bpmn-engine 12.0.4 → 13.0.1

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.
@@ -1,8 +1,8 @@
1
1
  // Author : Saeed Tabrizi
2
2
 
3
- import { EventEmitter } from "events";
3
+ import {EventEmitter} from 'events';
4
4
 
5
- declare module "bpmn-engine" {
5
+ declare module 'bpmn-engine' {
6
6
 
7
7
  /**
8
8
  * Engine emits the following events:
@@ -25,7 +25,16 @@ declare module "bpmn-engine" {
25
25
  activity.throw: An recoverable error was thrown
26
26
  activity.error: An non-recoverable error has occurred
27
27
  */
28
- export type BpmnActivityEvent = 'activity.enter' | 'activity.start' | 'activity.wait' | 'wait' | 'activity.end' | 'activity.leave' | 'activity.stop' | 'activity.throw' | 'activity.error';
28
+ export type BpmnActivityEvent =
29
+ 'activity.enter'
30
+ | 'activity.start'
31
+ | 'activity.wait'
32
+ | 'wait'
33
+ | 'activity.end'
34
+ | 'activity.leave'
35
+ | 'activity.stop'
36
+ | 'activity.throw'
37
+ | 'activity.error';
29
38
  /**
30
39
  * Sequence flow events
31
40
  flow.take: The sequence flow was taken
@@ -33,163 +42,166 @@ declare module "bpmn-engine" {
33
42
  flow.looped: The sequence is looped
34
43
  */
35
44
  export type BpmnSequenceFlowEvent = 'flow.take' | 'flow.discard' | 'flow.looped';
36
- export type BpmnEngineVariable = Record<string,any>;
45
+ export type BpmnEngineVariable = Record<string, any>;
37
46
 
38
47
  export interface BpmnLogger {
39
48
  debug(...args: any[]): void;
40
49
  error(...args: any[]): void;
41
50
  warn(...args: any[]): void;
42
51
  }
43
- export interface BpmnMessage{
44
- id?:string,executionId?: string, [name: string]: any
52
+
53
+ export interface BpmnMessage {
54
+ id?: string,
55
+ executionId?: string,
56
+ [name: string]: any
45
57
  }
46
58
 
47
59
  export interface BpmnEngineBrokerExchange {
48
60
  name: string;
49
61
  type: 'topic' | 'direct';
50
62
  options: any;
51
- bindingCount:number;
63
+ bindingCount: number;
52
64
  bindings: any[];
53
65
  stopped: boolean;
54
- bind(queue:string, pattern: string, bindOptions?: any):void;
55
- close():void;
56
- emit(eventName: string, content?:any): void;
57
- getBinding(queueName:string, pattern:string):any;
58
- getState<S>():S;
59
- on(pattern:string, handler:()=>void, consumeOptions?: any):void;
60
- off(pattern:string, handler:()=>void):void;
61
- publish(routingKey:string, content?: any, properties?:any):void;
62
- recover<S>(state:S, getQueue?:boolean):void;
63
- stop():void;
64
- unbind(queue:string, pattern:string):void;
65
- unbindQueueByName(queueName:string): void;
66
+ bind(queue: string, pattern: string, bindOptions?: any): void;
67
+ close(): void;
68
+ emit(eventName: string, content?: any): void;
69
+ getBinding(queueName: string, pattern: string): any;
70
+ getState<S>(): S;
71
+ on(pattern: string, handler: () => void, consumeOptions?: any): void;
72
+ off(pattern: string, handler: () => void): void;
73
+ publish(routingKey: string, content?: any, properties?: any): void;
74
+ recover<S>(state: S, getQueue?: boolean): void;
75
+ stop(): void;
76
+ unbind(queue: string, pattern: string): void;
77
+ unbindQueueByName(queueName: string): void;
66
78
  }
67
79
 
68
80
  export interface BpmnEngineBrokerQueue {
69
81
  name: string;
70
82
  options: any;
71
83
  messages: any[];
72
- messageCount:number;
73
- consumerCount:number;
84
+ messageCount: number;
85
+ consumerCount: number;
74
86
  stopped: boolean;
75
87
  exclusive: boolean;
76
88
  maxLength: number;
77
89
  readonly capacity: number;
78
90
  messageTtl: number;
79
- ack(message: any):void;
80
- ackAll():void;
81
- assertConsumer(onMessage:()=>void, consumeOptions?: any, owner?: any):void;
82
- cancel(consumerTag:string):void;
83
- close():void;
84
- consume(onMessage:()=>void, consumeOptions?: any, owner?:any):void;
85
- delete(deleteOptions?: any):void;
91
+ ack(message: any): void;
92
+ ackAll(): void;
93
+ assertConsumer(onMessage: () => void, consumeOptions?: any, owner?: any): void;
94
+ cancel(consumerTag: string): void;
95
+ close(): void;
96
+ consume(onMessage: () => void, consumeOptions?: any, owner?: any): void;
97
+ delete(deleteOptions?: any): void;
86
98
  dequeueMessage(message: any): void;
87
- dismiss(onMessage:()=>void): void;
99
+ dismiss(onMessage: () => void): void;
88
100
  get<T>(consumeOptions?: any): T;
89
- getState<S>():S ;
90
- nack(message:any, allUpTo?:boolean, requeue?: boolean ):void;
91
- nackAll(requeue: boolean):void;
92
- off(eventName:string, handler:()=>void): void;
101
+ getState<S>(): S;
102
+ nack(message: any, allUpTo?: boolean, requeue?: boolean): void;
103
+ nackAll(requeue: boolean): void;
104
+ off(eventName: string, handler: () => void): void;
93
105
 
94
- on(eventName:string, handler:()=>void):void;
106
+ on(eventName: string, handler: () => void): void;
95
107
 
96
108
  peek(ignoreDelivered?: boolean): void;
97
- purge():void;
109
+ purge(): void;
98
110
 
99
- queueMessage(fields: any[], content?:any, properties?:any, onMessageQueued?:()=>void):void;
100
- recover<S>(state:S):void;
101
- reject(message:any, requeue?:boolean):void;
102
- stop():void;
111
+ queueMessage(fields: any[], content?: any, properties?: any, onMessageQueued?: () => void): void;
112
+ recover<S>(state: S): void;
113
+ reject(message: any, requeue?: boolean): void;
114
+ stop(): void;
103
115
  unbindConsumer(): void;
104
116
  }
105
117
 
106
- export interface BpmnEngineBrokerConsumer{
118
+ export interface BpmnEngineBrokerConsumer {
107
119
  consumerTag: string;
108
120
  noAck: any;
109
- onMessage: ()=>void;
121
+ onMessage: () => void;
110
122
  options: any;
111
123
  priority: number;
112
- queueName:string;
113
- ackAll():void;
114
- nackAll(requeue: boolean):void;
115
- cancel():void;
124
+ queueName: string;
125
+ ackAll(): void;
126
+ nackAll(requeue: boolean): void;
127
+ cancel(): void;
116
128
  }
117
129
 
118
- export interface BpmnEngineBrokerMessage{
119
- fields: {routingKey:string,redelivered:boolean,exchange: any,consumerTag:string}[];
130
+ export interface BpmnEngineBrokerMessage {
131
+ fields: {routingKey: string, redelivered: boolean, exchange: any, consumerTag: string}[];
120
132
  content: any;
121
- properties: {messageId: string,persistent: boolean,timestamp: Date,expiration:number};
122
- ack(allUpTo?:boolean):void;
123
- nack(allUpTo?: boolean, requeue?:boolean):void;
124
- reject(requeue?: boolean ): void;
125
- getRoutingKeyPattern(pattern: string): (test:string)=>boolean;
133
+ properties: {messageId: string, persistent: boolean, timestamp: Date, expiration: number};
134
+ ack(allUpTo?: boolean): void;
135
+ nack(allUpTo?: boolean, requeue?: boolean): void;
136
+ reject(requeue?: boolean): void;
137
+ getRoutingKeyPattern(pattern: string): (test: string) => boolean;
126
138
  }
127
- export interface BpmnEngineBroker<W>{
128
- new(owner:W):BpmnEngineBroker<W>;
139
+
140
+ export interface BpmnEngineBroker<W> {
141
+ new(owner: W): BpmnEngineBroker<W>;
129
142
  readonly owner: W;
130
- assertExchange(exchangeName:string, type: string, options?:any):void;
131
- deleteExchange(exchangeName:string, ifUnused?:boolean):void;
132
- bindExchange(source:string, destination:string, pattern: string, ...args: any[]):void;
133
-
134
- unbindExchange(source:string, destination:string, pattern?: string):void;
135
- assertQueue(queueName:string, options?: any):void;
136
- bindQueue(queueName:string, exchangeName:string, pattern:string, options?: any):void;
137
- unbindQueue(queueName:string, exchangeName:string, pattern:string):void;
138
-
139
- consume(queueName:string, onMessage:()=>void, options?:any):void;
140
- cancel(consumerTag:string):void;
141
- createQueue<Q>():Q;
142
- deleteQueue(queueName:string ,options?:{ifUnused:boolean, ifEmpty?:boolean}):void;
143
-
144
-
145
- getExchange<T>(exchangeName:string):T;
146
- getQueue<Q>(queueName:string):Q;
147
- getConsumers<C>():C[];
148
- getConsumer<C>(consumerTag:string):C;
149
- getState<S>():S;
150
- recover<S>(state?:S):void;
151
- purgeQueue(queueName:string):void;
152
- sendToQueue(queueName:string, content: any, options?:any):void;
153
- stop():void;
154
- get(queueName:string, options?: any):void;
155
-
156
- ack(message:any ,allUpTo?: boolean,):void;
157
- ackAll():void;
158
- nack(message:any ,allUpTo?: boolean, requeue?: boolean):void;
159
- nackAll(requeue?:boolean):void;
160
- reject(message:any, requeue?:boolean):void;
161
-
162
- createShovel<S>(name:string, source:string, destination:string ,options?: any):S;
163
- getShovel<S>(name:string):S;
164
- closeShovel(name:string):void;
165
- prefetch(count:number):void;
166
-
167
- reset():void;
168
- on(eventName:string, handler:()=>void):void;
169
- off(eventName:string, handler:()=>void):void;
170
- unsubscribe(queueName:string, onMessage:()=>void):void
171
- cancel(eventName: string):void;
172
- subscribe(exchangeName:string, pattern: string, queueName:string, onMessage:()=>void, options?: any):void;
173
- subscribeTmp(exchangeName:string, pattern: string, queueName:string, onMessage:()=>void, options?: any):void;
174
- subscribeOnce(exchangeName:string, pattern: string, queueName:string, onMessage:()=>void, options?: any):void;
175
- publish(exchangeName:string, routingKey:string, content?:any, options?: any):void;
143
+ assertExchange(exchangeName: string, type: string, options?: any): void;
144
+ deleteExchange(exchangeName: string, ifUnused?: boolean): void;
145
+ bindExchange(source: string, destination: string, pattern: string, ...args: any[]): void;
146
+
147
+ unbindExchange(source: string, destination: string, pattern?: string): void;
148
+ assertQueue(queueName: string, options?: any): void;
149
+ bindQueue(queueName: string, exchangeName: string, pattern: string, options?: any): void;
150
+ unbindQueue(queueName: string, exchangeName: string, pattern: string): void;
151
+
152
+ consume(queueName: string, onMessage: () => void, options?: any): void;
153
+ cancel(consumerTag: string): void;
154
+ createQueue<Q>(): Q;
155
+ deleteQueue(queueName: string, options?: {ifUnused: boolean, ifEmpty?: boolean}): void;
156
+
157
+ getExchange<T>(exchangeName: string): T;
158
+ getQueue<Q>(queueName: string): Q;
159
+ getConsumers<C>(): C[];
160
+ getConsumer<C>(consumerTag: string): C;
161
+ getState<S>(): S;
162
+ recover<S>(state?: S): void;
163
+ purgeQueue(queueName: string): void;
164
+ sendToQueue(queueName: string, content: any, options?: any): void;
165
+ stop(): void;
166
+ get(queueName: string, options?: any): void;
167
+
168
+ ack(message: any, allUpTo?: boolean): void;
169
+ ackAll(): void;
170
+ nack(message: any, allUpTo?: boolean, requeue?: boolean): void;
171
+ nackAll(requeue?: boolean): void;
172
+ reject(message: any, requeue?: boolean): void;
173
+
174
+ createShovel<S>(name: string, source: string, destination: string, options?: any): S;
175
+ getShovel<S>(name: string): S;
176
+ closeShovel(name: string): void;
177
+ prefetch(count: number): void;
178
+
179
+ reset(): void;
180
+ on(eventName: string, handler: () => void): void;
181
+ off(eventName: string, handler: () => void): void;
182
+ unsubscribe(queueName: string, onMessage: () => void): void;
183
+ cancel(eventName: string): void;
184
+ subscribe(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
185
+ subscribeTmp(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
186
+ subscribeOnce(exchangeName: string, pattern: string, queueName: string, onMessage: () => void, options?: any): void;
187
+ publish(exchangeName: string, routingKey: string, content?: any, options?: any): void;
176
188
  close(): void;
177
189
 
178
- }
190
+ }
179
191
 
180
- export interface BpmnEngineExecuteOptions {
192
+ export interface BpmnEngineExecuteOptions {
181
193
  variables?: BpmnEngineVariable;
182
194
  listener?: EventEmitter;
183
195
  services?: BpmnEngineService;
184
196
 
185
- /**
197
+ /**
186
198
  * optional override expressions handler
187
199
  */
188
200
  expressions?: BpmnEngineExpressions;
189
- }
201
+ }
202
+
203
+ export interface BpmnEngineOptions {
190
204
 
191
- export interface BpmnEngineOptions {
192
-
193
205
  /**
194
206
  * optional name of engine,
195
207
  */
@@ -203,28 +215,28 @@ declare module "bpmn-engine" {
203
215
  */
204
216
  sourceContext?: any;
205
217
  variables?: BpmnEngineVariable;
206
- /**
207
- * optional Logger factory, defaults to debug logger
208
- */
209
- Logger?: BpmnLogger;
210
-
218
+ /**
219
+ * optional Logger factory, defaults to debug logger
220
+ */
221
+ Logger?: (scope: string) => BpmnLogger;
222
+
211
223
  /**
212
224
  * optional inline script handler, defaults to nodejs vm module handling, i.e. JavaScript
213
225
  */
214
226
  scripts?: any;
215
-
227
+
216
228
  listener?: EventEmitter;
217
229
  // tslint:disable-next-line:ban-types
218
230
  services?: BpmnEngineService;
219
-
231
+
220
232
  elements?: any;
221
-
233
+
222
234
  typeResolver?: <R>(...elements: any) => R;
223
235
  /**
224
236
  * optional bpmn-moddle options to be passed to bpmn-moddle
225
237
  */
226
238
  moddleOptions?: any;
227
-
239
+
228
240
  extensions?: BpmnEngineExtension;
229
241
  /**
230
242
  * optional override expressions handler
@@ -232,10 +244,10 @@ declare module "bpmn-engine" {
232
244
  expressions?: BpmnEngineExpressions;
233
245
  }
234
246
 
235
- export interface BpmnEngineExtension{
236
- [name: string]: (activiy?:BpmnEngineActivity,environment?:BpmnEngineExecutionEnvironment)=>void;
247
+ export interface BpmnEngineExtension {
248
+ [name: string]: (activiy?: BpmnEngineActivity, environment?: BpmnEngineExecutionEnvironment) => void;
237
249
  }
238
-
250
+
239
251
  export interface BpmnEngineExpressions {
240
252
  resolveExpression<R>(
241
253
  expression: string,
@@ -243,6 +255,7 @@ declare module "bpmn-engine" {
243
255
  expressionFnContext?: any,
244
256
  ): R;
245
257
  }
258
+
246
259
  export interface BpmnEngine {
247
260
  new(options?: BpmnEngineOptions): BpmnEngine;
248
261
 
@@ -274,22 +287,26 @@ declare module "bpmn-engine" {
274
287
  * engine logger
275
288
  */
276
289
  readonly logger: BpmnLogger;
277
- /**
278
- * execute definition
279
- * @param options Optional object with options to override the initial engine options
280
- * @summary Execute options overrides the initial options passed to the engine before executing the definition.
281
- */
282
- execute(options?:BpmnEngineExecuteOptions): Promise<BpmnEngineExecutionApi>;
290
+
291
+ /**
292
+ * execute definition
293
+ * @param options Optional object with options to override the initial engine options
294
+ * @param cb Callback called before the throw
295
+ * @summary Execute options overrides the initial options passed to the engine before executing the definition.
296
+ */
297
+ execute(options?:BpmnEngineExecuteOptions, cb?: (err) => void): Promise<BpmnEngineExecutionApi>;
298
+
283
299
  /**
284
300
  * get definition by id
285
301
  * @param id id of definition
286
302
  */
287
303
  getDefinitionById(id: string): Promise<any>;
288
-
304
+
289
305
  /**
290
306
  * get all definitions
291
307
  */
292
308
  getDefinitions(): Promise<any[]>;
309
+
293
310
  /**
294
311
  * get execution serialized state
295
312
  */
@@ -300,14 +317,14 @@ declare module "bpmn-engine" {
300
317
  * @param state engine state
301
318
  * @param recoverOptions optional object with options that will completely override the options passed to the engine at init
302
319
  */
303
- recover(state: any,recoverOptions?:BpmnEngineOptions): BpmnEngine;
320
+ recover(state: any, recoverOptions?: BpmnEngineOptions): BpmnEngine;
304
321
 
305
322
  /**
306
323
  * Resume execution function with previously saved engine state.
307
- * @param options
308
- * @param callback
324
+ * @param options
325
+ * @param callback
309
326
  */
310
- resume(options?: BpmnEngineExecuteOptions, callback?:()=> void): Promise<BpmnEngineExecutionApi>;
327
+ resume(options?: BpmnEngineExecuteOptions, callback?: () => void): Promise<BpmnEngineExecutionApi>;
311
328
 
312
329
  /**
313
330
  * Stop execution. The instance is terminated.
@@ -317,403 +334,417 @@ declare module "bpmn-engine" {
317
334
  waitFor<R>(eventName: string): Promise<R>;
318
335
 
319
336
  /**
320
- * Add definition source by source context.
321
- * @param options
322
- */
337
+ * Add definition source by source context.
338
+ * @param options
339
+ */
323
340
  addSource(options?: {sourceContext: any}): void;
324
341
 
325
342
  }
326
343
 
327
- export function Engine(options?:BpmnEngineOptions): BpmnEngine;
344
+ export function Engine(options?: BpmnEngineOptions): BpmnEngine;
328
345
 
329
- export interface BpmnEngineExecution {
330
- definitions: BpmnEngineExecutionDefinition[];
331
- state: "idle" | "running";
332
- environment: BpmnEngineExecutionEnvironment;
346
+ export interface BpmnEngineExecution {
347
+ definitions: BpmnEngineExecutionDefinition[];
348
+ state: 'idle' | 'running';
349
+ environment: BpmnEngineExecutionEnvironment;
333
350
 
334
- stopped: boolean;
335
- execute(executeOptions?: any): BpmnEngineExecutionApi;
336
- getState<R>(): R;
351
+ stopped: boolean;
352
+ execute(executeOptions?: any): BpmnEngineExecutionApi;
353
+ getState<R>(): R;
337
354
 
338
- resume(resumeOptions?: any): void;
355
+ resume(resumeOptions?: any): void;
339
356
 
340
- stop(): void;
357
+ stop(): void;
341
358
 
342
- }
359
+ }
343
360
 
344
- export interface BpmnEngineExecutionContext {
345
- id: string;
346
- name: string;
347
- type: string;
348
- sid: any;
349
- definitionContext: any;
350
- environment: BpmnEngineExecutionEnvironment;
361
+ export interface BpmnEngineExecutionContext {
362
+ id: string;
363
+ name: string;
364
+ type: string;
365
+ sid: any;
366
+ definitionContext: any;
367
+ environment: BpmnEngineExecutionEnvironment;
351
368
 
352
- clone(
353
- environment?: BpmnEngineExecutionEnvironment,
354
- ): BpmnEngineExecutionContext;
355
- getActivities(scopeId?: string): BpmnEngineActivity[];
356
- getActivityById(id: string): BpmnEngineActivity;
357
- getExecutableProcesses(): any[];
358
- getDataObjectById(id: string): any;
369
+ clone(
370
+ environment?: BpmnEngineExecutionEnvironment
371
+ ): BpmnEngineExecutionContext;
372
+ getActivities(scopeId?: string): BpmnEngineActivity[];
373
+ getActivityById(id: string): BpmnEngineActivity;
374
+ getExecutableProcesses(): any[];
375
+ getDataObjectById(id: string): any;
359
376
 
360
- getMessageFlows(): any[];
377
+ getMessageFlows(): any[];
361
378
 
362
- getProcessById(id: string): any;
379
+ getProcessById(id: string): any;
363
380
 
364
- getProcesses(): any;
381
+ getProcesses(): any;
365
382
 
366
- getSequenceFlowById(id: string): any;
383
+ getSequenceFlowById(id: string): any;
367
384
 
368
- getSequenceFlows(scopeId: string): any[];
385
+ getSequenceFlows(scopeId: string): any[];
369
386
 
370
- getInboundSequenceFlows(activityId: string): any[];
371
- getOutboundSequenceFlows(activityId: string): any[];
387
+ getInboundSequenceFlows(activityId: string): any[];
388
+ getOutboundSequenceFlows(activityId: string): any[];
372
389
 
373
- loadExtensions(activity: BpmnEngineActivity): void;
374
- }
375
- export interface BpmnProcess {
376
- new (processDefinition: any, context: BpmnEngineExecutionContext): BpmnProcess;
377
- readonly id: string;
378
- readonly type: string;
379
- readonly name: string;
380
- readonly isExecutable: boolean;
381
- readonly broker: BpmnEngineBroker<BpmnEngine>;
382
-
383
- readonly context: BpmnEngineExecutionContext;
384
- readonly counters: Record<string,number>;
385
- readonly environment: BpmnEngineExecutionEnvironment;
386
- readonly execution: BpmnEngineExecutionApi;
387
- readonly executionId: string;
388
- readonly isRunning: boolean;
389
-
390
- readonly logger: BpmnLogger;
391
- readonly parent: BpmnProcess;
392
- readonly status: any;
393
-
394
- readonly stopped: boolean;
395
-
396
- getApi(message: any): BpmnEngineExecutionApi;
397
- getActivities(): BpmnEngineActivity[];
398
- getActivityById(id: string): BpmnEngineActivity;
399
-
400
- getSequenceFlows(): any[];
401
- getPostponed(): BpmnEngineActivity[];
402
-
403
- getState<S>(): S;
404
-
405
- recover<S>(state: S): void;
406
- resume(): void;
407
- run(): void;
408
- stop(): void;
409
- waitFor<R>(eventName: string): Promise<R>;
410
- }
390
+ loadExtensions(activity: BpmnEngineActivity): void;
391
+ }
411
392
 
412
- export interface BpmnEngineActivity extends EventEmitter {
413
- readonly id: string;
414
- readonly type: string;
415
- readonly name: string;
393
+ export interface BpmnProcess {
394
+ new(processDefinition: any, context: BpmnEngineExecutionContext): BpmnProcess;
416
395
 
417
- readonly attachedTo: any;
396
+ readonly id: string;
397
+ readonly type: string;
398
+ readonly name: string;
399
+ readonly isExecutable: boolean;
400
+ readonly broker: BpmnEngineBroker<BpmnEngine>;
418
401
 
419
- readonly Behaviour: any;
402
+ readonly context: BpmnEngineExecutionContext;
403
+ readonly counters: Record<string, number>;
404
+ readonly environment: BpmnEngineExecutionEnvironment;
405
+ readonly execution: BpmnEngineExecutionApi;
406
+ readonly executionId: string;
407
+ readonly isRunning: boolean;
420
408
 
421
- readonly behaviour: any;
409
+ readonly logger: BpmnLogger;
410
+ readonly parent: BpmnProcess;
411
+ readonly status: any;
422
412
 
423
- readonly broker: BpmnEngineBroker<BpmnEngine>;
413
+ readonly stopped: boolean;
424
414
 
425
- readonly counters: Record<string,number>;
426
- readonly environment: BpmnEngineExecutionEnvironment;
427
- readonly execution: BpmnEngineExecutionApi;
428
- readonly executionId: string;
429
- readonly extensions: BpmnEngineExtension;
430
- readonly logger: BpmnLogger;
431
- readonly inbound: any[];
432
- readonly isRunning: boolean;
433
- readonly isStart: boolean;
434
- readonly isSubProcess: boolean;
415
+ getApi(message: any): BpmnEngineExecutionApi;
416
+ getActivities(): BpmnEngineActivity[];
417
+ getActivityById(id: string): BpmnEngineActivity;
435
418
 
436
- readonly outbound: any[];
437
- readonly parent?: BpmnEngineActivity | BpmnProcess;
438
- readonly status: any;
439
- readonly stopped: boolean;
419
+ getSequenceFlows(): any[];
420
+ getPostponed(): BpmnEngineActivity[];
440
421
 
441
- activate(): void;
422
+ getState<S>(): S;
442
423
 
443
- deactivate(): void;
424
+ recover<S>(state: S): void;
425
+ resume(): void;
426
+ run(): void;
427
+ stop(): void;
428
+ waitFor<R>(eventName: string): Promise<R>;
429
+ }
444
430
 
445
- discard(): void;
431
+ export interface BpmnEngineActivity extends EventEmitter {
432
+ readonly id: string;
433
+ readonly type: string;
434
+ readonly name: string;
446
435
 
447
- getApi(message?: any): BpmnEngineExecutionApi;
436
+ readonly attachedTo: any;
448
437
 
449
- getActivityById(id: string): BpmnEngineActivity;
438
+ readonly Behaviour: any;
450
439
 
451
- getState<S>(): S;
440
+ readonly behaviour: any;
452
441
 
453
- message(messageContent: any): void;
454
- signal: (message?: BpmnMessage, options?: any) => void;
455
- next(): void;
442
+ readonly broker: BpmnEngineBroker<BpmnEngine>;
456
443
 
457
- recover<S>(state: S): void;
444
+ readonly counters: Record<string, number>;
445
+ readonly environment: BpmnEngineExecutionEnvironment;
446
+ readonly execution: BpmnEngineExecutionApi;
447
+ readonly executionId: string;
448
+ readonly extensions: BpmnEngineExtension;
449
+ readonly logger: BpmnLogger;
450
+ readonly inbound: any[];
451
+ readonly isRunning: boolean;
452
+ readonly isStart: boolean;
453
+ readonly isSubProcess: boolean;
454
+
455
+ readonly outbound: any[];
456
+ readonly parent?: BpmnEngineActivity | BpmnProcess;
457
+ readonly status: any;
458
+ readonly stopped: boolean;
458
459
 
459
- resume(): void;
460
+ activate(): void;
460
461
 
461
- run(runContent?: any): void;
462
+ deactivate(): void;
462
463
 
463
- stop(): void;
464
+ discard(): void;
464
465
 
465
- waitFor<R>(eventName: string): Promise<R>;
466
- }
466
+ getApi(message?: any): BpmnEngineExecutionApi;
467
467
 
468
- export interface BpmnEngineService {
469
- [name: string]: Function
470
- }
471
- export interface BpmnEngineExecutionEnvironment {
472
- readonly options: any;
473
- readonly extensions: BpmnEngineExtension;
468
+ getActivityById(id: string): BpmnEngineActivity;
474
469
 
475
- readonly scripts: any;
476
- readonly output: any;
477
- readonly variables: BpmnEngineVariable;
470
+ getState<S>(): S;
478
471
 
479
- readonly settings: any;
472
+ message(messageContent: any): void;
473
+ signal: (message?: BpmnMessage, options?: any) => void;
474
+ next(): void;
480
475
 
481
- readonly Logger: BpmnLogger;
482
- readonly services: BpmnEngineService;
483
- // tslint:disable: ban-types
484
- addService(name: string, serviceFn: Function): void;
485
- assignVariables(...vars: any): void;
486
- clone(overrideOptions?: any): BpmnEngineExecutionEnvironment;
487
- getScript(scriptType: string, activity: any): any;
488
- getServiceByName(name: string): any;
476
+ recover<S>(state: S): void;
489
477
 
490
- getState(): BpmnEngineExecutionState;
478
+ resume(): void;
491
479
 
492
- registerScript(activity: any): void;
480
+ run(runContent?: any): void;
493
481
 
494
- resolveExpression<R>(
495
- expression: any,
496
- message?: any,
497
- expressionFnContext?: any,
498
- ): R;
482
+ stop(): void;
499
483
 
500
- recover(state: any): void;
501
- }
502
- export interface BpmnExecutionEventMessageContent {
503
- id: string;
504
- type: string;
505
- executionId: string;
506
- parent?: BpmnExecutionEventMessageContent;
507
- path?: BpmnExecutionEventMessageContent[];
508
- }
509
- export interface BpmnExecutionEventMessageApi {
510
- readonly id: string;
511
- readonly type: string;
512
- readonly name: string;
513
- readonly executionId: string;
514
- readonly environment: BpmnEngineExecutionEnvironment;
515
- readonly fields: any;
516
-
517
- readonly content: BpmnExecutionEventMessageContent;
518
- readonly messageProperties: any;
519
- readonly owner: BpmnEngine;
520
-
521
- cancel(): void;
522
- discard(): void;
523
- signal(message: string, options: any): void;
524
- stop(): void;
525
-
526
- resolveExpression<R>(expression: any): R;
527
- createMessage(overrideContent?: any): BpmnExecutionEventMessageApi;
528
- }
529
- export interface BpmnEngineExecutionDefinition extends EventEmitter {
530
- state: "pending" | "running" | "completed";
531
- run: (callback?: any) => void;
532
- resume: (callback?: any) => void;
533
-
534
- recover: (state?: any) => void;
535
-
536
- sendMessage: (message: any) => void;
537
-
538
- executionId: string;
539
- execution: BpmnEngineExecutionApi;
540
- getProcesses: () => any[];
541
-
542
- getExecutableProcesses: () => any[];
543
- getApi: <T>(message: any) => T;
544
- getElementById: (elementId: string) => any;
545
- getActivityById: (childId: string) => any;
546
- environment: BpmnEngineExecutionEnvironment;
547
- status: string;
548
- stopped: boolean;
549
- type: string;
550
- signal: (message: BpmnMessage, options?: any) => void;
551
- cancelActivity: (message?: any) => void;
552
- shake: (activityId?: string) => any;
553
- broker: BpmnEngineBroker<BpmnEngine>;
554
- id: string;
555
- isRunning: boolean;
556
- name: string;
557
- logger: BpmnLogger;
558
- waitFor(name: string, fn: Function): void;
559
- }
560
- export interface BpmnEngineExecutionDefinitionState {
561
- readonly state: "pending" | "running" | "completed";
562
- readonly processes: {
563
- [processId: string]: {
564
- variables: BpmnEngineVariable;
565
- services: BpmnEngineService;
566
- children: BpmnEngineExecutionState[];
484
+ waitFor<R>(eventName: string): Promise<R>;
485
+ }
486
+
487
+ export interface BpmnEngineService {
488
+ [name: string]: Function;
489
+ }
490
+
491
+ export interface BpmnEngineExecutionEnvironment {
492
+ readonly options: any;
493
+ readonly extensions: BpmnEngineExtension;
494
+
495
+ readonly scripts: any;
496
+ readonly output: any;
497
+ readonly variables: BpmnEngineVariable;
498
+
499
+ readonly settings: any;
500
+
501
+ readonly Logger: BpmnLogger;
502
+ readonly services: BpmnEngineService;
503
+
504
+ // tslint:disable: ban-types
505
+ addService(name: string, serviceFn: Function): void;
506
+ assignVariables(...vars: any): void;
507
+ clone(overrideOptions?: any): BpmnEngineExecutionEnvironment;
508
+ getScript(scriptType: string, activity: any): any;
509
+ getServiceByName(name: string): any;
510
+
511
+ getState(): BpmnEngineExecutionState;
512
+
513
+ registerScript(activity: any): void;
514
+
515
+ resolveExpression<R>(
516
+ expression: any,
517
+ message?: any,
518
+ expressionFnContext?: any,
519
+ ): R;
520
+
521
+ recover(state: any): void;
522
+ }
523
+
524
+ export interface BpmnExecutionEventMessageContent {
525
+ id: string;
526
+ type: string;
527
+ executionId: string;
528
+ parent?: BpmnExecutionEventMessageContent;
529
+ path?: BpmnExecutionEventMessageContent[];
530
+ }
531
+
532
+ export interface BpmnExecutionEventMessageApi {
533
+ readonly id: string;
534
+ readonly type: string;
535
+ readonly name: string;
536
+ readonly executionId: string;
537
+ readonly environment: BpmnEngineExecutionEnvironment;
538
+ readonly fields: any;
539
+
540
+ readonly content: BpmnExecutionEventMessageContent;
541
+ readonly messageProperties: any;
542
+ readonly owner: BpmnEngine;
543
+
544
+ cancel(): void;
545
+ discard(): void;
546
+ signal(message: string, options: any): void;
547
+ stop(): void;
548
+
549
+ resolveExpression<R>(expression: any): R;
550
+ createMessage(overrideContent?: any): BpmnExecutionEventMessageApi;
551
+ }
552
+
553
+ export interface BpmnEngineExecutionDefinition extends EventEmitter {
554
+ state: 'pending' | 'running' | 'completed';
555
+ run: (callback?: any) => void;
556
+ resume: (callback?: any) => void;
557
+
558
+ recover: (state?: any) => void;
559
+
560
+ sendMessage: (message: any) => void;
561
+
562
+ executionId: string;
563
+ execution: BpmnEngineExecutionApi;
564
+ getProcesses: () => any[];
565
+
566
+ getExecutableProcesses: () => any[];
567
+ getApi: <T>(message: any) => T;
568
+ getElementById: (elementId: string) => any;
569
+ getActivityById: (childId: string) => any;
570
+ environment: BpmnEngineExecutionEnvironment;
571
+ status: string;
572
+ stopped: boolean;
573
+ type: string;
574
+ signal: (message: BpmnMessage, options?: any) => void;
575
+ cancelActivity: (message?: any) => void;
576
+ shake: (activityId?: string) => any;
577
+ broker: BpmnEngineBroker<BpmnEngine>;
578
+ id: string;
579
+ isRunning: boolean;
580
+ name: string;
581
+ logger: BpmnLogger;
582
+ waitFor(name: string, fn: Function): void;
583
+ }
584
+
585
+ export interface BpmnEngineExecutionDefinitionState {
586
+ readonly state: 'pending' | 'running' | 'completed';
587
+ readonly processes: {
588
+ [processId: string]: {
589
+ variables: BpmnEngineVariable;
590
+ services: BpmnEngineService;
591
+ children: BpmnEngineExecutionState[];
592
+ };
567
593
  };
568
- };
569
- }
570
- export interface BpmnEngineExecutionState {
571
- readonly name: string;
572
- readonly state: "idle" | "running";
573
- readonly stopped: boolean;
574
- readonly engineVersion: string;
575
- readonly environment: BpmnEngineExecutionEnvironment;
576
- readonly definitions: BpmnEngineExecutionDefinitionState[];
577
-
578
- readonly entered: boolean;
579
- }
594
+ }
580
595
 
581
- export interface BpmnEngineEventApi {
582
- /**
583
- * engine name
584
- *
585
- * @type {string}
586
- *
587
- */
588
- name: string;
589
- /**
590
- * state of execution, i.e running or idle
591
- *
592
- * @type {("running"| "idle")}
593
- *
594
- */
595
- state: "running" | "idle";
596
- /**
597
- * is the execution stopped
598
- *
599
- * @type {boolean}
600
- *
601
- */
602
- stopped: boolean;
603
- /**
604
- * engine environment
605
- *
606
- * @type {BpmnEngineExecutionEnvironment}
607
- *
608
- */
609
- environment: BpmnEngineExecutionEnvironment;
596
+ export interface BpmnEngineExecutionState {
597
+ readonly name: string;
598
+ readonly state: 'idle' | 'running';
599
+ readonly stopped: boolean;
600
+ readonly engineVersion: string;
601
+ readonly environment: BpmnEngineExecutionEnvironment;
602
+ readonly definitions: BpmnEngineExecutionDefinitionState[];
610
603
 
611
- /**
612
- * executing definitions
613
- *
614
- * @type {BpmnEngineExecutionDefinition}
615
- *
616
- */
617
- definitions: BpmnEngineExecutionDefinition;
618
- /**
619
- * get execution serializable state
620
- *
621
- * @returns {BpmnEngineExecutionState}
622
- *
623
- */
624
- getState(): BpmnEngineExecutionState;
604
+ readonly entered: boolean;
605
+ }
625
606
 
626
- /**
627
- * get activities in a postponed state
628
- *
629
- *
630
- */
631
- getPostponed(): any[];
632
- }
607
+ export interface BpmnEngineEventApi {
608
+ /**
609
+ * engine name
610
+ *
611
+ * @type {string}
612
+ *
613
+ */
614
+ name: string;
615
+ /**
616
+ * state of execution, i.e running or idle
617
+ *
618
+ * @type {("running"| "idle")}
619
+ *
620
+ */
621
+ state: 'running' | 'idle';
622
+ /**
623
+ * is the execution stopped
624
+ *
625
+ * @type {boolean}
626
+ *
627
+ */
628
+ stopped: boolean;
629
+ /**
630
+ * engine environment
631
+ *
632
+ * @type {BpmnEngineExecutionEnvironment}
633
+ *
634
+ */
635
+ environment: BpmnEngineExecutionEnvironment;
633
636
 
634
- export interface BpmnEngineExecutionApi {
635
- /**
636
- * engine name
637
- *
638
- * @type {string}
639
- * @
640
- */
641
- readonly name: string;
642
- /**
643
- * state of execution, i.e running or idle
644
- *
645
- * @type {("running"| "idle")}
646
- *
647
- */
648
- readonly state: "running" | "idle";
649
- /**
650
- * is the execution stopped
651
- *
652
- * @type {boolean}
653
- *
654
- */
655
- readonly stopped: boolean;
656
- /**
657
- * engine environment
658
- *
659
- * @type {BpmnEngineExecutionEnvironment}
660
- *
661
- */
662
- readonly environment: BpmnEngineExecutionEnvironment;
637
+ /**
638
+ * executing definitions
639
+ *
640
+ * @type {BpmnEngineExecutionDefinition}
641
+ *
642
+ */
643
+ definitions: BpmnEngineExecutionDefinition;
663
644
 
664
- /**
665
- * executing definitions
666
- *
667
- * @type {BpmnEngineExecutionDefinition}
668
- *
669
- */
670
- readonly definitions: BpmnEngineExecutionDefinition;
645
+ /**
646
+ * get execution serializable state
647
+ *
648
+ * @returns {BpmnEngineExecutionState}
649
+ *
650
+ */
651
+ getState(): BpmnEngineExecutionState;
671
652
 
672
- /**
673
- * Get activity/element by id. Loops the definitions and returns the first found activity with id.
674
- * @param activityId Activity or element id
675
- */
676
- getActivityById(activityId: string):BpmnEngineActivity;
677
- /**
678
- * get execution serializable state
679
- *
680
- * @returns {BpmnEngineExecutionState}
681
- *
682
- */
683
- getState(): BpmnEngineExecutionState;
653
+ /**
654
+ * get activities in a postponed state
655
+ *
656
+ *
657
+ */
658
+ getPostponed(): any[];
659
+ }
684
660
 
685
- /**
686
- * stop execution
687
- *
688
- *
689
- */
690
- stop(): void;
661
+ export interface BpmnEngineExecutionApi {
662
+ /**
663
+ * engine name
664
+ *
665
+ * @type {string}
666
+ * @
667
+ */
668
+ readonly name: string;
669
+ /**
670
+ * state of execution, i.e running or idle
671
+ *
672
+ * @type {("running"| "idle")}
673
+ *
674
+ */
675
+ readonly state: 'running' | 'idle';
676
+ /**
677
+ * is the execution stopped
678
+ *
679
+ * @type {boolean}
680
+ *
681
+ */
682
+ readonly stopped: boolean;
683
+ /**
684
+ * engine environment
685
+ *
686
+ * @type {BpmnEngineExecutionEnvironment}
687
+ *
688
+ */
689
+ readonly environment: BpmnEngineExecutionEnvironment;
691
690
 
692
- /**
693
- * get activities in a postponed state
694
- *
695
- *
696
- */
697
- getPostponed(): BpmnEngineActivity[];
698
- /**
699
- * send signal to execution, distributed to all definitions
700
- * Delegate a signal message to all interested parties, usually MessageEventDefinition, SignalEventDefinition, SignalTask (user, manual), ReceiveTask, or a StartEvent that has a form.
701
- * @param message {BpmnMessage}
702
- */
703
- signal(message?: BpmnMessage,options?: {ignoreSameDefinition?: boolean}): void;
704
- /**
705
- * send cancel activity to execution, distributed to all definitions
706
- * Delegate a cancel message to all interested parties, perhaps a stalled TimerEventDefinition.
707
- * @param message
708
- */
709
- cancelActivity(message?: BpmnMessage): void;
691
+ /**
692
+ * executing definitions
693
+ *
694
+ * @type {BpmnEngineExecutionDefinition}
695
+ *
696
+ */
697
+ readonly definitions: BpmnEngineExecutionDefinition[];
710
698
 
711
- /**
712
- *
713
- * @param event
714
- */
715
- waitFor<T>(event: BpmnEngineEvent): Promise<T>;
699
+ /**
700
+ * Get activity/element by id. Loops the definitions and returns the first found activity with id.
701
+ * @param activityId Activity or element id
702
+ */
703
+ getActivityById(activityId: string): BpmnEngineActivity;
716
704
 
717
- }
705
+ /**
706
+ * get execution serializable state
707
+ *
708
+ * @returns {BpmnEngineExecutionState}
709
+ *
710
+ */
711
+ getState(): BpmnEngineExecutionState;
712
+
713
+ /**
714
+ * stop execution
715
+ *
716
+ *
717
+ */
718
+ stop(): void;
719
+
720
+ /**
721
+ * get activities in a postponed state
722
+ *
723
+ *
724
+ */
725
+ getPostponed(): BpmnEngineActivity[];
726
+
727
+ /**
728
+ * send signal to execution, distributed to all definitions
729
+ * Delegate a signal message to all interested parties, usually MessageEventDefinition, SignalEventDefinition, SignalTask (user, manual), ReceiveTask, or a StartEvent that has a form.
730
+ * @param message {BpmnMessage}
731
+ * @param options
732
+ */
733
+ signal(message?: BpmnMessage, options?: {ignoreSameDefinition?: boolean}): void;
734
+
735
+ /**
736
+ * send cancel activity to execution, distributed to all definitions
737
+ * Delegate a cancel message to all interested parties, perhaps a stalled TimerEventDefinition.
738
+ * @param message
739
+ */
740
+ cancelActivity(message?: BpmnMessage): void;
741
+
742
+ /**
743
+ *
744
+ * @param event
745
+ */
746
+ waitFor<T>(event: BpmnEngineEvent): Promise<T>;
747
+
748
+ }
718
749
 
719
750
  }