bpmn-elements 7.0.0 → 8.1.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 +23 -0
- package/dist/src/Context.js +50 -40
- package/dist/src/Environment.js +39 -19
- package/dist/src/MessageFormatter.js +11 -11
- package/dist/src/activity/Activity.js +106 -106
- package/dist/src/activity/ActivityExecution.js +37 -37
- package/dist/src/activity/Message.js +2 -2
- package/dist/src/activity/Signal.js +2 -2
- package/dist/src/definition/Definition.js +50 -50
- package/dist/src/definition/DefinitionExecution.js +114 -125
- package/dist/src/eventDefinitions/CancelEventDefinition.js +16 -16
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +24 -24
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +26 -26
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +20 -20
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +14 -14
- package/dist/src/eventDefinitions/LinkEventDefinition.js +15 -15
- package/dist/src/eventDefinitions/MessageEventDefinition.js +23 -23
- package/dist/src/eventDefinitions/SignalEventDefinition.js +24 -24
- package/dist/src/eventDefinitions/TimerEventDefinition.js +76 -53
- package/dist/src/events/BoundaryEvent.js +67 -38
- package/dist/src/events/EndEvent.js +3 -3
- package/dist/src/events/IntermediateCatchEvent.js +3 -3
- package/dist/src/events/IntermediateThrowEvent.js +3 -3
- package/dist/src/events/StartEvent.js +9 -9
- package/dist/src/flows/Association.js +7 -7
- package/dist/src/flows/MessageFlow.js +9 -9
- package/dist/src/flows/SequenceFlow.js +7 -7
- package/dist/src/gateways/EventBasedGateway.js +11 -11
- package/dist/src/io/InputOutputSpecification.js +4 -4
- package/dist/src/io/Properties.js +9 -9
- package/dist/src/process/Process.js +64 -61
- package/dist/src/process/ProcessExecution.js +93 -90
- package/dist/src/tasks/ReceiveTask.js +16 -16
- package/dist/src/tasks/SubProcess.js +16 -18
- package/package.json +15 -16
- package/src/Context.js +48 -40
- package/src/Environment.js +48 -20
- package/src/EventBroker.js +1 -1
- package/src/MessageFormatter.js +11 -11
- package/src/activity/Activity.js +99 -100
- package/src/activity/ActivityExecution.js +35 -35
- package/src/activity/Message.js +1 -1
- package/src/activity/Signal.js +1 -1
- package/src/definition/Definition.js +51 -50
- package/src/definition/DefinitionExecution.js +111 -113
- package/src/eventDefinitions/CancelEventDefinition.js +16 -16
- package/src/eventDefinitions/CompensateEventDefinition.js +25 -24
- package/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
- package/src/eventDefinitions/ErrorEventDefinition.js +26 -26
- package/src/eventDefinitions/EscalationEventDefinition.js +20 -20
- package/src/eventDefinitions/EventDefinitionExecution.js +14 -14
- package/src/eventDefinitions/LinkEventDefinition.js +15 -15
- package/src/eventDefinitions/MessageEventDefinition.js +23 -23
- package/src/eventDefinitions/SignalEventDefinition.js +24 -24
- package/src/eventDefinitions/TimerEventDefinition.js +61 -44
- package/src/events/BoundaryEvent.js +53 -36
- 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 +9 -9
- package/src/flows/Association.js +7 -7
- package/src/flows/MessageFlow.js +9 -9
- package/src/flows/SequenceFlow.js +7 -7
- package/src/gateways/EventBasedGateway.js +11 -11
- package/src/io/BpmnIO.js +5 -1
- package/src/io/InputOutputSpecification.js +4 -4
- package/src/io/Properties.js +9 -9
- package/src/process/Process.js +62 -58
- package/src/process/ProcessExecution.js +86 -88
- package/src/tasks/ReceiveTask.js +16 -16
- package/src/tasks/SubProcess.js +16 -16
package/src/tasks/SubProcess.js
CHANGED
|
@@ -2,8 +2,8 @@ import Activity from '../activity/Activity';
|
|
|
2
2
|
import ProcessExecution from '../process/ProcessExecution';
|
|
3
3
|
import {cloneContent} from '../messageHelper';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const kExecutions = Symbol.for('executions');
|
|
6
|
+
const kMessageHandlers = Symbol.for('messageHandlers');
|
|
7
7
|
|
|
8
8
|
export default function SubProcess(activityDef, context) {
|
|
9
9
|
const triggeredByEvent = activityDef.behaviour && activityDef.behaviour.triggeredByEvent;
|
|
@@ -37,8 +37,8 @@ export function SubProcessBehaviour(activity, context) {
|
|
|
37
37
|
this.broker = activity.broker;
|
|
38
38
|
this.executionId = undefined;
|
|
39
39
|
|
|
40
|
-
this[
|
|
41
|
-
this[
|
|
40
|
+
this[kExecutions] = [];
|
|
41
|
+
this[kMessageHandlers] = {
|
|
42
42
|
onApiRootMessage: this._onApiRootMessage.bind(this),
|
|
43
43
|
onExecutionCompleted: this._onExecutionCompleted.bind(this),
|
|
44
44
|
};
|
|
@@ -48,13 +48,13 @@ const proto = SubProcessBehaviour.prototype;
|
|
|
48
48
|
|
|
49
49
|
Object.defineProperty(proto, 'execution', {
|
|
50
50
|
get() {
|
|
51
|
-
return this[
|
|
51
|
+
return this[kExecutions][0];
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
Object.defineProperty(proto, 'executions', {
|
|
56
56
|
get() {
|
|
57
|
-
return this[
|
|
57
|
+
return this[kExecutions].slice();
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -68,7 +68,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
68
68
|
|
|
69
69
|
const loopCharacteristics = this.loopCharacteristics;
|
|
70
70
|
if (loopCharacteristics && content.isRootScope) {
|
|
71
|
-
this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[
|
|
71
|
+
this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[kMessageHandlers].onApiRootMessage, {
|
|
72
72
|
noAck: true,
|
|
73
73
|
consumerTag: `_api-${executionId}`,
|
|
74
74
|
priority: 200,
|
|
@@ -84,7 +84,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
proto.stop = function stop() {
|
|
87
|
-
for (const execution of this[
|
|
87
|
+
for (const execution of this[kExecutions]) {
|
|
88
88
|
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
89
89
|
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
90
90
|
execution.stop();
|
|
@@ -92,7 +92,7 @@ proto.stop = function stop() {
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
proto.discard = function discard() {
|
|
95
|
-
for (const execution of this[
|
|
95
|
+
for (const execution of this[kExecutions]) {
|
|
96
96
|
this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
|
|
97
97
|
this.broker.cancel(`_sub-process-api-${execution.executionId}`);
|
|
98
98
|
execution.discard();
|
|
@@ -102,7 +102,7 @@ proto.discard = function discard() {
|
|
|
102
102
|
proto.getState = function getState() {
|
|
103
103
|
if (this.loopCharacteristics) {
|
|
104
104
|
return {
|
|
105
|
-
executions: this[
|
|
105
|
+
executions: this[kExecutions].map((pe) => {
|
|
106
106
|
const state = pe.getState();
|
|
107
107
|
state.environment = pe.environment.getState();
|
|
108
108
|
return state;
|
|
@@ -121,7 +121,7 @@ proto.getState = function getState() {
|
|
|
121
121
|
proto.recover = function recover(state) {
|
|
122
122
|
if (!state) return;
|
|
123
123
|
|
|
124
|
-
const executions = this[
|
|
124
|
+
const executions = this[kExecutions];
|
|
125
125
|
|
|
126
126
|
const loopCharacteristics = this.loopCharacteristics;
|
|
127
127
|
if (loopCharacteristics && state.executions) {
|
|
@@ -146,7 +146,7 @@ proto.recover = function recover(state) {
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
proto.getPostponed = function getPostponed() {
|
|
149
|
-
return this[
|
|
149
|
+
return this[kExecutions].reduce((result, pe) => {
|
|
150
150
|
result = result.concat(pe.getPostponed());
|
|
151
151
|
return result;
|
|
152
152
|
}, []);
|
|
@@ -177,11 +177,11 @@ proto._upsertExecution = function upsertExecution(executeMessage) {
|
|
|
177
177
|
return execution;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
const subEnvironment = this.environment.clone(
|
|
180
|
+
const subEnvironment = this.environment.clone();
|
|
181
181
|
const subContext = this.context.clone(subEnvironment);
|
|
182
182
|
|
|
183
183
|
execution = new ProcessExecution(this.activity, subContext);
|
|
184
|
-
this[
|
|
184
|
+
this[kExecutions].push(execution);
|
|
185
185
|
|
|
186
186
|
this._addListeners(execution, executionId);
|
|
187
187
|
|
|
@@ -189,7 +189,7 @@ proto._upsertExecution = function upsertExecution(executeMessage) {
|
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
proto._addListeners = function addListeners(processExecution, executionId) {
|
|
192
|
-
this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[
|
|
192
|
+
this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[kMessageHandlers].onExecutionCompleted, {
|
|
193
193
|
noAck: true,
|
|
194
194
|
consumerTag: `_sub-process-execution-${executionId}`,
|
|
195
195
|
});
|
|
@@ -245,5 +245,5 @@ proto.getApi = function getApi(apiMessage) {
|
|
|
245
245
|
};
|
|
246
246
|
|
|
247
247
|
proto._getExecutionById = function getExecutionById(executionId) {
|
|
248
|
-
return this[
|
|
248
|
+
return this[kExecutions].find((pe) => pe.executionId === executionId);
|
|
249
249
|
};
|