bpmn-elements 8.2.4 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +1 -1
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/{src/activity → activity}/Activity.js +62 -63
- package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +41 -42
- package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +15 -16
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +15 -16
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +39 -40
- package/dist/{src/process → process}/ProcessExecution.js +42 -43
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +30 -30
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +1 -1
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/activity/Activity.js +62 -64
- package/src/activity/ActivityExecution.js +23 -25
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +41 -43
- package/src/definition/DefinitionExecution.js +45 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +12 -14
- package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
- package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
- package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +15 -17
- package/src/events/EndEvent.js +3 -3
- package/src/events/IntermediateCatchEvent.js +3 -3
- package/src/events/IntermediateThrowEvent.js +3 -3
- package/src/events/StartEvent.js +8 -10
- package/src/flows/Association.js +15 -17
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +2 -2
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +39 -41
- package/src/process/ProcessExecution.js +42 -44
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +17 -19
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +491 -0
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /package/dist/{src/shared.js → shared.js} +0 -0
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _ActivityExecution = _interopRequireDefault(require("./ActivityExecution"));
|
|
8
|
-
var _shared = require("../shared");
|
|
9
|
-
var _Api = require("../Api");
|
|
10
|
-
var _EventBroker = require("../EventBroker");
|
|
11
|
-
var _MessageFormatter = require("../MessageFormatter");
|
|
12
|
-
var _messageHelper = require("../messageHelper");
|
|
13
|
-
var _Errors = require("../error/Errors");
|
|
7
|
+
var _ActivityExecution = _interopRequireDefault(require("./ActivityExecution.js"));
|
|
8
|
+
var _shared = require("../shared.js");
|
|
9
|
+
var _Api = require("../Api.js");
|
|
10
|
+
var _EventBroker = require("../EventBroker.js");
|
|
11
|
+
var _MessageFormatter = require("../MessageFormatter.js");
|
|
12
|
+
var _messageHelper = require("../messageHelper.js");
|
|
13
|
+
var _Errors = require("../error/Errors.js");
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
const kActivityDef = Symbol.for('activityDefinition');
|
|
16
16
|
const kConsuming = Symbol.for('consuming');
|
|
@@ -129,8 +129,7 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
129
129
|
this[kEventDefinitions] = eventDefinitions && eventDefinitions.map(ed => new ed.Behaviour(this, ed, this.context));
|
|
130
130
|
this[kExtensions] = context.loadExtensions(this);
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
Object.defineProperty(proto, 'counters', {
|
|
132
|
+
Object.defineProperty(Activity.prototype, 'counters', {
|
|
134
133
|
enumerable: true,
|
|
135
134
|
get() {
|
|
136
135
|
return {
|
|
@@ -138,32 +137,32 @@ Object.defineProperty(proto, 'counters', {
|
|
|
138
137
|
};
|
|
139
138
|
}
|
|
140
139
|
});
|
|
141
|
-
Object.defineProperty(
|
|
140
|
+
Object.defineProperty(Activity.prototype, 'execution', {
|
|
142
141
|
enumerable: true,
|
|
143
142
|
get() {
|
|
144
143
|
return this[kExec].execution;
|
|
145
144
|
}
|
|
146
145
|
});
|
|
147
|
-
Object.defineProperty(
|
|
146
|
+
Object.defineProperty(Activity.prototype, 'executionId', {
|
|
148
147
|
enumerable: true,
|
|
149
148
|
get() {
|
|
150
149
|
return this[kExec].executionId;
|
|
151
150
|
}
|
|
152
151
|
});
|
|
153
|
-
Object.defineProperty(
|
|
152
|
+
Object.defineProperty(Activity.prototype, 'extensions', {
|
|
154
153
|
enumerable: true,
|
|
155
154
|
get() {
|
|
156
155
|
return this[kExtensions];
|
|
157
156
|
}
|
|
158
157
|
});
|
|
159
|
-
Object.defineProperty(
|
|
158
|
+
Object.defineProperty(Activity.prototype, 'bpmnIo', {
|
|
160
159
|
enumerable: true,
|
|
161
160
|
get() {
|
|
162
161
|
const extensions = this[kExtensions];
|
|
163
162
|
return extensions && extensions.extensions.find(e => e.type === 'bpmnio');
|
|
164
163
|
}
|
|
165
164
|
});
|
|
166
|
-
Object.defineProperty(
|
|
165
|
+
Object.defineProperty(Activity.prototype, 'formatter', {
|
|
167
166
|
enumerable: true,
|
|
168
167
|
get() {
|
|
169
168
|
let formatter = this[kFormatter];
|
|
@@ -177,68 +176,68 @@ Object.defineProperty(proto, 'formatter', {
|
|
|
177
176
|
return formatter;
|
|
178
177
|
}
|
|
179
178
|
});
|
|
180
|
-
Object.defineProperty(
|
|
179
|
+
Object.defineProperty(Activity.prototype, 'isRunning', {
|
|
181
180
|
enumerable: true,
|
|
182
181
|
get() {
|
|
183
182
|
if (!this[kConsuming]) return false;
|
|
184
183
|
return !!this.status;
|
|
185
184
|
}
|
|
186
185
|
});
|
|
187
|
-
Object.defineProperty(
|
|
186
|
+
Object.defineProperty(Activity.prototype, 'outbound', {
|
|
188
187
|
enumerable: true,
|
|
189
188
|
get() {
|
|
190
189
|
return this[kFlows].outboundSequenceFlows;
|
|
191
190
|
}
|
|
192
191
|
});
|
|
193
|
-
Object.defineProperty(
|
|
192
|
+
Object.defineProperty(Activity.prototype, 'inbound', {
|
|
194
193
|
enumerable: true,
|
|
195
194
|
get() {
|
|
196
195
|
return this[kFlows].inboundSequenceFlows;
|
|
197
196
|
}
|
|
198
197
|
});
|
|
199
|
-
Object.defineProperty(
|
|
198
|
+
Object.defineProperty(Activity.prototype, 'isEnd', {
|
|
200
199
|
enumerable: true,
|
|
201
200
|
get() {
|
|
202
201
|
return this[kFlags].isEnd;
|
|
203
202
|
}
|
|
204
203
|
});
|
|
205
|
-
Object.defineProperty(
|
|
204
|
+
Object.defineProperty(Activity.prototype, 'isStart', {
|
|
206
205
|
enumerable: true,
|
|
207
206
|
get() {
|
|
208
207
|
return this[kFlags].isStart;
|
|
209
208
|
}
|
|
210
209
|
});
|
|
211
|
-
Object.defineProperty(
|
|
210
|
+
Object.defineProperty(Activity.prototype, 'isSubProcess', {
|
|
212
211
|
enumerable: true,
|
|
213
212
|
get() {
|
|
214
213
|
return this[kFlags].isSubProcess;
|
|
215
214
|
}
|
|
216
215
|
});
|
|
217
|
-
Object.defineProperty(
|
|
216
|
+
Object.defineProperty(Activity.prototype, 'isMultiInstance', {
|
|
218
217
|
enumerable: true,
|
|
219
218
|
get() {
|
|
220
219
|
return this[kFlags].isMultiInstance;
|
|
221
220
|
}
|
|
222
221
|
});
|
|
223
|
-
Object.defineProperty(
|
|
222
|
+
Object.defineProperty(Activity.prototype, 'isThrowing', {
|
|
224
223
|
enumerable: true,
|
|
225
224
|
get() {
|
|
226
225
|
return this[kFlags].isThrowing;
|
|
227
226
|
}
|
|
228
227
|
});
|
|
229
|
-
Object.defineProperty(
|
|
228
|
+
Object.defineProperty(Activity.prototype, 'isForCompensation', {
|
|
230
229
|
enumerable: true,
|
|
231
230
|
get() {
|
|
232
231
|
return this[kFlags].isForCompensation;
|
|
233
232
|
}
|
|
234
233
|
});
|
|
235
|
-
Object.defineProperty(
|
|
234
|
+
Object.defineProperty(Activity.prototype, 'triggeredByEvent', {
|
|
236
235
|
enumerable: true,
|
|
237
236
|
get() {
|
|
238
237
|
return this[kActivityDef].triggeredByEvent;
|
|
239
238
|
}
|
|
240
239
|
});
|
|
241
|
-
Object.defineProperty(
|
|
240
|
+
Object.defineProperty(Activity.prototype, 'attachedTo', {
|
|
242
241
|
enumerable: true,
|
|
243
242
|
get() {
|
|
244
243
|
const attachedToId = this[kFlags].attachedTo;
|
|
@@ -246,22 +245,22 @@ Object.defineProperty(proto, 'attachedTo', {
|
|
|
246
245
|
return this.getActivityById(attachedToId);
|
|
247
246
|
}
|
|
248
247
|
});
|
|
249
|
-
Object.defineProperty(
|
|
248
|
+
Object.defineProperty(Activity.prototype, 'eventDefinitions', {
|
|
250
249
|
enumerable: true,
|
|
251
250
|
get() {
|
|
252
251
|
return this[kEventDefinitions];
|
|
253
252
|
}
|
|
254
253
|
});
|
|
255
|
-
|
|
254
|
+
Activity.prototype.activate = function activate() {
|
|
256
255
|
if (this[kFlags].isForCompensation) return;
|
|
257
256
|
return this._consumeInbound();
|
|
258
257
|
};
|
|
259
|
-
|
|
258
|
+
Activity.prototype.deactivate = function deactivate() {
|
|
260
259
|
const broker = this.broker;
|
|
261
260
|
broker.cancel('_run-on-inbound');
|
|
262
261
|
broker.cancel('_format-consumer');
|
|
263
262
|
};
|
|
264
|
-
|
|
263
|
+
Activity.prototype.init = function init(initContent) {
|
|
265
264
|
const id = this.id;
|
|
266
265
|
const exec = this[kExec];
|
|
267
266
|
const executionId = exec.initExecutionId = exec.initExecutionId || (0, _shared.getUniqueId)(id);
|
|
@@ -271,7 +270,7 @@ proto.init = function init(initContent) {
|
|
|
271
270
|
executionId
|
|
272
271
|
}));
|
|
273
272
|
};
|
|
274
|
-
|
|
273
|
+
Activity.prototype.run = function run(runContent) {
|
|
275
274
|
const id = this.id;
|
|
276
275
|
if (this.isRunning) throw new Error(`activity <${id}> is already running`);
|
|
277
276
|
const exec = this[kExec];
|
|
@@ -287,7 +286,7 @@ proto.run = function run(runContent) {
|
|
|
287
286
|
broker.publish('run', 'run.start', (0, _messageHelper.cloneContent)(content));
|
|
288
287
|
this._consumeRunQ();
|
|
289
288
|
};
|
|
290
|
-
|
|
289
|
+
Activity.prototype.recover = function recover(state) {
|
|
291
290
|
if (this.isRunning) throw new Error(`cannot recover running activity <${this.id}>`);
|
|
292
291
|
if (!state) return;
|
|
293
292
|
this.stopped = state.stopped;
|
|
@@ -304,7 +303,7 @@ proto.recover = function recover(state) {
|
|
|
304
303
|
this.broker.recover(state.broker);
|
|
305
304
|
return this;
|
|
306
305
|
};
|
|
307
|
-
|
|
306
|
+
Activity.prototype.resume = function resume() {
|
|
308
307
|
if (this[kConsuming]) {
|
|
309
308
|
throw new Error(`cannot resume running activity <${this.id}>`);
|
|
310
309
|
}
|
|
@@ -317,7 +316,7 @@ proto.resume = function resume() {
|
|
|
317
316
|
});
|
|
318
317
|
this._consumeRunQ();
|
|
319
318
|
};
|
|
320
|
-
|
|
319
|
+
Activity.prototype.discard = function discard(discardContent) {
|
|
321
320
|
if (!this.status) return this._runDiscard(discardContent);
|
|
322
321
|
const execution = this[kExec].execution;
|
|
323
322
|
if (execution && !execution.completed) return execution.discard();
|
|
@@ -327,11 +326,11 @@ proto.discard = function discard(discardContent) {
|
|
|
327
326
|
broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(this[kStateMessage].content));
|
|
328
327
|
this._consumeRunQ();
|
|
329
328
|
};
|
|
330
|
-
|
|
329
|
+
Activity.prototype.stop = function stop() {
|
|
331
330
|
if (!this[kConsuming]) return;
|
|
332
331
|
return this.getApi().stop();
|
|
333
332
|
};
|
|
334
|
-
|
|
333
|
+
Activity.prototype.next = function next() {
|
|
335
334
|
if (!this.environment.settings.step) return;
|
|
336
335
|
const stateMessage = this[kStateMessage];
|
|
337
336
|
if (!stateMessage) return;
|
|
@@ -341,15 +340,15 @@ proto.next = function next() {
|
|
|
341
340
|
stateMessage.ack();
|
|
342
341
|
return current;
|
|
343
342
|
};
|
|
344
|
-
|
|
343
|
+
Activity.prototype.shake = function shake() {
|
|
345
344
|
this._shakeOutbound({
|
|
346
345
|
content: this._createMessage()
|
|
347
346
|
});
|
|
348
347
|
};
|
|
349
|
-
|
|
348
|
+
Activity.prototype.evaluateOutbound = function evaluateOutbound(fromMessage, discardRestAtTake, callback) {
|
|
350
349
|
return this[kFlows].outboundEvaluator.evaluate(fromMessage, discardRestAtTake, callback);
|
|
351
350
|
};
|
|
352
|
-
|
|
351
|
+
Activity.prototype.getState = function getState() {
|
|
353
352
|
const msg = this._createMessage();
|
|
354
353
|
const exec = this[kExec];
|
|
355
354
|
return {
|
|
@@ -364,15 +363,15 @@ proto.getState = function getState() {
|
|
|
364
363
|
execution: exec.execution && exec.execution.getState()
|
|
365
364
|
};
|
|
366
365
|
};
|
|
367
|
-
|
|
366
|
+
Activity.prototype.getApi = function getApi(message) {
|
|
368
367
|
const execution = this[kExec].execution;
|
|
369
368
|
if (execution && !execution.completed) return execution.getApi(message);
|
|
370
369
|
return (0, _Api.ActivityApi)(this.broker, message || this[kStateMessage]);
|
|
371
370
|
};
|
|
372
|
-
|
|
371
|
+
Activity.prototype.getActivityById = function getActivityById(elementId) {
|
|
373
372
|
return this.context.getActivityById(elementId);
|
|
374
373
|
};
|
|
375
|
-
|
|
374
|
+
Activity.prototype._runDiscard = function runDiscard(discardContent) {
|
|
376
375
|
const exec = this[kExec];
|
|
377
376
|
const executionId = exec.executionId = exec.initExecutionId || (0, _shared.getUniqueId)(this.id);
|
|
378
377
|
exec.initExecutionId = null;
|
|
@@ -384,7 +383,7 @@ proto._runDiscard = function runDiscard(discardContent) {
|
|
|
384
383
|
this.broker.publish('run', 'run.discard', content);
|
|
385
384
|
this._consumeRunQ();
|
|
386
385
|
};
|
|
387
|
-
|
|
386
|
+
Activity.prototype._discardRun = function discardRun() {
|
|
388
387
|
const status = this.status;
|
|
389
388
|
if (!status) return;
|
|
390
389
|
const execution = this[kExec].execution;
|
|
@@ -403,7 +402,7 @@ proto._discardRun = function discardRun() {
|
|
|
403
402
|
broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(message.content));
|
|
404
403
|
this._consumeRunQ();
|
|
405
404
|
};
|
|
406
|
-
|
|
405
|
+
Activity.prototype._shakeOutbound = function shakeOutbound(sourceMessage) {
|
|
407
406
|
const message = (0, _messageHelper.cloneMessage)(sourceMessage);
|
|
408
407
|
message.content.sequence = message.content.sequence || [];
|
|
409
408
|
message.content.sequence.push({
|
|
@@ -423,7 +422,7 @@ proto._shakeOutbound = function shakeOutbound(sourceMessage) {
|
|
|
423
422
|
}
|
|
424
423
|
for (const flow of this[kFlows].outboundSequenceFlows) flow.shake(message);
|
|
425
424
|
};
|
|
426
|
-
|
|
425
|
+
Activity.prototype._consumeInbound = function consumeInbound() {
|
|
427
426
|
if (this.status) return;
|
|
428
427
|
const inboundQ = this.broker.getQueue('inbound-q');
|
|
429
428
|
if (this[kFlags].isParallelJoin) {
|
|
@@ -436,7 +435,7 @@ proto._consumeInbound = function consumeInbound() {
|
|
|
436
435
|
consumerTag: '_run-on-inbound'
|
|
437
436
|
});
|
|
438
437
|
};
|
|
439
|
-
|
|
438
|
+
Activity.prototype._onInbound = function onInbound(routingKey, message) {
|
|
440
439
|
message.ack();
|
|
441
440
|
const id = this.id;
|
|
442
441
|
const broker = this.broker;
|
|
@@ -473,7 +472,7 @@ proto._onInbound = function onInbound(routingKey, message) {
|
|
|
473
472
|
}
|
|
474
473
|
}
|
|
475
474
|
};
|
|
476
|
-
|
|
475
|
+
Activity.prototype._onJoinInbound = function onJoinInbound(routingKey, message) {
|
|
477
476
|
const {
|
|
478
477
|
content
|
|
479
478
|
} = message;
|
|
@@ -516,7 +515,7 @@ proto._onJoinInbound = function onJoinInbound(routingKey, message) {
|
|
|
516
515
|
inbound
|
|
517
516
|
});
|
|
518
517
|
};
|
|
519
|
-
|
|
518
|
+
Activity.prototype._onInboundEvent = function onInboundEvent(routingKey, message) {
|
|
520
519
|
const {
|
|
521
520
|
fields,
|
|
522
521
|
content,
|
|
@@ -560,7 +559,7 @@ proto._onInboundEvent = function onInboundEvent(routingKey, message) {
|
|
|
560
559
|
}
|
|
561
560
|
}
|
|
562
561
|
};
|
|
563
|
-
|
|
562
|
+
Activity.prototype._consumeRunQ = function consumeRunQ() {
|
|
564
563
|
if (this[kConsuming]) return;
|
|
565
564
|
this[kConsuming] = true;
|
|
566
565
|
this.broker.getQueue('run-q').assertConsumer(this[kMessageHandlers].onRunMessage, {
|
|
@@ -568,7 +567,7 @@ proto._consumeRunQ = function consumeRunQ() {
|
|
|
568
567
|
consumerTag: '_activity-run'
|
|
569
568
|
});
|
|
570
569
|
};
|
|
571
|
-
|
|
570
|
+
Activity.prototype._onRunMessage = function onRunMessage(routingKey, message, messageProperties) {
|
|
572
571
|
switch (routingKey) {
|
|
573
572
|
case 'run.outbound.discard':
|
|
574
573
|
case 'run.outbound.take':
|
|
@@ -588,7 +587,7 @@ proto._onRunMessage = function onRunMessage(routingKey, message, messageProperti
|
|
|
588
587
|
this._continueRunMessage(routingKey, message, messageProperties);
|
|
589
588
|
});
|
|
590
589
|
};
|
|
591
|
-
|
|
590
|
+
Activity.prototype._continueRunMessage = function continueRunMessage(routingKey, message) {
|
|
592
591
|
const isRedelivered = message.fields.redelivered;
|
|
593
592
|
const content = (0, _messageHelper.cloneContent)(message.content);
|
|
594
593
|
const correlationId = message.properties.correlationId;
|
|
@@ -726,7 +725,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
|
|
|
726
725
|
}
|
|
727
726
|
if (!step) message.ack();
|
|
728
727
|
};
|
|
729
|
-
|
|
728
|
+
Activity.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
730
729
|
const executeMessage = this[kExecuteMessage];
|
|
731
730
|
const content = (0, _messageHelper.cloneContent)({
|
|
732
731
|
...executeMessage.content,
|
|
@@ -781,13 +780,13 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
781
780
|
message.ack();
|
|
782
781
|
this._ackRunExecuteMessage();
|
|
783
782
|
};
|
|
784
|
-
|
|
783
|
+
Activity.prototype._ackRunExecuteMessage = function ackRunExecuteMessage() {
|
|
785
784
|
if (this.environment.settings.step) return;
|
|
786
785
|
const executeMessage = this[kExecuteMessage];
|
|
787
786
|
this[kExecuteMessage] = null;
|
|
788
787
|
executeMessage.ack();
|
|
789
788
|
};
|
|
790
|
-
|
|
789
|
+
Activity.prototype._doRunLeave = function doRunLeave(message, isDiscarded, onOutbound) {
|
|
791
790
|
const {
|
|
792
791
|
content,
|
|
793
792
|
properties
|
|
@@ -818,7 +817,7 @@ proto._doRunLeave = function doRunLeave(message, isDiscarded, onOutbound) {
|
|
|
818
817
|
onOutbound();
|
|
819
818
|
});
|
|
820
819
|
};
|
|
821
|
-
|
|
820
|
+
Activity.prototype._doOutbound = function doOutbound(fromMessage, isDiscarded, callback) {
|
|
822
821
|
const outboundSequenceFlows = this[kFlows].outboundSequenceFlows;
|
|
823
822
|
if (!outboundSequenceFlows.length) return callback(null, []);
|
|
824
823
|
const fromContent = fromMessage.content;
|
|
@@ -844,7 +843,7 @@ proto._doOutbound = function doOutbound(fromMessage, isDiscarded, callback) {
|
|
|
844
843
|
return callback(null, outbound);
|
|
845
844
|
});
|
|
846
845
|
};
|
|
847
|
-
|
|
846
|
+
Activity.prototype._doRunOutbound = function doRunOutbound(outboundList, content, discardSequence) {
|
|
848
847
|
for (const outboundFlow of outboundList) {
|
|
849
848
|
const {
|
|
850
849
|
id: flowId,
|
|
@@ -862,7 +861,7 @@ proto._doRunOutbound = function doRunOutbound(outboundList, content, discardSequ
|
|
|
862
861
|
}
|
|
863
862
|
return outboundList;
|
|
864
863
|
};
|
|
865
|
-
|
|
864
|
+
Activity.prototype._onResumeMessage = function onResumeMessage(message) {
|
|
866
865
|
message.ack();
|
|
867
866
|
const stateMessage = this[kStateMessage];
|
|
868
867
|
const fields = stateMessage.fields;
|
|
@@ -881,7 +880,7 @@ proto._onResumeMessage = function onResumeMessage(message) {
|
|
|
881
880
|
this.logger.debug(`<${this.id}> resume from ${message.content.status}`);
|
|
882
881
|
return this.broker.publish('run', fields.routingKey, (0, _messageHelper.cloneContent)(stateMessage.content), stateMessage.properties);
|
|
883
882
|
};
|
|
884
|
-
|
|
883
|
+
Activity.prototype._publishEvent = function publishEvent(state, content, properties = {}) {
|
|
885
884
|
this.broker.publish('event', `activity.${state}`, (0, _messageHelper.cloneContent)(content, {
|
|
886
885
|
state
|
|
887
886
|
}), {
|
|
@@ -891,7 +890,7 @@ proto._publishEvent = function publishEvent(state, content, properties = {}) {
|
|
|
891
890
|
persistent: 'persistent' in properties ? properties.persistent : state !== 'stop'
|
|
892
891
|
});
|
|
893
892
|
};
|
|
894
|
-
|
|
893
|
+
Activity.prototype._onStop = function onStop(message) {
|
|
895
894
|
const running = this[kConsuming];
|
|
896
895
|
this.stopped = true;
|
|
897
896
|
this[kConsuming] = false;
|
|
@@ -906,7 +905,7 @@ proto._onStop = function onStop(message) {
|
|
|
906
905
|
this._publishEvent('stop', this._createMessage());
|
|
907
906
|
}
|
|
908
907
|
};
|
|
909
|
-
|
|
908
|
+
Activity.prototype._consumeApi = function consumeApi() {
|
|
910
909
|
const executionId = this[kExec].executionId;
|
|
911
910
|
if (!executionId) return;
|
|
912
911
|
const broker = this.broker;
|
|
@@ -917,7 +916,7 @@ proto._consumeApi = function consumeApi() {
|
|
|
917
916
|
priority: 100
|
|
918
917
|
});
|
|
919
918
|
};
|
|
920
|
-
|
|
919
|
+
Activity.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
921
920
|
switch (message.properties.type) {
|
|
922
921
|
case 'discard':
|
|
923
922
|
{
|
|
@@ -933,7 +932,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
933
932
|
}
|
|
934
933
|
}
|
|
935
934
|
};
|
|
936
|
-
|
|
935
|
+
Activity.prototype._createMessage = function createMessage(override) {
|
|
937
936
|
const name = this.name,
|
|
938
937
|
status = this.status,
|
|
939
938
|
parent = this.parent;
|
|
@@ -956,10 +955,10 @@ proto._createMessage = function createMessage(override) {
|
|
|
956
955
|
}
|
|
957
956
|
return result;
|
|
958
957
|
};
|
|
959
|
-
|
|
958
|
+
Activity.prototype._getOutboundSequenceFlowById = function getOutboundSequenceFlowById(flowId) {
|
|
960
959
|
return this[kFlows].outboundSequenceFlows.find(flow => flow.id === flowId);
|
|
961
960
|
};
|
|
962
|
-
|
|
961
|
+
Activity.prototype._deactivateRunConsumers = function _deactivateRunConsumers() {
|
|
963
962
|
const broker = this.broker;
|
|
964
963
|
broker.cancel('_activity-api');
|
|
965
964
|
broker.cancel('_activity-run');
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _Api = require("../Api");
|
|
8
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _Api = require("../Api.js");
|
|
8
|
+
var _messageHelper = require("../messageHelper.js");
|
|
9
9
|
const kCompleted = Symbol.for('completed');
|
|
10
10
|
const kExecuteQ = Symbol.for('executeQ');
|
|
11
11
|
const kExecuteMessage = Symbol.for('executeMessage');
|
|
@@ -29,14 +29,13 @@ function ActivityExecution(activity, context) {
|
|
|
29
29
|
onExecuteMessage: this._onExecuteMessage.bind(this)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(proto, 'completed', {
|
|
32
|
+
Object.defineProperty(ActivityExecution.prototype, 'completed', {
|
|
34
33
|
enumerable: true,
|
|
35
34
|
get() {
|
|
36
35
|
return this[kCompleted];
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
|
-
|
|
38
|
+
ActivityExecution.prototype.execute = function execute(executeMessage) {
|
|
40
39
|
if (!executeMessage) throw new Error('Execution requires message');
|
|
41
40
|
const executionId = executeMessage.content && executeMessage.content.executionId;
|
|
42
41
|
if (!executionId) throw new Error('Execution requires execution id');
|
|
@@ -60,7 +59,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
60
59
|
this.source = new this.activity.Behaviour(this.activity, this.context);
|
|
61
60
|
this.broker.publish('execution', 'execute.start', (0, _messageHelper.cloneContent)(initMessage.content));
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
ActivityExecution.prototype.activate = function activate() {
|
|
64
63
|
if (this[kCompleted]) return;
|
|
65
64
|
const broker = this.broker;
|
|
66
65
|
const batchSize = this.activity.environment.settings.batchSize || 50;
|
|
@@ -84,19 +83,19 @@ proto.activate = function activate() {
|
|
|
84
83
|
priority: 200
|
|
85
84
|
});
|
|
86
85
|
};
|
|
87
|
-
|
|
86
|
+
ActivityExecution.prototype.deactivate = function deactivate() {
|
|
88
87
|
const broker = this.broker;
|
|
89
88
|
broker.cancel('_activity-api-execution');
|
|
90
89
|
broker.cancel('_activity-execute');
|
|
91
90
|
broker.unbindQueue('execute-q', 'execution', 'execute.#');
|
|
92
91
|
};
|
|
93
|
-
|
|
92
|
+
ActivityExecution.prototype.discard = function discard() {
|
|
94
93
|
if (this[kCompleted]) return;
|
|
95
94
|
const initMessage = this[kExecuteMessage];
|
|
96
95
|
if (!initMessage) return this.activity.logger.warn(`<${this.id}> is not executing`);
|
|
97
96
|
this.getApi(initMessage).discard();
|
|
98
97
|
};
|
|
99
|
-
|
|
98
|
+
ActivityExecution.prototype.getApi = function getApi(apiMessage) {
|
|
100
99
|
const self = this;
|
|
101
100
|
if (!apiMessage) apiMessage = this[kExecuteMessage];
|
|
102
101
|
if (self.source.getApi) {
|
|
@@ -113,17 +112,17 @@ proto.getApi = function getApi(apiMessage) {
|
|
|
113
112
|
};
|
|
114
113
|
return api;
|
|
115
114
|
};
|
|
116
|
-
|
|
115
|
+
ActivityExecution.prototype.passthrough = function passthrough(executeMessage) {
|
|
117
116
|
if (!this.source) return this.execute(executeMessage);
|
|
118
117
|
return this._sourceExecute(executeMessage);
|
|
119
118
|
};
|
|
120
|
-
|
|
119
|
+
ActivityExecution.prototype.getPostponed = function getPostponed() {
|
|
121
120
|
let apis = this[kPostponed].map(msg => this.getApi(msg));
|
|
122
121
|
if (!this.activity.isSubProcess || !this.source) return apis;
|
|
123
122
|
apis = apis.concat(this.source.getPostponed());
|
|
124
123
|
return apis;
|
|
125
124
|
};
|
|
126
|
-
|
|
125
|
+
ActivityExecution.prototype.getState = function getState() {
|
|
127
126
|
const result = {
|
|
128
127
|
completed: this[kCompleted]
|
|
129
128
|
};
|
|
@@ -134,7 +133,7 @@ proto.getState = function getState() {
|
|
|
134
133
|
...source.getState()
|
|
135
134
|
};
|
|
136
135
|
};
|
|
137
|
-
|
|
136
|
+
ActivityExecution.prototype.recover = function recover(state) {
|
|
138
137
|
this[kPostponed].splice(0);
|
|
139
138
|
if (!state) return this;
|
|
140
139
|
if ('completed' in state) this[kCompleted] = state.completed;
|
|
@@ -144,12 +143,12 @@ proto.recover = function recover(state) {
|
|
|
144
143
|
}
|
|
145
144
|
return this;
|
|
146
145
|
};
|
|
147
|
-
|
|
146
|
+
ActivityExecution.prototype.stop = function stop() {
|
|
148
147
|
const executeMessage = this[kExecuteMessage];
|
|
149
148
|
if (!executeMessage) return;
|
|
150
149
|
this.getApi(executeMessage).stop();
|
|
151
150
|
};
|
|
152
|
-
|
|
151
|
+
ActivityExecution.prototype._sourceExecute = function sourceExecute(executeMessage) {
|
|
153
152
|
try {
|
|
154
153
|
return this.source.execute(executeMessage);
|
|
155
154
|
} catch (error) {
|
|
@@ -158,7 +157,7 @@ proto._sourceExecute = function sourceExecute(executeMessage) {
|
|
|
158
157
|
}));
|
|
159
158
|
}
|
|
160
159
|
};
|
|
161
|
-
|
|
160
|
+
ActivityExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
162
161
|
const {
|
|
163
162
|
fields,
|
|
164
163
|
content,
|
|
@@ -209,7 +208,7 @@ proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
|
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
};
|
|
212
|
-
|
|
211
|
+
ActivityExecution.prototype._onStateChangeMessage = function onStateChangeMessage(message) {
|
|
213
212
|
const {
|
|
214
213
|
ignoreIfExecuting,
|
|
215
214
|
executionId
|
|
@@ -229,7 +228,7 @@ proto._onStateChangeMessage = function onStateChangeMessage(message) {
|
|
|
229
228
|
postponed.push(message);
|
|
230
229
|
return true;
|
|
231
230
|
};
|
|
232
|
-
|
|
231
|
+
ActivityExecution.prototype._onExecutionCompleted = function onExecutionCompleted(message) {
|
|
233
232
|
const postponedMsg = this._ackPostponed(message);
|
|
234
233
|
if (!postponedMsg) return;
|
|
235
234
|
const postponed = this[kPostponed];
|
|
@@ -258,7 +257,7 @@ proto._onExecutionCompleted = function onExecutionCompleted(message) {
|
|
|
258
257
|
...message.content
|
|
259
258
|
}, message.properties.correlationId);
|
|
260
259
|
};
|
|
261
|
-
|
|
260
|
+
ActivityExecution.prototype._onExecutionDiscarded = function onExecutionDiscarded(message) {
|
|
262
261
|
const postponedMsg = this._ackPostponed(message);
|
|
263
262
|
const {
|
|
264
263
|
isRootScope,
|
|
@@ -288,7 +287,7 @@ proto._onExecutionDiscarded = function onExecutionDiscarded(message) {
|
|
|
288
287
|
}
|
|
289
288
|
this._publishExecutionCompleted('discard', message.content, correlationId);
|
|
290
289
|
};
|
|
291
|
-
|
|
290
|
+
ActivityExecution.prototype._publishExecutionCompleted = function publishExecutionCompleted(completionType, completeContent, correlationId) {
|
|
292
291
|
this[kCompleted] = true;
|
|
293
292
|
this.broker.publish('execution', `execution.${completionType}`, {
|
|
294
293
|
...completeContent,
|
|
@@ -298,7 +297,7 @@ proto._publishExecutionCompleted = function publishExecutionCompleted(completion
|
|
|
298
297
|
correlationId
|
|
299
298
|
});
|
|
300
299
|
};
|
|
301
|
-
|
|
300
|
+
ActivityExecution.prototype._ackPostponed = function ackPostponed(completeMessage) {
|
|
302
301
|
const {
|
|
303
302
|
executionId: eid
|
|
304
303
|
} = completeMessage.content;
|
|
@@ -311,7 +310,7 @@ proto._ackPostponed = function ackPostponed(completeMessage) {
|
|
|
311
310
|
msg.ack();
|
|
312
311
|
return msg;
|
|
313
312
|
};
|
|
314
|
-
|
|
313
|
+
ActivityExecution.prototype._onParentApiMessage = function onParentApiMessage(routingKey, message) {
|
|
315
314
|
switch (message.properties.type) {
|
|
316
315
|
case 'error':
|
|
317
316
|
return this[kExecuteQ].queueMessage({
|
|
@@ -329,7 +328,7 @@ proto._onParentApiMessage = function onParentApiMessage(routingKey, message) {
|
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
};
|
|
332
|
-
|
|
331
|
+
ActivityExecution.prototype._onStop = function onStop(message) {
|
|
333
332
|
const stoppedId = message && message.content && message.content.executionId;
|
|
334
333
|
const running = this.getPostponed();
|
|
335
334
|
for (const api of running) {
|
|
@@ -340,7 +339,7 @@ proto._onStop = function onStop(message) {
|
|
|
340
339
|
this.broker.cancel('_activity-execute');
|
|
341
340
|
this.broker.cancel('_activity-api-execution');
|
|
342
341
|
};
|
|
343
|
-
|
|
342
|
+
ActivityExecution.prototype._debug = function debug(logMessage, executionId) {
|
|
344
343
|
executionId = executionId || this.executionId;
|
|
345
344
|
this.activity.logger.debug(`<${executionId} (${this.id})> ${logMessage}`);
|
|
346
345
|
};
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = ExecutionScope;
|
|
7
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
-
var _Errors = require("../error/Errors");
|
|
7
|
+
var _messageHelper = require("../messageHelper.js");
|
|
8
|
+
var _Errors = require("../error/Errors.js");
|
|
9
9
|
function ExecutionScope(activity, initMessage) {
|
|
10
10
|
const {
|
|
11
11
|
id,
|