@things-factory/integration-base 6.0.142 → 6.0.143
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.
@@ -15,8 +15,7 @@ async function Script(step, context) {
|
|
15
15
|
variables
|
16
16
|
}
|
17
17
|
});
|
18
|
-
|
19
|
-
const result = vm.run(script);
|
18
|
+
const result = await vm.run(`return (async () => {\n${script}\n})()`);
|
20
19
|
return {
|
21
20
|
data: result
|
22
21
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../../server/engine/task/script.ts"],"names":[],"mappings":";;AAAA,oDAA+C;AAC/C,6BAA4B;AAE5B,KAAK,UAAU,MAAM,CAAC,IAAI,EAAE,OAAO;IACjC,IAAI,EACF,MAAM,EAAE,EAAE,MAAM,EAAE,EACnB,GAAG,IAAI,CAAA;IAER,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IAE3C,MAAM,EAAE,GAAG,IAAI,YAAM,CAAC;QACpB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE;YACP,MAAM;YACN,IAAI;YACJ,SAAS;SACV;KACF,CAAC,CAAA;IAEF,
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../../server/engine/task/script.ts"],"names":[],"mappings":";;AAAA,oDAA+C;AAC/C,6BAA4B;AAE5B,KAAK,UAAU,MAAM,CAAC,IAAI,EAAE,OAAO;IACjC,IAAI,EACF,MAAM,EAAE,EAAE,MAAM,EAAE,EACnB,GAAG,IAAI,CAAA;IAER,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IAE3C,MAAM,EAAE,GAAG,IAAI,YAAM,CAAC;QACpB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE;YACP,MAAM;YACN,IAAI;YACJ,SAAS;SACV;KACF,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,0BAA0B,MAAM,QAAQ,CAAC,CAAA;IAErE,OAAO;QACL,IAAI,EAAE,MAAM;KACb,CAAA;AACH,CAAC;AAED,MAAM,CAAC,aAAa,GAAG;IACrB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;KAChB;CACF,CAAA;AAED,MAAM,CAAC,aAAa,GAAG,IAAI,CAAA;AAC3B,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;AAEvC,4BAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import { TaskRegistry } from '../task-registry'\nimport { NodeVM } from 'vm2'\n\nasync function Script(step, context) {\n var {\n params: { script }\n } = step\n\n const { domain, data, variables } = context\n\n const vm = new NodeVM({\n timeout: 5000,\n wrapper: 'none',\n console: 'inherit',\n sandbox: {\n domain,\n data,\n variables\n }\n })\n\n const result = await vm.run(`return (async () => {\\n${script}\\n})()`)\n\n return {\n data: result\n }\n}\n\nScript.parameterSpec = [\n {\n type: 'textarea',\n name: 'script',\n label: 'script'\n }\n]\n\nScript.connectorFree = true\nScript.help = 'integration/task/script'\n\nTaskRegistry.registerTaskHandler('script', Script)\n"]}
|