bpmn-elements 11.1.1 → 13.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 +14 -0
- package/dist/Environment.js +15 -15
- package/dist/activity/Activity.js +123 -143
- package/dist/activity/ActivityExecution.js +1 -3
- package/dist/definition/Definition.js +39 -44
- package/dist/definition/DefinitionExecution.js +51 -53
- package/dist/eventDefinitions/EventDefinitionExecution.js +10 -10
- package/dist/eventDefinitions/TimerEventDefinition.js +16 -16
- package/dist/events/BoundaryEvent.js +12 -11
- package/dist/events/index.js +60 -0
- package/dist/flows/Association.js +0 -1
- package/dist/flows/MessageFlow.js +0 -1
- package/dist/flows/SequenceFlow.js +1 -3
- package/dist/gateways/index.js +49 -0
- package/dist/getPropertyValue.js +1 -2
- package/dist/index.js +2 -2
- package/dist/process/Process.js +54 -61
- package/dist/process/ProcessExecution.js +31 -33
- package/dist/tasks/LoopCharacteristics.js +20 -7
- package/dist/tasks/SubProcess.js +33 -61
- package/dist/tasks/index.js +93 -0
- package/events.d.ts +1 -0
- package/gateways.d.ts +1 -0
- package/index.d.ts +1 -0
- package/package.json +39 -19
- package/src/Environment.js +16 -17
- package/src/activity/Activity.js +96 -131
- package/src/activity/ActivityExecution.js +0 -1
- package/src/definition/Definition.js +30 -40
- package/src/definition/DefinitionExecution.js +47 -55
- package/src/eventDefinitions/EventDefinitionExecution.js +9 -10
- package/src/eventDefinitions/TimerEventDefinition.js +14 -16
- package/src/events/BoundaryEvent.js +11 -11
- package/src/events/index.js +5 -0
- package/src/flows/Association.js +0 -1
- package/src/flows/MessageFlow.js +0 -1
- package/src/flows/SequenceFlow.js +0 -1
- package/src/gateways/index.js +4 -0
- package/src/process/Process.js +40 -54
- package/src/process/ProcessExecution.js +25 -31
- package/src/tasks/LoopCharacteristics.js +18 -7
- package/src/tasks/SubProcess.js +32 -66
- package/src/tasks/index.js +8 -0
- package/tasks.d.ts +1 -0
- package/types/index.d.ts +69 -767
- package/types/types.d.ts +706 -0
|
@@ -61,69 +61,61 @@ export default function DefinitionExecution(definition, context) {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
Object.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
Object.defineProperties(DefinitionExecution.prototype, {
|
|
65
|
+
stopped: {
|
|
66
|
+
get() {
|
|
67
|
+
return this[kStopped];
|
|
68
|
+
},
|
|
68
69
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
get() {
|
|
74
|
-
return this[kCompleted];
|
|
70
|
+
completed: {
|
|
71
|
+
get() {
|
|
72
|
+
return this[kCompleted];
|
|
73
|
+
},
|
|
75
74
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
get() {
|
|
81
|
-
return this[kStatus];
|
|
75
|
+
status: {
|
|
76
|
+
get() {
|
|
77
|
+
return this[kStatus];
|
|
78
|
+
},
|
|
82
79
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
get() {
|
|
88
|
-
return this[kProcesses].running;
|
|
80
|
+
processes: {
|
|
81
|
+
get() {
|
|
82
|
+
return this[kProcesses].running;
|
|
83
|
+
},
|
|
89
84
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return this[kProcesses].postponed.length;
|
|
85
|
+
postponedCount: {
|
|
86
|
+
get() {
|
|
87
|
+
return this[kProcesses].postponed.length;
|
|
88
|
+
},
|
|
95
89
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return this[kActivated];
|
|
90
|
+
isRunning: {
|
|
91
|
+
get() {
|
|
92
|
+
return this[kActivated];
|
|
93
|
+
},
|
|
101
94
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
break;
|
|
95
|
+
activityStatus: {
|
|
96
|
+
get() {
|
|
97
|
+
let status = 'idle';
|
|
98
|
+
const running = this[kProcesses].running;
|
|
99
|
+
if (!running || !running.length) return status;
|
|
100
|
+
|
|
101
|
+
for (const bp of running) {
|
|
102
|
+
const bpStatus = bp.activityStatus;
|
|
103
|
+
switch (bp.activityStatus) {
|
|
104
|
+
case 'idle':
|
|
105
|
+
break;
|
|
106
|
+
case 'executing':
|
|
107
|
+
return bpStatus;
|
|
108
|
+
case 'timer':
|
|
109
|
+
status = bpStatus;
|
|
110
|
+
break;
|
|
111
|
+
case 'wait':
|
|
112
|
+
if (status === 'idle') status = bpStatus;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
123
115
|
}
|
|
124
|
-
}
|
|
125
116
|
|
|
126
|
-
|
|
117
|
+
return status;
|
|
118
|
+
},
|
|
127
119
|
},
|
|
128
120
|
});
|
|
129
121
|
|
|
@@ -15,17 +15,16 @@ export default function EventDefinitionExecution(activity, eventDefinitions, com
|
|
|
15
15
|
this[kExecuteMessage] = null;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
Object.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
Object.defineProperties(EventDefinitionExecution.prototype, {
|
|
19
|
+
completed: {
|
|
20
|
+
get() {
|
|
21
|
+
return this[kCompleted];
|
|
22
|
+
},
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
get() {
|
|
28
|
-
return this[kStopped];
|
|
24
|
+
stopped: {
|
|
25
|
+
get() {
|
|
26
|
+
return this[kStopped];
|
|
27
|
+
},
|
|
29
28
|
},
|
|
30
29
|
});
|
|
31
30
|
|
|
@@ -23,24 +23,22 @@ export default function TimerEventDefinition(activity, eventDefinition) {
|
|
|
23
23
|
this[kTimer] = null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
Object.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
Object.defineProperties(TimerEventDefinition.prototype, {
|
|
27
|
+
executionId: {
|
|
28
|
+
get() {
|
|
29
|
+
const content = this[kTimerContent];
|
|
30
|
+
return content && content.executionId;
|
|
31
|
+
},
|
|
30
32
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
get() {
|
|
36
|
-
return this[kStopped];
|
|
33
|
+
stopped: {
|
|
34
|
+
get() {
|
|
35
|
+
return this[kStopped];
|
|
36
|
+
},
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
get() {
|
|
43
|
-
return this[kTimer];
|
|
38
|
+
timer: {
|
|
39
|
+
get() {
|
|
40
|
+
return this[kTimer];
|
|
41
|
+
},
|
|
44
42
|
},
|
|
45
43
|
});
|
|
46
44
|
|
|
@@ -25,18 +25,18 @@ export function BoundaryEventBehaviour(activity) {
|
|
|
25
25
|
this[kAttachedTags] = [];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
Object.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
Object.defineProperties(BoundaryEventBehaviour.prototype, {
|
|
29
|
+
executionId: {
|
|
30
|
+
get() {
|
|
31
|
+
const message = this[kExecuteMessage];
|
|
32
|
+
return message && message.content.executionId;
|
|
33
|
+
},
|
|
32
34
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const behaviour = this.activity.behaviour || {};
|
|
39
|
-
return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
35
|
+
cancelActivity: {
|
|
36
|
+
get() {
|
|
37
|
+
const behaviour = this.activity.behaviour || {};
|
|
38
|
+
return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
|
package/src/flows/Association.js
CHANGED
package/src/flows/MessageFlow.js
CHANGED
package/src/process/Process.js
CHANGED
|
@@ -60,68 +60,54 @@ export function Process(processDef, context) {
|
|
|
60
60
|
this[kExtensions] = context.loadExtensions(this);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
Object.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
Object.defineProperties(Process.prototype, {
|
|
64
|
+
counters: {
|
|
65
|
+
get() {
|
|
66
|
+
return {...this[kCounters]};
|
|
67
|
+
},
|
|
67
68
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const lanes = this[kLanes];
|
|
74
|
-
return lanes && lanes.slice();
|
|
69
|
+
lanes: {
|
|
70
|
+
get() {
|
|
71
|
+
const lanes = this[kLanes];
|
|
72
|
+
return lanes && lanes.slice();
|
|
73
|
+
},
|
|
75
74
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
get() {
|
|
81
|
-
return this[kExtensions];
|
|
75
|
+
extensions: {
|
|
76
|
+
get() {
|
|
77
|
+
return this[kExtensions];
|
|
78
|
+
},
|
|
82
79
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
get() {
|
|
88
|
-
return this[kStopped];
|
|
80
|
+
stopped: {
|
|
81
|
+
get() {
|
|
82
|
+
return this[kStopped];
|
|
83
|
+
},
|
|
89
84
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!this[kConsuming]) return false;
|
|
96
|
-
return !!this.status;
|
|
85
|
+
isRunning: {
|
|
86
|
+
get() {
|
|
87
|
+
if (!this[kConsuming]) return false;
|
|
88
|
+
return !!this.status;
|
|
89
|
+
},
|
|
97
90
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const {executionId, initExecutionId} = this[kExec];
|
|
104
|
-
return executionId || initExecutionId;
|
|
91
|
+
executionId: {
|
|
92
|
+
get() {
|
|
93
|
+
const {executionId, initExecutionId} = this[kExec];
|
|
94
|
+
return executionId || initExecutionId;
|
|
95
|
+
},
|
|
105
96
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
get() {
|
|
111
|
-
return this[kExec].execution;
|
|
97
|
+
execution: {
|
|
98
|
+
get() {
|
|
99
|
+
return this[kExec].execution;
|
|
100
|
+
},
|
|
112
101
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
get() {
|
|
118
|
-
return this[kStatus];
|
|
102
|
+
status: {
|
|
103
|
+
get() {
|
|
104
|
+
return this[kStatus];
|
|
105
|
+
},
|
|
119
106
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
|
|
107
|
+
activityStatus: {
|
|
108
|
+
get() {
|
|
109
|
+
return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
|
|
110
|
+
},
|
|
125
111
|
},
|
|
126
112
|
});
|
|
127
113
|
|
|
@@ -58,42 +58,36 @@ function ProcessExecution(parentActivity, context) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
Object.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
Object.defineProperties(ProcessExecution.prototype, {
|
|
62
|
+
stopped: {
|
|
63
|
+
get() {
|
|
64
|
+
return this[kStopped];
|
|
65
|
+
},
|
|
65
66
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
get() {
|
|
71
|
-
return this[kCompleted];
|
|
67
|
+
completed: {
|
|
68
|
+
get() {
|
|
69
|
+
return this[kCompleted];
|
|
70
|
+
},
|
|
72
71
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
get() {
|
|
78
|
-
return this[kStatus];
|
|
72
|
+
status: {
|
|
73
|
+
get() {
|
|
74
|
+
return this[kStatus];
|
|
75
|
+
},
|
|
79
76
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return this[kElements].postponed.length;
|
|
77
|
+
postponedCount: {
|
|
78
|
+
get() {
|
|
79
|
+
return this[kElements].postponed.length;
|
|
80
|
+
},
|
|
85
81
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return this[kActivated];
|
|
82
|
+
isRunning: {
|
|
83
|
+
get() {
|
|
84
|
+
return this[kActivated];
|
|
85
|
+
},
|
|
91
86
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return this[kTracker].activityStatus;
|
|
87
|
+
activityStatus: {
|
|
88
|
+
get() {
|
|
89
|
+
return this[kTracker].activityStatus;
|
|
90
|
+
},
|
|
97
91
|
},
|
|
98
92
|
});
|
|
99
93
|
|
|
@@ -120,6 +120,7 @@ function ParallelLoopCharacteristics(activity, characteristics) {
|
|
|
120
120
|
this.characteristics = characteristics;
|
|
121
121
|
this.running = 0;
|
|
122
122
|
this.index = 0;
|
|
123
|
+
this.discarded = 0;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
ParallelLoopCharacteristics.prototype.execute = function execute(executeMessage) {
|
|
@@ -128,8 +129,10 @@ ParallelLoopCharacteristics.prototype.execute = function execute(executeMessage)
|
|
|
128
129
|
|
|
129
130
|
const isRedelivered = executeMessage.fields.redelivered;
|
|
130
131
|
if (isRedelivered) {
|
|
131
|
-
|
|
132
|
-
if (!isNaN(
|
|
132
|
+
const { index, running, discarded } = executeMessage.content;
|
|
133
|
+
if (!isNaN(index)) this.index = index;
|
|
134
|
+
if (!isNaN(running)) this.running = running;
|
|
135
|
+
if (!isNaN(discarded)) this.discarded = discarded;
|
|
133
136
|
}
|
|
134
137
|
chr.subscribe(this._onCompleteMessage.bind(this));
|
|
135
138
|
|
|
@@ -160,6 +163,7 @@ ParallelLoopCharacteristics.prototype._startBatch = function startBatch() {
|
|
|
160
163
|
...chr.getContent(),
|
|
161
164
|
index: this.index,
|
|
162
165
|
running: this.running,
|
|
166
|
+
discarded: this.discarded,
|
|
163
167
|
output: chr.output,
|
|
164
168
|
preventComplete: true,
|
|
165
169
|
});
|
|
@@ -169,11 +173,15 @@ ParallelLoopCharacteristics.prototype._startBatch = function startBatch() {
|
|
|
169
173
|
}
|
|
170
174
|
};
|
|
171
175
|
|
|
172
|
-
ParallelLoopCharacteristics.prototype._onCompleteMessage = function onCompleteMessage(
|
|
176
|
+
ParallelLoopCharacteristics.prototype._onCompleteMessage = function onCompleteMessage(routingKey, message) {
|
|
173
177
|
const chr = this.characteristics;
|
|
174
178
|
const {content} = message;
|
|
175
179
|
if (content.output !== undefined) chr.output[content.index] = content.output;
|
|
176
180
|
|
|
181
|
+
if (routingKey === 'execute.discard') {
|
|
182
|
+
this.discarded++;
|
|
183
|
+
}
|
|
184
|
+
|
|
177
185
|
this.running--;
|
|
178
186
|
|
|
179
187
|
this.activity.broker.publish('execution', 'execute.iteration.completed', {
|
|
@@ -181,17 +189,18 @@ ParallelLoopCharacteristics.prototype._onCompleteMessage = function onCompleteMe
|
|
|
181
189
|
...chr.getContent(),
|
|
182
190
|
index: this.index,
|
|
183
191
|
running: this.running,
|
|
192
|
+
discarded: this.discarded,
|
|
184
193
|
output: chr.output,
|
|
185
194
|
state: 'iteration.completed',
|
|
186
195
|
preventComplete: true,
|
|
187
196
|
});
|
|
188
197
|
|
|
189
198
|
if (this.running <= 0 && !chr.next(this.index)) {
|
|
190
|
-
return chr.complete(content);
|
|
199
|
+
return chr.complete(content, this.discarded === this.index);
|
|
191
200
|
}
|
|
192
201
|
|
|
193
202
|
if (chr.isCompletionConditionMet(message)) {
|
|
194
|
-
return chr.complete(content);
|
|
203
|
+
return chr.complete(content, this.discarded === this.index);
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
if (this.running <= 0) {
|
|
@@ -299,10 +308,10 @@ Characteristics.prototype.isCompletionConditionMet = function isCompletionCondit
|
|
|
299
308
|
return this.activity.environment.resolveExpression(this.completionCondition, cloneMessage(message, {loopOutput: this.output}));
|
|
300
309
|
};
|
|
301
310
|
|
|
302
|
-
Characteristics.prototype.complete = function complete(content) {
|
|
311
|
+
Characteristics.prototype.complete = function complete(content, allDiscarded) {
|
|
303
312
|
this.stop();
|
|
304
313
|
|
|
305
|
-
return this.broker.publish('execution', 'execute.completed', {
|
|
314
|
+
return this.broker.publish('execution', 'execute.' + (allDiscarded ? 'discard' : 'completed'), {
|
|
306
315
|
...content,
|
|
307
316
|
...this.getContent(),
|
|
308
317
|
output: this.output,
|
|
@@ -315,7 +324,9 @@ Characteristics.prototype.subscribe = function subscribe(onIterationCompleteMess
|
|
|
315
324
|
|
|
316
325
|
function onComplete(routingKey, message, ...args) {
|
|
317
326
|
if (!message.content.isMultiInstance) return;
|
|
327
|
+
|
|
318
328
|
switch (routingKey) {
|
|
329
|
+
case 'execute.discard':
|
|
319
330
|
case 'execute.cancel':
|
|
320
331
|
case 'execute.completed':
|
|
321
332
|
return onIterationCompleteMessage(routingKey, message, ...args);
|