bpmn-elements 8.2.4 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{src/Api.js → Api.js} +11 -12
  3. package/dist/{src/Context.js → Context.js} +26 -27
  4. package/dist/{src/Environment.js → Environment.js} +15 -16
  5. package/dist/{src/EventBroker.js → EventBroker.js} +1 -1
  6. package/dist/{src/Expressions.js → Expressions.js} +1 -1
  7. package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
  8. package/dist/{src/activity → activity}/Activity.js +62 -63
  9. package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
  10. package/dist/{src/activity → activity}/Dummy.js +1 -1
  11. package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
  12. package/dist/{src/definition → definition}/Definition.js +41 -42
  13. package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
  14. package/dist/{src/error → error}/Errors.js +1 -1
  15. package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
  16. package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
  17. package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
  18. package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
  19. package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
  20. package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
  21. package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
  22. package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
  23. package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
  24. package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
  25. package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
  26. package/dist/{src/events → events}/BoundaryEvent.js +15 -16
  27. package/dist/{src/events → events}/EndEvent.js +3 -3
  28. package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
  29. package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
  30. package/dist/{src/events → events}/StartEvent.js +8 -9
  31. package/dist/{src/flows → flows}/Association.js +15 -16
  32. package/dist/{src/flows → flows}/MessageFlow.js +16 -14
  33. package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
  34. package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
  35. package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
  36. package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
  37. package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
  38. package/dist/index.js +48 -48
  39. package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
  40. package/dist/{src/io → io}/Properties.js +7 -8
  41. package/dist/package.json +3 -0
  42. package/dist/{src/process → process}/Process.js +39 -40
  43. package/dist/{src/process → process}/ProcessExecution.js +42 -43
  44. package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
  45. package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
  46. package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
  47. package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
  48. package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
  49. package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
  50. package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
  51. package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
  52. package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
  53. package/dist/{src/tasks → tasks}/Task.js +2 -2
  54. package/dist/{src/tasks → tasks}/Transaction.js +1 -1
  55. package/package.json +30 -30
  56. package/src/Api.js +11 -13
  57. package/src/Context.js +26 -28
  58. package/src/Environment.js +15 -17
  59. package/src/EventBroker.js +1 -1
  60. package/src/Expressions.js +1 -1
  61. package/src/MessageFormatter.js +3 -3
  62. package/src/activity/Activity.js +62 -64
  63. package/src/activity/ActivityExecution.js +23 -25
  64. package/src/activity/Dummy.js +1 -1
  65. package/src/activity/ExecutionScope.js +2 -2
  66. package/src/definition/Definition.js +41 -43
  67. package/src/definition/DefinitionExecution.js +45 -47
  68. package/src/error/Errors.js +1 -1
  69. package/src/eventDefinitions/CancelEventDefinition.js +12 -14
  70. package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
  71. package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
  72. package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
  73. package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
  74. package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
  75. package/src/eventDefinitions/LinkEventDefinition.js +14 -16
  76. package/src/eventDefinitions/MessageEventDefinition.js +13 -15
  77. package/src/eventDefinitions/SignalEventDefinition.js +13 -15
  78. package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
  79. package/src/eventDefinitions/TimerEventDefinition.js +15 -17
  80. package/src/events/BoundaryEvent.js +15 -17
  81. package/src/events/EndEvent.js +3 -3
  82. package/src/events/IntermediateCatchEvent.js +3 -3
  83. package/src/events/IntermediateThrowEvent.js +3 -3
  84. package/src/events/StartEvent.js +8 -10
  85. package/src/flows/Association.js +15 -17
  86. package/src/flows/MessageFlow.js +14 -15
  87. package/src/flows/SequenceFlow.js +16 -20
  88. package/src/gateways/EventBasedGateway.js +2 -2
  89. package/src/gateways/ExclusiveGateway.js +2 -2
  90. package/src/gateways/InclusiveGateway.js +2 -2
  91. package/src/gateways/ParallelGateway.js +2 -2
  92. package/src/index.js +106 -0
  93. package/src/io/InputOutputSpecification.js +8 -10
  94. package/src/io/Properties.js +7 -9
  95. package/src/process/Process.js +39 -41
  96. package/src/process/ProcessExecution.js +42 -44
  97. package/src/tasks/CallActivity.js +7 -9
  98. package/src/tasks/LoopCharacteristics.js +2 -2
  99. package/src/tasks/ReceiveTask.js +215 -217
  100. package/src/tasks/ScriptTask.js +4 -4
  101. package/src/tasks/ServiceImplementation.js +1 -1
  102. package/src/tasks/ServiceTask.js +6 -8
  103. package/src/tasks/SignalTask.js +7 -9
  104. package/src/tasks/StandardLoopCharacteristics.js +1 -1
  105. package/src/tasks/SubProcess.js +17 -19
  106. package/src/tasks/Task.js +2 -2
  107. package/src/tasks/Transaction.js +1 -1
  108. package/types/index.d.ts +491 -0
  109. package/index.js +0 -106
  110. /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
  111. /package/dist/{src/Scripts.js → Scripts.js} +0 -0
  112. /package/dist/{src/Timers.js → Timers.js} +0 -0
  113. /package/dist/{src/activity → activity}/Escalation.js +0 -0
  114. /package/dist/{src/activity → activity}/Message.js +0 -0
  115. /package/dist/{src/activity → activity}/Signal.js +0 -0
  116. /package/dist/{src/error → error}/BpmnError.js +0 -0
  117. /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
  118. /package/dist/{src/io → io}/BpmnIO.js +0 -0
  119. /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
  120. /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
  121. /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
  122. /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
  123. /package/dist/{src/shared.js → shared.js} +0 -0
@@ -1,5 +1,5 @@
1
- import {brokerSafeId} from '../shared';
2
- import {cloneContent, shiftParent} from '../messageHelper';
1
+ import {brokerSafeId} from '../shared.js';
2
+ import {cloneContent, shiftParent} from '../messageHelper.js';
3
3
 
4
4
  const kMessageQ = Symbol.for('cancelQ');
5
5
  const kCompleted = Symbol.for('completed');
@@ -26,20 +26,18 @@ export default function CancelEventDefinition(activity, eventDefinition) {
26
26
  }
27
27
  }
28
28
 
29
- const proto = CancelEventDefinition.prototype;
30
-
31
- Object.defineProperty(proto, 'executionId', {
29
+ Object.defineProperty(CancelEventDefinition.prototype, 'executionId', {
32
30
  get() {
33
31
  const message = this[kExecuteMessage];
34
32
  return message && message.content.executionId;
35
33
  },
36
34
  });
37
35
 
38
- proto.execute = function execute(executeMessage) {
36
+ CancelEventDefinition.prototype.execute = function execute(executeMessage) {
39
37
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
40
38
  };
41
39
 
42
- proto.executeCatch = function executeCatch(executeMessage) {
40
+ CancelEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
43
41
  this[kExecuteMessage] = executeMessage;
44
42
  this[kCompleted] = false;
45
43
 
@@ -80,7 +78,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
80
78
  }));
81
79
  };
82
80
 
83
- proto.executeThrow = function executeThrow(executeMessage) {
81
+ CancelEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
84
82
  const {isTransaction} = this.environment.variables.content || {};
85
83
  const executeContent = executeMessage.content;
86
84
  const {executionId, parent} = executeContent;
@@ -100,14 +98,14 @@ proto.executeThrow = function executeThrow(executeMessage) {
100
98
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
101
99
  };
102
100
 
103
- proto._onCatchMessage = function onCatchMessage(_, message) {
101
+ CancelEventDefinition.prototype._onCatchMessage = function onCatchMessage(_, message) {
104
102
  if (message.content && message.content.isTransaction) return this._onCancelTransaction(_, message);
105
103
 
106
104
  this._debug(`cancel caught from <${message.content.id}>`);
107
105
  return this._complete(message.content.message);
108
106
  };
109
107
 
110
- proto._onCancelTransaction = function onCancelTransaction(_, message) {
108
+ CancelEventDefinition.prototype._onCancelTransaction = function onCancelTransaction(_, message) {
111
109
  const broker = this.broker, executionId = this.executionId;
112
110
  const executeContent = this[kExecuteMessage].content;
113
111
  broker.cancel(`_oncancel-${executionId}`);
@@ -132,7 +130,7 @@ proto._onCancelTransaction = function onCancelTransaction(_, message) {
132
130
  }, {noAck: true, consumerTag: `_oncancelend-${executionId}`});
133
131
  };
134
132
 
135
- proto._complete = function complete(output) {
133
+ CancelEventDefinition.prototype._complete = function complete(output) {
136
134
  this[kCompleted] = true;
137
135
  this._stop();
138
136
  this._debug('completed');
@@ -143,7 +141,7 @@ proto._complete = function complete(output) {
143
141
  return this.broker.publish('execution', 'execute.completed', content);
144
142
  };
145
143
 
146
- proto._onApiMessage = function onApiMessage(routingKey, message) {
144
+ CancelEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
147
145
  switch (message.properties.type) {
148
146
  case 'discard': {
149
147
  this[kCompleted] = true;
@@ -158,7 +156,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
158
156
  }
159
157
  };
160
158
 
161
- proto._stop = function stop() {
159
+ CancelEventDefinition.prototype._stop = function stop() {
162
160
  const broker = this.broker, executionId = this.executionId;
163
161
  broker.cancel(`_api-parent-${executionId}`);
164
162
  broker.cancel(`_api-${executionId}`);
@@ -168,6 +166,6 @@ proto._stop = function stop() {
168
166
  this[kMessageQ].purge();
169
167
  };
170
168
 
171
- proto._debug = function debug(msg) {
169
+ CancelEventDefinition.prototype._debug = function debug(msg) {
172
170
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
173
171
  };
@@ -1,5 +1,5 @@
1
- import {brokerSafeId} from '../shared';
2
- import {cloneContent, cloneMessage, shiftParent} from '../messageHelper';
1
+ import {brokerSafeId} from '../shared.js';
2
+ import {cloneContent, cloneMessage, shiftParent} from '../messageHelper.js';
3
3
 
4
4
  const kCompleted = Symbol.for('completed');
5
5
  const kExecuteMessage = Symbol.for('executeMessage');
@@ -27,20 +27,18 @@ export default function CompensateEventDefinition(activity, eventDefinition, con
27
27
  }
28
28
  }
29
29
 
30
- const proto = CompensateEventDefinition.prototype;
31
-
32
- Object.defineProperty(proto, 'executionId', {
30
+ Object.defineProperty(CompensateEventDefinition.prototype, 'executionId', {
33
31
  get() {
34
32
  const message = this[kExecuteMessage];
35
33
  return message && message.content.executionId;
36
34
  },
37
35
  });
38
36
 
39
- proto.execute = function execute(executeMessage) {
37
+ CompensateEventDefinition.prototype.execute = function execute(executeMessage) {
40
38
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
41
39
  };
42
40
 
43
- proto.executeCatch = function executeCatch(executeMessage) {
41
+ CompensateEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
44
42
  this[kExecuteMessage] = executeMessage;
45
43
  this[kCompleted] = false;
46
44
 
@@ -84,7 +82,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
84
82
  broker.publish('event', 'activity.detach', detachContent);
85
83
  };
86
84
 
87
- proto.executeThrow = function executeThrow(executeMessage) {
85
+ CompensateEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
88
86
  const executeContent = executeMessage.content;
89
87
  const {executionId, parent} = executeContent;
90
88
  const parentExecutionId = parent && parent.executionId;
@@ -102,7 +100,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
102
100
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
103
101
  };
104
102
 
105
- proto._onCollect = function onCollect(routingKey, message) {
103
+ CompensateEventDefinition.prototype._onCollect = function onCollect(routingKey, message) {
106
104
 
107
105
  switch (routingKey) {
108
106
  case 'execute.error':
@@ -112,7 +110,7 @@ proto._onCollect = function onCollect(routingKey, message) {
112
110
  }
113
111
  };
114
112
 
115
- proto._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
113
+ CompensateEventDefinition.prototype._onCompensateApiMessage = function onCompensateApiMessage(routingKey, message) {
116
114
  const output = message.content.message;
117
115
  this[kCompleted] = true;
118
116
 
@@ -141,11 +139,11 @@ proto._onCompensateApiMessage = function onCompensateApiMessage(routingKey, mess
141
139
  }
142
140
  };
143
141
 
144
- proto._onCollected = function onCollected(routingKey, message) {
142
+ CompensateEventDefinition.prototype._onCollected = function onCollected(routingKey, message) {
145
143
  for (const association of this[kAssociations]) association.take(cloneMessage(message));
146
144
  };
147
145
 
148
- proto._onApiMessage = function onApiMessage(routingKey, message) {
146
+ CompensateEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
149
147
  const messageType = message.properties.type;
150
148
 
151
149
  switch (messageType) {
@@ -165,7 +163,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
165
163
  }
166
164
  };
167
165
 
168
- proto._stop = function stop() {
166
+ CompensateEventDefinition.prototype._stop = function stop() {
169
167
  const broker = this.broker, executionId = this.executionId;
170
168
  broker.cancel(`_api-${executionId}`);
171
169
  broker.cancel(`_oncompensate-${executionId}`);
@@ -174,6 +172,6 @@ proto._stop = function stop() {
174
172
  this[kMessageQ].purge();
175
173
  };
176
174
 
177
- proto._debug = function debug(msg) {
175
+ CompensateEventDefinition.prototype._debug = function debug(msg) {
178
176
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
179
177
  };
@@ -1,5 +1,5 @@
1
- import {cloneContent, shiftParent} from '../messageHelper';
2
- import {ActivityError} from '../error/Errors';
1
+ import {cloneContent, shiftParent} from '../messageHelper.js';
2
+ import {ActivityError} from '../error/Errors.js';
3
3
 
4
4
  const kExecuteMessage = Symbol.for('executeMessage');
5
5
 
@@ -18,21 +18,19 @@ export default function ConditionalEventDefinition(activity, eventDefinition) {
18
18
  this.logger = environment.Logger(type.toLowerCase());
19
19
  }
20
20
 
21
- const proto = ConditionalEventDefinition.prototype;
22
-
23
- Object.defineProperty(proto, 'executionId', {
21
+ Object.defineProperty(ConditionalEventDefinition.prototype, 'executionId', {
24
22
  get() {
25
23
  const message = this[kExecuteMessage];
26
24
  return message && message.content.executionId;
27
25
  },
28
26
  });
29
27
 
30
- proto.execute = function execute(executeMessage) {
28
+ ConditionalEventDefinition.prototype.execute = function execute(executeMessage) {
31
29
  this[kExecuteMessage] = executeMessage;
32
30
  return this.isWaiting ? this.executeWait(executeMessage) : this.executeCatch(executeMessage);
33
31
  };
34
32
 
35
- proto.executeWait = function executeWait(executeMessage) {
33
+ ConditionalEventDefinition.prototype.executeWait = function executeWait(executeMessage) {
36
34
  const executeContent = executeMessage.content;
37
35
  const {executionId, parent} = executeContent;
38
36
  const parentExecutionId = parent.executionId;
@@ -59,7 +57,7 @@ proto.executeWait = function executeWait(executeMessage) {
59
57
  broker.publish('event', 'activity.wait', waitContent);
60
58
  };
61
59
 
62
- proto.executeCatch = function executeCatch(executeMessage) {
60
+ ConditionalEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
63
61
  const executeContent = executeMessage.content;
64
62
  const {executionId, index} = executeContent;
65
63
 
@@ -78,7 +76,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
78
76
  });
79
77
  };
80
78
 
81
- proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
79
+ ConditionalEventDefinition.prototype._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
82
80
  const messageType = message.properties.type;
83
81
 
84
82
  switch (messageType) {
@@ -95,7 +93,7 @@ proto._onWaitApiMessage = function onWaitApiMessage(routingKey, message) {
95
93
  }
96
94
  };
97
95
 
98
- proto._evaluateWait = function evaluate(message) {
96
+ ConditionalEventDefinition.prototype._evaluateWait = function evaluate(message) {
99
97
  const executeMessage = this[kExecuteMessage];
100
98
  const broker = this.broker, executeContent = executeMessage.content;
101
99
 
@@ -116,13 +114,13 @@ proto._evaluateWait = function evaluate(message) {
116
114
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output}));
117
115
  };
118
116
 
119
- proto._stopWait = function stopWait() {
117
+ ConditionalEventDefinition.prototype._stopWait = function stopWait() {
120
118
  const broker = this.broker, executionId = this.executionId;
121
119
  broker.cancel(`_api-${executionId}`);
122
120
  broker.cancel(`_parent-signal-${executionId}`);
123
121
  };
124
122
 
125
- proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
123
+ ConditionalEventDefinition.prototype._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
126
124
  this._stopCatch();
127
125
 
128
126
  const executeMessage = this[kExecuteMessage];
@@ -144,7 +142,7 @@ proto._onAttachedCompleted = function onAttachedCompleted(routingKey, message) {
144
142
  }
145
143
  };
146
144
 
147
- proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
145
+ ConditionalEventDefinition.prototype._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
148
146
  const messageType = message.properties.type;
149
147
  switch (messageType) {
150
148
  case 'discard': {
@@ -159,12 +157,12 @@ proto._onCatchApiMessage = function onCatchApiMessage(routingKey, message) {
159
157
  }
160
158
  };
161
159
 
162
- proto._stopCatch = function stopCatch() {
160
+ ConditionalEventDefinition.prototype._stopCatch = function stopCatch() {
163
161
  const {executionId, index} = this[kExecuteMessage].content;
164
162
  this.activity.attachedTo.broker.cancel(`_onend-${executionId}_${index}`);
165
163
  this.broker.cancel(`_api-${executionId}_${index}`);
166
164
  };
167
165
 
168
- proto._debug = function debug(msg) {
166
+ ConditionalEventDefinition.prototype._debug = function debug(msg) {
169
167
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
170
168
  };
@@ -1,5 +1,5 @@
1
- import {brokerSafeId} from '../shared';
2
- import {cloneContent, shiftParent} from '../messageHelper';
1
+ import {brokerSafeId} from '../shared.js';
2
+ import {cloneContent, shiftParent} from '../messageHelper.js';
3
3
 
4
4
  const kCompleted = Symbol.for('completed');
5
5
  const kMessageQ = Symbol.for('messageQ');
@@ -36,20 +36,18 @@ export default function ErrorEventDefinition(activity, eventDefinition) {
36
36
  }
37
37
  }
38
38
 
39
- const proto = ErrorEventDefinition.prototype;
40
-
41
- Object.defineProperty(proto, 'executionId', {
39
+ Object.defineProperty(ErrorEventDefinition.prototype, 'executionId', {
42
40
  get() {
43
41
  const message = this[kExecuteMessage];
44
42
  return message && message.content.executionId;
45
43
  },
46
44
  });
47
45
 
48
- proto.execute = function execute(executeMessage) {
46
+ ErrorEventDefinition.prototype.execute = function execute(executeMessage) {
49
47
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
50
48
  };
51
49
 
52
- proto.executeCatch = function executeCatch(executeMessage) {
50
+ ErrorEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
53
51
  this[kExecuteMessage] = executeMessage;
54
52
  this[kCompleted] = false;
55
53
 
@@ -97,7 +95,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
97
95
  broker.publish('event', 'activity.wait', waitContent);
98
96
  };
99
97
 
100
- proto.executeThrow = function executeThrow(executeMessage) {
98
+ ErrorEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
101
99
  const executeContent = executeMessage.content;
102
100
  const {executionId, parent} = executeContent;
103
101
 
@@ -120,7 +118,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
120
118
  }));
121
119
  };
122
120
 
123
- proto._onErrorMessage = function onErrorMessage(routingKey, message) {
121
+ ErrorEventDefinition.prototype._onErrorMessage = function onErrorMessage(routingKey, message) {
124
122
  const error = message.content.error;
125
123
  if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
126
124
 
@@ -132,7 +130,7 @@ proto._onErrorMessage = function onErrorMessage(routingKey, message) {
132
130
  return this._catchError(routingKey, message, error);
133
131
  };
134
132
 
135
- proto._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
133
+ ErrorEventDefinition.prototype._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
136
134
  const error = message.content.message;
137
135
  if (!this[kReferenceElement]) return this._catchError(routingKey, message, error);
138
136
 
@@ -141,7 +139,7 @@ proto._onThrowApiMessage = function onThrowApiMessage(routingKey, message) {
141
139
  return this._catchError(routingKey, message, error);
142
140
  };
143
141
 
144
- proto._catchError = function catchError(routingKey, message, error) {
142
+ ErrorEventDefinition.prototype._catchError = function catchError(routingKey, message, error) {
145
143
  this[kCompleted] = true;
146
144
 
147
145
  this._stop();
@@ -171,7 +169,7 @@ proto._catchError = function catchError(routingKey, message, error) {
171
169
  }));
172
170
  };
173
171
 
174
- proto._onApiMessage = function onApiMessage(routingKey, message) {
172
+ ErrorEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
175
173
  const messageType = message.properties.type;
176
174
 
177
175
  switch (messageType) {
@@ -187,7 +185,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
187
185
  }
188
186
  };
189
187
 
190
- proto._stop = function stop() {
188
+ ErrorEventDefinition.prototype._stop = function stop() {
191
189
  const broker = this.broker, executionId = this.executionId;
192
190
  broker.cancel(`_onthrow-${executionId}`);
193
191
  broker.cancel(`_onerror-${executionId}`);
@@ -195,7 +193,7 @@ proto._stop = function stop() {
195
193
  this[kMessageQ].purge();
196
194
  };
197
195
 
198
- proto._getReferenceInfo = function getReferenceInfo(message) {
196
+ ErrorEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
199
197
  const referenceElement = this[kReferenceElement];
200
198
  if (!referenceElement) {
201
199
  return {
@@ -214,6 +212,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
214
212
  return result;
215
213
  };
216
214
 
217
- proto._debug = function debug(msg) {
215
+ ErrorEventDefinition.prototype._debug = function debug(msg) {
218
216
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
219
217
  };
@@ -1,6 +1,6 @@
1
- import getPropertyValue from '../getPropertyValue';
2
- import {brokerSafeId} from '../shared';
3
- import {cloneContent, shiftParent} from '../messageHelper';
1
+ import getPropertyValue from '../getPropertyValue.js';
2
+ import {brokerSafeId} from '../shared.js';
3
+ import {cloneContent, shiftParent} from '../messageHelper.js';
4
4
 
5
5
  const kCompleted = Symbol.for('completed');
6
6
  const kMessageQ = Symbol.for('messageQ');
@@ -36,20 +36,18 @@ export default function EscalationEventDefinition(activity, eventDefinition) {
36
36
  }
37
37
  }
38
38
 
39
- const proto = EscalationEventDefinition.prototype;
40
-
41
- Object.defineProperty(proto, 'executionId', {
39
+ Object.defineProperty(EscalationEventDefinition.prototype, 'executionId', {
42
40
  get() {
43
41
  const message = this[kExecuteMessage];
44
42
  return message && message.content.executionId;
45
43
  },
46
44
  });
47
45
 
48
- proto.execute = function execute(executeMessage) {
46
+ EscalationEventDefinition.prototype.execute = function execute(executeMessage) {
49
47
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
50
48
  };
51
49
 
52
- proto.executeCatch = function executeCatch(executeMessage) {
50
+ EscalationEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
53
51
  this[kExecuteMessage] = executeMessage;
54
52
  this[kCompleted] = false;
55
53
 
@@ -82,7 +80,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
82
80
  broker.publish('event', 'activity.wait', waitContent);
83
81
  };
84
82
 
85
- proto.executeThrow = function executeThrow(executeMessage) {
83
+ EscalationEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
86
84
  const executeContent = executeMessage.content;
87
85
  const {executionId, parent} = executeContent;
88
86
 
@@ -102,7 +100,7 @@ proto.executeThrow = function executeThrow(executeMessage) {
102
100
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
103
101
  };
104
102
 
105
- proto._onCatchMessage = function onCatchMessage(routingKey, message) {
103
+ EscalationEventDefinition.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
106
104
  const info = this[kReference];
107
105
  if (getPropertyValue(message, 'content.message.id') !== info.message.id) return;
108
106
 
@@ -127,7 +125,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
127
125
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output, state: 'catch'}));
128
126
  };
129
127
 
130
- proto._onApiMessage = function onApiMessage(routingKey, message) {
128
+ EscalationEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
131
129
  switch (message.properties.type) {
132
130
  case 'escalate': {
133
131
  return this._onCatchMessage(routingKey, message);
@@ -144,13 +142,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
144
142
  }
145
143
  };
146
144
 
147
- proto._stop = function stop() {
145
+ EscalationEventDefinition.prototype._stop = function stop() {
148
146
  const broker = this.broker, executionId = this.executionId;
149
147
  broker.cancel(`_api-${executionId}`);
150
148
  broker.cancel(`_onescalate-${executionId}`);
151
149
  };
152
150
 
153
- proto._getReferenceInfo = function getReferenceInfo(message) {
151
+ EscalationEventDefinition.prototype._getReferenceInfo = function getReferenceInfo(message) {
154
152
  const referenceElement = this[kReferenceElement];
155
153
  if (!referenceElement) {
156
154
  return {
@@ -168,6 +166,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
168
166
  return result;
169
167
  };
170
168
 
171
- proto._debug = function debug(msg) {
169
+ EscalationEventDefinition.prototype._debug = function debug(msg) {
172
170
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
173
171
  };
@@ -1,4 +1,4 @@
1
- import {cloneContent, unshiftParent, shiftParent, cloneParent} from '../messageHelper';
1
+ import {cloneContent, unshiftParent, shiftParent, cloneParent} from '../messageHelper.js';
2
2
 
3
3
  const kCompleted = Symbol.for('completed');
4
4
  const kExecuteMessage = Symbol.for('executeMessage');
@@ -15,23 +15,21 @@ export default function EventDefinitionExecution(activity, eventDefinitions, com
15
15
  this[kExecuteMessage] = null;
16
16
  }
17
17
 
18
- const proto = EventDefinitionExecution.prototype;
19
-
20
- Object.defineProperty(proto, 'completed', {
18
+ Object.defineProperty(EventDefinitionExecution.prototype, 'completed', {
21
19
  enumerable: true,
22
20
  get() {
23
21
  return this[kCompleted];
24
22
  },
25
23
  });
26
24
 
27
- Object.defineProperty(proto, 'stopped', {
25
+ Object.defineProperty(EventDefinitionExecution.prototype, 'stopped', {
28
26
  enumerable: true,
29
27
  get() {
30
28
  return this[kStopped];
31
29
  },
32
30
  });
33
31
 
34
- proto.execute = function execute(executeMessage) {
32
+ EventDefinitionExecution.prototype.execute = function execute(executeMessage) {
35
33
  const content = executeMessage.content;
36
34
 
37
35
  if (content.isDefinitionScope) return this._executeDefinition(executeMessage);
@@ -82,7 +80,7 @@ proto.execute = function execute(executeMessage) {
82
80
  }
83
81
  };
84
82
 
85
- proto._onApiMessage = function onApiMessage(_, message) {
83
+ EventDefinitionExecution.prototype._onApiMessage = function onApiMessage(_, message) {
86
84
  const messageType = message.properties.type;
87
85
  switch (messageType) {
88
86
  case 'stop':
@@ -91,7 +89,7 @@ proto._onApiMessage = function onApiMessage(_, message) {
91
89
  }
92
90
  };
93
91
 
94
- proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
92
+ EventDefinitionExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
95
93
  switch (routingKey) {
96
94
  case 'execute.completed': {
97
95
  this._stop();
@@ -111,7 +109,7 @@ proto._onExecuteMessage = function onExecuteMessage(routingKey, message) {
111
109
  }
112
110
  };
113
111
 
114
- proto._complete = function complete(message) {
112
+ EventDefinitionExecution.prototype._complete = function complete(message) {
115
113
  const {executionId, type, index, parent} = message.content;
116
114
  this[kCompleted] = true;
117
115
 
@@ -127,7 +125,7 @@ proto._complete = function complete(message) {
127
125
  this.broker.publish('execution', this.completedRoutingKey, completeContent, {correlationId: message.properties.correlationId});
128
126
  };
129
127
 
130
- proto._executeDefinition = function executeDefinition(message) {
128
+ EventDefinitionExecution.prototype._executeDefinition = function executeDefinition(message) {
131
129
  const {executionId, index} = message.content;
132
130
  const ed = this.eventDefinitions[index];
133
131
  if (!ed) return this.activity.logger.warn(`<${executionId} (${this.id})> found no event definition on index ${index}`);
@@ -135,12 +133,12 @@ proto._executeDefinition = function executeDefinition(message) {
135
133
  ed.execute(message);
136
134
  };
137
135
 
138
- proto._stop = function stop() {
136
+ EventDefinitionExecution.prototype._stop = function stop() {
139
137
  this[kStopped] = true;
140
138
  this.broker.cancel('_eventdefinition-execution-execute-tag');
141
139
  this.broker.cancel('_eventdefinition-execution-api-tag');
142
140
  };
143
141
 
144
- proto._debug = function debug(executionId, msg) {
142
+ EventDefinitionExecution.prototype._debug = function debug(executionId, msg) {
145
143
  this.activity.logger.debug(`<${executionId} (${this.id})> ${msg}`);
146
144
  };
@@ -1,6 +1,6 @@
1
- import getPropertyValue from '../getPropertyValue';
2
- import {brokerSafeId} from '../shared';
3
- import {cloneContent, shiftParent} from '../messageHelper';
1
+ import getPropertyValue from '../getPropertyValue.js';
2
+ import {brokerSafeId} from '../shared.js';
3
+ import {cloneContent, shiftParent} from '../messageHelper.js';
4
4
 
5
5
  const kCompleted = Symbol.for('completed');
6
6
  const kMessageQ = Symbol.for('messageQ');
@@ -36,20 +36,18 @@ export default function LinkEventDefinition(activity, eventDefinition) {
36
36
  }
37
37
  }
38
38
 
39
- const proto = LinkEventDefinition.prototype;
40
-
41
- Object.defineProperty(proto, 'executionId', {
39
+ Object.defineProperty(LinkEventDefinition.prototype, 'executionId', {
42
40
  get() {
43
41
  const message = this[kExecuteMessage];
44
42
  return message && message.content.executionId;
45
43
  },
46
44
  });
47
45
 
48
- proto.execute = function execute(executeMessage) {
46
+ LinkEventDefinition.prototype.execute = function execute(executeMessage) {
49
47
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
50
48
  };
51
49
 
52
- proto.executeCatch = function executeCatch(executeMessage) {
50
+ LinkEventDefinition.prototype.executeCatch = function executeCatch(executeMessage) {
53
51
  this[kExecuteMessage] = executeMessage;
54
52
  this[kCompleted] = false;
55
53
 
@@ -86,7 +84,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
86
84
  broker.publish('event', 'activity.wait', waitContent);
87
85
  };
88
86
 
89
- proto.executeThrow = function executeThrow(executeMessage) {
87
+ LinkEventDefinition.prototype.executeThrow = function executeThrow(executeMessage) {
90
88
  const executeContent = executeMessage.content;
91
89
  const {executionId, parent} = executeContent;
92
90
  const parentExecutionId = parent && parent.executionId;
@@ -106,13 +104,13 @@ proto.executeThrow = function executeThrow(executeMessage) {
106
104
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent));
107
105
  };
108
106
 
109
- proto._onCatchLink = function onCatchLink(routingKey, message) {
107
+ LinkEventDefinition.prototype._onCatchLink = function onCatchLink(routingKey, message) {
110
108
  if (getPropertyValue(message, 'content.message.linkName') !== this.reference.linkName) return;
111
109
  if (message.content.state === 'discard') return this._discard();
112
110
  return this._complete('caught', message.content.message);
113
111
  };
114
112
 
115
- proto._onApiMessage = function onApiMessage(routingKey, message) {
113
+ LinkEventDefinition.prototype._onApiMessage = function onApiMessage(routingKey, message) {
116
114
  const messageType = message.properties.type;
117
115
 
118
116
  switch (messageType) {
@@ -126,7 +124,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
126
124
  }
127
125
  };
128
126
 
129
- proto._complete = function complete(verb, output) {
127
+ LinkEventDefinition.prototype._complete = function complete(verb, output) {
130
128
  this[kCompleted] = true;
131
129
 
132
130
  this._stop();
@@ -148,13 +146,13 @@ proto._complete = function complete(verb, output) {
148
146
  return broker.publish('execution', 'execute.completed', cloneContent(executeContent, {output, state: 'catch'}));
149
147
  };
150
148
 
151
- proto._discard = function discard() {
149
+ LinkEventDefinition.prototype._discard = function discard() {
152
150
  this[kCompleted] = true;
153
151
  this._stop();
154
152
  return this.broker.publish('execution', 'execute.discard', cloneContent(this[kExecuteMessage].content));
155
153
  };
156
154
 
157
- proto._stop = function stop() {
155
+ LinkEventDefinition.prototype._stop = function stop() {
158
156
  const broker = this.broker, executionId = this.executionId;
159
157
  broker.cancel(`_api-link-${executionId}`);
160
158
  broker.cancel(`_api-parent-${executionId}`);
@@ -162,13 +160,13 @@ proto._stop = function stop() {
162
160
  this[kMessageQ].purge();
163
161
  };
164
162
 
165
- proto._onDiscard = function onDiscard(_, message) {
163
+ LinkEventDefinition.prototype._onDiscard = function onDiscard(_, message) {
166
164
  this.broker.publish('event', 'activity.link.discard', cloneContent(message.content, {
167
165
  message: {...this.reference},
168
166
  state: 'discard',
169
167
  }), {type: 'link', delegate: true});
170
168
  };
171
169
 
172
- proto._debug = function debug(msg) {
170
+ LinkEventDefinition.prototype._debug = function debug(msg) {
173
171
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
174
172
  };