diff --git a/backend/windmill-worker/src/js_eval.rs b/backend/windmill-worker/src/js_eval.rs index 30e620ab3a..d0e30d80a5 100644 --- a/backend/windmill-worker/src/js_eval.rs +++ b/backend/windmill-worker/src/js_eval.rs @@ -143,7 +143,6 @@ fn add_closing_bracket(s: &str) -> String { s } -const SPLIT_PAT: &str = ";"; async fn eval( context: &mut JsRuntime, expr: &str, @@ -151,21 +150,6 @@ async fn eval( by_id: Option, has_client: bool, ) -> anyhow::Result { - let exprs = expr - .trim() - .split(SPLIT_PAT) - .map(|x| x.trim()) - .filter(|x| !x.is_empty()) - .collect::>(); - let expr = if exprs.is_empty() { - "return undefined;".to_string() - } else { - format!( - "{};\n return {};", - exprs.iter().take(exprs.len() - 1).join(";\n"), - exprs.last().unwrap() - ) - }; let (api_code, by_id_code) = if has_client { let by_id_code = if let Some(by_id) = by_id { format!( @@ -238,7 +222,7 @@ async function resource(path) {{ {} {by_id_code} (async () => {{ - {expr} + return {expr}; }})() "#, env.into_iter() @@ -251,7 +235,6 @@ async function resource(path) {{ }) .join(""), ); - tracing::debug!("{}", code); let global = context.execute_script("", code.into())?; let global = context.resolve_value(global).await?; diff --git a/frontend/src/lib/components/InputTransformForm.svelte b/frontend/src/lib/components/InputTransformForm.svelte index b0fe54b5d9..47ceb2f4e3 100644 --- a/frontend/src/lib/components/InputTransformForm.svelte +++ b/frontend/src/lib/components/InputTransformForm.svelte @@ -196,7 +196,7 @@ > {#if isStaticTemplate(inputCat)} - the last line must always be the final expression. -

- If it is multiline, the statement before the final expression MUST END WITH ; and a newline -

+ Single javascript expression. The following functions and objects are available:
  • {'results.'}: the result of step at id 'id'
  • flow_input: the object containing the flow input arguments