Giter Club home page Giter Club logo

process-engine.js's Introduction

Process automation for Node.js

###Best For

  • Task Orchestration
  • Human Task Management
  • Process Management and Monitoring via a Node.js web application

###Features

  • Start/End/Decision/Parallel/Service/Human Task
  • Human Task Management
  • Process Definition Management and Visualization
  • Process Instance Management and Visualization

###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();

###Guide Process definition describes the workflow using tasks and flows. The built-in task types:

  • start: mark the start of process, must be the first task
  • end: mark the end of process.
  • service: automatic task type that execute any code in it
  • decision: Certain things can only be done under certain circumstances. The decision task is used to mark the fork and join of execution path
  • human: manual task type, they are assigned by engine, e.g. place it in the task list, the engine expect confirmation to continue the execution

The flow is something to connect the tasks and can take a condition function if the from task is decision task.

human task service is used to manipulate the task list.

See examples/tests for all usage that process engine supports

###API

  • ProcessEngine
    • importProcessDefinition(definition): Create a new process definition based on definition object
    • createProcessDefinition(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 options
    • createProcessInstance(def): Create a new process instance with definition def
    • loadProcessInstance(id): Load a process instance by id
    • queryProcessInstance(conditions): Query process instances by conditions
    • completeTask(processId, taskId, variables): Complete a task with processId, taskId, variables
  • ProcessInstance is a Node event emitter.
    • Events
      • before: emitted before each task is executed
      • after: emitted after each task is executed
      • end: emitted when the whole process instance is ended
    • start(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 image

process-engine.js contains a Node.js web application to manage the process instances and human task list.

  • Go to ui folder
  • Run npm install
  • Run bower install
  • Run npm install -g nodemon
  • Run brunch watch --server to launch the server
  • Open http://localhost:3000/#/definitions in your browser

###Development

  • Test Runner: npm install -g mocha
  • Front End Package Manager: npm install -g bower
  • Front End Build: npm install -g brunch
  • Code Coverage: npm install -g istanbul

###Roadmap

  • Planned
    • Process Diagram Designer via D3(SVG)
    • Human Task Form Builder
    • User Management Service
    • Performance Benchmark
  • Future
    • Message/Timer Event Support
    • Separate Running and Histronic Process Instances into different collections
    • Sub Process
    • BPMN 2.0 XML Import/Export

process-engine.js's People

Contributors

oliverzy avatar

Watchers

James Cloos avatar Frederic Michel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.