bpmn-elements 16.2.0 → 16.2.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/dist/Api.js +1 -1
- package/dist/Context.js +2 -4
- package/dist/Environment.js +3 -3
- package/dist/EventBroker.js +1 -1
- package/dist/MessageFormatter.js +2 -2
- package/dist/Tracker.js +1 -0
- package/dist/activity/Activity.js +19 -13
- package/dist/activity/ActivityExecution.js +2 -2
- package/dist/activity/outbound-evaluator.js +0 -3
- package/dist/definition/Definition.js +4 -4
- package/dist/definition/DefinitionExecution.js +6 -6
- package/dist/error/Errors.js +7 -10
- package/dist/eventDefinitions/CancelEventDefinition.js +1 -2
- package/dist/eventDefinitions/CompensateEventDefinition.js +2 -3
- package/dist/eventDefinitions/ConditionalEventDefinition.js +2 -3
- package/dist/eventDefinitions/ErrorEventDefinition.js +3 -4
- package/dist/eventDefinitions/EscalationEventDefinition.js +1 -2
- package/dist/eventDefinitions/LinkEventDefinition.js +1 -2
- package/dist/eventDefinitions/MessageEventDefinition.js +2 -3
- package/dist/eventDefinitions/SignalEventDefinition.js +2 -3
- package/dist/eventDefinitions/TimerEventDefinition.js +2 -3
- package/dist/events/BoundaryEvent.js +2 -3
- package/dist/events/StartEvent.js +1 -2
- package/dist/flows/Association.js +2 -2
- package/dist/flows/SequenceFlow.js +3 -7
- package/dist/io/EnvironmentDataObject.js +1 -1
- package/dist/io/EnvironmentDataStore.js +1 -1
- package/dist/io/EnvironmentDataStoreReference.js +1 -1
- package/dist/io/InputOutputSpecification.js +2 -2
- package/dist/io/Properties.js +14 -14
- package/dist/process/Process.js +5 -7
- package/dist/process/ProcessExecution.js +13 -13
- package/dist/tasks/ServiceTask.js +1 -1
- package/package.json +2 -2
- package/src/Api.js +1 -1
- package/src/Context.js +2 -1
- package/src/Environment.js +3 -3
- package/src/EventBroker.js +1 -1
- package/src/MessageFormatter.js +2 -2
- package/src/Tracker.js +1 -0
- package/src/activity/Activity.js +18 -13
- package/src/activity/ActivityExecution.js +2 -2
- package/src/activity/outbound-evaluator.js +0 -1
- package/src/definition/Definition.js +4 -4
- package/src/definition/DefinitionExecution.js +6 -6
- package/src/error/Errors.js +7 -11
- package/src/eventDefinitions/CancelEventDefinition.js +1 -2
- package/src/eventDefinitions/CompensateEventDefinition.js +2 -3
- package/src/eventDefinitions/ConditionalEventDefinition.js +2 -3
- package/src/eventDefinitions/ErrorEventDefinition.js +3 -4
- package/src/eventDefinitions/EscalationEventDefinition.js +1 -2
- package/src/eventDefinitions/LinkEventDefinition.js +1 -2
- package/src/eventDefinitions/MessageEventDefinition.js +2 -3
- package/src/eventDefinitions/SignalEventDefinition.js +2 -3
- package/src/eventDefinitions/TimerEventDefinition.js +2 -3
- package/src/events/BoundaryEvent.js +2 -3
- package/src/events/StartEvent.js +1 -2
- package/src/flows/Association.js +2 -2
- package/src/flows/SequenceFlow.js +3 -3
- package/src/io/EnvironmentDataObject.js +1 -1
- package/src/io/EnvironmentDataStore.js +1 -1
- package/src/io/EnvironmentDataStoreReference.js +1 -1
- package/src/io/InputOutputSpecification.js +2 -2
- package/src/io/Properties.js +14 -14
- package/src/process/Process.js +5 -7
- package/src/process/ProcessExecution.js +13 -13
- package/src/tasks/ServiceTask.js +1 -1
package/dist/Api.js
CHANGED
|
@@ -72,7 +72,7 @@ Api.prototype.resolveExpression = function resolveExpression(expression) {
|
|
|
72
72
|
}, this.owner);
|
|
73
73
|
};
|
|
74
74
|
Api.prototype.sendApiMessage = function sendApiMessage(action, content, options) {
|
|
75
|
-
const correlationId = options
|
|
75
|
+
const correlationId = options?.correlationId || (0, _shared.getUniqueId)(`${this.id || this.messagePrefix}_signal`);
|
|
76
76
|
let key = `${this.messagePrefix}.${action}`;
|
|
77
77
|
if (this.executionId) key += `.${this.executionId}`;
|
|
78
78
|
this.broker.publish('api', key, this.createMessage(content), {
|
package/dist/Context.js
CHANGED
|
@@ -165,10 +165,8 @@ ContextInstance.prototype.getDataStoreById = function getDataStoreById(reference
|
|
|
165
165
|
return dataStore;
|
|
166
166
|
};
|
|
167
167
|
ContextInstance.prototype.getStartActivities = function getStartActivities(filterOptions, scopeId) {
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
referenceType = 'unknown'
|
|
171
|
-
} = filterOptions || {};
|
|
168
|
+
const referenceId = filterOptions?.referenceId;
|
|
169
|
+
const referenceType = filterOptions?.referenceType || 'unknown';
|
|
172
170
|
const result = [];
|
|
173
171
|
for (const activity of this.getActivities()) {
|
|
174
172
|
if (!activity.isStart) continue;
|
package/dist/Environment.js
CHANGED
|
@@ -64,7 +64,7 @@ Environment.prototype.recover = function recover(state) {
|
|
|
64
64
|
if (state.output) Object.assign(this.output, state.output);
|
|
65
65
|
return this;
|
|
66
66
|
};
|
|
67
|
-
Environment.prototype.clone = function clone(overrideOptions
|
|
67
|
+
Environment.prototype.clone = function clone(overrideOptions) {
|
|
68
68
|
const services = this[kServices];
|
|
69
69
|
const newOptions = {
|
|
70
70
|
settings: {
|
|
@@ -82,7 +82,7 @@ Environment.prototype.clone = function clone(overrideOptions = {}) {
|
|
|
82
82
|
...overrideOptions,
|
|
83
83
|
services
|
|
84
84
|
};
|
|
85
|
-
if (overrideOptions
|
|
85
|
+
if (overrideOptions?.services) newOptions.services = {
|
|
86
86
|
...services,
|
|
87
87
|
...overrideOptions.services
|
|
88
88
|
};
|
|
@@ -111,7 +111,7 @@ Environment.prototype.registerScript = function registerScript(...args) {
|
|
|
111
111
|
Environment.prototype.getServiceByName = function getServiceByName(serviceName) {
|
|
112
112
|
return this[kServices][serviceName];
|
|
113
113
|
};
|
|
114
|
-
Environment.prototype.resolveExpression = function resolveExpression(expression, message
|
|
114
|
+
Environment.prototype.resolveExpression = function resolveExpression(expression, message, expressionFnContext) {
|
|
115
115
|
const from = {
|
|
116
116
|
environment: this,
|
|
117
117
|
...message
|
package/dist/EventBroker.js
CHANGED
|
@@ -111,7 +111,7 @@ EventBroker.prototype.on = function on(eventName, callback, eventOptions = {
|
|
|
111
111
|
callback(owner.getApi(message));
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
EventBroker.prototype.once = function once(eventName, callback, eventOptions
|
|
114
|
+
EventBroker.prototype.once = function once(eventName, callback, eventOptions) {
|
|
115
115
|
return this.on(eventName, callback, {
|
|
116
116
|
...eventOptions,
|
|
117
117
|
once: true
|
package/dist/MessageFormatter.js
CHANGED
|
@@ -66,7 +66,7 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
66
66
|
default:
|
|
67
67
|
{
|
|
68
68
|
message.ack();
|
|
69
|
-
const endRoutingKey = message.content
|
|
69
|
+
const endRoutingKey = message.content?.endRoutingKey;
|
|
70
70
|
if (endRoutingKey) {
|
|
71
71
|
this._decorate(message.content);
|
|
72
72
|
pending.push(message);
|
|
@@ -102,7 +102,7 @@ Formatter.prototype._complete = function complete(message, isError) {
|
|
|
102
102
|
if (executeMessage) executeMessage.ack();
|
|
103
103
|
this.broker.cancel(message.fields.consumerTag);
|
|
104
104
|
if (isError) {
|
|
105
|
-
const error = message.content
|
|
105
|
+
const error = message.content?.error || new Error('formatting failed');
|
|
106
106
|
const errMessage = error.message || 'formatting failed';
|
|
107
107
|
this._debug(`formatting of ${formatKey} failed with ${message.fields.routingKey}: ${errMessage}`);
|
|
108
108
|
return callback(new _Errors.ActivityError(errMessage, (0, _messageHelper.cloneMessage)(runMessage), error));
|
package/dist/Tracker.js
CHANGED
|
@@ -37,6 +37,7 @@ ActivityTracker.prototype.track = function track(routingKey, message) {
|
|
|
37
37
|
break;
|
|
38
38
|
case 'activity.execution.outbound.take':
|
|
39
39
|
case 'activity.detach':
|
|
40
|
+
case 'activity.call':
|
|
40
41
|
case 'activity.wait':
|
|
41
42
|
{
|
|
42
43
|
if (content.isMultiInstance) this._waiting(content.parent.executionId);else this._waiting(executionId);
|
|
@@ -109,7 +109,7 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
109
109
|
isTransaction: activityDef.isTransaction,
|
|
110
110
|
isParallelJoin,
|
|
111
111
|
isThrowing: activityDef.isThrowing,
|
|
112
|
-
lane: activityDef.lane
|
|
112
|
+
lane: activityDef.lane?.id
|
|
113
113
|
};
|
|
114
114
|
this[kExec] = new Map();
|
|
115
115
|
this[kMessageHandlers] = {
|
|
@@ -118,7 +118,7 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
118
118
|
onApiMessage: this._onApiMessage.bind(this),
|
|
119
119
|
onExecutionMessage: this._onExecutionMessage.bind(this)
|
|
120
120
|
};
|
|
121
|
-
this[kEventDefinitions] = eventDefinitions
|
|
121
|
+
this[kEventDefinitions] = eventDefinitions?.map((ed, idx) => new ed.Behaviour(this, ed, context, idx));
|
|
122
122
|
this[kExtensions] = context.loadExtensions(this);
|
|
123
123
|
this[kConsuming] = false;
|
|
124
124
|
this[kConsumingRunQ] = undefined;
|
|
@@ -149,7 +149,7 @@ Object.defineProperties(Activity.prototype, {
|
|
|
149
149
|
bpmnIo: {
|
|
150
150
|
get() {
|
|
151
151
|
const extensions = this[kExtensions];
|
|
152
|
-
return extensions
|
|
152
|
+
return extensions?.extensions.find(e => e.type === 'bpmnio');
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
formatter: {
|
|
@@ -666,7 +666,7 @@ Activity.prototype._continueRunMessage = function continueRunMessage(routingKey,
|
|
|
666
666
|
}
|
|
667
667
|
case 'run.execute.passthrough':
|
|
668
668
|
{
|
|
669
|
-
const execution = this.execution;
|
|
669
|
+
const execution = this[kExec].get('execution');
|
|
670
670
|
if (!isRedelivered && execution) {
|
|
671
671
|
if (execution.completed) return message.ack();
|
|
672
672
|
this[kExecuteMessage] = message;
|
|
@@ -677,14 +677,18 @@ Activity.prototype._continueRunMessage = function continueRunMessage(routingKey,
|
|
|
677
677
|
{
|
|
678
678
|
this.status = 'executing';
|
|
679
679
|
this[kExecuteMessage] = message;
|
|
680
|
-
const exec = this[kExec];
|
|
681
680
|
if (isRedelivered && this.extensions) this.extensions.activate((0, _messageHelper.cloneMessage)(message));
|
|
682
|
-
|
|
681
|
+
const exec = this[kExec];
|
|
682
|
+
let execution = exec.get('execution');
|
|
683
|
+
if (!execution) {
|
|
684
|
+
execution = new _ActivityExecution.default(this, this.context);
|
|
685
|
+
exec.set('execution', execution);
|
|
686
|
+
}
|
|
683
687
|
this.broker.getQueue('execution-q').assertConsumer(this[kMessageHandlers].onExecutionMessage, {
|
|
684
688
|
exclusive: true,
|
|
685
689
|
consumerTag: '_activity-execution'
|
|
686
690
|
});
|
|
687
|
-
return
|
|
691
|
+
return execution.execute(message);
|
|
688
692
|
}
|
|
689
693
|
case 'run.end':
|
|
690
694
|
{
|
|
@@ -852,7 +856,7 @@ Activity.prototype._doOutbound = function doOutbound(fromMessage, isDiscarded, c
|
|
|
852
856
|
if (!outboundSequenceFlows.length) return callback(null, []);
|
|
853
857
|
const fromContent = fromMessage.content;
|
|
854
858
|
let discardSequence = fromContent.discardSequence;
|
|
855
|
-
if (isDiscarded && !discardSequence && this[kFlags].attachedTo && fromContent.inbound
|
|
859
|
+
if (isDiscarded && !discardSequence && this[kFlags].attachedTo && fromContent.inbound?.[0]) {
|
|
856
860
|
discardSequence = [fromContent.inbound[0].id];
|
|
857
861
|
}
|
|
858
862
|
let outboundFlows;
|
|
@@ -860,7 +864,7 @@ Activity.prototype._doOutbound = function doOutbound(fromMessage, isDiscarded, c
|
|
|
860
864
|
outboundFlows = outboundSequenceFlows.map(flow => (0, _outboundEvaluator.formatFlowAction)(flow, {
|
|
861
865
|
action: 'discard'
|
|
862
866
|
}));
|
|
863
|
-
} else if (fromContent.outbound
|
|
867
|
+
} else if (fromContent.outbound?.length) {
|
|
864
868
|
outboundFlows = outboundSequenceFlows.map(flow => (0, _outboundEvaluator.formatFlowAction)(flow, fromContent.outbound.filter(f => f.id === flow.id).pop()));
|
|
865
869
|
}
|
|
866
870
|
if (outboundFlows) {
|
|
@@ -928,7 +932,7 @@ Activity.prototype._onResumeMessage = function onResumeMessage(message) {
|
|
|
928
932
|
this.logger.debug(`<${this.id}> resume from ${message.content.status}`);
|
|
929
933
|
return this.broker.publish('run', fields.routingKey, (0, _messageHelper.cloneContent)(stateMessage.content), stateMessage.properties);
|
|
930
934
|
};
|
|
931
|
-
Activity.prototype._publishEvent = function publishEvent(state, content, properties
|
|
935
|
+
Activity.prototype._publishEvent = function publishEvent(state, content, properties) {
|
|
932
936
|
this.broker.publish('event', `activity.${state}`, (0, _messageHelper.cloneContent)(content, {
|
|
933
937
|
state
|
|
934
938
|
}), {
|
|
@@ -982,9 +986,11 @@ Activity.prototype._onApiMessage = function onApiMessage(routingKey, message) {
|
|
|
982
986
|
}
|
|
983
987
|
};
|
|
984
988
|
Activity.prototype._createMessage = function createMessage(override) {
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
|
|
989
|
+
const {
|
|
990
|
+
name,
|
|
991
|
+
status,
|
|
992
|
+
parent
|
|
993
|
+
} = this;
|
|
988
994
|
const result = {
|
|
989
995
|
...override,
|
|
990
996
|
id: this.id,
|
|
@@ -35,7 +35,7 @@ Object.defineProperty(ActivityExecution.prototype, 'completed', {
|
|
|
35
35
|
});
|
|
36
36
|
ActivityExecution.prototype.execute = function execute(executeMessage) {
|
|
37
37
|
if (!executeMessage) throw new Error('Execution requires message');
|
|
38
|
-
const executionId = executeMessage.content
|
|
38
|
+
const executionId = executeMessage.content?.executionId;
|
|
39
39
|
if (!executionId) throw new Error('Execution requires execution id');
|
|
40
40
|
this.executionId = executionId;
|
|
41
41
|
const initMessage = this[kExecuteMessage] = (0, _messageHelper.cloneMessage)(executeMessage, {
|
|
@@ -338,7 +338,7 @@ ActivityExecution.prototype._onParentApiMessage = function onParentApiMessage(ro
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
ActivityExecution.prototype._onStop = function onStop(message) {
|
|
341
|
-
const stoppedId = message
|
|
341
|
+
const stoppedId = message?.content?.executionId;
|
|
342
342
|
const running = this.getPostponed();
|
|
343
343
|
for (const api of running) {
|
|
344
344
|
if (stoppedId !== api.content.executionId) {
|
|
@@ -18,9 +18,6 @@ function OutboundEvaluator(activity, outboundFlows) {
|
|
|
18
18
|
const [defaultFlow] = flows.splice(defaultFlowIdx, 1);
|
|
19
19
|
flows.push(defaultFlow);
|
|
20
20
|
}
|
|
21
|
-
this.defaultFlowIdx = outboundFlows.findIndex(({
|
|
22
|
-
isDefault
|
|
23
|
-
}) => isDefault);
|
|
24
21
|
this._onEvaluated = this.onEvaluated.bind(this);
|
|
25
22
|
this.evaluateArgs = {};
|
|
26
23
|
}
|
|
@@ -106,7 +106,7 @@ Object.defineProperties(Definition.prototype, {
|
|
|
106
106
|
activityStatus: {
|
|
107
107
|
get() {
|
|
108
108
|
const execution = this[kExec].get('execution');
|
|
109
|
-
return execution
|
|
109
|
+
return execution?.activityStatus || 'idle';
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
});
|
|
@@ -159,7 +159,7 @@ Definition.prototype.getState = function getState() {
|
|
|
159
159
|
stopped: this.stopped,
|
|
160
160
|
counters: this.counters,
|
|
161
161
|
environment: this.environment.getState(),
|
|
162
|
-
execution: this.execution
|
|
162
|
+
execution: this.execution?.getState(),
|
|
163
163
|
broker: this.broker.getState(true)
|
|
164
164
|
});
|
|
165
165
|
};
|
|
@@ -272,8 +272,8 @@ Definition.prototype.sendMessage = function sendMessage(message) {
|
|
|
272
272
|
message
|
|
273
273
|
};
|
|
274
274
|
let messageType = 'message';
|
|
275
|
-
const reference = message
|
|
276
|
-
if (reference
|
|
275
|
+
const reference = message?.id && this.getElementById(message.id);
|
|
276
|
+
if (reference?.resolve) {
|
|
277
277
|
const resolvedReference = reference.resolve(this._createMessage({
|
|
278
278
|
message
|
|
279
279
|
}));
|
|
@@ -390,7 +390,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
|
|
|
390
390
|
break;
|
|
391
391
|
case 'process.discarded':
|
|
392
392
|
{
|
|
393
|
-
if (inbound
|
|
393
|
+
if (inbound?.length) {
|
|
394
394
|
const calledFrom = inbound[0];
|
|
395
395
|
this._getProcessApi({
|
|
396
396
|
content: calledFrom
|
|
@@ -402,7 +402,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
|
|
|
402
402
|
}
|
|
403
403
|
case 'process.end':
|
|
404
404
|
{
|
|
405
|
-
if (inbound
|
|
405
|
+
if (inbound?.length) {
|
|
406
406
|
const calledFrom = inbound[0];
|
|
407
407
|
this._getProcessApi({
|
|
408
408
|
content: calledFrom
|
|
@@ -419,7 +419,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
|
|
|
419
419
|
}
|
|
420
420
|
case 'process.error':
|
|
421
421
|
{
|
|
422
|
-
if (inbound
|
|
422
|
+
if (inbound?.length) {
|
|
423
423
|
const calledFrom = inbound[0];
|
|
424
424
|
this._getProcessApi({
|
|
425
425
|
content: calledFrom
|
|
@@ -467,7 +467,7 @@ DefinitionExecution.prototype._onProcessCompleted = function onProcessCompleted(
|
|
|
467
467
|
} = message.content;
|
|
468
468
|
message.ack();
|
|
469
469
|
this._debug(`left <${executionId} (${id})> (${type}), pending runs ${this.postponedCount}`);
|
|
470
|
-
if (inbound
|
|
470
|
+
if (inbound?.length) {
|
|
471
471
|
const bp = this._removeProcessByExecutionId(executionId);
|
|
472
472
|
this._deactivateProcess(bp);
|
|
473
473
|
}
|
|
@@ -627,7 +627,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
|
|
|
627
627
|
const messageType = executeMessage.properties.type;
|
|
628
628
|
const delegateMessage = executeMessage.content.message;
|
|
629
629
|
const reference = this.context.getActivityById(delegateMessage.id);
|
|
630
|
-
const message = reference
|
|
630
|
+
const message = reference?.resolve(executeMessage);
|
|
631
631
|
this._debug(`<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating.`);
|
|
632
632
|
this.getApi().sendApiMessage(messageType, {
|
|
633
633
|
source: {
|
|
@@ -674,7 +674,7 @@ DefinitionExecution.prototype._complete = function complete(completionType, cont
|
|
|
674
674
|
...options
|
|
675
675
|
});
|
|
676
676
|
};
|
|
677
|
-
DefinitionExecution.prototype._createMessage = function createMessage(content
|
|
677
|
+
DefinitionExecution.prototype._createMessage = function createMessage(content) {
|
|
678
678
|
return {
|
|
679
679
|
id: this.id,
|
|
680
680
|
type: this.type,
|
package/dist/error/Errors.js
CHANGED
|
@@ -12,7 +12,7 @@ class ActivityError extends Error {
|
|
|
12
12
|
this.type = 'ActivityError';
|
|
13
13
|
this.name = this.constructor.name;
|
|
14
14
|
this.description = description;
|
|
15
|
-
if (sourceMessage) this.source = (0, _messageHelper.cloneMessage)(sourceMessage, sourceMessage.content
|
|
15
|
+
if (sourceMessage) this.source = (0, _messageHelper.cloneMessage)(sourceMessage, sourceMessage.content?.error && {
|
|
16
16
|
error: undefined
|
|
17
17
|
});
|
|
18
18
|
if (inner) {
|
|
@@ -31,17 +31,14 @@ class RunError extends ActivityError {
|
|
|
31
31
|
}
|
|
32
32
|
exports.RunError = RunError;
|
|
33
33
|
class BpmnError extends Error {
|
|
34
|
-
constructor(description, behaviour
|
|
35
|
-
const {
|
|
36
|
-
errorCode
|
|
37
|
-
} = behaviour;
|
|
34
|
+
constructor(description, behaviour, sourceMessage, inner) {
|
|
38
35
|
super(description);
|
|
39
36
|
this.type = 'BpmnError';
|
|
40
|
-
this.name = behaviour
|
|
37
|
+
this.name = behaviour?.name ?? this.constructor.name;
|
|
41
38
|
this.description = description;
|
|
42
|
-
this.code =
|
|
43
|
-
this.id = behaviour
|
|
44
|
-
if (sourceMessage) this.source = (0, _messageHelper.cloneMessage)(sourceMessage, sourceMessage.content
|
|
39
|
+
this.code = behaviour?.errorCode?.toString() ?? behaviour?.code;
|
|
40
|
+
this.id = behaviour?.id;
|
|
41
|
+
if (sourceMessage) this.source = (0, _messageHelper.cloneMessage)(sourceMessage, sourceMessage.content?.error && {
|
|
45
42
|
error: undefined
|
|
46
43
|
});
|
|
47
44
|
if (inner) this.inner = inner;
|
|
@@ -56,7 +53,7 @@ function makeErrorFromMessage(errorMessage) {
|
|
|
56
53
|
const {
|
|
57
54
|
error
|
|
58
55
|
} = content;
|
|
59
|
-
if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields
|
|
56
|
+
if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields?.routingKey}`);
|
|
60
57
|
if (isKnownError(error)) return error;
|
|
61
58
|
switch (error.type) {
|
|
62
59
|
case 'ActivityError':
|
|
@@ -28,8 +28,7 @@ function CancelEventDefinition(activity, eventDefinition) {
|
|
|
28
28
|
}
|
|
29
29
|
Object.defineProperty(CancelEventDefinition.prototype, 'executionId', {
|
|
30
30
|
get() {
|
|
31
|
-
|
|
32
|
-
return message && message.content.executionId;
|
|
31
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
34
|
CancelEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -47,8 +47,7 @@ function CompensateEventDefinition(activity, eventDefinition, context) {
|
|
|
47
47
|
}
|
|
48
48
|
Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
|
|
49
49
|
get() {
|
|
50
|
-
|
|
51
|
-
return message && message.content.executionId;
|
|
50
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
CompensateEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -95,7 +94,7 @@ CompensateEventDefinition.prototype.executeThrow = function executeThrow(execute
|
|
|
95
94
|
const {
|
|
96
95
|
parent
|
|
97
96
|
} = executeContent;
|
|
98
|
-
const parentExecutionId = parent
|
|
97
|
+
const parentExecutionId = parent?.executionId;
|
|
99
98
|
this.logger.debug(`<${parentExecutionId} (${this.id})> throw compensate`);
|
|
100
99
|
const broker = this.broker;
|
|
101
100
|
const throwContent = (0, _messageHelper.cloneContent)(executeContent, {
|
|
@@ -29,8 +29,7 @@ function ConditionalEventDefinition(activity, eventDefinition, _context, index)
|
|
|
29
29
|
}
|
|
30
30
|
Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
|
|
31
31
|
get() {
|
|
32
|
-
|
|
33
|
-
return message && message.content.executionId;
|
|
32
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
35
|
ConditionalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -151,7 +150,7 @@ ConditionalEventDefinition.prototype.getCondition = function getCondition(index)
|
|
|
151
150
|
}
|
|
152
151
|
};
|
|
153
152
|
ConditionalEventDefinition.prototype._onDelegateApiMessage = function onDelegateApiMessage(routingKey, message) {
|
|
154
|
-
if (message.content.message
|
|
153
|
+
if (message.content.message?.id === this.id) {
|
|
155
154
|
this._onApiMessage(routingKey, message);
|
|
156
155
|
}
|
|
157
156
|
};
|
|
@@ -51,8 +51,7 @@ function ErrorEventDefinition(activity, eventDefinition) {
|
|
|
51
51
|
}
|
|
52
52
|
Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
|
|
53
53
|
get() {
|
|
54
|
-
|
|
55
|
-
return message && message.content.executionId;
|
|
54
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
56
55
|
}
|
|
57
56
|
});
|
|
58
57
|
ErrorEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -66,7 +65,7 @@ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessa
|
|
|
66
65
|
executionId,
|
|
67
66
|
parent
|
|
68
67
|
} = executeContent;
|
|
69
|
-
const parentExecutionId = parent
|
|
68
|
+
const parentExecutionId = parent?.executionId;
|
|
70
69
|
const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
|
|
71
70
|
this[kMessageQ].consume(this._onThrowApiMessage.bind(this), {
|
|
72
71
|
noAck: true,
|
|
@@ -143,7 +142,7 @@ ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(r
|
|
|
143
142
|
const error = message.content.message;
|
|
144
143
|
if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
|
|
145
144
|
const info = this[kReferenceInfo];
|
|
146
|
-
if (info.message.id !==
|
|
145
|
+
if (info.message.id !== error?.id) return;
|
|
147
146
|
return this._catchError(routingKey, message, error);
|
|
148
147
|
};
|
|
149
148
|
ErrorEventDefinition.prototype._catchError = function catchError(routingKey, message, error) {
|
|
@@ -52,8 +52,7 @@ function EscalationEventDefinition(activity, eventDefinition) {
|
|
|
52
52
|
}
|
|
53
53
|
Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
|
|
54
54
|
get() {
|
|
55
|
-
|
|
56
|
-
return message && message.content.executionId;
|
|
55
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
58
|
EscalationEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -51,8 +51,7 @@ function LinkEventDefinition(activity, eventDefinition) {
|
|
|
51
51
|
}
|
|
52
52
|
Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
|
|
53
53
|
get() {
|
|
54
|
-
|
|
55
|
-
return message && message.content.executionId;
|
|
54
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
56
55
|
}
|
|
57
56
|
});
|
|
58
57
|
LinkEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -51,8 +51,7 @@ function MessageEventDefinition(activity, eventDefinition) {
|
|
|
51
51
|
}
|
|
52
52
|
Object.defineProperty(MessageEventDefinition.prototype, 'executionId', {
|
|
53
53
|
get() {
|
|
54
|
-
|
|
55
|
-
return message && message.content.executionId;
|
|
54
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
56
55
|
}
|
|
57
56
|
});
|
|
58
57
|
MessageEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -66,7 +65,7 @@ MessageEventDefinition.prototype.executeCatch = function executeCatch(executeMes
|
|
|
66
65
|
executionId,
|
|
67
66
|
parent
|
|
68
67
|
} = executeContent;
|
|
69
|
-
const parentExecutionId = parent
|
|
68
|
+
const parentExecutionId = parent?.executionId;
|
|
70
69
|
const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
|
|
71
70
|
this._debug(`expect ${info.description}`);
|
|
72
71
|
const broker = this.broker;
|
|
@@ -52,8 +52,7 @@ function SignalEventDefinition(activity, eventDefinition) {
|
|
|
52
52
|
}
|
|
53
53
|
Object.defineProperty(SignalEventDefinition.prototype, 'executionId', {
|
|
54
54
|
get() {
|
|
55
|
-
|
|
56
|
-
return message && message.content.executionId;
|
|
55
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
58
|
SignalEventDefinition.prototype.execute = function execute(executeMessage) {
|
|
@@ -67,7 +66,7 @@ SignalEventDefinition.prototype.executeCatch = function executeCatch(executeMess
|
|
|
67
66
|
executionId,
|
|
68
67
|
parent
|
|
69
68
|
} = executeContent;
|
|
70
|
-
const parentExecutionId = parent
|
|
69
|
+
const parentExecutionId = parent?.executionId;
|
|
71
70
|
const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
|
|
72
71
|
const broker = this.broker;
|
|
73
72
|
const onCatchMessage = this._onCatchMessage.bind(this);
|
|
@@ -32,8 +32,7 @@ function TimerEventDefinition(activity, eventDefinition) {
|
|
|
32
32
|
Object.defineProperties(TimerEventDefinition.prototype, {
|
|
33
33
|
executionId: {
|
|
34
34
|
get() {
|
|
35
|
-
|
|
36
|
-
return content && content.executionId;
|
|
35
|
+
return this[kTimerContent]?.executionId;
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
stopped: {
|
|
@@ -262,7 +261,7 @@ TimerEventDefinition.prototype._getTimers = function getTimers(executeMessage) {
|
|
|
262
261
|
} else if (!Object.keys(result).length) {
|
|
263
262
|
result.timeout = 0;
|
|
264
263
|
}
|
|
265
|
-
if (content.inbound && 'repeat' in content.inbound[0]) {
|
|
264
|
+
if (content.inbound?.[0] && 'repeat' in content.inbound[0]) {
|
|
266
265
|
result.repeat = content.inbound[0].repeat;
|
|
267
266
|
}
|
|
268
267
|
return result;
|
|
@@ -32,8 +32,7 @@ function BoundaryEventBehaviour(activity) {
|
|
|
32
32
|
Object.defineProperties(BoundaryEventBehaviour.prototype, {
|
|
33
33
|
executionId: {
|
|
34
34
|
get() {
|
|
35
|
-
|
|
36
|
-
return message && message.content.executionId;
|
|
35
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
cancelActivity: {
|
|
@@ -114,7 +113,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {
|
|
|
114
113
|
inbound,
|
|
115
114
|
executionId
|
|
116
115
|
} = this[kExecuteMessage].content;
|
|
117
|
-
const attachedToContent = inbound
|
|
116
|
+
const attachedToContent = inbound?.[0];
|
|
118
117
|
const attachedTo = this.attachedTo;
|
|
119
118
|
this.activity.logger.debug(`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
|
|
120
119
|
if (content.isRecovered && !attachedTo.isRunning) {
|
|
@@ -23,8 +23,7 @@ function StartEventBehaviour(activity) {
|
|
|
23
23
|
}
|
|
24
24
|
Object.defineProperty(StartEventBehaviour.prototype, 'executionId', {
|
|
25
25
|
get() {
|
|
26
|
-
|
|
27
|
-
return message && message.content.executionId;
|
|
26
|
+
return this[kExecuteMessage]?.content.executionId;
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
29
|
StartEventBehaviour.prototype.execute = function execute(executeMessage) {
|
|
@@ -58,13 +58,13 @@ Object.defineProperty(Association.prototype, 'counters', {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
Association.prototype.take = function take(content
|
|
61
|
+
Association.prototype.take = function take(content) {
|
|
62
62
|
this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
|
|
63
63
|
++this[kCounters].take;
|
|
64
64
|
this._publishEvent('take', content);
|
|
65
65
|
return true;
|
|
66
66
|
};
|
|
67
|
-
Association.prototype.discard = function discard(content
|
|
67
|
+
Association.prototype.discard = function discard(content) {
|
|
68
68
|
this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
|
|
69
69
|
++this[kCounters].discard;
|
|
70
70
|
this._publishEvent('discard', content);
|
|
@@ -66,19 +66,15 @@ Object.defineProperty(SequenceFlow.prototype, 'counters', {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
SequenceFlow.prototype.take = function take(content
|
|
70
|
-
const
|
|
71
|
-
sequenceId
|
|
72
|
-
} = content;
|
|
69
|
+
SequenceFlow.prototype.take = function take(content) {
|
|
70
|
+
const sequenceId = content?.sequenceId;
|
|
73
71
|
this.logger.debug(`<${sequenceId} (${this.id})> take, target <${this.targetId}>`);
|
|
74
72
|
++this[kCounters].take;
|
|
75
73
|
this._publishEvent('take', content);
|
|
76
74
|
return true;
|
|
77
75
|
};
|
|
78
76
|
SequenceFlow.prototype.discard = function discard(content = {}) {
|
|
79
|
-
const
|
|
80
|
-
sequenceId = (0, _shared.getUniqueId)(this.id)
|
|
81
|
-
} = content;
|
|
77
|
+
const sequenceId = content?.sequenceId ?? (0, _shared.getUniqueId)(this.id);
|
|
82
78
|
const discardSequence = content.discardSequence = (content.discardSequence || []).slice();
|
|
83
79
|
if (discardSequence.indexOf(this.targetId) > -1) {
|
|
84
80
|
++this[kCounters].looped;
|
|
@@ -23,7 +23,7 @@ function EnvironmentDataObject(dataObjectDef, {
|
|
|
23
23
|
}
|
|
24
24
|
EnvironmentDataObject.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
25
25
|
const environment = this.environment;
|
|
26
|
-
const value = environment.variables._data
|
|
26
|
+
const value = environment.variables._data?.[this.id];
|
|
27
27
|
const content = this._createContent(value);
|
|
28
28
|
return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
|
|
29
29
|
};
|
|
@@ -23,7 +23,7 @@ function EnvironmentDataStore(dataStoreDef, {
|
|
|
23
23
|
}
|
|
24
24
|
EnvironmentDataStore.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
25
25
|
const environment = this.environment;
|
|
26
|
-
const value = environment.variables._data
|
|
26
|
+
const value = environment.variables._data?.[this.id];
|
|
27
27
|
const content = this._createContent(value);
|
|
28
28
|
return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
|
|
29
29
|
};
|
|
@@ -23,7 +23,7 @@ function EnvironmentDataStoreReference(dataObjectDef, {
|
|
|
23
23
|
}
|
|
24
24
|
EnvironmentDataStoreReference.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
25
25
|
const environment = this.environment;
|
|
26
|
-
const value = environment.variables._data
|
|
26
|
+
const value = environment.variables._data?.[this.id];
|
|
27
27
|
const content = this._createContent(value);
|
|
28
28
|
return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
|
|
29
29
|
};
|
|
@@ -23,10 +23,10 @@ function IoSpecification(activity, ioSpecificationDef, context) {
|
|
|
23
23
|
}
|
|
24
24
|
IoSpecification.prototype.activate = function activate(message) {
|
|
25
25
|
if (this[kConsuming]) return;
|
|
26
|
-
if (message
|
|
26
|
+
if (message?.fields.redelivered && message.fields.routingKey === 'run.start') {
|
|
27
27
|
this._onFormatEnter();
|
|
28
28
|
}
|
|
29
|
-
if (message
|
|
29
|
+
if (message?.fields.redelivered && message.fields.routingKey === 'run.end') {
|
|
30
30
|
this._onFormatComplete(message);
|
|
31
31
|
}
|
|
32
32
|
this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
|