bpmn-elements 16.2.0 → 16.2.2

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.
Files changed (72) hide show
  1. package/dist/Api.js +1 -1
  2. package/dist/Context.js +2 -4
  3. package/dist/Environment.js +3 -3
  4. package/dist/EventBroker.js +1 -1
  5. package/dist/MessageFormatter.js +2 -2
  6. package/dist/Tracker.js +1 -0
  7. package/dist/activity/Activity.js +19 -13
  8. package/dist/activity/ActivityExecution.js +2 -2
  9. package/dist/activity/outbound-evaluator.js +0 -3
  10. package/dist/definition/Definition.js +4 -4
  11. package/dist/definition/DefinitionExecution.js +6 -6
  12. package/dist/error/Errors.js +7 -10
  13. package/dist/eventDefinitions/CancelEventDefinition.js +1 -2
  14. package/dist/eventDefinitions/CompensateEventDefinition.js +2 -3
  15. package/dist/eventDefinitions/ConditionalEventDefinition.js +2 -3
  16. package/dist/eventDefinitions/ErrorEventDefinition.js +3 -4
  17. package/dist/eventDefinitions/EscalationEventDefinition.js +1 -2
  18. package/dist/eventDefinitions/LinkEventDefinition.js +1 -2
  19. package/dist/eventDefinitions/MessageEventDefinition.js +2 -3
  20. package/dist/eventDefinitions/SignalEventDefinition.js +2 -3
  21. package/dist/eventDefinitions/TimerEventDefinition.js +2 -3
  22. package/dist/events/BoundaryEvent.js +2 -3
  23. package/dist/events/StartEvent.js +1 -2
  24. package/dist/flows/Association.js +2 -2
  25. package/dist/flows/SequenceFlow.js +3 -7
  26. package/dist/getPropertyValue.js +1 -2
  27. package/dist/io/EnvironmentDataObject.js +1 -1
  28. package/dist/io/EnvironmentDataStore.js +1 -1
  29. package/dist/io/EnvironmentDataStoreReference.js +1 -1
  30. package/dist/io/InputOutputSpecification.js +2 -2
  31. package/dist/io/Properties.js +14 -14
  32. package/dist/process/Process.js +5 -7
  33. package/dist/process/ProcessExecution.js +13 -13
  34. package/dist/tasks/CallActivity.js +7 -2
  35. package/dist/tasks/ServiceTask.js +1 -1
  36. package/package.json +5 -5
  37. package/src/Api.js +6 -8
  38. package/src/Context.js +2 -1
  39. package/src/Environment.js +3 -3
  40. package/src/EventBroker.js +6 -8
  41. package/src/MessageFormatter.js +3 -5
  42. package/src/Tracker.js +1 -0
  43. package/src/activity/Activity.js +18 -13
  44. package/src/activity/ActivityExecution.js +2 -2
  45. package/src/activity/outbound-evaluator.js +0 -1
  46. package/src/definition/Definition.js +4 -4
  47. package/src/definition/DefinitionExecution.js +6 -6
  48. package/src/error/Errors.js +11 -17
  49. package/src/eventDefinitions/CancelEventDefinition.js +1 -2
  50. package/src/eventDefinitions/CompensateEventDefinition.js +2 -3
  51. package/src/eventDefinitions/ConditionalEventDefinition.js +2 -3
  52. package/src/eventDefinitions/ErrorEventDefinition.js +3 -4
  53. package/src/eventDefinitions/EscalationEventDefinition.js +1 -2
  54. package/src/eventDefinitions/LinkEventDefinition.js +1 -2
  55. package/src/eventDefinitions/MessageEventDefinition.js +2 -3
  56. package/src/eventDefinitions/SignalEventDefinition.js +2 -3
  57. package/src/eventDefinitions/TimerEventDefinition.js +2 -3
  58. package/src/events/BoundaryEvent.js +2 -3
  59. package/src/events/StartEvent.js +1 -2
  60. package/src/flows/Association.js +2 -2
  61. package/src/flows/SequenceFlow.js +3 -3
  62. package/src/getPropertyValue.js +1 -3
  63. package/src/io/EnvironmentDataObject.js +1 -1
  64. package/src/io/EnvironmentDataStore.js +1 -1
  65. package/src/io/EnvironmentDataStoreReference.js +1 -1
  66. package/src/io/InputOutputSpecification.js +2 -2
  67. package/src/io/Properties.js +14 -14
  68. package/src/messageHelper.js +6 -8
  69. package/src/process/Process.js +5 -7
  70. package/src/process/ProcessExecution.js +13 -13
  71. package/src/tasks/CallActivity.js +7 -3
  72. package/src/tasks/ServiceTask.js +1 -1
@@ -408,7 +408,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
408
408
  this[kStatus] = 'executing';
409
409
  break;
410
410
  case 'process.discarded': {
411
- if (inbound && inbound.length) {
411
+ if (inbound?.length) {
412
412
  const calledFrom = inbound[0];
413
413
  this._getProcessApi({ content: calledFrom }).cancel({
414
414
  executionId: calledFrom.executionId,
@@ -417,7 +417,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
417
417
  break;
418
418
  }
419
419
  case 'process.end': {
420
- if (inbound && inbound.length) {
420
+ if (inbound?.length) {
421
421
  const calledFrom = inbound[0];
422
422
 
423
423
  this._getProcessApi({ content: calledFrom }).signal({
@@ -430,7 +430,7 @@ DefinitionExecution.prototype._onProcessMessage = function onProcessMessage(rout
430
430
  break;
431
431
  }
432
432
  case 'process.error': {
433
- if (inbound && inbound.length) {
433
+ if (inbound?.length) {
434
434
  const calledFrom = inbound[0];
435
435
 
436
436
  this._getProcessApi({ content: calledFrom }).sendApiMessage(
@@ -478,7 +478,7 @@ DefinitionExecution.prototype._onProcessCompleted = function onProcessCompleted(
478
478
  message.ack();
479
479
  this._debug(`left <${executionId} (${id})> (${type}), pending runs ${this.postponedCount}`);
480
480
 
481
- if (inbound && inbound.length) {
481
+ if (inbound?.length) {
482
482
  const bp = this._removeProcessByExecutionId(executionId);
483
483
  this._deactivateProcess(bp);
484
484
  }
@@ -651,7 +651,7 @@ DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(ro
651
651
  const delegateMessage = executeMessage.content.message;
652
652
 
653
653
  const reference = this.context.getActivityById(delegateMessage.id);
654
- const message = reference && reference.resolve(executeMessage);
654
+ const message = reference?.resolve(executeMessage);
655
655
 
656
656
  this._debug(
657
657
  `<${reference ? `${messageType} ${delegateMessage.id}>` : `anonymous ${messageType}`} event received from <${content.parent.id}.${content.id}>. Delegating.`,
@@ -710,7 +710,7 @@ DefinitionExecution.prototype._complete = function complete(completionType, cont
710
710
  );
711
711
  };
712
712
 
713
- DefinitionExecution.prototype._createMessage = function createMessage(content = {}) {
713
+ DefinitionExecution.prototype._createMessage = function createMessage(content) {
714
714
  return {
715
715
  id: this.id,
716
716
  type: this.type,
@@ -1,13 +1,12 @@
1
1
  import { cloneMessage } from '../messageHelper.js';
2
2
 
3
- class ActivityError extends Error {
3
+ export class ActivityError extends Error {
4
4
  constructor(description, sourceMessage, inner) {
5
5
  super(description);
6
6
  this.type = 'ActivityError';
7
7
  this.name = this.constructor.name;
8
8
  this.description = description;
9
- if (sourceMessage)
10
- this.source = cloneMessage(sourceMessage, sourceMessage.content && sourceMessage.content.error && { error: undefined });
9
+ if (sourceMessage) this.source = cloneMessage(sourceMessage, sourceMessage.content?.error && { error: undefined });
11
10
  if (inner) {
12
11
  this.inner = inner;
13
12
  if (inner.name) this.name = inner.name;
@@ -16,38 +15,33 @@ class ActivityError extends Error {
16
15
  }
17
16
  }
18
17
 
19
- class RunError extends ActivityError {
18
+ export class RunError extends ActivityError {
20
19
  constructor(...args) {
21
20
  super(...args);
22
21
  this.type = 'RunError';
23
22
  }
24
23
  }
25
24
 
26
- class BpmnError extends Error {
27
- constructor(description, behaviour = {}, sourceMessage, inner) {
28
- const { errorCode } = behaviour;
29
-
25
+ export class BpmnError extends Error {
26
+ constructor(description, behaviour, sourceMessage, inner) {
30
27
  super(description);
31
28
  this.type = 'BpmnError';
32
- this.name = behaviour.name || this.constructor.name;
29
+ this.name = behaviour?.name ?? this.constructor.name;
33
30
  this.description = description;
34
- this.code = ('errorCode' in behaviour && errorCode && errorCode.toString()) || behaviour.code;
35
- this.id = behaviour.id;
36
- if (sourceMessage)
37
- this.source = cloneMessage(sourceMessage, sourceMessage.content && sourceMessage.content.error && { error: undefined });
31
+ this.code = behaviour?.errorCode?.toString() ?? behaviour?.code;
32
+ this.id = behaviour?.id;
33
+ if (sourceMessage) this.source = cloneMessage(sourceMessage, sourceMessage.content?.error && { error: undefined });
38
34
  if (inner) this.inner = inner;
39
35
  }
40
36
  }
41
37
 
42
- export { ActivityError, BpmnError, RunError, makeErrorFromMessage };
43
-
44
- function makeErrorFromMessage(errorMessage) {
38
+ export function makeErrorFromMessage(errorMessage) {
45
39
  const { content } = errorMessage;
46
40
 
47
41
  if (isKnownError(content)) return content;
48
42
 
49
43
  const { error } = content;
50
- if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields && errorMessage.fields.routingKey}`);
44
+ if (!error) return new Error(`Malformatted error message with routing key ${errorMessage.fields?.routingKey}`);
51
45
 
52
46
  if (isKnownError(error)) return error;
53
47
 
@@ -19,8 +19,7 @@ export default function CancelEventDefinition(activity, eventDefinition) {
19
19
 
20
20
  Object.defineProperty(CancelEventDefinition.prototype, 'executionId', {
21
21
  get() {
22
- const message = this[kExecuteMessage];
23
- return message && message.content.executionId;
22
+ return this[kExecuteMessage]?.content.executionId;
24
23
  },
25
24
  });
26
25
 
@@ -30,8 +30,7 @@ export default function CompensateEventDefinition(activity, eventDefinition, con
30
30
 
31
31
  Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
32
32
  get() {
33
- const message = this[kExecuteMessage];
34
- return message && message.content.executionId;
33
+ return this[kExecuteMessage]?.content.executionId;
35
34
  },
36
35
  });
37
36
 
@@ -87,7 +86,7 @@ CompensateEventDefinition.prototype.executeCatch = function executeCatch(execute
87
86
  CompensateEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
88
87
  const executeContent = executeMessage.content;
89
88
  const { parent } = executeContent;
90
- const parentExecutionId = parent && parent.executionId;
89
+ const parentExecutionId = parent?.executionId;
91
90
 
92
91
  this.logger.debug(`<${parentExecutionId} (${this.id})> throw compensate`);
93
92
 
@@ -20,8 +20,7 @@ export default function ConditionalEventDefinition(activity, eventDefinition, _c
20
20
 
21
21
  Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
22
22
  get() {
23
- const message = this[kExecuteMessage];
24
- return message && message.content.executionId;
23
+ return this[kExecuteMessage]?.content.executionId;
25
24
  },
26
25
  });
27
26
 
@@ -149,7 +148,7 @@ ConditionalEventDefinition.prototype.getCondition = function getCondition(index)
149
148
  };
150
149
 
151
150
  ConditionalEventDefinition.prototype._onDelegateApiMessage = function onDelegateApiMessage(routingKey, message) {
152
- if (message.content.message && message.content.message.id === this.id) {
151
+ if (message.content.message?.id === this.id) {
153
152
  this._onApiMessage(routingKey, message);
154
153
  }
155
154
  };
@@ -38,8 +38,7 @@ export default function ErrorEventDefinition(activity, eventDefinition) {
38
38
 
39
39
  Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
40
40
  get() {
41
- const message = this[kExecuteMessage];
42
- return message && message.content.executionId;
41
+ return this[kExecuteMessage]?.content.executionId;
43
42
  },
44
43
  });
45
44
 
@@ -53,7 +52,7 @@ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessa
53
52
 
54
53
  const executeContent = executeMessage.content;
55
54
  const { executionId, parent } = executeContent;
56
- const parentExecutionId = parent && parent.executionId;
55
+ const parentExecutionId = parent?.executionId;
57
56
 
58
57
  const info = (this[kReferenceInfo] = this._getReferenceInfo(executeMessage));
59
58
 
@@ -145,7 +144,7 @@ ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(r
145
144
  if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
146
145
 
147
146
  const info = this[kReferenceInfo];
148
- if (info.message.id !== (error && error.id)) return;
147
+ if (info.message.id !== error?.id) return;
149
148
  return this._catchError(routingKey, message, error);
150
149
  };
151
150
 
@@ -38,8 +38,7 @@ export default function EscalationEventDefinition(activity, eventDefinition) {
38
38
 
39
39
  Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
40
40
  get() {
41
- const message = this[kExecuteMessage];
42
- return message && message.content.executionId;
41
+ return this[kExecuteMessage]?.content.executionId;
43
42
  },
44
43
  });
45
44
 
@@ -38,8 +38,7 @@ export default function LinkEventDefinition(activity, eventDefinition) {
38
38
 
39
39
  Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
40
40
  get() {
41
- const message = this[kExecuteMessage];
42
- return message && message.content.executionId;
41
+ return this[kExecuteMessage]?.content.executionId;
43
42
  },
44
43
  });
45
44
 
@@ -38,8 +38,7 @@ export default function MessageEventDefinition(activity, eventDefinition) {
38
38
 
39
39
  Object.defineProperty(MessageEventDefinition.prototype, 'executionId', {
40
40
  get() {
41
- const message = this[kExecuteMessage];
42
- return message && message.content.executionId;
41
+ return this[kExecuteMessage]?.content.executionId;
43
42
  },
44
43
  });
45
44
 
@@ -53,7 +52,7 @@ MessageEventDefinition.prototype.executeCatch = function executeCatch(executeMes
53
52
 
54
53
  const executeContent = executeMessage.content;
55
54
  const { executionId, parent } = executeContent;
56
- const parentExecutionId = parent && parent.executionId;
55
+ const parentExecutionId = parent?.executionId;
57
56
 
58
57
  const info = (this[kReferenceInfo] = this._getReferenceInfo(executeMessage));
59
58
  this._debug(`expect ${info.description}`);
@@ -38,8 +38,7 @@ export default function SignalEventDefinition(activity, eventDefinition) {
38
38
 
39
39
  Object.defineProperty(SignalEventDefinition.prototype, 'executionId', {
40
40
  get() {
41
- const message = this[kExecuteMessage];
42
- return message && message.content.executionId;
41
+ return this[kExecuteMessage]?.content.executionId;
43
42
  },
44
43
  });
45
44
 
@@ -53,7 +52,7 @@ SignalEventDefinition.prototype.executeCatch = function executeCatch(executeMess
53
52
 
54
53
  const executeContent = executeMessage.content;
55
54
  const { executionId, parent } = executeContent;
56
- const parentExecutionId = parent && parent.executionId;
55
+ const parentExecutionId = parent?.executionId;
57
56
 
58
57
  const info = (this[kReferenceInfo] = this._getReferenceInfo(executeMessage));
59
58
  const broker = this.broker;
@@ -29,8 +29,7 @@ export default function TimerEventDefinition(activity, eventDefinition) {
29
29
  Object.defineProperties(TimerEventDefinition.prototype, {
30
30
  executionId: {
31
31
  get() {
32
- const content = this[kTimerContent];
33
- return content && content.executionId;
32
+ return this[kTimerContent]?.executionId;
34
33
  },
35
34
  },
36
35
  stopped: {
@@ -265,7 +264,7 @@ TimerEventDefinition.prototype._getTimers = function getTimers(executeMessage) {
265
264
  result.timeout = 0;
266
265
  }
267
266
 
268
- if (content.inbound && 'repeat' in content.inbound[0]) {
267
+ if (content.inbound?.[0] && 'repeat' in content.inbound[0]) {
269
268
  result.repeat = content.inbound[0].repeat;
270
269
  }
271
270
 
@@ -29,8 +29,7 @@ export function BoundaryEventBehaviour(activity) {
29
29
  Object.defineProperties(BoundaryEventBehaviour.prototype, {
30
30
  executionId: {
31
31
  get() {
32
- const message = this[kExecuteMessage];
33
- return message && message.content.executionId;
32
+ return this[kExecuteMessage]?.content.executionId;
34
33
  },
35
34
  },
36
35
  cancelActivity: {
@@ -113,7 +112,7 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, { conten
113
112
  this[kCompleteContent] = content;
114
113
 
115
114
  const { inbound, executionId } = this[kExecuteMessage].content;
116
- const attachedToContent = inbound && inbound[0];
115
+ const attachedToContent = inbound?.[0];
117
116
  const attachedTo = this.attachedTo;
118
117
 
119
118
  this.activity.logger.debug(
@@ -19,8 +19,7 @@ export function StartEventBehaviour(activity) {
19
19
 
20
20
  Object.defineProperty(StartEventBehaviour.prototype, 'executionId', {
21
21
  get() {
22
- const message = this[kExecuteMessage];
23
- return message && message.content.executionId;
22
+ return this[kExecuteMessage]?.content.executionId;
24
23
  },
25
24
  });
26
25
 
@@ -39,7 +39,7 @@ Object.defineProperty(Association.prototype, 'counters', {
39
39
  },
40
40
  });
41
41
 
42
- Association.prototype.take = function take(content = {}) {
42
+ Association.prototype.take = function take(content) {
43
43
  this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
44
44
  ++this[kCounters].take;
45
45
 
@@ -48,7 +48,7 @@ Association.prototype.take = function take(content = {}) {
48
48
  return true;
49
49
  };
50
50
 
51
- Association.prototype.discard = function discard(content = {}) {
51
+ Association.prototype.discard = function discard(content) {
52
52
  this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
53
53
  ++this[kCounters].discard;
54
54
 
@@ -47,8 +47,8 @@ Object.defineProperty(SequenceFlow.prototype, 'counters', {
47
47
  },
48
48
  });
49
49
 
50
- SequenceFlow.prototype.take = function take(content = {}) {
51
- const { sequenceId } = content;
50
+ SequenceFlow.prototype.take = function take(content) {
51
+ const sequenceId = content?.sequenceId;
52
52
 
53
53
  this.logger.debug(`<${sequenceId} (${this.id})> take, target <${this.targetId}>`);
54
54
  ++this[kCounters].take;
@@ -59,7 +59,7 @@ SequenceFlow.prototype.take = function take(content = {}) {
59
59
  };
60
60
 
61
61
  SequenceFlow.prototype.discard = function discard(content = {}) {
62
- const { sequenceId = getUniqueId(this.id) } = content;
62
+ const sequenceId = content?.sequenceId ?? getUniqueId(this.id);
63
63
  const discardSequence = (content.discardSequence = (content.discardSequence || []).slice());
64
64
  if (discardSequence.indexOf(this.targetId) > -1) {
65
65
  ++this[kCounters].looped;
@@ -3,9 +3,7 @@ const stringConstantPattern = /^(['"])(.*)\1$/;
3
3
  const numberConstantPattern = /^\W*-?\d+(.\d+)?\W*$/;
4
4
  const negativeIndexPattern = /^-\d+$/;
5
5
 
6
- export default getPropertyValue;
7
-
8
- function getPropertyValue(inputContext, propertyPath, fnScope) {
6
+ export default function getPropertyValue(inputContext, propertyPath, fnScope) {
9
7
  if (!inputContext) return;
10
8
 
11
9
  let resultValue;
@@ -10,7 +10,7 @@ export default function EnvironmentDataObject(dataObjectDef, { environment }) {
10
10
 
11
11
  EnvironmentDataObject.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
12
12
  const environment = this.environment;
13
- const value = environment.variables._data && environment.variables._data[this.id];
13
+ const value = environment.variables._data?.[this.id];
14
14
  const content = this._createContent(value);
15
15
  return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
16
16
  };
@@ -10,7 +10,7 @@ export default function EnvironmentDataStore(dataStoreDef, { environment }) {
10
10
 
11
11
  EnvironmentDataStore.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
12
12
  const environment = this.environment;
13
- const value = environment.variables._data && environment.variables._data[this.id];
13
+ const value = environment.variables._data?.[this.id];
14
14
  const content = this._createContent(value);
15
15
  return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
16
16
  };
@@ -10,7 +10,7 @@ export default function EnvironmentDataStoreReference(dataObjectDef, { environme
10
10
 
11
11
  EnvironmentDataStoreReference.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
12
12
  const environment = this.environment;
13
- const value = environment.variables._data && environment.variables._data[this.id];
13
+ const value = environment.variables._data?.[this.id];
14
14
  const content = this._createContent(value);
15
15
  return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
16
16
  };
@@ -15,10 +15,10 @@ export default function IoSpecification(activity, ioSpecificationDef, context) {
15
15
 
16
16
  IoSpecification.prototype.activate = function activate(message) {
17
17
  if (this[kConsuming]) return;
18
- if (message && message.fields.redelivered && message.fields.routingKey === 'run.start') {
18
+ if (message?.fields.redelivered && message.fields.routingKey === 'run.start') {
19
19
  this._onFormatEnter();
20
20
  }
21
- if (message && message.fields.redelivered && message.fields.routingKey === 'run.end') {
21
+ if (message?.fields.redelivered && message.fields.routingKey === 'run.end') {
22
22
  this._onFormatComplete(message);
23
23
  }
24
24
  this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
@@ -8,18 +8,18 @@ export default function Properties(activity, propertiesDef, context) {
8
8
  this.broker = activity.broker;
9
9
 
10
10
  const props = (this[kProperties] = {
11
- properties: [],
12
- dataInputObjects: [],
13
- dataOutputObjects: [],
11
+ properties: new Set(),
12
+ dataInputObjects: new Set(),
13
+ dataOutputObjects: new Set(),
14
14
  });
15
15
 
16
16
  for (const { id, ...def } of propertiesDef.values) {
17
17
  const source = {
18
18
  id,
19
19
  type: def.type,
20
- name: def.behaviour && def.behaviour.name,
20
+ name: def.behaviour?.name,
21
21
  };
22
- props.properties.push(source);
22
+ props.properties.add(source);
23
23
 
24
24
  const inputDataObjectId = getPropertyValue(def, 'behaviour.dataInput.association.source.dataObject.id');
25
25
  const outputDataObjectId = getPropertyValue(def, 'behaviour.dataOutput.association.target.dataObject.id');
@@ -28,28 +28,28 @@ export default function Properties(activity, propertiesDef, context) {
28
28
 
29
29
  if (inputDataObjectId) {
30
30
  const reference = context.getDataObjectById(inputDataObjectId);
31
- props.dataInputObjects.push({ id, reference });
31
+ props.dataInputObjects.add({ id, reference });
32
32
  source.input = {
33
33
  reference,
34
34
  };
35
35
  }
36
36
  if (outputDataObjectId) {
37
37
  const reference = context.getDataObjectById(outputDataObjectId);
38
- props.dataOutputObjects.push({ id, reference: reference });
38
+ props.dataOutputObjects.add({ id, reference: reference });
39
39
  source.output = {
40
40
  reference,
41
41
  };
42
42
  }
43
43
  if (inputDataStoreId) {
44
44
  const reference = context.getDataStoreById(inputDataStoreId);
45
- props.dataInputObjects.push({ id, reference });
45
+ props.dataInputObjects.add({ id, reference });
46
46
  source.input = {
47
47
  reference,
48
48
  };
49
49
  }
50
50
  if (outputDataStoreId) {
51
51
  const reference = context.getDataStoreById(outputDataStoreId);
52
- props.dataOutputObjects.push({ id, reference });
52
+ props.dataOutputObjects.add({ id, reference });
53
53
  source.output = {
54
54
  reference,
55
55
  };
@@ -89,7 +89,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
89
89
 
90
90
  const dataInputObjects = this[kProperties].dataInputObjects;
91
91
  const broker = this.broker;
92
- if (!dataInputObjects.length) {
92
+ if (!dataInputObjects.size) {
93
93
  return broker.getQueue('format-run-q').queueMessage(
94
94
  { routingKey: startRoutingKey },
95
95
  {
@@ -107,7 +107,7 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
107
107
  },
108
108
  );
109
109
 
110
- return read(broker, dataInputObjects, (_, responses) => {
110
+ return read(broker, [...dataInputObjects], (_, responses) => {
111
111
  broker.publish('format', endRoutingKey, {
112
112
  properties: this._getProperties(message, responses),
113
113
  });
@@ -122,7 +122,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
122
122
 
123
123
  const dataOutputObjects = this[kProperties].dataOutputObjects;
124
124
  const broker = this.broker;
125
- if (!dataOutputObjects.length) {
125
+ if (!dataOutputObjects.size) {
126
126
  return broker.getQueue('format-run-q').queueMessage(
127
127
  { routingKey: startRoutingKey },
128
128
  {
@@ -140,7 +140,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
140
140
  },
141
141
  );
142
142
 
143
- return write(broker, dataOutputObjects, outputProperties, (_, responses) => {
143
+ return write(broker, [...dataOutputObjects], outputProperties, (_, responses) => {
144
144
  broker.publish('format', endRoutingKey, {
145
145
  properties: this._getProperties(message, responses),
146
146
  });
@@ -187,7 +187,7 @@ function read(broker, dataReferences, callback) {
187
187
  }
188
188
 
189
189
  function write(broker, dataReferences, properties, callback) {
190
- const responses = [];
190
+ const responses = {};
191
191
  let count = 0;
192
192
  const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, { noAck: true });
193
193
 
@@ -1,6 +1,4 @@
1
- export { cloneContent, cloneMessage, cloneParent, shiftParent, unshiftParent, pushParent };
2
-
3
- function cloneContent(content, extend) {
1
+ export function cloneContent(content, extend) {
4
2
  const { discardSequence, inbound, outbound, parent, sequence } = content;
5
3
 
6
4
  const clone = {
@@ -27,7 +25,7 @@ function cloneContent(content, extend) {
27
25
  return clone;
28
26
  }
29
27
 
30
- function cloneMessage(message, overrideContent) {
28
+ export function cloneMessage(message, overrideContent) {
31
29
  return {
32
30
  fields: { ...message.fields },
33
31
  content: cloneContent(message.content, overrideContent),
@@ -35,7 +33,7 @@ function cloneMessage(message, overrideContent) {
35
33
  };
36
34
  }
37
35
 
38
- function cloneParent(parent) {
36
+ export function cloneParent(parent) {
39
37
  const { path } = parent;
40
38
  const clone = { ...parent };
41
39
  if (!path) return clone;
@@ -47,7 +45,7 @@ function cloneParent(parent) {
47
45
  return clone;
48
46
  }
49
47
 
50
- function unshiftParent(parent, adoptingParent) {
48
+ export function unshiftParent(parent, adoptingParent) {
51
49
  const { id, type, executionId } = adoptingParent;
52
50
  if (!parent) {
53
51
  return {
@@ -69,7 +67,7 @@ function unshiftParent(parent, adoptingParent) {
69
67
  return clone;
70
68
  }
71
69
 
72
- function shiftParent(parent) {
70
+ export function shiftParent(parent) {
73
71
  if (!parent) return;
74
72
  if (!parent.path || !parent.path.length) return;
75
73
 
@@ -82,7 +80,7 @@ function shiftParent(parent) {
82
80
  return clone;
83
81
  }
84
82
 
85
- function pushParent(parent, ancestor) {
83
+ export function pushParent(parent, ancestor) {
86
84
  const { id, type, executionId } = ancestor;
87
85
  if (!parent) return { id, type, executionId };
88
86
 
@@ -68,8 +68,7 @@ Object.defineProperties(Process.prototype, {
68
68
  },
69
69
  lanes: {
70
70
  get() {
71
- const lanes = this[kLanes];
72
- return lanes && lanes.slice();
71
+ return this[kLanes]?.slice();
73
72
  },
74
73
  },
75
74
  extensions: {
@@ -106,8 +105,7 @@ Object.defineProperties(Process.prototype, {
106
105
  },
107
106
  activityStatus: {
108
107
  get() {
109
- const execution = this[kExec].get('execution');
110
- return (execution && execution.activityStatus) || 'idle';
108
+ return this[kExec].get('execution')?.activityStatus || 'idle';
111
109
  },
112
110
  },
113
111
  });
@@ -160,7 +158,7 @@ Process.prototype.getState = function getState() {
160
158
  stopped: this.stopped,
161
159
  counters: this.counters,
162
160
  broker: this.broker.getState(true),
163
- execution: this.execution && this.execution.getState(),
161
+ execution: this.execution?.getState(),
164
162
  };
165
163
  };
166
164
 
@@ -372,11 +370,11 @@ Process.prototype._publishEvent = function publishEvent(state, content) {
372
370
  };
373
371
 
374
372
  Process.prototype.sendMessage = function sendMessage(message) {
375
- const messageContent = message && message.content;
373
+ const messageContent = message?.content;
376
374
  if (!messageContent) return;
377
375
 
378
376
  let targetsFound = false;
379
- if (messageContent.target && messageContent.target.id && this.getActivityById(messageContent.target.id)) {
377
+ if (messageContent.target?.id && this.getActivityById(messageContent.target.id)) {
380
378
  targetsFound = true;
381
379
  } else if (
382
380
  messageContent.message &&