bpmn-engine 26.0.1 → 26.0.3
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 +21 -17
- package/package.json +11 -10
- package/src/index.js +20 -17
- package/types/index.d.ts +20 -15
- package/types/interfaces.d.ts +0 -80
package/lib/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var node_module = require('node:module');
|
|
6
6
|
var node_events = require('node:events');
|
|
7
7
|
var node_url = require('node:url');
|
|
8
|
-
var
|
|
8
|
+
var bpmnModdle = require('bpmn-moddle');
|
|
9
9
|
var Elements = require('bpmn-elements');
|
|
10
10
|
var smqp = require('smqp');
|
|
11
11
|
var moddleContextSerializer = require('moddle-context-serializer');
|
|
@@ -30,6 +30,7 @@ function _interopNamespaceDefault(e) {
|
|
|
30
30
|
return Object.freeze(n);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
var bpmnModdle__namespace = /*#__PURE__*/_interopNamespaceDefault(bpmnModdle);
|
|
33
34
|
var Elements__namespace = /*#__PURE__*/_interopNamespaceDefault(Elements);
|
|
34
35
|
|
|
35
36
|
function Logger(scope) {
|
|
@@ -164,6 +165,9 @@ ProcessOutputDataObject.prototype.write = function writeDataObject(broker, excha
|
|
|
164
165
|
const nodeRequire = node_module.createRequire(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
165
166
|
const { version: engineVersion } = nodeRequire('../package.json');
|
|
166
167
|
|
|
168
|
+
// bpmn-moddle@9 exposes the parser as default export, bpmn-moddle@10 as the named export BpmnModdle
|
|
169
|
+
const BpmnModdle = bpmnModdle__namespace.BpmnModdle ?? bpmnModdle__namespace.default;
|
|
170
|
+
|
|
167
171
|
const kEngine = Symbol.for('engine');
|
|
168
172
|
const kEnvironment = Symbol.for('environment');
|
|
169
173
|
const kExecuting = Symbol.for('executing');
|
|
@@ -177,7 +181,7 @@ const kTypeResolver = Symbol.for('type resolver');
|
|
|
177
181
|
|
|
178
182
|
/**
|
|
179
183
|
* BPMN 2.0 execution engine.
|
|
180
|
-
* @param {import('
|
|
184
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [options]
|
|
181
185
|
*/
|
|
182
186
|
function Engine(options) {
|
|
183
187
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
@@ -266,7 +270,7 @@ Object.defineProperties(Engine.prototype, {
|
|
|
266
270
|
|
|
267
271
|
/**
|
|
268
272
|
* Execute the loaded definitions.
|
|
269
|
-
* @param {import('
|
|
273
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
270
274
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
271
275
|
* @returns {Promise<Execution>}
|
|
272
276
|
*/
|
|
@@ -292,8 +296,8 @@ Engine.prototype.stop = function stop() {
|
|
|
292
296
|
|
|
293
297
|
/**
|
|
294
298
|
* Recover engine from saved state.
|
|
295
|
-
* @param {import('
|
|
296
|
-
* @param {import('
|
|
299
|
+
* @param {import('bpmn-engine').BpmnEngineExecutionState | null} savedState
|
|
300
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [recoverOptions]
|
|
297
301
|
* @returns {Engine}
|
|
298
302
|
*/
|
|
299
303
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
@@ -343,7 +347,7 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
343
347
|
|
|
344
348
|
/**
|
|
345
349
|
* Resume execution from a previously recovered state.
|
|
346
|
-
* @param {import('
|
|
350
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
347
351
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
348
352
|
* @returns {Promise<Execution>}
|
|
349
353
|
*/
|
|
@@ -370,7 +374,7 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
370
374
|
|
|
371
375
|
/**
|
|
372
376
|
* Add a pre-serialized source context to the engine.
|
|
373
|
-
* @param {{ sourceContext: import('
|
|
377
|
+
* @param {{ sourceContext: import('moddle-context-serializer').SerializableContext }} [options]
|
|
374
378
|
*/
|
|
375
379
|
Engine.prototype.addSource = function addSource(options) {
|
|
376
380
|
if (!options?.sourceContext) return;
|
|
@@ -380,7 +384,7 @@ Engine.prototype.addSource = function addSource(options) {
|
|
|
380
384
|
};
|
|
381
385
|
|
|
382
386
|
/**
|
|
383
|
-
* @param {import('
|
|
387
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [executeOptions]
|
|
384
388
|
* @returns {Promise<import('bpmn-elements').Definition[]>}
|
|
385
389
|
*/
|
|
386
390
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -397,7 +401,7 @@ Engine.prototype.getDefinitionById = async function getDefinitionById(id) {
|
|
|
397
401
|
return (await this.getDefinitions()).find((d) => d.id === id);
|
|
398
402
|
};
|
|
399
403
|
|
|
400
|
-
/** @returns {Promise<import('
|
|
404
|
+
/** @returns {Promise<import('bpmn-engine').BpmnEngineExecutionState>} */
|
|
401
405
|
Engine.prototype.getState = async function getState() {
|
|
402
406
|
const execution = this.execution;
|
|
403
407
|
if (execution) return execution.getState();
|
|
@@ -408,7 +412,7 @@ Engine.prototype.getState = async function getState() {
|
|
|
408
412
|
|
|
409
413
|
/**
|
|
410
414
|
* @template R
|
|
411
|
-
* @param {import('
|
|
415
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
412
416
|
* @returns {Promise<R>}
|
|
413
417
|
*/
|
|
414
418
|
Engine.prototype.waitFor = function waitFor(eventName) {
|
|
@@ -471,14 +475,14 @@ Engine.prototype._serializeModdleContext = function serializeModdleContext(moddl
|
|
|
471
475
|
|
|
472
476
|
/** @internal */
|
|
473
477
|
Engine.prototype._getModdleContext = function getModdleContext(source) {
|
|
474
|
-
const
|
|
475
|
-
return
|
|
478
|
+
const moddle = new BpmnModdle(this.options.moddleOptions);
|
|
479
|
+
return moddle.fromXML(Buffer.isBuffer(source) ? source.toString() : source.trim());
|
|
476
480
|
};
|
|
477
481
|
|
|
478
482
|
/**
|
|
479
483
|
* @param {Engine} engine
|
|
480
484
|
* @param {any[]} definitions
|
|
481
|
-
* @param {import('
|
|
485
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [options]
|
|
482
486
|
* @param {boolean} [isRecovered]
|
|
483
487
|
*/
|
|
484
488
|
function Execution(engine, definitions, options, isRecovered = false) {
|
|
@@ -755,7 +759,7 @@ Execution.prototype._saveOutput = function saveOutput(output) {
|
|
|
755
759
|
}
|
|
756
760
|
};
|
|
757
761
|
|
|
758
|
-
/** @returns {import('
|
|
762
|
+
/** @returns {import('bpmn-engine').BpmnEngineExecutionState} */
|
|
759
763
|
Execution.prototype.getState = function getState() {
|
|
760
764
|
const definitions = [];
|
|
761
765
|
for (const definition of this.definitions) {
|
|
@@ -797,7 +801,7 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
797
801
|
};
|
|
798
802
|
|
|
799
803
|
/**
|
|
800
|
-
* @param {import('
|
|
804
|
+
* @param {import('bpmn-engine').BpmnMessage} [payload]
|
|
801
805
|
* @param {{ ignoreSameDefinition?: boolean }} [signalOptions]
|
|
802
806
|
*/
|
|
803
807
|
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
@@ -807,7 +811,7 @@ Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
|
807
811
|
}
|
|
808
812
|
};
|
|
809
813
|
|
|
810
|
-
/** @param {import('
|
|
814
|
+
/** @param {import('bpmn-engine').BpmnMessage} [payload] */
|
|
811
815
|
Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
812
816
|
for (const definition of this[kExecuting]) {
|
|
813
817
|
definition.cancelActivity(payload);
|
|
@@ -816,7 +820,7 @@ Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
|
816
820
|
|
|
817
821
|
/**
|
|
818
822
|
* @template T
|
|
819
|
-
* @param {import('
|
|
823
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
820
824
|
* @returns {Promise<T>}
|
|
821
825
|
*/
|
|
822
826
|
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.3",
|
|
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
|
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';
|
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as bpmnModdle from 'bpmn-moddle';
|
|
6
6
|
import * as Elements from 'bpmn-elements';
|
|
7
7
|
import { Broker } from 'smqp';
|
|
8
8
|
import { Serializer, deserialize, TypeResolver } from 'moddle-context-serializer';
|
|
@@ -15,6 +15,9 @@ import ProcessOutputDataObject from './extensions/ProcessOutputDataObject.js';
|
|
|
15
15
|
const nodeRequire = createRequire(fileURLToPath(import.meta.url));
|
|
16
16
|
const { version: engineVersion } = nodeRequire('../package.json');
|
|
17
17
|
|
|
18
|
+
// bpmn-moddle@9 exposes the parser as default export, bpmn-moddle@10 as the named export BpmnModdle
|
|
19
|
+
const BpmnModdle = bpmnModdle.BpmnModdle ?? bpmnModdle.default;
|
|
20
|
+
|
|
18
21
|
const kEngine = Symbol.for('engine');
|
|
19
22
|
const kEnvironment = Symbol.for('environment');
|
|
20
23
|
const kExecuting = Symbol.for('executing');
|
|
@@ -31,7 +34,7 @@ export { JavaScripts };
|
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* BPMN 2.0 execution engine.
|
|
34
|
-
* @param {import('
|
|
37
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [options]
|
|
35
38
|
*/
|
|
36
39
|
export function Engine(options) {
|
|
37
40
|
if (!(this instanceof Engine)) return new Engine(options);
|
|
@@ -120,7 +123,7 @@ Object.defineProperties(Engine.prototype, {
|
|
|
120
123
|
|
|
121
124
|
/**
|
|
122
125
|
* Execute the loaded definitions.
|
|
123
|
-
* @param {import('
|
|
126
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
124
127
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
125
128
|
* @returns {Promise<Execution>}
|
|
126
129
|
*/
|
|
@@ -146,8 +149,8 @@ Engine.prototype.stop = function stop() {
|
|
|
146
149
|
|
|
147
150
|
/**
|
|
148
151
|
* Recover engine from saved state.
|
|
149
|
-
* @param {import('
|
|
150
|
-
* @param {import('
|
|
152
|
+
* @param {import('bpmn-engine').BpmnEngineExecutionState | null} savedState
|
|
153
|
+
* @param {import('bpmn-engine').BpmnEngineOptions} [recoverOptions]
|
|
151
154
|
* @returns {Engine}
|
|
152
155
|
*/
|
|
153
156
|
Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
@@ -197,7 +200,7 @@ Engine.prototype.recover = function recover(savedState, recoverOptions) {
|
|
|
197
200
|
|
|
198
201
|
/**
|
|
199
202
|
* Resume execution from a previously recovered state.
|
|
200
|
-
* @param {import('
|
|
203
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions | ((err: Error, execution?: Execution) => void)} [optionsOrCallback]
|
|
201
204
|
* @param {(err: Error, execution?: Execution) => void} [callback]
|
|
202
205
|
* @returns {Promise<Execution>}
|
|
203
206
|
*/
|
|
@@ -224,7 +227,7 @@ Engine.prototype.resume = async function resume(...args) {
|
|
|
224
227
|
|
|
225
228
|
/**
|
|
226
229
|
* Add a pre-serialized source context to the engine.
|
|
227
|
-
* @param {{ sourceContext: import('
|
|
230
|
+
* @param {{ sourceContext: import('moddle-context-serializer').SerializableContext }} [options]
|
|
228
231
|
*/
|
|
229
232
|
Engine.prototype.addSource = function addSource(options) {
|
|
230
233
|
if (!options?.sourceContext) return;
|
|
@@ -234,7 +237,7 @@ Engine.prototype.addSource = function addSource(options) {
|
|
|
234
237
|
};
|
|
235
238
|
|
|
236
239
|
/**
|
|
237
|
-
* @param {import('
|
|
240
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [executeOptions]
|
|
238
241
|
* @returns {Promise<import('bpmn-elements').Definition[]>}
|
|
239
242
|
*/
|
|
240
243
|
Engine.prototype.getDefinitions = function getDefinitions(executeOptions) {
|
|
@@ -251,7 +254,7 @@ Engine.prototype.getDefinitionById = async function getDefinitionById(id) {
|
|
|
251
254
|
return (await this.getDefinitions()).find((d) => d.id === id);
|
|
252
255
|
};
|
|
253
256
|
|
|
254
|
-
/** @returns {Promise<import('
|
|
257
|
+
/** @returns {Promise<import('bpmn-engine').BpmnEngineExecutionState>} */
|
|
255
258
|
Engine.prototype.getState = async function getState() {
|
|
256
259
|
const execution = this.execution;
|
|
257
260
|
if (execution) return execution.getState();
|
|
@@ -262,7 +265,7 @@ Engine.prototype.getState = async function getState() {
|
|
|
262
265
|
|
|
263
266
|
/**
|
|
264
267
|
* @template R
|
|
265
|
-
* @param {import('
|
|
268
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
266
269
|
* @returns {Promise<R>}
|
|
267
270
|
*/
|
|
268
271
|
Engine.prototype.waitFor = function waitFor(eventName) {
|
|
@@ -325,14 +328,14 @@ Engine.prototype._serializeModdleContext = function serializeModdleContext(moddl
|
|
|
325
328
|
|
|
326
329
|
/** @internal */
|
|
327
330
|
Engine.prototype._getModdleContext = function getModdleContext(source) {
|
|
328
|
-
const
|
|
329
|
-
return
|
|
331
|
+
const moddle = new BpmnModdle(this.options.moddleOptions);
|
|
332
|
+
return moddle.fromXML(Buffer.isBuffer(source) ? source.toString() : source.trim());
|
|
330
333
|
};
|
|
331
334
|
|
|
332
335
|
/**
|
|
333
336
|
* @param {Engine} engine
|
|
334
337
|
* @param {any[]} definitions
|
|
335
|
-
* @param {import('
|
|
338
|
+
* @param {import('bpmn-engine').BpmnEngineExecuteOptions} [options]
|
|
336
339
|
* @param {boolean} [isRecovered]
|
|
337
340
|
*/
|
|
338
341
|
export function Execution(engine, definitions, options, isRecovered = false) {
|
|
@@ -609,7 +612,7 @@ Execution.prototype._saveOutput = function saveOutput(output) {
|
|
|
609
612
|
}
|
|
610
613
|
};
|
|
611
614
|
|
|
612
|
-
/** @returns {import('
|
|
615
|
+
/** @returns {import('bpmn-engine').BpmnEngineExecutionState} */
|
|
613
616
|
Execution.prototype.getState = function getState() {
|
|
614
617
|
const definitions = [];
|
|
615
618
|
for (const definition of this.definitions) {
|
|
@@ -651,7 +654,7 @@ Execution.prototype.getPostponed = function getPostponed() {
|
|
|
651
654
|
};
|
|
652
655
|
|
|
653
656
|
/**
|
|
654
|
-
* @param {import('
|
|
657
|
+
* @param {import('bpmn-engine').BpmnMessage} [payload]
|
|
655
658
|
* @param {{ ignoreSameDefinition?: boolean }} [signalOptions]
|
|
656
659
|
*/
|
|
657
660
|
Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
@@ -661,7 +664,7 @@ Execution.prototype.signal = function signal(payload, signalOptions) {
|
|
|
661
664
|
}
|
|
662
665
|
};
|
|
663
666
|
|
|
664
|
-
/** @param {import('
|
|
667
|
+
/** @param {import('bpmn-engine').BpmnMessage} [payload] */
|
|
665
668
|
Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
666
669
|
for (const definition of this[kExecuting]) {
|
|
667
670
|
definition.cancelActivity(payload);
|
|
@@ -670,7 +673,7 @@ Execution.prototype.cancelActivity = function cancelActivity(payload) {
|
|
|
670
673
|
|
|
671
674
|
/**
|
|
672
675
|
* @template T
|
|
673
|
-
* @param {import('
|
|
676
|
+
* @param {import('bpmn-engine').BpmnEngineEvent} eventName
|
|
674
677
|
* @returns {Promise<T>}
|
|
675
678
|
*/
|
|
676
679
|
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
|
-
};
|