Skip to content

API Summary2

ralphhanna edited this page Dec 18, 2023 · 1 revision

bpmn-server

API Summary Full Listing

Server Components

Other Components and Topics

engine:

The execution Engine , processes an BPMN definition - Engine

Method parameters return description
start name, input ExecutionContext - Start a new Process execution
invoke itemQuery ,input ExecutionContext Invoke an already started Item (waiting)
signal signalId,input ExecutionContext Issue a signal or message
get instanceQuery Instance Get an already running or idle Instance

examples:

    let response: executioncontext;
    let data = {};

    //  engine
    response = await bpmn.engine.start('SubProcess');
    response = await bpmn.engine.invoke(itemQuery, data);
    response = await bpmn.engine.signal(signalId, data);
    response = await bpmn.engine.startEvent(instanceQuery, 'elementId', data);
    response = await bpmn.engine.get(instanceQuery);

definitions

Manages BPMN defintions - Definitions

Method parameters return description
list - string[]
load name definition

datastore

Saves and retrievs Instances Data - DataStore

Method parameters return description
findInstances instanceQuery Instance[]
findItems itemQuery Item[]

cache

Caches running instances for performance - CacheManager

	list		id[]
	get			instance
	remove
	clear
	restart

cron

Manages background tasks, primarly timers - Cron

	start
	check
	stop

Data Query

The syntax follows MongoDB standards, since instance data is saved in the format of :

{
id;
name;
//.. other instance attributes
items: { // items here
    id;
    elementId;
    status;
    // items here
}
data: { // data attributes here}

}
the query syntax must be 
- instance attributes unqualified
- item attributes are qualified by 'items.<attributeName>'
- data attributes are qualified by 'data.<attributeName>'

Item Query

example will retrieve
{ "items.id": item.id } find items by id only - unique
{ id: instanceId, "items.elementId": item.elementId } find items by instance id and elementId
{"data.caseId": caseId ,"items.elementId" : item.elementId } find items by caseId and item elementId
{ id: instanceId, "items.status": 'wait' } check for items in "wait"
{"items.status": 'wait' } find all items that has "wait" status
        and('find items by item id only', async () => {

            query = { "items.id": item.id };
            items = await server.dataStore.findItems(query);
            checkItem(items, { id: item.id });
        });
        and('find items by instance and item elemetnId ', async () => {

            query = { id: instanceId, "items.elementId": item.elementId };
            items = await server.dataStore.findItems(query);
            checkItem(items, { id: item.id });
        });

        and('find items by caseId and item elementId ', async () => {

            query = {"data.caseId": caseId  ,"items.elementId" : item.elementId };
            items = await server.dataStore.findItems(query);
            checkItem(items, { id: item.id });
        });


        and('check for items "wait" ', async () => {

            query = { id: instanceId, "items.status": 'wait' };
            items = await server.dataStore.findItems(query);
            checkItem(items, { status: 'wait' });
      });

Instance Query

        and('find instance by instance id only', async () => {

            query = { id: response.execution.id };
            instances = await server.dataStore.findInstances(query);
            checkInstance(instances, { id: response.execution.id });

        });

        and('find instance by itemd id ', async () => {

            query = {"items.id": item.id };
            instances = await server.dataStore.findInstances(query);
            checkInstance(instances, { id: response.execution.id });

        });


        and('find instance by caseId', async () => {

            query = {
                data: { caseId: caseId }};
            instances = await server.dataStore.findInstances(query);
            checkInstance(instances, { id: response.execution.id  });

        });
  • configuration

  • AppDelegate

  • Event Listener

  • Data

Enumerations

Clone this wiki locally