bpmn-elements 12.0.0 → 13.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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/Environment.js +15 -15
  3. package/dist/activity/Activity.js +125 -142
  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 +3 -2
  12. package/dist/flows/MessageFlow.js +3 -2
  13. package/dist/flows/SequenceFlow.js +3 -2
  14. package/dist/gateways/index.js +49 -0
  15. package/dist/process/Process.js +53 -59
  16. package/dist/process/ProcessExecution.js +40 -35
  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 +39 -19
  23. package/src/Environment.js +16 -17
  24. package/src/activity/Activity.js +100 -132
  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 +4 -2
  33. package/src/flows/MessageFlow.js +4 -2
  34. package/src/flows/SequenceFlow.js +4 -2
  35. package/src/gateways/index.js +4 -0
  36. package/src/process/Process.js +40 -54
  37. package/src/process/ProcessExecution.js +37 -35
  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 +721 -0
@@ -60,68 +60,54 @@ export function Process(processDef, context) {
60
60
  this[kExtensions] = context.loadExtensions(this);
61
61
  }
62
62
 
63
- Object.defineProperty(Process.prototype, 'counters', {
64
- enumerable: true,
65
- get() {
66
- return {...this[kCounters]};
63
+ Object.defineProperties(Process.prototype, {
64
+ counters: {
65
+ get() {
66
+ return {...this[kCounters]};
67
+ },
67
68
  },
68
- });
69
-
70
- Object.defineProperty(Process.prototype, 'lanes', {
71
- enumerable: true,
72
- get() {
73
- const lanes = this[kLanes];
74
- return lanes && lanes.slice();
69
+ lanes: {
70
+ get() {
71
+ const lanes = this[kLanes];
72
+ return lanes && lanes.slice();
73
+ },
75
74
  },
76
- });
77
-
78
- Object.defineProperty(Process.prototype, 'extensions', {
79
- enumerable: true,
80
- get() {
81
- return this[kExtensions];
75
+ extensions: {
76
+ get() {
77
+ return this[kExtensions];
78
+ },
82
79
  },
83
- });
84
-
85
- Object.defineProperty(Process.prototype, 'stopped', {
86
- enumerable: true,
87
- get() {
88
- return this[kStopped];
80
+ stopped: {
81
+ get() {
82
+ return this[kStopped];
83
+ },
89
84
  },
90
- });
91
-
92
- Object.defineProperty(Process.prototype, 'isRunning', {
93
- enumerable: true,
94
- get() {
95
- if (!this[kConsuming]) return false;
96
- return !!this.status;
85
+ isRunning: {
86
+ get() {
87
+ if (!this[kConsuming]) return false;
88
+ return !!this.status;
89
+ },
97
90
  },
98
- });
99
-
100
- Object.defineProperty(Process.prototype, 'executionId', {
101
- enumerable: true,
102
- get() {
103
- const {executionId, initExecutionId} = this[kExec];
104
- return executionId || initExecutionId;
91
+ executionId: {
92
+ get() {
93
+ const {executionId, initExecutionId} = this[kExec];
94
+ return executionId || initExecutionId;
95
+ },
105
96
  },
106
- });
107
-
108
- Object.defineProperty(Process.prototype, 'execution', {
109
- enumerable: true,
110
- get() {
111
- return this[kExec].execution;
97
+ execution: {
98
+ get() {
99
+ return this[kExec].execution;
100
+ },
112
101
  },
113
- });
114
-
115
- Object.defineProperty(Process.prototype, 'status', {
116
- enumerable: true,
117
- get() {
118
- return this[kStatus];
102
+ status: {
103
+ get() {
104
+ return this[kStatus];
105
+ },
119
106
  },
120
- });
121
-
122
- Object.defineProperty(Process.prototype, 'activityStatus', {
123
- get() {
124
- return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
107
+ activityStatus: {
108
+ get() {
109
+ return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
110
+ },
125
111
  },
126
112
  });
127
113
 
@@ -58,42 +58,36 @@ function ProcessExecution(parentActivity, context) {
58
58
  };
59
59
  }
60
60
 
61
- Object.defineProperty(ProcessExecution.prototype, 'stopped', {
62
- enumerable: true,
63
- get() {
64
- return this[kStopped];
61
+ Object.defineProperties(ProcessExecution.prototype, {
62
+ stopped: {
63
+ get() {
64
+ return this[kStopped];
65
+ },
65
66
  },
66
- });
67
-
68
- Object.defineProperty(ProcessExecution.prototype, 'completed', {
69
- enumerable: true,
70
- get() {
71
- return this[kCompleted];
67
+ completed: {
68
+ get() {
69
+ return this[kCompleted];
70
+ },
72
71
  },
73
- });
74
-
75
- Object.defineProperty(ProcessExecution.prototype, 'status', {
76
- enumerable: true,
77
- get() {
78
- return this[kStatus];
72
+ status: {
73
+ get() {
74
+ return this[kStatus];
75
+ },
79
76
  },
80
- });
81
-
82
- Object.defineProperty(ProcessExecution.prototype, 'postponedCount', {
83
- get() {
84
- return this[kElements].postponed.length;
77
+ postponedCount: {
78
+ get() {
79
+ return this[kElements].postponed.length;
80
+ },
85
81
  },
86
- });
87
-
88
- Object.defineProperty(ProcessExecution.prototype, 'isRunning', {
89
- get() {
90
- return this[kActivated];
82
+ isRunning: {
83
+ get() {
84
+ return this[kActivated];
85
+ },
91
86
  },
92
- });
93
-
94
- Object.defineProperty(ProcessExecution.prototype, 'activityStatus', {
95
- get() {
96
- return this[kTracker].activityStatus;
87
+ activityStatus: {
88
+ get() {
89
+ return this[kTracker].activityStatus;
90
+ },
97
91
  },
98
92
  });
99
93
 
@@ -171,6 +165,13 @@ ProcessExecution.prototype.resume = function resume() {
171
165
 
172
166
  ProcessExecution.prototype.getState = function getState() {
173
167
  const {children, flows, outboundMessageFlows, associations} = this[kElements];
168
+
169
+ const flowStates = flows.reduce((result, flow) => {
170
+ const elmState = flow.getState();
171
+ if (elmState) result.push(elmState);
172
+ return result;
173
+ }, []);
174
+
174
175
  return {
175
176
  executionId: this.executionId,
176
177
  stopped: this[kStopped],
@@ -178,12 +179,13 @@ ProcessExecution.prototype.getState = function getState() {
178
179
  status: this.status,
179
180
  children: children.reduce((result, activity) => {
180
181
  if (activity.placeholder) return result;
181
- result.push(activity.getState());
182
+ const elmState = activity.getState();
183
+ if (elmState) result.push(elmState);
182
184
  return result;
183
185
  }, []),
184
- ...(flows.length && {flows: flows.map((f) => f.getState())}),
185
- ...(outboundMessageFlows.length && {messageFlows: outboundMessageFlows.length && outboundMessageFlows.map((f) => f.getState())}),
186
- ...(associations.length && {associations: associations.map((f) => f.getState())}),
186
+ ...(flows.length && { flows: flowStates }),
187
+ ...(outboundMessageFlows.length && { messageFlows: outboundMessageFlows.length && outboundMessageFlows.map((f) => f.getState()).filter(Boolean) }),
188
+ ...(associations.length && { associations: associations.map((f) => f.getState()).filter(Boolean) }),
187
189
  };
188
190
  };
189
191
 
@@ -44,12 +44,12 @@ export function SubProcessBehaviour(activity, context) {
44
44
  }
45
45
 
46
46
  Object.defineProperties(SubProcessBehaviour.prototype, {
47
- 'execution': {
47
+ execution: {
48
48
  get() {
49
49
  return this[kExecutions][0];
50
50
  },
51
51
  },
52
- 'executions': {
52
+ executions: {
53
53
  get() {
54
54
  return this[kExecutions].slice();
55
55
  },
@@ -0,0 +1,8 @@
1
+ export * from './CallActivity.js';
2
+ export * from './ReceiveTask.js';
3
+ export * from './ScriptTask.js';
4
+ export * from './ServiceTask.js';
5
+ export * from './SignalTask.js';
6
+ export * from './SubProcess.js';
7
+ export * from './Task.js';
8
+ export * from './Transaction.js';
package/tasks.d.ts ADDED
@@ -0,0 +1 @@
1
+ import './types/index.js';