bpmn-elements 8.2.0 → 8.2.2

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 +8 -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 +24 -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 +8 -1
  74. package/src/tasks/StandardLoopCharacteristics.js +0 -1
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Properties;
7
-
8
7
  var _getPropertyValue = _interopRequireDefault(require("../getPropertyValue"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const kProperties = Symbol.for('properties');
13
10
  const kConsuming = Symbol.for('consuming');
14
-
15
11
  function Properties(activity, propertiesDef, context) {
16
12
  this.activity = activity;
17
13
  this.broker = activity.broker;
@@ -20,7 +16,6 @@ function Properties(activity, propertiesDef, context) {
20
16
  dataInputObjects: [],
21
17
  dataOutputObjects: []
22
18
  };
23
-
24
19
  for (const {
25
20
  id,
26
21
  ...def
@@ -35,7 +30,6 @@ function Properties(activity, propertiesDef, context) {
35
30
  const outputDataObjectId = (0, _getPropertyValue.default)(def, 'behaviour.dataOutput.association.target.dataObject.id');
36
31
  const inputDataStoreId = (0, _getPropertyValue.default)(def, 'behaviour.dataInput.association.source.dataStore.id');
37
32
  const outputDataStoreId = (0, _getPropertyValue.default)(def, 'behaviour.dataOutput.association.target.dataStore.id');
38
-
39
33
  if (inputDataObjectId) {
40
34
  const reference = context.getDataObjectById(inputDataObjectId);
41
35
  props.dataInputObjects.push({
@@ -46,7 +40,6 @@ function Properties(activity, propertiesDef, context) {
46
40
  reference
47
41
  };
48
42
  }
49
-
50
43
  if (outputDataObjectId) {
51
44
  const reference = context.getDataObjectById(outputDataObjectId);
52
45
  props.dataOutputObjects.push({
@@ -57,7 +50,6 @@ function Properties(activity, propertiesDef, context) {
57
50
  reference
58
51
  };
59
52
  }
60
-
61
53
  if (inputDataStoreId) {
62
54
  const reference = context.getDataStoreById(inputDataStoreId);
63
55
  props.dataInputObjects.push({
@@ -68,7 +60,6 @@ function Properties(activity, propertiesDef, context) {
68
60
  reference
69
61
  };
70
62
  }
71
-
72
63
  if (outputDataStoreId) {
73
64
  const reference = context.getDataStoreById(outputDataStoreId);
74
65
  props.dataOutputObjects.push({
@@ -81,45 +72,35 @@ function Properties(activity, propertiesDef, context) {
81
72
  }
82
73
  }
83
74
  }
84
-
85
75
  const proto = Properties.prototype;
86
-
87
76
  proto.activate = function activate(message) {
88
77
  if (this[kConsuming]) return;
89
-
90
78
  if (message.fields.redelivered && message.fields.routingKey === 'run.start') {
91
79
  this._onActivityEvent('activity.enter', message);
92
80
  }
93
-
94
81
  if (message.fields.redelivered && message.content.properties) {
95
82
  this._onActivityEvent('activity.extension.resume', message);
96
83
  }
97
-
98
84
  this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {
99
85
  noAck: true
100
86
  });
101
87
  };
102
-
103
88
  proto.deactivate = function deactivate() {
104
89
  if (this[kConsuming]) this[kConsuming] = this[kConsuming].cancel();
105
90
  };
106
-
107
91
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
108
92
  switch (routingKey) {
109
93
  case 'activity.enter':
110
94
  case 'activity.extension.resume':
111
95
  return this._formatOnEnter(message);
112
-
113
96
  case 'activity.execution.completed':
114
97
  return this._formatOnComplete(message);
115
98
  }
116
99
  };
117
-
118
100
  proto._formatOnEnter = function formatOnEnter(message) {
119
101
  const startRoutingKey = 'run.enter.bpmn-properties';
120
102
  const dataInputObjects = this[kProperties].dataInputObjects;
121
103
  const broker = this.broker;
122
-
123
104
  if (!dataInputObjects.length) {
124
105
  return broker.getQueue('format-run-q').queueMessage({
125
106
  routingKey: startRoutingKey
@@ -127,7 +108,6 @@ proto._formatOnEnter = function formatOnEnter(message) {
127
108
  properties: this._getProperties(message)
128
109
  });
129
110
  }
130
-
131
111
  const endRoutingKey = 'run.enter.bpmn-properties.end';
132
112
  broker.getQueue('format-run-q').queueMessage({
133
113
  routingKey: startRoutingKey
@@ -141,16 +121,12 @@ proto._formatOnEnter = function formatOnEnter(message) {
141
121
  });
142
122
  });
143
123
  };
144
-
145
124
  proto._formatOnComplete = function formatOnComplete(message) {
146
125
  const startRoutingKey = 'run.end.bpmn-properties';
147
126
  const messageOutput = (0, _getPropertyValue.default)(message, 'content.output.properties') || {};
148
-
149
127
  const outputProperties = this._getProperties(message, messageOutput);
150
-
151
128
  const dataOutputObjects = this[kProperties].dataOutputObjects;
152
129
  const broker = this.broker;
153
-
154
130
  if (!dataOutputObjects.length) {
155
131
  return broker.getQueue('format-run-q').queueMessage({
156
132
  routingKey: startRoutingKey
@@ -158,7 +134,6 @@ proto._formatOnComplete = function formatOnComplete(message) {
158
134
  properties: outputProperties
159
135
  });
160
136
  }
161
-
162
137
  const endRoutingKey = 'run.end.bpmn-properties.end';
163
138
  broker.getQueue('format-run-q').queueMessage({
164
139
  routingKey: startRoutingKey
@@ -172,15 +147,13 @@ proto._formatOnComplete = function formatOnComplete(message) {
172
147
  });
173
148
  });
174
149
  };
175
-
176
150
  proto._getProperties = function getProperties(message, values) {
177
151
  let response = {};
178
-
179
152
  if (message.content.properties) {
180
- response = { ...message.content.properties
153
+ response = {
154
+ ...message.content.properties
181
155
  };
182
156
  }
183
-
184
157
  for (const {
185
158
  id,
186
159
  type,
@@ -193,21 +166,17 @@ proto._getProperties = function getProperties(message, values) {
193
166
  name
194
167
  };
195
168
  }
196
-
197
169
  if (!values || !(id in values)) continue;
198
170
  response[id].value = values[id].value;
199
171
  }
200
-
201
172
  return response;
202
173
  };
203
-
204
174
  function read(broker, dataReferences, callback) {
205
175
  const responses = {};
206
176
  let count = 0;
207
177
  const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, {
208
178
  noAck: true
209
179
  });
210
-
211
180
  for (const {
212
181
  id: propertyId,
213
182
  reference
@@ -216,23 +185,21 @@ function read(broker, dataReferences, callback) {
216
185
  correlationId: propertyId
217
186
  });
218
187
  }
219
-
220
188
  function onDataReadResponse(routingKey, message) {
221
- responses[message.properties.correlationId] = { ...message.content
189
+ responses[message.properties.correlationId] = {
190
+ ...message.content
222
191
  };
223
192
  if (++count < dataReferences.length) return;
224
193
  dataReadConsumer.cancel();
225
194
  return callback(null, responses);
226
195
  }
227
196
  }
228
-
229
197
  function write(broker, dataReferences, properties, callback) {
230
198
  const responses = [];
231
199
  let count = 0;
232
200
  const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, {
233
201
  noAck: true
234
202
  });
235
-
236
203
  for (const {
237
204
  id: propertyId,
238
205
  reference
@@ -242,9 +209,9 @@ function write(broker, dataReferences, properties, callback) {
242
209
  correlationId: propertyId
243
210
  });
244
211
  }
245
-
246
212
  function onDataWriteResponse(routingKey, message) {
247
- responses[message.properties.correlationId] = { ...message.content
213
+ responses[message.properties.correlationId] = {
214
+ ...message.content
248
215
  };
249
216
  if (++count < dataReferences.length) return;
250
217
  dataWriteConsumer.cancel();
@@ -9,7 +9,6 @@ exports.cloneParent = cloneParent;
9
9
  exports.pushParent = pushParent;
10
10
  exports.shiftParent = shiftParent;
11
11
  exports.unshiftParent = unshiftParent;
12
-
13
12
  function cloneContent(content, extend) {
14
13
  const {
15
14
  discardSequence,
@@ -18,64 +17,59 @@ function cloneContent(content, extend) {
18
17
  parent,
19
18
  sequence
20
19
  } = content;
21
- const clone = { ...content,
20
+ const clone = {
21
+ ...content,
22
22
  ...extend
23
23
  };
24
-
25
24
  if (parent) {
26
25
  clone.parent = cloneParent(parent);
27
26
  }
28
-
29
27
  if (discardSequence) {
30
28
  clone.discardSequence = discardSequence.slice();
31
29
  }
32
-
33
30
  if (inbound) {
34
31
  clone.inbound = inbound.map(c => cloneContent(c));
35
32
  }
36
-
37
33
  if (outbound) {
38
34
  clone.outbound = outbound.map(c => cloneContent(c));
39
35
  }
40
-
41
36
  if (Array.isArray(sequence)) {
42
37
  clone.sequence = sequence.map(c => cloneContent(c));
43
38
  }
44
-
45
39
  return clone;
46
40
  }
47
-
48
41
  function cloneMessage(message, overrideContent) {
49
42
  return {
50
- fields: { ...message.fields
43
+ fields: {
44
+ ...message.fields
51
45
  },
52
46
  content: cloneContent(message.content, overrideContent),
53
- properties: { ...message.properties
47
+ properties: {
48
+ ...message.properties
54
49
  }
55
50
  };
56
51
  }
57
-
58
52
  function cloneParent(parent) {
59
53
  const {
60
54
  path
61
55
  } = parent;
62
- const clone = { ...parent
56
+ const clone = {
57
+ ...parent
63
58
  };
64
59
  if (!path) return clone;
65
60
  clone.path = path.map(p => {
66
- return { ...p
61
+ return {
62
+ ...p
67
63
  };
68
64
  });
69
65
  return clone;
70
66
  }
71
-
72
67
  function unshiftParent(parent, adoptingParent) {
73
68
  const {
74
69
  id,
75
70
  type,
76
71
  executionId
77
72
  } = adoptingParent;
78
-
79
73
  if (!parent) {
80
74
  return {
81
75
  id,
@@ -83,7 +77,6 @@ function unshiftParent(parent, adoptingParent) {
83
77
  executionId
84
78
  };
85
79
  }
86
-
87
80
  const clone = cloneParent(parent);
88
81
  const {
89
82
  id: parentId,
@@ -101,7 +94,6 @@ function unshiftParent(parent, adoptingParent) {
101
94
  });
102
95
  return clone;
103
96
  }
104
-
105
97
  function shiftParent(parent) {
106
98
  if (!parent) return;
107
99
  if (!parent.path || !parent.path.length) return;
@@ -117,7 +109,6 @@ function shiftParent(parent) {
117
109
  clone.path = clone.path.length ? clone.path : undefined;
118
110
  return clone;
119
111
  }
120
-
121
112
  function pushParent(parent, ancestor) {
122
113
  const {
123
114
  id,
@@ -130,21 +121,17 @@ function pushParent(parent, ancestor) {
130
121
  executionId
131
122
  };
132
123
  const clone = cloneParent(parent);
133
-
134
124
  if (clone.id === id) {
135
125
  if (executionId) clone.executionId = executionId;
136
126
  return clone;
137
127
  }
138
-
139
128
  const path = clone.path = clone.path || [];
140
-
141
129
  for (const p of path) {
142
130
  if (p.id === id) {
143
131
  if (executionId) p.executionId = executionId;
144
132
  return clone;
145
133
  }
146
134
  }
147
-
148
135
  path.push({
149
136
  id,
150
137
  type,