bpmn-elements 8.2.4 → 9.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 +10 -0
- 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} +1 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/{src/activity → activity}/Activity.js +62 -63
- package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
- 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 +41 -42
- package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -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 +15 -16
- 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 +15 -16
- 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 +2 -2
- 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 +39 -40
- package/dist/{src/process → process}/ProcessExecution.js +42 -43
- 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 +17 -18
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +30 -30
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +1 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/activity/Activity.js +62 -64
- package/src/activity/ActivityExecution.js +23 -25
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +41 -43
- package/src/definition/DefinitionExecution.js +45 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +12 -14
- package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
- package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
- package/src/eventDefinitions/ErrorEventDefinition.js +13 -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 +15 -17
- 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 +15 -17
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +2 -2
- 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 +39 -41
- package/src/process/ProcessExecution.js +42 -44
- 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 +17 -19
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +491 -0
- 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 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,7 +95,7 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
97
95
|
}
|
|
98
96
|
};
|
|
99
97
|
|
|
100
|
-
|
|
98
|
+
BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {content}) {
|
|
101
99
|
if (!this.cancelActivity && !content.cancelActivity) {
|
|
102
100
|
this._stop();
|
|
103
101
|
return this.broker.publish('execution', 'execute.completed', cloneContent(content, {isDefinitionScope: false, cancelActivity: false}));
|
|
@@ -113,7 +111,7 @@ proto._onCompleted = function onCompleted(_, {content}) {
|
|
|
113
111
|
attachedTo.getApi({content: attachedToContent}).discard();
|
|
114
112
|
};
|
|
115
113
|
|
|
116
|
-
|
|
114
|
+
BoundaryEventBehaviour.prototype._onAttachedLeave = function onAttachedLeave(_, {content}) {
|
|
117
115
|
if (content.id !== this.attachedTo.id) return;
|
|
118
116
|
this._stop();
|
|
119
117
|
const completeContent = this[kCompleteContent];
|
|
@@ -121,7 +119,7 @@ proto._onAttachedLeave = function onAttachedLeave(_, {content}) {
|
|
|
121
119
|
return this.broker.publish('execution', 'execute.completed', cloneContent(completeContent));
|
|
122
120
|
};
|
|
123
121
|
|
|
124
|
-
|
|
122
|
+
BoundaryEventBehaviour.prototype._onExpectMessage = function onExpectMessage(_, {content}) {
|
|
125
123
|
const {executionId, expectRoutingKey} = content;
|
|
126
124
|
const attachedTo = this.attachedTo;
|
|
127
125
|
|
|
@@ -138,7 +136,7 @@ proto._onExpectMessage = function onExpectMessage(_, {content}) {
|
|
|
138
136
|
});
|
|
139
137
|
};
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_, {content}) {
|
|
142
140
|
const id = this.id, executionId = this.executionId, attachedTo = this.attachedTo;
|
|
143
141
|
this.activity.logger.debug(`<${executionId} (${id})> detach from activity <${attachedTo.id}>`);
|
|
144
142
|
this._stop(true);
|
|
@@ -167,7 +165,7 @@ proto._onDetachMessage = function onDetachMessage(_, {content}) {
|
|
|
167
165
|
});
|
|
168
166
|
};
|
|
169
167
|
|
|
170
|
-
|
|
168
|
+
BoundaryEventBehaviour.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
171
169
|
switch (message.properties.type) {
|
|
172
170
|
case 'discard':
|
|
173
171
|
case 'stop':
|
|
@@ -176,14 +174,14 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
176
174
|
}
|
|
177
175
|
};
|
|
178
176
|
|
|
179
|
-
|
|
177
|
+
BoundaryEventBehaviour.prototype._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
180
178
|
if (this.cancelActivity) return;
|
|
181
179
|
const executeMessage = this[kExecuteMessage];
|
|
182
180
|
const repeat = message.content.repeat;
|
|
183
181
|
this.broker.getQueue('inbound-q').queueMessage({routingKey: 'activity.restart'}, cloneContent(executeMessage.content.inbound[0], {repeat}));
|
|
184
182
|
};
|
|
185
183
|
|
|
186
|
-
|
|
184
|
+
BoundaryEventBehaviour.prototype._stop = function stop(detach) {
|
|
187
185
|
const attachedTo = this.attachedTo, broker = this.broker, executionId = this.executionId;
|
|
188
186
|
for (const tag of this[kAttachedTags].splice(0)) attachedTo.broker.cancel(tag);
|
|
189
187
|
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}`);
|
package/src/flows/Association.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {cloneParent} from '../messageHelper';
|
|
2
|
-
import {EventBroker} from '../EventBroker';
|
|
3
|
-
import {
|
|
4
|
-
import {getUniqueId} from '../shared';
|
|
1
|
+
import {cloneParent} from '../messageHelper.js';
|
|
2
|
+
import {EventBroker} from '../EventBroker.js';
|
|
3
|
+
import {Api} from '../Api.js';
|
|
4
|
+
import {getUniqueId} from '../shared.js';
|
|
5
5
|
|
|
6
6
|
const kCounters = Symbol.for('counters');
|
|
7
7
|
|
|
@@ -34,16 +34,14 @@ export default function Association(associationDef, {environment}) {
|
|
|
34
34
|
logger.debug(`<${id}> init, <${sourceId}> -> <${targetId}>`);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Object.defineProperty(proto, 'counters', {
|
|
37
|
+
Object.defineProperty(Association.prototype, 'counters', {
|
|
40
38
|
enumerable: true,
|
|
41
39
|
get() {
|
|
42
40
|
return {...this[kCounters]};
|
|
43
41
|
},
|
|
44
42
|
});
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
Association.prototype.take = function take(content = {}) {
|
|
47
45
|
this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
|
|
48
46
|
++this[kCounters].take;
|
|
49
47
|
|
|
@@ -52,7 +50,7 @@ proto.take = function take(content = {}) {
|
|
|
52
50
|
return true;
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
Association.prototype.discard = function discard(content = {}) {
|
|
56
54
|
this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
|
|
57
55
|
++this[kCounters].discard;
|
|
58
56
|
|
|
@@ -61,7 +59,7 @@ proto.discard = function discard(content = {}) {
|
|
|
61
59
|
return true;
|
|
62
60
|
};
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
Association.prototype.complete = function complete(content = {}) {
|
|
65
63
|
this.logger.debug(`<${this.id}> completed target <${this.targetId}>`);
|
|
66
64
|
++this[kCounters].complete;
|
|
67
65
|
|
|
@@ -70,27 +68,27 @@ proto.complete = function complete(content = {}) {
|
|
|
70
68
|
return true;
|
|
71
69
|
};
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
Association.prototype.getState = function getState() {
|
|
74
72
|
return this._createMessageContent({
|
|
75
73
|
counters: this.counters,
|
|
76
74
|
broker: this.broker.getState(true),
|
|
77
75
|
});
|
|
78
76
|
};
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
Association.prototype.recover = function recover(state) {
|
|
81
79
|
Object.assign(this[kCounters], state.counters);
|
|
82
80
|
this.broker.recover(state.broker);
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
return
|
|
83
|
+
Association.prototype.getApi = function getApi(message) {
|
|
84
|
+
return new Api('association', this.broker, message || {content: this._createMessageContent()});
|
|
87
85
|
};
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
Association.prototype.stop = function stop() {
|
|
90
88
|
this.broker.stop();
|
|
91
89
|
};
|
|
92
90
|
|
|
93
|
-
|
|
91
|
+
Association.prototype._publishEvent = function publishEvent(action, content) {
|
|
94
92
|
const eventContent = this._createMessageContent({
|
|
95
93
|
action,
|
|
96
94
|
message: content,
|
|
@@ -100,7 +98,7 @@ proto._publishEvent = function publishEvent(action, content) {
|
|
|
100
98
|
this.broker.publish('event', `association.${action}`, eventContent, {type: action});
|
|
101
99
|
};
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
Association.prototype._createMessageContent = function createMessageContent(override) {
|
|
104
102
|
return {
|
|
105
103
|
...override,
|
|
106
104
|
id: this.id,
|