bpmn-elements 6.0.1 → 8.0.1
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 +341 -0
- package/README.md +3 -0
- package/dist/index.js +52 -44
- package/dist/src/Api.js +77 -76
- package/dist/src/Context.js +176 -172
- package/dist/src/Environment.js +110 -102
- package/dist/src/EventBroker.js +89 -88
- package/dist/src/ExtensionsMapper.js +2 -2
- package/dist/src/MessageFormatter.js +164 -95
- package/dist/src/Scripts.js +6 -2
- package/dist/src/activity/Activity.js +1105 -916
- package/dist/src/activity/ActivityExecution.js +342 -297
- package/dist/src/activity/Dummy.js +3 -3
- package/dist/src/definition/Definition.js +498 -444
- package/dist/src/definition/DefinitionExecution.js +710 -408
- package/dist/src/error/Errors.js +17 -7
- package/dist/src/eventDefinitions/CancelEventDefinition.js +190 -150
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +194 -161
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +197 -135
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +207 -165
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +175 -141
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +157 -129
- package/dist/src/eventDefinitions/LinkEventDefinition.js +174 -149
- package/dist/src/eventDefinitions/MessageEventDefinition.js +213 -176
- package/dist/src/eventDefinitions/SignalEventDefinition.js +203 -161
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +21 -23
- package/dist/src/eventDefinitions/TimerEventDefinition.js +243 -228
- package/dist/src/events/BoundaryEvent.js +180 -144
- package/dist/src/events/EndEvent.js +18 -23
- package/dist/src/events/IntermediateCatchEvent.js +44 -58
- package/dist/src/events/IntermediateThrowEvent.js +18 -23
- package/dist/src/events/StartEvent.js +109 -94
- package/dist/src/flows/Association.js +94 -100
- package/dist/src/flows/MessageFlow.js +86 -103
- package/dist/src/flows/SequenceFlow.js +173 -182
- package/dist/src/gateways/EventBasedGateway.js +88 -84
- package/dist/src/gateways/ExclusiveGateway.js +13 -16
- package/dist/src/gateways/InclusiveGateway.js +11 -14
- package/dist/src/gateways/ParallelGateway.js +11 -14
- package/dist/src/getPropertyValue.js +34 -34
- package/dist/src/io/BpmnIO.js +17 -14
- package/dist/src/io/EnvironmentDataObject.js +33 -29
- package/dist/src/io/EnvironmentDataStore.js +33 -29
- package/dist/src/io/EnvironmentDataStoreReference.js +35 -31
- package/dist/src/io/InputOutputSpecification.js +177 -168
- package/dist/src/io/Properties.js +117 -124
- package/dist/src/messageHelper.js +1 -1
- package/dist/src/process/Process.js +439 -362
- package/dist/src/process/ProcessExecution.js +748 -646
- package/dist/src/shared.js +2 -2
- package/dist/src/tasks/CallActivity.js +160 -0
- package/dist/src/tasks/LoopCharacteristics.js +309 -330
- package/dist/src/tasks/ReceiveTask.js +233 -182
- package/dist/src/tasks/ScriptTask.js +35 -41
- package/dist/src/tasks/ServiceImplementation.js +13 -20
- package/dist/src/tasks/ServiceTask.js +82 -75
- package/dist/src/tasks/SignalTask.js +97 -93
- package/dist/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/dist/src/tasks/SubProcess.js +193 -175
- package/dist/src/tasks/Task.js +17 -19
- package/index.js +2 -0
- package/package.json +16 -16
- package/src/Api.js +65 -59
- package/src/Context.js +145 -140
- package/src/Environment.js +116 -100
- package/src/EventBroker.js +67 -68
- package/src/ExtensionsMapper.js +2 -2
- package/src/MessageFormatter.js +132 -74
- package/src/activity/Activity.js +914 -776
- package/src/activity/ActivityExecution.js +293 -247
- package/src/activity/Dummy.js +2 -2
- package/src/definition/Definition.js +437 -401
- package/src/definition/DefinitionExecution.js +598 -340
- package/src/error/Errors.js +11 -6
- package/src/eventDefinitions/CancelEventDefinition.js +164 -121
- package/src/eventDefinitions/CompensateEventDefinition.js +159 -124
- package/src/eventDefinitions/ConditionalEventDefinition.js +147 -104
- package/src/eventDefinitions/ErrorEventDefinition.js +190 -131
- package/src/eventDefinitions/EscalationEventDefinition.js +139 -101
- package/src/eventDefinitions/EventDefinitionExecution.js +127 -95
- package/src/eventDefinitions/LinkEventDefinition.js +160 -129
- package/src/eventDefinitions/MessageEventDefinition.js +178 -121
- package/src/eventDefinitions/SignalEventDefinition.js +162 -106
- package/src/eventDefinitions/TerminateEventDefinition.js +19 -19
- package/src/eventDefinitions/TimerEventDefinition.js +202 -167
- package/src/events/BoundaryEvent.js +156 -115
- package/src/events/EndEvent.js +15 -18
- package/src/events/IntermediateCatchEvent.js +40 -44
- package/src/events/IntermediateThrowEvent.js +15 -18
- package/src/events/StartEvent.js +84 -50
- package/src/flows/Association.js +98 -112
- package/src/flows/MessageFlow.js +81 -97
- package/src/flows/SequenceFlow.js +146 -160
- package/src/gateways/EventBasedGateway.js +75 -68
- package/src/gateways/ExclusiveGateway.js +8 -13
- package/src/gateways/InclusiveGateway.js +8 -13
- package/src/gateways/ParallelGateway.js +8 -13
- package/src/getPropertyValue.js +34 -33
- package/src/io/BpmnIO.js +20 -15
- package/src/io/EnvironmentDataObject.js +29 -18
- package/src/io/EnvironmentDataStore.js +29 -18
- package/src/io/EnvironmentDataStoreReference.js +31 -20
- package/src/io/InputOutputSpecification.js +154 -157
- package/src/io/Properties.js +95 -97
- package/src/process/Process.js +378 -333
- package/src/process/ProcessExecution.js +603 -553
- package/src/tasks/CallActivity.js +130 -0
- package/src/tasks/LoopCharacteristics.js +290 -289
- package/src/tasks/ReceiveTask.js +174 -107
- package/src/tasks/ScriptTask.js +27 -30
- package/src/tasks/ServiceImplementation.js +13 -18
- package/src/tasks/ServiceTask.js +67 -60
- package/src/tasks/SignalTask.js +77 -52
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +184 -157
- package/src/tasks/Task.js +15 -19
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = SubProcess;
|
|
7
6
|
exports.SubProcessBehaviour = SubProcessBehaviour;
|
|
7
|
+
exports.default = SubProcess;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
@@ -14,9 +14,12 @@ var _messageHelper = require("../messageHelper");
|
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
|
|
17
|
+
const kExecutions = Symbol.for('executions');
|
|
18
|
+
const kMessageHandlers = Symbol.for('messageHandlers');
|
|
19
|
+
|
|
17
20
|
function SubProcess(activityDef, context) {
|
|
18
21
|
const triggeredByEvent = activityDef.behaviour && activityDef.behaviour.triggeredByEvent;
|
|
19
|
-
const subProcess =
|
|
22
|
+
const subProcess = new _Activity.default(SubProcessBehaviour, { ...activityDef,
|
|
20
23
|
isSubProcess: true,
|
|
21
24
|
triggeredByEvent
|
|
22
25
|
}, context);
|
|
@@ -37,7 +40,7 @@ function SubProcess(activityDef, context) {
|
|
|
37
40
|
startId
|
|
38
41
|
} = message.content;
|
|
39
42
|
const last = message.content.sequence.pop();
|
|
40
|
-
const sequence =
|
|
43
|
+
const sequence = new _ProcessExecution.default(subProcess, context).shake(startId);
|
|
41
44
|
message.content.sequence.push({ ...last,
|
|
42
45
|
isSubProcess: true,
|
|
43
46
|
sequence
|
|
@@ -49,214 +52,229 @@ function SubProcessBehaviour(activity, context) {
|
|
|
49
52
|
const {
|
|
50
53
|
id,
|
|
51
54
|
type,
|
|
52
|
-
|
|
53
|
-
behaviour,
|
|
54
|
-
environment,
|
|
55
|
-
logger
|
|
55
|
+
behaviour
|
|
56
56
|
} = activity;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
57
|
+
this.id = id;
|
|
58
|
+
this.type = type;
|
|
59
|
+
this.loopCharacteristics = behaviour.loopCharacteristics && new behaviour.loopCharacteristics.Behaviour(activity, behaviour.loopCharacteristics);
|
|
60
|
+
this.activity = activity;
|
|
61
|
+
this.context = context;
|
|
62
|
+
this.environment = activity.environment;
|
|
63
|
+
this.broker = activity.broker;
|
|
64
|
+
this.executionId = undefined;
|
|
65
|
+
this[kExecutions] = [];
|
|
66
|
+
this[kMessageHandlers] = {
|
|
67
|
+
onApiRootMessage: this._onApiRootMessage.bind(this),
|
|
68
|
+
onExecutionCompleted: this._onExecutionCompleted.bind(this)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const proto = SubProcessBehaviour.prototype;
|
|
73
|
+
Object.defineProperty(proto, 'execution', {
|
|
74
|
+
get() {
|
|
75
|
+
return this[kExecutions][0];
|
|
76
|
+
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(proto, 'executions', {
|
|
80
|
+
get() {
|
|
81
|
+
return this[kExecutions].slice();
|
|
82
|
+
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
return source;
|
|
84
|
+
});
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
proto.execute = function execute(executeMessage) {
|
|
87
|
+
const content = executeMessage.content;
|
|
88
|
+
let executionId = this.executionId;
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
if (content.isRootScope) {
|
|
91
|
+
executionId = this.executionId = content.executionId;
|
|
92
|
+
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
broker.subscribeTmp('api', `activity.#.${rootExecutionId}`, onApiRootMessage, {
|
|
97
|
-
noAck: true,
|
|
98
|
-
consumerTag: `_api-${rootExecutionId}`,
|
|
99
|
-
priority: 200
|
|
100
|
-
});
|
|
101
|
-
return loopCharacteristics.execute(executeMessage);
|
|
102
|
-
}
|
|
94
|
+
const loopCharacteristics = this.loopCharacteristics;
|
|
103
95
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
if (loopCharacteristics && content.isRootScope) {
|
|
97
|
+
this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[kMessageHandlers].onApiRootMessage, {
|
|
98
|
+
noAck: true,
|
|
99
|
+
consumerTag: `_api-${executionId}`,
|
|
100
|
+
priority: 200
|
|
101
|
+
});
|
|
102
|
+
return loopCharacteristics.execute(executeMessage);
|
|
103
|
+
}
|
|
107
104
|
|
|
108
|
-
|
|
109
|
-
const messageType = message.properties.type;
|
|
105
|
+
const processExecution = this._upsertExecution(executeMessage);
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
stop();
|
|
115
|
-
break;
|
|
107
|
+
if (!processExecution) return;
|
|
108
|
+
return processExecution.execute(executeMessage);
|
|
109
|
+
};
|
|
116
110
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
111
|
+
proto.stop = function stop() {
|
|
112
|
+
for (const execution of this[kExecutions]) {
|
|
113
|
+
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
114
|
+
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
115
|
+
execution.stop();
|
|
123
116
|
}
|
|
117
|
+
};
|
|
124
118
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
119
|
+
proto.discard = function discard() {
|
|
120
|
+
for (const execution of this[kExecutions]) {
|
|
121
|
+
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
122
|
+
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
123
|
+
execution.discard();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
proto.getState = function getState() {
|
|
128
|
+
if (this.loopCharacteristics) {
|
|
129
|
+
return {
|
|
130
|
+
executions: this[kExecutions].map(pe => {
|
|
131
|
+
const state = pe.getState();
|
|
132
|
+
state.environment = pe.environment.getState();
|
|
133
|
+
return state;
|
|
134
|
+
})
|
|
135
|
+
};
|
|
131
136
|
}
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const execution = this.execution;
|
|
139
|
+
|
|
140
|
+
if (execution) {
|
|
141
|
+
const state = execution.getState();
|
|
142
|
+
state.environment = execution.environment.getState();
|
|
143
|
+
return state;
|
|
139
144
|
}
|
|
145
|
+
};
|
|
140
146
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
+
proto.recover = function recover(state) {
|
|
148
|
+
if (!state) return;
|
|
149
|
+
const executions = this[kExecutions];
|
|
150
|
+
const loopCharacteristics = this.loopCharacteristics;
|
|
147
151
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
152
|
+
if (loopCharacteristics && state.executions) {
|
|
153
|
+
executions.splice(0);
|
|
151
154
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
state.environment = pe.environment.getState();
|
|
155
|
-
return state;
|
|
155
|
+
for (const se of state.executions) {
|
|
156
|
+
this.recover(se);
|
|
156
157
|
}
|
|
157
|
-
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} else if (!loopCharacteristics) {
|
|
166
|
-
processExecutions.splice(0);
|
|
167
|
-
}
|
|
162
|
+
if (!loopCharacteristics) {
|
|
163
|
+
executions.splice(0);
|
|
164
|
+
}
|
|
168
165
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
const subEnvironment = this.environment.clone().recover(state.environment);
|
|
167
|
+
const subContext = this.context.clone(subEnvironment);
|
|
168
|
+
const execution = new _ProcessExecution.default(this.activity, subContext).recover(state);
|
|
169
|
+
executions.push(execution);
|
|
170
|
+
return execution;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
proto.getPostponed = function getPostponed() {
|
|
174
|
+
return this[kExecutions].reduce((result, pe) => {
|
|
175
|
+
result = result.concat(pe.getPostponed());
|
|
176
|
+
return result;
|
|
177
|
+
}, []);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
proto._onApiRootMessage = function onApiRootMessage(_, message) {
|
|
181
|
+
const messageType = message.properties.type;
|
|
182
|
+
|
|
183
|
+
switch (messageType) {
|
|
184
|
+
case 'stop':
|
|
185
|
+
this.broker.cancel(message.fields.consumerTag);
|
|
186
|
+
this.stop();
|
|
187
|
+
break;
|
|
188
|
+
|
|
189
|
+
case 'discard':
|
|
190
|
+
this.broker.cancel(message.fields.consumerTag);
|
|
191
|
+
this.discard();
|
|
192
|
+
break;
|
|
174
193
|
}
|
|
194
|
+
};
|
|
175
195
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
let execution = getExecutionById(executionId);
|
|
196
|
+
proto._upsertExecution = function upsertExecution(executeMessage) {
|
|
197
|
+
const content = executeMessage.content;
|
|
198
|
+
const executionId = content.executionId;
|
|
180
199
|
|
|
181
|
-
|
|
182
|
-
if (executeMessage.fields.redelivered) addListeners(execution, executionId);
|
|
183
|
-
return execution;
|
|
184
|
-
}
|
|
200
|
+
let execution = this._getExecutionById(executionId);
|
|
185
201
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
});
|
|
189
|
-
const subContext = context.clone(subEnvironment);
|
|
190
|
-
execution = (0, _ProcessExecution.default)(activity, subContext);
|
|
191
|
-
processExecutions.push(execution);
|
|
192
|
-
addListeners(execution, executionId);
|
|
202
|
+
if (execution) {
|
|
203
|
+
if (executeMessage.fields.redelivered) this._addListeners(execution, executionId);
|
|
193
204
|
return execution;
|
|
194
205
|
}
|
|
195
206
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
207
|
+
const subEnvironment = this.environment.clone();
|
|
208
|
+
const subContext = this.context.clone(subEnvironment);
|
|
209
|
+
execution = new _ProcessExecution.default(this.activity, subContext);
|
|
210
|
+
this[kExecutions].push(execution);
|
|
211
|
+
|
|
212
|
+
this._addListeners(execution, executionId);
|
|
213
|
+
|
|
214
|
+
return execution;
|
|
215
|
+
};
|
|
202
216
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
case 'completed':
|
|
223
|
-
{
|
|
224
|
-
broker.cancel(executionConsumerTag);
|
|
225
|
-
broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content));
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
case 'error':
|
|
230
|
-
{
|
|
231
|
-
broker.cancel(executionConsumerTag);
|
|
232
|
-
const {
|
|
233
|
-
error
|
|
234
|
-
} = content;
|
|
235
|
-
logger.error(`<${id}>`, error);
|
|
236
|
-
broker.publish('execution', 'execute.error', (0, _messageHelper.cloneContent)(content));
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
217
|
+
proto._addListeners = function addListeners(processExecution, executionId) {
|
|
218
|
+
this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[kMessageHandlers].onExecutionCompleted, {
|
|
219
|
+
noAck: true,
|
|
220
|
+
consumerTag: `_sub-process-execution-${executionId}`
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
proto._onExecutionCompleted = function onExecutionCompleted(_, message) {
|
|
225
|
+
if (message.fields.redelivered && message.properties.persistent === false) return;
|
|
226
|
+
const content = message.content;
|
|
227
|
+
const messageType = message.properties.type;
|
|
228
|
+
const broker = this.broker;
|
|
229
|
+
|
|
230
|
+
switch (messageType) {
|
|
231
|
+
case 'stopped':
|
|
232
|
+
{
|
|
233
|
+
broker.cancel(message.fields.consumerTag);
|
|
234
|
+
break;
|
|
239
235
|
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
236
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
case 'discard':
|
|
238
|
+
{
|
|
239
|
+
broker.cancel(message.fields.consumerTag);
|
|
240
|
+
broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(content));
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
247
243
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
case 'completed':
|
|
245
|
+
{
|
|
246
|
+
broker.cancel(message.fields.consumerTag);
|
|
247
|
+
broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content));
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
case 'error':
|
|
252
|
+
{
|
|
253
|
+
broker.cancel(message.fields.consumerTag);
|
|
254
|
+
const {
|
|
255
|
+
error
|
|
256
|
+
} = content;
|
|
257
|
+
this.activity.logger.error(`<${this.id}>`, error);
|
|
258
|
+
broker.publish('execution', 'execute.error', (0, _messageHelper.cloneContent)(content));
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
251
263
|
|
|
252
|
-
|
|
264
|
+
proto.getApi = function getApi(apiMessage) {
|
|
265
|
+
const content = apiMessage.content;
|
|
266
|
+
if (content.id === this.id) return;
|
|
267
|
+
let execution;
|
|
253
268
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
269
|
+
if (execution = this._getExecutionById(content.parent.executionId)) {
|
|
270
|
+
return execution.getApi(apiMessage);
|
|
257
271
|
}
|
|
258
272
|
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
for (const pp of content.parent.path) {
|
|
274
|
+
if (execution = this._getExecutionById(pp.executionId)) return execution.getApi(apiMessage);
|
|
261
275
|
}
|
|
262
|
-
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
proto._getExecutionById = function getExecutionById(executionId) {
|
|
279
|
+
return this[kExecutions].find(pe => pe.executionId === executionId);
|
|
280
|
+
};
|
package/dist/src/tasks/Task.js
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = Task;
|
|
7
6
|
exports.TaskBehaviour = TaskBehaviour;
|
|
7
|
+
exports.default = Task;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
11
|
+
var _messageHelper = require("../messageHelper");
|
|
12
|
+
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
|
|
13
15
|
function Task(activityDef, context) {
|
|
14
|
-
return
|
|
16
|
+
return new _Activity.default(TaskBehaviour, activityDef, context);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
function TaskBehaviour(activity) {
|
|
@@ -21,23 +23,19 @@ function TaskBehaviour(activity) {
|
|
|
21
23
|
behaviour,
|
|
22
24
|
broker
|
|
23
25
|
} = activity;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
execute
|
|
30
|
-
};
|
|
31
|
-
return source;
|
|
32
|
-
|
|
33
|
-
function execute(executeMessage) {
|
|
34
|
-
const content = executeMessage.content;
|
|
26
|
+
this.id = id;
|
|
27
|
+
this.type = type;
|
|
28
|
+
this.loopCharacteristics = behaviour.loopCharacteristics && new behaviour.loopCharacteristics.Behaviour(activity, behaviour.loopCharacteristics);
|
|
29
|
+
this.broker = broker;
|
|
30
|
+
}
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
TaskBehaviour.prototype.execute = function execute(executeMessage) {
|
|
33
|
+
const executeContent = executeMessage.content;
|
|
34
|
+
const loopCharacteristics = this.loopCharacteristics;
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
if (loopCharacteristics && executeContent.isRootScope) {
|
|
37
|
+
return loopCharacteristics.execute(executeMessage);
|
|
42
38
|
}
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
41
|
+
};
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import Activity from './src/activity/Activity';
|
|
|
2
2
|
import Association from './src/flows/Association';
|
|
3
3
|
import BoundaryEvent from './src/events/BoundaryEvent';
|
|
4
4
|
import BpmnError from './src/error/BpmnError';
|
|
5
|
+
import CallActivity from './src/tasks/CallActivity';
|
|
5
6
|
import CancelEventDefinition from './src/eventDefinitions/CancelEventDefinition';
|
|
6
7
|
import CompensateEventDefinition from './src/eventDefinitions/CompensateEventDefinition';
|
|
7
8
|
import ConditionalEventDefinition from './src/eventDefinitions/ConditionalEventDefinition';
|
|
@@ -51,6 +52,7 @@ export {
|
|
|
51
52
|
Activity,
|
|
52
53
|
BoundaryEvent,
|
|
53
54
|
BpmnError,
|
|
55
|
+
CallActivity,
|
|
54
56
|
CancelEventDefinition,
|
|
55
57
|
CompensateEventDefinition,
|
|
56
58
|
ConditionalEventDefinition,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-elements",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Executable workflow elements based on BPMN 2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -46,26 +46,26 @@
|
|
|
46
46
|
"index.js"
|
|
47
47
|
],
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@aircall/expression-parser": "^1.0.
|
|
50
|
-
"@babel/cli": "^7.
|
|
51
|
-
"@babel/core": "^7.
|
|
52
|
-
"@babel/preset-env": "^7.
|
|
53
|
-
"@babel/register": "^7.
|
|
49
|
+
"@aircall/expression-parser": "^1.0.4",
|
|
50
|
+
"@babel/cli": "^7.17.10",
|
|
51
|
+
"@babel/core": "^7.18.5",
|
|
52
|
+
"@babel/preset-env": "^7.18.2",
|
|
53
|
+
"@babel/register": "^7.17.7",
|
|
54
54
|
"bpmn-moddle": "^7.1.2",
|
|
55
|
-
"camunda-bpmn-moddle": "^6.1.
|
|
56
|
-
"chai": "^4.
|
|
55
|
+
"camunda-bpmn-moddle": "^6.1.2",
|
|
56
|
+
"chai": "^4.3.6",
|
|
57
57
|
"chronokinesis": "^3.0.0",
|
|
58
|
-
"debug": "^4.3.
|
|
59
|
-
"eslint": "^7.
|
|
60
|
-
"got": "^11.8.
|
|
61
|
-
"mocha": "^9.
|
|
58
|
+
"debug": "^4.3.4",
|
|
59
|
+
"eslint": "^7.32.0",
|
|
60
|
+
"got": "^11.8.5",
|
|
61
|
+
"mocha": "^9.2.2",
|
|
62
62
|
"mocha-cakes-2": "^3.3.0",
|
|
63
|
-
"moddle-context-serializer": "^
|
|
64
|
-
"nock": "^13.
|
|
63
|
+
"moddle-context-serializer": "^2.1.0",
|
|
64
|
+
"nock": "^13.2.6",
|
|
65
65
|
"nyc": "^15.1.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"iso8601-duration": "^1.
|
|
69
|
-
"smqp": "^
|
|
68
|
+
"iso8601-duration": "^2.1.1",
|
|
69
|
+
"smqp": "^6.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|