bpmn-elements 13.1.2 → 14.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/README.md +1 -2
- package/dist/Context.js +36 -2
- package/dist/activity/Activity.js +32 -15
- package/dist/definition/DefinitionExecution.js +1 -1
- package/dist/error/Errors.js +6 -1
- package/dist/eventDefinitions/TimerEventDefinition.js +18 -31
- package/dist/getPropertyValue.js +1 -2
- package/dist/index.js +13 -5
- package/package.json +16 -14
- package/src/Api.js +18 -20
- package/src/Context.js +49 -7
- package/src/Environment.js +10 -20
- package/src/EventBroker.js +21 -27
- package/src/MessageFormatter.js +23 -19
- package/src/Tracker.js +4 -4
- package/src/activity/Activity.js +174 -121
- package/src/activity/ActivityExecution.js +38 -29
- package/src/activity/Dummy.js +3 -3
- package/src/activity/Escalation.js +4 -4
- package/src/activity/ExecutionScope.js +4 -4
- package/src/activity/Message.js +5 -5
- package/src/activity/Signal.js +5 -5
- package/src/definition/Definition.js +44 -36
- package/src/definition/DefinitionExecution.js +97 -66
- package/src/error/BpmnError.js +3 -3
- package/src/error/Errors.js +27 -15
- package/src/eventDefinitions/CancelEventDefinition.js +16 -11
- package/src/eventDefinitions/CompensateEventDefinition.js +28 -23
- package/src/eventDefinitions/ConditionalEventDefinition.js +42 -23
- package/src/eventDefinitions/ErrorEventDefinition.js +47 -34
- package/src/eventDefinitions/EscalationEventDefinition.js +21 -20
- package/src/eventDefinitions/EventDefinitionExecution.js +6 -6
- package/src/eventDefinitions/LinkEventDefinition.js +28 -22
- package/src/eventDefinitions/MessageEventDefinition.js +47 -36
- package/src/eventDefinitions/SignalEventDefinition.js +42 -31
- package/src/eventDefinitions/TerminateEventDefinition.js +4 -4
- package/src/eventDefinitions/TimerEventDefinition.js +56 -57
- package/src/events/BoundaryEvent.js +81 -46
- package/src/events/EndEvent.js +2 -2
- package/src/events/IntermediateCatchEvent.js +8 -4
- package/src/events/IntermediateThrowEvent.js +2 -2
- package/src/events/StartEvent.js +29 -18
- package/src/flows/Association.js +11 -11
- package/src/flows/MessageFlow.js +16 -14
- package/src/flows/SequenceFlow.js +22 -20
- package/src/gateways/EventBasedGateway.js +7 -6
- package/src/gateways/ExclusiveGateway.js +4 -4
- package/src/gateways/InclusiveGateway.js +3 -3
- package/src/gateways/ParallelGateway.js +4 -4
- package/src/getPropertyValue.js +3 -6
- package/src/index.js +3 -3
- package/src/io/BpmnIO.js +5 -6
- package/src/io/EnvironmentDataObject.js +2 -3
- package/src/io/EnvironmentDataStore.js +2 -2
- package/src/io/EnvironmentDataStoreReference.js +2 -2
- package/src/io/InputOutputSpecification.js +60 -54
- package/src/io/Properties.js +45 -33
- package/src/messageHelper.js +16 -23
- package/src/process/Lane.js +3 -3
- package/src/process/Process.js +40 -34
- package/src/process/ProcessExecution.js +122 -78
- package/src/tasks/CallActivity.js +109 -57
- package/src/tasks/LoopCharacteristics.js +30 -18
- package/src/tasks/ReceiveTask.js +59 -38
- package/src/tasks/ScriptTask.js +17 -8
- package/src/tasks/ServiceTask.js +16 -9
- package/src/tasks/SignalTask.js +47 -28
- package/src/tasks/StandardLoopCharacteristics.js +3 -3
- package/src/tasks/SubProcess.js +9 -8
- package/src/tasks/Task.js +4 -3
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +6 -6
- package/types/types.d.ts +39 -35
- package/CHANGELOG.md +0 -459
- package/src/ExtensionsMapper.js +0 -42
- package/src/iso-duration.js +0 -91
package/src/messageHelper.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
cloneContent,
|
|
3
|
-
cloneMessage,
|
|
4
|
-
cloneParent,
|
|
5
|
-
shiftParent,
|
|
6
|
-
unshiftParent,
|
|
7
|
-
pushParent,
|
|
8
|
-
};
|
|
1
|
+
export { cloneContent, cloneMessage, cloneParent, shiftParent, unshiftParent, pushParent };
|
|
9
2
|
|
|
10
3
|
function cloneContent(content, extend) {
|
|
11
|
-
const {discardSequence, inbound, outbound, parent, sequence} = content;
|
|
4
|
+
const { discardSequence, inbound, outbound, parent, sequence } = content;
|
|
12
5
|
|
|
13
6
|
const clone = {
|
|
14
7
|
...content,
|
|
@@ -36,26 +29,26 @@ function cloneContent(content, extend) {
|
|
|
36
29
|
|
|
37
30
|
function cloneMessage(message, overrideContent) {
|
|
38
31
|
return {
|
|
39
|
-
fields: {...message.fields},
|
|
32
|
+
fields: { ...message.fields },
|
|
40
33
|
content: cloneContent(message.content, overrideContent),
|
|
41
|
-
properties: {...message.properties},
|
|
34
|
+
properties: { ...message.properties },
|
|
42
35
|
};
|
|
43
36
|
}
|
|
44
37
|
|
|
45
38
|
function cloneParent(parent) {
|
|
46
|
-
const {path} = parent;
|
|
47
|
-
const clone = {...parent};
|
|
39
|
+
const { path } = parent;
|
|
40
|
+
const clone = { ...parent };
|
|
48
41
|
if (!path) return clone;
|
|
49
42
|
|
|
50
43
|
clone.path = path.map((p) => {
|
|
51
|
-
return {...p};
|
|
44
|
+
return { ...p };
|
|
52
45
|
});
|
|
53
46
|
|
|
54
47
|
return clone;
|
|
55
48
|
}
|
|
56
49
|
|
|
57
50
|
function unshiftParent(parent, adoptingParent) {
|
|
58
|
-
const {id, type, executionId} = adoptingParent;
|
|
51
|
+
const { id, type, executionId } = adoptingParent;
|
|
59
52
|
if (!parent) {
|
|
60
53
|
return {
|
|
61
54
|
id,
|
|
@@ -65,13 +58,13 @@ function unshiftParent(parent, adoptingParent) {
|
|
|
65
58
|
}
|
|
66
59
|
|
|
67
60
|
const clone = cloneParent(parent);
|
|
68
|
-
const {id: parentId, type: parentType, executionId: parentExecutionId} = parent;
|
|
61
|
+
const { id: parentId, type: parentType, executionId: parentExecutionId } = parent;
|
|
69
62
|
clone.id = id;
|
|
70
63
|
clone.executionId = executionId;
|
|
71
64
|
clone.type = type;
|
|
72
65
|
|
|
73
|
-
const path = clone.path = clone.path || [];
|
|
74
|
-
path.unshift({id: parentId, type: parentType, executionId: parentExecutionId});
|
|
66
|
+
const path = (clone.path = clone.path || []);
|
|
67
|
+
path.unshift({ id: parentId, type: parentType, executionId: parentExecutionId });
|
|
75
68
|
|
|
76
69
|
return clone;
|
|
77
70
|
}
|
|
@@ -81,7 +74,7 @@ function shiftParent(parent) {
|
|
|
81
74
|
if (!parent.path || !parent.path.length) return;
|
|
82
75
|
|
|
83
76
|
const clone = cloneParent(parent);
|
|
84
|
-
const {id, executionId, type} = clone.path.shift();
|
|
77
|
+
const { id, executionId, type } = clone.path.shift();
|
|
85
78
|
clone.id = id;
|
|
86
79
|
clone.executionId = executionId;
|
|
87
80
|
clone.type = type;
|
|
@@ -90,15 +83,15 @@ function shiftParent(parent) {
|
|
|
90
83
|
}
|
|
91
84
|
|
|
92
85
|
function pushParent(parent, ancestor) {
|
|
93
|
-
const {id, type, executionId} = ancestor;
|
|
94
|
-
if (!parent) return {id, type, executionId};
|
|
86
|
+
const { id, type, executionId } = ancestor;
|
|
87
|
+
if (!parent) return { id, type, executionId };
|
|
95
88
|
|
|
96
89
|
const clone = cloneParent(parent);
|
|
97
90
|
if (clone.id === id) {
|
|
98
91
|
if (executionId) clone.executionId = executionId;
|
|
99
92
|
return clone;
|
|
100
93
|
}
|
|
101
|
-
const path = clone.path = clone.path || [];
|
|
94
|
+
const path = (clone.path = clone.path || []);
|
|
102
95
|
|
|
103
96
|
for (const p of path) {
|
|
104
97
|
if (p.id === id) {
|
|
@@ -107,6 +100,6 @@ function pushParent(parent, ancestor) {
|
|
|
107
100
|
}
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
path.push({id, type, executionId});
|
|
103
|
+
path.push({ id, type, executionId });
|
|
111
104
|
return clone;
|
|
112
105
|
}
|
package/src/process/Lane.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const kProcess = Symbol.for('process');
|
|
2
2
|
|
|
3
3
|
export default function Lane(process, laneDefinition) {
|
|
4
|
-
const {broker, environment} = process;
|
|
5
|
-
const {id, type, behaviour} = laneDefinition;
|
|
4
|
+
const { broker, environment } = process;
|
|
5
|
+
const { id, type, behaviour } = laneDefinition;
|
|
6
6
|
|
|
7
7
|
this[kProcess] = process;
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export default function Lane(process, laneDefinition) {
|
|
|
13
13
|
id: process.id,
|
|
14
14
|
type: process.type,
|
|
15
15
|
};
|
|
16
|
-
this.behaviour = {...behaviour};
|
|
16
|
+
this.behaviour = { ...behaviour };
|
|
17
17
|
this.environment = environment;
|
|
18
18
|
this.broker = broker;
|
|
19
19
|
this.context = process.context;
|
package/src/process/Process.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
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';
|
|
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');
|
|
@@ -19,17 +19,17 @@ const kStopped = Symbol.for('stopped');
|
|
|
19
19
|
export default Process;
|
|
20
20
|
|
|
21
21
|
export function Process(processDef, context) {
|
|
22
|
-
const {id, type = 'process', name, parent, behaviour = {}} = processDef;
|
|
22
|
+
const { id, type = 'process', name, parent, behaviour = {} } = processDef;
|
|
23
23
|
this.id = id;
|
|
24
24
|
this.type = type;
|
|
25
25
|
this.name = name;
|
|
26
26
|
this.parent = parent ? cloneParent(parent) : {};
|
|
27
27
|
this.behaviour = behaviour;
|
|
28
28
|
|
|
29
|
-
const {isExecutable} = behaviour;
|
|
29
|
+
const { isExecutable } = behaviour;
|
|
30
30
|
this.isExecutable = isExecutable;
|
|
31
31
|
|
|
32
|
-
const environment = this.environment = context.environment;
|
|
32
|
+
const environment = (this.environment = context.environment);
|
|
33
33
|
this.context = context;
|
|
34
34
|
this[kCounters] = {
|
|
35
35
|
completed: 0,
|
|
@@ -40,7 +40,7 @@ export function Process(processDef, context) {
|
|
|
40
40
|
this[kStatus] = undefined;
|
|
41
41
|
this[kStopped] = false;
|
|
42
42
|
|
|
43
|
-
const {broker, on, once, waitFor} = ProcessBroker(this);
|
|
43
|
+
const { broker, on, once, waitFor } = ProcessBroker(this);
|
|
44
44
|
this.broker = broker;
|
|
45
45
|
this.on = on;
|
|
46
46
|
this.once = once;
|
|
@@ -63,7 +63,7 @@ export function Process(processDef, context) {
|
|
|
63
63
|
Object.defineProperties(Process.prototype, {
|
|
64
64
|
counters: {
|
|
65
65
|
get() {
|
|
66
|
-
return {...this[kCounters]};
|
|
66
|
+
return { ...this[kCounters] };
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
lanes: {
|
|
@@ -90,7 +90,7 @@ Object.defineProperties(Process.prototype, {
|
|
|
90
90
|
},
|
|
91
91
|
executionId: {
|
|
92
92
|
get() {
|
|
93
|
-
const {executionId, initExecutionId} = this[kExec];
|
|
93
|
+
const { executionId, initExecutionId } = this[kExec];
|
|
94
94
|
return executionId || initExecutionId;
|
|
95
95
|
},
|
|
96
96
|
},
|
|
@@ -106,26 +106,26 @@ Object.defineProperties(Process.prototype, {
|
|
|
106
106
|
},
|
|
107
107
|
activityStatus: {
|
|
108
108
|
get() {
|
|
109
|
-
return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
|
|
109
|
+
return (this[kExec].execution && this[kExec].execution.activityStatus) || 'idle';
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
Process.prototype.init = function init(useAsExecutionId) {
|
|
115
115
|
const exec = this[kExec];
|
|
116
|
-
const initExecutionId = exec.initExecutionId = useAsExecutionId || getUniqueId(this.id);
|
|
116
|
+
const initExecutionId = (exec.initExecutionId = useAsExecutionId || getUniqueId(this.id));
|
|
117
117
|
this._debug(`initialized with executionId <${initExecutionId}>`);
|
|
118
|
-
this._publishEvent('init', this._createMessage({executionId: initExecutionId}));
|
|
118
|
+
this._publishEvent('init', this._createMessage({ executionId: initExecutionId }));
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
Process.prototype.run = function run(runContent) {
|
|
122
122
|
if (this.isRunning) throw new Error(`process <${this.id}> is already running`);
|
|
123
123
|
|
|
124
124
|
const exec = this[kExec];
|
|
125
|
-
const executionId = exec.executionId = exec.initExecutionId || getUniqueId(this.id);
|
|
125
|
+
const executionId = (exec.executionId = exec.initExecutionId || getUniqueId(this.id));
|
|
126
126
|
exec.initExecutionId = undefined;
|
|
127
127
|
|
|
128
|
-
const content = this._createMessage({...runContent, executionId});
|
|
128
|
+
const content = this._createMessage({ ...runContent, executionId });
|
|
129
129
|
|
|
130
130
|
const broker = this.broker;
|
|
131
131
|
broker.publish('run', 'run.enter', content);
|
|
@@ -142,7 +142,7 @@ Process.prototype.resume = function resume() {
|
|
|
142
142
|
this[kStopped] = false;
|
|
143
143
|
|
|
144
144
|
const content = this._createMessage();
|
|
145
|
-
this.broker.publish('run', 'run.resume', content, {persistent: false});
|
|
145
|
+
this.broker.publish('run', 'run.resume', content, { persistent: false });
|
|
146
146
|
this._activateRunConsumers();
|
|
147
147
|
return this;
|
|
148
148
|
};
|
|
@@ -169,7 +169,7 @@ Process.prototype.recover = function recover(state) {
|
|
|
169
169
|
this[kStatus] = state.status;
|
|
170
170
|
const exec = this[kExec];
|
|
171
171
|
exec.executionId = state.executionId;
|
|
172
|
-
this[kCounters] = {...this[kCounters], ...state.counters};
|
|
172
|
+
this[kCounters] = { ...this[kCounters], ...state.counters };
|
|
173
173
|
this.environment.recover(state.environment);
|
|
174
174
|
|
|
175
175
|
if (state.execution) {
|
|
@@ -198,19 +198,19 @@ Process.prototype.getApi = function getApi(message) {
|
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
Process.prototype.signal = function signal(message) {
|
|
201
|
-
return this.getApi().signal(message, {delegate: true});
|
|
201
|
+
return this.getApi().signal(message, { delegate: true });
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
Process.prototype.cancelActivity = function cancelActivity(message) {
|
|
205
|
-
return this.getApi().cancel(message, {delegate: true});
|
|
205
|
+
return this.getApi().cancel(message, { delegate: true });
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
Process.prototype._activateRunConsumers = function activateRunConsumers() {
|
|
209
209
|
this[kConsuming] = true;
|
|
210
210
|
const broker = this.broker;
|
|
211
|
-
const {onApiMessage, onRunMessage} = this[kMessageHandlers];
|
|
212
|
-
broker.subscribeTmp('api', `process.*.${this.executionId}`, onApiMessage, {noAck: true, consumerTag: '_process-api', priority: 100});
|
|
213
|
-
broker.getQueue('run-q').assertConsumer(onRunMessage, {exclusive: true, consumerTag: '_process-run'});
|
|
211
|
+
const { onApiMessage, onRunMessage } = this[kMessageHandlers];
|
|
212
|
+
broker.subscribeTmp('api', `process.*.${this.executionId}`, onApiMessage, { noAck: true, consumerTag: '_process-api', priority: 100 });
|
|
213
|
+
broker.getQueue('run-q').assertConsumer(onRunMessage, { exclusive: true, consumerTag: '_process-run' });
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
@@ -222,7 +222,7 @@ Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
225
|
-
const {content, fields} = message;
|
|
225
|
+
const { content, fields } = message;
|
|
226
226
|
|
|
227
227
|
if (routingKey === 'run.resume') {
|
|
228
228
|
return this._onResumeMessage(message);
|
|
@@ -262,14 +262,17 @@ Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
|
262
262
|
consumerTag: '_process-execution',
|
|
263
263
|
});
|
|
264
264
|
|
|
265
|
-
const execution = exec.execution = exec.execution || new ProcessExecution(this, this.context);
|
|
265
|
+
const execution = (exec.execution = exec.execution || new ProcessExecution(this, this.context));
|
|
266
266
|
return execution.execute(executeMessage);
|
|
267
267
|
}
|
|
268
268
|
case 'run.error': {
|
|
269
269
|
this[kStatus] = 'errored';
|
|
270
|
-
this._publishEvent(
|
|
271
|
-
error
|
|
272
|
-
|
|
270
|
+
this._publishEvent(
|
|
271
|
+
'error',
|
|
272
|
+
cloneContent(content, {
|
|
273
|
+
error: fields.redelivered ? makeErrorFromMessage(message) : content.error,
|
|
274
|
+
}),
|
|
275
|
+
);
|
|
273
276
|
break;
|
|
274
277
|
}
|
|
275
278
|
case 'run.end': {
|
|
@@ -299,7 +302,7 @@ Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
|
299
302
|
case 'run.leave': {
|
|
300
303
|
this[kStatus] = undefined;
|
|
301
304
|
this.broker.cancel('_process-api');
|
|
302
|
-
const {output, ...rest} = content; // eslint-disable-line no-unused-vars
|
|
305
|
+
const { output, ...rest } = content; // eslint-disable-line no-unused-vars
|
|
303
306
|
this._publishEvent('leave', rest);
|
|
304
307
|
break;
|
|
305
308
|
}
|
|
@@ -358,8 +361,8 @@ Process.prototype._onExecutionMessage = function onExecutionMessage(routingKey,
|
|
|
358
361
|
};
|
|
359
362
|
|
|
360
363
|
Process.prototype._publishEvent = function publishEvent(state, content) {
|
|
361
|
-
const eventContent = this._createMessage({...content, state});
|
|
362
|
-
this.broker.publish('event', `process.${state}`, eventContent, {type: state, mandatory: state === 'error'});
|
|
364
|
+
const eventContent = this._createMessage({ ...content, state });
|
|
365
|
+
this.broker.publish('event', `process.${state}`, eventContent, { type: state, mandatory: state === 'error' });
|
|
363
366
|
};
|
|
364
367
|
|
|
365
368
|
Process.prototype.sendMessage = function sendMessage(message) {
|
|
@@ -369,13 +372,16 @@ Process.prototype.sendMessage = function sendMessage(message) {
|
|
|
369
372
|
let targetsFound = false;
|
|
370
373
|
if (messageContent.target && messageContent.target.id && this.getActivityById(messageContent.target.id)) {
|
|
371
374
|
targetsFound = true;
|
|
372
|
-
} else if (
|
|
375
|
+
} else if (
|
|
376
|
+
messageContent.message &&
|
|
377
|
+
this.getStartActivities({ referenceId: messageContent.message.id, referenceType: messageContent.message.messageType }).length
|
|
378
|
+
) {
|
|
373
379
|
targetsFound = true;
|
|
374
380
|
}
|
|
375
381
|
if (!targetsFound) return;
|
|
376
382
|
|
|
377
383
|
if (!this.status) this.run();
|
|
378
|
-
this.getApi().sendApiMessage(message.properties.type || 'message', cloneContent(messageContent), {delegate: true});
|
|
384
|
+
this.getApi().sendApiMessage(message.properties.type || 'message', cloneContent(messageContent), { delegate: true });
|
|
379
385
|
};
|
|
380
386
|
|
|
381
387
|
Process.prototype.getActivityById = function getActivityById(childId) {
|
|
@@ -436,7 +442,7 @@ Process.prototype._createMessage = function createMessage(override) {
|
|
|
436
442
|
type: this.type,
|
|
437
443
|
name: this.name,
|
|
438
444
|
executionId: this.executionId,
|
|
439
|
-
parent: {...this.parent},
|
|
445
|
+
parent: { ...this.parent },
|
|
440
446
|
...override,
|
|
441
447
|
};
|
|
442
448
|
};
|