bpmn-elements 7.0.0 → 8.1.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 (72) hide show
  1. package/CHANGELOG.md +23 -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 +106 -106
  6. package/dist/src/activity/ActivityExecution.js +37 -37
  7. package/dist/src/activity/Message.js +2 -2
  8. package/dist/src/activity/Signal.js +2 -2
  9. package/dist/src/definition/Definition.js +50 -50
  10. package/dist/src/definition/DefinitionExecution.js +114 -125
  11. package/dist/src/eventDefinitions/CancelEventDefinition.js +16 -16
  12. package/dist/src/eventDefinitions/CompensateEventDefinition.js +24 -24
  13. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  14. package/dist/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  15. package/dist/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  16. package/dist/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  17. package/dist/src/eventDefinitions/LinkEventDefinition.js +15 -15
  18. package/dist/src/eventDefinitions/MessageEventDefinition.js +23 -23
  19. package/dist/src/eventDefinitions/SignalEventDefinition.js +24 -24
  20. package/dist/src/eventDefinitions/TimerEventDefinition.js +76 -53
  21. package/dist/src/events/BoundaryEvent.js +67 -38
  22. package/dist/src/events/EndEvent.js +3 -3
  23. package/dist/src/events/IntermediateCatchEvent.js +3 -3
  24. package/dist/src/events/IntermediateThrowEvent.js +3 -3
  25. package/dist/src/events/StartEvent.js +9 -9
  26. package/dist/src/flows/Association.js +7 -7
  27. package/dist/src/flows/MessageFlow.js +9 -9
  28. package/dist/src/flows/SequenceFlow.js +7 -7
  29. package/dist/src/gateways/EventBasedGateway.js +11 -11
  30. package/dist/src/io/InputOutputSpecification.js +4 -4
  31. package/dist/src/io/Properties.js +9 -9
  32. package/dist/src/process/Process.js +64 -61
  33. package/dist/src/process/ProcessExecution.js +93 -90
  34. package/dist/src/tasks/ReceiveTask.js +16 -16
  35. package/dist/src/tasks/SubProcess.js +16 -18
  36. package/package.json +15 -16
  37. package/src/Context.js +48 -40
  38. package/src/Environment.js +48 -20
  39. package/src/EventBroker.js +1 -1
  40. package/src/MessageFormatter.js +11 -11
  41. package/src/activity/Activity.js +99 -100
  42. package/src/activity/ActivityExecution.js +35 -35
  43. package/src/activity/Message.js +1 -1
  44. package/src/activity/Signal.js +1 -1
  45. package/src/definition/Definition.js +51 -50
  46. package/src/definition/DefinitionExecution.js +111 -113
  47. package/src/eventDefinitions/CancelEventDefinition.js +16 -16
  48. package/src/eventDefinitions/CompensateEventDefinition.js +25 -24
  49. package/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  50. package/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  51. package/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  52. package/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  53. package/src/eventDefinitions/LinkEventDefinition.js +15 -15
  54. package/src/eventDefinitions/MessageEventDefinition.js +23 -23
  55. package/src/eventDefinitions/SignalEventDefinition.js +24 -24
  56. package/src/eventDefinitions/TimerEventDefinition.js +61 -44
  57. package/src/events/BoundaryEvent.js +53 -36
  58. package/src/events/EndEvent.js +3 -3
  59. package/src/events/IntermediateCatchEvent.js +3 -3
  60. package/src/events/IntermediateThrowEvent.js +3 -3
  61. package/src/events/StartEvent.js +9 -9
  62. package/src/flows/Association.js +7 -7
  63. package/src/flows/MessageFlow.js +9 -9
  64. package/src/flows/SequenceFlow.js +7 -7
  65. package/src/gateways/EventBasedGateway.js +11 -11
  66. package/src/io/BpmnIO.js +5 -1
  67. package/src/io/InputOutputSpecification.js +4 -4
  68. package/src/io/Properties.js +9 -9
  69. package/src/process/Process.js +62 -58
  70. package/src/process/ProcessExecution.js +86 -88
  71. package/src/tasks/ReceiveTask.js +16 -16
  72. package/src/tasks/SubProcess.js +16 -16
@@ -23,19 +23,19 @@ var _Errors = require("../error/Errors");
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
25
 
26
- const activityDefSymbol = Symbol.for('activityDefinition');
27
- const bpmnIoSymbol = Symbol.for('bpmnIo');
28
- const consumingSymbol = Symbol.for('consuming');
29
- const countersSymbol = Symbol.for('counters');
30
- const eventDefinitionsSymbol = Symbol.for('eventDefinitions');
31
- const execSymbol = Symbol.for('exec');
32
- const executeMessageSymbol = Symbol.for('executeMessage');
33
- const extensionsSymbol = Symbol.for('extensions');
34
- const flagsSymbol = Symbol.for('flags');
35
- const flowsSymbol = Symbol.for('flows');
36
- const formatterSymbol = Symbol.for('formatter');
37
- const messageHandlersSymbol = Symbol.for('messageHandlers');
38
- const stateMessageSymbol = Symbol.for('stateMessage');
26
+ const kActivityDef = Symbol.for('activityDefinition');
27
+ const kBpmnIo = Symbol.for('bpmnIo');
28
+ const kConsuming = Symbol.for('consuming');
29
+ const kCounters = Symbol.for('counters');
30
+ const kEventDefinitions = Symbol.for('eventDefinitions');
31
+ const kExec = Symbol.for('exec');
32
+ const kExecuteMessage = Symbol.for('executeMessage');
33
+ const kExtensions = Symbol.for('extensions');
34
+ const kFlags = Symbol.for('flags');
35
+ const kFlows = Symbol.for('flows');
36
+ const kFormatter = Symbol.for('formatter');
37
+ const kMessageHandlers = Symbol.for('messageHandlers');
38
+ const kStateMessage = Symbol.for('stateMessage');
39
39
  var _default = Activity;
40
40
  exports.default = _default;
41
41
 
@@ -50,7 +50,7 @@ function Activity(Behaviour, activityDef, context) {
50
50
  attachedTo: attachedToRef,
51
51
  eventDefinitions
52
52
  } = behaviour;
53
- this[activityDefSymbol] = activityDef;
53
+ this[kActivityDef] = activityDef;
54
54
  this.id = id;
55
55
  this.type = type;
56
56
  this.name = name;
@@ -62,7 +62,7 @@ function Activity(Behaviour, activityDef, context) {
62
62
  this.logger = context.environment.Logger(type.toLowerCase());
63
63
  this.environment = context.environment;
64
64
  this.context = context;
65
- this[countersSymbol] = {
65
+ this[kCounters] = {
66
66
  taken: 0,
67
67
  discarded: 0
68
68
  };
@@ -89,7 +89,7 @@ function Activity(Behaviour, activityDef, context) {
89
89
  const inboundAssociations = context.getInboundAssociations(id);
90
90
  const inboundTriggers = attachedToActivity ? [attachedToActivity] : inboundSequenceFlows.slice();
91
91
  const outboundSequenceFlows = context.getOutboundSequenceFlows(id);
92
- const flows = this[flowsSymbol] = {
92
+ const flows = this[kFlows] = {
93
93
  inboundSequenceFlows,
94
94
  inboundAssociations,
95
95
  inboundJoinFlows: [],
@@ -99,7 +99,7 @@ function Activity(Behaviour, activityDef, context) {
99
99
  };
100
100
  const isForCompensation = !!behaviour.isForCompensation;
101
101
  const isParallelJoin = activityDef.isParallelGateway && flows.inboundSequenceFlows.length > 1;
102
- this[flagsSymbol] = {
102
+ this[kFlags] = {
103
103
  isEnd: flows.outboundSequenceFlows.length === 0,
104
104
  isStart: flows.inboundSequenceFlows.length === 0 && !attachedTo && !behaviour.triggeredByEvent && !isForCompensation,
105
105
  isSubProcess: activityDef.isSubProcess,
@@ -110,8 +110,8 @@ function Activity(Behaviour, activityDef, context) {
110
110
  isParallelJoin,
111
111
  isThrowing: activityDef.isThrowing
112
112
  };
113
- this[execSymbol] = {};
114
- this[messageHandlersSymbol] = {
113
+ this[kExec] = {};
114
+ this[kMessageHandlers] = {
115
115
  onInbound: isParallelJoin ? this._onJoinInbound.bind(this) : this._onInbound.bind(this),
116
116
  onRunMessage: this._onRunMessage.bind(this),
117
117
  onApiMessage: this._onApiMessage.bind(this),
@@ -144,7 +144,7 @@ function Activity(Behaviour, activityDef, context) {
144
144
  }
145
145
  }
146
146
 
147
- this[eventDefinitionsSymbol] = eventDefinitions && eventDefinitions.map(ed => new ed.Behaviour(this, ed, this.context));
147
+ this[kEventDefinitions] = eventDefinitions && eventDefinitions.map(ed => new ed.Behaviour(this, ed, this.context));
148
148
  }
149
149
 
150
150
  const proto = Activity.prototype;
@@ -152,7 +152,7 @@ Object.defineProperty(proto, 'counters', {
152
152
  enumerable: true,
153
153
 
154
154
  get() {
155
- return { ...this[countersSymbol]
155
+ return { ...this[kCounters]
156
156
  };
157
157
  }
158
158
 
@@ -161,7 +161,7 @@ Object.defineProperty(proto, 'execution', {
161
161
  enumerable: true,
162
162
 
163
163
  get() {
164
- return this[execSymbol].execution;
164
+ return this[kExec].execution;
165
165
  }
166
166
 
167
167
  });
@@ -169,7 +169,7 @@ Object.defineProperty(proto, 'executionId', {
169
169
  enumerable: true,
170
170
 
171
171
  get() {
172
- return this[execSymbol].executionId;
172
+ return this[kExec].executionId;
173
173
  }
174
174
 
175
175
  });
@@ -177,8 +177,8 @@ Object.defineProperty(proto, 'bpmnIo', {
177
177
  enumerable: true,
178
178
 
179
179
  get() {
180
- if (bpmnIoSymbol in this) return this[bpmnIoSymbol];
181
- const bpmnIo = this[bpmnIoSymbol] = new _BpmnIO.default(this, this.context);
180
+ if (kBpmnIo in this) return this[kBpmnIo];
181
+ const bpmnIo = this[kBpmnIo] = new _BpmnIO.default(this, this.context);
182
182
  return bpmnIo;
183
183
  }
184
184
 
@@ -187,8 +187,8 @@ Object.defineProperty(proto, 'extensions', {
187
187
  enumerable: true,
188
188
 
189
189
  get() {
190
- if (extensionsSymbol in this) return this[extensionsSymbol];
191
- const extensions = this[extensionsSymbol] = this.context.loadExtensions(this);
190
+ if (kExtensions in this) return this[kExtensions];
191
+ const extensions = this[kExtensions] = this.context.loadExtensions(this);
192
192
  return extensions;
193
193
  }
194
194
 
@@ -197,10 +197,10 @@ Object.defineProperty(proto, 'formatter', {
197
197
  enumerable: true,
198
198
 
199
199
  get() {
200
- let formatter = this[formatterSymbol];
200
+ let formatter = this[kFormatter];
201
201
  if (formatter) return formatter;
202
202
  const broker = this.broker;
203
- formatter = this[formatterSymbol] = new _MessageFormatter.Formatter({
203
+ formatter = this[kFormatter] = new _MessageFormatter.Formatter({
204
204
  id: this.id,
205
205
  broker,
206
206
  logger: this.logger
@@ -213,7 +213,7 @@ Object.defineProperty(proto, 'isRunning', {
213
213
  enumerable: true,
214
214
 
215
215
  get() {
216
- if (!this[consumingSymbol]) return false;
216
+ if (!this[kConsuming]) return false;
217
217
  return !!this.status;
218
218
  }
219
219
 
@@ -222,7 +222,7 @@ Object.defineProperty(proto, 'outbound', {
222
222
  enumerable: true,
223
223
 
224
224
  get() {
225
- return this[flowsSymbol].outboundSequenceFlows;
225
+ return this[kFlows].outboundSequenceFlows;
226
226
  }
227
227
 
228
228
  });
@@ -230,7 +230,7 @@ Object.defineProperty(proto, 'inbound', {
230
230
  enumerable: true,
231
231
 
232
232
  get() {
233
- return this[flowsSymbol].inboundSequenceFlows;
233
+ return this[kFlows].inboundSequenceFlows;
234
234
  }
235
235
 
236
236
  });
@@ -238,7 +238,7 @@ Object.defineProperty(proto, 'isEnd', {
238
238
  enumerable: true,
239
239
 
240
240
  get() {
241
- return this[flagsSymbol].isEnd;
241
+ return this[kFlags].isEnd;
242
242
  }
243
243
 
244
244
  });
@@ -246,7 +246,7 @@ Object.defineProperty(proto, 'isStart', {
246
246
  enumerable: true,
247
247
 
248
248
  get() {
249
- return this[flagsSymbol].isStart;
249
+ return this[kFlags].isStart;
250
250
  }
251
251
 
252
252
  });
@@ -254,7 +254,7 @@ Object.defineProperty(proto, 'isSubProcess', {
254
254
  enumerable: true,
255
255
 
256
256
  get() {
257
- return this[flagsSymbol].isSubProcess;
257
+ return this[kFlags].isSubProcess;
258
258
  }
259
259
 
260
260
  });
@@ -262,7 +262,7 @@ Object.defineProperty(proto, 'isMultiInstance', {
262
262
  enumerable: true,
263
263
 
264
264
  get() {
265
- return this[flagsSymbol].isMultiInstance;
265
+ return this[kFlags].isMultiInstance;
266
266
  }
267
267
 
268
268
  });
@@ -270,7 +270,7 @@ Object.defineProperty(proto, 'isThrowing', {
270
270
  enumerable: true,
271
271
 
272
272
  get() {
273
- return this[flagsSymbol].isThrowing;
273
+ return this[kFlags].isThrowing;
274
274
  }
275
275
 
276
276
  });
@@ -278,7 +278,7 @@ Object.defineProperty(proto, 'isForCompensation', {
278
278
  enumerable: true,
279
279
 
280
280
  get() {
281
- return this[flagsSymbol].isForCompensation;
281
+ return this[kFlags].isForCompensation;
282
282
  }
283
283
 
284
284
  });
@@ -286,7 +286,7 @@ Object.defineProperty(proto, 'triggeredByEvent', {
286
286
  enumerable: true,
287
287
 
288
288
  get() {
289
- return this[activityDefSymbol].triggeredByEvent;
289
+ return this[kActivityDef].triggeredByEvent;
290
290
  }
291
291
 
292
292
  });
@@ -294,7 +294,7 @@ Object.defineProperty(proto, 'attachedTo', {
294
294
  enumerable: true,
295
295
 
296
296
  get() {
297
- const attachedToId = this[flagsSymbol].attachedTo;
297
+ const attachedToId = this[kFlags].attachedTo;
298
298
  if (!attachedToId) return null;
299
299
  return this.getActivityById(attachedToId);
300
300
  }
@@ -304,13 +304,13 @@ Object.defineProperty(proto, 'eventDefinitions', {
304
304
  enumerable: true,
305
305
 
306
306
  get() {
307
- return this[eventDefinitionsSymbol];
307
+ return this[kEventDefinitions];
308
308
  }
309
309
 
310
310
  });
311
311
 
312
312
  proto.activate = function activate() {
313
- if (this[flagsSymbol].isForCompensation) return;
313
+ if (this[kFlags].isForCompensation) return;
314
314
  return this._consumeInbound();
315
315
  };
316
316
 
@@ -322,7 +322,7 @@ proto.deactivate = function deactivate() {
322
322
 
323
323
  proto.init = function init(initContent) {
324
324
  const id = this.id;
325
- const exec = this[execSymbol];
325
+ const exec = this[kExec];
326
326
  const executionId = exec.initExecutionId = exec.initExecutionId || (0, _shared.getUniqueId)(id);
327
327
  this.logger.debug(`<${id}> initialized with executionId <${executionId}>`);
328
328
 
@@ -334,7 +334,7 @@ proto.init = function init(initContent) {
334
334
  proto.run = function run(runContent) {
335
335
  const id = this.id;
336
336
  if (this.isRunning) throw new Error(`activity <${id}> is already running`);
337
- const exec = this[execSymbol];
337
+ const exec = this[kExec];
338
338
  const executionId = exec.executionId = exec.initExecutionId || (0, _shared.getUniqueId)(id);
339
339
  exec.initExecutionId = null;
340
340
 
@@ -356,9 +356,9 @@ proto.recover = function recover(state) {
356
356
  if (!state) return;
357
357
  this.stopped = state.stopped;
358
358
  this.status = state.status;
359
- const exec = this[execSymbol];
359
+ const exec = this[kExec];
360
360
  exec.executionId = state.executionId;
361
- this[countersSymbol] = { ...this[countersSymbol],
361
+ this[kCounters] = { ...this[kCounters],
362
362
  ...state.counters
363
363
  };
364
364
 
@@ -371,7 +371,7 @@ proto.recover = function recover(state) {
371
371
  };
372
372
 
373
373
  proto.resume = function resume() {
374
- if (this[consumingSymbol]) {
374
+ if (this[kConsuming]) {
375
375
  throw new Error(`cannot resume running activity <${this.id}>`);
376
376
  }
377
377
 
@@ -391,26 +391,26 @@ proto.resume = function resume() {
391
391
 
392
392
  proto.discard = function discard(discardContent) {
393
393
  if (!this.status) return this._runDiscard(discardContent);
394
- const execution = this[execSymbol].execution;
394
+ const execution = this[kExec].execution;
395
395
  if (execution && !execution.completed) return execution.discard();
396
396
 
397
397
  this._deactivateRunConsumers();
398
398
 
399
399
  const broker = this.broker;
400
400
  broker.getQueue('run-q').purge();
401
- broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(this[stateMessageSymbol].content));
401
+ broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(this[kStateMessage].content));
402
402
 
403
403
  this._consumeRunQ();
404
404
  };
405
405
 
406
406
  proto.stop = function stop() {
407
- if (!this[consumingSymbol]) return;
407
+ if (!this[kConsuming]) return;
408
408
  return this.getApi().stop();
409
409
  };
410
410
 
411
411
  proto.next = function next() {
412
412
  if (!this.environment.settings.step) return;
413
- const stateMessage = this[stateMessageSymbol];
413
+ const stateMessage = this[kStateMessage];
414
414
  if (!stateMessage) return;
415
415
  if (this.status === 'executing') return false;
416
416
  if (this.status === 'formatting') return false;
@@ -426,13 +426,13 @@ proto.shake = function shake() {
426
426
  };
427
427
 
428
428
  proto.evaluateOutbound = function evaluateOutbound(fromMessage, discardRestAtTake, callback) {
429
- return this[flowsSymbol].outboundEvaluator.evaluate(fromMessage, discardRestAtTake, callback);
429
+ return this[kFlows].outboundEvaluator.evaluate(fromMessage, discardRestAtTake, callback);
430
430
  };
431
431
 
432
432
  proto.getState = function getState() {
433
433
  const msg = this._createMessage();
434
434
 
435
- const exec = this[execSymbol];
435
+ const exec = this[kExec];
436
436
  return { ...msg,
437
437
  executionId: exec.executionId,
438
438
  stopped: this.stopped,
@@ -445,9 +445,9 @@ proto.getState = function getState() {
445
445
  };
446
446
 
447
447
  proto.getApi = function getApi(message) {
448
- const execution = this[execSymbol].execution;
448
+ const execution = this[kExec].execution;
449
449
  if (execution && !execution.completed) return execution.getApi(message);
450
- return (0, _Api.ActivityApi)(this.broker, message || this[stateMessageSymbol]);
450
+ return (0, _Api.ActivityApi)(this.broker, message || this[kStateMessage]);
451
451
  };
452
452
 
453
453
  proto.getActivityById = function getActivityById(elementId) {
@@ -455,7 +455,7 @@ proto.getActivityById = function getActivityById(elementId) {
455
455
  };
456
456
 
457
457
  proto._runDiscard = function runDiscard(discardContent) {
458
- const exec = this[execSymbol];
458
+ const exec = this[kExec];
459
459
  const executionId = exec.executionId = exec.initExecutionId || (0, _shared.getUniqueId)(this.id);
460
460
  exec.initExecutionId = null;
461
461
 
@@ -473,7 +473,7 @@ proto._runDiscard = function runDiscard(discardContent) {
473
473
  proto._discardRun = function discardRun() {
474
474
  const status = this.status;
475
475
  if (!status) return;
476
- const execution = this[execSymbol].execution;
476
+ const execution = this[kExec].execution;
477
477
  if (execution && !execution.completed) return;
478
478
 
479
479
  switch (status) {
@@ -488,7 +488,7 @@ proto._discardRun = function discardRun() {
488
488
  if (this.extensions) this.extensions.deactivate();
489
489
  const broker = this.broker;
490
490
  broker.getQueue('run-q').purge();
491
- broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(this[stateMessageSymbol].content));
491
+ broker.publish('run', 'run.discard', (0, _messageHelper.cloneContent)(this[kStateMessage].content));
492
492
 
493
493
  this._consumeRunQ();
494
494
  };
@@ -506,28 +506,28 @@ proto._shakeOutbound = function shakeOutbound(sourceMessage) {
506
506
  type: 'shake'
507
507
  });
508
508
 
509
- if (this[flagsSymbol].isEnd) {
509
+ if (this[kFlags].isEnd) {
510
510
  return broker.publish('event', 'activity.shake.end', message.content, {
511
511
  persistent: false,
512
512
  type: 'shake'
513
513
  });
514
514
  }
515
515
 
516
- for (const flow of this[flowsSymbol].outboundSequenceFlows) flow.shake(message);
516
+ for (const flow of this[kFlows].outboundSequenceFlows) flow.shake(message);
517
517
  };
518
518
 
519
519
  proto._consumeInbound = function consumeInbound() {
520
520
  if (this.status) return;
521
521
  const inboundQ = this.broker.getQueue('inbound-q');
522
522
 
523
- if (this[flagsSymbol].isParallelJoin) {
524
- return inboundQ.consume(this[messageHandlersSymbol].onInbound, {
523
+ if (this[kFlags].isParallelJoin) {
524
+ return inboundQ.consume(this[kMessageHandlers].onInbound, {
525
525
  consumerTag: '_run-on-inbound',
526
526
  prefetch: 1000
527
527
  });
528
528
  }
529
529
 
530
- return inboundQ.consume(this[messageHandlersSymbol].onInbound, {
530
+ return inboundQ.consume(this[kMessageHandlers].onInbound, {
531
531
  consumerTag: '_run-on-inbound'
532
532
  });
533
533
  };
@@ -543,6 +543,7 @@ proto._onInbound = function onInbound(routingKey, message) {
543
543
  switch (routingKey) {
544
544
  case 'association.take':
545
545
  case 'flow.take':
546
+ case 'activity.restart':
546
547
  case 'activity.enter':
547
548
  return this.run({
548
549
  message: content.message,
@@ -580,7 +581,7 @@ proto._onJoinInbound = function onJoinInbound(routingKey, message) {
580
581
  inboundSequenceFlows,
581
582
  inboundJoinFlows,
582
583
  inboundTriggers
583
- } = this[flowsSymbol];
584
+ } = this[kFlows];
584
585
  const idx = inboundJoinFlows.findIndex(msg => msg.content.id === content.id);
585
586
  inboundJoinFlows.push(message);
586
587
  if (idx > -1) return;
@@ -630,7 +631,7 @@ proto._onInboundEvent = function onInboundEvent(routingKey, message) {
630
631
  case 'activity.enter':
631
632
  case 'activity.discard':
632
633
  {
633
- if (content.id === this[flagsSymbol].attachedTo) {
634
+ if (content.id === this[kFlags].attachedTo) {
634
635
  inboundQ.queueMessage(fields, (0, _messageHelper.cloneContent)(content), properties);
635
636
  }
636
637
 
@@ -655,7 +656,7 @@ proto._onInboundEvent = function onInboundEvent(routingKey, message) {
655
656
 
656
657
  case 'association.complete':
657
658
  {
658
- if (!this[flagsSymbol].isForCompensation) break;
659
+ if (!this[kFlags].isForCompensation) break;
659
660
  inboundQ.queueMessage(fields, (0, _messageHelper.cloneContent)(content), properties);
660
661
  const compensationId = `${(0, _shared.brokerSafeId)(id)}_${(0, _shared.brokerSafeId)(content.sequenceId)}`;
661
662
 
@@ -671,9 +672,9 @@ proto._onInboundEvent = function onInboundEvent(routingKey, message) {
671
672
  };
672
673
 
673
674
  proto._consumeRunQ = function consumeRunQ() {
674
- if (this[consumingSymbol]) return;
675
- this[consumingSymbol] = true;
676
- this.broker.getQueue('run-q').assertConsumer(this[messageHandlersSymbol].onRunMessage, {
675
+ if (this[kConsuming]) return;
676
+ this[kConsuming] = true;
677
+ this.broker.getQueue('run-q').assertConsumer(this[kMessageHandlers].onRunMessage, {
677
678
  exclusive: true,
678
679
  consumerTag: '_activity-run'
679
680
  });
@@ -709,7 +710,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
709
710
  const correlationId = message.properties.correlationId;
710
711
  const id = this.id;
711
712
  const step = this.environment.settings.step;
712
- this[stateMessageSymbol] = message;
713
+ this[kStateMessage] = message;
713
714
 
714
715
  switch (routingKey) {
715
716
  case 'run.enter':
@@ -718,7 +719,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
718
719
  this.status = 'entered';
719
720
 
720
721
  if (!isRedelivered) {
721
- this[execSymbol].execution = null;
722
+ this[kExec].execution = null;
722
723
  }
723
724
 
724
725
  if (this.extensions) this.extensions.activate((0, _messageHelper.cloneMessage)(message), this);
@@ -733,7 +734,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
733
734
  {
734
735
  this.logger.debug(`<${id}> discard`, isRedelivered ? 'redelivered' : '');
735
736
  this.status = 'discard';
736
- this[execSymbol].execution = null;
737
+ this[kExec].execution = null;
737
738
  if (this.extensions) this.extensions.activate((0, _messageHelper.cloneMessage)(message), this);
738
739
  if (this.bpmnIo) this.bpmnIo.activate(message);
739
740
 
@@ -771,7 +772,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
771
772
  const execution = this.execution;
772
773
 
773
774
  if (!isRedelivered && execution) {
774
- this[executeMessageSymbol] = message;
775
+ this[kExecuteMessage] = message;
775
776
  return execution.passthrough(message);
776
777
  }
777
778
  }
@@ -779,12 +780,12 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
779
780
  case 'run.execute':
780
781
  {
781
782
  this.status = 'executing';
782
- this[executeMessageSymbol] = message;
783
- this.broker.getQueue('execution-q').assertConsumer(this[messageHandlersSymbol].onExecutionMessage, {
783
+ this[kExecuteMessage] = message;
784
+ this.broker.getQueue('execution-q').assertConsumer(this[kMessageHandlers].onExecutionMessage, {
784
785
  exclusive: true,
785
786
  consumerTag: '_activity-execution'
786
787
  });
787
- const exec = this[execSymbol];
788
+ const exec = this[kExec];
788
789
  if (!exec.execution) exec.execution = new _ActivityExecution.default(this, this.context);
789
790
 
790
791
  if (isRedelivered) {
@@ -802,9 +803,8 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
802
803
  case 'run.end':
803
804
  {
804
805
  if (this.status === 'end') break;
805
- this[countersSymbol].taken++;
806
+ this[kCounters].taken++;
806
807
  this.status = 'end';
807
- if (isRedelivered) break;
808
808
  return this._doRunLeave(message, false, () => {
809
809
  this._publishEvent('end', content, {
810
810
  correlationId
@@ -828,7 +828,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
828
828
  case 'run.discarded':
829
829
  {
830
830
  this.logger.debug(`<${content.executionId} (${id})> discarded`);
831
- this[countersSymbol].discarded++;
831
+ this[kCounters].discarded++;
832
832
  this.status = 'discarded';
833
833
  content.outbound = undefined;
834
834
 
@@ -886,7 +886,7 @@ proto._continueRunMessage = function continueRunMessage(routingKey, message) {
886
886
  };
887
887
 
888
888
  proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
889
- const executeMessage = this[executeMessageSymbol];
889
+ const executeMessage = this[kExecuteMessage];
890
890
  const content = (0, _messageHelper.cloneContent)({ ...executeMessage.content,
891
891
  ...message.content,
892
892
  executionId: executeMessage.content.executionId,
@@ -949,8 +949,8 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
949
949
 
950
950
  proto._ackRunExecuteMessage = function ackRunExecuteMessage() {
951
951
  if (this.environment.settings.step) return;
952
- const executeMessage = this[executeMessageSymbol];
953
- this[executeMessageSymbol] = null;
952
+ const executeMessage = this[kExecuteMessage];
953
+ this[kExecuteMessage] = null;
954
954
  executeMessage.ack();
955
955
  };
956
956
 
@@ -977,9 +977,9 @@ proto._doRunLeave = function doRunLeave(message, isDiscarded, onOutbound) {
977
977
  });
978
978
  }
979
979
 
980
- this.broker.publish('run', 'run.leave', (0, _messageHelper.cloneContent)(content, { ...(outbound.length ? {
980
+ this.broker.publish('run', 'run.leave', (0, _messageHelper.cloneContent)(content, { ...(outbound.length && {
981
981
  outbound
982
- } : undefined)
982
+ })
983
983
  }), {
984
984
  correlationId
985
985
  });
@@ -988,12 +988,12 @@ proto._doRunLeave = function doRunLeave(message, isDiscarded, onOutbound) {
988
988
  };
989
989
 
990
990
  proto._doOutbound = function doOutbound(fromMessage, isDiscarded, callback) {
991
- const outboundSequenceFlows = this[flowsSymbol].outboundSequenceFlows;
991
+ const outboundSequenceFlows = this[kFlows].outboundSequenceFlows;
992
992
  if (!outboundSequenceFlows.length) return callback(null, []);
993
993
  const fromContent = fromMessage.content;
994
994
  let discardSequence = fromContent.discardSequence;
995
995
 
996
- if (isDiscarded && !discardSequence && this[flagsSymbol].attachedTo && fromContent.inbound && fromContent.inbound[0]) {
996
+ if (isDiscarded && !discardSequence && this[kFlags].attachedTo && fromContent.inbound && fromContent.inbound[0]) {
997
997
  discardSequence = [fromContent.inbound[0].id];
998
998
  }
999
999
 
@@ -1031,9 +1031,9 @@ proto._doRunOutbound = function doRunOutbound(outboundList, content, discardSequ
1031
1031
  this.broker.publish('run', 'run.outbound.' + action, (0, _messageHelper.cloneContent)(content, {
1032
1032
  flow: { ...outboundFlow,
1033
1033
  sequenceId: (0, _shared.getUniqueId)(`${flowId}_${action}`),
1034
- ...(discardSequence ? {
1034
+ ...(discardSequence && {
1035
1035
  discardSequence: discardSequence.slice()
1036
- } : undefined)
1036
+ })
1037
1037
  }
1038
1038
  }));
1039
1039
  }
@@ -1043,7 +1043,7 @@ proto._doRunOutbound = function doRunOutbound(outboundList, content, discardSequ
1043
1043
 
1044
1044
  proto._onResumeMessage = function onResumeMessage(message) {
1045
1045
  message.ack();
1046
- const stateMessage = this[stateMessageSymbol];
1046
+ const stateMessage = this[kStateMessage];
1047
1047
  const {
1048
1048
  fields
1049
1049
  } = stateMessage;
@@ -1076,9 +1076,9 @@ proto._publishEvent = function publishEvent(state, content, properties = {}) {
1076
1076
  };
1077
1077
 
1078
1078
  proto._onStop = function onStop(message) {
1079
- const running = this[consumingSymbol];
1079
+ const running = this[kConsuming];
1080
1080
  this.stopped = true;
1081
- this[consumingSymbol] = false;
1081
+ this[kConsuming] = false;
1082
1082
  const broker = this.broker;
1083
1083
  broker.cancel('_activity-run');
1084
1084
  broker.cancel('_activity-api');
@@ -1094,11 +1094,11 @@ proto._onStop = function onStop(message) {
1094
1094
  };
1095
1095
 
1096
1096
  proto._consumeApi = function consumeApi() {
1097
- const executionId = this[execSymbol].executionId;
1097
+ const executionId = this[kExec].executionId;
1098
1098
  if (!executionId) return;
1099
1099
  const broker = this.broker;
1100
1100
  broker.cancel('_activity-api');
1101
- broker.subscribeTmp('api', `activity.*.${executionId}`, this[messageHandlersSymbol].onApiMessage, {
1101
+ broker.subscribeTmp('api', `activity.*.${executionId}`, this[kMessageHandlers].onApiMessage, {
1102
1102
  noAck: true,
1103
1103
  consumerTag: '_activity-api',
1104
1104
  priority: 100
@@ -1131,18 +1131,18 @@ proto._createMessage = function createMessage(override) {
1131
1131
  const result = { ...override,
1132
1132
  id: this.id,
1133
1133
  type: this.type,
1134
- ...(name ? {
1134
+ ...(name && {
1135
1135
  name
1136
- } : undefined),
1137
- ...(status ? {
1136
+ }),
1137
+ ...(status && {
1138
1138
  status
1139
- } : undefined),
1140
- ...(parent ? {
1139
+ }),
1140
+ ...(parent && {
1141
1141
  parent: (0, _messageHelper.cloneParent)(parent)
1142
- } : undefined)
1142
+ })
1143
1143
  };
1144
1144
 
1145
- for (const [flag, value] of Object.entries(this[flagsSymbol])) {
1145
+ for (const [flag, value] of Object.entries(this[kFlags])) {
1146
1146
  if (value) result[flag] = value;
1147
1147
  }
1148
1148
 
@@ -1150,7 +1150,7 @@ proto._createMessage = function createMessage(override) {
1150
1150
  };
1151
1151
 
1152
1152
  proto._getOutboundSequenceFlowById = function getOutboundSequenceFlowById(flowId) {
1153
- return this[flowsSymbol].outboundSequenceFlows.find(flow => flow.id === flowId);
1153
+ return this[kFlows].outboundSequenceFlows.find(flow => flow.id === flowId);
1154
1154
  };
1155
1155
 
1156
1156
  proto._resumeExtensions = function resumeExtensions(message, callback) {
@@ -1171,7 +1171,7 @@ proto._deactivateRunConsumers = function _deactivateRunConsumers() {
1171
1171
  broker.cancel('_activity-api');
1172
1172
  broker.cancel('_activity-run');
1173
1173
  broker.cancel('_activity-execution');
1174
- this[consumingSymbol] = false;
1174
+ this[kConsuming] = false;
1175
1175
  };
1176
1176
 
1177
1177
  function OutboundEvaluator(activity, outboundFlows) {
@@ -1316,9 +1316,9 @@ OutboundEvaluator.prototype.completed = function completed(err) {
1316
1316
 
1317
1317
  for (const flow of Object.values(result)) {
1318
1318
  evaluationResult.push({ ...flow,
1319
- ...(message !== undefined ? {
1319
+ ...(message !== undefined && {
1320
1320
  message
1321
- } : undefined)
1321
+ })
1322
1322
  });
1323
1323
  }
1324
1324
 
@@ -1329,8 +1329,8 @@ function formatFlowAction(flow, options) {
1329
1329
  return { ...options,
1330
1330
  id: flow.id,
1331
1331
  action: options.action,
1332
- ...(flow.isDefault ? {
1332
+ ...(flow.isDefault && {
1333
1333
  isDefault: true
1334
- } : undefined)
1334
+ })
1335
1335
  };
1336
1336
  }