Process automation for Node.js
###Best For
###Features
###Get Started
npm install process-engine
var ProcessEngine = require('process-engine');
// Create a process engine object
var processEngine = ProcessEngine.create();
var simpleDefinition = {
name: 'simple process',
tasks: {
start: {type: 'start'},
'service1': {type: 'service', action: function (variables, complete) {
console.log('do work');
complete();
}
},
end: {type: 'end'}
},
flows: [
{from: 'start', to: 'service1'},
{from: 'service1', to: 'end'}
]
};
// Create process instance from the above process definition
var processDefinition = processEngine.importProcessDefinition(simpleDefinition);
var processInstance = processEngine.createProcessInstance(processDefinition);
// Start the execution of the process instance
processInstance.start();
See examples/tests for all usage that process engine supports
###API
ProcessEngine
importProcessDefinition(definition)
: Create a new process definition based on definition
objectcreateProcessDefinition(name)
: Create an empty process definition with name
loadProcessDefinition(id)
: Load a process definition by id
queryProcessDefinition(conditions, options)
: Query process definitions by conditions and optionscreateProcessInstance(def)
: Create a new process instance with definition def
loadProcessInstance(id)
: Load a process instance by id
queryProcessInstance(conditions)
: Query process instances by conditionscompleteTask(processId, taskId, variables)
: Complete a task with processId
, taskId
, variables
ProcessInstance
is a Node event emitter. Events
before
: emitted before each task is executedafter
: emitted after each task is executedend
: emitted when the whole process instance is endedstart(variables)
: Start the process instance with given variables
getNode(taskName)
: Get the runtime node with taskName
HumanTaskService
complete(taskId, variables)
: Complete the human task taskId
with variables
claim(taskId, user)
: Claim the human task taskId
with User user
startWorking(taskId)
: Start to work on the human task taskId
query(conditions)
: Query the human tasks by conditions
###UI
process-engine.js contains a Node.js web application to manage the process instances and human task list.
ui
foldernpm install
bower install
npm install -g nodemon
brunch watch --server
to launch the serverhttp://localhost:3000/#/definitions
in your browser###Development
npm install -g mocha
npm install -g bower
npm install -g brunch
npm install -g istanbul
###Roadmap
Version | Tag | Published |
---|---|---|
0.5.3 | latest | 9yrs ago |