@workglow/tasks 0.0.57 → 0.0.59
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/index.js +11 -10
- package/dist/index.js.map +3 -3
- package/dist/task/JavaScriptTask.d.ts +8 -14
- package/dist/task/JavaScriptTask.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -4886,18 +4886,15 @@ Interpreter["Status"] = Interpreter.Status;
|
|
|
4886
4886
|
var inputSchema4 = {
|
|
4887
4887
|
type: "object",
|
|
4888
4888
|
properties: {
|
|
4889
|
-
|
|
4889
|
+
javascript_code: {
|
|
4890
4890
|
type: "string",
|
|
4891
4891
|
title: "Code",
|
|
4892
|
+
minLength: 1,
|
|
4892
4893
|
description: "JavaScript code to execute"
|
|
4893
|
-
},
|
|
4894
|
-
input: {
|
|
4895
|
-
title: "Input",
|
|
4896
|
-
description: "Input data to pass to the JavaScript code"
|
|
4897
4894
|
}
|
|
4898
4895
|
},
|
|
4899
|
-
required: ["
|
|
4900
|
-
additionalProperties:
|
|
4896
|
+
required: ["javascript_code"],
|
|
4897
|
+
additionalProperties: true
|
|
4901
4898
|
};
|
|
4902
4899
|
var outputSchema4 = {
|
|
4903
4900
|
type: "object",
|
|
@@ -4923,11 +4920,15 @@ class JavaScriptTask extends Task3 {
|
|
|
4923
4920
|
return outputSchema4;
|
|
4924
4921
|
}
|
|
4925
4922
|
async executeReactive(input2, output) {
|
|
4926
|
-
if (input2.
|
|
4923
|
+
if (input2.javascript_code) {
|
|
4927
4924
|
try {
|
|
4928
|
-
const
|
|
4925
|
+
const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code");
|
|
4926
|
+
const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
|
|
4927
|
+
`);
|
|
4928
|
+
const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
|
|
4929
4929
|
myInterpreter.run();
|
|
4930
4930
|
output.output = myInterpreter.value;
|
|
4931
|
+
console.log("output", output.output);
|
|
4931
4932
|
} catch (e) {
|
|
4932
4933
|
console.error("error", e);
|
|
4933
4934
|
}
|
|
@@ -5107,4 +5108,4 @@ export {
|
|
|
5107
5108
|
DebugLog
|
|
5108
5109
|
};
|
|
5109
5110
|
|
|
5110
|
-
//# debugId=
|
|
5111
|
+
//# debugId=A6D0603C966B101564756E2164756E21
|