bpmn-elements 8.2.4 → 9.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 +16 -0
- package/README.md +1 -1
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +5 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/Tracker.js +89 -0
- package/dist/{src/activity → activity}/Activity.js +109 -120
- package/dist/{src/activity → activity}/ActivityExecution.js +28 -32
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +64 -59
- package/dist/{src/definition → definition}/DefinitionExecution.js +68 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/eventDefinitions/CancelEventDefinition.js +127 -0
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +64 -52
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +24 -16
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +15 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +39 -25
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +14 -22
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +3 -4
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +44 -40
- package/dist/{src/process → process}/ProcessExecution.js +169 -78
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +19 -19
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +31 -31
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +2 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/Tracker.js +73 -0
- package/src/activity/Activity.js +106 -114
- package/src/activity/ActivityExecution.js +28 -32
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +65 -64
- package/src/definition/DefinitionExecution.js +71 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +32 -78
- package/src/eventDefinitions/CompensateEventDefinition.js +58 -52
- package/src/eventDefinitions/ConditionalEventDefinition.js +25 -17
- package/src/eventDefinitions/ErrorEventDefinition.js +15 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +34 -24
- 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 +8 -10
- package/src/flows/Association.js +14 -26
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +3 -4
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +45 -41
- package/src/process/ProcessExecution.js +167 -79
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +19 -20
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +520 -0
- package/dist/src/eventDefinitions/CancelEventDefinition.js +0 -184
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /package/dist/{src/shared.js → shared.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue';
|
|
2
|
-
import {brokerSafeId} from '../shared';
|
|
3
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
1
|
+
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
+
import {brokerSafeId} from '../shared.js';
|
|
3
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kCompleted = Symbol.for('completed');
|
|
6
6
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -36,20 +36,18 @@ export default function LinkEventDefinition(activity, eventDefinition) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(proto, 'executionId', {
|
|
39
|
+
Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
|
|
42
40
|
get() {
|
|
43
41
|
const message = this[kExecuteMessage];
|
|
44
42
|
return message && message.content.executionId;
|
|
45
43
|
},
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
LinkEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
49
47
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
LinkEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
53
51
|
this[kExecuteMessage] = executeMessage;
|
|
54
52
|
this[kCompleted] = false;
|
|
55
53
|
|
|
@@ -86,7 +84,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
86
84
|
broker.publish('event', 'activity.wait', waitContent);
|
|
87
85
|
};
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
LinkEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
90
88
|
const executeContent = executeMessage.content;
|
|
91
89
|
const {executionId, parent} = executeContent;
|
|
92
90
|
const parentExecutionId = parent && parent.executionId;
|
|
@@ -106,13 +104,13 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
106
104
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
|
|
107
105
|
};
|
|
108
106
|
|
|
109
|
-
|
|
107
|
+
LinkEventDefinition.prototype._onCatchLink = function onCatchLink(routingKey, message) {
|
|
110
108
|
if (getPropertyValue(message, 'content.message.linkName') !== this.reference.linkName) return;
|
|
111
109
|
if (message.content.state === 'discard') return this._discard();
|
|
112
110
|
return this._complete('caught', message.content.message);
|
|
113
111
|
};
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
LinkEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
116
114
|
const messageType = message.properties.type;
|
|
117
115
|
|
|
118
116
|
switch (messageType) {
|
|
@@ -126,7 +124,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
126
124
|
}
|
|
127
125
|
};
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
LinkEventDefinition.prototype._complete = function complete(verb, output) {
|
|
130
128
|
this[kCompleted] = true;
|
|
131
129
|
|
|
132
130
|
this._stop();
|
|
@@ -148,13 +146,13 @@ proto._complete = function complete(verb, output) {
|
|
|
148
146
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output, state: 'catch'}));
|
|
149
147
|
};
|
|
150
148
|
|
|
151
|
-
|
|
149
|
+
LinkEventDefinition.prototype._discard = function discard() {
|
|
152
150
|
this[kCompleted] = true;
|
|
153
151
|
this._stop();
|
|
154
152
|
return this.broker.publish('execution', 'execute.discard', cloneContent(this[kExecuteMessage].content));
|
|
155
153
|
};
|
|
156
154
|
|
|
157
|
-
|
|
155
|
+
LinkEventDefinition.prototype._stop = function stop() {
|
|
158
156
|
const broker = this.broker, executionId = this.executionId;
|
|
159
157
|
broker.cancel(`_api-link-${executionId}`);
|
|
160
158
|
broker.cancel(`_api-parent-${executionId}`);
|
|
@@ -162,13 +160,13 @@ proto._stop = function stop() {
|
|
|
162
160
|
this[kMessageQ].purge();
|
|
163
161
|
};
|
|
164
162
|
|
|
165
|
-
|
|
163
|
+
LinkEventDefinition.prototype._onDiscard = function onDiscard(_, message) {
|
|
166
164
|
this.broker.publish('event', 'activity.link.discard', cloneContent(message.content, {
|
|
167
165
|
message: {...this.reference},
|
|
168
166
|
state: 'discard',
|
|
169
167
|
}), {type: 'link', delegate: true});
|
|
170
168
|
};
|
|
171
169
|
|
|
172
|
-
|
|
170
|
+
LinkEventDefinition.prototype._debug = function debug(msg) {
|
|
173
171
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
174
172
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue';
|
|
2
|
-
import {brokerSafeId} from '../shared';
|
|
3
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
1
|
+
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
+
import {brokerSafeId} from '../shared.js';
|
|
3
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kCompleted = Symbol.for('completed');
|
|
6
6
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -36,20 +36,18 @@ export default function MessageEventDefinition(activity, eventDefinition) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(proto, 'executionId', {
|
|
39
|
+
Object.defineProperty(MessageEventDefinition.prototype, 'executionId', {
|
|
42
40
|
get() {
|
|
43
41
|
const message = this[kExecuteMessage];
|
|
44
42
|
return message && message.content.executionId;
|
|
45
43
|
},
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
MessageEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
49
47
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
MessageEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
53
51
|
this[kExecuteMessage] = executeMessage;
|
|
54
52
|
this[kCompleted] = false;
|
|
55
53
|
|
|
@@ -94,7 +92,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
94
92
|
broker.publish('event', 'activity.wait', waitContent);
|
|
95
93
|
};
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
MessageEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
98
96
|
const executeContent = executeMessage.content;
|
|
99
97
|
const {executionId, parent} = executeContent;
|
|
100
98
|
const info = this._getReferenceInfo(executeMessage);
|
|
@@ -114,7 +112,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
114
112
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
|
|
115
113
|
};
|
|
116
114
|
|
|
117
|
-
|
|
115
|
+
MessageEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
118
116
|
if (getPropertyValue(message, 'content.message.id') !== this[kReferenceInfo].message.id) return;
|
|
119
117
|
|
|
120
118
|
const {type, correlationId} = message.properties;
|
|
@@ -128,7 +126,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
128
126
|
this._complete('caught', message.content.message, {correlationId});
|
|
129
127
|
};
|
|
130
128
|
|
|
131
|
-
|
|
129
|
+
MessageEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
132
130
|
const {type, correlationId} = message.properties;
|
|
133
131
|
switch (type) {
|
|
134
132
|
case 'message':
|
|
@@ -146,7 +144,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
146
144
|
}
|
|
147
145
|
};
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
MessageEventDefinition.prototype._complete = function complete(verb, output, options) {
|
|
150
148
|
this[kCompleted] = true;
|
|
151
149
|
|
|
152
150
|
this._stop();
|
|
@@ -168,7 +166,7 @@ proto._complete = function complete(verb, output, options) {
|
|
|
168
166
|
}), options);
|
|
169
167
|
};
|
|
170
168
|
|
|
171
|
-
|
|
169
|
+
MessageEventDefinition.prototype._stop = function stop() {
|
|
172
170
|
const broker = this.broker, executionId = this.executionId;
|
|
173
171
|
broker.cancel(`_api-message-${executionId}`);
|
|
174
172
|
broker.cancel(`_api-${executionId}`);
|
|
@@ -177,7 +175,7 @@ proto._stop = function stop() {
|
|
|
177
175
|
this[kMessageQ].purge();
|
|
178
176
|
};
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+
MessageEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
181
179
|
const referenceElement = this[kReferenceElement];
|
|
182
180
|
if (!referenceElement) {
|
|
183
181
|
return {
|
|
@@ -195,6 +193,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
195
193
|
return result;
|
|
196
194
|
};
|
|
197
195
|
|
|
198
|
-
|
|
196
|
+
MessageEventDefinition.prototype._debug = function debug(msg) {
|
|
199
197
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
200
198
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue';
|
|
2
|
-
import {brokerSafeId} from '../shared';
|
|
3
|
-
import {cloneContent, shiftParent} from '../messageHelper';
|
|
1
|
+
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
+
import {brokerSafeId} from '../shared.js';
|
|
3
|
+
import {cloneContent, shiftParent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kCompleted = Symbol.for('completed');
|
|
6
6
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -36,20 +36,18 @@ export default function SignalEventDefinition(activity, eventDefinition) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(proto, 'executionId', {
|
|
39
|
+
Object.defineProperty(SignalEventDefinition.prototype, 'executionId', {
|
|
42
40
|
get() {
|
|
43
41
|
const message = this[kExecuteMessage];
|
|
44
42
|
return message && message.content.executionId;
|
|
45
43
|
},
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
SignalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
49
47
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
SignalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
53
51
|
this[kExecuteMessage] = executeMessage;
|
|
54
52
|
this[kCompleted] = false;
|
|
55
53
|
|
|
@@ -94,7 +92,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
94
92
|
broker.publish('event', 'activity.wait', waitContent);
|
|
95
93
|
};
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
SignalEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
98
96
|
const executeContent = executeMessage.content;
|
|
99
97
|
const {executionId, parent} = executeContent;
|
|
100
98
|
|
|
@@ -115,7 +113,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
115
113
|
return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
|
|
116
114
|
};
|
|
117
115
|
|
|
118
|
-
|
|
116
|
+
SignalEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
119
117
|
const info = this[kReferenceInfo];
|
|
120
118
|
if (getPropertyValue(message, 'content.message.id') !== info.message.id) return;
|
|
121
119
|
this[kCompleted] = true;
|
|
@@ -132,7 +130,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
132
130
|
return this._complete(message.content.message, message.properties);
|
|
133
131
|
};
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
SignalEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
136
134
|
const {type, correlationId} = message.properties;
|
|
137
135
|
|
|
138
136
|
switch (type) {
|
|
@@ -151,7 +149,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
151
149
|
}
|
|
152
150
|
};
|
|
153
151
|
|
|
154
|
-
|
|
152
|
+
SignalEventDefinition.prototype._complete = function complete(output, options) {
|
|
155
153
|
this[kCompleted] = true;
|
|
156
154
|
this._stop();
|
|
157
155
|
this._debug(`signaled with ${this[kReferenceInfo].description}`);
|
|
@@ -161,7 +159,7 @@ proto._complete = function complete(output, options) {
|
|
|
161
159
|
}), options);
|
|
162
160
|
};
|
|
163
161
|
|
|
164
|
-
|
|
162
|
+
SignalEventDefinition.prototype._stop = function stop() {
|
|
165
163
|
const broker = this.broker, executionId = this.executionId;
|
|
166
164
|
broker.cancel(`_api-signal-${executionId}`);
|
|
167
165
|
broker.cancel(`_api-parent-${executionId}`);
|
|
@@ -170,7 +168,7 @@ proto._stop = function stop() {
|
|
|
170
168
|
if (this.activity.isStart) this[kMessageQ].purge();
|
|
171
169
|
};
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
SignalEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
174
172
|
const referenceElement = this[kReferenceElement];
|
|
175
173
|
if (!referenceElement) {
|
|
176
174
|
return {
|
|
@@ -188,6 +186,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
188
186
|
return result;
|
|
189
187
|
};
|
|
190
188
|
|
|
191
|
-
|
|
189
|
+
SignalEventDefinition.prototype._debug = function debug(msg) {
|
|
192
190
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
193
191
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import {cloneContent} from '../messageHelper.js';
|
|
2
2
|
import {toSeconds, parse} from 'iso8601-duration';
|
|
3
3
|
|
|
4
4
|
const kStopped = Symbol.for('stopped');
|
|
@@ -7,7 +7,7 @@ const kTimer = Symbol.for('timer');
|
|
|
7
7
|
const repeatPattern = /^\s*R(\d+)\//;
|
|
8
8
|
|
|
9
9
|
export default function TimerEventDefinition(activity, eventDefinition) {
|
|
10
|
-
const type = this.type = eventDefinition.type || 'TimerEventDefinition';
|
|
10
|
+
const type = this.type = eventDefinition.type || 'TimerEventDefinition.js';
|
|
11
11
|
this.activity = activity;
|
|
12
12
|
const environment = this.environment = activity.environment;
|
|
13
13
|
this.eventDefinition = eventDefinition;
|
|
@@ -24,30 +24,28 @@ export default function TimerEventDefinition(activity, eventDefinition) {
|
|
|
24
24
|
this[kTimer] = null;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Object.defineProperty(proto, 'executionId', {
|
|
27
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'executionId', {
|
|
30
28
|
get() {
|
|
31
29
|
const content = this[kTimerContent];
|
|
32
30
|
return content && content.executionId;
|
|
33
31
|
},
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
Object.defineProperty(
|
|
34
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'stopped', {
|
|
37
35
|
enumerable: true,
|
|
38
36
|
get() {
|
|
39
37
|
return this[kStopped];
|
|
40
38
|
},
|
|
41
39
|
});
|
|
42
40
|
|
|
43
|
-
Object.defineProperty(
|
|
41
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'timer', {
|
|
44
42
|
enumerable: true,
|
|
45
43
|
get() {
|
|
46
44
|
return this[kTimer];
|
|
47
45
|
},
|
|
48
46
|
});
|
|
49
47
|
|
|
50
|
-
|
|
48
|
+
TimerEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
51
49
|
const {routingKey: executeKey, redelivered: isResumed} = executeMessage.fields;
|
|
52
50
|
const timer = this[kTimer];
|
|
53
51
|
if (timer && executeKey === 'execute.timer') {
|
|
@@ -95,12 +93,12 @@ proto.execute = function execute(executeMessage) {
|
|
|
95
93
|
});
|
|
96
94
|
};
|
|
97
95
|
|
|
98
|
-
|
|
96
|
+
TimerEventDefinition.prototype.stop = function stopTimer() {
|
|
99
97
|
const timer = this[kTimer];
|
|
100
98
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
101
99
|
};
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
TimerEventDefinition.prototype._completed = function completed(completeContent, options) {
|
|
104
102
|
this._stop();
|
|
105
103
|
|
|
106
104
|
const stoppedAt = new Date();
|
|
@@ -122,7 +120,7 @@ proto._completed = function completed(completeContent, options) {
|
|
|
122
120
|
broker.publish('execution', 'execute.completed', cloneContent(timerContent, content), options);
|
|
123
121
|
};
|
|
124
122
|
|
|
125
|
-
|
|
123
|
+
TimerEventDefinition.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, message) {
|
|
126
124
|
if (!message.properties.delegate) return;
|
|
127
125
|
|
|
128
126
|
const content = message.content;
|
|
@@ -145,7 +143,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
145
143
|
return this._onApiMessage(routingKey, message);
|
|
146
144
|
};
|
|
147
145
|
|
|
148
|
-
|
|
146
|
+
TimerEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
149
147
|
const {type: messageType, correlationId} = message.properties;
|
|
150
148
|
|
|
151
149
|
switch (messageType) {
|
|
@@ -168,7 +166,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
168
166
|
}
|
|
169
167
|
};
|
|
170
168
|
|
|
171
|
-
|
|
169
|
+
TimerEventDefinition.prototype._stop = function stop() {
|
|
172
170
|
this[kStopped] = true;
|
|
173
171
|
const timer = this[kTimer];
|
|
174
172
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
@@ -177,7 +175,7 @@ proto._stop = function stop() {
|
|
|
177
175
|
broker.cancel(`_api-delegated-${this.executionId}`);
|
|
178
176
|
};
|
|
179
177
|
|
|
180
|
-
|
|
178
|
+
TimerEventDefinition.prototype._getTimers = function getTimers(executeMessage) {
|
|
181
179
|
const content = executeMessage.content;
|
|
182
180
|
|
|
183
181
|
const now = Date.now();
|
|
@@ -241,7 +239,7 @@ proto._getTimers = function getTimers(executeMessage) {
|
|
|
241
239
|
return result;
|
|
242
240
|
};
|
|
243
241
|
|
|
244
|
-
|
|
242
|
+
TimerEventDefinition.prototype._getDurationInMilliseconds = function getDurationInMilliseconds(duration) {
|
|
245
243
|
try {
|
|
246
244
|
return toSeconds(parse(duration)) * 1000;
|
|
247
245
|
} catch (err) {
|
|
@@ -249,10 +247,10 @@ proto._getDurationInMilliseconds = function getDurationInMilliseconds(duration)
|
|
|
249
247
|
}
|
|
250
248
|
};
|
|
251
249
|
|
|
252
|
-
|
|
250
|
+
TimerEventDefinition.prototype._debug = function debug(msg) {
|
|
253
251
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
254
252
|
};
|
|
255
253
|
|
|
256
|
-
|
|
254
|
+
TimerEventDefinition.prototype._warn = function debug(msg) {
|
|
257
255
|
this.logger.warn(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
258
256
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
|
|
3
|
-
import {cloneContent, cloneMessage} from '../messageHelper';
|
|
4
|
-
import {brokerSafeId} from '../shared';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution.js';
|
|
3
|
+
import {cloneContent, cloneMessage} from '../messageHelper.js';
|
|
4
|
+
import {brokerSafeId} from '../shared.js';
|
|
5
5
|
|
|
6
6
|
const kAttachedTags = Symbol.for('attachedConsumers');
|
|
7
7
|
const kCompleteContent = Symbol.for('completeContent');
|
|
@@ -25,16 +25,14 @@ export function BoundaryEventBehaviour(activity) {
|
|
|
25
25
|
this[kAttachedTags] = [];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Object.defineProperty(proto, 'executionId', {
|
|
28
|
+
Object.defineProperty(BoundaryEventBehaviour.prototype, 'executionId', {
|
|
31
29
|
get() {
|
|
32
30
|
const message = this[kExecuteMessage];
|
|
33
31
|
return message && message.content.executionId;
|
|
34
32
|
},
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
Object.defineProperty(
|
|
35
|
+
Object.defineProperty(BoundaryEventBehaviour.prototype, 'cancelActivity', {
|
|
38
36
|
enumerable: true,
|
|
39
37
|
get() {
|
|
40
38
|
const behaviour = this.activity.behaviour || {};
|
|
@@ -42,7 +40,7 @@ Object.defineProperty(proto, 'cancelActivity', {
|
|
|
42
40
|
},
|
|
43
41
|
});
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
BoundaryEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
46
44
|
const {isRootScope, executionId} = executeMessage.content;
|
|
47
45
|
|
|
48
46
|
const eventDefinitionExecution = this[kExecution];
|
|
@@ -83,7 +81,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
83
81
|
}
|
|
84
82
|
};
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
BoundaryEventBehaviour.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
87
85
|
message.ack();
|
|
88
86
|
switch (routingKey) {
|
|
89
87
|
case 'execute.detach':
|
|
@@ -97,8 +95,8 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
97
95
|
}
|
|
98
96
|
};
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
if (!this.cancelActivity && !content.cancelActivity) {
|
|
98
|
+
BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {content}) {
|
|
99
|
+
if (content.cancelActivity === false || !this.cancelActivity && !content.cancelActivity) {
|
|
102
100
|
this._stop();
|
|
103
101
|
return this.broker.publish('execution', 'execute.completed', cloneContent(content, {isDefinitionScope: false, cancelActivity: false}));
|
|
104
102
|
}
|
|
@@ -108,38 +106,42 @@ proto._onCompleted = function onCompleted(_, {content}) {
|
|
|
108
106
|
const inbound = this[kExecuteMessage].content.inbound;
|
|
109
107
|
const attachedToContent = inbound && inbound[0];
|
|
110
108
|
const attachedTo = this.attachedTo;
|
|
109
|
+
|
|
111
110
|
this.activity.logger.debug(`<${this.executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
|
|
112
111
|
|
|
113
112
|
attachedTo.getApi({content: attachedToContent}).discard();
|
|
114
113
|
};
|
|
115
114
|
|
|
116
|
-
|
|
115
|
+
BoundaryEventBehaviour.prototype._onAttachedLeave = function onAttachedLeave(_, {content}) {
|
|
117
116
|
if (content.id !== this.attachedTo.id) return;
|
|
117
|
+
|
|
118
118
|
this._stop();
|
|
119
119
|
const completeContent = this[kCompleteContent];
|
|
120
120
|
if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[kExecuteMessage].content);
|
|
121
121
|
return this.broker.publish('execution', 'execute.completed', cloneContent(completeContent));
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
const {executionId, expectRoutingKey} = content;
|
|
124
|
+
BoundaryEventBehaviour.prototype._onExpectMessage = function onExpectMessage(_, {content}) {
|
|
125
|
+
const {executionId, expectRoutingKey, pattern, exchange} = content;
|
|
126
126
|
const attachedTo = this.attachedTo;
|
|
127
127
|
|
|
128
128
|
const errorConsumerTag = `_bound-error-listener-${executionId}`;
|
|
129
129
|
this[kAttachedTags].push(errorConsumerTag);
|
|
130
130
|
|
|
131
|
-
attachedTo.broker.subscribeTmp('event',
|
|
132
|
-
if (
|
|
133
|
-
this.broker.publish(
|
|
131
|
+
attachedTo.broker.subscribeTmp('event', pattern, (__, message) => {
|
|
132
|
+
if (message.content.id !== attachedTo.id) return;
|
|
133
|
+
this.broker.publish(exchange, expectRoutingKey, cloneContent(message.content, {attachedTo: attachedTo.id}), {...message.properties, mandatory: false});
|
|
134
134
|
}, {
|
|
135
135
|
noAck: true,
|
|
136
136
|
consumerTag: errorConsumerTag,
|
|
137
|
-
priority:
|
|
137
|
+
priority: 400,
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
const
|
|
141
|
+
BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_, message) {
|
|
142
|
+
const content = message.content;
|
|
143
|
+
const {executionId, parent} = this[kExecuteMessage].content;
|
|
144
|
+
const id = this.id, attachedTo = this.attachedTo;
|
|
143
145
|
this.activity.logger.debug(`<${executionId} (${id})> detach from activity <${attachedTo.id}>`);
|
|
144
146
|
this._stop(true);
|
|
145
147
|
|
|
@@ -159,6 +161,14 @@ proto._onDetachMessage = function onDetachMessage(_, {content}) {
|
|
|
159
161
|
cloneMessage,
|
|
160
162
|
});
|
|
161
163
|
|
|
164
|
+
const detachContent = cloneContent(content, {
|
|
165
|
+
executionId,
|
|
166
|
+
});
|
|
167
|
+
detachContent.parent = parent;
|
|
168
|
+
|
|
169
|
+
this.activity.removeInboundListeners();
|
|
170
|
+
broker.publish('event', 'activity.detach', detachContent);
|
|
171
|
+
|
|
162
172
|
broker.subscribeOnce('execution', 'execute.bound.completed', (__, {content: completeContent}) => {
|
|
163
173
|
this._stop();
|
|
164
174
|
this.broker.publish('execution', 'execute.completed', cloneContent(completeContent));
|
|
@@ -167,7 +177,7 @@ proto._onDetachMessage = function onDetachMessage(_, {content}) {
|
|
|
167
177
|
});
|
|
168
178
|
};
|
|
169
179
|
|
|
170
|
-
|
|
180
|
+
BoundaryEventBehaviour.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
171
181
|
switch (message.properties.type) {
|
|
172
182
|
case 'discard':
|
|
173
183
|
case 'stop':
|
|
@@ -176,14 +186,14 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
176
186
|
}
|
|
177
187
|
};
|
|
178
188
|
|
|
179
|
-
|
|
189
|
+
BoundaryEventBehaviour.prototype._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
180
190
|
if (this.cancelActivity) return;
|
|
181
191
|
const executeMessage = this[kExecuteMessage];
|
|
182
192
|
const repeat = message.content.repeat;
|
|
183
193
|
this.broker.getQueue('inbound-q').queueMessage({routingKey: 'activity.restart'}, cloneContent(executeMessage.content.inbound[0], {repeat}));
|
|
184
194
|
};
|
|
185
195
|
|
|
186
|
-
|
|
196
|
+
BoundaryEventBehaviour.prototype._stop = function stop(detach) {
|
|
187
197
|
const attachedTo = this.attachedTo, broker = this.broker, executionId = this.executionId;
|
|
188
198
|
for (const tag of this[kAttachedTags].splice(0)) attachedTo.broker.cancel(tag);
|
|
189
199
|
for (const shovelName of this[kShovels].splice(0)) attachedTo.broker.closeShovel(shovelName);
|
package/src/events/EndEvent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
|
|
3
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution.js';
|
|
3
|
+
import {cloneContent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kExecution = Symbol.for('execution');
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
|
|
3
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution.js';
|
|
3
|
+
import {cloneContent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kExecution = Symbol.for('execution');
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
|
|
3
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution.js';
|
|
3
|
+
import {cloneContent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kExecution = Symbol.for('execution');
|
|
6
6
|
|
package/src/events/StartEvent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Activity from '../activity/Activity';
|
|
2
|
-
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
|
|
3
|
-
import {cloneContent} from '../messageHelper';
|
|
1
|
+
import Activity from '../activity/Activity.js';
|
|
2
|
+
import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution.js';
|
|
3
|
+
import {cloneContent} from '../messageHelper.js';
|
|
4
4
|
|
|
5
5
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
6
6
|
const kExecution = Symbol.for('execution');
|
|
@@ -17,16 +17,14 @@ export function StartEventBehaviour(activity) {
|
|
|
17
17
|
this[kExecution] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(proto, 'executionId', {
|
|
20
|
+
Object.defineProperty(StartEventBehaviour.prototype, 'executionId', {
|
|
23
21
|
get() {
|
|
24
22
|
const message = this[kExecuteMessage];
|
|
25
23
|
return message && message.content.executionId;
|
|
26
24
|
},
|
|
27
25
|
});
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
StartEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
30
28
|
const execution = this[kExecution];
|
|
31
29
|
if (execution) {
|
|
32
30
|
return execution.execute(executeMessage);
|
|
@@ -52,7 +50,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
52
50
|
broker.publish('event', 'activity.wait', {...content, executionId, state: 'wait'});
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
StartEventBehaviour.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
56
54
|
const {type: messageType, correlationId} = message.properties;
|
|
57
55
|
switch (messageType) {
|
|
58
56
|
case 'stop':
|
|
@@ -73,7 +71,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
StartEventBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, message) {
|
|
77
75
|
if (!message.properties.delegate) return;
|
|
78
76
|
|
|
79
77
|
const content = message.content;
|
|
@@ -96,7 +94,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
96
94
|
return this._onApiMessage(routingKey, message);
|
|
97
95
|
};
|
|
98
96
|
|
|
99
|
-
|
|
97
|
+
StartEventBehaviour.prototype._stop = function stop() {
|
|
100
98
|
const broker = this.broker, executionId = this.executionId;
|
|
101
99
|
broker.cancel(`_api-${executionId}`);
|
|
102
100
|
broker.cancel(`_api-delegated-${executionId}`);
|