vm2-script-executor
v0.1.2
Published
Script executor for NodeJS using vm2
Downloads
2
Readme
Node vm2 Script Executor for neo-bpmn-engine
This module is an optional dependency for neo-bpmn-engine
to execute javascript on NodeJS vm2 with security against quitting the process. Note however that the process can still be stalled using while(true) { }
.
npm install neo-bpmn-vm2-script-exec
To add the executor to the Engine,
import * as Engine from `neo-bpmn-engine`;
import createScriptExecutor from `neo-bpmn-vm2-script-exec`;
// Make sure its NodeJS env and set the executor
if (typeof window === 'undefined') {
const options = { }; // refer vm2 docs for options
Engine.provideScriptExecutor( createScriptExecutor(options) );
}
We only vm2 option that is overridden is, wrapper
with a value ''
, since the BPMN expects the script to return a promise.