@budibase/string-templates 2.13.46 → 2.13.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.mjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -1
- package/manifest.json +8 -0
- package/package.json +3 -3
- package/src/helpers/external.js +1 -0
- package/src/helpers/javascript.js +3 -1
- package/src/index.cjs +1 -0
- package/src/index.js +3 -0
- package/src/index.mjs +1 -1
package/dist/index.d.cts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { isValid, makePropSafe, getManifest, isJSBinding, encodeJSBinding, decodeJSBinding, processStringSync, processObjectSync, processString, processObject, doesContainStrings, doesContainString, disableEscaping, findHBSBlocks, convertToJS, FIND_ANY_HBS_REGEX };
|
1
|
+
export { isValid, makePropSafe, getManifest, isJSBinding, encodeJSBinding, decodeJSBinding, processStringSync, processObjectSync, processString, processObject, doesContainStrings, doesContainString, disableEscaping, findHBSBlocks, convertToJS, setJSRunner, FIND_ANY_HBS_REGEX };
|
package/dist/index.d.mts
CHANGED
@@ -16,4 +16,5 @@ export const doesContainString: (template: string, string: string) => boolean;
|
|
16
16
|
export const disableEscaping: (string: any) => any;
|
17
17
|
export const findHBSBlocks: (string: string) => string[];
|
18
18
|
export const convertToJS: (hbs: any) => string;
|
19
|
+
export const setJSRunner: (runner: any) => any;
|
19
20
|
export const FIND_ANY_HBS_REGEX: RegExp;
|
package/dist/index.d.ts
CHANGED
@@ -13,5 +13,5 @@ export function doesContainStrings(template: string, strings: string[]): boolean
|
|
13
13
|
export function findHBSBlocks(string: string): string[];
|
14
14
|
export function doesContainString(template: string, string: string): boolean;
|
15
15
|
export function convertToJS(hbs: any): string;
|
16
|
-
export { FIND_ANY_HBS_REGEX };
|
17
16
|
import { FIND_ANY_HBS_REGEX } from "./utilities";
|
17
|
+
export { setJSRunner, FIND_ANY_HBS_REGEX };
|
package/manifest.json
CHANGED
@@ -1180,6 +1180,14 @@
|
|
1180
1180
|
"description": "<p>Stringify an object using <code>JSON.stringify</code>.</p>\n"
|
1181
1181
|
}
|
1182
1182
|
},
|
1183
|
+
"uuid": {
|
1184
|
+
"uuid": {
|
1185
|
+
"args": [],
|
1186
|
+
"numArgs": 0,
|
1187
|
+
"example": "{{ uuid }} -> f34ebc66-93bd-4f7c-b79b-92b5569138bc",
|
1188
|
+
"description": "<p>Generates a UUID, using the V4 method (identical to the browser crypto.randomUUID function).</p>\n"
|
1189
|
+
}
|
1190
|
+
},
|
1183
1191
|
"date": {
|
1184
1192
|
"date": {
|
1185
1193
|
"args": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@budibase/string-templates",
|
3
|
-
"version": "2.13.
|
3
|
+
"version": "2.13.47",
|
4
4
|
"description": "Handlebars wrapper for Budibase templating.",
|
5
5
|
"main": "src/index.cjs",
|
6
6
|
"module": "dist/bundle.mjs",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"manifest": "node ./scripts/gen-collection-info.js"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"@budibase/handlebars-helpers": "^0.11.
|
28
|
+
"@budibase/handlebars-helpers": "^0.11.11",
|
29
29
|
"dayjs": "^1.10.8",
|
30
30
|
"handlebars": "^4.7.6",
|
31
31
|
"lodash": "4.17.21",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"rollup-plugin-terser": "^7.0.2",
|
46
46
|
"typescript": "5.2.2"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "92c519aa049b4834446896c4421ce59bad55b19e"
|
49
49
|
}
|
package/src/helpers/external.js
CHANGED
@@ -56,10 +56,12 @@ module.exports.processJS = (handlebars, context) => {
|
|
56
56
|
const res = { data: runJS(js, sandboxContext) }
|
57
57
|
return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}`
|
58
58
|
} catch (error) {
|
59
|
-
console.log(`JS error: ${typeof error} ${JSON.stringify(error)}`)
|
60
59
|
if (error.code === "ERR_SCRIPT_EXECUTION_TIMEOUT") {
|
61
60
|
return "Timed out while executing JS"
|
62
61
|
}
|
62
|
+
if (error.name === "ExecutionTimeoutError") {
|
63
|
+
return "Request JS execution limit hit"
|
64
|
+
}
|
63
65
|
return "Error while executing JS"
|
64
66
|
}
|
65
67
|
}
|
package/src/index.cjs
CHANGED
@@ -18,6 +18,7 @@ module.exports.doesContainString = templates.doesContainString
|
|
18
18
|
module.exports.disableEscaping = templates.disableEscaping
|
19
19
|
module.exports.findHBSBlocks = templates.findHBSBlocks
|
20
20
|
module.exports.convertToJS = templates.convertToJS
|
21
|
+
module.exports.setJSRunner = templates.setJSRunner
|
21
22
|
module.exports.FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
22
23
|
|
23
24
|
if (!process.env.NO_JS) {
|
package/src/index.js
CHANGED
@@ -9,6 +9,7 @@ const {
|
|
9
9
|
findDoubleHbsInstances,
|
10
10
|
} = require("./utilities")
|
11
11
|
const { convertHBSBlock } = require("./conversion")
|
12
|
+
const javascript = require("./helpers/javascript")
|
12
13
|
|
13
14
|
const hbsInstance = handlebars.create()
|
14
15
|
registerAll(hbsInstance)
|
@@ -362,6 +363,8 @@ module.exports.doesContainString = (template, string) => {
|
|
362
363
|
return exports.doesContainStrings(template, [string])
|
363
364
|
}
|
364
365
|
|
366
|
+
module.exports.setJSRunner = javascript.setJSRunner
|
367
|
+
|
365
368
|
module.exports.convertToJS = hbs => {
|
366
369
|
const blocks = exports.findHBSBlocks(hbs)
|
367
370
|
let js = "return `",
|
package/src/index.mjs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import vm from "vm"
|
2
2
|
import templates from "./index.js"
|
3
|
-
import { setJSRunner } from "./helpers/javascript"
|
4
3
|
|
5
4
|
/**
|
6
5
|
* ES6 entrypoint for rollup
|
@@ -20,6 +19,7 @@ export const doesContainString = templates.doesContainString
|
|
20
19
|
export const disableEscaping = templates.disableEscaping
|
21
20
|
export const findHBSBlocks = templates.findHBSBlocks
|
22
21
|
export const convertToJS = templates.convertToJS
|
22
|
+
export const setJSRunner = templates.setJSRunner
|
23
23
|
export const FIND_ANY_HBS_REGEX = templates.FIND_ANY_HBS_REGEX
|
24
24
|
|
25
25
|
if (process && !process.env.NO_JS) {
|