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.
Files changed (67) 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/io/EnvironmentDataObject.js +1 -1
  27. package/dist/io/EnvironmentDataStore.js +1 -1
  28. package/dist/io/EnvironmentDataStoreReference.js +1 -1
  29. package/dist/io/InputOutputSpecification.js +2 -2
  30. package/dist/io/Properties.js +14 -14
  31. package/dist/process/Process.js +5 -7
  32. package/dist/process/ProcessExecution.js +13 -13
  33. package/dist/tasks/ServiceTask.js +1 -1
  34. package/package.json +2 -2
  35. package/src/Api.js +1 -1
  36. package/src/Context.js +2 -1
  37. package/src/Environment.js +3 -3
  38. package/src/EventBroker.js +1 -1
  39. package/src/MessageFormatter.js +2 -2
  40. package/src/Tracker.js +1 -0
  41. package/src/activity/Activity.js +18 -13
  42. package/src/activity/ActivityExecution.js +2 -2
  43. package/src/activity/outbound-evaluator.js +0 -1
  44. package/src/definition/Definition.js +4 -4
  45. package/src/definition/DefinitionExecution.js +6 -6
  46. package/src/error/Errors.js +7 -11
  47. package/src/eventDefinitions/CancelEventDefinition.js +1 -2
  48. package/src/eventDefinitions/CompensateEventDefinition.js +2 -3
  49. package/src/eventDefinitions/ConditionalEventDefinition.js +2 -3
  50. package/src/eventDefinitions/ErrorEventDefinition.js +3 -4
  51. package/src/eventDefinitions/EscalationEventDefinition.js +1 -2
  52. package/src/eventDefinitions/LinkEventDefinition.js +1 -2
  53. package/src/eventDefinitions/MessageEventDefinition.js +2 -3
  54. package/src/eventDefinitions/SignalEventDefinition.js +2 -3
  55. package/src/eventDefinitions/TimerEventDefinition.js +2 -3
  56. package/src/events/BoundaryEvent.js +2 -3
  57. package/src/events/StartEvent.js +1 -2
  58. package/src/flows/Association.js +2 -2
  59. package/src/flows/SequenceFlow.js +3 -3
  60. package/src/io/EnvironmentDataObject.js +1 -1
  61. package/src/io/EnvironmentDataStore.js +1 -1
  62. package/src/io/EnvironmentDataStoreReference.js +1 -1
  63. package/src/io/InputOutputSpecification.js +2 -2
  64. package/src/io/Properties.js +14 -14
  65. package/src/process/Process.js +5 -7
  66. package/src/process/ProcessExecution.js +13 -13
  67. package/src/tasks/ServiceTask.js +1 -1
@@ -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;
@@ -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
 
@@ -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 &&
@@ -34,8 +34,8 @@ function ProcessExecution(parentActivity, context) {
34
34
  associations: context.getAssociations(id),
35
35
  flows: context.getSequenceFlows(id),
36
36
  outboundMessageFlows: context.getMessageFlows(id),
37
- startActivities: [],
38
- triggeredByEvent: [],
37
+ startActivities: new Set(),
38
+ triggeredByEvent: new Set(),
39
39
  detachedActivities: new Set(),
40
40
  startSequences: {},
41
41
  };
@@ -126,7 +126,7 @@ ProcessExecution.prototype.resume = function resume() {
126
126
 
127
127
  const { startActivities, detachedActivities, postponed } = this[kElements];
128
128
 
129
- if (startActivities.length > 1) {
129
+ if (startActivities.size > 1) {
130
130
  for (const a of startActivities) a.shake();
131
131
  }
132
132
 
@@ -185,7 +185,7 @@ ProcessExecution.prototype.getState = function getState() {
185
185
  }, []),
186
186
  ...(flows.length && { flows: flowStates }),
187
187
  ...(outboundMessageFlows.length && {
188
- messageFlows: outboundMessageFlows.length && outboundMessageFlows.map((f) => f.getState()).filter(Boolean),
188
+ messageFlows: outboundMessageFlows.map((f) => f.getState()).filter(Boolean),
189
189
  }),
190
190
  ...(associations.length && { associations: associations.map((f) => f.getState()).filter(Boolean) }),
191
191
  };
@@ -370,7 +370,7 @@ ProcessExecution.prototype._start = function start() {
370
370
  this.broker.publish(this._exchangeName, 'execute.start', cloneContent(executeContent));
371
371
 
372
372
  const { startActivities, postponed, detachedActivities } = this[kElements];
373
- if (startActivities.length > 1) {
373
+ if (startActivities.size > 1) {
374
374
  for (const a of startActivities) a.shake();
375
375
  }
376
376
 
@@ -430,8 +430,8 @@ ProcessExecution.prototype._activate = function activate() {
430
430
  });
431
431
  }
432
432
 
433
- startActivities.splice(0);
434
- triggeredByEvent.splice(0);
433
+ startActivities.clear();
434
+ triggeredByEvent.clear();
435
435
 
436
436
  for (const activity of children) {
437
437
  if (activity.placeholder) continue;
@@ -441,8 +441,8 @@ ProcessExecution.prototype._activate = function activate() {
441
441
  consumerTag: '_process-activity-consumer',
442
442
  priority: 200,
443
443
  });
444
- if (activity.isStart) startActivities.push(activity);
445
- if (activity.triggeredByEvent) triggeredByEvent.push(activity);
444
+ if (activity.isStart) startActivities.add(activity);
445
+ if (activity.triggeredByEvent) triggeredByEvent.add(activity);
446
446
  }
447
447
 
448
448
  this[kActivated] = true;
@@ -483,14 +483,14 @@ ProcessExecution.prototype._onDelegateEvent = function onDelegateEvent(message)
483
483
  let delegate = true;
484
484
 
485
485
  const content = message.content;
486
- if (content.message && content.message.id) {
486
+ if (content.message?.id) {
487
487
  this._debug(`delegate ${eventType} event with id <${content.message.id}>`);
488
488
  } else {
489
489
  this._debug(`delegate ${eventType} anonymous event`);
490
490
  }
491
491
 
492
492
  for (const activity of this[kElements].triggeredByEvent) {
493
- if (activity.getStartActivities({ referenceId: content.message && content.message.id, referenceType: eventType }).length) {
493
+ if (activity.getStartActivities({ referenceId: content.message?.id, referenceType: eventType }).length) {
494
494
  delegate = false;
495
495
  activity.run(content.message);
496
496
  }
@@ -607,7 +607,7 @@ ProcessExecution.prototype._onChildMessage = function onChildMessage(routingKey,
607
607
  case 'activity.error': {
608
608
  let eventCaughtBy;
609
609
  for (const msg of this[kElements].postponed) {
610
- if (msg.fields.routingKey === 'activity.catch' && msg.content.source && msg.content.source.executionId === content.executionId) {
610
+ if (msg.fields.routingKey === 'activity.catch' && msg.content.source?.executionId === content.executionId) {
611
611
  eventCaughtBy = msg;
612
612
  break;
613
613
  }
@@ -693,7 +693,7 @@ ProcessExecution.prototype._onChildCompleted = function onChildCompleted(message
693
693
  );
694
694
  }
695
695
 
696
- if (isEnd && startActivities.length) {
696
+ if (isEnd && startActivities.size) {
697
697
  const startSequences = this[kElements].startSequences;
698
698
  for (const msg of postponed) {
699
699
  const postponedId = msg.content.id;
@@ -73,7 +73,7 @@ ServiceTaskBehaviour.prototype._onApiMessage = function onApiMessage(executeMess
73
73
  const executionId = executeMessage.content.executionId;
74
74
  broker.cancel(`_api-${executionId}`);
75
75
  const service = this.service;
76
- if (service && service.stop) service.stop(message);
76
+ if (service?.stop) service.stop(message);
77
77
  return this.activity.logger.debug(`<${executionId} (${this.id})> stopped`);
78
78
  }
79
79
  }