bpmn-elements 8.2.0 → 8.2.1

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 (74) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +0 -49
  3. package/dist/src/Api.js +4 -19
  4. package/dist/src/Context.js +0 -35
  5. package/dist/src/Environment.js +18 -44
  6. package/dist/src/EventBroker.js +8 -27
  7. package/dist/src/Expressions.js +0 -13
  8. package/dist/src/ExtensionsMapper.js +0 -12
  9. package/dist/src/MessageFormatter.js +0 -33
  10. package/dist/src/Scripts.js +2 -9
  11. package/dist/src/Timers.js +0 -9
  12. package/dist/src/activity/Activity.js +39 -243
  13. package/dist/src/activity/ActivityExecution.js +8 -76
  14. package/dist/src/activity/Dummy.js +2 -3
  15. package/dist/src/activity/Escalation.js +4 -4
  16. package/dist/src/activity/ExecutionScope.js +0 -4
  17. package/dist/src/activity/Message.js +4 -4
  18. package/dist/src/activity/Signal.js +4 -4
  19. package/dist/src/definition/Definition.js +12 -133
  20. package/dist/src/definition/DefinitionExecution.js +10 -160
  21. package/dist/src/error/BpmnError.js +2 -3
  22. package/dist/src/error/Errors.js +0 -16
  23. package/dist/src/eventDefinitions/CancelEventDefinition.js +2 -35
  24. package/dist/src/eventDefinitions/CompensateEventDefinition.js +3 -34
  25. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +3 -42
  26. package/dist/src/eventDefinitions/ErrorEventDefinition.js +11 -41
  27. package/dist/src/eventDefinitions/EscalationEventDefinition.js +7 -37
  28. package/dist/src/eventDefinitions/EventDefinitionExecution.js +0 -30
  29. package/dist/src/eventDefinitions/LinkEventDefinition.js +11 -37
  30. package/dist/src/eventDefinitions/MessageEventDefinition.js +11 -44
  31. package/dist/src/eventDefinitions/SignalEventDefinition.js +9 -46
  32. package/dist/src/eventDefinitions/TerminateEventDefinition.js +0 -3
  33. package/dist/src/eventDefinitions/TimerEventDefinition.js +8 -52
  34. package/dist/src/events/BoundaryEvent.js +4 -44
  35. package/dist/src/events/EndEvent.js +2 -11
  36. package/dist/src/events/IntermediateCatchEvent.js +0 -13
  37. package/dist/src/events/IntermediateThrowEvent.js +2 -11
  38. package/dist/src/events/StartEvent.js +5 -25
  39. package/dist/src/flows/Association.js +4 -27
  40. package/dist/src/flows/MessageFlow.js +6 -18
  41. package/dist/src/flows/SequenceFlow.js +4 -39
  42. package/dist/src/gateways/EventBasedGateway.js +0 -21
  43. package/dist/src/gateways/ExclusiveGateway.js +0 -6
  44. package/dist/src/gateways/InclusiveGateway.js +0 -6
  45. package/dist/src/gateways/ParallelGateway.js +2 -7
  46. package/dist/src/getPropertyValue.js +0 -30
  47. package/dist/src/io/BpmnIO.js +2 -7
  48. package/dist/src/io/EnvironmentDataObject.js +0 -8
  49. package/dist/src/io/EnvironmentDataStore.js +0 -8
  50. package/dist/src/io/EnvironmentDataStoreReference.js +0 -8
  51. package/dist/src/io/InputOutputSpecification.js +12 -37
  52. package/dist/src/io/Properties.js +6 -39
  53. package/dist/src/messageHelper.js +10 -23
  54. package/dist/src/process/Process.js +10 -112
  55. package/dist/src/process/ProcessExecution.js +14 -170
  56. package/dist/src/shared.js +0 -7
  57. package/dist/src/tasks/CallActivity.js +2 -23
  58. package/dist/src/tasks/LoopCharacteristics.js +16 -67
  59. package/dist/src/tasks/ReceiveTask.js +8 -48
  60. package/dist/src/tasks/ScriptTask.js +1 -15
  61. package/dist/src/tasks/ServiceImplementation.js +0 -4
  62. package/dist/src/tasks/ServiceTask.js +0 -20
  63. package/dist/src/tasks/SignalTask.js +2 -21
  64. package/dist/src/tasks/StandardLoopCharacteristics.js +4 -5
  65. package/dist/src/tasks/SubProcess.js +4 -52
  66. package/dist/src/tasks/Task.js +0 -8
  67. package/dist/src/tasks/Transaction.js +0 -3
  68. package/package.json +7 -7
  69. package/src/Context.js +0 -1
  70. package/src/activity/Activity.js +1 -1
  71. package/src/gateways/EventBasedGateway.js +0 -1
  72. package/src/io/InputOutputSpecification.js +0 -1
  73. package/src/process/ProcessExecution.js +2 -1
  74. package/src/tasks/StandardLoopCharacteristics.js +0 -1
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = MessageEventDefinition;
7
-
8
7
  var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
9
-
10
8
  var _shared = require("../shared");
11
-
12
9
  var _messageHelper = require("../messageHelper");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const kCompleted = Symbol.for('completed');
17
12
  const kMessageQ = Symbol.for('messageQ');
18
13
  const kExecuteMessage = Symbol.for('executeMessage');
19
14
  const kReferenceElement = Symbol.for('referenceElement');
20
15
  const kReferenceInfo = Symbol.for('referenceInfo');
21
-
22
16
  function MessageEventDefinition(activity, eventDefinition) {
23
17
  const {
24
18
  id,
@@ -42,7 +36,6 @@ function MessageEventDefinition(activity, eventDefinition) {
42
36
  this.broker = broker;
43
37
  this.logger = environment.Logger(type.toLowerCase());
44
38
  const referenceElement = this[kReferenceElement] = reference.id && activity.getActivityById(reference.id);
45
-
46
39
  if (!isThrowing) {
47
40
  this[kCompleted] = false;
48
41
  const referenceId = referenceElement ? referenceElement.id : 'anonymous';
@@ -56,20 +49,16 @@ function MessageEventDefinition(activity, eventDefinition) {
56
49
  });
57
50
  }
58
51
  }
59
-
60
52
  const proto = MessageEventDefinition.prototype;
61
53
  Object.defineProperty(proto, 'executionId', {
62
54
  get() {
63
55
  const message = this[kExecuteMessage];
64
56
  return message && message.content.executionId;
65
57
  }
66
-
67
58
  });
68
-
69
59
  proto.execute = function execute(executeMessage) {
70
60
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
71
61
  };
72
-
73
62
  proto.executeCatch = function executeCatch(executeMessage) {
74
63
  this[kExecuteMessage] = executeMessage;
75
64
  this[kCompleted] = false;
@@ -79,23 +68,16 @@ proto.executeCatch = function executeCatch(executeMessage) {
79
68
  parent
80
69
  } = executeContent;
81
70
  const parentExecutionId = parent && parent.executionId;
82
-
83
71
  const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
84
-
85
72
  this._debug(`expect ${info.description}`);
86
-
87
73
  const broker = this.broker;
88
-
89
74
  const onCatchMessage = this._onCatchMessage.bind(this);
90
-
91
75
  this[kMessageQ].consume(onCatchMessage, {
92
76
  noAck: true,
93
77
  consumerTag: `_api-message-${executionId}`
94
78
  });
95
79
  if (this[kCompleted]) return;
96
-
97
80
  const onApiMessage = this._onApiMessage.bind(this);
98
-
99
81
  broker.subscribeTmp('api', `activity.#.${executionId}`, onApiMessage, {
100
82
  noAck: true,
101
83
  consumerTag: `_api-${executionId}`,
@@ -112,27 +94,26 @@ proto.executeCatch = function executeCatch(executeMessage) {
112
94
  });
113
95
  const waitContent = (0, _messageHelper.cloneContent)(executeContent, {
114
96
  executionId: parentExecutionId,
115
- message: { ...info.message
97
+ message: {
98
+ ...info.message
116
99
  }
117
100
  });
118
101
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
119
102
  broker.publish('event', 'activity.wait', waitContent);
120
103
  };
121
-
122
104
  proto.executeThrow = function executeThrow(executeMessage) {
123
105
  const executeContent = executeMessage.content;
124
106
  const {
125
107
  executionId,
126
108
  parent
127
109
  } = executeContent;
128
-
129
110
  const info = this._getReferenceInfo(executeMessage);
130
-
131
111
  this.logger.debug(`<${executionId} (${this.activity.id})> message ${info.description}`);
132
112
  const broker = this.broker;
133
113
  const throwContent = (0, _messageHelper.cloneContent)(executeContent, {
134
114
  executionId: parent.executionId,
135
- message: { ...executeContent.input,
115
+ message: {
116
+ ...executeContent.input,
136
117
  ...info.message
137
118
  },
138
119
  state: 'throw'
@@ -144,7 +125,6 @@ proto.executeThrow = function executeThrow(executeMessage) {
144
125
  });
145
126
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
146
127
  };
147
-
148
128
  proto._onCatchMessage = function onCatchMessage(routingKey, message) {
149
129
  if ((0, _getPropertyValue.default)(message, 'content.message.id') !== this[kReferenceInfo].message.id) return;
150
130
  const {
@@ -152,24 +132,22 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
152
132
  correlationId
153
133
  } = message.properties;
154
134
  this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
155
- message: { ...message.content.message
135
+ message: {
136
+ ...message.content.message
156
137
  }
157
138
  }), {
158
139
  correlationId,
159
140
  type
160
141
  });
161
-
162
142
  this._complete('caught', message.content.message, {
163
143
  correlationId
164
144
  });
165
145
  };
166
-
167
146
  proto._onApiMessage = function onApiMessage(routingKey, message) {
168
147
  const {
169
148
  type,
170
149
  correlationId
171
150
  } = message.properties;
172
-
173
151
  switch (type) {
174
152
  case 'message':
175
153
  case 'signal':
@@ -178,36 +156,29 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
178
156
  correlationId
179
157
  });
180
158
  }
181
-
182
159
  case 'discard':
183
160
  {
184
161
  this[kCompleted] = true;
185
-
186
162
  this._stop();
187
-
188
163
  return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content), {
189
164
  correlationId
190
165
  });
191
166
  }
192
-
193
167
  case 'stop':
194
168
  {
195
169
  return this._stop();
196
170
  }
197
171
  }
198
172
  };
199
-
200
173
  proto._complete = function complete(verb, output, options) {
201
174
  this[kCompleted] = true;
202
-
203
175
  this._stop();
204
-
205
176
  this._debug(`${verb} ${this[kReferenceInfo].description}`);
206
-
207
177
  const broker = this.broker;
208
178
  const executeContent = this[kExecuteMessage].content;
209
179
  const catchContent = (0, _messageHelper.cloneContent)(executeContent, {
210
- message: { ...output
180
+ message: {
181
+ ...output
211
182
  },
212
183
  executionId: executeContent.parent.executionId
213
184
  });
@@ -220,35 +191,31 @@ proto._complete = function complete(verb, output, options) {
220
191
  state: 'catch'
221
192
  }), options);
222
193
  };
223
-
224
194
  proto._stop = function stop() {
225
195
  const broker = this.broker,
226
- executionId = this.executionId;
196
+ executionId = this.executionId;
227
197
  broker.cancel(`_api-message-${executionId}`);
228
198
  broker.cancel(`_api-${executionId}`);
229
199
  broker.cancel(`_api-parent-${executionId}`);
230
200
  broker.cancel(`_api-delegated-${executionId}`);
231
201
  this[kMessageQ].purge();
232
202
  };
233
-
234
203
  proto._getReferenceInfo = function getReferenceInfo(message) {
235
204
  const referenceElement = this[kReferenceElement];
236
-
237
205
  if (!referenceElement) {
238
206
  return {
239
- message: { ...this.reference
207
+ message: {
208
+ ...this.reference
240
209
  },
241
210
  description: 'anonymous message'
242
211
  };
243
212
  }
244
-
245
213
  const result = {
246
214
  message: referenceElement.resolve(message)
247
215
  };
248
216
  result.description = `${result.message.name} <${result.message.id}>`;
249
217
  return result;
250
218
  };
251
-
252
219
  proto._debug = function debug(msg) {
253
220
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
254
221
  };
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = SignalEventDefinition;
7
-
8
7
  var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
9
-
10
8
  var _shared = require("../shared");
11
-
12
9
  var _messageHelper = require("../messageHelper");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const kCompleted = Symbol.for('completed');
17
12
  const kMessageQ = Symbol.for('messageQ');
18
13
  const kExecuteMessage = Symbol.for('executeMessage');
19
14
  const kReferenceElement = Symbol.for('referenceElement');
20
15
  const kReferenceInfo = Symbol.for('referenceInfo');
21
-
22
16
  function SignalEventDefinition(activity, eventDefinition) {
23
17
  const {
24
18
  id,
@@ -43,7 +37,6 @@ function SignalEventDefinition(activity, eventDefinition) {
43
37
  this.broker = broker;
44
38
  this.logger = environment.Logger(type.toLowerCase());
45
39
  const referenceElement = this[kReferenceElement] = reference.id && activity.getActivityById(reference.id);
46
-
47
40
  if (!isThrowing && isStart) {
48
41
  this[kCompleted] = false;
49
42
  const referenceId = referenceElement ? referenceElement.id : 'anonymous';
@@ -57,20 +50,16 @@ function SignalEventDefinition(activity, eventDefinition) {
57
50
  });
58
51
  }
59
52
  }
60
-
61
53
  const proto = SignalEventDefinition.prototype;
62
54
  Object.defineProperty(proto, 'executionId', {
63
55
  get() {
64
56
  const message = this[kExecuteMessage];
65
57
  return message && message.content.executionId;
66
58
  }
67
-
68
59
  });
69
-
70
60
  proto.execute = function execute(executeMessage) {
71
61
  return this.isThrowing ? this.executeThrow(executeMessage) : this.executeCatch(executeMessage);
72
62
  };
73
-
74
63
  proto.executeCatch = function executeCatch(executeMessage) {
75
64
  this[kExecuteMessage] = executeMessage;
76
65
  this[kCompleted] = false;
@@ -80,13 +69,9 @@ proto.executeCatch = function executeCatch(executeMessage) {
80
69
  parent
81
70
  } = executeContent;
82
71
  const parentExecutionId = parent && parent.executionId;
83
-
84
72
  const info = this[kReferenceInfo] = this._getReferenceInfo(executeMessage);
85
-
86
73
  const broker = this.broker;
87
-
88
74
  const onCatchMessage = this._onCatchMessage.bind(this);
89
-
90
75
  if (this.activity.isStart) {
91
76
  this[kMessageQ].consume(onCatchMessage, {
92
77
  noAck: true,
@@ -94,9 +79,7 @@ proto.executeCatch = function executeCatch(executeMessage) {
94
79
  });
95
80
  if (this[kCompleted]) return;
96
81
  }
97
-
98
82
  const onApiMessage = this._onApiMessage.bind(this);
99
-
100
83
  broker.subscribeTmp('api', `activity.#.${parentExecutionId}`, onApiMessage, {
101
84
  noAck: true,
102
85
  consumerTag: `_api-parent-${executionId}`
@@ -109,31 +92,28 @@ proto.executeCatch = function executeCatch(executeMessage) {
109
92
  noAck: true,
110
93
  consumerTag: `_api-delegated-${executionId}`
111
94
  });
112
-
113
95
  this._debug(`expect ${info.description}`);
114
-
115
96
  const waitContent = (0, _messageHelper.cloneContent)(executeContent, {
116
97
  executionId: parent.executionId,
117
- signal: { ...info.message
98
+ signal: {
99
+ ...info.message
118
100
  }
119
101
  });
120
102
  waitContent.parent = (0, _messageHelper.shiftParent)(parent);
121
103
  broker.publish('event', 'activity.wait', waitContent);
122
104
  };
123
-
124
105
  proto.executeThrow = function executeThrow(executeMessage) {
125
106
  const executeContent = executeMessage.content;
126
107
  const {
127
108
  executionId,
128
109
  parent
129
110
  } = executeContent;
130
-
131
111
  const info = this._getReferenceInfo(executeMessage);
132
-
133
112
  this.logger.debug(`<${executionId} (${this.activity.id})> throw ${info.description}`);
134
113
  const throwContent = (0, _messageHelper.cloneContent)(executeContent, {
135
114
  executionId: parent.executionId,
136
- message: { ...executeContent.input,
115
+ message: {
116
+ ...executeContent.input,
137
117
  ...info.message
138
118
  },
139
119
  state: 'throw'
@@ -145,20 +125,18 @@ proto.executeThrow = function executeThrow(executeMessage) {
145
125
  });
146
126
  return broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent));
147
127
  };
148
-
149
128
  proto._onCatchMessage = function onCatchMessage(routingKey, message) {
150
129
  const info = this[kReferenceInfo];
151
130
  if ((0, _getPropertyValue.default)(message, 'content.message.id') !== info.message.id) return;
152
131
  this[kCompleted] = true;
153
-
154
132
  this._stop();
155
-
156
133
  const {
157
134
  type,
158
135
  correlationId
159
136
  } = message.properties;
160
137
  this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
161
- message: { ...message.content.message
138
+ message: {
139
+ ...message.content.message
162
140
  }
163
141
  }), {
164
142
  correlationId,
@@ -166,13 +144,11 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
166
144
  });
167
145
  return this._complete(message.content.message, message.properties);
168
146
  };
169
-
170
147
  proto._onApiMessage = function onApiMessage(routingKey, message) {
171
148
  const {
172
149
  type,
173
150
  correlationId
174
151
  } = message.properties;
175
-
176
152
  switch (type) {
177
153
  case 'signal':
178
154
  {
@@ -180,68 +156,55 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
180
156
  correlationId
181
157
  });
182
158
  }
183
-
184
159
  case 'discard':
185
160
  {
186
161
  this[kCompleted] = true;
187
-
188
162
  this._stop();
189
-
190
163
  return this.broker.publish('execution', 'execute.discard', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content), {
191
164
  correlationId
192
165
  });
193
166
  }
194
-
195
167
  case 'stop':
196
168
  {
197
169
  this._stop();
198
-
199
170
  break;
200
171
  }
201
172
  }
202
173
  };
203
-
204
174
  proto._complete = function complete(output, options) {
205
175
  this[kCompleted] = true;
206
-
207
176
  this._stop();
208
-
209
177
  this._debug(`signaled with ${this[kReferenceInfo].description}`);
210
-
211
178
  return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
212
179
  output,
213
180
  state: 'signal'
214
181
  }), options);
215
182
  };
216
-
217
183
  proto._stop = function stop() {
218
184
  const broker = this.broker,
219
- executionId = this.executionId;
185
+ executionId = this.executionId;
220
186
  broker.cancel(`_api-signal-${executionId}`);
221
187
  broker.cancel(`_api-parent-${executionId}`);
222
188
  broker.cancel(`_api-${executionId}`);
223
189
  broker.cancel(`_api-delegated-${executionId}`);
224
190
  if (this.activity.isStart) this[kMessageQ].purge();
225
191
  };
226
-
227
192
  proto._getReferenceInfo = function getReferenceInfo(message) {
228
193
  const referenceElement = this[kReferenceElement];
229
-
230
194
  if (!referenceElement) {
231
195
  return {
232
- message: { ...this.reference
196
+ message: {
197
+ ...this.reference
233
198
  },
234
199
  description: 'anonymous signal'
235
200
  };
236
201
  }
237
-
238
202
  const result = {
239
203
  message: referenceElement.resolve(message)
240
204
  };
241
205
  result.description = `${result.message.name} <${result.message.id}>`;
242
206
  return result;
243
207
  };
244
-
245
208
  proto._debug = function debug(msg) {
246
209
  this.logger.debug(`<${this.executionId} (${this.activity.id})> ${msg}`);
247
210
  };
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = TerminateEventDefinition;
7
-
8
7
  var _messageHelper = require("../messageHelper");
9
-
10
8
  function TerminateEventDefinition(activity, eventDefinition) {
11
9
  const {
12
10
  id,
@@ -22,7 +20,6 @@ function TerminateEventDefinition(activity, eventDefinition) {
22
20
  this.broker = broker;
23
21
  this.logger = environment.Logger(type.toLowerCase());
24
22
  }
25
-
26
23
  TerminateEventDefinition.prototype.execute = function execute(executeMessage) {
27
24
  const executeContent = executeMessage.content;
28
25
  const throwContent = (0, _messageHelper.cloneContent)(executeContent, {