Fix types
This commit is contained in:
parent
69ecf5183b
commit
7d6377fa14
|
@ -1 +0,0 @@
|
||||||
declare module "@budibase/handlebars-helpers"
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// @ts-ignore we don't have types for it
|
||||||
import helpers from "@budibase/handlebars-helpers"
|
import helpers from "@budibase/handlebars-helpers"
|
||||||
|
|
||||||
import { date, duration } from "./date"
|
import { date, duration } from "./date"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { atob, isBackendService, isJSAllowed } from "../utilities"
|
import { atob, isJSAllowed } from "../utilities"
|
||||||
import cloneDeep from "lodash/fp/cloneDeep"
|
import cloneDeep from "lodash/fp/cloneDeep"
|
||||||
import { LITERAL_MARKER } from "../helpers/constants"
|
import { LITERAL_MARKER } from "../helpers/constants"
|
||||||
import { getJsHelperList } from "./list"
|
import { getJsHelperList } from "./list"
|
||||||
|
|
||||||
// The method of executing JS scripts depends on the bundle being built.
|
// The method of executing JS scripts depends on the bundle being built.
|
||||||
// This setter is used in the entrypoint (either index.js or index.mjs).
|
// This setter is used in the entrypoint (either index.js or index.mjs).
|
||||||
let runJS: (js: string, context: any) => any
|
let runJS: ((js: string, context: any) => any) | undefined = undefined
|
||||||
export const setJSRunner = (runner: typeof runJS) => (runJS = runner)
|
export const setJSRunner = (runner: typeof runJS) => (runJS = runner)
|
||||||
|
|
||||||
export const removeJSRunner = () => {
|
export const removeJSRunner = () => {
|
||||||
|
@ -44,7 +44,7 @@ const getContextValue = (path: string, context: any) => {
|
||||||
|
|
||||||
// Evaluates JS code against a certain context
|
// Evaluates JS code against a certain context
|
||||||
export function processJS(handlebars: string, context: any) {
|
export function processJS(handlebars: string, context: any) {
|
||||||
if (!isJSAllowed() || (isBackendService() && !runJS)) {
|
if (!isJSAllowed() || !runJS) {
|
||||||
throw new Error("JS disabled in environment.")
|
throw new Error("JS disabled in environment.")
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue