bpmn-elements 6.0.1 → 8.0.1
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 +341 -0
- package/README.md +3 -0
- package/dist/index.js +52 -44
- package/dist/src/Api.js +77 -76
- package/dist/src/Context.js +176 -172
- package/dist/src/Environment.js +110 -102
- package/dist/src/EventBroker.js +89 -88
- package/dist/src/ExtensionsMapper.js +2 -2
- package/dist/src/MessageFormatter.js +164 -95
- package/dist/src/Scripts.js +6 -2
- package/dist/src/activity/Activity.js +1105 -916
- package/dist/src/activity/ActivityExecution.js +342 -297
- package/dist/src/activity/Dummy.js +3 -3
- package/dist/src/definition/Definition.js +498 -444
- package/dist/src/definition/DefinitionExecution.js +710 -408
- package/dist/src/error/Errors.js +17 -7
- package/dist/src/eventDefinitions/CancelEventDefinition.js +190 -150
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +194 -161
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +197 -135
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +207 -165
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +175 -141
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +157 -129
- package/dist/src/eventDefinitions/LinkEventDefinition.js +174 -149
- package/dist/src/eventDefinitions/MessageEventDefinition.js +213 -176
- package/dist/src/eventDefinitions/SignalEventDefinition.js +203 -161
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +21 -23
- package/dist/src/eventDefinitions/TimerEventDefinition.js +243 -228
- package/dist/src/events/BoundaryEvent.js +180 -144
- package/dist/src/events/EndEvent.js +18 -23
- package/dist/src/events/IntermediateCatchEvent.js +44 -58
- package/dist/src/events/IntermediateThrowEvent.js +18 -23
- package/dist/src/events/StartEvent.js +109 -94
- package/dist/src/flows/Association.js +94 -100
- package/dist/src/flows/MessageFlow.js +86 -103
- package/dist/src/flows/SequenceFlow.js +173 -182
- package/dist/src/gateways/EventBasedGateway.js +88 -84
- package/dist/src/gateways/ExclusiveGateway.js +13 -16
- package/dist/src/gateways/InclusiveGateway.js +11 -14
- package/dist/src/gateways/ParallelGateway.js +11 -14
- package/dist/src/getPropertyValue.js +34 -34
- package/dist/src/io/BpmnIO.js +17 -14
- package/dist/src/io/EnvironmentDataObject.js +33 -29
- package/dist/src/io/EnvironmentDataStore.js +33 -29
- package/dist/src/io/EnvironmentDataStoreReference.js +35 -31
- package/dist/src/io/InputOutputSpecification.js +177 -168
- package/dist/src/io/Properties.js +117 -124
- package/dist/src/messageHelper.js +1 -1
- package/dist/src/process/Process.js +439 -362
- package/dist/src/process/ProcessExecution.js +748 -646
- package/dist/src/shared.js +2 -2
- package/dist/src/tasks/CallActivity.js +160 -0
- package/dist/src/tasks/LoopCharacteristics.js +309 -330
- package/dist/src/tasks/ReceiveTask.js +233 -182
- package/dist/src/tasks/ScriptTask.js +35 -41
- package/dist/src/tasks/ServiceImplementation.js +13 -20
- package/dist/src/tasks/ServiceTask.js +82 -75
- package/dist/src/tasks/SignalTask.js +97 -93
- package/dist/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/dist/src/tasks/SubProcess.js +193 -175
- package/dist/src/tasks/Task.js +17 -19
- package/index.js +2 -0
- package/package.json +16 -16
- package/src/Api.js +65 -59
- package/src/Context.js +145 -140
- package/src/Environment.js +116 -100
- package/src/EventBroker.js +67 -68
- package/src/ExtensionsMapper.js +2 -2
- package/src/MessageFormatter.js +132 -74
- package/src/activity/Activity.js +914 -776
- package/src/activity/ActivityExecution.js +293 -247
- package/src/activity/Dummy.js +2 -2
- package/src/definition/Definition.js +437 -401
- package/src/definition/DefinitionExecution.js +598 -340
- package/src/error/Errors.js +11 -6
- package/src/eventDefinitions/CancelEventDefinition.js +164 -121
- package/src/eventDefinitions/CompensateEventDefinition.js +159 -124
- package/src/eventDefinitions/ConditionalEventDefinition.js +147 -104
- package/src/eventDefinitions/ErrorEventDefinition.js +190 -131
- package/src/eventDefinitions/EscalationEventDefinition.js +139 -101
- package/src/eventDefinitions/EventDefinitionExecution.js +127 -95
- package/src/eventDefinitions/LinkEventDefinition.js +160 -129
- package/src/eventDefinitions/MessageEventDefinition.js +178 -121
- package/src/eventDefinitions/SignalEventDefinition.js +162 -106
- package/src/eventDefinitions/TerminateEventDefinition.js +19 -19
- package/src/eventDefinitions/TimerEventDefinition.js +202 -167
- package/src/events/BoundaryEvent.js +156 -115
- package/src/events/EndEvent.js +15 -18
- package/src/events/IntermediateCatchEvent.js +40 -44
- package/src/events/IntermediateThrowEvent.js +15 -18
- package/src/events/StartEvent.js +84 -50
- package/src/flows/Association.js +98 -112
- package/src/flows/MessageFlow.js +81 -97
- package/src/flows/SequenceFlow.js +146 -160
- package/src/gateways/EventBasedGateway.js +75 -68
- package/src/gateways/ExclusiveGateway.js +8 -13
- package/src/gateways/InclusiveGateway.js +8 -13
- package/src/gateways/ParallelGateway.js +8 -13
- package/src/getPropertyValue.js +34 -33
- package/src/io/BpmnIO.js +20 -15
- package/src/io/EnvironmentDataObject.js +29 -18
- package/src/io/EnvironmentDataStore.js +29 -18
- package/src/io/EnvironmentDataStoreReference.js +31 -20
- package/src/io/InputOutputSpecification.js +154 -157
- package/src/io/Properties.js +95 -97
- package/src/process/Process.js +378 -333
- package/src/process/ProcessExecution.js +603 -553
- package/src/tasks/CallActivity.js +130 -0
- package/src/tasks/LoopCharacteristics.js +290 -289
- package/src/tasks/ReceiveTask.js +174 -107
- package/src/tasks/ScriptTask.js +27 -30
- package/src/tasks/ServiceImplementation.js +13 -18
- package/src/tasks/ServiceTask.js +67 -60
- package/src/tasks/SignalTask.js +77 -52
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +184 -157
- package/src/tasks/Task.js +15 -19
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = BoundaryEvent;
|
|
7
6
|
exports.BoundaryEventBehaviour = BoundaryEventBehaviour;
|
|
7
|
+
exports.default = BoundaryEvent;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
@@ -16,165 +16,201 @@ var _shared = require("../shared");
|
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
+
const kAttachedTags = Symbol.for('attachedConsumers');
|
|
20
|
+
const kCompleteContent = Symbol.for('completeContent');
|
|
21
|
+
const kExecuteMessage = Symbol.for('executeMessage');
|
|
22
|
+
const kExecution = Symbol.for('execution');
|
|
23
|
+
const kShovels = Symbol.for('shovels');
|
|
24
|
+
|
|
19
25
|
function BoundaryEvent(activityDef, context) {
|
|
20
|
-
return
|
|
26
|
+
return new _Activity.default(BoundaryEventBehaviour, activityDef, context);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
function BoundaryEventBehaviour(activity) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const attachedToId = attachedTo.id;
|
|
35
|
-
const cancelActivity = 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
36
|
-
const eventDefinitionExecution = eventDefinitions && (0, _EventDefinitionExecution.default)(activity, eventDefinitions, 'execute.bound.completed');
|
|
37
|
-
return {
|
|
38
|
-
id,
|
|
39
|
-
type,
|
|
40
|
-
attachedTo,
|
|
41
|
-
cancelActivity,
|
|
42
|
-
execute
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function execute(executeMessage) {
|
|
46
|
-
const executeContent = (0, _messageHelper.cloneContent)(executeMessage.content);
|
|
47
|
-
const {
|
|
48
|
-
isRootScope,
|
|
49
|
-
executionId,
|
|
50
|
-
inbound
|
|
51
|
-
} = executeContent;
|
|
52
|
-
let parentExecutionId, completeContent;
|
|
53
|
-
const errorConsumerTags = [];
|
|
54
|
-
const shovels = [];
|
|
55
|
-
|
|
56
|
-
if (isRootScope) {
|
|
57
|
-
parentExecutionId = executionId;
|
|
58
|
-
|
|
59
|
-
if (eventDefinitionExecution && !environment.settings.strict) {
|
|
60
|
-
broker.subscribeTmp('execution', 'execute.expect', onExpectMessage, {
|
|
61
|
-
noAck: true,
|
|
62
|
-
consumerTag: '_expect-tag'
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
attachedTo.broker.subscribeTmp('event', 'activity.leave', onAttachedLeave, {
|
|
67
|
-
noAck: true,
|
|
68
|
-
consumerTag: `_bound-listener-${parentExecutionId}`,
|
|
69
|
-
priority: 300
|
|
70
|
-
});
|
|
71
|
-
broker.subscribeOnce('execution', 'execute.detach', onDetachMessage, {
|
|
72
|
-
consumerTag: '_detach-tag'
|
|
73
|
-
});
|
|
74
|
-
broker.subscribeOnce('api', `activity.#.${parentExecutionId}`, onApiMessage, {
|
|
75
|
-
consumerTag: `_api-${parentExecutionId}`
|
|
76
|
-
});
|
|
77
|
-
broker.subscribeOnce('execution', 'execute.bound.completed', onCompleted, {
|
|
78
|
-
consumerTag: `_execution-completed-${parentExecutionId}`
|
|
79
|
-
});
|
|
80
|
-
}
|
|
30
|
+
this.id = activity.id;
|
|
31
|
+
this.type = activity.type;
|
|
32
|
+
this.attachedTo = activity.attachedTo;
|
|
33
|
+
this.activity = activity;
|
|
34
|
+
this.environment = activity.environment;
|
|
35
|
+
this.broker = activity.broker;
|
|
36
|
+
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions, 'execute.bound.completed');
|
|
37
|
+
this[kShovels] = [];
|
|
38
|
+
this[kAttachedTags] = [];
|
|
39
|
+
}
|
|
81
40
|
|
|
82
|
-
|
|
41
|
+
const proto = BoundaryEventBehaviour.prototype;
|
|
42
|
+
Object.defineProperty(proto, 'executionId', {
|
|
43
|
+
get() {
|
|
44
|
+
const message = this[kExecuteMessage];
|
|
45
|
+
return message && message.content.executionId;
|
|
46
|
+
}
|
|
83
47
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(message.content));
|
|
88
|
-
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(proto, 'cancelActivity', {
|
|
50
|
+
enumerable: true,
|
|
89
51
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
content: attachedToContent
|
|
95
|
-
}).discard();
|
|
96
|
-
}
|
|
52
|
+
get() {
|
|
53
|
+
const behaviour = this.activity.behaviour || {};
|
|
54
|
+
return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
|
|
55
|
+
}
|
|
97
56
|
|
|
98
|
-
|
|
99
|
-
if (message.content.id !== attachedToId) return;
|
|
100
|
-
stop();
|
|
101
|
-
if (!completeContent) return broker.publish('execution', 'execute.discard', executeContent);
|
|
102
|
-
return broker.publish('execution', 'execute.completed', completeContent);
|
|
103
|
-
}
|
|
57
|
+
});
|
|
104
58
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
priority: 300
|
|
112
|
-
});
|
|
113
|
-
}
|
|
59
|
+
proto.execute = function execute(executeMessage) {
|
|
60
|
+
const {
|
|
61
|
+
isRootScope,
|
|
62
|
+
executionId
|
|
63
|
+
} = executeMessage.content;
|
|
64
|
+
const eventDefinitionExecution = this[kExecution];
|
|
114
65
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
broker.publish('execution', routingKey, (0, _messageHelper.cloneContent)(message.content));
|
|
119
|
-
};
|
|
120
|
-
}
|
|
66
|
+
if (isRootScope) {
|
|
67
|
+
this[kExecuteMessage] = executeMessage;
|
|
68
|
+
const broker = this.broker;
|
|
121
69
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
stop(true);
|
|
127
|
-
const {
|
|
128
|
-
executionId: detachId,
|
|
129
|
-
bindExchange,
|
|
130
|
-
sourceExchange = 'execution',
|
|
131
|
-
sourcePattern
|
|
132
|
-
} = content;
|
|
133
|
-
const shovelName = `_detached-${(0, _shared.brokerSafeId)(id)}_${detachId}`;
|
|
134
|
-
shovels.push(shovelName);
|
|
135
|
-
attachedTo.broker.createShovel(shovelName, {
|
|
136
|
-
exchange: sourceExchange,
|
|
137
|
-
pattern: sourcePattern
|
|
138
|
-
}, {
|
|
139
|
-
broker,
|
|
140
|
-
exchange: bindExchange
|
|
141
|
-
}, {
|
|
142
|
-
cloneMessage: _messageHelper.cloneMessage
|
|
143
|
-
});
|
|
144
|
-
broker.subscribeOnce('execution', 'execute.bound.completed', onDetachedCompleted, {
|
|
145
|
-
consumerTag: `_execution-completed-${parentExecutionId}`
|
|
70
|
+
if (eventDefinitionExecution && !this.environment.settings.strict) {
|
|
71
|
+
broker.subscribeTmp('execution', 'execute.expect', this._onExpectMessage.bind(this), {
|
|
72
|
+
noAck: true,
|
|
73
|
+
consumerTag: '_expect-tag'
|
|
146
74
|
});
|
|
147
75
|
}
|
|
148
76
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
77
|
+
const consumerTag = `_bound-listener-${executionId}`;
|
|
78
|
+
this.attachedTo.broker.subscribeTmp('event', 'activity.leave', this._onAttachedLeave.bind(this), {
|
|
79
|
+
noAck: true,
|
|
80
|
+
consumerTag,
|
|
81
|
+
priority: 300
|
|
82
|
+
});
|
|
83
|
+
this[kAttachedTags].push(consumerTag);
|
|
84
|
+
broker.subscribeOnce('execution', 'execute.detach', this._onDetachMessage.bind(this), {
|
|
85
|
+
consumerTag: '_detach-tag'
|
|
86
|
+
});
|
|
87
|
+
broker.subscribeOnce('api', `activity.#.${executionId}`, this._onApiMessage.bind(this), {
|
|
88
|
+
consumerTag: `_api-${executionId}`
|
|
89
|
+
});
|
|
90
|
+
broker.subscribeOnce('execution', 'execute.bound.completed', this._onCompleted.bind(this), {
|
|
91
|
+
consumerTag: `_execution-completed-${executionId}`
|
|
92
|
+
});
|
|
93
|
+
}
|
|
153
94
|
|
|
154
|
-
|
|
155
|
-
|
|
95
|
+
if (eventDefinitionExecution) {
|
|
96
|
+
return eventDefinitionExecution.execute(executeMessage);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
156
99
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
100
|
+
proto._onCompleted = function onCompleted(_, {
|
|
101
|
+
content
|
|
102
|
+
}) {
|
|
103
|
+
if (!this.cancelActivity && !content.cancelActivity) {
|
|
104
|
+
this._stop();
|
|
161
105
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
106
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content));
|
|
107
|
+
}
|
|
167
108
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
109
|
+
this[kCompleteContent] = content;
|
|
110
|
+
const {
|
|
111
|
+
inbound
|
|
112
|
+
} = this[kExecuteMessage].content;
|
|
113
|
+
const attachedToContent = inbound && inbound[0];
|
|
114
|
+
const attachedTo = this.attachedTo;
|
|
115
|
+
this.activity.logger.debug(`<${this.executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
|
|
116
|
+
attachedTo.getApi({
|
|
117
|
+
content: attachedToContent
|
|
118
|
+
}).discard();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
proto._onAttachedLeave = function onAttachedLeave(_, {
|
|
122
|
+
content
|
|
123
|
+
}) {
|
|
124
|
+
if (content.id !== this.attachedTo.id) return;
|
|
125
|
+
|
|
126
|
+
this._stop();
|
|
127
|
+
|
|
128
|
+
const completeContent = this[kCompleteContent];
|
|
129
|
+
if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[kExecuteMessage].content);
|
|
130
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
proto._onExpectMessage = function onExpectMessage(_, {
|
|
134
|
+
content
|
|
135
|
+
}) {
|
|
136
|
+
const {
|
|
137
|
+
executionId,
|
|
138
|
+
expectRoutingKey
|
|
139
|
+
} = content;
|
|
140
|
+
const attachedTo = this.attachedTo;
|
|
141
|
+
const errorConsumerTag = `_bound-error-listener-${executionId}`;
|
|
142
|
+
this[kAttachedTags].push(errorConsumerTag);
|
|
143
|
+
attachedTo.broker.subscribeTmp('event', 'activity.error', (__, errorMessage) => {
|
|
144
|
+
if (errorMessage.content.id !== attachedTo.id) return;
|
|
145
|
+
this.broker.publish('execution', expectRoutingKey, (0, _messageHelper.cloneContent)(errorMessage.content));
|
|
146
|
+
}, {
|
|
147
|
+
noAck: true,
|
|
148
|
+
consumerTag: errorConsumerTag,
|
|
149
|
+
priority: 300
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
proto._onDetachMessage = function onDetachMessage(_, {
|
|
154
|
+
content
|
|
155
|
+
}) {
|
|
156
|
+
const id = this.id,
|
|
157
|
+
executionId = this.executionId,
|
|
158
|
+
attachedTo = this.attachedTo;
|
|
159
|
+
this.activity.logger.debug(`<${executionId} (${id})> detach from activity <${attachedTo.id}>`);
|
|
160
|
+
|
|
161
|
+
this._stop(true);
|
|
162
|
+
|
|
163
|
+
const {
|
|
164
|
+
executionId: detachId,
|
|
165
|
+
bindExchange,
|
|
166
|
+
sourceExchange,
|
|
167
|
+
sourcePattern
|
|
168
|
+
} = content;
|
|
169
|
+
const shovelName = `_detached-${(0, _shared.brokerSafeId)(id)}_${detachId}`;
|
|
170
|
+
this[kShovels].push(shovelName);
|
|
171
|
+
const broker = this.broker;
|
|
172
|
+
attachedTo.broker.createShovel(shovelName, {
|
|
173
|
+
exchange: sourceExchange,
|
|
174
|
+
pattern: sourcePattern
|
|
175
|
+
}, {
|
|
176
|
+
broker,
|
|
177
|
+
exchange: bindExchange
|
|
178
|
+
}, {
|
|
179
|
+
cloneMessage: _messageHelper.cloneMessage
|
|
180
|
+
});
|
|
181
|
+
broker.subscribeOnce('execution', 'execute.bound.completed', (__, {
|
|
182
|
+
content: completeContent
|
|
183
|
+
}) => {
|
|
184
|
+
this._stop();
|
|
185
|
+
|
|
186
|
+
this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
|
|
187
|
+
}, {
|
|
188
|
+
consumerTag: `_execution-completed-${executionId}`
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
proto._onApiMessage = function onApiMessage(_, message) {
|
|
193
|
+
switch (message.properties.type) {
|
|
194
|
+
case 'discard':
|
|
195
|
+
case 'stop':
|
|
196
|
+
this._stop();
|
|
197
|
+
|
|
198
|
+
break;
|
|
179
199
|
}
|
|
180
|
-
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
proto._stop = function stop(detach) {
|
|
203
|
+
const attachedTo = this.attachedTo,
|
|
204
|
+
broker = this.broker,
|
|
205
|
+
executionId = this.executionId;
|
|
206
|
+
|
|
207
|
+
for (const tag of this[kAttachedTags].splice(0)) attachedTo.broker.cancel(tag);
|
|
208
|
+
|
|
209
|
+
for (const shovelName of this[kShovels].splice(0)) attachedTo.broker.closeShovel(shovelName);
|
|
210
|
+
|
|
211
|
+
broker.cancel('_expect-tag');
|
|
212
|
+
broker.cancel('_detach-tag');
|
|
213
|
+
broker.cancel(`_execution-completed-${executionId}`);
|
|
214
|
+
if (detach) return;
|
|
215
|
+
broker.cancel(`_api-${executionId}`);
|
|
216
|
+
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = EndEvent;
|
|
7
6
|
exports.EndEventBehaviour = EndEventBehaviour;
|
|
7
|
+
exports.default = EndEvent;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
@@ -14,32 +14,27 @@ var _messageHelper = require("../messageHelper");
|
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
|
|
17
|
+
const kExecution = Symbol.for('execution');
|
|
18
|
+
|
|
17
19
|
function EndEvent(activityDef, context) {
|
|
18
|
-
return
|
|
20
|
+
return new _Activity.default(EndEventBehaviour, { ...activityDef,
|
|
19
21
|
isThrowing: true
|
|
20
22
|
}, context);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function EndEventBehaviour(activity) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
execute
|
|
35
|
-
};
|
|
36
|
-
return source;
|
|
37
|
-
|
|
38
|
-
function execute(executeMessage) {
|
|
39
|
-
if (eventDefinitionExecution) {
|
|
40
|
-
return eventDefinitionExecution.execute(executeMessage);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
26
|
+
this.id = activity.id;
|
|
27
|
+
this.type = activity.type;
|
|
28
|
+
this.broker = activity.broker;
|
|
29
|
+
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
EndEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
33
|
+
const execution = this[kExecution];
|
|
34
|
+
|
|
35
|
+
if (execution) {
|
|
36
|
+
return execution.execute(executeMessage);
|
|
44
37
|
}
|
|
45
|
-
|
|
38
|
+
|
|
39
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
40
|
+
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = IntermediateCatchEvent;
|
|
7
6
|
exports.IntermediateCatchEventBehaviour = IntermediateCatchEventBehaviour;
|
|
7
|
+
exports.default = IntermediateCatchEvent;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
@@ -14,72 +14,58 @@ var _messageHelper = require("../messageHelper");
|
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
|
|
17
|
+
const kExecution = Symbol.for('execution');
|
|
18
|
+
|
|
17
19
|
function IntermediateCatchEvent(activityDef, context) {
|
|
18
|
-
return
|
|
20
|
+
return new _Activity.default(IntermediateCatchEventBehaviour, activityDef, context);
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
function IntermediateCatchEventBehaviour(activity) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = activity;
|
|
28
|
-
const eventDefinitionExecution = eventDefinitions && (0, _EventDefinitionExecution.default)(activity, eventDefinitions);
|
|
29
|
-
const source = {
|
|
30
|
-
id,
|
|
31
|
-
type,
|
|
32
|
-
execute
|
|
33
|
-
};
|
|
34
|
-
return source;
|
|
35
|
-
|
|
36
|
-
function execute(executeMessage) {
|
|
37
|
-
if (eventDefinitionExecution) {
|
|
38
|
-
return eventDefinitionExecution.execute(executeMessage);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const content = (0, _messageHelper.cloneContent)(executeMessage.content);
|
|
42
|
-
const {
|
|
43
|
-
executionId
|
|
44
|
-
} = content;
|
|
45
|
-
broker.subscribeTmp('api', `activity.#.${executionId}`, onApiMessage, {
|
|
46
|
-
noAck: true,
|
|
47
|
-
consumerTag: `_api-${executionId}`
|
|
48
|
-
});
|
|
49
|
-
return broker.publish('event', 'activity.wait', (0, _messageHelper.cloneContent)(content));
|
|
24
|
+
this.id = activity.id;
|
|
25
|
+
this.type = activity.type;
|
|
26
|
+
this.broker = activity.broker;
|
|
27
|
+
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
28
|
+
}
|
|
50
29
|
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
IntermediateCatchEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
31
|
+
const execution = this[kExecution];
|
|
53
32
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
return complete(message.content.message);
|
|
59
|
-
}
|
|
33
|
+
if (execution) {
|
|
34
|
+
return execution.execute(executeMessage);
|
|
35
|
+
}
|
|
60
36
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
const executeContent = executeMessage.content;
|
|
38
|
+
const executionId = executeContent.executionId;
|
|
39
|
+
const broker = this.broker;
|
|
40
|
+
broker.subscribeTmp('api', `activity.#.${executionId}`, this._onApiMessage.bind(this, executeMessage), {
|
|
41
|
+
noAck: true,
|
|
42
|
+
consumerTag: '_api-behaviour-execution'
|
|
43
|
+
});
|
|
44
|
+
return broker.publish('event', 'activity.wait', (0, _messageHelper.cloneContent)(executeContent));
|
|
45
|
+
};
|
|
66
46
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
47
|
+
IntermediateCatchEventBehaviour.prototype._onApiMessage = function onApiMessage(executeMessage, routingKey, message) {
|
|
48
|
+
switch (message.properties.type) {
|
|
49
|
+
case 'message':
|
|
50
|
+
case 'signal':
|
|
51
|
+
{
|
|
52
|
+
const broker = this.broker;
|
|
53
|
+
broker.cancel('_api-behaviour-execution');
|
|
54
|
+
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content, {
|
|
55
|
+
output: message.content.message
|
|
56
|
+
}));
|
|
71
57
|
}
|
|
72
|
-
}
|
|
73
58
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
case 'discard':
|
|
60
|
+
{
|
|
61
|
+
const broker = this.broker;
|
|
62
|
+
broker.cancel('_api-behaviour-execution');
|
|
63
|
+
return broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
64
|
+
}
|
|
80
65
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
case 'stop':
|
|
67
|
+
{
|
|
68
|
+
return this.broker.cancel('_api-behaviour-execution');
|
|
69
|
+
}
|
|
84
70
|
}
|
|
85
|
-
}
|
|
71
|
+
};
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = IntermediateThrowEvent;
|
|
7
6
|
exports.IntermediateThrowEventBehaviour = IntermediateThrowEventBehaviour;
|
|
7
|
+
exports.default = IntermediateThrowEvent;
|
|
8
8
|
|
|
9
9
|
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
10
|
|
|
@@ -14,32 +14,27 @@ var _messageHelper = require("../messageHelper");
|
|
|
14
14
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
|
|
17
|
+
const kExecution = Symbol.for('execution');
|
|
18
|
+
|
|
17
19
|
function IntermediateThrowEvent(activityDef, context) {
|
|
18
|
-
return
|
|
20
|
+
return new _Activity.default(IntermediateThrowEventBehaviour, { ...activityDef,
|
|
19
21
|
isThrowing: true
|
|
20
22
|
}, context);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
function IntermediateThrowEventBehaviour(activity) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
execute
|
|
35
|
-
};
|
|
36
|
-
return source;
|
|
37
|
-
|
|
38
|
-
function execute(executeMessage) {
|
|
39
|
-
if (eventDefinitionExecution) {
|
|
40
|
-
return eventDefinitionExecution.execute(executeMessage);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
26
|
+
this.id = activity.id;
|
|
27
|
+
this.type = activity.type;
|
|
28
|
+
this.broker = activity.broker;
|
|
29
|
+
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
IntermediateThrowEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
33
|
+
const execution = this[kExecution];
|
|
34
|
+
|
|
35
|
+
if (execution) {
|
|
36
|
+
return execution.execute(executeMessage);
|
|
44
37
|
}
|
|
45
|
-
|
|
38
|
+
|
|
39
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
|
|
40
|
+
};
|