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
@@ -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;
@@ -8,7 +8,6 @@ export default function CallActivity(activityDef, context) {
8
8
 
9
9
  export function CallActivityBehaviour(activity) {
10
10
  const { id, type, behaviour = {} } = activity;
11
-
12
11
  this.id = id;
13
12
  this.type = type;
14
13
  this.calledElement = behaviour.calledElement;
@@ -60,7 +59,11 @@ CallActivityBehaviour.prototype.execute = function execute(executeMessage) {
60
59
  );
61
60
  broker.subscribeTmp('api', '#.signal.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
62
61
  noAck: true,
63
- consumerTag: `_api-delegated-${executionId}`,
62
+ consumerTag: `_api-delegated-signal-${executionId}`,
63
+ });
64
+ broker.subscribeTmp('api', '#.cancel.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
65
+ noAck: true,
66
+ consumerTag: `_api-delegated-cancel-${executionId}`,
64
67
  });
65
68
 
66
69
  broker.publish(
@@ -176,5 +179,6 @@ CallActivityBehaviour.prototype._onApiMessage = function onApiMessage(calledElem
176
179
  CallActivityBehaviour.prototype._stop = function stop(executionId) {
177
180
  const broker = this.broker;
178
181
  broker.cancel(`_api-${executionId}`);
179
- broker.cancel(`_api-delegated-${executionId}`);
182
+ broker.cancel(`_api-delegated-signal-${executionId}`);
183
+ broker.cancel(`_api-delegated-cancel-${executionId}`);
180
184
  };
@@ -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
  }