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
package/src/tasks/SubProcess.js
CHANGED
|
@@ -39,39 +39,32 @@ export function SubProcessBehaviour(activity, context) {
|
|
|
39
39
|
|
|
40
40
|
this[kExecutions] = [];
|
|
41
41
|
this[kMessageHandlers] = {
|
|
42
|
-
onApiRootMessage: this._onApiRootMessage.bind(this),
|
|
43
42
|
onExecutionCompleted: this._onExecutionCompleted.bind(this),
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
Object.
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
Object.defineProperties(SubProcessBehaviour.prototype, {
|
|
47
|
+
execution: {
|
|
48
|
+
get() {
|
|
49
|
+
return this[kExecutions][0];
|
|
50
|
+
},
|
|
50
51
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return this[kExecutions].slice();
|
|
52
|
+
executions: {
|
|
53
|
+
get() {
|
|
54
|
+
return this[kExecutions].slice();
|
|
55
|
+
},
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
SubProcessBehaviour.prototype.execute = function execute(executeMessage) {
|
|
60
|
-
const
|
|
60
|
+
const { isRootScope, executionId } = executeMessage.content;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
executionId = this.executionId = content.executionId;
|
|
62
|
+
if (isRootScope) {
|
|
63
|
+
this.executionId = executionId;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
const loopCharacteristics = this.loopCharacteristics;
|
|
68
|
-
if (loopCharacteristics &&
|
|
69
|
-
this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[kMessageHandlers].onApiRootMessage, {
|
|
70
|
-
noAck: true,
|
|
71
|
-
consumerTag: `_api-${executionId}`,
|
|
72
|
-
priority: 200,
|
|
73
|
-
});
|
|
74
|
-
|
|
67
|
+
if (loopCharacteristics && isRootScope) {
|
|
75
68
|
return loopCharacteristics.execute(executeMessage);
|
|
76
69
|
}
|
|
77
70
|
|
|
@@ -79,22 +72,6 @@ SubProcessBehaviour.prototype.execute = function execute(executeMessage) {
|
|
|
79
72
|
return processExecution.execute(executeMessage);
|
|
80
73
|
};
|
|
81
74
|
|
|
82
|
-
SubProcessBehaviour.prototype.stop = function stop() {
|
|
83
|
-
for (const execution of this[kExecutions]) {
|
|
84
|
-
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
85
|
-
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
86
|
-
execution.stop();
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
SubProcessBehaviour.prototype.discard = function discard() {
|
|
91
|
-
for (const execution of this[kExecutions]) {
|
|
92
|
-
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
93
|
-
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
94
|
-
execution.discard();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
75
|
SubProcessBehaviour.prototype.getState = function getState() {
|
|
99
76
|
if (this.loopCharacteristics) {
|
|
100
77
|
return {
|
|
@@ -148,28 +125,13 @@ SubProcessBehaviour.prototype.getPostponed = function getPostponed() {
|
|
|
148
125
|
}, []);
|
|
149
126
|
};
|
|
150
127
|
|
|
151
|
-
SubProcessBehaviour.prototype._onApiRootMessage = function onApiRootMessage(_, message) {
|
|
152
|
-
const messageType = message.properties.type;
|
|
153
|
-
|
|
154
|
-
switch (messageType) {
|
|
155
|
-
case 'stop':
|
|
156
|
-
this.broker.cancel(message.fields.consumerTag);
|
|
157
|
-
this.stop();
|
|
158
|
-
break;
|
|
159
|
-
case 'discard':
|
|
160
|
-
this.broker.cancel(message.fields.consumerTag);
|
|
161
|
-
this.discard();
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
128
|
SubProcessBehaviour.prototype._upsertExecution = function upsertExecution(executeMessage) {
|
|
167
129
|
const content = executeMessage.content;
|
|
168
130
|
const executionId = content.executionId;
|
|
169
131
|
|
|
170
132
|
let execution = this._getExecutionById(executionId);
|
|
171
133
|
if (execution) {
|
|
172
|
-
if (executeMessage.fields.redelivered) this._addListeners(
|
|
134
|
+
if (executeMessage.fields.redelivered) this._addListeners(executionId);
|
|
173
135
|
return execution;
|
|
174
136
|
}
|
|
175
137
|
|
|
@@ -179,12 +141,12 @@ SubProcessBehaviour.prototype._upsertExecution = function upsertExecution(execut
|
|
|
179
141
|
execution = new ProcessExecution(this.activity, subContext);
|
|
180
142
|
this[kExecutions].push(execution);
|
|
181
143
|
|
|
182
|
-
this._addListeners(
|
|
144
|
+
this._addListeners(executionId);
|
|
183
145
|
|
|
184
146
|
return execution;
|
|
185
147
|
};
|
|
186
148
|
|
|
187
|
-
SubProcessBehaviour.prototype._addListeners = function addListeners(
|
|
149
|
+
SubProcessBehaviour.prototype._addListeners = function addListeners(executionId) {
|
|
188
150
|
this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[kMessageHandlers].onExecutionCompleted, {
|
|
189
151
|
noAck: true,
|
|
190
152
|
consumerTag: `_sub-process-execution-${executionId}`,
|
|
@@ -200,38 +162,42 @@ SubProcessBehaviour.prototype._onExecutionCompleted = function onExecutionComple
|
|
|
200
162
|
|
|
201
163
|
switch (messageType) {
|
|
202
164
|
case 'stopped': {
|
|
203
|
-
broker.cancel(message.fields.consumerTag);
|
|
204
|
-
break;
|
|
165
|
+
return broker.cancel(message.fields.consumerTag);
|
|
205
166
|
}
|
|
167
|
+
case 'completed':
|
|
206
168
|
case 'cancel':
|
|
207
169
|
case 'discard': {
|
|
208
170
|
broker.cancel(message.fields.consumerTag);
|
|
209
|
-
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case 'completed': {
|
|
213
|
-
broker.cancel(message.fields.consumerTag);
|
|
214
|
-
broker.publish('execution', 'execute.completed', cloneContent(content));
|
|
215
|
-
break;
|
|
171
|
+
return this._completeExecution('execute.' + messageType, content);
|
|
216
172
|
}
|
|
217
173
|
case 'error': {
|
|
218
174
|
broker.cancel(message.fields.consumerTag);
|
|
219
175
|
|
|
220
176
|
const {error} = content;
|
|
221
177
|
this.activity.logger.error(`<${this.id}>`, error);
|
|
222
|
-
|
|
223
|
-
|
|
178
|
+
|
|
179
|
+
return this._completeExecution('execute.error', content);
|
|
224
180
|
}
|
|
225
181
|
}
|
|
226
182
|
};
|
|
227
183
|
|
|
184
|
+
SubProcessBehaviour.prototype._completeExecution = function completeExecution(completeRoutingKey, content) {
|
|
185
|
+
if (this.loopCharacteristics) {
|
|
186
|
+
const executions = this[kExecutions];
|
|
187
|
+
const executionIdx = executions.findIndex((pe) => pe.executionId === content.executionId);
|
|
188
|
+
if (executionIdx < 0) return;
|
|
189
|
+
executions.splice(executionIdx, 1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
this.broker.publish('execution', completeRoutingKey, cloneContent(content));
|
|
193
|
+
};
|
|
194
|
+
|
|
228
195
|
SubProcessBehaviour.prototype.getApi = function getApi(apiMessage) {
|
|
229
196
|
const content = apiMessage.content;
|
|
230
197
|
|
|
231
198
|
if (content.id === this.id) return;
|
|
232
199
|
|
|
233
200
|
let execution;
|
|
234
|
-
|
|
235
201
|
if ((execution = this._getExecutionById(content.parent.executionId))) {
|
|
236
202
|
return execution.getApi(apiMessage);
|
|
237
203
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './CallActivity.js';
|
|
2
|
+
export * from './ReceiveTask.js';
|
|
3
|
+
export * from './ScriptTask.js';
|
|
4
|
+
export * from './ServiceTask.js';
|
|
5
|
+
export * from './SignalTask.js';
|
|
6
|
+
export * from './SubProcess.js';
|
|
7
|
+
export * from './Task.js';
|
|
8
|
+
export * from './Transaction.js';
|
package/tasks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './types/index.js';
|