bpmn-engine 15.1.3 → 16.0.0
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/CHANGELOG.md +6 -0
- package/index.js +33 -0
- package/package.json +15 -19
- package/types/bpmn-engine.d.ts +68 -520
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
# 16.0.0
|
|
5
|
+
|
|
6
|
+
- Refactor type declarations using types from bpmn-elements, smqp, etc
|
|
7
|
+
- add activity status property
|
|
8
|
+
- Bump [`bpmn-elements@9.1.0`](https://github.com/paed01/bpmn-elements/blob/master/CHANGELOG.md)
|
|
9
|
+
|
|
4
10
|
# 15.1.3
|
|
5
11
|
|
|
6
12
|
- fix(types): add missing `settings` option
|
package/index.js
CHANGED
|
@@ -107,6 +107,15 @@ Object.defineProperty(Engine.prototype, 'execution', {
|
|
|
107
107
|
},
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
Object.defineProperty(Engine.prototype, 'activityStatus', {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get() {
|
|
113
|
+
const execution = this.execution;
|
|
114
|
+
if (execution) return execution.activityStatus;
|
|
115
|
+
return 'idle';
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
110
119
|
Engine.prototype.execute = async function execute(...args) {
|
|
111
120
|
const [executeOptions, callback] = getOptionsAndCallback(...args);
|
|
112
121
|
try {
|
|
@@ -306,6 +315,30 @@ Object.defineProperty(Execution.prototype, 'environment', {
|
|
|
306
315
|
},
|
|
307
316
|
});
|
|
308
317
|
|
|
318
|
+
Object.defineProperty(Execution.prototype, 'activityStatus', {
|
|
319
|
+
get() {
|
|
320
|
+
let status = 'idle';
|
|
321
|
+
const running = this[kExecuting];
|
|
322
|
+
if (!running.length) return status;
|
|
323
|
+
|
|
324
|
+
for (const def of running) {
|
|
325
|
+
const bpStatus = def.activityStatus;
|
|
326
|
+
switch (def.activityStatus) {
|
|
327
|
+
case 'executing':
|
|
328
|
+
return bpStatus;
|
|
329
|
+
case 'timer':
|
|
330
|
+
status = bpStatus;
|
|
331
|
+
break;
|
|
332
|
+
case 'wait':
|
|
333
|
+
if (status === 'idle') status = bpStatus;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return status;
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
|
|
309
342
|
Execution.prototype._execute = function execute(executeOptions, callback) {
|
|
310
343
|
this._setup(executeOptions);
|
|
311
344
|
this[kStopped] = false;
|
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": "
|
|
4
|
+
"version": "16.0.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types/bpmn-engine.d.ts",
|
|
7
7
|
"repository": {
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "mocha -R dot",
|
|
25
|
-
"posttest": "
|
|
25
|
+
"posttest": "npm run lint && npm run toc",
|
|
26
|
+
"lint": "eslint . --cache",
|
|
26
27
|
"wintest": "mocha",
|
|
27
|
-
"cov:html": "
|
|
28
|
-
"test:lcov": "
|
|
28
|
+
"cov:html": "c8 -r html -r text mocha -R dot",
|
|
29
|
+
"test:lcov": "c8 -r lcov mocha && npm run lint",
|
|
29
30
|
"toc": "node scripts/generate-api-toc ./docs/API.md,./docs/Examples.md",
|
|
30
31
|
"test-md": "node scripts/test-markdown.js ./docs/API.md && node scripts/test-markdown.js ./docs/Examples.md"
|
|
31
32
|
},
|
|
@@ -44,29 +45,24 @@
|
|
|
44
45
|
"url": "https://github.com/paed01/bpmn-engine/master/LICENSE"
|
|
45
46
|
}
|
|
46
47
|
],
|
|
47
|
-
"nyc": {
|
|
48
|
-
"exclude": [
|
|
49
|
-
"test"
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
48
|
"devDependencies": {
|
|
53
49
|
"bent": "^7.3.12",
|
|
54
|
-
"
|
|
50
|
+
"c8": "^7.13.0",
|
|
51
|
+
"camunda-bpmn-moddle": "^7.0.1",
|
|
55
52
|
"chai": "^4.3.7",
|
|
56
|
-
"chronokinesis": "^
|
|
57
|
-
"eslint": "^8.
|
|
53
|
+
"chronokinesis": "^4.0.1",
|
|
54
|
+
"eslint": "^8.37.0",
|
|
58
55
|
"markdown-toc": "^1.2.0",
|
|
59
|
-
"mocha": "^10.
|
|
56
|
+
"mocha": "^10.2.0",
|
|
60
57
|
"mocha-cakes-2": "^3.3.0",
|
|
61
|
-
"nock": "^13.
|
|
62
|
-
"nyc": "^15.1.0"
|
|
58
|
+
"nock": "^13.3.0"
|
|
63
59
|
},
|
|
64
60
|
"dependencies": {
|
|
65
61
|
"@types/bpmn-moddle": "^5.1.6",
|
|
66
|
-
"bpmn-elements": "^
|
|
67
|
-
"bpmn-moddle": "^
|
|
62
|
+
"bpmn-elements": "^9.1.0",
|
|
63
|
+
"bpmn-moddle": "^8.0.1",
|
|
68
64
|
"debug": "^4.3.4",
|
|
69
|
-
"moddle-context-serializer": "^2.
|
|
70
|
-
"smqp": "^
|
|
65
|
+
"moddle-context-serializer": "^3.2.2",
|
|
66
|
+
"smqp": "^7.1.3"
|
|
71
67
|
}
|
|
72
68
|
}
|
package/types/bpmn-engine.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Author : Saeed Tabrizi
|
|
2
|
+
// Refactored by : Pål Edman
|
|
2
3
|
|
|
3
|
-
import {EventEmitter} from 'events';
|
|
4
|
-
import {Definitions} from 'bpmn-moddle';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import { Definitions as BpmnModdleDefinitions } from 'bpmn-moddle';
|
|
6
|
+
import { extendFn, SerializableContext } from 'moddle-context-serializer';
|
|
7
|
+
import { ActivityStatus, ElementBroker, EnvironmentOptions, Definition, DefinitionState, Environment, Api, ElementBase, ILogger, EnvironmentState } from 'bpmn-elements';
|
|
5
8
|
|
|
6
9
|
declare module 'bpmn-engine' {
|
|
7
10
|
|
|
@@ -43,14 +46,8 @@ declare module 'bpmn-engine' {
|
|
|
43
46
|
flow.looped: The sequence is looped
|
|
44
47
|
*/
|
|
45
48
|
export type BpmnSequenceFlowEvent = 'flow.take' | 'flow.discard' | 'flow.looped';
|
|
46
|
-
export type BpmnEngineVariable = Record<string, any>;
|
|
47
|
-
export type BpmnEngineSetting = Record<string, any>;
|
|
48
|
-
|
|
49
|
-
export interface BpmnLogger {
|
|
50
|
-
debug(...args: any[]): void;
|
|
51
|
-
error(...args: any[]): void;
|
|
52
|
-
warn(...args: any[]): void;
|
|
53
|
-
}
|
|
49
|
+
// export type BpmnEngineVariable = Record<string, any>;
|
|
50
|
+
// export type BpmnEngineSetting = Record<string, any>;
|
|
54
51
|
|
|
55
52
|
export interface BpmnMessage {
|
|
56
53
|
id?: string,
|
|
@@ -58,152 +55,11 @@ declare module 'bpmn-engine' {
|
|
|
58
55
|
[name: string]: any
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
export interface
|
|
62
|
-
name: string;
|
|
63
|
-
type: 'topic' | 'direct';
|
|
64
|
-
options: any;
|
|
65
|
-
bindingCount: number;
|
|
66
|
-
bindings: any[];
|
|
67
|
-
stopped: boolean;
|
|
68
|
-
bind(queue: string, pattern: string, bindOptions?: any): void;
|
|
69
|
-
close(): void;
|
|
70
|
-
emit(eventName: string, content?: any): void;
|
|
71
|
-
getBinding(queueName: string, pattern: string): any;
|
|
72
|
-
getState<S>(): S;
|
|
73
|
-
on(pattern: string, handler: () => void, consumeOptions?: any): void;
|
|
74
|
-
off(pattern: string, handler: () => void): void;
|
|
75
|
-
publish(routingKey: string, content?: any, properties?: any): void;
|
|
76
|
-
recover<S>(state: S, getQueue?: boolean): void;
|
|
77
|
-
stop(): void;
|
|
78
|
-
unbind(queue: string, pattern: string): void;
|
|
79
|
-
unbindQueueByName(queueName: string): void;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface BpmnEngineBrokerQueue {
|
|
83
|
-
name: string;
|
|
84
|
-
options: any;
|
|
85
|
-
messages: any[];
|
|
86
|
-
messageCount: number;
|
|
87
|
-
consumerCount: number;
|
|
88
|
-
stopped: boolean;
|
|
89
|
-
exclusive: boolean;
|
|
90
|
-
maxLength: number;
|
|
91
|
-
readonly capacity: number;
|
|
92
|
-
messageTtl: number;
|
|
93
|
-
ack(message: any): void;
|
|
94
|
-
ackAll(): void;
|
|
95
|
-
assertConsumer(onMessage: () => void, consumeOptions?: any, owner?: any): void;
|
|
96
|
-
cancel(consumerTag: string): void;
|
|
97
|
-
close(): void;
|
|
98
|
-
consume(onMessage: () => void, consumeOptions?: any, owner?: any): void;
|
|
99
|
-
delete(deleteOptions?: any): void;
|
|
100
|
-
dequeueMessage(message: any): void;
|
|
101
|
-
dismiss(onMessage: () => void): void;
|
|
102
|
-
get<T>(consumeOptions?: any): T;
|
|
103
|
-
getState<S>(): S;
|
|
104
|
-
nack(message: any, allUpTo?: boolean, requeue?: boolean): void;
|
|
105
|
-
nackAll(requeue: boolean): void;
|
|
106
|
-
off(eventName: string, handler: () => void): void;
|
|
107
|
-
|
|
108
|
-
on(eventName: string, handler: () => void): void;
|
|
109
|
-
|
|
110
|
-
peek(ignoreDelivered?: boolean): void;
|
|
111
|
-
purge(): void;
|
|
112
|
-
|
|
113
|
-
queueMessage(fields: any[], content?: any, properties?: any, onMessageQueued?: () => void): void;
|
|
114
|
-
recover<S>(state: S): void;
|
|
115
|
-
reject(message: any, requeue?: boolean): void;
|
|
116
|
-
stop(): void;
|
|
117
|
-
unbindConsumer(): void;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface BpmnEngineBrokerConsumer {
|
|
121
|
-
consumerTag: string;
|
|
122
|
-
noAck: any;
|
|
123
|
-
onMessage: () => void;
|
|
124
|
-
options: any;
|
|
125
|
-
priority: number;
|
|
126
|
-
queueName: string;
|
|
127
|
-
ackAll(): void;
|
|
128
|
-
nackAll(requeue: boolean): void;
|
|
129
|
-
cancel(): void;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface BpmnEngineBrokerMessage {
|
|
133
|
-
fields: {routingKey: string, redelivered: boolean, exchange: any, consumerTag: string}[];
|
|
134
|
-
content: any;
|
|
135
|
-
properties: {messageId: string, persistent: boolean, timestamp: Date, expiration: number};
|
|
136
|
-
ack(allUpTo?: boolean): void;
|
|
137
|
-
nack(allUpTo?: boolean, requeue?: boolean): void;
|
|
138
|
-
reject(requeue?: boolean): void;
|
|
139
|
-
getRoutingKeyPattern(pattern: string): (test: string) => boolean;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export interface BpmnEngineBroker<W> {
|
|
143
|
-
new(owner: W): BpmnEngineBroker<W>;
|
|
144
|
-
readonly owner: W;
|
|
145
|
-
assertExchange(exchangeName: string, type: string, options?: any): void;
|
|
146
|
-
deleteExchange(exchangeName: string, ifUnused?: boolean): void;
|
|
147
|
-
bindExchange(source: string, destination: string, pattern: string, ...args: any[]): void;
|
|
148
|
-
|
|
149
|
-
unbindExchange(source: string, destination: string, pattern?: string): void;
|
|
150
|
-
assertQueue(queueName: string, options?: any): void;
|
|
151
|
-
bindQueue(queueName: string, exchangeName: string, pattern: string, options?: any): void;
|
|
152
|
-
unbindQueue(queueName: string, exchangeName: string, pattern: string): void;
|
|
153
|
-
|
|
154
|
-
consume(queueName: string, onMessage: () => void, options?: any): void;
|
|
155
|
-
cancel(consumerTag: string): void;
|
|
156
|
-
createQueue<Q>(): Q;
|
|
157
|
-
deleteQueue(queueName: string, options?: {ifUnused: boolean, ifEmpty?: boolean}): void;
|
|
158
|
-
|
|
159
|
-
getExchange<T>(exchangeName: string): T;
|
|
160
|
-
getQueue<Q>(queueName: string): Q;
|
|
161
|
-
getConsumers<C>(): C[];
|
|
162
|
-
getConsumer<C>(consumerTag: string): C;
|
|
163
|
-
getState<S>(): S;
|
|
164
|
-
recover<S>(state?: S): void;
|
|
165
|
-
purgeQueue(queueName: string): void;
|
|
166
|
-
sendToQueue(queueName: string, content: any, options?: any): void;
|
|
167
|
-
stop(): void;
|
|
168
|
-
get(queueName: string, options?: any): void;
|
|
169
|
-
|
|
170
|
-
ack(message: any, allUpTo?: boolean): void;
|
|
171
|
-
ackAll(): void;
|
|
172
|
-
nack(message: any, allUpTo?: boolean, requeue?: boolean): void;
|
|
173
|
-
nackAll(requeue?: boolean): void;
|
|
174
|
-
reject(message: any, requeue?: boolean): void;
|
|
175
|
-
|
|
176
|
-
createShovel<S>(name: string, source: string, destination: string, options?: any): S;
|
|
177
|
-
getShovel<S>(name: string): S;
|
|
178
|
-
closeShovel(name: string): void;
|
|
179
|
-
prefetch(count: number): void;
|
|
180
|
-
|
|
181
|
-
reset(): void;
|
|
182
|
-
on(eventName: string, handler: () => void): void;
|
|
183
|
-
off(eventName: string, handler: () => void): void;
|
|
184
|
-
unsubscribe(queueName: string, onMessage: () => void): void;
|
|
185
|
-
cancel(eventName: string): void;
|
|
186
|
-
subscribe(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
|
|
187
|
-
subscribeTmp(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
|
|
188
|
-
subscribeOnce(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
|
|
189
|
-
publish(exchangeName: string, routingKey: string, content?: any, options?: any): void;
|
|
190
|
-
close(): void;
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface BpmnEngineExecuteOptions {
|
|
195
|
-
variables?: BpmnEngineVariable;
|
|
58
|
+
export interface BpmnEngineExecuteOptions extends EnvironmentOptions {
|
|
196
59
|
listener?: EventEmitter;
|
|
197
|
-
services?: BpmnEngineService;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* optional override expressions handler
|
|
201
|
-
*/
|
|
202
|
-
expressions?: BpmnEngineExpressions;
|
|
203
60
|
}
|
|
204
61
|
|
|
205
|
-
export interface BpmnEngineOptions {
|
|
206
|
-
|
|
62
|
+
export interface BpmnEngineOptions extends BpmnEngineExecuteOptions {
|
|
207
63
|
/**
|
|
208
64
|
* optional name of engine,
|
|
209
65
|
*/
|
|
@@ -213,56 +69,46 @@ declare module 'bpmn-engine' {
|
|
|
213
69
|
*/
|
|
214
70
|
source?: string;
|
|
215
71
|
/**
|
|
216
|
-
*
|
|
72
|
+
* optional serialized context supplied by moddle-context-serializer
|
|
217
73
|
*/
|
|
218
|
-
sourceContext?:
|
|
219
|
-
variables?: BpmnEngineVariable;
|
|
220
|
-
settings?: BpmnEngineSetting;
|
|
74
|
+
sourceContext?: SerializableContext;
|
|
221
75
|
/**
|
|
222
|
-
* optional
|
|
76
|
+
* optional override of BPMN Elements behaviors, defaults to bpmn-elements
|
|
223
77
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
78
|
+
elements?: Record<string, any>;
|
|
226
79
|
/**
|
|
227
|
-
*
|
|
80
|
+
* Passed to moddle-context-serializer as extendFn
|
|
228
81
|
*/
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
listener?: EventEmitter;
|
|
232
|
-
// tslint:disable-next-line:ban-types
|
|
233
|
-
services?: BpmnEngineService;
|
|
234
|
-
|
|
235
|
-
elements?: any;
|
|
236
|
-
|
|
237
|
-
typeResolver?: <R>(...elements: any) => R;
|
|
82
|
+
typeResolver?: extendFn;
|
|
238
83
|
/**
|
|
239
84
|
* optional bpmn-moddle options to be passed to bpmn-moddle
|
|
240
85
|
*/
|
|
241
86
|
moddleOptions?: any;
|
|
242
|
-
moddleContext?:
|
|
87
|
+
moddleContext?: BpmnModdleDefinitions;
|
|
88
|
+
}
|
|
243
89
|
|
|
244
|
-
|
|
90
|
+
const enum BpmnEngineRunningStatus {
|
|
245
91
|
/**
|
|
246
|
-
*
|
|
92
|
+
* Engine is not executing
|
|
247
93
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
94
|
+
Idle = 'idle',
|
|
95
|
+
/**
|
|
96
|
+
* Engine is executing
|
|
97
|
+
*/
|
|
98
|
+
Running = 'running',
|
|
99
|
+
/**
|
|
100
|
+
* Engine execution is stopped
|
|
101
|
+
*/
|
|
102
|
+
Stopped = 'stopped',
|
|
103
|
+
/**
|
|
104
|
+
* Engine execution has errored
|
|
105
|
+
*/
|
|
106
|
+
Error = 'error',
|
|
261
107
|
}
|
|
262
108
|
|
|
263
|
-
export
|
|
264
|
-
|
|
265
|
-
|
|
109
|
+
export function Engine(options?: BpmnEngineOptions): Engine;
|
|
110
|
+
export class Engine extends EventEmitter {
|
|
111
|
+
constructor(options?: BpmnEngineOptions);
|
|
266
112
|
/**
|
|
267
113
|
* engine name
|
|
268
114
|
*/
|
|
@@ -270,11 +116,11 @@ declare module 'bpmn-engine' {
|
|
|
270
116
|
/**
|
|
271
117
|
* engine broker
|
|
272
118
|
*/
|
|
273
|
-
broker:
|
|
119
|
+
broker: ElementBroker<Engine>;
|
|
274
120
|
/**
|
|
275
121
|
* engine state
|
|
276
122
|
*/
|
|
277
|
-
readonly state:
|
|
123
|
+
readonly state: BpmnEngineRunningStatus;
|
|
278
124
|
/**
|
|
279
125
|
* boolean stopped
|
|
280
126
|
*/
|
|
@@ -282,15 +128,16 @@ declare module 'bpmn-engine' {
|
|
|
282
128
|
/**
|
|
283
129
|
* current engine execution
|
|
284
130
|
*/
|
|
285
|
-
readonly execution:
|
|
131
|
+
readonly execution: Execution;
|
|
286
132
|
/**
|
|
287
133
|
* engine environment
|
|
288
134
|
*/
|
|
289
|
-
readonly environment:
|
|
135
|
+
readonly environment: Environment;
|
|
290
136
|
/**
|
|
291
137
|
* engine logger
|
|
292
138
|
*/
|
|
293
|
-
readonly logger:
|
|
139
|
+
readonly logger: ILogger;
|
|
140
|
+
get activityStatus(): ActivityStatus;
|
|
294
141
|
|
|
295
142
|
/**
|
|
296
143
|
* execute definition
|
|
@@ -298,18 +145,21 @@ declare module 'bpmn-engine' {
|
|
|
298
145
|
* @param cb Callback called before the throw
|
|
299
146
|
* @summary Execute options overrides the initial options passed to the engine before executing the definition.
|
|
300
147
|
*/
|
|
301
|
-
execute(
|
|
148
|
+
execute(): Promise<Execution>;
|
|
149
|
+
execute(options: BpmnEngineExecuteOptions): Promise<Execution>;
|
|
150
|
+
execute(options: BpmnEngineExecuteOptions, cb: (err: Error) => void): Promise<Execution>;
|
|
151
|
+
execute(cb: (err: Error) => void): Promise<Execution>;
|
|
302
152
|
|
|
303
153
|
/**
|
|
304
154
|
* get definition by id
|
|
305
155
|
* @param id id of definition
|
|
306
156
|
*/
|
|
307
|
-
getDefinitionById(id: string): Promise<
|
|
157
|
+
getDefinitionById(id: string): Promise<Definition>;
|
|
308
158
|
|
|
309
159
|
/**
|
|
310
160
|
* get all definitions
|
|
311
161
|
*/
|
|
312
|
-
getDefinitions(): Promise<
|
|
162
|
+
getDefinitions(): Promise<Definition[]>;
|
|
313
163
|
|
|
314
164
|
/**
|
|
315
165
|
* get execution serialized state
|
|
@@ -321,348 +171,46 @@ declare module 'bpmn-engine' {
|
|
|
321
171
|
* @param state engine state
|
|
322
172
|
* @param recoverOptions optional object with options that will completely override the options passed to the engine at init
|
|
323
173
|
*/
|
|
324
|
-
recover(state: any, recoverOptions?: BpmnEngineOptions):
|
|
174
|
+
recover(state: any, recoverOptions?: BpmnEngineOptions): Engine;
|
|
325
175
|
|
|
326
176
|
/**
|
|
327
177
|
* Resume execution function with previously saved engine state.
|
|
328
178
|
* @param options
|
|
329
179
|
* @param callback
|
|
330
180
|
*/
|
|
331
|
-
resume(options?: BpmnEngineExecuteOptions, callback?: () => void): Promise<
|
|
181
|
+
resume(options?: BpmnEngineExecuteOptions, callback?: () => void): Promise<Execution>;
|
|
332
182
|
|
|
333
183
|
/**
|
|
334
184
|
* Stop execution. The instance is terminated.
|
|
335
185
|
*/
|
|
336
186
|
stop(): void;
|
|
337
187
|
|
|
338
|
-
waitFor<R>(eventName:
|
|
188
|
+
waitFor<R>(eventName: BpmnEngineEvent): Promise<R>;
|
|
339
189
|
|
|
340
190
|
/**
|
|
341
191
|
* Add definition source by source context.
|
|
342
192
|
* @param options
|
|
343
193
|
*/
|
|
344
194
|
addSource(options?: {sourceContext: any}): void;
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export function Engine(options?: BpmnEngineOptions): BpmnEngine;
|
|
349
|
-
|
|
350
|
-
export interface BpmnEngineExecution {
|
|
351
|
-
definitions: BpmnEngineExecutionDefinition[];
|
|
352
|
-
state: 'idle' | 'running';
|
|
353
|
-
environment: BpmnEngineExecutionEnvironment;
|
|
354
|
-
|
|
355
|
-
stopped: boolean;
|
|
356
|
-
execute(executeOptions?: any): BpmnEngineExecutionApi;
|
|
357
|
-
getState<R>(): R;
|
|
358
|
-
|
|
359
|
-
resume(resumeOptions?: any): void;
|
|
360
|
-
|
|
361
|
-
stop(): void;
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export interface BpmnEngineExecutionContext {
|
|
366
|
-
id: string;
|
|
367
|
-
name: string;
|
|
368
|
-
type: string;
|
|
369
|
-
sid: any;
|
|
370
|
-
definitionContext: any;
|
|
371
|
-
environment: BpmnEngineExecutionEnvironment;
|
|
372
|
-
|
|
373
|
-
clone(
|
|
374
|
-
environment?: BpmnEngineExecutionEnvironment
|
|
375
|
-
): BpmnEngineExecutionContext;
|
|
376
|
-
getActivities(scopeId?: string): BpmnEngineActivity[];
|
|
377
|
-
getActivityById(id: string): BpmnEngineActivity;
|
|
378
|
-
getExecutableProcesses(): any[];
|
|
379
|
-
getDataObjectById(id: string): any;
|
|
380
|
-
|
|
381
|
-
getMessageFlows(): any[];
|
|
382
|
-
|
|
383
|
-
getProcessById(id: string): any;
|
|
384
|
-
|
|
385
|
-
getProcesses(): any;
|
|
386
|
-
|
|
387
|
-
getSequenceFlowById(id: string): any;
|
|
388
|
-
|
|
389
|
-
getSequenceFlows(scopeId: string): any[];
|
|
390
|
-
|
|
391
|
-
getInboundSequenceFlows(activityId: string): any[];
|
|
392
|
-
getOutboundSequenceFlows(activityId: string): any[];
|
|
393
|
-
|
|
394
|
-
loadExtensions(activity: BpmnEngineActivity): void;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
export interface BpmnProcess {
|
|
398
|
-
new(processDefinition: any, context: BpmnEngineExecutionContext): BpmnProcess;
|
|
399
|
-
|
|
400
|
-
readonly id: string;
|
|
401
|
-
readonly type: string;
|
|
402
|
-
readonly name: string;
|
|
403
|
-
readonly isExecutable: boolean;
|
|
404
|
-
readonly broker: BpmnEngineBroker<BpmnEngine>;
|
|
405
|
-
|
|
406
|
-
readonly context: BpmnEngineExecutionContext;
|
|
407
|
-
readonly counters: Record<string, number>;
|
|
408
|
-
readonly environment: BpmnEngineExecutionEnvironment;
|
|
409
|
-
readonly execution: BpmnEngineExecutionApi;
|
|
410
|
-
readonly executionId: string;
|
|
411
|
-
readonly isRunning: boolean;
|
|
412
|
-
|
|
413
|
-
readonly logger: BpmnLogger;
|
|
414
|
-
readonly parent: BpmnProcess;
|
|
415
|
-
readonly status: any;
|
|
416
|
-
|
|
417
|
-
readonly stopped: boolean;
|
|
418
|
-
|
|
419
|
-
getApi(message: any): BpmnEngineExecutionApi;
|
|
420
|
-
getActivities(): BpmnEngineActivity[];
|
|
421
|
-
getActivityById(id: string): BpmnEngineActivity;
|
|
422
|
-
|
|
423
|
-
getSequenceFlows(): any[];
|
|
424
|
-
getPostponed(): BpmnEngineActivity[];
|
|
425
|
-
|
|
426
|
-
getState<S>(): S;
|
|
427
|
-
|
|
428
|
-
recover<S>(state: S): void;
|
|
429
|
-
resume(): void;
|
|
430
|
-
run(): void;
|
|
431
|
-
stop(): void;
|
|
432
|
-
waitFor<R>(eventName: string): Promise<R>;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
export interface BpmnEngineActivity extends EventEmitter {
|
|
436
|
-
readonly id: string;
|
|
437
|
-
readonly type: string;
|
|
438
|
-
readonly name: string;
|
|
439
|
-
|
|
440
|
-
readonly attachedTo: any;
|
|
441
|
-
|
|
442
|
-
readonly Behaviour: any;
|
|
443
|
-
|
|
444
|
-
readonly behaviour: any;
|
|
445
|
-
|
|
446
|
-
readonly broker: BpmnEngineBroker<BpmnEngine>;
|
|
447
|
-
|
|
448
|
-
readonly counters: Record<string, number>;
|
|
449
|
-
readonly environment: BpmnEngineExecutionEnvironment;
|
|
450
|
-
readonly execution: BpmnEngineExecutionApi;
|
|
451
|
-
readonly executionId: string;
|
|
452
|
-
readonly extensions: BpmnEngineExtension;
|
|
453
|
-
readonly logger: BpmnLogger;
|
|
454
|
-
readonly inbound: any[];
|
|
455
|
-
readonly isRunning: boolean;
|
|
456
|
-
readonly isStart: boolean;
|
|
457
|
-
readonly isSubProcess: boolean;
|
|
458
|
-
|
|
459
|
-
readonly outbound: any[];
|
|
460
|
-
readonly parent?: BpmnEngineActivity | BpmnProcess;
|
|
461
|
-
readonly status: any;
|
|
462
|
-
readonly stopped: boolean;
|
|
463
|
-
|
|
464
|
-
activate(): void;
|
|
465
|
-
|
|
466
|
-
deactivate(): void;
|
|
467
|
-
|
|
468
|
-
discard(): void;
|
|
469
|
-
|
|
470
|
-
getApi(message?: any): BpmnEngineExecutionApi;
|
|
471
|
-
|
|
472
|
-
getActivityById(id: string): BpmnEngineActivity;
|
|
473
|
-
|
|
474
|
-
getState<S>(): S;
|
|
475
|
-
|
|
476
|
-
message(messageContent: any): void;
|
|
477
|
-
signal: (message?: BpmnMessage, options?: any) => void;
|
|
478
|
-
next(): void;
|
|
479
|
-
|
|
480
|
-
recover<S>(state: S): void;
|
|
481
|
-
|
|
482
|
-
resume(): void;
|
|
483
|
-
|
|
484
|
-
run(runContent?: any): void;
|
|
485
|
-
|
|
486
|
-
stop(): void;
|
|
487
|
-
|
|
488
|
-
waitFor<R>(eventName: string): Promise<R>;
|
|
489
195
|
}
|
|
490
196
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
readonly options: any;
|
|
497
|
-
readonly extensions: BpmnEngineExtension;
|
|
498
|
-
|
|
499
|
-
readonly scripts: any;
|
|
500
|
-
readonly output: any;
|
|
501
|
-
readonly variables: BpmnEngineVariable;
|
|
502
|
-
|
|
503
|
-
readonly settings: BpmnEngineSetting;
|
|
504
|
-
|
|
505
|
-
readonly Logger: BpmnLogger;
|
|
506
|
-
readonly services: BpmnEngineService;
|
|
507
|
-
|
|
508
|
-
// tslint:disable: ban-types
|
|
509
|
-
addService(name: string, serviceFn: Function): void;
|
|
510
|
-
assignVariables(...vars: any): void;
|
|
511
|
-
clone(overrideOptions?: any): BpmnEngineExecutionEnvironment;
|
|
512
|
-
getScript(scriptType: string, activity: any): any;
|
|
513
|
-
getServiceByName(name: string): any;
|
|
514
|
-
|
|
515
|
-
getState(): BpmnEngineExecutionState;
|
|
516
|
-
|
|
517
|
-
registerScript(activity: any): void;
|
|
518
|
-
|
|
519
|
-
resolveExpression<R>(
|
|
520
|
-
expression: any,
|
|
521
|
-
message?: any,
|
|
522
|
-
expressionFnContext?: any,
|
|
523
|
-
): R;
|
|
524
|
-
|
|
525
|
-
recover(state: any): void;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export interface BpmnExecutionEventMessageContent {
|
|
529
|
-
id: string;
|
|
530
|
-
type: string;
|
|
531
|
-
executionId: string;
|
|
532
|
-
parent?: BpmnExecutionEventMessageContent;
|
|
533
|
-
path?: BpmnExecutionEventMessageContent[];
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
export interface BpmnExecutionEventMessageApi {
|
|
537
|
-
readonly id: string;
|
|
538
|
-
readonly type: string;
|
|
539
|
-
readonly name: string;
|
|
540
|
-
readonly executionId: string;
|
|
541
|
-
readonly environment: BpmnEngineExecutionEnvironment;
|
|
542
|
-
readonly fields: any;
|
|
543
|
-
|
|
544
|
-
readonly content: BpmnExecutionEventMessageContent;
|
|
545
|
-
readonly messageProperties: any;
|
|
546
|
-
readonly owner: BpmnEngine;
|
|
547
|
-
|
|
548
|
-
cancel(): void;
|
|
549
|
-
discard(): void;
|
|
550
|
-
signal(message: string, options: any): void;
|
|
551
|
-
stop(): void;
|
|
552
|
-
|
|
553
|
-
resolveExpression<R>(expression: any): R;
|
|
554
|
-
createMessage(overrideContent?: any): BpmnExecutionEventMessageApi;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
export interface BpmnEngineExecutionDefinition extends EventEmitter {
|
|
558
|
-
state: 'pending' | 'running' | 'completed';
|
|
559
|
-
run: (callback?: any) => void;
|
|
560
|
-
resume: (callback?: any) => void;
|
|
561
|
-
|
|
562
|
-
recover: (state?: any) => void;
|
|
563
|
-
|
|
564
|
-
sendMessage: (message: any) => void;
|
|
565
|
-
|
|
566
|
-
executionId: string;
|
|
567
|
-
execution: BpmnEngineExecutionApi;
|
|
568
|
-
getProcesses: () => any[];
|
|
569
|
-
|
|
570
|
-
getExecutableProcesses: () => any[];
|
|
571
|
-
getApi: <T>(message: any) => T;
|
|
572
|
-
getElementById: (elementId: string) => any;
|
|
573
|
-
getActivityById: (childId: string) => any;
|
|
574
|
-
environment: BpmnEngineExecutionEnvironment;
|
|
575
|
-
status: string;
|
|
576
|
-
stopped: boolean;
|
|
577
|
-
type: string;
|
|
578
|
-
signal: (message: BpmnMessage, options?: any) => void;
|
|
579
|
-
cancelActivity: (message?: any) => void;
|
|
580
|
-
shake: (activityId?: string) => any;
|
|
581
|
-
broker: BpmnEngineBroker<BpmnEngine>;
|
|
582
|
-
id: string;
|
|
583
|
-
isRunning: boolean;
|
|
584
|
-
name: string;
|
|
585
|
-
logger: BpmnLogger;
|
|
586
|
-
waitFor(name: string, fn: Function): void;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
export interface BpmnEngineExecutionDefinitionState {
|
|
590
|
-
readonly state: 'pending' | 'running' | 'completed';
|
|
591
|
-
readonly processes: {
|
|
592
|
-
[processId: string]: {
|
|
593
|
-
variables: BpmnEngineVariable;
|
|
594
|
-
services: BpmnEngineService;
|
|
595
|
-
children: BpmnEngineExecutionState[];
|
|
596
|
-
};
|
|
597
|
-
};
|
|
197
|
+
interface BpmnEngineDefinitionState extends DefinitionState {
|
|
198
|
+
/**
|
|
199
|
+
* Serialized moddle-context-serializer context
|
|
200
|
+
*/
|
|
201
|
+
source?: string;
|
|
598
202
|
}
|
|
599
203
|
|
|
600
204
|
export interface BpmnEngineExecutionState {
|
|
601
|
-
readonly name: string;
|
|
602
|
-
readonly state: 'idle' | 'running';
|
|
603
|
-
readonly stopped: boolean;
|
|
604
|
-
readonly engineVersion: string;
|
|
605
|
-
readonly environment: BpmnEngineExecutionEnvironment;
|
|
606
|
-
readonly definitions: BpmnEngineExecutionDefinitionState[];
|
|
607
|
-
|
|
608
|
-
readonly entered: boolean;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
export interface BpmnEngineEventApi {
|
|
612
|
-
/**
|
|
613
|
-
* engine name
|
|
614
|
-
*
|
|
615
|
-
* @type {string}
|
|
616
|
-
*
|
|
617
|
-
*/
|
|
618
205
|
name: string;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
*
|
|
622
|
-
* @type {("running"| "idle")}
|
|
623
|
-
*
|
|
624
|
-
*/
|
|
625
|
-
state: 'running' | 'idle';
|
|
626
|
-
/**
|
|
627
|
-
* is the execution stopped
|
|
628
|
-
*
|
|
629
|
-
* @type {boolean}
|
|
630
|
-
*
|
|
631
|
-
*/
|
|
206
|
+
engineVersion: string;
|
|
207
|
+
state: BpmnEngineRunningStatus;
|
|
632
208
|
stopped: boolean;
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
*
|
|
636
|
-
* @type {BpmnEngineExecutionEnvironment}
|
|
637
|
-
*
|
|
638
|
-
*/
|
|
639
|
-
environment: BpmnEngineExecutionEnvironment;
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* executing definitions
|
|
643
|
-
*
|
|
644
|
-
* @type {BpmnEngineExecutionDefinition}
|
|
645
|
-
*
|
|
646
|
-
*/
|
|
647
|
-
definitions: BpmnEngineExecutionDefinition;
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* get execution serializable state
|
|
651
|
-
*
|
|
652
|
-
* @returns {BpmnEngineExecutionState}
|
|
653
|
-
*
|
|
654
|
-
*/
|
|
655
|
-
getState(): BpmnEngineExecutionState;
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* get activities in a postponed state
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*/
|
|
662
|
-
getPostponed(): any[];
|
|
209
|
+
environment: EnvironmentState;
|
|
210
|
+
definitions: BpmnEngineDefinitionState[];
|
|
663
211
|
}
|
|
664
212
|
|
|
665
|
-
export interface
|
|
213
|
+
export interface Execution {
|
|
666
214
|
/**
|
|
667
215
|
* engine name
|
|
668
216
|
*
|
|
@@ -687,24 +235,26 @@ declare module 'bpmn-engine' {
|
|
|
687
235
|
/**
|
|
688
236
|
* engine environment
|
|
689
237
|
*
|
|
690
|
-
* @type {
|
|
238
|
+
* @type {Environment}
|
|
691
239
|
*
|
|
692
240
|
*/
|
|
693
|
-
readonly environment:
|
|
241
|
+
readonly environment: Environment;
|
|
694
242
|
|
|
695
243
|
/**
|
|
696
244
|
* executing definitions
|
|
697
245
|
*
|
|
698
|
-
* @type {
|
|
246
|
+
* @type {Definition}
|
|
699
247
|
*
|
|
700
248
|
*/
|
|
701
|
-
readonly definitions:
|
|
249
|
+
readonly definitions: Definition[];
|
|
250
|
+
get activityStatus(): ActivityStatus;
|
|
702
251
|
|
|
703
252
|
/**
|
|
704
253
|
* Get activity/element by id. Loops the definitions and returns the first found activity with id.
|
|
705
254
|
* @param activityId Activity or element id
|
|
706
255
|
*/
|
|
707
|
-
getActivityById(activityId: string):
|
|
256
|
+
getActivityById(activityId: string): ElementBase;
|
|
257
|
+
getActivityById<R>(activityId: string): R;
|
|
708
258
|
|
|
709
259
|
/**
|
|
710
260
|
* get execution serializable state
|
|
@@ -726,7 +276,7 @@ declare module 'bpmn-engine' {
|
|
|
726
276
|
*
|
|
727
277
|
*
|
|
728
278
|
*/
|
|
729
|
-
getPostponed():
|
|
279
|
+
getPostponed(): Api<ElementBase>[];
|
|
730
280
|
|
|
731
281
|
/**
|
|
732
282
|
* send signal to execution, distributed to all definitions
|
|
@@ -748,7 +298,5 @@ declare module 'bpmn-engine' {
|
|
|
748
298
|
* @param event
|
|
749
299
|
*/
|
|
750
300
|
waitFor<T>(event: BpmnEngineEvent): Promise<T>;
|
|
751
|
-
|
|
752
301
|
}
|
|
753
|
-
|
|
754
302
|
}
|