bpmn-elements 8.2.4 → 9.1.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 +16 -0
- package/README.md +1 -1
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +5 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/Tracker.js +89 -0
- package/dist/{src/activity → activity}/Activity.js +109 -120
- package/dist/{src/activity → activity}/ActivityExecution.js +28 -32
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +64 -59
- package/dist/{src/definition → definition}/DefinitionExecution.js +68 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/eventDefinitions/CancelEventDefinition.js +127 -0
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +64 -52
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +24 -16
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +15 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +39 -25
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +14 -22
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +3 -4
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +44 -40
- package/dist/{src/process → process}/ProcessExecution.js +169 -78
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +19 -19
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +31 -31
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +2 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/Tracker.js +73 -0
- package/src/activity/Activity.js +106 -114
- package/src/activity/ActivityExecution.js +28 -32
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +65 -64
- package/src/definition/DefinitionExecution.js +71 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +32 -78
- package/src/eventDefinitions/CompensateEventDefinition.js +58 -52
- package/src/eventDefinitions/ConditionalEventDefinition.js +25 -17
- package/src/eventDefinitions/ErrorEventDefinition.js +15 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +34 -24
- package/src/events/EndEvent.js +3 -3
- package/src/events/IntermediateCatchEvent.js +3 -3
- package/src/events/IntermediateThrowEvent.js +3 -3
- package/src/events/StartEvent.js +8 -10
- package/src/flows/Association.js +14 -26
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +3 -4
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +45 -41
- package/src/process/ProcessExecution.js +167 -79
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +19 -20
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +520 -0
- package/dist/src/eventDefinitions/CancelEventDefinition.js +0 -184
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /package/dist/{src/shared.js → shared.js} +0 -0
package/src/process/Process.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import ProcessExecution from './ProcessExecution';
|
|
2
|
-
import {getUniqueId} from '../shared';
|
|
3
|
-
import {ProcessApi} from '../Api';
|
|
4
|
-
import {ProcessBroker} from '../EventBroker';
|
|
5
|
-
import {cloneMessage, cloneContent, cloneParent} from '../messageHelper';
|
|
6
|
-
import {makeErrorFromMessage} from '../error/Errors';
|
|
1
|
+
import ProcessExecution from './ProcessExecution.js';
|
|
2
|
+
import {getUniqueId} from '../shared.js';
|
|
3
|
+
import {ProcessApi} from '../Api.js';
|
|
4
|
+
import {ProcessBroker} from '../EventBroker.js';
|
|
5
|
+
import {cloneMessage, cloneContent, cloneParent} from '../messageHelper.js';
|
|
6
|
+
import {makeErrorFromMessage} from '../error/Errors.js';
|
|
7
7
|
|
|
8
8
|
const kConsuming = Symbol.for('consuming');
|
|
9
9
|
const kCounters = Symbol.for('counters');
|
|
@@ -56,30 +56,28 @@ export function Process(processDef, context) {
|
|
|
56
56
|
this[kExtensions] = context.loadExtensions(this);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Object.defineProperty(proto, 'counters', {
|
|
59
|
+
Object.defineProperty(Process.prototype, 'counters', {
|
|
62
60
|
enumerable: true,
|
|
63
61
|
get() {
|
|
64
62
|
return {...this[kCounters]};
|
|
65
63
|
},
|
|
66
64
|
});
|
|
67
65
|
|
|
68
|
-
Object.defineProperty(
|
|
66
|
+
Object.defineProperty(Process.prototype, 'extensions', {
|
|
69
67
|
enumerable: true,
|
|
70
68
|
get() {
|
|
71
69
|
return this[kExtensions];
|
|
72
70
|
},
|
|
73
71
|
});
|
|
74
72
|
|
|
75
|
-
Object.defineProperty(
|
|
73
|
+
Object.defineProperty(Process.prototype, 'stopped', {
|
|
76
74
|
enumerable: true,
|
|
77
75
|
get() {
|
|
78
76
|
return this[kStopped];
|
|
79
77
|
},
|
|
80
78
|
});
|
|
81
79
|
|
|
82
|
-
Object.defineProperty(
|
|
80
|
+
Object.defineProperty(Process.prototype, 'isRunning', {
|
|
83
81
|
enumerable: true,
|
|
84
82
|
get() {
|
|
85
83
|
if (!this[kConsuming]) return false;
|
|
@@ -87,7 +85,7 @@ Object.defineProperty(proto, 'isRunning', {
|
|
|
87
85
|
},
|
|
88
86
|
});
|
|
89
87
|
|
|
90
|
-
Object.defineProperty(
|
|
88
|
+
Object.defineProperty(Process.prototype, 'executionId', {
|
|
91
89
|
enumerable: true,
|
|
92
90
|
get() {
|
|
93
91
|
const {executionId, initExecutionId} = this[kExec];
|
|
@@ -95,28 +93,34 @@ Object.defineProperty(proto, 'executionId', {
|
|
|
95
93
|
},
|
|
96
94
|
});
|
|
97
95
|
|
|
98
|
-
Object.defineProperty(
|
|
96
|
+
Object.defineProperty(Process.prototype, 'execution', {
|
|
99
97
|
enumerable: true,
|
|
100
98
|
get() {
|
|
101
99
|
return this[kExec].execution;
|
|
102
100
|
},
|
|
103
101
|
});
|
|
104
102
|
|
|
105
|
-
Object.defineProperty(
|
|
103
|
+
Object.defineProperty(Process.prototype, 'status', {
|
|
106
104
|
enumerable: true,
|
|
107
105
|
get() {
|
|
108
106
|
return this[kStatus];
|
|
109
107
|
},
|
|
110
108
|
});
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
Object.defineProperty(Process.prototype, 'activityStatus', {
|
|
111
|
+
get() {
|
|
112
|
+
return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
Process.prototype.init = function init(useAsExecutionId) {
|
|
113
117
|
const exec = this[kExec];
|
|
114
118
|
const initExecutionId = exec.initExecutionId = useAsExecutionId || getUniqueId(this.id);
|
|
115
119
|
this._debug(`initialized with executionId <${initExecutionId}>`);
|
|
116
120
|
this._publishEvent('init', this._createMessage({executionId: initExecutionId}));
|
|
117
121
|
};
|
|
118
122
|
|
|
119
|
-
|
|
123
|
+
Process.prototype.run = function run(runContent) {
|
|
120
124
|
if (this.isRunning) throw new Error(`process <${this.id}> is already running`);
|
|
121
125
|
|
|
122
126
|
const exec = this[kExec];
|
|
@@ -133,7 +137,7 @@ proto.run = function run(runContent) {
|
|
|
133
137
|
this._activateRunConsumers();
|
|
134
138
|
};
|
|
135
139
|
|
|
136
|
-
|
|
140
|
+
Process.prototype.resume = function resume() {
|
|
137
141
|
if (this.isRunning) throw new Error(`cannot resume running process <${this.id}>`);
|
|
138
142
|
if (!this.status) return this;
|
|
139
143
|
|
|
@@ -145,7 +149,7 @@ proto.resume = function resume() {
|
|
|
145
149
|
return this;
|
|
146
150
|
};
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
Process.prototype.recover = function recover(state) {
|
|
149
153
|
if (this.isRunning) throw new Error(`cannot recover running process <${this.id}>`);
|
|
150
154
|
if (!state) return this;
|
|
151
155
|
|
|
@@ -165,27 +169,27 @@ proto.recover = function recover(state) {
|
|
|
165
169
|
return this;
|
|
166
170
|
};
|
|
167
171
|
|
|
168
|
-
|
|
172
|
+
Process.prototype.shake = function shake(startId) {
|
|
169
173
|
if (this.isRunning) return this.execution.shake(startId);
|
|
170
174
|
return new ProcessExecution(this, this.context).shake(startId);
|
|
171
175
|
};
|
|
172
176
|
|
|
173
|
-
|
|
177
|
+
Process.prototype.stop = function stop() {
|
|
174
178
|
if (!this.isRunning) return;
|
|
175
179
|
this.getApi().stop();
|
|
176
180
|
};
|
|
177
181
|
|
|
178
|
-
|
|
182
|
+
Process.prototype.getApi = function getApi(message) {
|
|
179
183
|
const execution = this.execution;
|
|
180
184
|
if (execution) return execution.getApi(message);
|
|
181
185
|
return ProcessApi(this.broker, message || this[kStateMessage]);
|
|
182
186
|
};
|
|
183
187
|
|
|
184
|
-
|
|
188
|
+
Process.prototype.signal = function signal(message) {
|
|
185
189
|
return this.getApi().signal(message, {delegate: true});
|
|
186
190
|
};
|
|
187
191
|
|
|
188
|
-
|
|
192
|
+
Process.prototype.getState = function getState() {
|
|
189
193
|
return this._createMessage({
|
|
190
194
|
environment: this.environment.getState(),
|
|
191
195
|
status: this.status,
|
|
@@ -196,11 +200,11 @@ proto.getState = function getState() {
|
|
|
196
200
|
});
|
|
197
201
|
};
|
|
198
202
|
|
|
199
|
-
|
|
203
|
+
Process.prototype.cancelActivity = function cancelActivity(message) {
|
|
200
204
|
return this.getApi().cancel(message, {delegate: true});
|
|
201
205
|
};
|
|
202
206
|
|
|
203
|
-
|
|
207
|
+
Process.prototype._activateRunConsumers = function activateRunConsumers() {
|
|
204
208
|
this[kConsuming] = true;
|
|
205
209
|
const broker = this.broker;
|
|
206
210
|
const {onApiMessage, onRunMessage} = this[kMessageHandlers];
|
|
@@ -208,7 +212,7 @@ proto._activateRunConsumers = function activateRunConsumers() {
|
|
|
208
212
|
broker.getQueue('run-q').assertConsumer(onRunMessage, {exclusive: true, consumerTag: '_process-run'});
|
|
209
213
|
};
|
|
210
214
|
|
|
211
|
-
|
|
215
|
+
Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
212
216
|
const broker = this.broker;
|
|
213
217
|
broker.cancel('_process-api');
|
|
214
218
|
broker.cancel('_process-run');
|
|
@@ -216,7 +220,7 @@ proto._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
|
216
220
|
this[kConsuming] = false;
|
|
217
221
|
};
|
|
218
222
|
|
|
219
|
-
|
|
223
|
+
Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
220
224
|
const {content, fields} = message;
|
|
221
225
|
|
|
222
226
|
if (routingKey === 'run.resume') {
|
|
@@ -303,7 +307,7 @@ proto._onRunMessage = function onRunMessage(routingKey, message) {
|
|
|
303
307
|
message.ack();
|
|
304
308
|
};
|
|
305
309
|
|
|
306
|
-
|
|
310
|
+
Process.prototype._onResumeMessage = function onResumeMessage(message) {
|
|
307
311
|
message.ack();
|
|
308
312
|
|
|
309
313
|
const stateMessage = this[kStateMessage];
|
|
@@ -325,7 +329,7 @@ proto._onResumeMessage = function onResumeMessage(message) {
|
|
|
325
329
|
return this.broker.publish('run', stateMessage.fields.routingKey, cloneContent(stateMessage.content), stateMessage.properties);
|
|
326
330
|
};
|
|
327
331
|
|
|
328
|
-
|
|
332
|
+
Process.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
329
333
|
const content = message.content;
|
|
330
334
|
const messageType = message.properties.type;
|
|
331
335
|
message.ack();
|
|
@@ -352,12 +356,12 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
352
356
|
executeMessage.ack();
|
|
353
357
|
};
|
|
354
358
|
|
|
355
|
-
|
|
359
|
+
Process.prototype._publishEvent = function publishEvent(state, content) {
|
|
356
360
|
const eventContent = this._createMessage({...content, state});
|
|
357
361
|
this.broker.publish('event', `process.${state}`, eventContent, {type: state, mandatory: state === 'error'});
|
|
358
362
|
};
|
|
359
363
|
|
|
360
|
-
|
|
364
|
+
Process.prototype.sendMessage = function sendMessage(message) {
|
|
361
365
|
const messageContent = message && message.content;
|
|
362
366
|
if (!messageContent) return;
|
|
363
367
|
|
|
@@ -373,35 +377,35 @@ proto.sendMessage = function sendMessage(message) {
|
|
|
373
377
|
this.getApi().sendApiMessage(message.properties.type || 'message', cloneContent(messageContent), {delegate: true});
|
|
374
378
|
};
|
|
375
379
|
|
|
376
|
-
|
|
380
|
+
Process.prototype.getActivityById = function getActivityById(childId) {
|
|
377
381
|
const execution = this.execution;
|
|
378
382
|
if (execution) return execution.getActivityById(childId);
|
|
379
383
|
return this.context.getActivityById(childId);
|
|
380
384
|
};
|
|
381
385
|
|
|
382
|
-
|
|
386
|
+
Process.prototype.getActivities = function getActivities() {
|
|
383
387
|
const execution = this.execution;
|
|
384
388
|
if (execution) return execution.getActivities();
|
|
385
389
|
return this.context.getActivities(this.id);
|
|
386
390
|
};
|
|
387
391
|
|
|
388
|
-
|
|
392
|
+
Process.prototype.getStartActivities = function getStartActivities(filterOptions) {
|
|
389
393
|
return this.context.getStartActivities(filterOptions, this.id);
|
|
390
394
|
};
|
|
391
395
|
|
|
392
|
-
|
|
396
|
+
Process.prototype.getSequenceFlows = function getSequenceFlows() {
|
|
393
397
|
const execution = this.execution;
|
|
394
398
|
if (execution) return execution.getSequenceFlows();
|
|
395
399
|
return this.context.getSequenceFlows();
|
|
396
400
|
};
|
|
397
401
|
|
|
398
|
-
|
|
402
|
+
Process.prototype.getPostponed = function getPostponed(...args) {
|
|
399
403
|
const execution = this.execution;
|
|
400
404
|
if (!execution) return [];
|
|
401
405
|
return execution.getPostponed(...args);
|
|
402
406
|
};
|
|
403
407
|
|
|
404
|
-
|
|
408
|
+
Process.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
405
409
|
const messageType = message.properties.type;
|
|
406
410
|
|
|
407
411
|
switch (messageType) {
|
|
@@ -413,13 +417,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
413
417
|
}
|
|
414
418
|
};
|
|
415
419
|
|
|
416
|
-
|
|
420
|
+
Process.prototype._onStop = function onStop() {
|
|
417
421
|
this[kStopped] = true;
|
|
418
422
|
this._deactivateRunConsumers();
|
|
419
423
|
return this._publishEvent('stop');
|
|
420
424
|
};
|
|
421
425
|
|
|
422
|
-
|
|
426
|
+
Process.prototype._createMessage = function createMessage(override) {
|
|
423
427
|
return {
|
|
424
428
|
id: this.id,
|
|
425
429
|
type: this.type,
|
|
@@ -430,6 +434,6 @@ proto._createMessage = function createMessage(override) {
|
|
|
430
434
|
};
|
|
431
435
|
};
|
|
432
436
|
|
|
433
|
-
|
|
437
|
+
Process.prototype._debug = function debug(msg) {
|
|
434
438
|
this.logger.debug(`<${this.id}> ${msg}`);
|
|
435
439
|
};
|