
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
workflow-executor
Advanced tools
A flexible and powerful workflow engine for automating complex processes.
WorkflowExecutor is a flexible and powerful workflow engine designed to automate complex processes with ease. Whether you're building a simple decision tree or a complex multi-step process, WorkflowExecutor provides the tools you need to get the job done.
To install WorkflowExecutor, use npm:
npm install workflow-executor
const WorkflowExecutor = require('workflow-executor');
const workflow = {
start: 'step1',
steps: {
step1: {
action: 'action1',
transitions: {
true: 'step2',
false: 'step3'
},
conditions: {
key: 'someKey',
operator: 'equals',
value: 'someValue'
}
},
step2: {
action: 'action2',
transitions: {
next: 'step4'
}
},
step3: {
action: 'action3',
transitions: {
next: 'step4'
}
},
step4: {
action: 'action4',
transitions: {
next: null
}
}
}
};
const actions = {
async action1(context) {
console.log("Performing action1");
return context;
},
async action2(context) {
console.log("Performing action2");
return context;
},
async action3(context) {
console.log("Performing action3");
return context;
},
async action4(context) {
console.log("Performing action4");
return context;
}
};
const context = {
someKey: 'someValue'
};
const executor = new WorkflowExecutor(workflow, actions, { loggingEnabled: true });
executor.execute(context).then(() => {
console.log('Workflow execution completed.');
}).catch(error => {
console.error('Workflow execution failed:', error);
});
// Define a sample workflow blueprint for an e-commerce order process
const orderWorkflow = {
start: 'checkInventory',
steps: {
checkInventory: {
action: 'checkInventoryAction',
transitions: {
true: 'processPayment',
false: 'outOfStock'
},
conditions: {
key: 'inventoryAvailable',
operator: 'equals',
value: true
}
},
processPayment: {
action: 'processPaymentAction',
transitions: {
true: 'shipOrder',
false: 'paymentFailed'
},
conditions: {
key: 'paymentSuccessful',
operator: 'equals',
value: true
}
},
outOfStock: {
action: 'outOfStockAction',
transitions: {
next: null
}
},
paymentFailed: {
action: 'paymentFailedAction',
transitions: {
next: null
}
},
shipOrder: {
action: 'shipOrderAction',
transitions: {
next: null
}
}
}
};
// Define actions as methods for the order workflow
const orderActions = {
async checkInventoryAction(context) {
console.log("Checking inventory");
context.inventoryAvailable = true;
return context;
},
async processPaymentAction(context) {
console.log("Processing payment");
context.paymentSuccessful = true;
return context;
},
async outOfStockAction(context) {
console.log("Order cannot be processed: Out of stock");
return context;
},
async paymentFailedAction(context) {
console.log("Payment failed");
return context;
},
async shipOrderAction(context) {
console.log("Shipping order");
return context;
}
};
const orderContext = {
inventoryAvailable: false,
paymentSuccessful: false
};
const orderExecutor = new WorkflowExecutor(orderWorkflow, orderActions, { loggingEnabled: true });
orderExecutor.execute(orderContext).then(() => {
console.log('Order workflow execution completed.');
}).catch(error => {
console.error('Order workflow execution failed:', error);
});
The WorkflowExecutor uses a JSON-based schema to define workflows. This schema consists of several key components:
Start: The initial step of the workflow. This is where execution begins.
Steps: A collection of steps that define the actions and transitions within the workflow. Each step includes:
WorkflowExecutor.Here's an example of a simple workflow schema:
{
"start": "step1",
"steps": {
"step1": {
"action": "action1",
"transitions": {
"value1": "step2",
"value2": "step3"
},
"conditions": {
"key": "someKey",
"operator": "return_value"
}
},
"step2": {
"action": "action2",
"transitions": {
"next": null
}
},
"step3": {
"action": "action3",
"transitions": {
"next": null
}
}
}
}
return_value.equals, greater_than, and return_value.This schema allows for flexible and dynamic workflows, enabling complex decision-making processes to be automated efficiently.
FAQs
A flexible and powerful workflow engine for automating complex processes.
We found that workflow-executor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.