Merge branch 'master' into vulnerability/budi-7793-ddos

This commit is contained in:
Adria Navarro 2024-01-02 17:03:55 +01:00 committed by GitHub
commit 49c672603b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -1,19 +1,26 @@
const externalHandlebars = require("./external")
const helperList = require("@budibase/handlebars-helpers")
let helpers = undefined
module.exports.getHelperList = () => {
if (helpers) {
return helpers
}
helpers = {}
let constructed = []
for (let collection of externalHandlebars.externalCollections) {
constructed.push(helperList[collection]())
}
const fullMap = {}
for (let collection of constructed) {
for (let [key, func] of Object.entries(collection)) {
fullMap[key] = func
helpers[key] = func
}
}
for (let key of Object.keys(externalHandlebars.addedHelpers)) {
fullMap[key] = externalHandlebars.addedHelpers[key]
helpers[key] = externalHandlebars.addedHelpers[key]
}
return fullMap
Object.freeze(helpers)
return helpers
}