bpmn-elements 17.2.2 → 18.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 (155) hide show
  1. package/README.md +3 -1
  2. package/dist/Api.js +83 -0
  3. package/dist/Context.js +228 -22
  4. package/dist/Environment.js +111 -31
  5. package/dist/EventBroker.js +57 -1
  6. package/dist/Expressions.js +3 -4
  7. package/dist/MessageFormatter.js +29 -16
  8. package/dist/Timers.js +13 -9
  9. package/dist/Tracker.js +1 -0
  10. package/dist/activity/Activity.js +458 -254
  11. package/dist/activity/ActivityExecution.js +113 -40
  12. package/dist/activity/Dummy.js +6 -1
  13. package/dist/activity/Escalation.js +36 -24
  14. package/dist/activity/ExecutionScope.js +1 -1
  15. package/dist/activity/Message.js +36 -24
  16. package/dist/activity/Signal.js +36 -24
  17. package/dist/activity/outbound-evaluator.js +1 -1
  18. package/dist/condition.js +12 -6
  19. package/dist/constants.js +21 -0
  20. package/dist/definition/Definition.js +182 -64
  21. package/dist/definition/DefinitionExecution.js +195 -82
  22. package/dist/error/BpmnError.js +12 -1
  23. package/dist/error/Errors.js +50 -9
  24. package/dist/eventDefinitions/CancelEventDefinition.js +29 -11
  25. package/dist/eventDefinitions/CompensateEventDefinition.js +51 -31
  26. package/dist/eventDefinitions/ConditionalEventDefinition.js +21 -9
  27. package/dist/eventDefinitions/ErrorEventDefinition.js +46 -30
  28. package/dist/eventDefinitions/EscalationEventDefinition.js +44 -27
  29. package/dist/eventDefinitions/EventDefinitionExecution.js +30 -23
  30. package/dist/eventDefinitions/LinkEventDefinition.js +45 -120
  31. package/dist/eventDefinitions/MessageEventDefinition.js +44 -29
  32. package/dist/eventDefinitions/SignalEventDefinition.js +46 -31
  33. package/dist/eventDefinitions/TerminateEventDefinition.js +10 -1
  34. package/dist/eventDefinitions/TimerEventDefinition.js +57 -37
  35. package/dist/eventDefinitions/index.js +20 -21
  36. package/dist/events/BoundaryEvent.js +52 -40
  37. package/dist/events/EndEvent.js +22 -8
  38. package/dist/events/IntermediateCatchEvent.js +26 -8
  39. package/dist/events/IntermediateThrowEvent.js +24 -9
  40. package/dist/events/StartEvent.js +30 -14
  41. package/dist/events/index.js +10 -11
  42. package/dist/flows/Association.js +50 -7
  43. package/dist/flows/MessageFlow.js +49 -10
  44. package/dist/flows/SequenceFlow.js +93 -22
  45. package/dist/flows/index.js +6 -7
  46. package/dist/gateways/EventBasedGateway.js +29 -15
  47. package/dist/gateways/ExclusiveGateway.js +20 -5
  48. package/dist/gateways/InclusiveGateway.js +21 -5
  49. package/dist/gateways/ParallelGateway.js +253 -15
  50. package/dist/gateways/index.js +8 -9
  51. package/dist/getPropertyValue.js +2 -2
  52. package/dist/index.js +42 -43
  53. package/dist/io/BpmnIO.js +15 -1
  54. package/dist/io/EnvironmentDataObject.js +29 -1
  55. package/dist/io/EnvironmentDataStore.js +24 -1
  56. package/dist/io/EnvironmentDataStoreReference.js +24 -1
  57. package/dist/io/InputOutputSpecification.js +21 -11
  58. package/dist/io/Properties.js +28 -17
  59. package/dist/messageHelper.js +41 -4
  60. package/dist/process/Lane.js +15 -4
  61. package/dist/process/Process.js +174 -76
  62. package/dist/process/ProcessExecution.js +362 -177
  63. package/dist/shared.js +2 -0
  64. package/dist/tasks/CallActivity.js +19 -4
  65. package/dist/tasks/LoopCharacteristics.js +94 -9
  66. package/dist/tasks/ReceiveTask.js +36 -21
  67. package/dist/tasks/ScriptTask.js +22 -6
  68. package/dist/tasks/ServiceImplementation.js +7 -4
  69. package/dist/tasks/ServiceTask.js +19 -4
  70. package/dist/tasks/SignalTask.js +19 -4
  71. package/dist/tasks/StandardLoopCharacteristics.js +8 -4
  72. package/dist/tasks/SubProcess.js +44 -29
  73. package/dist/tasks/Task.js +19 -4
  74. package/dist/tasks/Transaction.js +8 -4
  75. package/dist/tasks/index.js +16 -18
  76. package/package.json +31 -13
  77. package/src/Api.js +70 -0
  78. package/src/Context.js +200 -19
  79. package/src/Environment.js +99 -30
  80. package/src/EventBroker.js +46 -1
  81. package/src/Expressions.js +2 -3
  82. package/src/MessageFormatter.js +24 -16
  83. package/src/Timers.js +12 -9
  84. package/src/Tracker.js +1 -0
  85. package/src/activity/Activity.js +388 -231
  86. package/src/activity/ActivityExecution.js +93 -42
  87. package/src/activity/Dummy.js +6 -1
  88. package/src/activity/Escalation.js +25 -18
  89. package/src/activity/ExecutionScope.js +1 -1
  90. package/src/activity/Message.js +25 -18
  91. package/src/activity/Signal.js +25 -18
  92. package/src/activity/outbound-evaluator.js +1 -1
  93. package/src/condition.js +11 -5
  94. package/src/constants.js +15 -0
  95. package/src/definition/Definition.js +157 -62
  96. package/src/definition/DefinitionExecution.js +161 -83
  97. package/src/error/BpmnError.js +11 -1
  98. package/src/error/Errors.js +44 -5
  99. package/src/eventDefinitions/CancelEventDefinition.js +27 -13
  100. package/src/eventDefinitions/CompensateEventDefinition.js +48 -32
  101. package/src/eventDefinitions/ConditionalEventDefinition.js +20 -10
  102. package/src/eventDefinitions/ErrorEventDefinition.js +44 -33
  103. package/src/eventDefinitions/EscalationEventDefinition.js +39 -26
  104. package/src/eventDefinitions/EventDefinitionExecution.js +30 -24
  105. package/src/eventDefinitions/LinkEventDefinition.js +34 -120
  106. package/src/eventDefinitions/MessageEventDefinition.js +42 -31
  107. package/src/eventDefinitions/SignalEventDefinition.js +43 -32
  108. package/src/eventDefinitions/TerminateEventDefinition.js +9 -1
  109. package/src/eventDefinitions/TimerEventDefinition.js +53 -35
  110. package/src/eventDefinitions/index.js +10 -23
  111. package/src/events/BoundaryEvent.js +50 -39
  112. package/src/events/EndEvent.js +19 -7
  113. package/src/events/IntermediateCatchEvent.js +24 -8
  114. package/src/events/IntermediateThrowEvent.js +24 -8
  115. package/src/events/StartEvent.js +25 -14
  116. package/src/events/index.js +5 -18
  117. package/src/flows/Association.js +43 -9
  118. package/src/flows/MessageFlow.js +41 -10
  119. package/src/flows/SequenceFlow.js +82 -19
  120. package/src/flows/index.js +3 -4
  121. package/src/gateways/EventBasedGateway.js +27 -15
  122. package/src/gateways/ExclusiveGateway.js +16 -3
  123. package/src/gateways/InclusiveGateway.js +16 -3
  124. package/src/gateways/ParallelGateway.js +301 -10
  125. package/src/gateways/index.js +4 -4
  126. package/src/getPropertyValue.js +2 -2
  127. package/src/index.js +19 -19
  128. package/src/io/BpmnIO.js +13 -1
  129. package/src/io/EnvironmentDataObject.js +26 -1
  130. package/src/io/EnvironmentDataStore.js +22 -1
  131. package/src/io/EnvironmentDataStoreReference.js +22 -1
  132. package/src/io/InputOutputSpecification.js +17 -8
  133. package/src/io/Properties.js +23 -13
  134. package/src/messageHelper.js +36 -4
  135. package/src/process/Lane.js +14 -4
  136. package/src/process/Process.js +154 -72
  137. package/src/process/ProcessExecution.js +326 -175
  138. package/src/shared.js +1 -0
  139. package/src/tasks/CallActivity.js +16 -2
  140. package/src/tasks/LoopCharacteristics.js +77 -11
  141. package/src/tasks/ReceiveTask.js +33 -22
  142. package/src/tasks/ScriptTask.js +17 -3
  143. package/src/tasks/ServiceImplementation.js +6 -3
  144. package/src/tasks/ServiceTask.js +16 -2
  145. package/src/tasks/SignalTask.js +16 -2
  146. package/src/tasks/StandardLoopCharacteristics.js +7 -3
  147. package/src/tasks/SubProcess.js +37 -23
  148. package/src/tasks/Task.js +16 -2
  149. package/src/tasks/Transaction.js +7 -3
  150. package/src/tasks/index.js +8 -9
  151. package/types/bundle-errors.d.ts +1 -0
  152. package/types/bundle.d.ts +97 -0
  153. package/types/index.d.ts +2614 -84
  154. package/types/interfaces.d.ts +636 -0
  155. package/types/types.d.ts +0 -765
@@ -3,14 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.SequenceFlow = SequenceFlow;
7
7
  var _messageHelper = require("../messageHelper.js");
8
8
  var _shared = require("../shared.js");
9
9
  var _EventBroker = require("../EventBroker.js");
10
10
  var _Api = require("../Api.js");
11
11
  var _condition = require("../condition.js");
12
- const kCounters = Symbol.for('counters');
13
- var _default = exports.default = SequenceFlow;
12
+ var _constants = require("../constants.js");
13
+ /**
14
+ * Sequence flow connecting two activities. Owns its broker and publishes take/discard/looped
15
+ * events; activities subscribe to drive their inbound queue.
16
+ * @param {import('moddle-context-serializer').SequenceFlow} flowDef
17
+ * @param {import('#types').ContextInstance} context
18
+ */
14
19
  function SequenceFlow(flowDef, {
15
20
  environment
16
21
  }) {
@@ -28,6 +33,7 @@ function SequenceFlow(flowDef, {
28
33
  this.type = type;
29
34
  this.name = name;
30
35
  this.parent = (0, _messageHelper.cloneParent)(parent);
36
+ /** @type {Record<string, any>} */
31
37
  this.behaviour = behaviour;
32
38
  this.sourceId = sourceId;
33
39
  this.targetId = targetId;
@@ -35,7 +41,7 @@ function SequenceFlow(flowDef, {
35
41
  this.isSequenceFlow = true;
36
42
  this.environment = environment;
37
43
  const logger = this.logger = environment.Logger(type.toLowerCase());
38
- this[kCounters] = {
44
+ this[_constants.K_COUNTERS] = {
39
45
  looped: 0,
40
46
  take: 0,
41
47
  discard: 0
@@ -60,32 +66,51 @@ function SequenceFlow(flowDef, {
60
66
  logger.debug(`<${id}> init, <${sourceId}> -> <${targetId}>`);
61
67
  }
62
68
  Object.defineProperty(SequenceFlow.prototype, 'counters', {
69
+ /** @returns {{ take: number, discard: number, looped: number }} */
63
70
  get() {
64
71
  return {
65
- ...this[kCounters]
72
+ ...this[_constants.K_COUNTERS]
66
73
  };
67
74
  }
68
75
  });
76
+
77
+ /**
78
+ * Take the flow and publish flow.take.
79
+ * @param {Record<string, any>} [content]
80
+ */
69
81
  SequenceFlow.prototype.take = function take(content) {
70
82
  const sequenceId = content?.sequenceId;
71
83
  this.logger.debug(`<${sequenceId} (${this.id})> take, target <${this.targetId}>`);
72
- ++this[kCounters].take;
84
+ ++this[_constants.K_COUNTERS].take;
73
85
  this._publishEvent('take', content);
74
86
  return true;
75
87
  };
88
+
89
+ /**
90
+ * Discard the flow and publish flow.discard.
91
+ *
92
+ * @deprecated The execution runtime no longer discards sequence flows, so this is a no-op during a run. It will be removed in a future version.
93
+ * @param {Record<string, any>} [content]
94
+ */
76
95
  SequenceFlow.prototype.discard = function discard(content = {}) {
77
96
  const sequenceId = content?.sequenceId ?? (0, _shared.getUniqueId)(this.id);
78
- const discardSequence = content.discardSequence = (content.discardSequence || []).slice();
97
+ const discardSequence = content.discardSequence = content.discardSequence?.slice() || [];
79
98
  if (discardSequence.indexOf(this.targetId) > -1) {
80
- ++this[kCounters].looped;
99
+ ++this[_constants.K_COUNTERS].looped;
81
100
  this.logger.debug(`<${this.id}> discard loop detected <${this.sourceId}> -> <${this.targetId}>. Stop.`);
82
101
  return this._publishEvent('looped', content);
83
102
  }
84
103
  discardSequence.push(this.sourceId);
85
104
  this.logger.debug(`<${sequenceId} (${this.id})> discard, target <${this.targetId}>`);
86
- ++this[kCounters].discard;
105
+ ++this[_constants.K_COUNTERS].discard;
87
106
  this._publishEvent('discard', content);
88
107
  };
108
+
109
+ /**
110
+ * Snapshot flow state. Returns undefined when the broker has no state and `disableTrackState`
111
+ * is set.
112
+ * @returns {import('#types').SequenceFlowState | undefined}
113
+ */
89
114
  SequenceFlow.prototype.getState = function getState() {
90
115
  const brokerState = this.broker.getState(true);
91
116
  if (!brokerState && this.environment.settings.disableTrackState) return;
@@ -96,42 +121,74 @@ SequenceFlow.prototype.getState = function getState() {
96
121
  broker: brokerState
97
122
  };
98
123
  };
124
+
125
+ /**
126
+ * Restore flow state captured by getState.
127
+ * @param {import('#types').SequenceFlowState} state
128
+ */
99
129
  SequenceFlow.prototype.recover = function recover(state) {
100
- Object.assign(this[kCounters], state.counters);
130
+ Object.assign(this[_constants.K_COUNTERS], state.counters);
101
131
  this.broker.recover(state.broker);
102
132
  };
133
+
134
+ /**
135
+ * Resolve a Flow Api wrapper.
136
+ * @param {import('#types').ElementBrokerMessage} [message]
137
+ * @returns {import('#types').IApi<this>}
138
+ */
103
139
  SequenceFlow.prototype.getApi = function getApi(message) {
104
140
  return (0, _Api.FlowApi)(this.broker, message || {
105
141
  content: this.createMessage()
106
142
  });
107
143
  };
144
+
145
+ /**
146
+ * Stop the flow's broker.
147
+ */
108
148
  SequenceFlow.prototype.stop = function stop() {
109
149
  this.broker.stop();
110
150
  };
151
+
152
+ /**
153
+ * Walk the flow as part of a process shake. Detects loops and publishes flow.shake.loop
154
+ * when the target was already visited, otherwise flow.shake.
155
+ * @param {import('#types').ElementBrokerMessage} message
156
+ */
111
157
  SequenceFlow.prototype.shake = function shake(message) {
112
158
  const content = (0, _messageHelper.cloneContent)(message.content);
113
159
  content.sequence = content.sequence || [];
114
- content.sequence.push({
160
+ const info = {
115
161
  id: this.id,
116
162
  type: this.type,
117
163
  isSequenceFlow: true,
164
+ sourceId: this.sourceId,
118
165
  targetId: this.targetId
119
- });
120
- if (content.id === this.targetId) return this.broker.publish('event', 'flow.shake.loop', content, {
121
- persistent: false,
122
- type: 'shake'
123
- });
124
- for (const s of message.content.sequence || []) {
125
- if (s.id === this.id) return this.broker.publish('event', 'flow.shake.loop', content, {
166
+ };
167
+ if (content.id === this.targetId) {
168
+ content.sequence.push(info);
169
+ return this.broker.publish('event', 'flow.shake.loop', content, {
170
+ persistent: false,
171
+ type: 'shake'
172
+ });
173
+ } else if (content.sequence?.find(f => f.id === this.id)) {
174
+ return this.broker.publish('event', 'flow.shake.loop', content, {
175
+ persistent: false,
176
+ type: 'shake'
177
+ });
178
+ } else {
179
+ content.sequence.push(info);
180
+ this.broker.publish('event', 'flow.shake', content, {
126
181
  persistent: false,
127
182
  type: 'shake'
128
183
  });
129
184
  }
130
- this.broker.publish('event', 'flow.shake', content, {
131
- persistent: false,
132
- type: 'shake'
133
- });
134
185
  };
186
+
187
+ /**
188
+ * Resolve the flow's condition (script or expression). Returns null when no condition is set.
189
+ * Emits a fatal error when the script language is missing or unsupported.
190
+ * @returns {import('#types').ICondition | null}
191
+ */
135
192
  SequenceFlow.prototype.getCondition = function getCondition() {
136
193
  const conditionExpression = this.behaviour.conditionExpression;
137
194
  if (!conditionExpression) return null;
@@ -148,6 +205,12 @@ SequenceFlow.prototype.getCondition = function getCondition() {
148
205
  }
149
206
  return new _condition.ExpressionCondition(this, conditionExpression.body);
150
207
  };
208
+
209
+ /**
210
+ * Build a flow event message body, optionally merging override content.
211
+ * @param {Record<string, any>} [override]
212
+ * @returns {import('#types').ElementMessageContent}
213
+ */
151
214
  SequenceFlow.prototype.createMessage = function createMessage(override) {
152
215
  return {
153
216
  ...override,
@@ -161,6 +224,12 @@ SequenceFlow.prototype.createMessage = function createMessage(override) {
161
224
  parent: (0, _messageHelper.cloneParent)(this.parent)
162
225
  };
163
226
  };
227
+
228
+ /**
229
+ * Evaluate the flow's condition for the source activity message. Default flows are always taken.
230
+ * @param {import('#types').ElementBrokerMessage} fromMessage Source activity message
231
+ * @param {(err: Error | null, result?: boolean | unknown) => void} callback Callback with truthy result if flow should be taken
232
+ */
164
233
  SequenceFlow.prototype.evaluate = function evaluate(fromMessage, callback) {
165
234
  if (this.isDefault) {
166
235
  return callback(null, true);
@@ -171,6 +240,8 @@ SequenceFlow.prototype.evaluate = function evaluate(fromMessage, callback) {
171
240
  }
172
241
  flowCondition.execute(fromMessage, callback);
173
242
  };
243
+
244
+ /** @internal */
174
245
  SequenceFlow.prototype._publishEvent = function publishEvent(action, content) {
175
246
  const eventContent = this.createMessage({
176
247
  action,
@@ -6,22 +6,21 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Association", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Association.default;
9
+ return _Association.Association;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "MessageFlow", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _MessageFlow.default;
15
+ return _MessageFlow.MessageFlow;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "SequenceFlow", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _SequenceFlow.default;
21
+ return _SequenceFlow.SequenceFlow;
22
22
  }
23
23
  });
24
- var _Association = _interopRequireDefault(require("./Association.js"));
25
- var _MessageFlow = _interopRequireDefault(require("./MessageFlow.js"));
26
- var _SequenceFlow = _interopRequireDefault(require("./SequenceFlow.js"));
27
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
+ var _Association = require("./Association.js");
25
+ var _MessageFlow = require("./MessageFlow.js");
26
+ var _SequenceFlow = require("./SequenceFlow.js");
@@ -3,24 +3,38 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.EventBasedGateway = EventBasedGateway;
6
7
  exports.EventBasedGatewayBehaviour = EventBasedGatewayBehaviour;
7
- exports.default = EventBasedGateway;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
8
+ var _Activity = require("../activity/Activity.js");
9
9
  var _messageHelper = require("../messageHelper.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const kCompleted = Symbol.for('completed');
12
- const kTargets = Symbol.for('targets');
10
+ var _constants = require("../constants.js");
11
+ /**
12
+ * Event based gateway
13
+ * @param {import('moddle-context-serializer').Activity} activityDef
14
+ * @param {import('#types').ContextInstance} context
15
+ */
13
16
  function EventBasedGateway(activityDef, context) {
14
- return new _Activity.default(EventBasedGatewayBehaviour, activityDef, context);
17
+ return new _Activity.Activity(EventBasedGatewayBehaviour, activityDef, context);
15
18
  }
19
+
20
+ /**
21
+ * Event based gateway behaviour
22
+ * @param {import('#types').Activity} activity
23
+ * @param {import('#types').ContextInstance} context
24
+ */
16
25
  function EventBasedGatewayBehaviour(activity, context) {
17
26
  this.id = activity.id;
18
27
  this.type = activity.type;
19
28
  this.activity = activity;
20
29
  this.broker = activity.broker;
21
30
  this.context = context;
22
- this[kTargets] = new Set(activity.outbound.map(flow => context.getActivityById(flow.targetId)));
31
+ this[_constants.K_TARGETS] = new Set(activity.outbound.map(flow => context.getActivityById(flow.targetId)));
23
32
  }
33
+
34
+ /**
35
+ * @param {import('#types').ElementBrokerMessage} executeMessage
36
+ * @returns {void}
37
+ */
24
38
  EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage) {
25
39
  const executeContent = executeMessage.content;
26
40
  const {
@@ -28,8 +42,8 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
28
42
  outbound = [],
29
43
  outboundTaken
30
44
  } = executeContent;
31
- const targets = this[kTargets];
32
- this[kCompleted] = false;
45
+ const targets = this[_constants.K_TARGETS];
46
+ this[_constants.K_COMPLETED] = false;
33
47
  if (!targets.size) return this._complete(executeContent);
34
48
  for (const flow of this.activity.outbound) {
35
49
  outbound.push({
@@ -37,10 +51,10 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
37
51
  action: 'take'
38
52
  });
39
53
  }
40
- if (!this[kCompleted] && outboundTaken) return;
54
+ if (!this[_constants.K_COMPLETED] && outboundTaken) return;
41
55
  const targetConsumerTag = `_gateway-listener-${this.id}`;
42
56
  const onTargetCompleted = this._onTargetCompleted.bind(this, executeMessage);
43
- for (const target of this[kTargets]) {
57
+ for (const target of this[_constants.K_TARGETS]) {
44
58
  target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, {
45
59
  consumerTag: targetConsumerTag
46
60
  });
@@ -49,7 +63,7 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
49
63
  broker.subscribeOnce('api', `activity.stop.${executionId}`, () => this._stop(), {
50
64
  consumerTag: '_api-stop-execution'
51
65
  });
52
- this[kCompleted] = false;
66
+ this[_constants.K_COMPLETED] = false;
53
67
  if (!executeMessage.fields.redelivered) {
54
68
  return broker.publish('execution', 'execute.outbound.take', (0, _messageHelper.cloneContent)(executeContent, {
55
69
  outboundTaken: true
@@ -65,7 +79,7 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
65
79
  const executionId = executeContent.executionId;
66
80
  this.activity.logger.debug(`<${executionId} (${this.id})> <${targetExecutionId}> completed run, discarding the rest`);
67
81
  this._stop();
68
- for (const target of this[kTargets]) {
82
+ for (const target of this[_constants.K_TARGETS]) {
69
83
  if (target === owner) continue;
70
84
  target.discard();
71
85
  }
@@ -79,11 +93,11 @@ EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompl
79
93
  this._complete(completedContent);
80
94
  };
81
95
  EventBasedGatewayBehaviour.prototype._complete = function complete(completedContent) {
82
- this[kCompleted] = true;
96
+ this[_constants.K_COMPLETED] = true;
83
97
  this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(completedContent));
84
98
  };
85
99
  EventBasedGatewayBehaviour.prototype._stop = function stop() {
86
100
  const targetConsumerTag = `_gateway-listener-${this.id}`;
87
- for (const target of this[kTargets]) target.broker.cancel(targetConsumerTag);
101
+ for (const target of this[_constants.K_TARGETS]) target.broker.cancel(targetConsumerTag);
88
102
  this.broker.cancel('_api-stop-execution');
89
103
  };
@@ -3,14 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.ExclusiveGateway = ExclusiveGateway;
6
7
  exports.ExclusiveGatewayBehaviour = ExclusiveGatewayBehaviour;
7
- exports.default = ExclusiveGateway;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
8
+ var _Activity = require("../activity/Activity.js");
9
9
  var _messageHelper = require("../messageHelper.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Exclusive gateway
12
+ * @param {import('moddle-context-serializer').Activity} activityDef
13
+ * @param {import('#types').ContextInstance} context
14
+ */
11
15
  function ExclusiveGateway(activityDef, context) {
12
- return new _Activity.default(ExclusiveGatewayBehaviour, activityDef, context);
16
+ return new _Activity.Activity(ExclusiveGatewayBehaviour, activityDef, context);
13
17
  }
18
+
19
+ /**
20
+ * Exclusive gateway behaviour
21
+ * @param {import('#types').Activity} activity
22
+ */
14
23
  function ExclusiveGatewayBehaviour(activity) {
15
24
  const {
16
25
  id,
@@ -21,10 +30,16 @@ function ExclusiveGatewayBehaviour(activity) {
21
30
  this.type = type;
22
31
  this.broker = broker;
23
32
  }
33
+
34
+ /**
35
+ * @param {import('#types').ElementBrokerMessage} executeMessage
36
+ * @returns {void}
37
+ */
24
38
  ExclusiveGatewayBehaviour.prototype.execute = function execute({
25
39
  content
26
40
  }) {
27
41
  this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content, {
28
- outboundTakeOne: true
42
+ outboundTakeOne: true,
43
+ requireOutbound: true
29
44
  }));
30
45
  };
@@ -3,14 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.InclusiveGateway = InclusiveGateway;
6
7
  exports.InclusiveGatewayBehaviour = InclusiveGatewayBehaviour;
7
- exports.default = InclusiveGateway;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
8
+ var _Activity = require("../activity/Activity.js");
9
9
  var _messageHelper = require("../messageHelper.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ /**
11
+ * Inclusive gateway
12
+ * @param {import('moddle-context-serializer').Activity} activityDef
13
+ * @param {import('#types').ContextInstance} context
14
+ */
11
15
  function InclusiveGateway(activityDef, context) {
12
- return new _Activity.default(InclusiveGatewayBehaviour, activityDef, context);
16
+ return new _Activity.Activity(InclusiveGatewayBehaviour, activityDef, context);
13
17
  }
18
+
19
+ /**
20
+ * Inclusive gateway behaviour
21
+ * @param {import('#types').Activity} activity
22
+ */
14
23
  function InclusiveGatewayBehaviour(activity) {
15
24
  const {
16
25
  id,
@@ -21,8 +30,15 @@ function InclusiveGatewayBehaviour(activity) {
21
30
  this.type = type;
22
31
  this.broker = broker;
23
32
  }
33
+
34
+ /**
35
+ * @param {import('#types').ElementBrokerMessage} executeMessage
36
+ * @returns {void}
37
+ */
24
38
  InclusiveGatewayBehaviour.prototype.execute = function execute({
25
39
  content
26
40
  }) {
27
- this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content));
41
+ this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(content, {
42
+ requireOutbound: true
43
+ }));
28
44
  };