bpmn-elements 8.2.4 → 9.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 +10 -0
- 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} +1 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/{src/activity → activity}/Activity.js +62 -63
- package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
- 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 +41 -42
- package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -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 +15 -16
- 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 +15 -16
- 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 +2 -2
- 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 +39 -40
- package/dist/{src/process → process}/ProcessExecution.js +42 -43
- 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 +17 -18
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +30 -30
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +1 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/activity/Activity.js +62 -64
- package/src/activity/ActivityExecution.js +23 -25
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +41 -43
- package/src/definition/DefinitionExecution.js +45 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +12 -14
- package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
- package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
- package/src/eventDefinitions/ErrorEventDefinition.js +13 -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 +15 -17
- 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 +15 -17
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +2 -2
- 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 +39 -41
- package/src/process/ProcessExecution.js +42 -44
- 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 +17 -19
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +491 -0
- 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,28 @@ 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
|
+
Process.prototype.init = function init(useAsExecutionId) {
|
|
113
111
|
const exec = this[kExec];
|
|
114
112
|
const initExecutionId = exec.initExecutionId = useAsExecutionId || getUniqueId(this.id);
|
|
115
113
|
this._debug(`initialized with executionId <${initExecutionId}>`);
|
|
116
114
|
this._publishEvent('init', this._createMessage({executionId: initExecutionId}));
|
|
117
115
|
};
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
Process.prototype.run = function run(runContent) {
|
|
120
118
|
if (this.isRunning) throw new Error(`process <${this.id}> is already running`);
|
|
121
119
|
|
|
122
120
|
const exec = this[kExec];
|
|
@@ -133,7 +131,7 @@ proto.run = function run(runContent) {
|
|
|
133
131
|
this._activateRunConsumers();
|
|
134
132
|
};
|
|
135
133
|
|
|
136
|
-
|
|
134
|
+
Process.prototype.resume = function resume() {
|
|
137
135
|
if (this.isRunning) throw new Error(`cannot resume running process <${this.id}>`);
|
|
138
136
|
if (!this.status) return this;
|
|
139
137
|
|
|
@@ -145,7 +143,7 @@ proto.resume = function resume() {
|
|
|
145
143
|
return this;
|
|
146
144
|
};
|
|
147
145
|
|
|
148
|
-
|
|
146
|
+
Process.prototype.recover = function recover(state) {
|
|
149
147
|
if (this.isRunning) throw new Error(`cannot recover running process <${this.id}>`);
|
|
150
148
|
if (!state) return this;
|
|
151
149
|
|
|
@@ -165,27 +163,27 @@ proto.recover = function recover(state) {
|
|
|
165
163
|
return this;
|
|
166
164
|
};
|
|
167
165
|
|
|
168
|
-
|
|
166
|
+
Process.prototype.shake = function shake(startId) {
|
|
169
167
|
if (this.isRunning) return this.execution.shake(startId);
|
|
170
168
|
return new ProcessExecution(this, this.context).shake(startId);
|
|
171
169
|
};
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
Process.prototype.stop = function stop() {
|
|
174
172
|
if (!this.isRunning) return;
|
|
175
173
|
this.getApi().stop();
|
|
176
174
|
};
|
|
177
175
|
|
|
178
|
-
|
|
176
|
+
Process.prototype.getApi = function getApi(message) {
|
|
179
177
|
const execution = this.execution;
|
|
180
178
|
if (execution) return execution.getApi(message);
|
|
181
179
|
return ProcessApi(this.broker, message || this[kStateMessage]);
|
|
182
180
|
};
|
|
183
181
|
|
|
184
|
-
|
|
182
|
+
Process.prototype.signal = function signal(message) {
|
|
185
183
|
return this.getApi().signal(message, {delegate: true});
|
|
186
184
|
};
|
|
187
185
|
|
|
188
|
-
|
|
186
|
+
Process.prototype.getState = function getState() {
|
|
189
187
|
return this._createMessage({
|
|
190
188
|
environment: this.environment.getState(),
|
|
191
189
|
status: this.status,
|
|
@@ -196,11 +194,11 @@ proto.getState = function getState() {
|
|
|
196
194
|
});
|
|
197
195
|
};
|
|
198
196
|
|
|
199
|
-
|
|
197
|
+
Process.prototype.cancelActivity = function cancelActivity(message) {
|
|
200
198
|
return this.getApi().cancel(message, {delegate: true});
|
|
201
199
|
};
|
|
202
200
|
|
|
203
|
-
|
|
201
|
+
Process.prototype._activateRunConsumers = function activateRunConsumers() {
|
|
204
202
|
this[kConsuming] = true;
|
|
205
203
|
const broker = this.broker;
|
|
206
204
|
const {onApiMessage, onRunMessage} = this[kMessageHandlers];
|
|
@@ -208,7 +206,7 @@ proto._activateRunConsumers = function activateRunConsumers() {
|
|
|
208
206
|
broker.getQueue('run-q').assertConsumer(onRunMessage, {exclusive: true, consumerTag: '_process-run'});
|
|
209
207
|
};
|
|
210
208
|
|
|
211
|
-
|
|
209
|
+
Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
212
210
|
const broker = this.broker;
|
|
213
211
|
broker.cancel('_process-api');
|
|
214
212
|
broker.cancel('_process-run');
|
|
@@ -216,7 +214,7 @@ proto._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
|
216
214
|
this[kConsuming] = false;
|
|
217
215
|
};
|
|
218
216
|
|
|
219
|
-
|
|
217
|
+
Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
220
218
|
const {content, fields} = message;
|
|
221
219
|
|
|
222
220
|
if (routingKey === 'run.resume') {
|
|
@@ -303,7 +301,7 @@ proto._onRunMessage = function onRunMessage(routingKey, message) {
|
|
|
303
301
|
message.ack();
|
|
304
302
|
};
|
|
305
303
|
|
|
306
|
-
|
|
304
|
+
Process.prototype._onResumeMessage = function onResumeMessage(message) {
|
|
307
305
|
message.ack();
|
|
308
306
|
|
|
309
307
|
const stateMessage = this[kStateMessage];
|
|
@@ -325,7 +323,7 @@ proto._onResumeMessage = function onResumeMessage(message) {
|
|
|
325
323
|
return this.broker.publish('run', stateMessage.fields.routingKey, cloneContent(stateMessage.content), stateMessage.properties);
|
|
326
324
|
};
|
|
327
325
|
|
|
328
|
-
|
|
326
|
+
Process.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
329
327
|
const content = message.content;
|
|
330
328
|
const messageType = message.properties.type;
|
|
331
329
|
message.ack();
|
|
@@ -352,12 +350,12 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
352
350
|
executeMessage.ack();
|
|
353
351
|
};
|
|
354
352
|
|
|
355
|
-
|
|
353
|
+
Process.prototype._publishEvent = function publishEvent(state, content) {
|
|
356
354
|
const eventContent = this._createMessage({...content, state});
|
|
357
355
|
this.broker.publish('event', `process.${state}`, eventContent, {type: state, mandatory: state === 'error'});
|
|
358
356
|
};
|
|
359
357
|
|
|
360
|
-
|
|
358
|
+
Process.prototype.sendMessage = function sendMessage(message) {
|
|
361
359
|
const messageContent = message && message.content;
|
|
362
360
|
if (!messageContent) return;
|
|
363
361
|
|
|
@@ -373,35 +371,35 @@ proto.sendMessage = function sendMessage(message) {
|
|
|
373
371
|
this.getApi().sendApiMessage(message.properties.type || 'message', cloneContent(messageContent), {delegate: true});
|
|
374
372
|
};
|
|
375
373
|
|
|
376
|
-
|
|
374
|
+
Process.prototype.getActivityById = function getActivityById(childId) {
|
|
377
375
|
const execution = this.execution;
|
|
378
376
|
if (execution) return execution.getActivityById(childId);
|
|
379
377
|
return this.context.getActivityById(childId);
|
|
380
378
|
};
|
|
381
379
|
|
|
382
|
-
|
|
380
|
+
Process.prototype.getActivities = function getActivities() {
|
|
383
381
|
const execution = this.execution;
|
|
384
382
|
if (execution) return execution.getActivities();
|
|
385
383
|
return this.context.getActivities(this.id);
|
|
386
384
|
};
|
|
387
385
|
|
|
388
|
-
|
|
386
|
+
Process.prototype.getStartActivities = function getStartActivities(filterOptions) {
|
|
389
387
|
return this.context.getStartActivities(filterOptions, this.id);
|
|
390
388
|
};
|
|
391
389
|
|
|
392
|
-
|
|
390
|
+
Process.prototype.getSequenceFlows = function getSequenceFlows() {
|
|
393
391
|
const execution = this.execution;
|
|
394
392
|
if (execution) return execution.getSequenceFlows();
|
|
395
393
|
return this.context.getSequenceFlows();
|
|
396
394
|
};
|
|
397
395
|
|
|
398
|
-
|
|
396
|
+
Process.prototype.getPostponed = function getPostponed(...args) {
|
|
399
397
|
const execution = this.execution;
|
|
400
398
|
if (!execution) return [];
|
|
401
399
|
return execution.getPostponed(...args);
|
|
402
400
|
};
|
|
403
401
|
|
|
404
|
-
|
|
402
|
+
Process.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
405
403
|
const messageType = message.properties.type;
|
|
406
404
|
|
|
407
405
|
switch (messageType) {
|
|
@@ -413,13 +411,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
413
411
|
}
|
|
414
412
|
};
|
|
415
413
|
|
|
416
|
-
|
|
414
|
+
Process.prototype._onStop = function onStop() {
|
|
417
415
|
this[kStopped] = true;
|
|
418
416
|
this._deactivateRunConsumers();
|
|
419
417
|
return this._publishEvent('stop');
|
|
420
418
|
};
|
|
421
419
|
|
|
422
|
-
|
|
420
|
+
Process.prototype._createMessage = function createMessage(override) {
|
|
423
421
|
return {
|
|
424
422
|
id: this.id,
|
|
425
423
|
type: this.type,
|
|
@@ -430,6 +428,6 @@ proto._createMessage = function createMessage(override) {
|
|
|
430
428
|
};
|
|
431
429
|
};
|
|
432
430
|
|
|
433
|
-
|
|
431
|
+
Process.prototype._debug = function debug(msg) {
|
|
434
432
|
this.logger.debug(`<${this.id}> ${msg}`);
|
|
435
433
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {ProcessApi} from '../Api';
|
|
2
|
-
import {cloneContent, cloneMessage, pushParent} from '../messageHelper';
|
|
3
|
-
import {getUniqueId} from '../shared';
|
|
1
|
+
import {ProcessApi} from '../Api.js';
|
|
2
|
+
import {cloneContent, cloneMessage, pushParent} from '../messageHelper.js';
|
|
3
|
+
import {getUniqueId} from '../shared.js';
|
|
4
4
|
|
|
5
5
|
export default ProcessExecution;
|
|
6
6
|
|
|
@@ -54,42 +54,40 @@ function ProcessExecution(parentActivity, context) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Object.defineProperty(proto, 'stopped', {
|
|
57
|
+
Object.defineProperty(ProcessExecution.prototype, 'stopped', {
|
|
60
58
|
enumerable: true,
|
|
61
59
|
get() {
|
|
62
60
|
return this[kStopped];
|
|
63
61
|
},
|
|
64
62
|
});
|
|
65
63
|
|
|
66
|
-
Object.defineProperty(
|
|
64
|
+
Object.defineProperty(ProcessExecution.prototype, 'completed', {
|
|
67
65
|
enumerable: true,
|
|
68
66
|
get() {
|
|
69
67
|
return this[kCompleted];
|
|
70
68
|
},
|
|
71
69
|
});
|
|
72
70
|
|
|
73
|
-
Object.defineProperty(
|
|
71
|
+
Object.defineProperty(ProcessExecution.prototype, 'status', {
|
|
74
72
|
enumerable: true,
|
|
75
73
|
get() {
|
|
76
74
|
return this[kStatus];
|
|
77
75
|
},
|
|
78
76
|
});
|
|
79
77
|
|
|
80
|
-
Object.defineProperty(
|
|
78
|
+
Object.defineProperty(ProcessExecution.prototype, 'postponedCount', {
|
|
81
79
|
get() {
|
|
82
80
|
return this[kElements].postponed.length;
|
|
83
81
|
},
|
|
84
82
|
});
|
|
85
83
|
|
|
86
|
-
Object.defineProperty(
|
|
84
|
+
Object.defineProperty(ProcessExecution.prototype, 'isRunning', {
|
|
87
85
|
get() {
|
|
88
86
|
return this[kActivated];
|
|
89
87
|
},
|
|
90
88
|
});
|
|
91
89
|
|
|
92
|
-
|
|
90
|
+
ProcessExecution.prototype.execute = function execute(executeMessage) {
|
|
93
91
|
if (!executeMessage) throw new Error('Process execution requires message');
|
|
94
92
|
if (!executeMessage.content || !executeMessage.content.executionId) throw new Error('Process execution requires execution id');
|
|
95
93
|
|
|
@@ -115,7 +113,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
115
113
|
return true;
|
|
116
114
|
};
|
|
117
115
|
|
|
118
|
-
|
|
116
|
+
ProcessExecution.prototype.resume = function resume() {
|
|
119
117
|
this._debug(`resume process execution at ${this.status}`);
|
|
120
118
|
|
|
121
119
|
if (this[kCompleted]) return this._complete('completed');
|
|
@@ -158,7 +156,7 @@ proto.resume = function resume() {
|
|
|
158
156
|
if (!postponed.length && status === 'executing') return this._complete('completed');
|
|
159
157
|
};
|
|
160
158
|
|
|
161
|
-
|
|
159
|
+
ProcessExecution.prototype.recover = function recover(state) {
|
|
162
160
|
if (!state) return this;
|
|
163
161
|
this.executionId = state.executionId;
|
|
164
162
|
|
|
@@ -204,7 +202,7 @@ proto.recover = function recover(state) {
|
|
|
204
202
|
return this;
|
|
205
203
|
};
|
|
206
204
|
|
|
207
|
-
|
|
205
|
+
ProcessExecution.prototype.shake = function shake(fromId) {
|
|
208
206
|
let executing = true;
|
|
209
207
|
const id = this.id;
|
|
210
208
|
if (!this.isRunning) {
|
|
@@ -239,11 +237,11 @@ proto.shake = function shake(fromId) {
|
|
|
239
237
|
return result;
|
|
240
238
|
};
|
|
241
239
|
|
|
242
|
-
|
|
240
|
+
ProcessExecution.prototype.stop = function stop() {
|
|
243
241
|
this.getApi().stop();
|
|
244
242
|
};
|
|
245
243
|
|
|
246
|
-
|
|
244
|
+
ProcessExecution.prototype.getPostponed = function getPostponed(filterFn) {
|
|
247
245
|
const result = [];
|
|
248
246
|
for (const msg of this[kElements].postponed.slice()) {
|
|
249
247
|
const api = this._getChildApi(msg);
|
|
@@ -254,7 +252,7 @@ proto.getPostponed = function getPostponed(filterFn) {
|
|
|
254
252
|
return result;
|
|
255
253
|
};
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
ProcessExecution.prototype.discard = function discard() {
|
|
258
256
|
this[kStatus] = 'discard';
|
|
259
257
|
return this[kActivityQ].queueMessage({routingKey: 'execution.discard'}, {
|
|
260
258
|
id: this.id,
|
|
@@ -263,7 +261,7 @@ proto.discard = function discard() {
|
|
|
263
261
|
}, {type: 'discard'});
|
|
264
262
|
};
|
|
265
263
|
|
|
266
|
-
|
|
264
|
+
ProcessExecution.prototype.getState = function getState() {
|
|
267
265
|
const {children, flows, outboundMessageFlows, associations} = this[kElements];
|
|
268
266
|
return {
|
|
269
267
|
executionId: this.executionId,
|
|
@@ -281,19 +279,19 @@ proto.getState = function getState() {
|
|
|
281
279
|
};
|
|
282
280
|
};
|
|
283
281
|
|
|
284
|
-
|
|
282
|
+
ProcessExecution.prototype.getActivities = function getActivities() {
|
|
285
283
|
return this[kElements].children.slice();
|
|
286
284
|
};
|
|
287
285
|
|
|
288
|
-
|
|
286
|
+
ProcessExecution.prototype.getActivityById = function getActivityById(activityId) {
|
|
289
287
|
return this[kElements].children.find((child) => child.id === activityId);
|
|
290
288
|
};
|
|
291
289
|
|
|
292
|
-
|
|
290
|
+
ProcessExecution.prototype.getSequenceFlows = function getSequenceFlows() {
|
|
293
291
|
return this[kElements].flows.slice();
|
|
294
292
|
};
|
|
295
293
|
|
|
296
|
-
|
|
294
|
+
ProcessExecution.prototype.getApi = function getApi(message) {
|
|
297
295
|
if (!message) return ProcessApi(this.broker, this[kExecuteMessage]);
|
|
298
296
|
|
|
299
297
|
const content = message.content;
|
|
@@ -317,7 +315,7 @@ proto.getApi = function getApi(message) {
|
|
|
317
315
|
return api;
|
|
318
316
|
};
|
|
319
317
|
|
|
320
|
-
|
|
318
|
+
ProcessExecution.prototype._start = function start() {
|
|
321
319
|
if (this[kElements].children.length === 0) {
|
|
322
320
|
return this._complete('completed');
|
|
323
321
|
}
|
|
@@ -344,7 +342,7 @@ proto._start = function start() {
|
|
|
344
342
|
});
|
|
345
343
|
};
|
|
346
344
|
|
|
347
|
-
|
|
345
|
+
ProcessExecution.prototype._activate = function activate() {
|
|
348
346
|
const {onApiMessage, onMessageFlowEvent, onActivityEvent} = this[kMessageHandlers];
|
|
349
347
|
|
|
350
348
|
if (!this.isSubProcess) {
|
|
@@ -406,7 +404,7 @@ proto._activate = function activate() {
|
|
|
406
404
|
this[kActivated] = true;
|
|
407
405
|
};
|
|
408
406
|
|
|
409
|
-
|
|
407
|
+
ProcessExecution.prototype._deactivate = function deactivate() {
|
|
410
408
|
const broker = this.broker;
|
|
411
409
|
const executionId = this.executionId;
|
|
412
410
|
broker.cancel(`_process-api-consumer-${executionId}`);
|
|
@@ -436,7 +434,7 @@ proto._deactivate = function deactivate() {
|
|
|
436
434
|
this[kActivated] = false;
|
|
437
435
|
};
|
|
438
436
|
|
|
439
|
-
|
|
437
|
+
ProcessExecution.prototype._onDelegateEvent = function onDelegateEvent(message) {
|
|
440
438
|
const eventType = message.properties.type;
|
|
441
439
|
let delegate = true;
|
|
442
440
|
|
|
@@ -459,11 +457,11 @@ proto._onDelegateEvent = function onDelegateEvent(message) {
|
|
|
459
457
|
return delegate;
|
|
460
458
|
};
|
|
461
459
|
|
|
462
|
-
|
|
460
|
+
ProcessExecution.prototype._onMessageFlowEvent = function onMessageFlowEvent(routingKey, message) {
|
|
463
461
|
this.broker.publish('message', routingKey, cloneContent(message.content), message.properties);
|
|
464
462
|
};
|
|
465
463
|
|
|
466
|
-
|
|
464
|
+
ProcessExecution.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
467
465
|
if (message.fields.redelivered && message.properties.persistent === false) return;
|
|
468
466
|
|
|
469
467
|
const content = message.content;
|
|
@@ -495,7 +493,7 @@ proto._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
|
495
493
|
this[kActivityQ].queueMessage(message.fields, cloneContent(content), {persistent: true, ...message.properties});
|
|
496
494
|
};
|
|
497
495
|
|
|
498
|
-
|
|
496
|
+
ProcessExecution.prototype._onChildMessage = function onChildMessage(routingKey, message) {
|
|
499
497
|
if (message.fields.redelivered && message.properties.persistent === false) return message.ack();
|
|
500
498
|
|
|
501
499
|
const content = message.content;
|
|
@@ -558,13 +556,13 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
|
|
|
558
556
|
}
|
|
559
557
|
};
|
|
560
558
|
|
|
561
|
-
|
|
559
|
+
ProcessExecution.prototype._stateChangeMessage = function stateChangeMessage(message, postponeMessage) {
|
|
562
560
|
const previousMsg = this._popPostponed(message.content);
|
|
563
561
|
if (previousMsg) previousMsg.ack();
|
|
564
562
|
if (postponeMessage) this[kElements].postponed.push(message);
|
|
565
563
|
};
|
|
566
564
|
|
|
567
|
-
|
|
565
|
+
ProcessExecution.prototype._popPostponed = function popPostponed(byContent) {
|
|
568
566
|
const {postponed, detachedActivities} = this[kElements];
|
|
569
567
|
|
|
570
568
|
const postponedIdx = postponed.findIndex((msg) => {
|
|
@@ -583,7 +581,7 @@ proto._popPostponed = function popPostponed(byContent) {
|
|
|
583
581
|
return postponedMsg;
|
|
584
582
|
};
|
|
585
583
|
|
|
586
|
-
|
|
584
|
+
ProcessExecution.prototype._onChildCompleted = function onChildCompleted(message) {
|
|
587
585
|
this._stateChangeMessage(message, false);
|
|
588
586
|
if (message.fields.redelivered) return message.ack();
|
|
589
587
|
|
|
@@ -619,7 +617,7 @@ proto._onChildCompleted = function onChildCompleted(message) {
|
|
|
619
617
|
}
|
|
620
618
|
};
|
|
621
619
|
|
|
622
|
-
|
|
620
|
+
ProcessExecution.prototype._stopExecution = function stopExecution(message) {
|
|
623
621
|
const postponedCount = this.postponedCount;
|
|
624
622
|
this._debug(`stop process execution (stop child executions ${postponedCount})`);
|
|
625
623
|
if (postponedCount) {
|
|
@@ -633,7 +631,7 @@ proto._stopExecution = function stopExecution(message) {
|
|
|
633
631
|
}, {type: 'stopped', persistent: false});
|
|
634
632
|
};
|
|
635
633
|
|
|
636
|
-
|
|
634
|
+
ProcessExecution.prototype._onDiscard = function onDiscard() {
|
|
637
635
|
this._deactivate();
|
|
638
636
|
const running = this[kElements].postponed.splice(0);
|
|
639
637
|
this._debug(`discard process execution (discard child executions ${running.length})`);
|
|
@@ -645,7 +643,7 @@ proto._onDiscard = function onDiscard() {
|
|
|
645
643
|
return this._complete('discard');
|
|
646
644
|
};
|
|
647
645
|
|
|
648
|
-
|
|
646
|
+
ProcessExecution.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
649
647
|
const executionId = this.executionId;
|
|
650
648
|
const broker = this.broker;
|
|
651
649
|
if (message.properties.delegate) {
|
|
@@ -686,7 +684,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
686
684
|
}
|
|
687
685
|
};
|
|
688
686
|
|
|
689
|
-
|
|
687
|
+
ProcessExecution.prototype._complete = function complete(completionType, content) {
|
|
690
688
|
this._deactivate();
|
|
691
689
|
this._debug(`process execution ${completionType}`);
|
|
692
690
|
this[kCompleted] = true;
|
|
@@ -701,7 +699,7 @@ proto._complete = function complete(completionType, content) {
|
|
|
701
699
|
}), {type: completionType, mandatory: completionType === 'error'});
|
|
702
700
|
};
|
|
703
701
|
|
|
704
|
-
|
|
702
|
+
ProcessExecution.prototype._terminate = function terminate(message) {
|
|
705
703
|
this[kStatus] = 'terminated';
|
|
706
704
|
this._debug('terminating process execution');
|
|
707
705
|
|
|
@@ -719,23 +717,23 @@ proto._terminate = function terminate(message) {
|
|
|
719
717
|
this[kActivityQ].purge();
|
|
720
718
|
};
|
|
721
719
|
|
|
722
|
-
|
|
720
|
+
ProcessExecution.prototype._getFlowById = function getFlowById(flowId) {
|
|
723
721
|
return this[kElements].flows.find((f) => f.id === flowId);
|
|
724
722
|
};
|
|
725
723
|
|
|
726
|
-
|
|
724
|
+
ProcessExecution.prototype._getAssociationById = function getAssociationById(associationId) {
|
|
727
725
|
return this[kElements].associations.find((a) => a.id === associationId);
|
|
728
726
|
};
|
|
729
727
|
|
|
730
|
-
|
|
728
|
+
ProcessExecution.prototype._getMessageFlowById = function getMessageFlowById(flowId) {
|
|
731
729
|
return this[kElements].outboundMessageFlows.find((f) => f.id === flowId);
|
|
732
730
|
};
|
|
733
731
|
|
|
734
|
-
|
|
732
|
+
ProcessExecution.prototype._getChildById = function getChildById(childId) {
|
|
735
733
|
return this.getActivityById(childId) || this._getFlowById(childId);
|
|
736
734
|
};
|
|
737
735
|
|
|
738
|
-
|
|
736
|
+
ProcessExecution.prototype._getChildApi = function getChildApi(message) {
|
|
739
737
|
const content = message.content;
|
|
740
738
|
|
|
741
739
|
let child = this._getChildById(content.id);
|
|
@@ -754,12 +752,12 @@ proto._getChildApi = function getChildApi(message) {
|
|
|
754
752
|
}
|
|
755
753
|
};
|
|
756
754
|
|
|
757
|
-
|
|
755
|
+
ProcessExecution.prototype._onShookEnd = function onShookEnd(message) {
|
|
758
756
|
const routingKey = message.fields.routingKey;
|
|
759
757
|
if (routingKey !== 'activity.shake.end') return;
|
|
760
758
|
this[kElements].startSequences[message.content.id] = cloneMessage(message);
|
|
761
759
|
};
|
|
762
760
|
|
|
763
|
-
|
|
761
|
+
ProcessExecution.prototype._debug = function debugMessage(logMessage) {
|
|
764
762
|
this[kParent].logger.debug(`<${this.executionId} (${this.id})> ${logMessage}`);
|
|
765
763
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import {ActivityError} from '../error/Errors';
|
|
3
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import {ActivityError} from '../error/Errors.js';
|
|
3
|
+
import {cloneContent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
export default function CallActivity(activityDef, context) {
|
|
6
6
|
return new Activity(CallActivityBehaviour, activityDef, context);
|
|
@@ -18,9 +18,7 @@ export function CallActivityBehaviour(activity) {
|
|
|
18
18
|
this.environment = activity.environment;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
proto.execute = function execute(executeMessage) {
|
|
21
|
+
CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
|
|
24
22
|
const executeContent = executeMessage.content;
|
|
25
23
|
const loopCharacteristics = this.loopCharacteristics;
|
|
26
24
|
if (loopCharacteristics && executeContent.isRootScope) {
|
|
@@ -59,7 +57,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
59
57
|
});
|
|
60
58
|
};
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
63
61
|
if (!message.properties.delegate) return;
|
|
64
62
|
const {content: delegateContent} = message;
|
|
65
63
|
if (!delegateContent || !delegateContent.message) return;
|
|
@@ -82,7 +80,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(calledElement, exe
|
|
|
82
80
|
return this._onApiMessage(calledElement, executeMessage, routingKey, message);
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
86
84
|
const {type: messageType, correlationId} = message.properties;
|
|
87
85
|
const executeContent = executeMessage.content;
|
|
88
86
|
|
|
@@ -123,7 +121,7 @@ proto._onApiMessage = function onApiMessage(calledElement, executeMessage, routi
|
|
|
123
121
|
}
|
|
124
122
|
};
|
|
125
123
|
|
|
126
|
-
|
|
124
|
+
CallActivityBehaviour.prototype._stop = function stop(executionId) {
|
|
127
125
|
const broker = this.broker;
|
|
128
126
|
broker.cancel(`_api-${executionId}`);
|
|
129
127
|
broker.cancel(`_api-delegated-${executionId}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {RunError} from '../error/Errors';
|
|
2
|
-
import {cloneContent, cloneMessage, unshiftParent, cloneParent} from '../messageHelper';
|
|
1
|
+
import {RunError} from '../error/Errors.js';
|
|
2
|
+
import {cloneContent, cloneMessage, unshiftParent, cloneParent} from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
export default function LoopCharacteristics(activity, loopCharacteristics) {
|
|
5
5
|
this.activity = activity;
|