Skip to content

bpmn-server

bpmn-server#

Table of contents#

Enumerations#

Classes#

Interfaces#

Type Aliases#

Variables#

Functions#

Type Aliases#

InstanceLockerOptions#

Ƭ InstanceLockerOptions: Object

Type declaration#

Name Type Description
database string The logical database (MongoDB's db name).
collection? string -
owner? string This process's identity as an owner; default SERVER_ID, else host, process id and a random suffix.
retryDelay? number Milliseconds between tries.
maxTries? number Tries before lock gives up.
staleAfter? number Milliseconds after which a lock or claim is stale: its owner is presumed gone and another may take it.
logger? { log: (...m: any[]) => any ; warn?: (...m: any[]) => any } -
logger.log [object Object] -
logger.warn? [object Object] -

Defined in#

packages/bpmn-server/src/datastore/InstanceLocker.ts:8


DMNOptions#

Ƭ DMNOptions: Object

Type declaration#

Name Type
debug? boolean
log? (message: string) => void

Defined in#

packages/bpmn-server/src/dmn/DMNEngine.ts:18


FoundDecision#

Ƭ FoundDecision: Object

Where a decision was found.

Type declaration#

Name Type
filePath string
definitions DMNDefinitions
decision Decision

Defined in#

packages/bpmn-server/src/dmn/DMNEngine.ts:21


InputClause#

Ƭ InputClause: Object

Type declaration#

Name Type
id string
label string
expression string
typeRef string
values? string

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:12


OutputClause#

Ƭ OutputClause: Object

Type declaration#

Name Type
id string
name string
label string
typeRef string
values? string

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:13


Rule#

Ƭ Rule: Object

Type declaration#

Name Type
id string
description string
inputEntries string[]
outputEntries string[]

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:14


DecisionTable#

Ƭ DecisionTable: Object

Type declaration#

Name Type
hitPolicy string
aggregation? string
inputs InputClause[]
outputs OutputClause[]
rules Rule[]

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:16


Decision#

Ƭ Decision: Object

Type declaration#

Name Type
id string
name string
requires string[]
table? DecisionTable
literal? { text: string ; variable: string ; typeRef: string }
literal.text string
literal.variable string
literal.typeRef string

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:24


DMNDefinitions#

Ƭ DMNDefinitions: Object

Type declaration#

Name Type
id string
name string
decisions Decision[]

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:32


DMNIssue#

Ƭ DMNIssue: Object

A problem found in a DMN file: where it is and what is wrong.

Type declaration#

Name Type
decisionId? string
ruleId? string
ruleIndex? number
message string

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:35


ModelIssueSeverity#

Ƭ ModelIssueSeverity: "error" | "warning" | "info"

Static verification of a BPMN model: reports what would stop the engine from loading or running it (errors) and what is likely a modelling mistake (warnings), without starting it.

 const result = await verifyModel(xml, server);
 if (!result.valid) result.issues.filter(i => i.severity == 'error').forEach(i => console.log(i.message));

Defined in#

packages/bpmn-server/src/elements/verifyModel.ts:23


ScriptContext#

Ƭ ScriptContext: Record\<string, (scope: { data: any }) => any>

A variable scripts see besides their own: its value, from a copy of the data (so it can not change the process's).

Defined in#

packages/bpmn-server/src/engine/ScriptHandler.ts:15


LifecycleNotification#

Ƭ LifecycleNotification: Object

Internal engine lifecycle notifications: what happened to an execution (process.start, wait, end, …: the EXECUTION_EVENT names), distinct from BPMN events (messages, signals, timers, which the engine correlates itself) and from an application's business events.

Delivery: in order, awaited, after the engine's own listeners and the application delegate. A subscriber's failure is reported to the server's logger and does not abort the execution or reach the other subscribers: a subscriber that must not miss a notification records it durably itself (an outbox) and treats a repeat as a duplicate (item.id with the event identifies it).

Type declaration#

Name Type Description
type string The event's name (an EXECUTION_EVENT value).
context any The execution it happened to.
details? unknown -

Defined in#

packages/bpmn-server/src/interfaces/lifecycle.ts:11


IUpgradeOutcome#

Ƭ IUpgradeOutcome: "upgraded" | "would-upgrade" | "current" | "ended" | "stranded" | "busy" | "failed"

What upgradeRunning did with an instance.

Defined in#

packages/bpmn-server/src/interfaces/server.ts:146


StorageQuery#

Ƭ StorageQuery: Record\<string, any>

The storage ports: what the engine's persistence components (the instance DataStore, the models datastore and the instance locker) need from a database, so that MongoDB is one adapter among others (an in-memory store; an application's PostgreSQL) and no engine code changes with it.

Documents are plain JSON objects. Queries, updates, projections and sorts use the subset of MongoDB's query language the engine issues (equality, dotted paths into arrays, $elemMatch, $or, $nor, $and, $exists, $eq, $ne, $in, $nin, $lt, $lte, $gt, $gte; $set and whole-document updates, with upsert); an adapter that cannot evaluate a query refuses it, never ignores part of it.

Defined in#

packages/bpmn-server/src/interfaces/storage.ts:12


StorageProjection#

Ƭ StorageProjection: Record\<string, 0 | 1 | any> | null

Defined in#

packages/bpmn-server/src/interfaces/storage.ts:13


StorageSort#

Ƭ StorageSort: Record\<string, 1 | -1> | null

Defined in#

packages/bpmn-server/src/interfaces/storage.ts:14

Variables#

SystemUser#

• Const SystemUser: SecureUser

Defined in#

packages/bpmn-server/src/API/SecureUser.ts:239


defaultConfiguration#

• Const defaultConfiguration: Configuration

Defined in#

packages/bpmn-server/src/common/DefaultConfiguration.ts:98


HTTP_METHODS#

• Const HTTP_METHODS: string[]

Defined in#

packages/bpmn-server/src/connectors/OpenAPI.ts:7


HIT_POLICIES#

• Const HIT_POLICIES: string[]

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:37


Behaviour_names#

• Const Behaviour_names: Object

Type declaration#

Name Type
TimerEventDefinition string
LoopCharacteristics string
IOSpecification string
TerminateEventDefinition string
MessageEventDefinition string
SignalEventDefinition string
ErrorEventDefinition string
EscalationEventDefinition string
CancelEventDefinition string
CompensateEventDefinition string
CamundaFormData string
CamundaScript string
CamundaScript2 string
CamundaScript3 string
CamundaIO string
CamundaConnector string

Defined in#

packages/bpmn-server/src/elements/behaviours/BehaviourLoader.ts:22

Functions#

dateDiff#

▸ dateDiff(dateStr): string

Parameters#

Name Type
dateStr any

Returns#

string

Defined in#

packages/bpmn-server/src/common/timer.ts:4


parseDocument#

▸ parseDocument(text): any

A document from text: JSON, else YAML. Refuses what is not OpenAPI 3.x, and a $ref to another file. The document is returned as it is written: its $refs are resolved when it is read (listOperations), never stored resolved (that copies each shared schema wherever it is used: GitHub's 11 MB document becomes 50).

Parameters#

Name Type
text string | object

Returns#

any

Defined in#

packages/bpmn-server/src/connectors/OpenAPI.ts:37


refResolver#

▸ refResolver(document): (value: any) => any

A resolver of the document's local $refs (#/components/...): what a value is with each reference replaced by what it points to. Each target is resolved once and shared by every place that refers to it (a recursive schema refers back to itself), so resolving costs what the document is, however often its schemas are used.

Parameters#

Name Type
document any

Returns#

fn

▸ (value): any

Parameters#
Name Type
value any
Returns#

any

Defined in#

packages/bpmn-server/src/connectors/OpenAPI.ts:79


resolveRefs#

▸ resolveRefs(document): any

The document with its references resolved (shared: see refResolver).

Parameters#

Name Type
document any

Returns#

any

Defined in#

packages/bpmn-server/src/connectors/OpenAPI.ts:126


listOperations#

▸ listOperations(document): Object

Every operation of the document that has an operationId, by it; skipped lists those that have none.

Parameters#

Name Type
document any

Returns#

Object

Name Type
operations Map\<string, Operation>
skipped string[]

Defined in#

packages/bpmn-server/src/connectors/OpenAPI.ts:138


canEncrypt#

▸ canEncrypt(): boolean

Whether keys can be stored: CONNECTORS_KEY is set.

Returns#

boolean

Defined in#

packages/bpmn-server/src/connectors/Secrets.ts:17


databaseName#

▸ databaseName(dbConfig): string

The database a MongoDB configuration means: its db, else the database named in db_url's path, else test — the one the MongoDB driver itself uses when client.db() is given no name. Naming it lets every component use the same database: without it the instance, archive and model collections followed the driver while the lock manager used the literal 'bpmn', so locks were kept in a database of their own.

Parameters#

Name Type
dbConfig Object
dbConfig.db? string
dbConfig.db_url? string

Returns#

string

Defined in#

packages/bpmn-server/src/datastore/MongoDB.ts:20


feelParses#

▸ feelParses(source, unary): boolean

The FEEL text parses: as unary tests (an input cell) or as an expression.

Parameters#

Name Type
source string
unary boolean

Returns#

boolean

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:173


legacyTest#

▸ legacyTest(source): string

Input cells written for bpmn-server's earlier evaluator: == 5 and != 5 are FEEL 5 and not(5).

Parameters#

Name Type
source string

Returns#

string

Defined in#

packages/bpmn-server/src/dmn/DMNParser.ts:189


label#

▸ label(element): string

An element in a decision's words: 'Name' (Id), or Id.

Parameters#

Name Type
element any

Returns#

string

Defined in#

packages/bpmn-server/src/elements/Flow.ts:15


valuesRead#

▸ valuesRead(expression, data): string

The values of the data an expression reads (data.x, $data.x.y, item.data.z): "x=1, y=\"a\"".

Parameters#

Name Type
expression any
data any

Returns#

string

Defined in#

packages/bpmn-server/src/elements/Flow.ts:18


verifyModel#

▸ verifyModel(source, server?, name?, options?): Promise\<IModelVerification>

Verifies a BPMN model's XML. Pass the server to also check services and called models against the application; without it only the model itself is checked.

Parameters#

Name Type Default value
source string undefined
server? IBPMNServer undefined
name string 'model'
options? IVerifyOptions undefined

Returns#

Promise\<IModelVerification>

Defined in#

packages/bpmn-server/src/elements/verifyModel.ts:642


formatDecision#

▸ formatDecision(d): string

A decision as a block:

seq: 3   flow 'repair' (flow_gw1_repair)
action: taken
why:
    condition
        (item.data.needsRepairs=="Yes") || item.data.needsRepairs
    result: true (needsRepairs="Yes")

Parameters#

Name Type
d ExecutionDecision

Returns#

string

Defined in#

packages/bpmn-server/src/engine/Execution.ts:867


runSandboxed#

▸ runSandboxed(values, body, options?): Promise\<{ result: any ; back: any ; calls: string[] }>

Runs a function body in QuickJS with values as its variables (JSON copies). appServices and appUtils are there too: calling one of their methods returns undefined and is listed in calls, or, given services, runs it. Returns the body's value and returned (an expression over the variables, default all of them) as JSON. Throws the script's error, or a time-limit error. The time limit is the script's own: not what it waits for a service.

Parameters#

Name Type Description
values Record\<string, any> -
body string -
options Object -
options.name? string -
options.timeLimit? number -
options.memoryLimit? number -
options.log? (text: string) => void -
options.self? string an expression: this in the body
options.prelude? string statements run before the body
options.returned? string an expression: what comes back of the variables
options.services? Object what calling appServices.x and appUtils.x runs
options.services.appServices? any -
options.services.appUtils? any -

Returns#

Promise\<{ result: any ; back: any ; calls: string[] }>

Defined in#

packages/bpmn-server/src/engine/SandboxScriptHandler.ts:74


executionResult#

▸ executionResult(execution): IExecutionResult

What an engine call answers from outside the engine: a JSON copy of where the instance stands, shaped as an execution was read (.id, .status, .instance, with instance.items and instance.tokens). Nothing in it reaches a running process, and it can cross a network as it is.

Parameters#

Name Type
execution any

Returns#

IExecutionResult

Defined in#

packages/bpmn-server/src/server/EngineService.ts:14


engineCalls#

▸ engineCalls(server): Record\<string, (...args: any[]) => Promise\<any>>

Everything outside the engine can ask of it, each answering data. It is the whole door, in this process or over the network: what is not here can't be asked.

Parameters#

Name Type
server BPMNServer

Returns#

Record\<string, (...args: any[]) => Promise\<any>>

Defined in#

packages/bpmn-server/src/server/EngineService.ts:54


startEngineService#

▸ startEngineService(server, «destructured»): Promise\<http.Server>

Serves engineCalls to the one who launched the server: POST /engine/call { method, args }, with the key in x-engine-key. Private: it listens on this machine alone unless told otherwise, and no one but the host is to reach it. calls adds to what can be asked (bpmn-web's tests): they run in here, and answer data as the rest do.

Parameters#

Name Type Default value
server BPMNServer undefined
«destructured» Object undefined
› port? number 3001
› host? string '127.0.0.1'
› key string undefined
› calls? (server: BPMNServer) => Record\<string, (...args: any[]) => Promise\<any>> undefined

Returns#

Promise\<http.Server>

Defined in#

packages/bpmn-server/src/server/EngineService.ts:119

Comments