1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

Fix types

This commit is contained in:
Adria Navarro 2024-03-15 13:01:33 +01:00
parent 69ecf5183b
commit 7d6377fa14
3 changed files with 4 additions and 4 deletions

View file

@ -1 +0,0 @@
declare module "@budibase/handlebars-helpers"

View file

@ -1,3 +1,4 @@
// @ts-ignore we don't have types for it
import helpers from "@budibase/handlebars-helpers"
import { date, duration } from "./date"

View file

@ -1,11 +1,11 @@
import { atob, isBackendService, isJSAllowed } from "../utilities"
import { atob, isJSAllowed } from "../utilities"
import cloneDeep from "lodash/fp/cloneDeep"
import { LITERAL_MARKER } from "../helpers/constants"
import { getJsHelperList } from "./list"
// 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).
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 removeJSRunner = () => {
@ -44,7 +44,7 @@ const getContextValue = (path: string, context: any) => {
// Evaluates JS code against a certain context
export function processJS(handlebars: string, context: any) {
if (!isJSAllowed() || (isBackendService() && !runJS)) {
if (!isJSAllowed() || !runJS) {
throw new Error("JS disabled in environment.")
}
try {