bpmn-elements 8.2.4 → 9.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 (127) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/{src/Api.js → Api.js} +11 -12
  4. package/dist/{src/Context.js → Context.js} +26 -27
  5. package/dist/{src/Environment.js → Environment.js} +15 -16
  6. package/dist/{src/EventBroker.js → EventBroker.js} +5 -1
  7. package/dist/{src/Expressions.js → Expressions.js} +1 -1
  8. package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
  9. package/dist/Tracker.js +89 -0
  10. package/dist/{src/activity → activity}/Activity.js +109 -120
  11. package/dist/{src/activity → activity}/ActivityExecution.js +28 -32
  12. package/dist/{src/activity → activity}/Dummy.js +1 -1
  13. package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
  14. package/dist/{src/definition → definition}/Definition.js +64 -59
  15. package/dist/{src/definition → definition}/DefinitionExecution.js +68 -46
  16. package/dist/{src/error → error}/Errors.js +1 -1
  17. package/dist/eventDefinitions/CancelEventDefinition.js +127 -0
  18. package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +64 -52
  19. package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +24 -16
  20. package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +15 -14
  21. package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
  22. package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
  23. package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
  24. package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
  25. package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
  26. package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
  27. package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
  28. package/dist/{src/events → events}/BoundaryEvent.js +39 -25
  29. package/dist/{src/events → events}/EndEvent.js +3 -3
  30. package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
  31. package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
  32. package/dist/{src/events → events}/StartEvent.js +8 -9
  33. package/dist/{src/flows → flows}/Association.js +14 -22
  34. package/dist/{src/flows → flows}/MessageFlow.js +16 -14
  35. package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
  36. package/dist/{src/gateways → gateways}/EventBasedGateway.js +3 -4
  37. package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
  38. package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
  39. package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
  40. package/dist/index.js +48 -48
  41. package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
  42. package/dist/{src/io → io}/Properties.js +7 -8
  43. package/dist/package.json +3 -0
  44. package/dist/{src/process → process}/Process.js +44 -40
  45. package/dist/{src/process → process}/ProcessExecution.js +169 -78
  46. package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
  47. package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
  48. package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
  49. package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
  50. package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
  51. package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
  52. package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
  53. package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
  54. package/dist/{src/tasks → tasks}/SubProcess.js +19 -19
  55. package/dist/{src/tasks → tasks}/Task.js +2 -2
  56. package/dist/{src/tasks → tasks}/Transaction.js +1 -1
  57. package/package.json +31 -31
  58. package/src/Api.js +11 -13
  59. package/src/Context.js +26 -28
  60. package/src/Environment.js +15 -17
  61. package/src/EventBroker.js +2 -1
  62. package/src/Expressions.js +1 -1
  63. package/src/MessageFormatter.js +3 -3
  64. package/src/Tracker.js +73 -0
  65. package/src/activity/Activity.js +106 -114
  66. package/src/activity/ActivityExecution.js +28 -32
  67. package/src/activity/Dummy.js +1 -1
  68. package/src/activity/ExecutionScope.js +2 -2
  69. package/src/definition/Definition.js +65 -64
  70. package/src/definition/DefinitionExecution.js +71 -47
  71. package/src/error/Errors.js +1 -1
  72. package/src/eventDefinitions/CancelEventDefinition.js +32 -78
  73. package/src/eventDefinitions/CompensateEventDefinition.js +58 -52
  74. package/src/eventDefinitions/ConditionalEventDefinition.js +25 -17
  75. package/src/eventDefinitions/ErrorEventDefinition.js +15 -15
  76. package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
  77. package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
  78. package/src/eventDefinitions/LinkEventDefinition.js +14 -16
  79. package/src/eventDefinitions/MessageEventDefinition.js +13 -15
  80. package/src/eventDefinitions/SignalEventDefinition.js +13 -15
  81. package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
  82. package/src/eventDefinitions/TimerEventDefinition.js +15 -17
  83. package/src/events/BoundaryEvent.js +34 -24
  84. package/src/events/EndEvent.js +3 -3
  85. package/src/events/IntermediateCatchEvent.js +3 -3
  86. package/src/events/IntermediateThrowEvent.js +3 -3
  87. package/src/events/StartEvent.js +8 -10
  88. package/src/flows/Association.js +14 -26
  89. package/src/flows/MessageFlow.js +14 -15
  90. package/src/flows/SequenceFlow.js +16 -20
  91. package/src/gateways/EventBasedGateway.js +3 -4
  92. package/src/gateways/ExclusiveGateway.js +2 -2
  93. package/src/gateways/InclusiveGateway.js +2 -2
  94. package/src/gateways/ParallelGateway.js +2 -2
  95. package/src/index.js +106 -0
  96. package/src/io/InputOutputSpecification.js +8 -10
  97. package/src/io/Properties.js +7 -9
  98. package/src/process/Process.js +45 -41
  99. package/src/process/ProcessExecution.js +167 -79
  100. package/src/tasks/CallActivity.js +7 -9
  101. package/src/tasks/LoopCharacteristics.js +2 -2
  102. package/src/tasks/ReceiveTask.js +215 -217
  103. package/src/tasks/ScriptTask.js +4 -4
  104. package/src/tasks/ServiceImplementation.js +1 -1
  105. package/src/tasks/ServiceTask.js +6 -8
  106. package/src/tasks/SignalTask.js +7 -9
  107. package/src/tasks/StandardLoopCharacteristics.js +1 -1
  108. package/src/tasks/SubProcess.js +19 -20
  109. package/src/tasks/Task.js +2 -2
  110. package/src/tasks/Transaction.js +1 -1
  111. package/types/index.d.ts +520 -0
  112. package/dist/src/eventDefinitions/CancelEventDefinition.js +0 -184
  113. package/index.js +0 -106
  114. /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
  115. /package/dist/{src/Scripts.js → Scripts.js} +0 -0
  116. /package/dist/{src/Timers.js → Timers.js} +0 -0
  117. /package/dist/{src/activity → activity}/Escalation.js +0 -0
  118. /package/dist/{src/activity → activity}/Message.js +0 -0
  119. /package/dist/{src/activity → activity}/Signal.js +0 -0
  120. /package/dist/{src/error → error}/BpmnError.js +0 -0
  121. /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
  122. /package/dist/{src/io → io}/BpmnIO.js +0 -0
  123. /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
  124. /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
  125. /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
  126. /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
  127. /package/dist/{src/shared.js → shared.js} +0 -0
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Process = Process;
7
7
  exports.default = void 0;
8
- var _ProcessExecution = _interopRequireDefault(require("./ProcessExecution"));
9
- var _shared = require("../shared");
10
- var _Api = require("../Api");
11
- var _EventBroker = require("../EventBroker");
12
- var _messageHelper = require("../messageHelper");
13
- var _Errors = require("../error/Errors");
8
+ var _ProcessExecution = _interopRequireDefault(require("./ProcessExecution.js"));
9
+ var _shared = require("../shared.js");
10
+ var _Api = require("../Api.js");
11
+ var _EventBroker = require("../EventBroker.js");
12
+ var _messageHelper = require("../messageHelper.js");
13
+ var _Errors = require("../error/Errors.js");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  const kConsuming = Symbol.for('consuming');
16
16
  const kCounters = Symbol.for('counters');
@@ -68,8 +68,7 @@ function Process(processDef, context) {
68
68
  this.logger = environment.Logger(type.toLowerCase());
69
69
  this[kExtensions] = context.loadExtensions(this);
70
70
  }
71
- const proto = Process.prototype;
72
- Object.defineProperty(proto, 'counters', {
71
+ Object.defineProperty(Process.prototype, 'counters', {
73
72
  enumerable: true,
74
73
  get() {
75
74
  return {
@@ -77,26 +76,26 @@ Object.defineProperty(proto, 'counters', {
77
76
  };
78
77
  }
79
78
  });
80
- Object.defineProperty(proto, 'extensions', {
79
+ Object.defineProperty(Process.prototype, 'extensions', {
81
80
  enumerable: true,
82
81
  get() {
83
82
  return this[kExtensions];
84
83
  }
85
84
  });
86
- Object.defineProperty(proto, 'stopped', {
85
+ Object.defineProperty(Process.prototype, 'stopped', {
87
86
  enumerable: true,
88
87
  get() {
89
88
  return this[kStopped];
90
89
  }
91
90
  });
92
- Object.defineProperty(proto, 'isRunning', {
91
+ Object.defineProperty(Process.prototype, 'isRunning', {
93
92
  enumerable: true,
94
93
  get() {
95
94
  if (!this[kConsuming]) return false;
96
95
  return !!this.status;
97
96
  }
98
97
  });
99
- Object.defineProperty(proto, 'executionId', {
98
+ Object.defineProperty(Process.prototype, 'executionId', {
100
99
  enumerable: true,
101
100
  get() {
102
101
  const {
@@ -106,19 +105,24 @@ Object.defineProperty(proto, 'executionId', {
106
105
  return executionId || initExecutionId;
107
106
  }
108
107
  });
109
- Object.defineProperty(proto, 'execution', {
108
+ Object.defineProperty(Process.prototype, 'execution', {
110
109
  enumerable: true,
111
110
  get() {
112
111
  return this[kExec].execution;
113
112
  }
114
113
  });
115
- Object.defineProperty(proto, 'status', {
114
+ Object.defineProperty(Process.prototype, 'status', {
116
115
  enumerable: true,
117
116
  get() {
118
117
  return this[kStatus];
119
118
  }
120
119
  });
121
- proto.init = function init(useAsExecutionId) {
120
+ Object.defineProperty(Process.prototype, 'activityStatus', {
121
+ get() {
122
+ return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
123
+ }
124
+ });
125
+ Process.prototype.init = function init(useAsExecutionId) {
122
126
  const exec = this[kExec];
123
127
  const initExecutionId = exec.initExecutionId = useAsExecutionId || (0, _shared.getUniqueId)(this.id);
124
128
  this._debug(`initialized with executionId <${initExecutionId}>`);
@@ -126,7 +130,7 @@ proto.init = function init(useAsExecutionId) {
126
130
  executionId: initExecutionId
127
131
  }));
128
132
  };
129
- proto.run = function run(runContent) {
133
+ Process.prototype.run = function run(runContent) {
130
134
  if (this.isRunning) throw new Error(`process <${this.id}> is already running`);
131
135
  const exec = this[kExec];
132
136
  const executionId = exec.executionId = exec.initExecutionId || (0, _shared.getUniqueId)(this.id);
@@ -141,7 +145,7 @@ proto.run = function run(runContent) {
141
145
  broker.publish('run', 'run.execute', (0, _messageHelper.cloneContent)(content));
142
146
  this._activateRunConsumers();
143
147
  };
144
- proto.resume = function resume() {
148
+ Process.prototype.resume = function resume() {
145
149
  if (this.isRunning) throw new Error(`cannot resume running process <${this.id}>`);
146
150
  if (!this.status) return this;
147
151
  this[kStopped] = false;
@@ -152,7 +156,7 @@ proto.resume = function resume() {
152
156
  this._activateRunConsumers();
153
157
  return this;
154
158
  };
155
- proto.recover = function recover(state) {
159
+ Process.prototype.recover = function recover(state) {
156
160
  if (this.isRunning) throw new Error(`cannot recover running process <${this.id}>`);
157
161
  if (!state) return this;
158
162
  this[kStopped] = !!state.stopped;
@@ -170,25 +174,25 @@ proto.recover = function recover(state) {
170
174
  this.broker.recover(state.broker);
171
175
  return this;
172
176
  };
173
- proto.shake = function shake(startId) {
177
+ Process.prototype.shake = function shake(startId) {
174
178
  if (this.isRunning) return this.execution.shake(startId);
175
179
  return new _ProcessExecution.default(this, this.context).shake(startId);
176
180
  };
177
- proto.stop = function stop() {
181
+ Process.prototype.stop = function stop() {
178
182
  if (!this.isRunning) return;
179
183
  this.getApi().stop();
180
184
  };
181
- proto.getApi = function getApi(message) {
185
+ Process.prototype.getApi = function getApi(message) {
182
186
  const execution = this.execution;
183
187
  if (execution) return execution.getApi(message);
184
188
  return (0, _Api.ProcessApi)(this.broker, message || this[kStateMessage]);
185
189
  };
186
- proto.signal = function signal(message) {
190
+ Process.prototype.signal = function signal(message) {
187
191
  return this.getApi().signal(message, {
188
192
  delegate: true
189
193
  });
190
194
  };
191
- proto.getState = function getState() {
195
+ Process.prototype.getState = function getState() {
192
196
  return this._createMessage({
193
197
  environment: this.environment.getState(),
194
198
  status: this.status,
@@ -198,12 +202,12 @@ proto.getState = function getState() {
198
202
  execution: this.execution && this.execution.getState()
199
203
  });
200
204
  };
201
- proto.cancelActivity = function cancelActivity(message) {
205
+ Process.prototype.cancelActivity = function cancelActivity(message) {
202
206
  return this.getApi().cancel(message, {
203
207
  delegate: true
204
208
  });
205
209
  };
206
- proto._activateRunConsumers = function activateRunConsumers() {
210
+ Process.prototype._activateRunConsumers = function activateRunConsumers() {
207
211
  this[kConsuming] = true;
208
212
  const broker = this.broker;
209
213
  const {
@@ -220,14 +224,14 @@ proto._activateRunConsumers = function activateRunConsumers() {
220
224
  consumerTag: '_process-run'
221
225
  });
222
226
  };
223
- proto._deactivateRunConsumers = function deactivateRunConsumers() {
227
+ Process.prototype._deactivateRunConsumers = function deactivateRunConsumers() {
224
228
  const broker = this.broker;
225
229
  broker.cancel('_process-api');
226
230
  broker.cancel('_process-run');
227
231
  broker.cancel('_process-execution');
228
232
  this[kConsuming] = false;
229
233
  };
230
- proto._onRunMessage = function onRunMessage(routingKey, message) {
234
+ Process.prototype._onRunMessage = function onRunMessage(routingKey, message) {
231
235
  const {
232
236
  content,
233
237
  fields
@@ -310,7 +314,7 @@ proto._onRunMessage = function onRunMessage(routingKey, message) {
310
314
  }
311
315
  message.ack();
312
316
  };
313
- proto._onResumeMessage = function onResumeMessage(message) {
317
+ Process.prototype._onResumeMessage = function onResumeMessage(message) {
314
318
  message.ack();
315
319
  const stateMessage = this[kStateMessage];
316
320
  switch (stateMessage.fields.routingKey) {
@@ -327,7 +331,7 @@ proto._onResumeMessage = function onResumeMessage(message) {
327
331
  this._debug(`resume from ${this.status}`);
328
332
  return this.broker.publish('run', stateMessage.fields.routingKey, (0, _messageHelper.cloneContent)(stateMessage.content), stateMessage.properties);
329
333
  };
330
- proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
334
+ Process.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
331
335
  const content = message.content;
332
336
  const messageType = message.properties.type;
333
337
  message.ack();
@@ -354,7 +358,7 @@ proto._onExecutionMessage = function onExecutionMessage(routingKey, message) {
354
358
  this[kExecuteMessage] = null;
355
359
  executeMessage.ack();
356
360
  };
357
- proto._publishEvent = function publishEvent(state, content) {
361
+ Process.prototype._publishEvent = function publishEvent(state, content) {
358
362
  const eventContent = this._createMessage({
359
363
  ...content,
360
364
  state
@@ -364,7 +368,7 @@ proto._publishEvent = function publishEvent(state, content) {
364
368
  mandatory: state === 'error'
365
369
  });
366
370
  };
367
- proto.sendMessage = function sendMessage(message) {
371
+ Process.prototype.sendMessage = function sendMessage(message) {
368
372
  const messageContent = message && message.content;
369
373
  if (!messageContent) return;
370
374
  let targetsFound = false;
@@ -382,30 +386,30 @@ proto.sendMessage = function sendMessage(message) {
382
386
  delegate: true
383
387
  });
384
388
  };
385
- proto.getActivityById = function getActivityById(childId) {
389
+ Process.prototype.getActivityById = function getActivityById(childId) {
386
390
  const execution = this.execution;
387
391
  if (execution) return execution.getActivityById(childId);
388
392
  return this.context.getActivityById(childId);
389
393
  };
390
- proto.getActivities = function getActivities() {
394
+ Process.prototype.getActivities = function getActivities() {
391
395
  const execution = this.execution;
392
396
  if (execution) return execution.getActivities();
393
397
  return this.context.getActivities(this.id);
394
398
  };
395
- proto.getStartActivities = function getStartActivities(filterOptions) {
399
+ Process.prototype.getStartActivities = function getStartActivities(filterOptions) {
396
400
  return this.context.getStartActivities(filterOptions, this.id);
397
401
  };
398
- proto.getSequenceFlows = function getSequenceFlows() {
402
+ Process.prototype.getSequenceFlows = function getSequenceFlows() {
399
403
  const execution = this.execution;
400
404
  if (execution) return execution.getSequenceFlows();
401
405
  return this.context.getSequenceFlows();
402
406
  };
403
- proto.getPostponed = function getPostponed(...args) {
407
+ Process.prototype.getPostponed = function getPostponed(...args) {
404
408
  const execution = this.execution;
405
409
  if (!execution) return [];
406
410
  return execution.getPostponed(...args);
407
411
  };
408
- proto._onApiMessage = function onApiMessage(routingKey, message) {
412
+ Process.prototype._onApiMessage = function onApiMessage(routingKey, message) {
409
413
  const messageType = message.properties.type;
410
414
  switch (messageType) {
411
415
  case 'stop':
@@ -416,12 +420,12 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
416
420
  }
417
421
  }
418
422
  };
419
- proto._onStop = function onStop() {
423
+ Process.prototype._onStop = function onStop() {
420
424
  this[kStopped] = true;
421
425
  this._deactivateRunConsumers();
422
426
  return this._publishEvent('stop');
423
427
  };
424
- proto._createMessage = function createMessage(override) {
428
+ Process.prototype._createMessage = function createMessage(override) {
425
429
  return {
426
430
  id: this.id,
427
431
  type: this.type,
@@ -433,6 +437,6 @@ proto._createMessage = function createMessage(override) {
433
437
  ...override
434
438
  };
435
439
  };
436
- proto._debug = function debug(msg) {
440
+ Process.prototype._debug = function debug(msg) {
437
441
  this.logger.debug(`<${this.id}> ${msg}`);
438
442
  };