1.6.12 • Published 6 years ago

@yape/engine v1.6.12

Weekly downloads
2
License
Apache-2.0
Repository
-
Last release
6 years ago

npm.io

yape

Build Status Test Coverage Maintainability

Yape, like in "yet another process engine" or "your adaptable process engine" is a JavaScript BPMN workflow execution engine.

Goals

  • Everything needs to be extensible. (Plugins)
  • Vendor independent. (Understands various modeler's properties through plugins)
  • Run in the browser and in node. (Browserify)
  • Every variable value can also be a function which when executed returns 'the value' to use.
  • Needs to be able to execute a BPMN 2.0 workflow. (BPMN conformance)
  • Be safe.
  • Try to be fast.
  • Optionally spawn child processes (on node) or workers (in the browser) to optimize the execution of the flow. (not sure yet)

Install and use

First, install using npm or yarn

$ npm install @yape/engine --save

Then use yape in your Node.JS or in the browser.

To start a processInstance
const Yape = require('@yape/engine');

// Instantiate an engine
const yape = new Yape();

// Create a new process instance, specify a valid bpmn definition (returns a token)
const token = await yape
  .createProcessInstance({
    workflowDefinition: 'valid bpmn'
  }).catch(console.error);

// Tell the initial token to continue execution
await token.exec().catch(console.error);
To continue execution of a processInstance (by token)
// At some later point in time, in a different part of
// your app (e.g. when a User task is handled as complete by your own app)
const token = await yape.continueTokenInstance({
  tokenId: '<id of the token you want to execute>',
  // set the payload you want to merge into the existing payload
  payload: {}
});

await token.exec().catch(console.error);

Currently supported flow objects

Events:

  • Start
  • End
  • IntermediateThrow
  • MessageIntermediateThrow
  • MessageIntermediateCatch
  • MessageEnd
  • TimerIntermediateCatch
  • EscalationIntermediateThrow
  • EscalationEnd
  • ErrorEnd
  • ConditionalIntermediateThrow
  • LinkIntermediateCatch
  • LinkIntermediateThrow
  • CompensationIntermediateThrow
  • CompensationEnd
  • SignalIntermediateThrow
  • SignalIntermediateCatch
  • MessageStart
  • TimerStart
  • ConditionalStart
  • SignalStart
  • SignalEnd
  • TerminateEnd

Activities:

  • Task
  • Service
  • User
  • Manual
  • Send
  • Receive
  • BusinessRule
  • Script

Gateways:

  • Exclusive
  • Inclusive
  • Parallel
  • EventBased
  • Complex

Other:

  • Swimlanes
  • CallActivity
  • SubProcess
  • Loop
  • ParallelMultiInstance
  • SequentialMultiInstance

Develop Yape

...

Develop plugins

Currently you can develop plugins for the following elements:

  • Element
  • FlowObject
  • Activity
  • UserTask
  • ServiceTask

You create plugins by extending from one of the above classes and instantiating a class into the plugins array when creating the engine.

const Yape = require('@yape/engine');

class History extends Yape.Plugins.Element {
  constructor({ store = [] } = {}) {
    super();
    this.store = store;
  }

  onReady = definition => {
    this.store.push({ state: 'ready', elementId: definition.id });
  };
  onActive = definition => {
    this.store.push({ state: 'active', elementId: definition.id });
  };
  onComplete = definition => {
    this.store.push({ state: 'complete', elementId: definition.id });
  };
}

const history = new History();

const yape = new Yape({ plugins: [history] });

The above plugin will push executed elements' id's into an array, which serves as some kind of log.

Plugin methods

Every plugin can make use of three methods which will be called in order of execution, onReady, onActive and onComplete.

Method arguments

Methods receive the definition (as a moddle reference) of the current activity and the processInstance (including its .payload) as arguments. Read more about creating plugins here (... link missing...).

1.6.12

6 years ago

1.6.11

6 years ago

1.6.10

6 years ago

1.6.9

6 years ago

1.6.8

6 years ago

1.6.7

6 years ago

1.6.6

6 years ago

1.6.5

6 years ago

1.6.4

6 years ago

1.6.3

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.3.2001

6 years ago

1.3.2000

6 years ago

1.3.1

6 years ago

1.3.0-alpha.4

6 years ago

1.3.0-alpha.3

6 years ago

1.3.0-alpha.2

6 years ago

1.3.0-alpha.1

6 years ago

1.2.10

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.14

6 years ago

1.1.13

6 years ago

1.1.12

6 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.46

6 years ago

1.0.45

6 years ago

1.0.44

6 years ago

1.0.43

6 years ago

1.0.42

6 years ago

1.0.41

6 years ago

1.0.40

6 years ago

1.0.39

6 years ago

1.0.38

6 years ago

1.0.37

6 years ago

1.0.36

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.10

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1-alpha.2

6 years ago

0.0.1-alpha.1

6 years ago