bpmn-engine 26.0.1 → 26.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +14 -14
- package/package.json +11 -10
- package/src/index.js +14 -14
- package/types/index.d.ts +20 -15
- package/types/interfaces.d.ts +0 -80
package/lib/index.cjs
CHANGED
|
@@ -177,7 +177,7 @@ const kTypeResolver = Symbol.for('type resolver');
|
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* BPMN 2.0 execution engine.
|
|
180
|
-
* @param {import('
|
|
180
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [options]
|
|
181
181
|
*/
|
|
182
182
|
function Engine(options) {
|
|
183
183
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
@@ -266,7 +266,7 @@ Object.defineProperties(Engine.prototype, {
|
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
268
|
* Execute the loaded definitions.
|
|
269
|
-
* @param {import('
|
|
269
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
270
270
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
271
271
|
* @returns {Promise<Execution>}
|
|
272
272
|
*/
|
|
@@ -292,8 +292,8 @@ Engine.prototype.stop = function stop() {
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
294
|
* Recover engine from saved state.
|
|
295
|
-
* @param {import('
|
|
296
|
-
* @param {import('
|
|
295
|
+
* @param {import('bpmn-engine').BpmnEngineExecutionState | null} savedState
|
|
296
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [recoverOptions]
|
|
297
297
|
* @returns {Engine}
|
|
298
298
|
*/
|
|
299
299
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
@@ -343,7 +343,7 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
* Resume execution from a previously recovered state.
|
|
346
|
-
* @param {import('
|
|
346
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
347
347
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
348
348
|
* @returns {Promise<Execution>}
|
|
349
349
|
*/
|
|
@@ -370,7 +370,7 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
372
|
* Add a pre-serialized source context to the engine.
|
|
373
|
-
* @param {{ sourceContext: import('
|
|
373
|
+
* @param {{ sourceContext: import('moddle-context-serializer').SerializableContext }} [options]
|
|
374
374
|
*/
|
|
375
375
|
Engine.prototype.addSource = function addSource(options) {
|
|
376
376
|
if (!options?.sourceContext) return;
|
|
@@ -380,7 +380,7 @@ Engine.prototype.addSource = function addSource(options) {
|
|
|
380
380
|
};
|
|
381
381
|
|
|
382
382
|
/**
|
|
383
|
-
* @param {import('
|
|
383
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [executeOptions]
|
|
384
384
|
* @returns {Promise<import('bpmn-elements').Definition[]>}
|
|
385
385
|
*/
|
|
386
386
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -397,7 +397,7 @@ Engine.prototype.getDefinitionById = async function getDefinitionById(id) {
|
|
|
397
397
|
return (await this.getDefinitions()).find((d) => d.id === id);
|
|
398
398
|
};
|
|
399
399
|
|
|
400
|
-
/** @returns {Promise<import('
|
|
400
|
+
/** @returns {Promise<import('bpmn-engine').BpmnEngineExecutionState>} */
|
|
401
401
|
Engine.prototype.getState = async function getState() {
|
|
402
402
|
const execution = this.execution;
|
|
403
403
|
if (execution) return execution.getState();
|
|
@@ -408,7 +408,7 @@ Engine.prototype.getState = async function getState() {
|
|
|
408
408
|
|
|
409
409
|
/**
|
|
410
410
|
* @template R
|
|
411
|
-
* @param {import('
|
|
411
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
412
412
|
* @returns {Promise<R>}
|
|
413
413
|
*/
|
|
414
414
|
Engine.prototype.waitFor = function waitFor(eventName) {
|
|
@@ -478,7 +478,7 @@ Engine.prototype._getModdleContext = function getModdleContext(source) {
|
|
|
478
478
|
/**
|
|
479
479
|
* @param {Engine} engine
|
|
480
480
|
* @param {any[]} definitions
|
|
481
|
-
* @param {import('
|
|
481
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [options]
|
|
482
482
|
* @param {boolean} [isRecovered]
|
|
483
483
|
*/
|
|
484
484
|
function Execution(engine, definitions, options, isRecovered = false) {
|
|
@@ -755,7 +755,7 @@ Execution.prototype._saveOutput = function saveOutput(output) {
|
|
|
755
755
|
}
|
|
756
756
|
};
|
|
757
757
|
|
|
758
|
-
/** @returns {import('
|
|
758
|
+
/** @returns {import('bpmn-engine').BpmnEngineExecutionState} */
|
|
759
759
|
Execution.prototype.getState = function getState() {
|
|
760
760
|
const definitions = [];
|
|
761
761
|
for (const definition of this.definitions) {
|
|
@@ -797,7 +797,7 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
797
797
|
};
|
|
798
798
|
|
|
799
799
|
/**
|
|
800
|
-
* @param {import('
|
|
800
|
+
* @param {import('bpmn-engine').BpmnMessage} [payload]
|
|
801
801
|
* @param {{ ignoreSameDefinition?: boolean }} [signalOptions]
|
|
802
802
|
*/
|
|
803
803
|
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
@@ -807,7 +807,7 @@ Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
|
807
807
|
}
|
|
808
808
|
};
|
|
809
809
|
|
|
810
|
-
/** @param {import('
|
|
810
|
+
/** @param {import('bpmn-engine').BpmnMessage} [payload] */
|
|
811
811
|
Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
812
812
|
for (const definition of this[kExecuting]) {
|
|
813
813
|
definition.cancelActivity(payload);
|
|
@@ -816,7 +816,7 @@ Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
|
816
816
|
|
|
817
817
|
/**
|
|
818
818
|
* @template T
|
|
819
|
-
* @param {import('
|
|
819
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
820
820
|
* @returns {Promise<T>}
|
|
821
821
|
*/
|
|
822
822
|
Execution.prototype.waitFor = function waitFor(...args) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-engine",
|
|
3
3
|
"description": "BPMN 2.0 execution engine. Open source javascript workflow engine.",
|
|
4
|
-
"version": "26.0.
|
|
4
|
+
"version": "26.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./src/index.js",
|
|
7
7
|
"main": "./lib/index.cjs",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "mocha -p -R @bonniernews/hot-bev",
|
|
35
|
-
"posttest": "npm run lint && npm run toc && npm run dist",
|
|
35
|
+
"posttest": "npm run lint && npm run toc && npm run dist && npm run test:md",
|
|
36
36
|
"lint": "eslint . --cache && prettier . -c --cache",
|
|
37
37
|
"wintest": "mocha",
|
|
38
38
|
"cov:html": "c8 -r html -r text mocha -p -R @bonniernews/hot-bev",
|
|
39
39
|
"test:lcov": "c8 -r lcov mocha && npm run lint",
|
|
40
40
|
"toc": "node scripts/generate-api-toc ./docs/API.md,./docs/Examples.md",
|
|
41
|
-
"test
|
|
41
|
+
"test:md": "texample ./docs/API.md,./docs/Examples.md,./docs/Upgrade.md -c .mocharc.json",
|
|
42
42
|
"dist": "rollup -c",
|
|
43
43
|
"prepack": "npm run dist"
|
|
44
44
|
},
|
|
@@ -58,9 +58,6 @@
|
|
|
58
58
|
}
|
|
59
59
|
],
|
|
60
60
|
"overrides": {
|
|
61
|
-
"c8": {
|
|
62
|
-
"yargs": "^18.0.0"
|
|
63
|
-
},
|
|
64
61
|
"mocha": {
|
|
65
62
|
"yargs": "^18.0.0"
|
|
66
63
|
}
|
|
@@ -70,24 +67,28 @@
|
|
|
70
67
|
"@eslint/js": "^10.0.1",
|
|
71
68
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
72
69
|
"@types/bpmn-moddle": "^10.0.0",
|
|
70
|
+
"@types/chai": "^5.2.3",
|
|
71
|
+
"@types/mocha": "^10.0.10",
|
|
73
72
|
"@types/node": "^20.19.40",
|
|
74
73
|
"bent": "^7.3.12",
|
|
75
|
-
"bpmn-elements": "^18.0.
|
|
74
|
+
"bpmn-elements": "^18.0.15",
|
|
76
75
|
"bpmn-moddle": "^9.0.4",
|
|
77
76
|
"bpmn-moddle-10": "npm:bpmn-moddle@^10.0.0",
|
|
78
|
-
"c8": "^
|
|
77
|
+
"c8": "^12.0.0",
|
|
79
78
|
"camunda-bpmn-moddle": "^7.0.1",
|
|
80
79
|
"chai": "^6.2.0",
|
|
81
80
|
"chronokinesis": "^8.0.0",
|
|
82
81
|
"debug": "^4.4.3",
|
|
83
82
|
"eslint": "^10.5.0",
|
|
84
83
|
"globals": "^17.6.0",
|
|
85
|
-
"moddle-context-serializer": "^6.0.0",
|
|
86
84
|
"mocha": "^11.0.1",
|
|
87
85
|
"mocha-cakes-2": "^3.3.0",
|
|
86
|
+
"moddle-context-serializer": "^6.0.0",
|
|
87
|
+
"nock": "^14.0.17",
|
|
88
88
|
"prettier": "^3.2.5",
|
|
89
89
|
"rollup": "^4.10.0",
|
|
90
|
-
"texample": "^1.0.2"
|
|
90
|
+
"texample": "^1.0.2",
|
|
91
|
+
"typescript": "^7.0.2"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
94
|
"bpmn-elements": ">=18",
|
package/src/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export { JavaScripts };
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* BPMN 2.0 execution engine.
|
|
34
|
-
* @param {import('
|
|
34
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [options]
|
|
35
35
|
*/
|
|
36
36
|
export function Engine(options) {
|
|
37
37
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
@@ -120,7 +120,7 @@ Object.defineProperties(Engine.prototype, {
|
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* Execute the loaded definitions.
|
|
123
|
-
* @param {import('
|
|
123
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
124
124
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
125
125
|
* @returns {Promise<Execution>}
|
|
126
126
|
*/
|
|
@@ -146,8 +146,8 @@ Engine.prototype.stop = function stop() {
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Recover engine from saved state.
|
|
149
|
-
* @param {import('
|
|
150
|
-
* @param {import('
|
|
149
|
+
* @param {import('bpmn-engine').BpmnEngineExecutionState | null} savedState
|
|
150
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [recoverOptions]
|
|
151
151
|
* @returns {Engine}
|
|
152
152
|
*/
|
|
153
153
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
@@ -197,7 +197,7 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* Resume execution from a previously recovered state.
|
|
200
|
-
* @param {import('
|
|
200
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
201
201
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
202
202
|
* @returns {Promise<Execution>}
|
|
203
203
|
*/
|
|
@@ -224,7 +224,7 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Add a pre-serialized source context to the engine.
|
|
227
|
-
* @param {{ sourceContext: import('
|
|
227
|
+
* @param {{ sourceContext: import('moddle-context-serializer').SerializableContext }} [options]
|
|
228
228
|
*/
|
|
229
229
|
Engine.prototype.addSource = function addSource(options) {
|
|
230
230
|
if (!options?.sourceContext) return;
|
|
@@ -234,7 +234,7 @@ Engine.prototype.addSource = function addSource(options) {
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* @param {import('
|
|
237
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [executeOptions]
|
|
238
238
|
* @returns {Promise<import('bpmn-elements').Definition[]>}
|
|
239
239
|
*/
|
|
240
240
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -251,7 +251,7 @@ Engine.prototype.getDefinitionById = async function getDefinitionById(id) {
|
|
|
251
251
|
return (await this.getDefinitions()).find((d) => d.id === id);
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
/** @returns {Promise<import('
|
|
254
|
+
/** @returns {Promise<import('bpmn-engine').BpmnEngineExecutionState>} */
|
|
255
255
|
Engine.prototype.getState = async function getState() {
|
|
256
256
|
const execution = this.execution;
|
|
257
257
|
if (execution) return execution.getState();
|
|
@@ -262,7 +262,7 @@ Engine.prototype.getState = async function getState() {
|
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* @template R
|
|
265
|
-
* @param {import('
|
|
265
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
266
266
|
* @returns {Promise<R>}
|
|
267
267
|
*/
|
|
268
268
|
Engine.prototype.waitFor = function waitFor(eventName) {
|
|
@@ -332,7 +332,7 @@ Engine.prototype._getModdleContext = function getModdleContext(source) {
|
|
|
332
332
|
/**
|
|
333
333
|
* @param {Engine} engine
|
|
334
334
|
* @param {any[]} definitions
|
|
335
|
-
* @param {import('
|
|
335
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [options]
|
|
336
336
|
* @param {boolean} [isRecovered]
|
|
337
337
|
*/
|
|
338
338
|
export function Execution(engine, definitions, options, isRecovered = false) {
|
|
@@ -609,7 +609,7 @@ Execution.prototype._saveOutput = function saveOutput(output) {
|
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
611
|
|
|
612
|
-
/** @returns {import('
|
|
612
|
+
/** @returns {import('bpmn-engine').BpmnEngineExecutionState} */
|
|
613
613
|
Execution.prototype.getState = function getState() {
|
|
614
614
|
const definitions = [];
|
|
615
615
|
for (const definition of this.definitions) {
|
|
@@ -651,7 +651,7 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
651
651
|
};
|
|
652
652
|
|
|
653
653
|
/**
|
|
654
|
-
* @param {import('
|
|
654
|
+
* @param {import('bpmn-engine').BpmnMessage} [payload]
|
|
655
655
|
* @param {{ ignoreSameDefinition?: boolean }} [signalOptions]
|
|
656
656
|
*/
|
|
657
657
|
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
@@ -661,7 +661,7 @@ Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
|
661
661
|
}
|
|
662
662
|
};
|
|
663
663
|
|
|
664
|
-
/** @param {import('
|
|
664
|
+
/** @param {import('bpmn-engine').BpmnMessage} [payload] */
|
|
665
665
|
Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
666
666
|
for (const definition of this[kExecuting]) {
|
|
667
667
|
definition.cancelActivity(payload);
|
|
@@ -670,7 +670,7 @@ Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
|
670
670
|
|
|
671
671
|
/**
|
|
672
672
|
* @template T
|
|
673
|
-
* @param {import('
|
|
673
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
674
674
|
* @returns {Promise<T>}
|
|
675
675
|
*/
|
|
676
676
|
Execution.prototype.waitFor = function waitFor(...args) {
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ declare module 'bpmn-engine' {
|
|
|
2
2
|
import type { EventEmitter } from 'node:events';
|
|
3
3
|
import type { Broker } from 'smqp';
|
|
4
4
|
import type { Definitions as BpmnModdleDefinitions } from 'bpmn-moddle';
|
|
5
|
-
import type { ExtendFn, SerializableContext,
|
|
5
|
+
import type { ExtendFn, SerializableContext, TypeResolverExtender } from 'moddle-context-serializer';
|
|
6
6
|
import type {
|
|
7
7
|
ActivityStatus,
|
|
8
8
|
Definition,
|
|
@@ -16,7 +16,7 @@ declare module 'bpmn-engine' {
|
|
|
16
16
|
Script,
|
|
17
17
|
} from 'bpmn-elements';
|
|
18
18
|
|
|
19
|
-
export type BpmnEngineEvent = 'error' | 'stop' | 'end';
|
|
19
|
+
export type BpmnEngineEvent = 'error' | 'stop' | 'end' | 'wait';
|
|
20
20
|
|
|
21
21
|
export type BpmnActivityEvent =
|
|
22
22
|
| 'activity.enter'
|
|
@@ -49,16 +49,17 @@ declare module 'bpmn-engine' {
|
|
|
49
49
|
|
|
50
50
|
export interface BpmnEngineOptions extends BpmnEngineExecuteOptions {
|
|
51
51
|
name?: string;
|
|
52
|
-
source?: string;
|
|
52
|
+
source?: string | Buffer;
|
|
53
53
|
sourceContext?: SerializableContext;
|
|
54
54
|
elements?: Record<string, any>;
|
|
55
|
-
typeResolver?:
|
|
55
|
+
typeResolver?: TypeResolverExtender;
|
|
56
56
|
extendFn?: ExtendFn;
|
|
57
57
|
moddleOptions?: any;
|
|
58
58
|
moddleContext?: BpmnModdleDefinitions;
|
|
59
59
|
Logger?: (scope: string) => ILogger;
|
|
60
60
|
scripts?: IScripts;
|
|
61
61
|
disableDummyScript?: boolean;
|
|
62
|
+
listener?: EventEmitter | IListenerEmitter;
|
|
62
63
|
[x: string]: any;
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -69,19 +70,19 @@ declare module 'bpmn-engine' {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
export interface BpmnEngineExecutionState {
|
|
72
|
-
name
|
|
73
|
-
engineVersion
|
|
74
|
-
state
|
|
75
|
-
stopped
|
|
76
|
-
environment
|
|
77
|
-
definitions
|
|
73
|
+
name?: string;
|
|
74
|
+
engineVersion?: string;
|
|
75
|
+
state?: BpmnEngineRunningStatus;
|
|
76
|
+
stopped?: boolean;
|
|
77
|
+
environment?: EnvironmentState;
|
|
78
|
+
definitions?: BpmnEngineDefinitionState[];
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
export function Engine(options?: BpmnEngineOptions): Engine;
|
|
81
82
|
export class Engine extends EventEmitter {
|
|
82
83
|
constructor(options?: BpmnEngineOptions);
|
|
83
84
|
options: BpmnEngineOptions;
|
|
84
|
-
|
|
85
|
+
name: string;
|
|
85
86
|
readonly broker: Broker;
|
|
86
87
|
readonly logger: ILogger;
|
|
87
88
|
readonly environment: Environment;
|
|
@@ -99,7 +100,7 @@ declare module 'bpmn-engine' {
|
|
|
99
100
|
getDefinitions(executeOptions?: BpmnEngineExecuteOptions): Promise<Definition[]>;
|
|
100
101
|
getState(): Promise<BpmnEngineExecutionState>;
|
|
101
102
|
|
|
102
|
-
recover(savedState
|
|
103
|
+
recover(savedState?: BpmnEngineExecutionState | null, recoverOptions?: BpmnEngineOptions): Engine;
|
|
103
104
|
|
|
104
105
|
resume(): Promise<Execution>;
|
|
105
106
|
resume(options: BpmnEngineExecuteOptions): Promise<Execution>;
|
|
@@ -143,11 +144,15 @@ declare module 'bpmn-engine' {
|
|
|
143
144
|
waitFor<R>(eventName: BpmnEngineEvent): Promise<R>;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
export
|
|
147
|
-
constructor(disableDummy?: boolean);
|
|
147
|
+
export interface JavaScripts extends IScripts {
|
|
148
148
|
register(activity: any): Script | undefined;
|
|
149
|
-
getScript(language: string, identifier: { id: string; [x: string]: any }): Script;
|
|
149
|
+
getScript(language: string, identifier: { id: string; [x: string]: any }): Script | undefined;
|
|
150
150
|
}
|
|
151
|
+
export const JavaScripts: {
|
|
152
|
+
new (disableDummy?: boolean): JavaScripts;
|
|
153
|
+
/** callable without new */
|
|
154
|
+
(disableDummy?: boolean): JavaScripts;
|
|
155
|
+
};
|
|
151
156
|
|
|
152
157
|
export default Engine;
|
|
153
158
|
}
|
package/types/interfaces.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { EventEmitter } from 'node:events';
|
|
2
|
-
import type { Definitions as BpmnModdleDefinitions } from 'bpmn-moddle';
|
|
3
|
-
import type { ExtendFn, SerializableContext, ResolverFn } from 'moddle-context-serializer';
|
|
4
|
-
import type { ActivityStatus, ElementBroker, EnvironmentOptions, EnvironmentState, IScripts, Script, ILogger } from 'bpmn-elements';
|
|
5
|
-
|
|
6
|
-
export type { SerializableContext };
|
|
7
|
-
|
|
8
|
-
export type BpmnEngineEvent = 'error' | 'stop' | 'end';
|
|
9
|
-
|
|
10
|
-
export type BpmnActivityEvent =
|
|
11
|
-
| 'activity.enter'
|
|
12
|
-
| 'activity.start'
|
|
13
|
-
| 'activity.wait'
|
|
14
|
-
| 'wait'
|
|
15
|
-
| 'activity.end'
|
|
16
|
-
| 'activity.leave'
|
|
17
|
-
| 'activity.stop'
|
|
18
|
-
| 'activity.throw'
|
|
19
|
-
| 'activity.error';
|
|
20
|
-
|
|
21
|
-
export type BpmnSequenceFlowEvent = 'flow.take' | 'flow.discard' | 'flow.looped';
|
|
22
|
-
|
|
23
|
-
export type BpmnEngineRunningStatus = 'idle' | 'running' | 'stopped' | 'error';
|
|
24
|
-
|
|
25
|
-
export interface BpmnMessage {
|
|
26
|
-
id?: string;
|
|
27
|
-
executionId?: string;
|
|
28
|
-
[name: string]: any;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IListenerEmitter {
|
|
32
|
-
emit(eventName: string, ...args: any[]): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface BpmnEngineExecuteOptions extends EnvironmentOptions {
|
|
36
|
-
listener?: EventEmitter | IListenerEmitter;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface BpmnEngineOptions extends BpmnEngineExecuteOptions {
|
|
40
|
-
name?: string;
|
|
41
|
-
source?: string;
|
|
42
|
-
sourceContext?: SerializableContext;
|
|
43
|
-
elements?: Record<string, any>;
|
|
44
|
-
typeResolver?: ResolverFn;
|
|
45
|
-
extendFn?: ExtendFn;
|
|
46
|
-
moddleOptions?: any;
|
|
47
|
-
moddleContext?: BpmnModdleDefinitions;
|
|
48
|
-
Logger?: (scope: string) => ILogger;
|
|
49
|
-
scripts?: IScripts;
|
|
50
|
-
disableDummyScript?: boolean;
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface BpmnEngineDefinitionState {
|
|
55
|
-
state: string;
|
|
56
|
-
source?: string;
|
|
57
|
-
[x: string]: any;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface BpmnEngineExecutionState {
|
|
61
|
-
name: string;
|
|
62
|
-
engineVersion: string;
|
|
63
|
-
state: BpmnEngineRunningStatus;
|
|
64
|
-
stopped: boolean;
|
|
65
|
-
environment: EnvironmentState;
|
|
66
|
-
definitions: BpmnEngineDefinitionState[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export type {
|
|
70
|
-
ActivityStatus,
|
|
71
|
-
BpmnModdleDefinitions,
|
|
72
|
-
ElementBroker,
|
|
73
|
-
EnvironmentOptions,
|
|
74
|
-
EnvironmentState,
|
|
75
|
-
ExtendFn,
|
|
76
|
-
ILogger,
|
|
77
|
-
IScripts,
|
|
78
|
-
ResolverFn,
|
|
79
|
-
Script,
|
|
80
|
-
};
|