bpmn-elements 8.2.3 → 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} +8 -2
- 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 +55 -48
- 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 +31 -31
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +5 -2
- 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 +55 -49
- 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
|
@@ -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,7 +96,7 @@ 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
102
|
if (!this.cancelActivity && !content.cancelActivity) {
|
|
@@ -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,7 +124,7 @@ 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 {
|
|
@@ -144,7 +143,7 @@ proto._onExpectMessage = function onExpectMessage(_, {
|
|
|
144
143
|
priority: 300
|
|
145
144
|
});
|
|
146
145
|
};
|
|
147
|
-
|
|
146
|
+
BoundaryEventBehaviour.prototype._onDetachMessage = function onDetachMessage(_, {
|
|
148
147
|
content
|
|
149
148
|
}) {
|
|
150
149
|
const id = this.id,
|
|
@@ -179,7 +178,7 @@ proto._onDetachMessage = function onDetachMessage(_, {
|
|
|
179
178
|
consumerTag: `_execution-completed-${executionId}`
|
|
180
179
|
});
|
|
181
180
|
};
|
|
182
|
-
|
|
181
|
+
BoundaryEventBehaviour.prototype._onApiMessage = function onApiMessage(_, message) {
|
|
183
182
|
switch (message.properties.type) {
|
|
184
183
|
case 'discard':
|
|
185
184
|
case 'stop':
|
|
@@ -187,7 +186,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
|
|
|
187
186
|
break;
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
|
-
|
|
189
|
+
BoundaryEventBehaviour.prototype._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
191
190
|
if (this.cancelActivity) return;
|
|
192
191
|
const executeMessage = this[kExecuteMessage];
|
|
193
192
|
const repeat = message.content.repeat;
|
|
@@ -197,7 +196,7 @@ proto._onRepeatMessage = function onRepeatMessage(_, message) {
|
|
|
197
196
|
repeat
|
|
198
197
|
}));
|
|
199
198
|
};
|
|
200
|
-
|
|
199
|
+
BoundaryEventBehaviour.prototype._stop = function stop(detach) {
|
|
201
200
|
const attachedTo = this.attachedTo,
|
|
202
201
|
broker = this.broker,
|
|
203
202
|
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) {
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.StartEventBehaviour = StartEventBehaviour;
|
|
7
7
|
exports.default = StartEvent;
|
|
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 kExecuteMessage = Symbol.for('executeMessage');
|
|
13
13
|
const kExecution = Symbol.for('execution');
|
|
@@ -21,14 +21,13 @@ function StartEventBehaviour(activity) {
|
|
|
21
21
|
this.broker = activity.broker;
|
|
22
22
|
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(proto, 'executionId', {
|
|
24
|
+
Object.defineProperty(StartEventBehaviour.prototype, 'executionId', {
|
|
26
25
|
get() {
|
|
27
26
|
const message = this[kExecuteMessage];
|
|
28
27
|
return message && message.content.executionId;
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
|
-
|
|
30
|
+
StartEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
32
31
|
const execution = this[kExecution];
|
|
33
32
|
if (execution) {
|
|
34
33
|
return execution.execute(executeMessage);
|
|
@@ -55,7 +54,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
55
54
|
state: 'wait'
|
|
56
55
|
});
|
|
57
56
|
};
|
|
58
|
-
|
|
57
|
+
StartEventBehaviour.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
59
58
|
const {
|
|
60
59
|
type: messageType,
|
|
61
60
|
correlationId
|
|
@@ -84,7 +83,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
|
|
86
|
+
StartEventBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, message) {
|
|
88
87
|
if (!message.properties.delegate) return;
|
|
89
88
|
const content = message.content;
|
|
90
89
|
if (!content.message) return;
|
|
@@ -108,7 +107,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
|
|
|
108
107
|
});
|
|
109
108
|
return this._onApiMessage(routingKey, message);
|
|
110
109
|
};
|
|
111
|
-
|
|
110
|
+
StartEventBehaviour.prototype._stop = function stop() {
|
|
112
111
|
const broker = this.broker,
|
|
113
112
|
executionId = this.executionId;
|
|
114
113
|
broker.cancel(`_api-${executionId}`);
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Association;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
-
var _EventBroker = require("../EventBroker");
|
|
9
|
-
var _Api = require("../Api");
|
|
10
|
-
var _shared = require("../shared");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
|
+
var _EventBroker = require("../EventBroker.js");
|
|
9
|
+
var _Api = require("../Api.js");
|
|
10
|
+
var _shared = require("../shared.js");
|
|
11
11
|
const kCounters = Symbol.for('counters');
|
|
12
12
|
function Association(associationDef, {
|
|
13
13
|
environment
|
|
@@ -52,8 +52,7 @@ function Association(associationDef, {
|
|
|
52
52
|
this.waitFor = waitFor;
|
|
53
53
|
logger.debug(`<${id}> init, <${sourceId}> -> <${targetId}>`);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
Object.defineProperty(proto, 'counters', {
|
|
55
|
+
Object.defineProperty(Association.prototype, 'counters', {
|
|
57
56
|
enumerable: true,
|
|
58
57
|
get() {
|
|
59
58
|
return {
|
|
@@ -61,43 +60,43 @@ Object.defineProperty(proto, 'counters', {
|
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
|
-
|
|
63
|
+
Association.prototype.take = function take(content = {}) {
|
|
65
64
|
this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
|
|
66
65
|
++this[kCounters].take;
|
|
67
66
|
this._publishEvent('take', content);
|
|
68
67
|
return true;
|
|
69
68
|
};
|
|
70
|
-
|
|
69
|
+
Association.prototype.discard = function discard(content = {}) {
|
|
71
70
|
this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
|
|
72
71
|
++this[kCounters].discard;
|
|
73
72
|
this._publishEvent('discard', content);
|
|
74
73
|
return true;
|
|
75
74
|
};
|
|
76
|
-
|
|
75
|
+
Association.prototype.complete = function complete(content = {}) {
|
|
77
76
|
this.logger.debug(`<${this.id}> completed target <${this.targetId}>`);
|
|
78
77
|
++this[kCounters].complete;
|
|
79
78
|
this._publishEvent('complete', content);
|
|
80
79
|
return true;
|
|
81
80
|
};
|
|
82
|
-
|
|
81
|
+
Association.prototype.getState = function getState() {
|
|
83
82
|
return this._createMessageContent({
|
|
84
83
|
counters: this.counters,
|
|
85
84
|
broker: this.broker.getState(true)
|
|
86
85
|
});
|
|
87
86
|
};
|
|
88
|
-
|
|
87
|
+
Association.prototype.recover = function recover(state) {
|
|
89
88
|
Object.assign(this[kCounters], state.counters);
|
|
90
89
|
this.broker.recover(state.broker);
|
|
91
90
|
};
|
|
92
|
-
|
|
93
|
-
return
|
|
91
|
+
Association.prototype.getApi = function getApi(message) {
|
|
92
|
+
return new _Api.Api('association', this.broker, message || {
|
|
94
93
|
content: this._createMessageContent()
|
|
95
94
|
});
|
|
96
95
|
};
|
|
97
|
-
|
|
96
|
+
Association.prototype.stop = function stop() {
|
|
98
97
|
this.broker.stop();
|
|
99
98
|
};
|
|
100
|
-
|
|
99
|
+
Association.prototype._publishEvent = function publishEvent(action, content) {
|
|
101
100
|
const eventContent = this._createMessageContent({
|
|
102
101
|
action,
|
|
103
102
|
message: content,
|
|
@@ -107,7 +106,7 @@ proto._publishEvent = function publishEvent(action, content) {
|
|
|
107
106
|
type: action
|
|
108
107
|
});
|
|
109
108
|
};
|
|
110
|
-
|
|
109
|
+
Association.prototype._createMessageContent = function createMessageContent(override) {
|
|
111
110
|
return {
|
|
112
111
|
...override,
|
|
113
112
|
id: this.id,
|