bpmn-elements 7.0.0 → 8.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 (68) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/src/Context.js +50 -40
  3. package/dist/src/Environment.js +39 -19
  4. package/dist/src/MessageFormatter.js +11 -11
  5. package/dist/src/activity/Activity.js +91 -91
  6. package/dist/src/activity/ActivityExecution.js +35 -35
  7. package/dist/src/definition/Definition.js +50 -50
  8. package/dist/src/definition/DefinitionExecution.js +114 -125
  9. package/dist/src/eventDefinitions/CancelEventDefinition.js +16 -16
  10. package/dist/src/eventDefinitions/CompensateEventDefinition.js +24 -24
  11. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  12. package/dist/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  13. package/dist/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  14. package/dist/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  15. package/dist/src/eventDefinitions/LinkEventDefinition.js +15 -15
  16. package/dist/src/eventDefinitions/MessageEventDefinition.js +23 -23
  17. package/dist/src/eventDefinitions/SignalEventDefinition.js +24 -24
  18. package/dist/src/eventDefinitions/TimerEventDefinition.js +21 -21
  19. package/dist/src/events/BoundaryEvent.js +20 -20
  20. package/dist/src/events/EndEvent.js +3 -3
  21. package/dist/src/events/IntermediateCatchEvent.js +3 -3
  22. package/dist/src/events/IntermediateThrowEvent.js +3 -3
  23. package/dist/src/events/StartEvent.js +9 -9
  24. package/dist/src/flows/Association.js +7 -7
  25. package/dist/src/flows/MessageFlow.js +9 -9
  26. package/dist/src/flows/SequenceFlow.js +7 -7
  27. package/dist/src/gateways/EventBasedGateway.js +11 -11
  28. package/dist/src/io/InputOutputSpecification.js +4 -4
  29. package/dist/src/io/Properties.js +9 -9
  30. package/dist/src/process/Process.js +64 -61
  31. package/dist/src/process/ProcessExecution.js +93 -90
  32. package/dist/src/tasks/ReceiveTask.js +16 -16
  33. package/dist/src/tasks/SubProcess.js +16 -18
  34. package/package.json +9 -9
  35. package/src/Context.js +48 -40
  36. package/src/Environment.js +48 -20
  37. package/src/EventBroker.js +1 -1
  38. package/src/MessageFormatter.js +11 -11
  39. package/src/activity/Activity.js +91 -91
  40. package/src/activity/ActivityExecution.js +34 -34
  41. package/src/definition/Definition.js +51 -50
  42. package/src/definition/DefinitionExecution.js +111 -113
  43. package/src/eventDefinitions/CancelEventDefinition.js +16 -16
  44. package/src/eventDefinitions/CompensateEventDefinition.js +25 -24
  45. package/src/eventDefinitions/ConditionalEventDefinition.js +8 -8
  46. package/src/eventDefinitions/ErrorEventDefinition.js +26 -26
  47. package/src/eventDefinitions/EscalationEventDefinition.js +20 -20
  48. package/src/eventDefinitions/EventDefinitionExecution.js +14 -14
  49. package/src/eventDefinitions/LinkEventDefinition.js +15 -15
  50. package/src/eventDefinitions/MessageEventDefinition.js +23 -23
  51. package/src/eventDefinitions/SignalEventDefinition.js +24 -24
  52. package/src/eventDefinitions/TimerEventDefinition.js +21 -21
  53. package/src/events/BoundaryEvent.js +20 -20
  54. package/src/events/EndEvent.js +3 -3
  55. package/src/events/IntermediateCatchEvent.js +3 -3
  56. package/src/events/IntermediateThrowEvent.js +3 -3
  57. package/src/events/StartEvent.js +9 -9
  58. package/src/flows/Association.js +7 -7
  59. package/src/flows/MessageFlow.js +9 -9
  60. package/src/flows/SequenceFlow.js +7 -7
  61. package/src/gateways/EventBasedGateway.js +11 -11
  62. package/src/io/BpmnIO.js +5 -1
  63. package/src/io/InputOutputSpecification.js +4 -4
  64. package/src/io/Properties.js +9 -9
  65. package/src/process/Process.js +62 -58
  66. package/src/process/ProcessExecution.js +86 -88
  67. package/src/tasks/ReceiveTask.js +16 -16
  68. package/src/tasks/SubProcess.js +16 -16
@@ -2,8 +2,8 @@ import Activity from '../activity/Activity';
2
2
  import ProcessExecution from '../process/ProcessExecution';
3
3
  import {cloneContent} from '../messageHelper';
4
4
 
5
- const executionsSymbol = Symbol.for('executions');
6
- const messageHandlersSymbol = Symbol.for('messageHandlers');
5
+ const kExecutions = Symbol.for('executions');
6
+ const kMessageHandlers = Symbol.for('messageHandlers');
7
7
 
8
8
  export default function SubProcess(activityDef, context) {
9
9
  const triggeredByEvent = activityDef.behaviour && activityDef.behaviour.triggeredByEvent;
@@ -37,8 +37,8 @@ export function SubProcessBehaviour(activity, context) {
37
37
  this.broker = activity.broker;
38
38
  this.executionId = undefined;
39
39
 
40
- this[executionsSymbol] = [];
41
- this[messageHandlersSymbol] = {
40
+ this[kExecutions] = [];
41
+ this[kMessageHandlers] = {
42
42
  onApiRootMessage: this._onApiRootMessage.bind(this),
43
43
  onExecutionCompleted: this._onExecutionCompleted.bind(this),
44
44
  };
@@ -48,13 +48,13 @@ const proto = SubProcessBehaviour.prototype;
48
48
 
49
49
  Object.defineProperty(proto, 'execution', {
50
50
  get() {
51
- return this[executionsSymbol][0];
51
+ return this[kExecutions][0];
52
52
  },
53
53
  });
54
54
 
55
55
  Object.defineProperty(proto, 'executions', {
56
56
  get() {
57
- return this[executionsSymbol].slice();
57
+ return this[kExecutions].slice();
58
58
  },
59
59
  });
60
60
 
@@ -68,7 +68,7 @@ proto.execute = function execute(executeMessage) {
68
68
 
69
69
  const loopCharacteristics = this.loopCharacteristics;
70
70
  if (loopCharacteristics && content.isRootScope) {
71
- this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[messageHandlersSymbol].onApiRootMessage, {
71
+ this.broker.subscribeTmp('api', `activity.#.${executionId}`, this[kMessageHandlers].onApiRootMessage, {
72
72
  noAck: true,
73
73
  consumerTag: `_api-${executionId}`,
74
74
  priority: 200,
@@ -84,7 +84,7 @@ proto.execute = function execute(executeMessage) {
84
84
  };
85
85
 
86
86
  proto.stop = function stop() {
87
- for (const execution of this[executionsSymbol]) {
87
+ for (const execution of this[kExecutions]) {
88
88
  this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
89
89
  this.broker.cancel(`_sub-process-api-${execution.executionId}`);
90
90
  execution.stop();
@@ -92,7 +92,7 @@ proto.stop = function stop() {
92
92
  };
93
93
 
94
94
  proto.discard = function discard() {
95
- for (const execution of this[executionsSymbol]) {
95
+ for (const execution of this[kExecutions]) {
96
96
  this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
97
97
  this.broker.cancel(`_sub-process-api-${execution.executionId}`);
98
98
  execution.discard();
@@ -102,7 +102,7 @@ proto.discard = function discard() {
102
102
  proto.getState = function getState() {
103
103
  if (this.loopCharacteristics) {
104
104
  return {
105
- executions: this[executionsSymbol].map((pe) => {
105
+ executions: this[kExecutions].map((pe) => {
106
106
  const state = pe.getState();
107
107
  state.environment = pe.environment.getState();
108
108
  return state;
@@ -121,7 +121,7 @@ proto.getState = function getState() {
121
121
  proto.recover = function recover(state) {
122
122
  if (!state) return;
123
123
 
124
- const executions = this[executionsSymbol];
124
+ const executions = this[kExecutions];
125
125
 
126
126
  const loopCharacteristics = this.loopCharacteristics;
127
127
  if (loopCharacteristics && state.executions) {
@@ -146,7 +146,7 @@ proto.recover = function recover(state) {
146
146
  };
147
147
 
148
148
  proto.getPostponed = function getPostponed() {
149
- return this[executionsSymbol].reduce((result, pe) => {
149
+ return this[kExecutions].reduce((result, pe) => {
150
150
  result = result.concat(pe.getPostponed());
151
151
  return result;
152
152
  }, []);
@@ -177,11 +177,11 @@ proto._upsertExecution = function upsertExecution(executeMessage) {
177
177
  return execution;
178
178
  }
179
179
 
180
- const subEnvironment = this.environment.clone({ output: {} });
180
+ const subEnvironment = this.environment.clone();
181
181
  const subContext = this.context.clone(subEnvironment);
182
182
 
183
183
  execution = new ProcessExecution(this.activity, subContext);
184
- this[executionsSymbol].push(execution);
184
+ this[kExecutions].push(execution);
185
185
 
186
186
  this._addListeners(execution, executionId);
187
187
 
@@ -189,7 +189,7 @@ proto._upsertExecution = function upsertExecution(executeMessage) {
189
189
  };
190
190
 
191
191
  proto._addListeners = function addListeners(processExecution, executionId) {
192
- this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[messageHandlersSymbol].onExecutionCompleted, {
192
+ this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[kMessageHandlers].onExecutionCompleted, {
193
193
  noAck: true,
194
194
  consumerTag: `_sub-process-execution-${executionId}`,
195
195
  });
@@ -245,5 +245,5 @@ proto.getApi = function getApi(apiMessage) {
245
245
  };
246
246
 
247
247
  proto._getExecutionById = function getExecutionById(executionId) {
248
- return this[executionsSymbol].find((pe) => pe.executionId === executionId);
248
+ return this[kExecutions].find((pe) => pe.executionId === executionId);
249
249
  };