Workflow History
Workflow History is an extension to FSM Core. It provides server-side API for storing and extracting Business Object lifecycle history.
Installation
Install package
npm install --save-prod @opuscapita/fsm-workflow-history
Basic Usage
// Run migrations and initiate an instance of FSM Workflow History.const history = await sequelize;
history is JavaScript object with the following structure/interface:
// add history record async ... return <History Record>; // search for history record async ... return <History Record> ... ; // delete history record async delete businessObjType: <string> businessObjId: <string> ... return <deleted records number>;
History Record is JavaScript object with values from DB:
Column | Type | Required | Notes |
---|---|---|---|
id | integer | true | autogenerated id |
from | string | true | |
to | string | true | |
event | string | true | |
businessObjType | string | true | example: 'invoice' |
businessObjId | string | true | example: '123456789' |
user | string | true | user initiated a transition |
workflowName | string | true | unique workflow name, known by workflow machine |
description | string | false | event/object/trsnaition information |
finishedOn | timestamp | true | like in Grailsflow, object finished the transition in 'to' state |
See Express Server Demo for an example of using Workflow History.