bpmn-elements 12.0.0 → 13.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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/Environment.js +15 -15
  3. package/dist/activity/Activity.js +122 -141
  4. package/dist/activity/ActivityExecution.js +0 -1
  5. package/dist/definition/Definition.js +38 -42
  6. package/dist/definition/DefinitionExecution.js +51 -53
  7. package/dist/eventDefinitions/EventDefinitionExecution.js +10 -10
  8. package/dist/eventDefinitions/TimerEventDefinition.js +16 -16
  9. package/dist/events/BoundaryEvent.js +12 -11
  10. package/dist/events/index.js +60 -0
  11. package/dist/flows/Association.js +0 -1
  12. package/dist/flows/MessageFlow.js +0 -1
  13. package/dist/flows/SequenceFlow.js +0 -1
  14. package/dist/gateways/index.js +49 -0
  15. package/dist/process/Process.js +53 -59
  16. package/dist/process/ProcessExecution.js +30 -31
  17. package/dist/tasks/SubProcess.js +2 -2
  18. package/dist/tasks/index.js +93 -0
  19. package/events.d.ts +1 -0
  20. package/gateways.d.ts +1 -0
  21. package/index.d.ts +1 -0
  22. package/package.json +36 -16
  23. package/src/Environment.js +16 -17
  24. package/src/activity/Activity.js +96 -131
  25. package/src/activity/ActivityExecution.js +0 -1
  26. package/src/definition/Definition.js +30 -40
  27. package/src/definition/DefinitionExecution.js +47 -55
  28. package/src/eventDefinitions/EventDefinitionExecution.js +9 -10
  29. package/src/eventDefinitions/TimerEventDefinition.js +14 -16
  30. package/src/events/BoundaryEvent.js +11 -11
  31. package/src/events/index.js +5 -0
  32. package/src/flows/Association.js +0 -1
  33. package/src/flows/MessageFlow.js +0 -1
  34. package/src/flows/SequenceFlow.js +0 -1
  35. package/src/gateways/index.js +4 -0
  36. package/src/process/Process.js +40 -54
  37. package/src/process/ProcessExecution.js +25 -31
  38. package/src/tasks/SubProcess.js +2 -2
  39. package/src/tasks/index.js +8 -0
  40. package/tasks.d.ts +1 -0
  41. package/types/index.d.ts +69 -767
  42. package/types/types.d.ts +706 -0
@@ -102,161 +102,126 @@ function Activity(Behaviour, activityDef, context) {
102
102
  this[kExtensions] = context.loadExtensions(this);
103
103
  }
104
104
 
105
- Object.defineProperty(Activity.prototype, 'counters', {
106
- enumerable: true,
107
- get() {
108
- return {...this[kCounters]};
105
+ Object.defineProperties(Activity.prototype, {
106
+ counters: {
107
+ get() {
108
+ return {...this[kCounters]};
109
+ },
109
110
  },
110
- });
111
-
112
- Object.defineProperty(Activity.prototype, 'execution', {
113
- enumerable: true,
114
- get() {
115
- return this[kExec].execution;
111
+ execution: {
112
+ get() {
113
+ return this[kExec].execution;
114
+ },
116
115
  },
117
- });
118
-
119
- Object.defineProperty(Activity.prototype, 'executionId', {
120
- enumerable: true,
121
- get() {
122
- return this[kExec].executionId;
116
+ executionId: {
117
+ get() {
118
+ return this[kExec].executionId;
119
+ },
123
120
  },
124
- });
125
-
126
- Object.defineProperty(Activity.prototype, 'extensions', {
127
- enumerable: true,
128
- get() {
129
- return this[kExtensions];
121
+ extensions: {
122
+ get() {
123
+ return this[kExtensions];
124
+ },
130
125
  },
131
- });
132
-
133
- Object.defineProperty(Activity.prototype, 'bpmnIo', {
134
- enumerable: true,
135
- get() {
136
- const extensions = this[kExtensions];
137
- return extensions && extensions.extensions.find(e => e.type === 'bpmnio');
126
+ bpmnIo: {
127
+ get() {
128
+ const extensions = this[kExtensions];
129
+ return extensions && extensions.extensions.find(e => e.type === 'bpmnio');
130
+ },
138
131
  },
139
- });
140
-
141
- Object.defineProperty(Activity.prototype, 'formatter', {
142
- enumerable: true,
143
- get() {
144
- let formatter = this[kFormatter];
145
- if (formatter) return formatter;
146
-
147
- const broker = this.broker;
148
- formatter = this[kFormatter] = new Formatter({
149
- id: this.id,
150
- broker,
151
- logger: this.logger,
152
- }, broker.getQueue('format-run-q'));
153
- return formatter;
132
+ formatter: {
133
+ get() {
134
+ let formatter = this[kFormatter];
135
+ if (formatter) return formatter;
136
+
137
+ const broker = this.broker;
138
+ formatter = this[kFormatter] = new Formatter({
139
+ id: this.id,
140
+ broker,
141
+ logger: this.logger,
142
+ }, broker.getQueue('format-run-q'));
143
+ return formatter;
144
+ },
154
145
  },
155
- });
156
-
157
- Object.defineProperty(Activity.prototype, 'isRunning', {
158
- enumerable: true,
159
- get() {
160
- if (!this[kConsuming]) return false;
161
- return !!this.status;
146
+ isRunning: {
147
+ get() {
148
+ if (!this[kConsuming]) return false;
149
+ return !!this.status;
150
+ },
162
151
  },
163
- });
164
-
165
- Object.defineProperty(Activity.prototype, 'outbound', {
166
- enumerable: true,
167
- get() {
168
- return this[kFlows].outboundSequenceFlows;
152
+ outbound: {
153
+ get() {
154
+ return this[kFlows].outboundSequenceFlows;
155
+ },
169
156
  },
170
- });
171
-
172
- Object.defineProperty(Activity.prototype, 'inbound', {
173
- enumerable: true,
174
- get() {
175
- return this[kFlows].inboundSequenceFlows;
157
+ inbound: {
158
+ get() {
159
+ return this[kFlows].inboundSequenceFlows;
160
+ },
176
161
  },
177
- });
178
-
179
- Object.defineProperty(Activity.prototype, 'isEnd', {
180
- enumerable: true,
181
- get() {
182
- return this[kFlags].isEnd;
162
+ isEnd: {
163
+ get() {
164
+ return this[kFlags].isEnd;
165
+ },
183
166
  },
184
- });
185
- Object.defineProperty(Activity.prototype, 'isStart', {
186
- enumerable: true,
187
- get() {
188
- return this[kFlags].isStart;
167
+ isStart: {
168
+ get() {
169
+ return this[kFlags].isStart;
170
+ },
189
171
  },
190
- });
191
- Object.defineProperty(Activity.prototype, 'isSubProcess', {
192
- enumerable: true,
193
- get() {
194
- return this[kFlags].isSubProcess;
172
+ isSubProcess: {
173
+ get() {
174
+ return this[kFlags].isSubProcess;
175
+ },
195
176
  },
196
- });
197
- Object.defineProperty(Activity.prototype, 'isTransaction', {
198
- enumerable: true,
199
- get() {
200
- return this[kFlags].isTransaction;
177
+ isTransaction: {
178
+ get() {
179
+ return this[kFlags].isTransaction;
180
+ },
201
181
  },
202
- });
203
-
204
- Object.defineProperty(Activity.prototype, 'isMultiInstance', {
205
- enumerable: true,
206
- get() {
207
- return this[kFlags].isMultiInstance;
182
+ isMultiInstance: {
183
+ get() {
184
+ return this[kFlags].isMultiInstance;
185
+ },
208
186
  },
209
- });
210
-
211
- Object.defineProperty(Activity.prototype, 'isThrowing', {
212
- enumerable: true,
213
- get() {
214
- return this[kFlags].isThrowing;
187
+ isThrowing: {
188
+ get() {
189
+ return this[kFlags].isThrowing;
190
+ },
215
191
  },
216
- });
217
- Object.defineProperty(Activity.prototype, 'isForCompensation', {
218
- enumerable: true,
219
- get() {
220
- return this[kFlags].isForCompensation;
192
+ isForCompensation: {
193
+ get() {
194
+ return this[kFlags].isForCompensation;
195
+ },
221
196
  },
222
- });
223
- Object.defineProperty(Activity.prototype, 'triggeredByEvent', {
224
- enumerable: true,
225
- get() {
226
- return this[kActivityDef].triggeredByEvent;
197
+ triggeredByEvent: {
198
+ get() {
199
+ return this[kActivityDef].triggeredByEvent;
200
+ },
227
201
  },
228
- });
229
-
230
- Object.defineProperty(Activity.prototype, 'attachedTo', {
231
- enumerable: true,
232
- get() {
233
- const attachedToId = this[kFlags].attachedTo;
234
- if (!attachedToId) return null;
235
- return this.getActivityById(attachedToId);
202
+ attachedTo: {
203
+ get() {
204
+ const attachedToId = this[kFlags].attachedTo;
205
+ if (!attachedToId) return null;
206
+ return this.getActivityById(attachedToId);
207
+ },
236
208
  },
237
- });
238
-
239
- Object.defineProperty(Activity.prototype, 'lane', {
240
- enumerable: true,
241
- get() {
209
+ lane: { get() {
242
210
  const laneId = this[kFlags].lane;
243
211
  if (!laneId) return undefined;
244
212
  const parent = this.parentElement;
245
213
  return parent.getLaneById && parent.getLaneById(laneId);
246
214
  },
247
- });
248
-
249
- Object.defineProperty(Activity.prototype, 'eventDefinitions', {
250
- enumerable: true,
251
- get() {
252
- return this[kEventDefinitions];
253
215
  },
254
- });
255
-
256
- Object.defineProperty(Activity.prototype, 'parentElement', {
257
- enumerable: true,
258
- get() {
259
- return this.context.getActivityParentById(this.id);
216
+ eventDefinitions: {
217
+ get() {
218
+ return this[kEventDefinitions];
219
+ },
220
+ },
221
+ parentElement: {
222
+ get() {
223
+ return this.context.getActivityParentById(this.id);
224
+ },
260
225
  },
261
226
  });
262
227
 
@@ -25,7 +25,6 @@ function ActivityExecution(activity, context) {
25
25
  }
26
26
 
27
27
  Object.defineProperty(ActivityExecution.prototype, 'completed', {
28
- enumerable: true,
29
28
  get() {
30
29
  return this[kCompleted];
31
30
  },
@@ -63,52 +63,42 @@ export function Definition(context, options) {
63
63
  this.logger = environment.Logger(type.toLowerCase());
64
64
  }
65
65
 
66
- Object.defineProperty(Definition.prototype, 'counters', {
67
- enumerable: true,
68
- get() {
69
- return {...this[kCounters]};
66
+ Object.defineProperties(Definition.prototype, {
67
+ counters: {
68
+ get() {
69
+ return {...this[kCounters]};
70
+ },
70
71
  },
71
- });
72
-
73
- Object.defineProperty(Definition.prototype, 'execution', {
74
- enumerable: true,
75
- get() {
76
- return this[kExec].execution;
72
+ execution: {
73
+ get() {
74
+ return this[kExec].execution;
75
+ },
77
76
  },
78
- });
79
-
80
- Object.defineProperty(Definition.prototype, 'executionId', {
81
- enumerable: true,
82
- get() {
83
- return this[kExec].executionId;
77
+ executionId: {
78
+ get() {
79
+ return this[kExec].executionId;
80
+ },
84
81
  },
85
- });
86
-
87
- Object.defineProperty(Definition.prototype, 'isRunning', {
88
- enumerable: true,
89
- get() {
90
- if (!this[kConsuming]) return false;
91
- return !!this.status;
82
+ isRunning: {
83
+ get() {
84
+ if (!this[kConsuming]) return false;
85
+ return !!this.status;
86
+ },
92
87
  },
93
- });
94
-
95
- Object.defineProperty(Definition.prototype, 'status', {
96
- enumerable: true,
97
- get() {
98
- return this[kStatus];
88
+ status: {
89
+ get() {
90
+ return this[kStatus];
91
+ },
99
92
  },
100
- });
101
-
102
- Object.defineProperty(Definition.prototype, 'stopped', {
103
- enumerable: true,
104
- get() {
105
- return this[kStopped];
93
+ stopped: {
94
+ get() {
95
+ return this[kStopped];
96
+ },
106
97
  },
107
- });
108
-
109
- Object.defineProperty(Definition.prototype, 'activityStatus', {
110
- get() {
111
- return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
98
+ activityStatus: {
99
+ get() {
100
+ return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
101
+ },
112
102
  },
113
103
  });
114
104
 
@@ -61,69 +61,61 @@ export default function DefinitionExecution(definition, context) {
61
61
  };
62
62
  }
63
63
 
64
- Object.defineProperty(DefinitionExecution.prototype, 'stopped', {
65
- enumerable: true,
66
- get() {
67
- return this[kStopped];
64
+ Object.defineProperties(DefinitionExecution.prototype, {
65
+ stopped: {
66
+ get() {
67
+ return this[kStopped];
68
+ },
68
69
  },
69
- });
70
-
71
- Object.defineProperty(DefinitionExecution.prototype, 'completed', {
72
- enumerable: true,
73
- get() {
74
- return this[kCompleted];
70
+ completed: {
71
+ get() {
72
+ return this[kCompleted];
73
+ },
75
74
  },
76
- });
77
-
78
- Object.defineProperty(DefinitionExecution.prototype, 'status', {
79
- enumerable: true,
80
- get() {
81
- return this[kStatus];
75
+ status: {
76
+ get() {
77
+ return this[kStatus];
78
+ },
82
79
  },
83
- });
84
-
85
- Object.defineProperty(DefinitionExecution.prototype, 'processes', {
86
- enumerable: true,
87
- get() {
88
- return this[kProcesses].running;
80
+ processes: {
81
+ get() {
82
+ return this[kProcesses].running;
83
+ },
89
84
  },
90
- });
91
-
92
- Object.defineProperty(DefinitionExecution.prototype, 'postponedCount', {
93
- get() {
94
- return this[kProcesses].postponed.length;
85
+ postponedCount: {
86
+ get() {
87
+ return this[kProcesses].postponed.length;
88
+ },
95
89
  },
96
- });
97
-
98
- Object.defineProperty(DefinitionExecution.prototype, 'isRunning', {
99
- get() {
100
- return this[kActivated];
90
+ isRunning: {
91
+ get() {
92
+ return this[kActivated];
93
+ },
101
94
  },
102
- });
103
-
104
- Object.defineProperty(DefinitionExecution.prototype, 'activityStatus', {
105
- get() {
106
- let status = 'idle';
107
- const running = this[kProcesses].running;
108
- if (!running || !running.length) return status;
109
-
110
- for (const bp of running) {
111
- const bpStatus = bp.activityStatus;
112
- switch (bp.activityStatus) {
113
- case 'idle':
114
- break;
115
- case 'executing':
116
- return bpStatus;
117
- case 'timer':
118
- status = bpStatus;
119
- break;
120
- case 'wait':
121
- if (status === 'idle') status = bpStatus;
122
- break;
95
+ activityStatus: {
96
+ get() {
97
+ let status = 'idle';
98
+ const running = this[kProcesses].running;
99
+ if (!running || !running.length) return status;
100
+
101
+ for (const bp of running) {
102
+ const bpStatus = bp.activityStatus;
103
+ switch (bp.activityStatus) {
104
+ case 'idle':
105
+ break;
106
+ case 'executing':
107
+ return bpStatus;
108
+ case 'timer':
109
+ status = bpStatus;
110
+ break;
111
+ case 'wait':
112
+ if (status === 'idle') status = bpStatus;
113
+ break;
114
+ }
123
115
  }
124
- }
125
116
 
126
- return status;
117
+ return status;
118
+ },
127
119
  },
128
120
  });
129
121
 
@@ -15,17 +15,16 @@ export default function EventDefinitionExecution(activity, eventDefinitions, com
15
15
  this[kExecuteMessage] = null;
16
16
  }
17
17
 
18
- Object.defineProperty(EventDefinitionExecution.prototype, 'completed', {
19
- enumerable: true,
20
- get() {
21
- return this[kCompleted];
18
+ Object.defineProperties(EventDefinitionExecution.prototype, {
19
+ completed: {
20
+ get() {
21
+ return this[kCompleted];
22
+ },
22
23
  },
23
- });
24
-
25
- Object.defineProperty(EventDefinitionExecution.prototype, 'stopped', {
26
- enumerable: true,
27
- get() {
28
- return this[kStopped];
24
+ stopped: {
25
+ get() {
26
+ return this[kStopped];
27
+ },
29
28
  },
30
29
  });
31
30
 
@@ -23,24 +23,22 @@ export default function TimerEventDefinition(activity, eventDefinition) {
23
23
  this[kTimer] = null;
24
24
  }
25
25
 
26
- Object.defineProperty(TimerEventDefinition.prototype, 'executionId', {
27
- get() {
28
- const content = this[kTimerContent];
29
- return content && content.executionId;
26
+ Object.defineProperties(TimerEventDefinition.prototype, {
27
+ executionId: {
28
+ get() {
29
+ const content = this[kTimerContent];
30
+ return content && content.executionId;
31
+ },
30
32
  },
31
- });
32
-
33
- Object.defineProperty(TimerEventDefinition.prototype, 'stopped', {
34
- enumerable: true,
35
- get() {
36
- return this[kStopped];
33
+ stopped: {
34
+ get() {
35
+ return this[kStopped];
36
+ },
37
37
  },
38
- });
39
-
40
- Object.defineProperty(TimerEventDefinition.prototype, 'timer', {
41
- enumerable: true,
42
- get() {
43
- return this[kTimer];
38
+ timer: {
39
+ get() {
40
+ return this[kTimer];
41
+ },
44
42
  },
45
43
  });
46
44
 
@@ -25,18 +25,18 @@ export function BoundaryEventBehaviour(activity) {
25
25
  this[kAttachedTags] = [];
26
26
  }
27
27
 
28
- Object.defineProperty(BoundaryEventBehaviour.prototype, 'executionId', {
29
- get() {
30
- const message = this[kExecuteMessage];
31
- return message && message.content.executionId;
28
+ Object.defineProperties(BoundaryEventBehaviour.prototype, {
29
+ executionId: {
30
+ get() {
31
+ const message = this[kExecuteMessage];
32
+ return message && message.content.executionId;
33
+ },
32
34
  },
33
- });
34
-
35
- Object.defineProperty(BoundaryEventBehaviour.prototype, 'cancelActivity', {
36
- enumerable: true,
37
- get() {
38
- const behaviour = this.activity.behaviour || {};
39
- return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
35
+ cancelActivity: {
36
+ get() {
37
+ const behaviour = this.activity.behaviour || {};
38
+ return 'cancelActivity' in behaviour ? behaviour.cancelActivity : true;
39
+ },
40
40
  },
41
41
  });
42
42
 
@@ -0,0 +1,5 @@
1
+ export * from './BoundaryEvent.js';
2
+ export * from './EndEvent.js';
3
+ export * from './IntermediateCatchEvent.js';
4
+ export * from './IntermediateThrowEvent.js';
5
+ export * from './StartEvent.js';
@@ -34,7 +34,6 @@ export default function Association(associationDef, {environment}) {
34
34
  }
35
35
 
36
36
  Object.defineProperty(Association.prototype, 'counters', {
37
- enumerable: true,
38
37
  get() {
39
38
  return {...this[kCounters]};
40
39
  },
@@ -35,7 +35,6 @@ export default function MessageFlow(flowDef, context) {
35
35
  }
36
36
 
37
37
  Object.defineProperty(MessageFlow.prototype, 'counters', {
38
- enumerable: true,
39
38
  get() {
40
39
  return {...this[kCounters]};
41
40
  },
@@ -41,7 +41,6 @@ function SequenceFlow(flowDef, {environment}) {
41
41
  }
42
42
 
43
43
  Object.defineProperty(SequenceFlow.prototype, 'counters', {
44
- enumerable: true,
45
44
  get() {
46
45
  return {...this[kCounters]};
47
46
  },
@@ -0,0 +1,4 @@
1
+ export * from './EventBasedGateway.js';
2
+ export * from './ExclusiveGateway.js';
3
+ export * from './InclusiveGateway.js';
4
+ export * from './ParallelGateway.js';