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
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Process = Process;
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _ProcessExecution = _interopRequireDefault(require("./ProcessExecution"));
|
|
9
|
-
var _shared = require("../shared");
|
|
10
|
-
var _Api = require("../Api");
|
|
11
|
-
var _EventBroker = require("../EventBroker");
|
|
12
|
-
var _messageHelper = require("../messageHelper");
|
|
13
|
-
var _Errors = require("../error/Errors");
|
|
8
|
+
var _ProcessExecution = _interopRequireDefault(require("./ProcessExecution.js"));
|
|
9
|
+
var _shared = require("../shared.js");
|
|
10
|
+
var _Api = require("../Api.js");
|
|
11
|
+
var _EventBroker = require("../EventBroker.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 kConsuming = Symbol.for('consuming');
|
|
16
16
|
const kCounters = Symbol.for('counters');
|
|
@@ -68,8 +68,7 @@ function Process(processDef, context) {
|
|
|
68
68
|
this.logger = environment.Logger(type.toLowerCase());
|
|
69
69
|
this[kExtensions] = context.loadExtensions(this);
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
Object.defineProperty(proto, 'counters', {
|
|
71
|
+
Object.defineProperty(Process.prototype, 'counters', {
|
|
73
72
|
enumerable: true,
|
|
74
73
|
get() {
|
|
75
74
|
return {
|
|
@@ -77,26 +76,26 @@ Object.defineProperty(proto, 'counters', {
|
|
|
77
76
|
};
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
|
-
Object.defineProperty(
|
|
79
|
+
Object.defineProperty(Process.prototype, 'extensions', {
|
|
81
80
|
enumerable: true,
|
|
82
81
|
get() {
|
|
83
82
|
return this[kExtensions];
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
|
-
Object.defineProperty(
|
|
85
|
+
Object.defineProperty(Process.prototype, 'stopped', {
|
|
87
86
|
enumerable: true,
|
|
88
87
|
get() {
|
|
89
88
|
return this[kStopped];
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
|
-
Object.defineProperty(
|
|
91
|
+
Object.defineProperty(Process.prototype, 'isRunning', {
|
|
93
92
|
enumerable: true,
|
|
94
93
|
get() {
|
|
95
94
|
if (!this[kConsuming]) return false;
|
|
96
95
|
return !!this.status;
|
|
97
96
|
}
|
|
98
97
|
});
|
|
99
|
-
Object.defineProperty(
|
|
98
|
+
Object.defineProperty(Process.prototype, 'executionId', {
|
|
100
99
|
enumerable: true,
|
|
101
100
|
get() {
|
|
102
101
|
const {
|
|
@@ -106,19 +105,19 @@ Object.defineProperty(proto, 'executionId', {
|
|
|
106
105
|
return executionId || initExecutionId;
|
|
107
106
|
}
|
|
108
107
|
});
|
|
109
|
-
Object.defineProperty(
|
|
108
|
+
Object.defineProperty(Process.prototype, 'execution', {
|
|
110
109
|
enumerable: true,
|
|
111
110
|
get() {
|
|
112
111
|
return this[kExec].execution;
|
|
113
112
|
}
|
|
114
113
|
});
|
|
115
|
-
Object.defineProperty(
|
|
114
|
+
Object.defineProperty(Process.prototype, 'status', {
|
|
116
115
|
enumerable: true,
|
|
117
116
|
get() {
|
|
118
117
|
return this[kStatus];
|
|
119
118
|
}
|
|
120
119
|
});
|
|
121
|
-
|
|
120
|
+
Process.prototype.init = function init(useAsExecutionId) {
|
|
122
121
|
const exec = this[kExec];
|
|
123
122
|
const initExecutionId = exec.initExecutionId = useAsExecutionId || (0, _shared.getUniqueId)(this.id);
|
|
124
123
|
this._debug(`initialized with executionId <${initExecutionId}>`);
|
|
@@ -126,7 +125,7 @@ proto.init = function init(useAsExecutionId) {
|
|
|
126
125
|
executionId: initExecutionId
|
|
127
126
|
}));
|
|
128
127
|
};
|
|
129
|
-
|
|
128
|
+
Process.prototype.run = function run(runContent) {
|
|
130
129
|
if (this.isRunning) throw new Error(`process <${this.id}> is already running`);
|
|
131
130
|
const exec = this[kExec];
|
|
132
131
|
const executionId = exec.executionId = exec.initExecutionId || (0, _shared.getUniqueId)(this.id);
|
|
@@ -141,7 +140,7 @@ proto.run = function run(runContent) {
|
|
|
141
140
|
broker.publish('run', 'run.execute', (0, _messageHelper.cloneContent)(content));
|
|
142
141
|
this._activateRunConsumers();
|
|
143
142
|
};
|
|
144
|
-
|
|
143
|
+
Process.prototype.resume = function resume() {
|
|
145
144
|
if (this.isRunning) throw new Error(`cannot resume running process <${this.id}>`);
|
|
146
145
|
if (!this.status) return this;
|
|
147
146
|
this[kStopped] = false;
|
|
@@ -152,7 +151,7 @@ proto.resume = function resume() {
|
|
|
152
151
|
this._activateRunConsumers();
|
|
153
152
|
return this;
|
|
154
153
|
};
|
|
155
|
-
|
|
154
|
+
Process.prototype.recover = function recover(state) {
|
|
156
155
|
if (this.isRunning) throw new Error(`cannot recover running process <${this.id}>`);
|
|
157
156
|
if (!state) return this;
|
|
158
157
|
this[kStopped] = !!state.stopped;
|
|
@@ -170,25 +169,25 @@ proto.recover = function recover(state) {
|
|
|
170
169
|
this.broker.recover(state.broker);
|
|
171
170
|
return this;
|
|
172
171
|
};
|
|
173
|
-
|
|
172
|
+
Process.prototype.shake = function shake(startId) {
|
|
174
173
|
if (this.isRunning) return this.execution.shake(startId);
|
|
175
174
|
return new _ProcessExecution.default(this, this.context).shake(startId);
|
|
176
175
|
};
|
|
177
|
-
|
|
176
|
+
Process.prototype.stop = function stop() {
|
|
178
177
|
if (!this.isRunning) return;
|
|
179
178
|
this.getApi().stop();
|
|
180
179
|
};
|
|
181
|
-
|
|
180
|
+
Process.prototype.getApi = function getApi(message) {
|
|
182
181
|
const execution = this.execution;
|
|
183
182
|
if (execution) return execution.getApi(message);
|
|
184
183
|
return (0, _Api.ProcessApi)(this.broker, message || this[kStateMessage]);
|
|
185
184
|
};
|
|
186
|
-
|
|
185
|
+
Process.prototype.signal = function signal(message) {
|
|
187
186
|
return this.getApi().signal(message, {
|
|
188
187
|
delegate: true
|
|
189
188
|
});
|
|
190
189
|
};
|
|
191
|
-
|
|
190
|
+
Process.prototype.getState = function getState() {
|
|
192
191
|
return this._createMessage({
|
|
193
192
|
environment: this.environment.getState(),
|
|
194
193
|
status: this.status,
|
|
@@ -198,12 +197,12 @@ proto.getState = function getState() {
|
|
|
198
197
|
execution: this.execution && this.execution.getState()
|
|
199
198
|
});
|
|
200
199
|
};
|
|
201
|
-
|
|
200
|
+
Process.prototype.cancelActivity = function cancelActivity(message) {
|
|
202
201
|
return this.getApi().cancel(message, {
|
|
203
202
|
delegate: true
|
|
204
203
|
});
|
|
205
204
|
};
|
|
206
|
-
|
|
205
|
+
Process.prototype._activateRunConsumers = function activateRunConsumers() {
|
|
207
206
|
this[kConsuming] = true;
|
|
208
207
|
const broker = this.broker;
|
|
209
208
|
const {
|
|
@@ -220,14 +219,14 @@ proto._activateRunConsumers = function activateRunConsumers() {
|
|
|
220
219
|
consumerTag: '_process-run'
|
|
221
220
|
});
|
|
222
221
|
};
|
|
223
|
-
|
|
222
|
+
Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
|
|
224
223
|
const broker = this.broker;
|
|
225
224
|
broker.cancel('_process-api');
|
|
226
225
|
broker.cancel('_process-run');
|
|
227
226
|
broker.cancel('_process-execution');
|
|
228
227
|
this[kConsuming] = false;
|
|
229
228
|
};
|
|
230
|
-
|
|
229
|
+
Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
|
|
231
230
|
const {
|
|
232
231
|
content,
|
|
233
232
|
fields
|
|
@@ -310,7 +309,7 @@ proto._onRunMessage = function onRunMessage(routingKey, message) {
|
|
|
310
309
|
}
|
|
311
310
|
message.ack();
|
|
312
311
|
};
|
|
313
|
-
|
|
312
|
+
Process.prototype._onResumeMessage = function onResumeMessage(message) {
|
|
314
313
|
message.ack();
|
|
315
314
|
const stateMessage = this[kStateMessage];
|
|
316
315
|
switch (stateMessage.fields.routingKey) {
|
|
@@ -327,7 +326,7 @@ proto._onResumeMessage = function onResumeMessage(message) {
|
|
|
327
326
|
this._debug(`resume from ${this.status}`);
|
|
328
327
|
return this.broker.publish('run', stateMessage.fields.routingKey, (0, _messageHelper.cloneContent)(stateMessage.content), stateMessage.properties);
|
|
329
328
|
};
|
|
330
|
-
|
|
329
|
+
Process.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
331
330
|
const content = message.content;
|
|
332
331
|
const messageType = message.properties.type;
|
|
333
332
|
message.ack();
|
|
@@ -354,7 +353,7 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
|
|
|
354
353
|
this[kExecuteMessage] = null;
|
|
355
354
|
executeMessage.ack();
|
|
356
355
|
};
|
|
357
|
-
|
|
356
|
+
Process.prototype._publishEvent = function publishEvent(state, content) {
|
|
358
357
|
const eventContent = this._createMessage({
|
|
359
358
|
...content,
|
|
360
359
|
state
|
|
@@ -364,7 +363,7 @@ proto._publishEvent = function publishEvent(state, content) {
|
|
|
364
363
|
mandatory: state === 'error'
|
|
365
364
|
});
|
|
366
365
|
};
|
|
367
|
-
|
|
366
|
+
Process.prototype.sendMessage = function sendMessage(message) {
|
|
368
367
|
const messageContent = message && message.content;
|
|
369
368
|
if (!messageContent) return;
|
|
370
369
|
let targetsFound = false;
|
|
@@ -382,30 +381,30 @@ proto.sendMessage = function sendMessage(message) {
|
|
|
382
381
|
delegate: true
|
|
383
382
|
});
|
|
384
383
|
};
|
|
385
|
-
|
|
384
|
+
Process.prototype.getActivityById = function getActivityById(childId) {
|
|
386
385
|
const execution = this.execution;
|
|
387
386
|
if (execution) return execution.getActivityById(childId);
|
|
388
387
|
return this.context.getActivityById(childId);
|
|
389
388
|
};
|
|
390
|
-
|
|
389
|
+
Process.prototype.getActivities = function getActivities() {
|
|
391
390
|
const execution = this.execution;
|
|
392
391
|
if (execution) return execution.getActivities();
|
|
393
392
|
return this.context.getActivities(this.id);
|
|
394
393
|
};
|
|
395
|
-
|
|
394
|
+
Process.prototype.getStartActivities = function getStartActivities(filterOptions) {
|
|
396
395
|
return this.context.getStartActivities(filterOptions, this.id);
|
|
397
396
|
};
|
|
398
|
-
|
|
397
|
+
Process.prototype.getSequenceFlows = function getSequenceFlows() {
|
|
399
398
|
const execution = this.execution;
|
|
400
399
|
if (execution) return execution.getSequenceFlows();
|
|
401
400
|
return this.context.getSequenceFlows();
|
|
402
401
|
};
|
|
403
|
-
|
|
402
|
+
Process.prototype.getPostponed = function getPostponed(...args) {
|
|
404
403
|
const execution = this.execution;
|
|
405
404
|
if (!execution) return [];
|
|
406
405
|
return execution.getPostponed(...args);
|
|
407
406
|
};
|
|
408
|
-
|
|
407
|
+
Process.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
409
408
|
const messageType = message.properties.type;
|
|
410
409
|
switch (messageType) {
|
|
411
410
|
case 'stop':
|
|
@@ -416,12 +415,12 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
416
415
|
}
|
|
417
416
|
}
|
|
418
417
|
};
|
|
419
|
-
|
|
418
|
+
Process.prototype._onStop = function onStop() {
|
|
420
419
|
this[kStopped] = true;
|
|
421
420
|
this._deactivateRunConsumers();
|
|
422
421
|
return this._publishEvent('stop');
|
|
423
422
|
};
|
|
424
|
-
|
|
423
|
+
Process.prototype._createMessage = function createMessage(override) {
|
|
425
424
|
return {
|
|
426
425
|
id: this.id,
|
|
427
426
|
type: this.type,
|
|
@@ -433,6 +432,6 @@ proto._createMessage = function createMessage(override) {
|
|
|
433
432
|
...override
|
|
434
433
|
};
|
|
435
434
|
};
|
|
436
|
-
|
|
435
|
+
Process.prototype._debug = function debug(msg) {
|
|
437
436
|
this.logger.debug(`<${this.id}> ${msg}`);
|
|
438
437
|
};
|
|
@@ -4,9 +4,9 @@ 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");
|
|
9
|
-
var _shared = require("../shared");
|
|
7
|
+
var _Api = require("../Api.js");
|
|
8
|
+
var _messageHelper = require("../messageHelper.js");
|
|
9
|
+
var _shared = require("../shared.js");
|
|
10
10
|
var _default = ProcessExecution;
|
|
11
11
|
exports.default = _default;
|
|
12
12
|
const kActivated = Symbol.for('activated');
|
|
@@ -60,36 +60,35 @@ function ProcessExecution(parentActivity, context) {
|
|
|
60
60
|
onMessageFlowEvent: this._onMessageFlowEvent.bind(this)
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
Object.defineProperty(proto, 'stopped', {
|
|
63
|
+
Object.defineProperty(ProcessExecution.prototype, 'stopped', {
|
|
65
64
|
enumerable: true,
|
|
66
65
|
get() {
|
|
67
66
|
return this[kStopped];
|
|
68
67
|
}
|
|
69
68
|
});
|
|
70
|
-
Object.defineProperty(
|
|
69
|
+
Object.defineProperty(ProcessExecution.prototype, 'completed', {
|
|
71
70
|
enumerable: true,
|
|
72
71
|
get() {
|
|
73
72
|
return this[kCompleted];
|
|
74
73
|
}
|
|
75
74
|
});
|
|
76
|
-
Object.defineProperty(
|
|
75
|
+
Object.defineProperty(ProcessExecution.prototype, 'status', {
|
|
77
76
|
enumerable: true,
|
|
78
77
|
get() {
|
|
79
78
|
return this[kStatus];
|
|
80
79
|
}
|
|
81
80
|
});
|
|
82
|
-
Object.defineProperty(
|
|
81
|
+
Object.defineProperty(ProcessExecution.prototype, 'postponedCount', {
|
|
83
82
|
get() {
|
|
84
83
|
return this[kElements].postponed.length;
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
|
-
Object.defineProperty(
|
|
86
|
+
Object.defineProperty(ProcessExecution.prototype, 'isRunning', {
|
|
88
87
|
get() {
|
|
89
88
|
return this[kActivated];
|
|
90
89
|
}
|
|
91
90
|
});
|
|
92
|
-
|
|
91
|
+
ProcessExecution.prototype.execute = function execute(executeMessage) {
|
|
93
92
|
if (!executeMessage) throw new Error('Process execution requires message');
|
|
94
93
|
if (!executeMessage.content || !executeMessage.content.executionId) throw new Error('Process execution requires execution id');
|
|
95
94
|
const executionId = this.executionId = executeMessage.content.executionId;
|
|
@@ -111,7 +110,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
111
110
|
this._start();
|
|
112
111
|
return true;
|
|
113
112
|
};
|
|
114
|
-
|
|
113
|
+
ProcessExecution.prototype.resume = function resume() {
|
|
115
114
|
this._debug(`resume process execution at ${this.status}`);
|
|
116
115
|
if (this[kCompleted]) return this._complete('completed');
|
|
117
116
|
this._activate();
|
|
@@ -146,7 +145,7 @@ proto.resume = function resume() {
|
|
|
146
145
|
if (this[kCompleted]) return;
|
|
147
146
|
if (!postponed.length && status === 'executing') return this._complete('completed');
|
|
148
147
|
};
|
|
149
|
-
|
|
148
|
+
ProcessExecution.prototype.recover = function recover(state) {
|
|
150
149
|
if (!state) return this;
|
|
151
150
|
this.executionId = state.executionId;
|
|
152
151
|
this[kStopped] = state.stopped;
|
|
@@ -183,7 +182,7 @@ proto.recover = function recover(state) {
|
|
|
183
182
|
}
|
|
184
183
|
return this;
|
|
185
184
|
};
|
|
186
|
-
|
|
185
|
+
ProcessExecution.prototype.shake = function shake(fromId) {
|
|
187
186
|
let executing = true;
|
|
188
187
|
const id = this.id;
|
|
189
188
|
if (!this.isRunning) {
|
|
@@ -224,10 +223,10 @@ proto.shake = function shake(fromId) {
|
|
|
224
223
|
this.broker.cancel(`_shaker-${this.executionId}`);
|
|
225
224
|
return result;
|
|
226
225
|
};
|
|
227
|
-
|
|
226
|
+
ProcessExecution.prototype.stop = function stop() {
|
|
228
227
|
this.getApi().stop();
|
|
229
228
|
};
|
|
230
|
-
|
|
229
|
+
ProcessExecution.prototype.getPostponed = function getPostponed(filterFn) {
|
|
231
230
|
const result = [];
|
|
232
231
|
for (const msg of this[kElements].postponed.slice()) {
|
|
233
232
|
const api = this._getChildApi(msg);
|
|
@@ -237,7 +236,7 @@ proto.getPostponed = function getPostponed(filterFn) {
|
|
|
237
236
|
}
|
|
238
237
|
return result;
|
|
239
238
|
};
|
|
240
|
-
|
|
239
|
+
ProcessExecution.prototype.discard = function discard() {
|
|
241
240
|
this[kStatus] = 'discard';
|
|
242
241
|
return this[kActivityQ].queueMessage({
|
|
243
242
|
routingKey: 'execution.discard'
|
|
@@ -249,7 +248,7 @@ proto.discard = function discard() {
|
|
|
249
248
|
type: 'discard'
|
|
250
249
|
});
|
|
251
250
|
};
|
|
252
|
-
|
|
251
|
+
ProcessExecution.prototype.getState = function getState() {
|
|
253
252
|
const {
|
|
254
253
|
children,
|
|
255
254
|
flows,
|
|
@@ -277,16 +276,16 @@ proto.getState = function getState() {
|
|
|
277
276
|
})
|
|
278
277
|
};
|
|
279
278
|
};
|
|
280
|
-
|
|
279
|
+
ProcessExecution.prototype.getActivities = function getActivities() {
|
|
281
280
|
return this[kElements].children.slice();
|
|
282
281
|
};
|
|
283
|
-
|
|
282
|
+
ProcessExecution.prototype.getActivityById = function getActivityById(activityId) {
|
|
284
283
|
return this[kElements].children.find(child => child.id === activityId);
|
|
285
284
|
};
|
|
286
|
-
|
|
285
|
+
ProcessExecution.prototype.getSequenceFlows = function getSequenceFlows() {
|
|
287
286
|
return this[kElements].flows.slice();
|
|
288
287
|
};
|
|
289
|
-
|
|
288
|
+
ProcessExecution.prototype.getApi = function getApi(message) {
|
|
290
289
|
if (!message) return (0, _Api.ProcessApi)(this.broker, this[kExecuteMessage]);
|
|
291
290
|
const content = message.content;
|
|
292
291
|
if (content.executionId !== this.executionId) {
|
|
@@ -304,7 +303,7 @@ proto.getApi = function getApi(message) {
|
|
|
304
303
|
};
|
|
305
304
|
return api;
|
|
306
305
|
};
|
|
307
|
-
|
|
306
|
+
ProcessExecution.prototype._start = function start() {
|
|
308
307
|
if (this[kElements].children.length === 0) {
|
|
309
308
|
return this._complete('completed');
|
|
310
309
|
}
|
|
@@ -331,7 +330,7 @@ proto._start = function start() {
|
|
|
331
330
|
consumerTag: `_process-activity-${this.executionId}`
|
|
332
331
|
});
|
|
333
332
|
};
|
|
334
|
-
|
|
333
|
+
ProcessExecution.prototype._activate = function activate() {
|
|
335
334
|
const {
|
|
336
335
|
onApiMessage,
|
|
337
336
|
onMessageFlowEvent,
|
|
@@ -395,7 +394,7 @@ proto._activate = function activate() {
|
|
|
395
394
|
}
|
|
396
395
|
this[kActivated] = true;
|
|
397
396
|
};
|
|
398
|
-
|
|
397
|
+
ProcessExecution.prototype._deactivate = function deactivate() {
|
|
399
398
|
const broker = this.broker;
|
|
400
399
|
const executionId = this.executionId;
|
|
401
400
|
broker.cancel(`_process-api-consumer-${executionId}`);
|
|
@@ -423,7 +422,7 @@ proto._deactivate = function deactivate() {
|
|
|
423
422
|
}
|
|
424
423
|
this[kActivated] = false;
|
|
425
424
|
};
|
|
426
|
-
|
|
425
|
+
ProcessExecution.prototype._onDelegateEvent = function onDelegateEvent(message) {
|
|
427
426
|
const eventType = message.properties.type;
|
|
428
427
|
let delegate = true;
|
|
429
428
|
const content = message.content;
|
|
@@ -446,10 +445,10 @@ proto._onDelegateEvent = function onDelegateEvent(message) {
|
|
|
446
445
|
});
|
|
447
446
|
return delegate;
|
|
448
447
|
};
|
|
449
|
-
|
|
448
|
+
ProcessExecution.prototype._onMessageFlowEvent = function onMessageFlowEvent(routingKey, message) {
|
|
450
449
|
this.broker.publish('message', routingKey, (0, _messageHelper.cloneContent)(message.content), message.properties);
|
|
451
450
|
};
|
|
452
|
-
|
|
451
|
+
ProcessExecution.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
453
452
|
if (message.fields.redelivered && message.properties.persistent === false) return;
|
|
454
453
|
const content = message.content;
|
|
455
454
|
const parent = content.parent = content.parent || {};
|
|
@@ -490,7 +489,7 @@ proto._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
|
490
489
|
...message.properties
|
|
491
490
|
});
|
|
492
491
|
};
|
|
493
|
-
|
|
492
|
+
ProcessExecution.prototype._onChildMessage = function onChildMessage(routingKey, message) {
|
|
494
493
|
if (message.fields.redelivered && message.properties.persistent === false) return message.ack();
|
|
495
494
|
const content = message.content;
|
|
496
495
|
switch (routingKey) {
|
|
@@ -557,12 +556,12 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
|
|
|
557
556
|
}
|
|
558
557
|
}
|
|
559
558
|
};
|
|
560
|
-
|
|
559
|
+
ProcessExecution.prototype._stateChangeMessage = function stateChangeMessage(message, postponeMessage) {
|
|
561
560
|
const previousMsg = this._popPostponed(message.content);
|
|
562
561
|
if (previousMsg) previousMsg.ack();
|
|
563
562
|
if (postponeMessage) this[kElements].postponed.push(message);
|
|
564
563
|
};
|
|
565
|
-
|
|
564
|
+
ProcessExecution.prototype._popPostponed = function popPostponed(byContent) {
|
|
566
565
|
const {
|
|
567
566
|
postponed,
|
|
568
567
|
detachedActivities
|
|
@@ -579,7 +578,7 @@ proto._popPostponed = function popPostponed(byContent) {
|
|
|
579
578
|
if (detachedIdx > -1) detachedActivities.splice(detachedIdx, 1);
|
|
580
579
|
return postponedMsg;
|
|
581
580
|
};
|
|
582
|
-
|
|
581
|
+
ProcessExecution.prototype._onChildCompleted = function onChildCompleted(message) {
|
|
583
582
|
this._stateChangeMessage(message, false);
|
|
584
583
|
if (message.fields.redelivered) return message.ack();
|
|
585
584
|
const {
|
|
@@ -618,7 +617,7 @@ proto._onChildCompleted = function onChildCompleted(message) {
|
|
|
618
617
|
}
|
|
619
618
|
}
|
|
620
619
|
};
|
|
621
|
-
|
|
620
|
+
ProcessExecution.prototype._stopExecution = function stopExecution(message) {
|
|
622
621
|
const postponedCount = this.postponedCount;
|
|
623
622
|
this._debug(`stop process execution (stop child executions ${postponedCount})`);
|
|
624
623
|
if (postponedCount) {
|
|
@@ -634,7 +633,7 @@ proto._stopExecution = function stopExecution(message) {
|
|
|
634
633
|
persistent: false
|
|
635
634
|
});
|
|
636
635
|
};
|
|
637
|
-
|
|
636
|
+
ProcessExecution.prototype._onDiscard = function onDiscard() {
|
|
638
637
|
this._deactivate();
|
|
639
638
|
const running = this[kElements].postponed.splice(0);
|
|
640
639
|
this._debug(`discard process execution (discard child executions ${running.length})`);
|
|
@@ -643,7 +642,7 @@ proto._onDiscard = function onDiscard() {
|
|
|
643
642
|
this[kActivityQ].purge();
|
|
644
643
|
return this._complete('discard');
|
|
645
644
|
};
|
|
646
|
-
|
|
645
|
+
ProcessExecution.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
647
646
|
const executionId = this.executionId;
|
|
648
647
|
const broker = this.broker;
|
|
649
648
|
if (message.properties.delegate) {
|
|
@@ -684,7 +683,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
684
683
|
break;
|
|
685
684
|
}
|
|
686
685
|
};
|
|
687
|
-
|
|
686
|
+
ProcessExecution.prototype._complete = function complete(completionType, content) {
|
|
688
687
|
this._deactivate();
|
|
689
688
|
this._debug(`process execution ${completionType}`);
|
|
690
689
|
this[kCompleted] = true;
|
|
@@ -702,7 +701,7 @@ proto._complete = function complete(completionType, content) {
|
|
|
702
701
|
mandatory: completionType === 'error'
|
|
703
702
|
});
|
|
704
703
|
};
|
|
705
|
-
|
|
704
|
+
ProcessExecution.prototype._terminate = function terminate(message) {
|
|
706
705
|
this[kStatus] = 'terminated';
|
|
707
706
|
this._debug('terminating process execution');
|
|
708
707
|
const running = this[kElements].postponed.splice(0);
|
|
@@ -719,19 +718,19 @@ proto._terminate = function terminate(message) {
|
|
|
719
718
|
}
|
|
720
719
|
this[kActivityQ].purge();
|
|
721
720
|
};
|
|
722
|
-
|
|
721
|
+
ProcessExecution.prototype._getFlowById = function getFlowById(flowId) {
|
|
723
722
|
return this[kElements].flows.find(f => f.id === flowId);
|
|
724
723
|
};
|
|
725
|
-
|
|
724
|
+
ProcessExecution.prototype._getAssociationById = function getAssociationById(associationId) {
|
|
726
725
|
return this[kElements].associations.find(a => a.id === associationId);
|
|
727
726
|
};
|
|
728
|
-
|
|
727
|
+
ProcessExecution.prototype._getMessageFlowById = function getMessageFlowById(flowId) {
|
|
729
728
|
return this[kElements].outboundMessageFlows.find(f => f.id === flowId);
|
|
730
729
|
};
|
|
731
|
-
|
|
730
|
+
ProcessExecution.prototype._getChildById = function getChildById(childId) {
|
|
732
731
|
return this.getActivityById(childId) || this._getFlowById(childId);
|
|
733
732
|
};
|
|
734
|
-
|
|
733
|
+
ProcessExecution.prototype._getChildApi = function getChildApi(message) {
|
|
735
734
|
const content = message.content;
|
|
736
735
|
let child = this._getChildById(content.id);
|
|
737
736
|
if (child) return child.getApi(message);
|
|
@@ -744,11 +743,11 @@ proto._getChildApi = function getChildApi(message) {
|
|
|
744
743
|
if (child) return child.getApi(message);
|
|
745
744
|
}
|
|
746
745
|
};
|
|
747
|
-
|
|
746
|
+
ProcessExecution.prototype._onShookEnd = function onShookEnd(message) {
|
|
748
747
|
const routingKey = message.fields.routingKey;
|
|
749
748
|
if (routingKey !== 'activity.shake.end') return;
|
|
750
749
|
this[kElements].startSequences[message.content.id] = (0, _messageHelper.cloneMessage)(message);
|
|
751
750
|
};
|
|
752
|
-
|
|
751
|
+
ProcessExecution.prototype._debug = function debugMessage(logMessage) {
|
|
753
752
|
this[kParent].logger.debug(`<${this.executionId} (${this.id})> ${logMessage}`);
|
|
754
753
|
};
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CallActivityBehaviour = CallActivityBehaviour;
|
|
7
7
|
exports.default = CallActivity;
|
|
8
|
-
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
9
|
-
var _Errors = require("../error/Errors");
|
|
10
|
-
var _messageHelper = require("../messageHelper");
|
|
8
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
|
|
9
|
+
var _Errors = require("../error/Errors.js");
|
|
10
|
+
var _messageHelper = require("../messageHelper.js");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function CallActivity(activityDef, context) {
|
|
13
13
|
return new _Activity.default(CallActivityBehaviour, activityDef, context);
|
|
@@ -26,8 +26,7 @@ function CallActivityBehaviour(activity) {
|
|
|
26
26
|
this.broker = activity.broker;
|
|
27
27
|
this.environment = activity.environment;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
proto.execute = function execute(executeMessage) {
|
|
29
|
+
CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
|
|
31
30
|
const executeContent = executeMessage.content;
|
|
32
31
|
const loopCharacteristics = this.loopCharacteristics;
|
|
33
32
|
if (loopCharacteristics && executeContent.isRootScope) {
|
|
@@ -62,7 +61,7 @@ proto.execute = function execute(executeMessage) {
|
|
|
62
61
|
type: 'call'
|
|
63
62
|
});
|
|
64
63
|
};
|
|
65
|
-
|
|
64
|
+
CallActivityBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
66
65
|
if (!message.properties.delegate) return;
|
|
67
66
|
const {
|
|
68
67
|
content: delegateContent
|
|
@@ -89,7 +88,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(calledElement, exe
|
|
|
89
88
|
});
|
|
90
89
|
return this._onApiMessage(calledElement, executeMessage, routingKey, message);
|
|
91
90
|
};
|
|
92
|
-
|
|
91
|
+
CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
93
92
|
const {
|
|
94
93
|
type: messageType,
|
|
95
94
|
correlationId
|
|
@@ -132,7 +131,7 @@ proto._onApiMessage = function onApiMessage(calledElement, executeMessage, routi
|
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
};
|
|
135
|
-
|
|
134
|
+
CallActivityBehaviour.prototype._stop = function stop(executionId) {
|
|
136
135
|
const broker = this.broker;
|
|
137
136
|
broker.cancel(`_api-${executionId}`);
|
|
138
137
|
broker.cancel(`_api-delegated-${executionId}`);
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = LoopCharacteristics;
|
|
7
|
-
var _Errors = require("../error/Errors");
|
|
8
|
-
var _messageHelper = require("../messageHelper");
|
|
7
|
+
var _Errors = require("../error/Errors.js");
|
|
8
|
+
var _messageHelper = require("../messageHelper.js");
|
|
9
9
|
function LoopCharacteristics(activity, loopCharacteristics) {
|
|
10
10
|
this.activity = activity;
|
|
11
11
|
this.loopCharacteristics = loopCharacteristics;
|