From 754f4864140e85f83ff3936119917eb641507237 Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 13 Mar 2025 09:41:39 +0000 Subject: [PATCH] Ensure values typed in the JS step node are properly converted. Allow multiple quote types for readable bindings --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 10 ++++++++-- packages/builder/src/dataBinding.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index eb8cdd27e3..43894302fd 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -56,7 +56,10 @@ memo, fetchData, } from "@budibase/frontend-core" - import { getSchemaForDatasourcePlus } from "@/dataBinding" + import { + getSchemaForDatasourcePlus, + readableToRuntimeBinding, + } from "@/dataBinding" import { TriggerStepID, ActionStepID } from "@/constants/backend/automations" import { onMount, createEventDispatcher } from "svelte" import { writable } from "svelte/store" @@ -1034,7 +1037,10 @@ {bindings} {schema} panel={AutomationBindingPanel} - on:change={e => onChange({ [key]: e.detail })} + on:change={e => + onChange({ + [key]: readableToRuntimeBinding(bindings, e.detail), + })} context={$memoContext} value={inputData[key]} /> diff --git a/packages/builder/src/dataBinding.js b/packages/builder/src/dataBinding.js index c6171c72a4..1011774ac5 100644 --- a/packages/builder/src/dataBinding.js +++ b/packages/builder/src/dataBinding.js @@ -37,7 +37,7 @@ const { ContextScopes } = Constants // Regex to match all instances of template strings const CAPTURE_VAR_INSIDE_TEMPLATE = /{{([^}]+)}}/g -const CAPTURE_VAR_INSIDE_JS = /\$\("([^")]+)"\)/g +const CAPTURE_VAR_INSIDE_JS = /\$\((["'`])([^"'`]+)\1\)/g const CAPTURE_HBS_TEMPLATE = /{{[\S\s]*?}}/g const UpdateReferenceAction = {