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
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = LinkEventDefinition;
|
|
7
|
-
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
|
|
8
|
-
var _shared = require("../shared");
|
|
9
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
|
|
8
|
+
var _shared = require("../shared.js");
|
|
9
|
+
var _messageHelper = require("../messageHelper.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const kCompleted = Symbol.for('completed');
|
|
12
12
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -49,17 +49,16 @@ function LinkEventDefinition(activity, eventDefinition) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(proto, 'executionId', {
|
|
52
|
+
Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
|
|
54
53
|
get() {
|
|
55
54
|
const message = this[kExecuteMessage];
|
|
56
55
|
return message && message.content.executionId;
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
|
-
|
|
58
|
+
LinkEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
60
59
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
LinkEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
63
62
|
this[kExecuteMessage] = executeMessage;
|
|
64
63
|
this[kCompleted] = false;
|
|
65
64
|
const executeContent = executeMessage.content;
|
|
@@ -93,7 +92,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
93
92
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
94
93
|
broker.publish('event', 'activity.wait', waitContent);
|
|
95
94
|
};
|
|
96
|
-
|
|
95
|
+
LinkEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
97
96
|
const executeContent = executeMessage.content;
|
|
98
97
|
const {
|
|
99
98
|
executionId,
|
|
@@ -116,12 +115,12 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
116
115
|
});
|
|
117
116
|
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
118
117
|
};
|
|
119
|
-
|
|
118
|
+
LinkEventDefinition.prototype._onCatchLink = function onCatchLink(routingKey, message) {
|
|
120
119
|
if ((0, _getPropertyValue.default)(message, 'content.message.linkName') !== this.reference.linkName) return;
|
|
121
120
|
if (message.content.state === 'discard') return this._discard();
|
|
122
121
|
return this._complete('caught', message.content.message);
|
|
123
122
|
};
|
|
124
|
-
|
|
123
|
+
LinkEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
125
124
|
const messageType = message.properties.type;
|
|
126
125
|
switch (messageType) {
|
|
127
126
|
case 'discard':
|
|
@@ -135,7 +134,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
136
|
};
|
|
138
|
-
|
|
137
|
+
LinkEventDefinition.prototype._complete = function complete(verb, output) {
|
|
139
138
|
this[kCompleted] = true;
|
|
140
139
|
this._stop();
|
|
141
140
|
this._debug(`${verb} link ${this.reference.linkName}`);
|
|
@@ -160,12 +159,12 @@ proto._complete = function complete(verb, output) {
|
|
|
160
159
|
state: 'catch'
|
|
161
160
|
}));
|
|
162
161
|
};
|
|
163
|
-
|
|
162
|
+
LinkEventDefinition.prototype._discard = function discard() {
|
|
164
163
|
this[kCompleted] = true;
|
|
165
164
|
this._stop();
|
|
166
165
|
return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content));
|
|
167
166
|
};
|
|
168
|
-
|
|
167
|
+
LinkEventDefinition.prototype._stop = function stop() {
|
|
169
168
|
const broker = this.broker,
|
|
170
169
|
executionId = this.executionId;
|
|
171
170
|
broker.cancel(`_api-link-${executionId}`);
|
|
@@ -173,7 +172,7 @@ proto._stop = function stop() {
|
|
|
173
172
|
broker.cancel(`_api-${executionId}`);
|
|
174
173
|
this[kMessageQ].purge();
|
|
175
174
|
};
|
|
176
|
-
|
|
175
|
+
LinkEventDefinition.prototype._onDiscard = function onDiscard(_, message) {
|
|
177
176
|
this.broker.publish('event', 'activity.link.discard', (0, _messageHelper.cloneContent)(message.content, {
|
|
178
177
|
message: {
|
|
179
178
|
...this.reference
|
|
@@ -184,6 +183,6 @@ proto._onDiscard = function onDiscard(_, message) {
|
|
|
184
183
|
delegate: true
|
|
185
184
|
});
|
|
186
185
|
};
|
|
187
|
-
|
|
186
|
+
LinkEventDefinition.prototype._debug = function debug(msg) {
|
|
188
187
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
189
188
|
};
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = MessageEventDefinition;
|
|
7
|
-
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
|
|
8
|
-
var _shared = require("../shared");
|
|
9
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
|
|
8
|
+
var _shared = require("../shared.js");
|
|
9
|
+
var _messageHelper = require("../messageHelper.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const kCompleted = Symbol.for('completed');
|
|
12
12
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -49,17 +49,16 @@ function MessageEventDefinition(activity, eventDefinition) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
Object.defineProperty(proto, 'executionId', {
|
|
52
|
+
Object.defineProperty(MessageEventDefinition.prototype, 'executionId', {
|
|
54
53
|
get() {
|
|
55
54
|
const message = this[kExecuteMessage];
|
|
56
55
|
return message && message.content.executionId;
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
|
-
|
|
58
|
+
MessageEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
60
59
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
MessageEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
63
62
|
this[kExecuteMessage] = executeMessage;
|
|
64
63
|
this[kCompleted] = false;
|
|
65
64
|
const executeContent = executeMessage.content;
|
|
@@ -101,7 +100,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
101
100
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
102
101
|
broker.publish('event', 'activity.wait', waitContent);
|
|
103
102
|
};
|
|
104
|
-
|
|
103
|
+
MessageEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
105
104
|
const executeContent = executeMessage.content;
|
|
106
105
|
const {
|
|
107
106
|
executionId,
|
|
@@ -125,7 +124,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
125
124
|
});
|
|
126
125
|
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
127
126
|
};
|
|
128
|
-
|
|
127
|
+
MessageEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
129
128
|
if ((0, _getPropertyValue.default)(message, 'content.message.id') !== this[kReferenceInfo].message.id) return;
|
|
130
129
|
const {
|
|
131
130
|
type,
|
|
@@ -143,7 +142,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
143
142
|
correlationId
|
|
144
143
|
});
|
|
145
144
|
};
|
|
146
|
-
|
|
145
|
+
MessageEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
147
146
|
const {
|
|
148
147
|
type,
|
|
149
148
|
correlationId
|
|
@@ -170,7 +169,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
171
|
};
|
|
173
|
-
|
|
172
|
+
MessageEventDefinition.prototype._complete = function complete(verb, output, options) {
|
|
174
173
|
this[kCompleted] = true;
|
|
175
174
|
this._stop();
|
|
176
175
|
this._debug(`${verb} ${this[kReferenceInfo].description}`);
|
|
@@ -191,7 +190,7 @@ proto._complete = function complete(verb, output, options) {
|
|
|
191
190
|
state: 'catch'
|
|
192
191
|
}), options);
|
|
193
192
|
};
|
|
194
|
-
|
|
193
|
+
MessageEventDefinition.prototype._stop = function stop() {
|
|
195
194
|
const broker = this.broker,
|
|
196
195
|
executionId = this.executionId;
|
|
197
196
|
broker.cancel(`_api-message-${executionId}`);
|
|
@@ -200,7 +199,7 @@ proto._stop = function stop() {
|
|
|
200
199
|
broker.cancel(`_api-delegated-${executionId}`);
|
|
201
200
|
this[kMessageQ].purge();
|
|
202
201
|
};
|
|
203
|
-
|
|
202
|
+
MessageEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
204
203
|
const referenceElement = this[kReferenceElement];
|
|
205
204
|
if (!referenceElement) {
|
|
206
205
|
return {
|
|
@@ -216,6 +215,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
216
215
|
result.description = `${result.message.name} <${result.message.id}>`;
|
|
217
216
|
return result;
|
|
218
217
|
};
|
|
219
|
-
|
|
218
|
+
MessageEventDefinition.prototype._debug = function debug(msg) {
|
|
220
219
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
221
220
|
};
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = SignalEventDefinition;
|
|
7
|
-
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
|
|
8
|
-
var _shared = require("../shared");
|
|
9
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue.js"));
|
|
8
|
+
var _shared = require("../shared.js");
|
|
9
|
+
var _messageHelper = require("../messageHelper.js");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const kCompleted = Symbol.for('completed');
|
|
12
12
|
const kMessageQ = Symbol.for('messageQ');
|
|
@@ -50,17 +50,16 @@ function SignalEventDefinition(activity, eventDefinition) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
Object.defineProperty(proto, 'executionId', {
|
|
53
|
+
Object.defineProperty(SignalEventDefinition.prototype, 'executionId', {
|
|
55
54
|
get() {
|
|
56
55
|
const message = this[kExecuteMessage];
|
|
57
56
|
return message && message.content.executionId;
|
|
58
57
|
}
|
|
59
58
|
});
|
|
60
|
-
|
|
59
|
+
SignalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
61
60
|
return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
SignalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
|
|
64
63
|
this[kExecuteMessage] = executeMessage;
|
|
65
64
|
this[kCompleted] = false;
|
|
66
65
|
const executeContent = executeMessage.content;
|
|
@@ -102,7 +101,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
|
|
|
102
101
|
waitContent.parent = (0, _messageHelper.shiftParent)(parent);
|
|
103
102
|
broker.publish('event', 'activity.wait', waitContent);
|
|
104
103
|
};
|
|
105
|
-
|
|
104
|
+
SignalEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
|
|
106
105
|
const executeContent = executeMessage.content;
|
|
107
106
|
const {
|
|
108
107
|
executionId,
|
|
@@ -125,7 +124,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
|
|
|
125
124
|
});
|
|
126
125
|
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
|
|
127
126
|
};
|
|
128
|
-
|
|
127
|
+
SignalEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
129
128
|
const info = this[kReferenceInfo];
|
|
130
129
|
if ((0, _getPropertyValue.default)(message, 'content.message.id') !== info.message.id) return;
|
|
131
130
|
this[kCompleted] = true;
|
|
@@ -144,7 +143,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
|
|
|
144
143
|
});
|
|
145
144
|
return this._complete(message.content.message, message.properties);
|
|
146
145
|
};
|
|
147
|
-
|
|
146
|
+
SignalEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
148
147
|
const {
|
|
149
148
|
type,
|
|
150
149
|
correlationId
|
|
@@ -171,7 +170,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
};
|
|
174
|
-
|
|
173
|
+
SignalEventDefinition.prototype._complete = function complete(output, options) {
|
|
175
174
|
this[kCompleted] = true;
|
|
176
175
|
this._stop();
|
|
177
176
|
this._debug(`signaled with ${this[kReferenceInfo].description}`);
|
|
@@ -180,7 +179,7 @@ proto._complete = function complete(output, options) {
|
|
|
180
179
|
state: 'signal'
|
|
181
180
|
}), options);
|
|
182
181
|
};
|
|
183
|
-
|
|
182
|
+
SignalEventDefinition.prototype._stop = function stop() {
|
|
184
183
|
const broker = this.broker,
|
|
185
184
|
executionId = this.executionId;
|
|
186
185
|
broker.cancel(`_api-signal-${executionId}`);
|
|
@@ -189,7 +188,7 @@ proto._stop = function stop() {
|
|
|
189
188
|
broker.cancel(`_api-delegated-${executionId}`);
|
|
190
189
|
if (this.activity.isStart) this[kMessageQ].purge();
|
|
191
190
|
};
|
|
192
|
-
|
|
191
|
+
SignalEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
|
|
193
192
|
const referenceElement = this[kReferenceElement];
|
|
194
193
|
if (!referenceElement) {
|
|
195
194
|
return {
|
|
@@ -205,6 +204,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
|
|
|
205
204
|
result.description = `${result.message.name} <${result.message.id}>`;
|
|
206
205
|
return result;
|
|
207
206
|
};
|
|
208
|
-
|
|
207
|
+
SignalEventDefinition.prototype._debug = function debug(msg) {
|
|
209
208
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
210
209
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = TerminateEventDefinition;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
8
|
function TerminateEventDefinition(activity, eventDefinition) {
|
|
9
9
|
const {
|
|
10
10
|
id,
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = TimerEventDefinition;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
8
|
var _iso8601Duration = require("iso8601-duration");
|
|
9
9
|
const kStopped = Symbol.for('stopped');
|
|
10
10
|
const kTimerContent = Symbol.for('timerContent');
|
|
11
11
|
const kTimer = Symbol.for('timer');
|
|
12
12
|
const repeatPattern = /^\s*R(\d+)\//;
|
|
13
13
|
function TimerEventDefinition(activity, eventDefinition) {
|
|
14
|
-
const type = this.type = eventDefinition.type || 'TimerEventDefinition';
|
|
14
|
+
const type = this.type = eventDefinition.type || 'TimerEventDefinition.js';
|
|
15
15
|
this.activity = activity;
|
|
16
16
|
const environment = this.environment = activity.environment;
|
|
17
17
|
this.eventDefinition = eventDefinition;
|
|
@@ -28,26 +28,25 @@ function TimerEventDefinition(activity, eventDefinition) {
|
|
|
28
28
|
this[kStopped] = false;
|
|
29
29
|
this[kTimer] = null;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(proto, 'executionId', {
|
|
31
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'executionId', {
|
|
33
32
|
get() {
|
|
34
33
|
const content = this[kTimerContent];
|
|
35
34
|
return content && content.executionId;
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
|
-
Object.defineProperty(
|
|
37
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'stopped', {
|
|
39
38
|
enumerable: true,
|
|
40
39
|
get() {
|
|
41
40
|
return this[kStopped];
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
|
-
Object.defineProperty(
|
|
43
|
+
Object.defineProperty(TimerEventDefinition.prototype, 'timer', {
|
|
45
44
|
enumerable: true,
|
|
46
45
|
get() {
|
|
47
46
|
return this[kTimer];
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
|
-
|
|
49
|
+
TimerEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
51
50
|
const {
|
|
52
51
|
routingKey: executeKey,
|
|
53
52
|
redelivered: isResumed
|
|
@@ -93,11 +92,11 @@ proto.execute = function execute(executeMessage) {
|
|
|
93
92
|
state: 'timeout'
|
|
94
93
|
});
|
|
95
94
|
};
|
|
96
|
-
|
|
95
|
+
TimerEventDefinition.prototype.stop = function stopTimer() {
|
|
97
96
|
const timer = this[kTimer];
|
|
98
97
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
99
98
|
};
|
|
100
|
-
|
|
99
|
+
TimerEventDefinition.prototype._completed = function completed(completeContent, options) {
|
|
101
100
|
this._stop();
|
|
102
101
|
const stoppedAt = new Date();
|
|
103
102
|
const runningTime = stoppedAt.getTime() - this.startedAt.getTime();
|
|
@@ -120,7 +119,7 @@ proto._completed = function completed(completeContent, options) {
|
|
|
120
119
|
}
|
|
121
120
|
broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(timerContent, content), options);
|
|
122
121
|
};
|
|
123
|
-
|
|
122
|
+
TimerEventDefinition.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, message) {
|
|
124
123
|
if (!message.properties.delegate) return;
|
|
125
124
|
const content = message.content;
|
|
126
125
|
if (!content.message) return;
|
|
@@ -146,7 +145,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
146
145
|
});
|
|
147
146
|
return this._onApiMessage(routingKey, message);
|
|
148
147
|
};
|
|
149
|
-
|
|
148
|
+
TimerEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
150
149
|
const {
|
|
151
150
|
type: messageType,
|
|
152
151
|
correlationId
|
|
@@ -181,7 +180,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
};
|
|
184
|
-
|
|
183
|
+
TimerEventDefinition.prototype._stop = function stop() {
|
|
185
184
|
this[kStopped] = true;
|
|
186
185
|
const timer = this[kTimer];
|
|
187
186
|
if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
|
|
@@ -189,7 +188,7 @@ proto._stop = function stop() {
|
|
|
189
188
|
broker.cancel(`_api-${this.executionId}`);
|
|
190
189
|
broker.cancel(`_api-delegated-${this.executionId}`);
|
|
191
190
|
};
|
|
192
|
-
|
|
191
|
+
TimerEventDefinition.prototype._getTimers = function getTimers(executeMessage) {
|
|
193
192
|
const content = executeMessage.content;
|
|
194
193
|
const now = Date.now();
|
|
195
194
|
const result = {
|
|
@@ -248,16 +247,16 @@ proto._getTimers = function getTimers(executeMessage) {
|
|
|
248
247
|
}
|
|
249
248
|
return result;
|
|
250
249
|
};
|
|
251
|
-
|
|
250
|
+
TimerEventDefinition.prototype._getDurationInMilliseconds = function getDurationInMilliseconds(duration) {
|
|
252
251
|
try {
|
|
253
252
|
return (0, _iso8601Duration.toSeconds)((0, _iso8601Duration.parse)(duration)) * 1000;
|
|
254
253
|
} catch (err) {
|
|
255
254
|
this._warn(`failed to parse ${this.timerType} >${duration}<: ${err.message}`);
|
|
256
255
|
}
|
|
257
256
|
};
|
|
258
|
-
|
|
257
|
+
TimerEventDefinition.prototype._debug = function debug(msg) {
|
|
259
258
|
this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
260
259
|
};
|
|
261
|
-
|
|
260
|
+
TimerEventDefinition.prototype._warn = function debug(msg) {
|
|
262
261
|
this.logger.warn(`<${this.executionId} (${this.activity.id})> ${msg}`);
|
|
263
262
|
};
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.BoundaryEventBehaviour = BoundaryEventBehaviour;
|
|
7
7
|
exports.default = BoundaryEvent;
|
|
8
|
-
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
9
|
-
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
10
|
-
var _messageHelper = require("../messageHelper");
|
|
11
|
-
var _shared = require("../shared");
|
|
8
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
|
|
9
|
+
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution.js"));
|
|
10
|
+
var _messageHelper = require("../messageHelper.js");
|
|
11
|
+
var _shared = require("../shared.js");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const kAttachedTags = Symbol.for('attachedConsumers');
|
|
14
14
|
const kCompleteContent = Symbol.for('completeContent');
|
|
@@ -29,21 +29,20 @@ function BoundaryEventBehaviour(activity) {
|
|
|
29
29
|
this[kShovels] = [];
|
|
30
30
|
this[kAttachedTags] = [];
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(proto, 'executionId', {
|
|
32
|
+
Object.defineProperty(BoundaryEventBehaviour.prototype, 'executionId', {
|
|
34
33
|
get() {
|
|
35
34
|
const message = this[kExecuteMessage];
|
|
36
35
|
return message && message.content.executionId;
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
|
-
Object.defineProperty(
|
|
38
|
+
Object.defineProperty(BoundaryEventBehaviour.prototype, 'cancelActivity', {
|
|
40
39
|
enumerable: true,
|
|
41
40
|
get() {
|
|
42
41
|
const behaviour = this.activity.behaviour || {};
|
|
43
42
|
return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
44
43
|
}
|
|
45
44
|
});
|
|
46
|
-
|
|
45
|
+
BoundaryEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
47
46
|
const {
|
|
48
47
|
isRootScope,
|
|
49
48
|
executionId
|
|
@@ -84,7 +83,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
84
83
|
return eventDefinitionExecution.execute(executeMessage);
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
|
|
86
|
+
BoundaryEventBehaviour.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
88
87
|
message.ack();
|
|
89
88
|
switch (routingKey) {
|
|
90
89
|
case 'execute.detach':
|
|
@@ -97,10 +96,10 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
97
96
|
return this._onExpectMessage(routingKey, message);
|
|
98
97
|
}
|
|
99
98
|
};
|
|
100
|
-
|
|
99
|
+
BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {
|
|
101
100
|
content
|
|
102
101
|
}) {
|
|
103
|
-
if (!this.cancelActivity && !content.cancelActivity) {
|
|
102
|
+
if (content.cancelActivity === false || !this.cancelActivity && !content.cancelActivity) {
|
|
104
103
|
this._stop();
|
|
105
104
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content, {
|
|
106
105
|
isDefinitionScope: false,
|
|
@@ -116,7 +115,7 @@ proto._onCompleted = function onCompleted(_, {
|
|
|
116
115
|
content: attachedToContent
|
|
117
116
|
}).discard();
|
|
118
117
|
};
|
|
119
|
-
|
|
118
|
+
BoundaryEventBehaviour.prototype._onAttachedLeave = function onAttachedLeave(_, {
|
|
120
119
|
content
|
|
121
120
|
}) {
|
|
122
121
|
if (content.id !== this.attachedTo.id) return;
|
|
@@ -125,30 +124,39 @@ proto._onAttachedLeave = function onAttachedLeave(_, {
|
|
|
125
124
|
if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[kExecuteMessage].content);
|
|
126
125
|
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
|
|
127
126
|
};
|
|
128
|
-
|
|
127
|
+
BoundaryEventBehaviour.prototype._onExpectMessage = function onExpectMessage(_, {
|
|
129
128
|
content
|
|
130
129
|
}) {
|
|
131
130
|
const {
|
|
132
131
|
executionId,
|
|
133
|
-
expectRoutingKey
|
|
132
|
+
expectRoutingKey,
|
|
133
|
+
pattern,
|
|
134
|
+
exchange
|
|
134
135
|
} = content;
|
|
135
136
|
const attachedTo = this.attachedTo;
|
|
136
137
|
const errorConsumerTag = `_bound-error-listener-${executionId}`;
|
|
137
138
|
this[kAttachedTags].push(errorConsumerTag);
|
|
138
|
-
attachedTo.broker.subscribeTmp('event',
|
|
139
|
-
if (
|
|
140
|
-
this.broker.publish(
|
|
139
|
+
attachedTo.broker.subscribeTmp('event', pattern, (__, message) => {
|
|
140
|
+
if (message.content.id !== attachedTo.id) return;
|
|
141
|
+
this.broker.publish(exchange, expectRoutingKey, (0, _messageHelper.cloneContent)(message.content, {
|
|
142
|
+
attachedTo: attachedTo.id
|
|
143
|
+
}), {
|
|
144
|
+
...message.properties,
|
|
145
|
+
mandatory: false
|
|
146
|
+
});
|
|
141
147
|
}, {
|
|
142
148
|
noAck: true,
|
|
143
149
|
consumerTag: errorConsumerTag,
|
|
144
|
-
priority:
|
|
150
|
+
priority: 400
|
|
145
151
|
});
|
|
146
152
|
};
|
|
147
|
-
|
|
148
|
-
content
|
|
149
|
-
|
|
153
|
+
BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_, message) {
|
|
154
|
+
const content = message.content;
|
|
155
|
+
const {
|
|
156
|
+
executionId,
|
|
157
|
+
parent
|
|
158
|
+
} = this[kExecuteMessage].content;
|
|
150
159
|
const id = this.id,
|
|
151
|
-
executionId = this.executionId,
|
|
152
160
|
attachedTo = this.attachedTo;
|
|
153
161
|
this.activity.logger.debug(`<${executionId} (${id})> detach from activity <${attachedTo.id}>`);
|
|
154
162
|
this._stop(true);
|
|
@@ -170,6 +178,12 @@ proto._onDetachMessage = function onDetachMessage(_, {
|
|
|
170
178
|
}, {
|
|
171
179
|
cloneMessage: _messageHelper.cloneMessage
|
|
172
180
|
});
|
|
181
|
+
const detachContent = (0, _messageHelper.cloneContent)(content, {
|
|
182
|
+
executionId
|
|
183
|
+
});
|
|
184
|
+
detachContent.parent = parent;
|
|
185
|
+
this.activity.removeInboundListeners();
|
|
186
|
+
broker.publish('event', 'activity.detach', detachContent);
|
|
173
187
|
broker.subscribeOnce('execution', 'execute.bound.completed', (__, {
|
|
174
188
|
content: completeContent
|
|
175
189
|
}) => {
|
|
@@ -179,7 +193,7 @@ proto._onDetachMessage = function onDetachMessage(_, {
|
|
|
179
193
|
consumerTag: `_execution-completed-${executionId}`
|
|
180
194
|
});
|
|
181
195
|
};
|
|
182
|
-
|
|
196
|
+
BoundaryEventBehaviour.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
183
197
|
switch (message.properties.type) {
|
|
184
198
|
case 'discard':
|
|
185
199
|
case 'stop':
|
|
@@ -187,7 +201,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
187
201
|
break;
|
|
188
202
|
}
|
|
189
203
|
};
|
|
190
|
-
|
|
204
|
+
BoundaryEventBehaviour.prototype._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
191
205
|
if (this.cancelActivity) return;
|
|
192
206
|
const executeMessage = this[kExecuteMessage];
|
|
193
207
|
const repeat = message.content.repeat;
|
|
@@ -197,7 +211,7 @@ proto._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
|
197
211
|
repeat
|
|
198
212
|
}));
|
|
199
213
|
};
|
|
200
|
-
|
|
214
|
+
BoundaryEventBehaviour.prototype._stop = function stop(detach) {
|
|
201
215
|
const attachedTo = this.attachedTo,
|
|
202
216
|
broker = this.broker,
|
|
203
217
|
executionId = this.executionId;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.EndEventBehaviour = EndEventBehaviour;
|
|
7
7
|
exports.default = EndEvent;
|
|
8
|
-
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
9
|
-
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
10
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
|
|
9
|
+
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution.js"));
|
|
10
|
+
var _messageHelper = require("../messageHelper.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const kExecution = Symbol.for('execution');
|
|
13
13
|
function EndEvent(activityDef, context) {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.IntermediateCatchEventBehaviour = IntermediateCatchEventBehaviour;
|
|
7
7
|
exports.default = IntermediateCatchEvent;
|
|
8
|
-
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
9
|
-
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
10
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
|
|
9
|
+
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution.js"));
|
|
10
|
+
var _messageHelper = require("../messageHelper.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const kExecution = Symbol.for('execution');
|
|
13
13
|
function IntermediateCatchEvent(activityDef, context) {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.IntermediateThrowEventBehaviour = IntermediateThrowEventBehaviour;
|
|
7
7
|
exports.default = IntermediateThrowEvent;
|
|
8
|
-
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
9
|
-
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution"));
|
|
10
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
|
|
9
|
+
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution.js"));
|
|
10
|
+
var _messageHelper = require("../messageHelper.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
const kExecution = Symbol.for('execution');
|
|
13
13
|
function IntermediateThrowEvent(activityDef, context) {
|