bpmn-elements 7.0.0 → 8.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 (68) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/src/Context.js +50 -40
  3. package/dist/src/Environment.js +39 -19
  4. package/dist/src/MessageFormatter.js +11 -11
  5. package/dist/src/activity/Activity.js +91 -91
  6. package/dist/src/activity/ActivityExecution.js +35 -35
  7. package/dist/src/definition/Definition.js +50 -50
  8. package/dist/src/definition/DefinitionExecution.js +114 -125
  9. package/dist/src/eventDefinitions/CancelEventDefinition.js +16 -16
  10. package/dist/src/eventDefinitions/CompensateEventDefinition.js +24 -24
  11. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  12. package/dist/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  13. package/dist/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  14. package/dist/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  15. package/dist/src/eventDefinitions/LinkEventDefinition.js +15 -15
  16. package/dist/src/eventDefinitions/MessageEventDefinition.js +23 -23
  17. package/dist/src/eventDefinitions/SignalEventDefinition.js +24 -24
  18. package/dist/src/eventDefinitions/TimerEventDefinition.js +21 -21
  19. package/dist/src/events/BoundaryEvent.js +20 -20
  20. package/dist/src/events/EndEvent.js +3 -3
  21. package/dist/src/events/IntermediateCatchEvent.js +3 -3
  22. package/dist/src/events/IntermediateThrowEvent.js +3 -3
  23. package/dist/src/events/StartEvent.js +9 -9
  24. package/dist/src/flows/Association.js +7 -7
  25. package/dist/src/flows/MessageFlow.js +9 -9
  26. package/dist/src/flows/SequenceFlow.js +7 -7
  27. package/dist/src/gateways/EventBasedGateway.js +11 -11
  28. package/dist/src/io/InputOutputSpecification.js +4 -4
  29. package/dist/src/io/Properties.js +9 -9
  30. package/dist/src/process/Process.js +64 -61
  31. package/dist/src/process/ProcessExecution.js +93 -90
  32. package/dist/src/tasks/ReceiveTask.js +16 -16
  33. package/dist/src/tasks/SubProcess.js +16 -18
  34. package/package.json +9 -9
  35. package/src/Context.js +48 -40
  36. package/src/Environment.js +48 -20
  37. package/src/EventBroker.js +1 -1
  38. package/src/MessageFormatter.js +11 -11
  39. package/src/activity/Activity.js +91 -91
  40. package/src/activity/ActivityExecution.js +34 -34
  41. package/src/definition/Definition.js +51 -50
  42. package/src/definition/DefinitionExecution.js +111 -113
  43. package/src/eventDefinitions/CancelEventDefinition.js +16 -16
  44. package/src/eventDefinitions/CompensateEventDefinition.js +25 -24
  45. package/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  46. package/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  47. package/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  48. package/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  49. package/src/eventDefinitions/LinkEventDefinition.js +15 -15
  50. package/src/eventDefinitions/MessageEventDefinition.js +23 -23
  51. package/src/eventDefinitions/SignalEventDefinition.js +24 -24
  52. package/src/eventDefinitions/TimerEventDefinition.js +21 -21
  53. package/src/events/BoundaryEvent.js +20 -20
  54. package/src/events/EndEvent.js +3 -3
  55. package/src/events/IntermediateCatchEvent.js +3 -3
  56. package/src/events/IntermediateThrowEvent.js +3 -3
  57. package/src/events/StartEvent.js +9 -9
  58. package/src/flows/Association.js +7 -7
  59. package/src/flows/MessageFlow.js +9 -9
  60. package/src/flows/SequenceFlow.js +7 -7
  61. package/src/gateways/EventBasedGateway.js +11 -11
  62. package/src/io/BpmnIO.js +5 -1
  63. package/src/io/InputOutputSpecification.js +4 -4
  64. package/src/io/Properties.js +9 -9
  65. package/src/process/Process.js +62 -58
  66. package/src/process/ProcessExecution.js +86 -88
  67. package/src/tasks/ReceiveTask.js +16 -16
  68. package/src/tasks/SubProcess.js +16 -16
@@ -13,11 +13,11 @@ var _messageHelper = require("../messageHelper");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const completedSymbol = Symbol.for('completed');
17
- const messageQSymbol = Symbol.for('messageQ');
18
- const executeMessageSymbol = Symbol.for('executeMessage');
19
- const referenceElementSymbol = Symbol.for('referenceElement');
20
- const referenceInfoSymbol = Symbol.for('referenceInfo');
16
+ const kCompleted = Symbol.for('completed');
17
+ const kMessageQ = Symbol.for('messageQ');
18
+ const kExecuteMessage = Symbol.for('executeMessage');
19
+ const kReferenceElement = Symbol.for('referenceElement');
20
+ const kReferenceInfo = Symbol.for('referenceInfo');
21
21
 
22
22
  function MessageEventDefinition(activity, eventDefinition) {
23
23
  const {
@@ -41,13 +41,13 @@ function MessageEventDefinition(activity, eventDefinition) {
41
41
  this.activity = activity;
42
42
  this.broker = broker;
43
43
  this.logger = environment.Logger(type.toLowerCase());
44
- const referenceElement = this[referenceElementSymbol] = reference.id && activity.getActivityById(reference.id);
44
+ const referenceElement = this[kReferenceElement] = reference.id && activity.getActivityById(reference.id);
45
45
 
46
46
  if (!isThrowing) {
47
- this[completedSymbol] = false;
47
+ this[kCompleted] = false;
48
48
  const referenceId = referenceElement ? referenceElement.id : 'anonymous';
49
49
  const messageQueueName = `${reference.referenceType}-${(0, _shared.brokerSafeId)(id)}-${(0, _shared.brokerSafeId)(referenceId)}-q`;
50
- this[messageQSymbol] = broker.assertQueue(messageQueueName, {
50
+ this[kMessageQ] = broker.assertQueue(messageQueueName, {
51
51
  autoDelete: false,
52
52
  durable: true
53
53
  });
@@ -60,7 +60,7 @@ function MessageEventDefinition(activity, eventDefinition) {
60
60
  const proto = MessageEventDefinition.prototype;
61
61
  Object.defineProperty(proto, 'executionId', {
62
62
  get() {
63
- const message = this[executeMessageSymbol];
63
+ const message = this[kExecuteMessage];
64
64
  return message && message.content.executionId;
65
65
  }
66
66
 
@@ -71,8 +71,8 @@ proto.execute = function execute(executeMessage) {
71
71
  };
72
72
 
73
73
  proto.executeCatch = function executeCatch(executeMessage) {
74
- this[executeMessageSymbol] = executeMessage;
75
- this[completedSymbol] = false;
74
+ this[kExecuteMessage] = executeMessage;
75
+ this[kCompleted] = false;
76
76
  const executeContent = executeMessage.content;
77
77
  const {
78
78
  executionId,
@@ -80,7 +80,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
80
80
  } = executeContent;
81
81
  const parentExecutionId = parent && parent.executionId;
82
82
 
83
- const info = this[referenceInfoSymbol] = this._getReferenceInfo(executeMessage);
83
+ const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
84
84
 
85
85
  this._debug(`expect ${info.description}`);
86
86
 
@@ -88,11 +88,11 @@ proto.executeCatch = function executeCatch(executeMessage) {
88
88
 
89
89
  const onCatchMessage = this._onCatchMessage.bind(this);
90
90
 
91
- this[messageQSymbol].consume(onCatchMessage, {
91
+ this[kMessageQ].consume(onCatchMessage, {
92
92
  noAck: true,
93
93
  consumerTag: `_api-message-${executionId}`
94
94
  });
95
- if (this[completedSymbol]) return;
95
+ if (this[kCompleted]) return;
96
96
 
97
97
  const onApiMessage = this._onApiMessage.bind(this);
98
98
 
@@ -146,12 +146,12 @@ proto.executeThrow = function executeThrow(executeMessage) {
146
146
  };
147
147
 
148
148
  proto._onCatchMessage = function onCatchMessage(routingKey, message) {
149
- if ((0, _getPropertyValue.default)(message, 'content.message.id') !== this[referenceInfoSymbol].message.id) return;
149
+ if ((0, _getPropertyValue.default)(message, 'content.message.id') !== this[kReferenceInfo].message.id) return;
150
150
  const {
151
151
  type,
152
152
  correlationId
153
153
  } = message.properties;
154
- this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[executeMessageSymbol].content, {
154
+ this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
155
155
  message: { ...message.content.message
156
156
  }
157
157
  }), {
@@ -181,11 +181,11 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
181
181
 
182
182
  case 'discard':
183
183
  {
184
- this[completedSymbol] = true;
184
+ this[kCompleted] = true;
185
185
 
186
186
  this._stop();
187
187
 
188
- return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[executeMessageSymbol].content), {
188
+ return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content), {
189
189
  correlationId
190
190
  });
191
191
  }
@@ -198,14 +198,14 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
198
198
  };
199
199
 
200
200
  proto._complete = function complete(verb, output, options) {
201
- this[completedSymbol] = true;
201
+ this[kCompleted] = true;
202
202
 
203
203
  this._stop();
204
204
 
205
- this._debug(`${verb} ${this[referenceInfoSymbol].description}`);
205
+ this._debug(`${verb} ${this[kReferenceInfo].description}`);
206
206
 
207
207
  const broker = this.broker;
208
- const executeContent = this[executeMessageSymbol].content;
208
+ const executeContent = this[kExecuteMessage].content;
209
209
  const catchContent = (0, _messageHelper.cloneContent)(executeContent, {
210
210
  message: { ...output
211
211
  },
@@ -228,11 +228,11 @@ proto._stop = function stop() {
228
228
  broker.cancel(`_api-${executionId}`);
229
229
  broker.cancel(`_api-parent-${executionId}`);
230
230
  broker.cancel(`_api-delegated-${executionId}`);
231
- this[messageQSymbol].purge();
231
+ this[kMessageQ].purge();
232
232
  };
233
233
 
234
234
  proto._getReferenceInfo = function getReferenceInfo(message) {
235
- const referenceElement = this[referenceElementSymbol];
235
+ const referenceElement = this[kReferenceElement];
236
236
 
237
237
  if (!referenceElement) {
238
238
  return {
@@ -13,11 +13,11 @@ var _messageHelper = require("../messageHelper");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const completedSymbol = Symbol.for('completed');
17
- const messageQSymbol = Symbol.for('messageQ');
18
- const executeMessageSymbol = Symbol.for('executeMessage');
19
- const referenceElementSymbol = Symbol.for('referenceElement');
20
- const referenceInfoSymbol = Symbol.for('referenceInfo');
16
+ const kCompleted = Symbol.for('completed');
17
+ const kMessageQ = Symbol.for('messageQ');
18
+ const kExecuteMessage = Symbol.for('executeMessage');
19
+ const kReferenceElement = Symbol.for('referenceElement');
20
+ const kReferenceInfo = Symbol.for('referenceInfo');
21
21
 
22
22
  function SignalEventDefinition(activity, eventDefinition) {
23
23
  const {
@@ -42,13 +42,13 @@ function SignalEventDefinition(activity, eventDefinition) {
42
42
  this.activity = activity;
43
43
  this.broker = broker;
44
44
  this.logger = environment.Logger(type.toLowerCase());
45
- const referenceElement = this[referenceElementSymbol] = reference.id && activity.getActivityById(reference.id);
45
+ const referenceElement = this[kReferenceElement] = reference.id && activity.getActivityById(reference.id);
46
46
 
47
47
  if (!isThrowing && isStart) {
48
- this[completedSymbol] = false;
48
+ this[kCompleted] = false;
49
49
  const referenceId = referenceElement ? referenceElement.id : 'anonymous';
50
50
  const messageQueueName = `${reference.referenceType}-${(0, _shared.brokerSafeId)(id)}-${(0, _shared.brokerSafeId)(referenceId)}-q`;
51
- this[messageQSymbol] = broker.assertQueue(messageQueueName, {
51
+ this[kMessageQ] = broker.assertQueue(messageQueueName, {
52
52
  autoDelete: false,
53
53
  durable: true
54
54
  });
@@ -61,7 +61,7 @@ function SignalEventDefinition(activity, eventDefinition) {
61
61
  const proto = SignalEventDefinition.prototype;
62
62
  Object.defineProperty(proto, 'executionId', {
63
63
  get() {
64
- const message = this[executeMessageSymbol];
64
+ const message = this[kExecuteMessage];
65
65
  return message && message.content.executionId;
66
66
  }
67
67
 
@@ -72,8 +72,8 @@ proto.execute = function execute(executeMessage) {
72
72
  };
73
73
 
74
74
  proto.executeCatch = function executeCatch(executeMessage) {
75
- this[executeMessageSymbol] = executeMessage;
76
- this[completedSymbol] = false;
75
+ this[kExecuteMessage] = executeMessage;
76
+ this[kCompleted] = false;
77
77
  const executeContent = executeMessage.content;
78
78
  const {
79
79
  executionId,
@@ -81,18 +81,18 @@ proto.executeCatch = function executeCatch(executeMessage) {
81
81
  } = executeContent;
82
82
  const parentExecutionId = parent && parent.executionId;
83
83
 
84
- const info = this[referenceInfoSymbol] = this._getReferenceInfo(executeMessage);
84
+ const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
85
85
 
86
86
  const broker = this.broker;
87
87
 
88
88
  const onCatchMessage = this._onCatchMessage.bind(this);
89
89
 
90
90
  if (this.activity.isStart) {
91
- this[messageQSymbol].consume(onCatchMessage, {
91
+ this[kMessageQ].consume(onCatchMessage, {
92
92
  noAck: true,
93
93
  consumerTag: `_api-signal-${executionId}`
94
94
  });
95
- if (this[completedSymbol]) return;
95
+ if (this[kCompleted]) return;
96
96
  }
97
97
 
98
98
  const onApiMessage = this._onApiMessage.bind(this);
@@ -147,9 +147,9 @@ proto.executeThrow = function executeThrow(executeMessage) {
147
147
  };
148
148
 
149
149
  proto._onCatchMessage = function onCatchMessage(routingKey, message) {
150
- const info = this[referenceInfoSymbol];
150
+ const info = this[kReferenceInfo];
151
151
  if ((0, _getPropertyValue.default)(message, 'content.message.id') !== info.message.id) return;
152
- this[completedSymbol] = true;
152
+ this[kCompleted] = true;
153
153
 
154
154
  this._stop();
155
155
 
@@ -157,7 +157,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
157
157
  type,
158
158
  correlationId
159
159
  } = message.properties;
160
- this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[executeMessageSymbol].content, {
160
+ this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
161
161
  message: { ...message.content.message
162
162
  }
163
163
  }), {
@@ -183,11 +183,11 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
183
183
 
184
184
  case 'discard':
185
185
  {
186
- this[completedSymbol] = true;
186
+ this[kCompleted] = true;
187
187
 
188
188
  this._stop();
189
189
 
190
- return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[executeMessageSymbol].content), {
190
+ return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content), {
191
191
  correlationId
192
192
  });
193
193
  }
@@ -202,13 +202,13 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
202
202
  };
203
203
 
204
204
  proto._complete = function complete(output, options) {
205
- this[completedSymbol] = true;
205
+ this[kCompleted] = true;
206
206
 
207
207
  this._stop();
208
208
 
209
- this._debug(`signaled with ${this[referenceInfoSymbol].description}`);
209
+ this._debug(`signaled with ${this[kReferenceInfo].description}`);
210
210
 
211
- return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(this[executeMessageSymbol].content, {
211
+ return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
212
212
  output,
213
213
  state: 'signal'
214
214
  }), options);
@@ -221,11 +221,11 @@ proto._stop = function stop() {
221
221
  broker.cancel(`_api-parent-${executionId}`);
222
222
  broker.cancel(`_api-${executionId}`);
223
223
  broker.cancel(`_api-delegated-${executionId}`);
224
- if (this.activity.isStart) this[messageQSymbol].purge();
224
+ if (this.activity.isStart) this[kMessageQ].purge();
225
225
  };
226
226
 
227
227
  proto._getReferenceInfo = function getReferenceInfo(message) {
228
- const referenceElement = this[referenceElementSymbol];
228
+ const referenceElement = this[kReferenceElement];
229
229
 
230
230
  if (!referenceElement) {
231
231
  return {
@@ -9,9 +9,9 @@ var _messageHelper = require("../messageHelper");
9
9
 
10
10
  var _iso8601Duration = require("iso8601-duration");
11
11
 
12
- const stoppedSymbol = Symbol.for('stopped');
13
- const timerContentSymbol = Symbol.for('timerContent');
14
- const timerSymbol = Symbol.for('timer');
12
+ const kStopped = Symbol.for('stopped');
13
+ const kTimerContent = Symbol.for('timerContent');
14
+ const kTimer = Symbol.for('timer');
15
15
 
16
16
  function TimerEventDefinition(activity, eventDefinition) {
17
17
  const type = this.type = eventDefinition.type || 'TimerEventDefinition';
@@ -28,14 +28,14 @@ function TimerEventDefinition(activity, eventDefinition) {
28
28
  if (timeDate) this.timeDate = timeDate;
29
29
  this.broker = activity.broker;
30
30
  this.logger = environment.Logger(type.toLowerCase());
31
- this[stoppedSymbol] = false;
32
- this[timerSymbol] = null;
31
+ this[kStopped] = false;
32
+ this[kTimer] = null;
33
33
  }
34
34
 
35
35
  const proto = TimerEventDefinition.prototype;
36
36
  Object.defineProperty(proto, 'executionId', {
37
37
  get() {
38
- const content = this[timerContentSymbol];
38
+ const content = this[kTimerContent];
39
39
  return content && content.executionId;
40
40
  }
41
41
 
@@ -44,7 +44,7 @@ Object.defineProperty(proto, 'stopped', {
44
44
  enumerable: true,
45
45
 
46
46
  get() {
47
- return this[stoppedSymbol];
47
+ return this[kStopped];
48
48
  }
49
49
 
50
50
  });
@@ -52,7 +52,7 @@ Object.defineProperty(proto, 'timer', {
52
52
  enumerable: true,
53
53
 
54
54
  get() {
55
- return this[timerSymbol];
55
+ return this[kTimer];
56
56
  }
57
57
 
58
58
  });
@@ -62,21 +62,21 @@ proto.execute = function execute(executeMessage) {
62
62
  routingKey: executeKey,
63
63
  redelivered: isResumed
64
64
  } = executeMessage.fields;
65
- const timer = this[timerSymbol];
65
+ const timer = this[kTimer];
66
66
 
67
67
  if (timer && executeKey === 'execute.timer') {
68
68
  return;
69
69
  }
70
70
 
71
- if (timer) this[timerSymbol] = this.environment.timers.clearTimeout(timer);
72
- this[stoppedSymbol] = false;
71
+ if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
72
+ this[kStopped] = false;
73
73
  const content = executeMessage.content;
74
74
  const executionId = content.executionId;
75
75
  const startedAt = this.startedAt = 'startedAt' in content ? new Date(content.startedAt) : new Date();
76
76
 
77
77
  const resolvedTimer = this._getTimers(executeMessage);
78
78
 
79
- const timerContent = this[timerContentSymbol] = (0, _messageHelper.cloneContent)(content, { ...resolvedTimer,
79
+ const timerContent = this[kTimerContent] = (0, _messageHelper.cloneContent)(content, { ...resolvedTimer,
80
80
  ...(isResumed ? {
81
81
  isResumed
82
82
  } : undefined),
@@ -99,7 +99,7 @@ proto.execute = function execute(executeMessage) {
99
99
  if (timerContent.timeout === undefined) return this._debug(`waiting for ${timerContent.timerType || 'signal'}`);
100
100
  if (timerContent.timeout <= 0) return this._completed();
101
101
  const timers = this.environment.timers.register(timerContent);
102
- this[timerSymbol] = timers.setTimeout(this._completed.bind(this), timerContent.timeout, {
102
+ this[kTimer] = timers.setTimeout(this._completed.bind(this), timerContent.timeout, {
103
103
  id: content.id,
104
104
  type: this.type,
105
105
  executionId,
@@ -108,8 +108,8 @@ proto.execute = function execute(executeMessage) {
108
108
  };
109
109
 
110
110
  proto.stop = function stopTimer() {
111
- const timer = this[timerSymbol];
112
- if (timer) this[timerSymbol] = this.environment.timers.clearTimeout(timer);
111
+ const timer = this[kTimer];
112
+ if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
113
113
  };
114
114
 
115
115
  proto._completed = function completed(completeContent, options) {
@@ -120,7 +120,7 @@ proto._completed = function completed(completeContent, options) {
120
120
 
121
121
  this._debug(`completed in ${runningTime}ms`);
122
122
 
123
- const timerContent = this[timerContentSymbol];
123
+ const timerContent = this[kTimerContent];
124
124
  const content = {
125
125
  stoppedAt,
126
126
  runningTime,
@@ -148,7 +148,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
148
148
  type,
149
149
  correlationId
150
150
  } = message.properties;
151
- this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[timerContentSymbol], {
151
+ this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kTimerContent], {
152
152
  message: { ...content.message
153
153
  }
154
154
  }), {
@@ -192,7 +192,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
192
192
 
193
193
  this._debug('discarded');
194
194
 
195
- return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[timerContentSymbol], {
195
+ return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kTimerContent], {
196
196
  state: 'discard'
197
197
  }), {
198
198
  correlationId
@@ -202,9 +202,9 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
202
202
  };
203
203
 
204
204
  proto._stop = function stop() {
205
- this[stoppedSymbol] = true;
206
- const timer = this[timerSymbol];
207
- if (timer) this[timerSymbol] = this.environment.timers.clearTimeout(timer);
205
+ this[kStopped] = true;
206
+ const timer = this[kTimer];
207
+ if (timer) this[kTimer] = this.environment.timers.clearTimeout(timer);
208
208
  const broker = this.broker;
209
209
  broker.cancel(`_api-${this.executionId}`);
210
210
  broker.cancel(`_api-delegated-${this.executionId}`);
@@ -16,11 +16,11 @@ var _shared = require("../shared");
16
16
 
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
19
- const attachedTagsSymbol = Symbol.for('attachedConsumers');
20
- const completeContentSymbol = Symbol.for('completeContent');
21
- const executeMessageSymbol = Symbol.for('executeMessage');
22
- const executionSymbol = Symbol.for('execution');
23
- const shovelsSymbol = Symbol.for('shovels');
19
+ const kAttachedTags = Symbol.for('attachedConsumers');
20
+ const kCompleteContent = Symbol.for('completeContent');
21
+ const kExecuteMessage = Symbol.for('executeMessage');
22
+ const kExecution = Symbol.for('execution');
23
+ const kShovels = Symbol.for('shovels');
24
24
 
25
25
  function BoundaryEvent(activityDef, context) {
26
26
  return new _Activity.default(BoundaryEventBehaviour, activityDef, context);
@@ -33,15 +33,15 @@ function BoundaryEventBehaviour(activity) {
33
33
  this.activity = activity;
34
34
  this.environment = activity.environment;
35
35
  this.broker = activity.broker;
36
- this[executionSymbol] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions, 'execute.bound.completed');
37
- this[shovelsSymbol] = [];
38
- this[attachedTagsSymbol] = [];
36
+ this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions, 'execute.bound.completed');
37
+ this[kShovels] = [];
38
+ this[kAttachedTags] = [];
39
39
  }
40
40
 
41
41
  const proto = BoundaryEventBehaviour.prototype;
42
42
  Object.defineProperty(proto, 'executionId', {
43
43
  get() {
44
- const message = this[executeMessageSymbol];
44
+ const message = this[kExecuteMessage];
45
45
  return message && message.content.executionId;
46
46
  }
47
47
 
@@ -61,10 +61,10 @@ proto.execute = function execute(executeMessage) {
61
61
  isRootScope,
62
62
  executionId
63
63
  } = executeMessage.content;
64
- const eventDefinitionExecution = this[executionSymbol];
64
+ const eventDefinitionExecution = this[kExecution];
65
65
 
66
66
  if (isRootScope) {
67
- this[executeMessageSymbol] = executeMessage;
67
+ this[kExecuteMessage] = executeMessage;
68
68
  const broker = this.broker;
69
69
 
70
70
  if (eventDefinitionExecution && !this.environment.settings.strict) {
@@ -80,7 +80,7 @@ proto.execute = function execute(executeMessage) {
80
80
  consumerTag,
81
81
  priority: 300
82
82
  });
83
- this[attachedTagsSymbol].push(consumerTag);
83
+ this[kAttachedTags].push(consumerTag);
84
84
  broker.subscribeOnce('execution', 'execute.detach', this._onDetachMessage.bind(this), {
85
85
  consumerTag: '_detach-tag'
86
86
  });
@@ -106,10 +106,10 @@ proto._onCompleted = function onCompleted(_, {
106
106
  return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content));
107
107
  }
108
108
 
109
- this[completeContentSymbol] = content;
109
+ this[kCompleteContent] = content;
110
110
  const {
111
111
  inbound
112
- } = this[executeMessageSymbol].content;
112
+ } = this[kExecuteMessage].content;
113
113
  const attachedToContent = inbound && inbound[0];
114
114
  const attachedTo = this.attachedTo;
115
115
  this.activity.logger.debug(`<${this.executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
@@ -125,8 +125,8 @@ proto._onAttachedLeave = function onAttachedLeave(_, {
125
125
 
126
126
  this._stop();
127
127
 
128
- const completeContent = this[completeContentSymbol];
129
- if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[executeMessageSymbol].content);
128
+ const completeContent = this[kCompleteContent];
129
+ if (!completeContent) return this.broker.publish('execution', 'execute.discard', this[kExecuteMessage].content);
130
130
  return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completeContent));
131
131
  };
132
132
 
@@ -139,7 +139,7 @@ proto._onExpectMessage = function onExpectMessage(_, {
139
139
  } = content;
140
140
  const attachedTo = this.attachedTo;
141
141
  const errorConsumerTag = `_bound-error-listener-${executionId}`;
142
- this[attachedTagsSymbol].push(errorConsumerTag);
142
+ this[kAttachedTags].push(errorConsumerTag);
143
143
  attachedTo.broker.subscribeTmp('event', 'activity.error', (__, errorMessage) => {
144
144
  if (errorMessage.content.id !== attachedTo.id) return;
145
145
  this.broker.publish('execution', expectRoutingKey, (0, _messageHelper.cloneContent)(errorMessage.content));
@@ -167,7 +167,7 @@ proto._onDetachMessage = function onDetachMessage(_, {
167
167
  sourcePattern
168
168
  } = content;
169
169
  const shovelName = `_detached-${(0, _shared.brokerSafeId)(id)}_${detachId}`;
170
- this[shovelsSymbol].push(shovelName);
170
+ this[kShovels].push(shovelName);
171
171
  const broker = this.broker;
172
172
  attachedTo.broker.createShovel(shovelName, {
173
173
  exchange: sourceExchange,
@@ -204,9 +204,9 @@ proto._stop = function stop(detach) {
204
204
  broker = this.broker,
205
205
  executionId = this.executionId;
206
206
 
207
- for (const tag of this[attachedTagsSymbol].splice(0)) attachedTo.broker.cancel(tag);
207
+ for (const tag of this[kAttachedTags].splice(0)) attachedTo.broker.cancel(tag);
208
208
 
209
- for (const shovelName of this[shovelsSymbol].splice(0)) attachedTo.broker.closeShovel(shovelName);
209
+ for (const shovelName of this[kShovels].splice(0)) attachedTo.broker.closeShovel(shovelName);
210
210
 
211
211
  broker.cancel('_expect-tag');
212
212
  broker.cancel('_detach-tag');
@@ -14,7 +14,7 @@ var _messageHelper = require("../messageHelper");
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- const executionSymbol = Symbol.for('execution');
17
+ const kExecution = Symbol.for('execution');
18
18
 
19
19
  function EndEvent(activityDef, context) {
20
20
  return new _Activity.default(EndEventBehaviour, { ...activityDef,
@@ -26,11 +26,11 @@ function EndEventBehaviour(activity) {
26
26
  this.id = activity.id;
27
27
  this.type = activity.type;
28
28
  this.broker = activity.broker;
29
- this[executionSymbol] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
29
+ this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
30
30
  }
31
31
 
32
32
  EndEventBehaviour.prototype.execute = function execute(executeMessage) {
33
- const execution = this[executionSymbol];
33
+ const execution = this[kExecution];
34
34
 
35
35
  if (execution) {
36
36
  return execution.execute(executeMessage);
@@ -14,7 +14,7 @@ var _messageHelper = require("../messageHelper");
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- const executionSymbol = Symbol.for('execution');
17
+ const kExecution = Symbol.for('execution');
18
18
 
19
19
  function IntermediateCatchEvent(activityDef, context) {
20
20
  return new _Activity.default(IntermediateCatchEventBehaviour, activityDef, context);
@@ -24,11 +24,11 @@ function IntermediateCatchEventBehaviour(activity) {
24
24
  this.id = activity.id;
25
25
  this.type = activity.type;
26
26
  this.broker = activity.broker;
27
- this[executionSymbol] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
27
+ this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
28
28
  }
29
29
 
30
30
  IntermediateCatchEventBehaviour.prototype.execute = function execute(executeMessage) {
31
- const execution = this[executionSymbol];
31
+ const execution = this[kExecution];
32
32
 
33
33
  if (execution) {
34
34
  return execution.execute(executeMessage);
@@ -14,7 +14,7 @@ var _messageHelper = require("../messageHelper");
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- const executionSymbol = Symbol.for('execution');
17
+ const kExecution = Symbol.for('execution');
18
18
 
19
19
  function IntermediateThrowEvent(activityDef, context) {
20
20
  return new _Activity.default(IntermediateThrowEventBehaviour, { ...activityDef,
@@ -26,11 +26,11 @@ function IntermediateThrowEventBehaviour(activity) {
26
26
  this.id = activity.id;
27
27
  this.type = activity.type;
28
28
  this.broker = activity.broker;
29
- this[executionSymbol] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
29
+ this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
30
30
  }
31
31
 
32
32
  IntermediateThrowEventBehaviour.prototype.execute = function execute(executeMessage) {
33
- const execution = this[executionSymbol];
33
+ const execution = this[kExecution];
34
34
 
35
35
  if (execution) {
36
36
  return execution.execute(executeMessage);
@@ -14,8 +14,8 @@ var _messageHelper = require("../messageHelper");
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
 
17
- const executeMessageSymbol = Symbol.for('executeMessage');
18
- const executionSymbol = Symbol.for('execution');
17
+ const kExecuteMessage = Symbol.for('executeMessage');
18
+ const kExecution = Symbol.for('execution');
19
19
 
20
20
  function StartEvent(activityDef, context) {
21
21
  return new _Activity.default(StartEventBehaviour, activityDef, context);
@@ -26,20 +26,20 @@ function StartEventBehaviour(activity) {
26
26
  this.type = activity.type;
27
27
  this.activity = activity;
28
28
  this.broker = activity.broker;
29
- this[executionSymbol] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
29
+ this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
30
30
  }
31
31
 
32
32
  const proto = StartEventBehaviour.prototype;
33
33
  Object.defineProperty(proto, 'executionId', {
34
34
  get() {
35
- const message = this[executeMessageSymbol];
35
+ const message = this[kExecuteMessage];
36
36
  return message && message.content.executionId;
37
37
  }
38
38
 
39
39
  });
40
40
 
41
41
  proto.execute = function execute(executeMessage) {
42
- const execution = this[executionSymbol];
42
+ const execution = this[kExecution];
43
43
 
44
44
  if (execution) {
45
45
  return execution.execute(executeMessage);
@@ -53,7 +53,7 @@ proto.execute = function execute(executeMessage) {
53
53
  }
54
54
 
55
55
  const executionId = content.executionId;
56
- this[executeMessageSymbol] = executeMessage;
56
+ this[kExecuteMessage] = executeMessage;
57
57
  broker.subscribeTmp('api', `activity.#.${executionId}`, (...args) => this._onApiMessage(...args), {
58
58
  noAck: true,
59
59
  consumerTag: `_api-${executionId}`,
@@ -83,7 +83,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
83
83
  {
84
84
  this._stop();
85
85
 
86
- const content = this[executeMessageSymbol].content;
86
+ const content = this[kExecuteMessage].content;
87
87
  return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content, {
88
88
  output: message.content.message,
89
89
  state: 'signal'
@@ -96,7 +96,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
96
96
  {
97
97
  this._stop();
98
98
 
99
- const content = this[executeMessageSymbol].content;
99
+ const content = this[kExecuteMessage].content;
100
100
  return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(content), {
101
101
  correlationId
102
102
  });
@@ -117,7 +117,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
117
117
  type,
118
118
  correlationId
119
119
  } = message.properties;
120
- const executeContent = this[executeMessageSymbol].content;
120
+ const executeContent = this[kExecuteMessage].content;
121
121
  this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(executeContent, {
122
122
  message: { ...content.message
123
123
  }