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
@@ -2,7 +2,7 @@ import Activity from '../activity/Activity';
2
2
  import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
3
3
  import {cloneContent} from '../messageHelper';
4
4
 
5
- const executionSymbol = Symbol.for('execution');
5
+ const kExecution = Symbol.for('execution');
6
6
 
7
7
  export default function EndEvent(activityDef, context) {
8
8
  return new Activity(EndEventBehaviour, {...activityDef, isThrowing: true}, context);
@@ -12,11 +12,11 @@ export function EndEventBehaviour(activity) {
12
12
  this.id = activity.id;
13
13
  this.type = activity.type;
14
14
  this.broker = activity.broker;
15
- this[executionSymbol] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
15
+ this[kExecution] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
16
16
  }
17
17
 
18
18
  EndEventBehaviour.prototype.execute = function execute(executeMessage) {
19
- const execution = this[executionSymbol];
19
+ const execution = this[kExecution];
20
20
  if (execution) {
21
21
  return execution.execute(executeMessage);
22
22
  }
@@ -2,7 +2,7 @@ import Activity from '../activity/Activity';
2
2
  import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
3
3
  import {cloneContent} from '../messageHelper';
4
4
 
5
- const executionSymbol = Symbol.for('execution');
5
+ const kExecution = Symbol.for('execution');
6
6
 
7
7
  export default function IntermediateCatchEvent(activityDef, context) {
8
8
  return new Activity(IntermediateCatchEventBehaviour, activityDef, context);
@@ -12,11 +12,11 @@ export function IntermediateCatchEventBehaviour(activity) {
12
12
  this.id = activity.id;
13
13
  this.type = activity.type;
14
14
  this.broker = activity.broker;
15
- this[executionSymbol] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
15
+ this[kExecution] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
16
16
  }
17
17
 
18
18
  IntermediateCatchEventBehaviour.prototype.execute = function execute(executeMessage) {
19
- const execution = this[executionSymbol];
19
+ const execution = this[kExecution];
20
20
  if (execution) {
21
21
  return execution.execute(executeMessage);
22
22
  }
@@ -2,7 +2,7 @@ import Activity from '../activity/Activity';
2
2
  import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
3
3
  import {cloneContent} from '../messageHelper';
4
4
 
5
- const executionSymbol = Symbol.for('execution');
5
+ const kExecution = Symbol.for('execution');
6
6
 
7
7
  export default function IntermediateThrowEvent(activityDef, context) {
8
8
  return new Activity(IntermediateThrowEventBehaviour, {...activityDef, isThrowing: true}, context);
@@ -12,11 +12,11 @@ export function IntermediateThrowEventBehaviour(activity) {
12
12
  this.id = activity.id;
13
13
  this.type = activity.type;
14
14
  this.broker = activity.broker;
15
- this[executionSymbol] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
15
+ this[kExecution] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
16
16
  }
17
17
 
18
18
  IntermediateThrowEventBehaviour.prototype.execute = function execute(executeMessage) {
19
- const execution = this[executionSymbol];
19
+ const execution = this[kExecution];
20
20
  if (execution) {
21
21
  return execution.execute(executeMessage);
22
22
  }
@@ -2,8 +2,8 @@ import Activity from '../activity/Activity';
2
2
  import EventDefinitionExecution from '../eventDefinitions/EventDefinitionExecution';
3
3
  import {cloneContent} from '../messageHelper';
4
4
 
5
- const executeMessageSymbol = Symbol.for('executeMessage');
6
- const executionSymbol = Symbol.for('execution');
5
+ const kExecuteMessage = Symbol.for('executeMessage');
6
+ const kExecution = Symbol.for('execution');
7
7
 
8
8
  export default function StartEvent(activityDef, context) {
9
9
  return new Activity(StartEventBehaviour, activityDef, context);
@@ -14,20 +14,20 @@ export function StartEventBehaviour(activity) {
14
14
  this.type = activity.type;
15
15
  this.activity = activity;
16
16
  this.broker = activity.broker;
17
- this[executionSymbol] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
17
+ this[kExecution] = activity.eventDefinitions && new EventDefinitionExecution(activity, activity.eventDefinitions);
18
18
  }
19
19
 
20
20
  const proto = StartEventBehaviour.prototype;
21
21
 
22
22
  Object.defineProperty(proto, 'executionId', {
23
23
  get() {
24
- const message = this[executeMessageSymbol];
24
+ const message = this[kExecuteMessage];
25
25
  return message && message.content.executionId;
26
26
  },
27
27
  });
28
28
 
29
29
  proto.execute = function execute(executeMessage) {
30
- const execution = this[executionSymbol];
30
+ const execution = this[kExecution];
31
31
  if (execution) {
32
32
  return execution.execute(executeMessage);
33
33
  }
@@ -39,7 +39,7 @@ proto.execute = function execute(executeMessage) {
39
39
  }
40
40
 
41
41
  const executionId = content.executionId;
42
- this[executeMessageSymbol] = executeMessage;
42
+ this[kExecuteMessage] = executeMessage;
43
43
  broker.subscribeTmp('api', `activity.#.${executionId}`, (...args) => this._onApiMessage(...args), {
44
44
  noAck: true,
45
45
  consumerTag: `_api-${executionId}`,
@@ -59,7 +59,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
59
59
  return this._stop();
60
60
  case 'signal': {
61
61
  this._stop();
62
- const content = this[executeMessageSymbol].content;
62
+ const content = this[kExecuteMessage].content;
63
63
  return this.broker.publish('execution', 'execute.completed', cloneContent(content, {
64
64
  output: message.content.message,
65
65
  state: 'signal',
@@ -67,7 +67,7 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
67
67
  }
68
68
  case 'discard': {
69
69
  this._stop();
70
- const content = this[executeMessageSymbol].content;
70
+ const content = this[kExecuteMessage].content;
71
71
  return this.broker.publish('execution', 'execute.discard', cloneContent(content), {correlationId});
72
72
  }
73
73
  }
@@ -83,7 +83,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(routingKey, messag
83
83
  if (signalId !== this.id && signalExecutionId !== this.executionId) return;
84
84
 
85
85
  const {type, correlationId} = message.properties;
86
- const executeContent = this[executeMessageSymbol].content;
86
+ const executeContent = this[kExecuteMessage].content;
87
87
  this.broker.publish('event', 'activity.consumed', cloneContent(executeContent, {
88
88
  message: {
89
89
  ...content.message,
@@ -3,7 +3,7 @@ import {EventBroker} from '../EventBroker';
3
3
  import {FlowApi} from '../Api';
4
4
  import {getUniqueId} from '../shared';
5
5
 
6
- const countersSymbol = Symbol.for('counters');
6
+ const kCounters = Symbol.for('counters');
7
7
 
8
8
  export default function Association(associationDef, {environment}) {
9
9
  const {id, type = 'association', name, parent, targetId, sourceId, behaviour = {}} = associationDef;
@@ -19,7 +19,7 @@ export default function Association(associationDef, {environment}) {
19
19
  this.environment = environment;
20
20
  const logger = this.logger = environment.Logger(type.toLowerCase());
21
21
 
22
- this[countersSymbol] = {
22
+ this[kCounters] = {
23
23
  complete: 0,
24
24
  take: 0,
25
25
  discard: 0,
@@ -39,13 +39,13 @@ const proto = Association.prototype;
39
39
  Object.defineProperty(proto, 'counters', {
40
40
  enumerable: true,
41
41
  get() {
42
- return {...this[countersSymbol]};
42
+ return {...this[kCounters]};
43
43
  },
44
44
  });
45
45
 
46
46
  proto.take = function take(content = {}) {
47
47
  this.logger.debug(`<${this.id}> take target <${this.targetId}>`);
48
- ++this[countersSymbol].take;
48
+ ++this[kCounters].take;
49
49
 
50
50
  this._publishEvent('take', content);
51
51
 
@@ -54,7 +54,7 @@ proto.take = function take(content = {}) {
54
54
 
55
55
  proto.discard = function discard(content = {}) {
56
56
  this.logger.debug(`<${this.id}> discard target <${this.targetId}>`);
57
- ++this[countersSymbol].discard;
57
+ ++this[kCounters].discard;
58
58
 
59
59
  this._publishEvent('discard', content);
60
60
 
@@ -63,7 +63,7 @@ proto.discard = function discard(content = {}) {
63
63
 
64
64
  proto.complete = function complete(content = {}) {
65
65
  this.logger.debug(`<${this.id}> completed target <${this.targetId}>`);
66
- ++this[countersSymbol].complete;
66
+ ++this[kCounters].complete;
67
67
 
68
68
  this._publishEvent('complete', content);
69
69
 
@@ -78,7 +78,7 @@ proto.getState = function getState() {
78
78
  };
79
79
 
80
80
  proto.recover = function recover(state) {
81
- Object.assign(this[countersSymbol], state.counters);
81
+ Object.assign(this[kCounters], state.counters);
82
82
  this.broker.recover(state.broker);
83
83
  };
84
84
 
@@ -2,8 +2,8 @@ import {brokerSafeId} from '../shared';
2
2
  import {cloneParent} from '../messageHelper';
3
3
  import {MessageFlowBroker} from '../EventBroker';
4
4
 
5
- const countersSymbol = Symbol.for('counters');
6
- const sourceElementSymbol = Symbol.for('sourceElement');
5
+ const kCounters = Symbol.for('counters');
6
+ const kSourceElement = Symbol.for('sourceElement');
7
7
 
8
8
  export default function MessageFlow(flowDef, context) {
9
9
  const {id, type = 'messageflow', name, target, source, behaviour, parent} = flowDef;
@@ -18,7 +18,7 @@ export default function MessageFlow(flowDef, context) {
18
18
  this.environment = context.environment;
19
19
  this.context = context;
20
20
 
21
- this[countersSymbol] = {
21
+ this[kCounters] = {
22
22
  messages: 0,
23
23
  };
24
24
 
@@ -29,7 +29,7 @@ export default function MessageFlow(flowDef, context) {
29
29
  this.emit = emit;
30
30
  this.waitFor = waitFor;
31
31
 
32
- this[sourceElementSymbol] = context.getActivityById(source.id) || context.getProcessById(source.processId);
32
+ this[kSourceElement] = context.getActivityById(source.id) || context.getProcessById(source.processId);
33
33
  this.logger = context.environment.Logger(type.toLowerCase());
34
34
  }
35
35
 
@@ -38,7 +38,7 @@ const proto = MessageFlow.prototype;
38
38
  Object.defineProperty(proto, 'counters', {
39
39
  enumerable: true,
40
40
  get() {
41
- return {...this[countersSymbol]};
41
+ return {...this[kCounters]};
42
42
  },
43
43
  });
44
44
 
@@ -51,7 +51,7 @@ proto.getState = function getState() {
51
51
  };
52
52
 
53
53
  proto.recover = function recover(state) {
54
- Object.assign(this[countersSymbol], state.counters);
54
+ Object.assign(this[kCounters], state.counters);
55
55
  };
56
56
 
57
57
  proto.getApi = function getApi() {
@@ -59,21 +59,21 @@ proto.getApi = function getApi() {
59
59
  };
60
60
 
61
61
  proto.activate = function activate() {
62
- const sourceElement = this[sourceElementSymbol];
62
+ const sourceElement = this[kSourceElement];
63
63
  const safeId = brokerSafeId(this.id);
64
64
  sourceElement.on('message', this.deactivate.bind(this), {consumerTag: `_message-on-message-${safeId}`});
65
65
  sourceElement.on('end', this._onSourceEnd.bind(this), {consumerTag: `_message-on-end-${safeId}`});
66
66
  };
67
67
 
68
68
  proto.deactivate = function deactivate() {
69
- const sourceElement = this[sourceElementSymbol];
69
+ const sourceElement = this[kSourceElement];
70
70
  const safeId = brokerSafeId(this.id);
71
71
  sourceElement.broker.cancel(`_message-on-end-${safeId}`);
72
72
  sourceElement.broker.cancel(`_message-on-message-${safeId}`);
73
73
  };
74
74
 
75
75
  proto._onSourceEnd = function onSourceEnd({content}) {
76
- ++this[countersSymbol].messages;
76
+ ++this[kCounters].messages;
77
77
  const source = this.source;
78
78
  const target = this.target;
79
79
  this.logger.debug(`<${this.id}> sending message from <${source.processId}.${source.id}> to <${target.id ? `${target.processId}.${target.id}` : target.processId}>`);
@@ -4,7 +4,7 @@ import {getUniqueId} from '../shared';
4
4
  import {EventBroker} from '../EventBroker';
5
5
  import {FlowApi} from '../Api';
6
6
 
7
- const countersSymbol = Symbol.for('counters');
7
+ const kCounters = Symbol.for('counters');
8
8
 
9
9
  export default SequenceFlow;
10
10
 
@@ -23,7 +23,7 @@ function SequenceFlow(flowDef, {environment}) {
23
23
  this.environment = environment;
24
24
  const logger = this.logger = environment.Logger(type.toLowerCase());
25
25
 
26
- this[countersSymbol] = {
26
+ this[kCounters] = {
27
27
  looped: 0,
28
28
  take: 0,
29
29
  discard: 0,
@@ -45,7 +45,7 @@ const proto = SequenceFlow.prototype;
45
45
  Object.defineProperty(proto, 'counters', {
46
46
  enumerable: true,
47
47
  get() {
48
- return {...this[countersSymbol]};
48
+ return {...this[kCounters]};
49
49
  },
50
50
  });
51
51
 
@@ -55,7 +55,7 @@ proto.take = function take(content = {}) {
55
55
  const {sequenceId} = content;
56
56
 
57
57
  this.logger.debug(`<${sequenceId} (${this.id})> take, target <${this.targetId}>`);
58
- ++this[countersSymbol].take;
58
+ ++this[kCounters].take;
59
59
 
60
60
  this._publishEvent('take', content);
61
61
 
@@ -66,7 +66,7 @@ proto.discard = function discard(content = {}) {
66
66
  const {sequenceId = getUniqueId(this.id)} = content;
67
67
  const discardSequence = content.discardSequence = (content.discardSequence || []).slice();
68
68
  if (discardSequence.indexOf(this.targetId) > -1) {
69
- ++this[countersSymbol].looped;
69
+ ++this[kCounters].looped;
70
70
  this.logger.debug(`<${this.id}> discard loop detected <${this.sourceId}> -> <${this.targetId}>. Stop.`);
71
71
  return this._publishEvent('looped', content);
72
72
  }
@@ -74,7 +74,7 @@ proto.discard = function discard(content = {}) {
74
74
  discardSequence.push(this.sourceId);
75
75
 
76
76
  this.logger.debug(`<${sequenceId} (${this.id})> discard, target <${this.targetId}>`);
77
- ++this[countersSymbol].discard;
77
+ ++this[kCounters].discard;
78
78
  this._publishEvent('discard', content);
79
79
  };
80
80
 
@@ -86,7 +86,7 @@ proto.getState = function getState() {
86
86
  };
87
87
 
88
88
  proto.recover = function recover(state) {
89
- Object.assign(this[countersSymbol], state.counters);
89
+ Object.assign(this[kCounters], state.counters);
90
90
  this.broker.recover(state.broker);
91
91
  };
92
92
 
@@ -1,8 +1,8 @@
1
1
  import Activity from '../activity/Activity';
2
2
  import {cloneContent} from '../messageHelper';
3
3
 
4
- const completedSymbol = Symbol.for('completed');
5
- const targetsSymbol = Symbol.for('targets');
4
+ const kCompleted = Symbol.for('completed');
5
+ const kTargets = Symbol.for('targets');
6
6
 
7
7
  export default function EventBasedGateway(activityDef, context) {
8
8
  return new Activity(EventBasedGatewayBehaviour, activityDef, context);
@@ -14,27 +14,27 @@ export function EventBasedGatewayBehaviour(activity, context) {
14
14
  this.activity = activity;
15
15
  this.broker = activity.broker;
16
16
  this.context = context;
17
- this[targetsSymbol] = activity.outbound.map((flow) => context.getActivityById(flow.targetId));
17
+ this[kTargets] = activity.outbound.map((flow) => context.getActivityById(flow.targetId));
18
18
  }
19
19
 
20
20
  EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage) {
21
21
  const executeContent = executeMessage.content;
22
22
  const {executionId, outbound = [], outboundTaken} = executeContent;
23
23
 
24
- const targets = this[targetsSymbol];
25
- this[completedSymbol] = false;
24
+ const targets = this[kTargets];
25
+ this[kCompleted] = false;
26
26
  if (!targets.length) return this._complete(executeContent);
27
27
 
28
28
  for (const flow of this.activity.outbound) {
29
29
  outbound.push({id: flow.id, action: 'take'});
30
30
  }
31
31
 
32
- if (!this[completedSymbol] && outboundTaken) return;
32
+ if (!this[kCompleted] && outboundTaken) return;
33
33
 
34
34
  const targetConsumerTag = `_gateway-listener-${this.id}`;
35
35
 
36
36
  const onTargetCompleted = this._onTargetCompleted.bind(this, executeMessage);
37
- for (const target of this[targetsSymbol]) {
37
+ for (const target of this[kTargets]) {
38
38
  target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, {consumerTag: targetConsumerTag});
39
39
  }
40
40
 
@@ -44,7 +44,7 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
44
44
  consumerTag: '_api-stop-execution',
45
45
  });
46
46
 
47
- this[completedSymbol] = false;
47
+ this[kCompleted] = false;
48
48
  if (!executeMessage.fields.redelivered) return broker.publish('execution', 'execute.outbound.take', cloneContent(executeContent, {outboundTaken: true}));
49
49
  };
50
50
 
@@ -55,7 +55,7 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
55
55
  this.activity.logger.debug(`<${executionId} (${this.id})> <${targetExecutionId}> completed run, discarding the rest`);
56
56
 
57
57
  this._stop();
58
- for (const target of this[targetsSymbol]) {
58
+ for (const target of this[kTargets]) {
59
59
  if (target === owner) continue;
60
60
  target.discard();
61
61
  }
@@ -72,13 +72,13 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
72
72
  };
73
73
 
74
74
  EventBasedGatewayBehaviour.prototype._complete = function complete(completedContent) {
75
- this[completedSymbol] = true;
75
+ this[kCompleted] = true;
76
76
  this.broker.publish('execution', 'execute.completed', cloneContent(completedContent));
77
77
  };
78
78
 
79
79
  EventBasedGatewayBehaviour.prototype._stop = function stop() {
80
80
  const targetConsumerTag = `_gateway-listener-${this.id}`;
81
- for (const target of this[targetsSymbol]) target.broker.cancel(targetConsumerTag);
81
+ for (const target of this[kTargets]) target.broker.cancel(targetConsumerTag);
82
82
  this.broker.cancel('_api-stop-execution');
83
83
  };
84
84
 
package/src/io/BpmnIO.js CHANGED
@@ -2,7 +2,11 @@ export default function BpmnIO(activity, context) {
2
2
  this.activity = activity;
3
3
  this.context = context;
4
4
 
5
- const {ioSpecification: ioSpecificationDef, properties: propertiesDef} = activity.behaviour;
5
+ const {
6
+ ioSpecification: ioSpecificationDef,
7
+ properties: propertiesDef,
8
+ } = activity.behaviour;
9
+
6
10
  this.specification = ioSpecificationDef && new ioSpecificationDef.Behaviour(activity, ioSpecificationDef, context);
7
11
  this.properties = propertiesDef && new propertiesDef.Behaviour(activity, propertiesDef, context);
8
12
  }
@@ -1,7 +1,7 @@
1
1
  import getPropertyValue from '../getPropertyValue';
2
2
  import {brokerSafeId} from '../shared';
3
3
 
4
- const consumingSymbol = Symbol.for('consuming');
4
+ const kConsuming = Symbol.for('consuming');
5
5
 
6
6
  export default function IoSpecification(activity, ioSpecificationDef, context) {
7
7
  const {id, type = 'iospecification', behaviour = {}} = ioSpecificationDef;
@@ -16,12 +16,12 @@ export default function IoSpecification(activity, ioSpecificationDef, context) {
16
16
  const proto = IoSpecification.prototype;
17
17
 
18
18
  proto.activate = function activate() {
19
- if (this[consumingSymbol]) return;
20
- this[consumingSymbol] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
19
+ if (this[kConsuming]) return;
20
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
21
21
  };
22
22
 
23
23
  proto.deactivate = function deactivate() {
24
- if (this[consumingSymbol]) this[consumingSymbol] = this[consumingSymbol].cancel();
24
+ if (this[kConsuming]) this[kConsuming] = this[kConsuming].cancel();
25
25
  };
26
26
 
27
27
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
@@ -1,13 +1,13 @@
1
1
  import getPropertyValue from '../getPropertyValue';
2
2
 
3
- const propertiesSymbol = Symbol.for('properties');
4
- const consumingSymbol = Symbol.for('consuming');
3
+ const kProperties = Symbol.for('properties');
4
+ const kConsuming = Symbol.for('consuming');
5
5
 
6
6
  export default function Properties(activity, propertiesDef, context) {
7
7
  this.activity = activity;
8
8
  this.broker = activity.broker;
9
9
 
10
- const props = this[propertiesSymbol] = {
10
+ const props = this[kProperties] = {
11
11
  properties: [],
12
12
  dataInputObjects: [],
13
13
  dataOutputObjects: [],
@@ -61,17 +61,17 @@ export default function Properties(activity, propertiesDef, context) {
61
61
  const proto = Properties.prototype;
62
62
 
63
63
  proto.activate = function activate(message) {
64
- if (this[consumingSymbol]) return;
64
+ if (this[kConsuming]) return;
65
65
 
66
66
  if (message.fields.redelivered && message.content.properties) {
67
67
  this._onActivityEvent('activity.extension.resume', message);
68
68
  }
69
69
 
70
- this[consumingSymbol] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
70
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
71
71
  };
72
72
 
73
73
  proto.deactivate = function deactivate() {
74
- if (this[consumingSymbol]) this[consumingSymbol] = this[consumingSymbol].cancel();
74
+ if (this[kConsuming]) this[kConsuming] = this[kConsuming].cancel();
75
75
  };
76
76
 
77
77
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
@@ -91,7 +91,7 @@ proto._onActivityEvent = function onActivityEvent(routingKey, message) {
91
91
  proto._formatOnEnter = function formatOnEnter(message) {
92
92
  const startRoutingKey = 'run.enter.bpmn-properties';
93
93
 
94
- const dataInputObjects = this[propertiesSymbol].dataInputObjects;
94
+ const dataInputObjects = this[kProperties].dataInputObjects;
95
95
  const broker = this.broker;
96
96
  if (!dataInputObjects.length) {
97
97
  return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
@@ -118,7 +118,7 @@ proto._formatOnComplete = function formatOnComplete(message) {
118
118
  const messageOutput = getPropertyValue(message, 'content.output.properties') || {};
119
119
  const outputProperties = this._getProperties(message, messageOutput);
120
120
 
121
- const dataOutputObjects = this[propertiesSymbol].dataOutputObjects;
121
+ const dataOutputObjects = this[kProperties].dataOutputObjects;
122
122
  const broker = this.broker;
123
123
  if (!dataOutputObjects.length) {
124
124
  return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
@@ -146,7 +146,7 @@ proto._getProperties = function getProperties(message, values) {
146
146
  response = {...message.content.properties};
147
147
  }
148
148
 
149
- for (const {id, type, name} of this[propertiesSymbol].properties) {
149
+ for (const {id, type, name} of this[kProperties].properties) {
150
150
  if (!(id in response)) {
151
151
  response[id] = {id, type, name};
152
152
  }