bpmn-elements 8.1.0 → 8.2.1

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 (79) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/index.js +0 -49
  3. package/dist/src/Api.js +4 -19
  4. package/dist/src/Context.js +7 -36
  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 +32 -44
  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 +62 -294
  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 +8 -5
  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 +25 -36
  52. package/dist/src/io/Properties.js +15 -47
  53. package/dist/src/messageHelper.js +10 -23
  54. package/dist/src/process/Process.js +10 -112
  55. package/dist/src/process/ProcessExecution.js +14 -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 +1 -25
  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 +8 -8
  69. package/src/Context.js +7 -3
  70. package/src/ExtensionsMapper.js +35 -35
  71. package/src/activity/Activity.js +22 -51
  72. package/src/gateways/EventBasedGateway.js +0 -1
  73. package/src/io/BpmnIO.js +7 -0
  74. package/src/io/EnvironmentDataObject.js +1 -0
  75. package/src/io/InputOutputSpecification.js +17 -6
  76. package/src/io/Properties.js +9 -11
  77. package/src/process/ProcessExecution.js +2 -1
  78. package/src/tasks/ServiceTask.js +1 -3
  79. package/src/tasks/StandardLoopCharacteristics.js +0 -1
@@ -15,8 +15,14 @@ export default function IoSpecification(activity, ioSpecificationDef, context) {
15
15
 
16
16
  const proto = IoSpecification.prototype;
17
17
 
18
- proto.activate = function activate() {
18
+ proto.activate = function activate(message) {
19
19
  if (this[kConsuming]) return;
20
+ if (message && message.fields.redelivered && message.fields.routingKey === 'run.start') {
21
+ this._onFormatEnter();
22
+ }
23
+ if (message && message.fields.redelivered && message.fields.routingKey === 'run.end') {
24
+ this._onFormatComplete(message);
25
+ }
20
26
  this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
21
27
  };
22
28
 
@@ -117,7 +123,6 @@ proto._onFormatComplete = function formatOnComplete(message) {
117
123
  };
118
124
  result.sources.push(source);
119
125
 
120
-
121
126
  const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.target.dataObject.id');
122
127
  if (!dataObjectId) return result;
123
128
  const dataObject = context.getDataObjectById(dataObjectId);
@@ -143,8 +148,10 @@ proto._onFormatComplete = function formatOnComplete(message) {
143
148
  broker.publish('format', `${startRoutingKey}.begin`, {
144
149
  endRoutingKey,
145
150
  ioSpecification: {
146
- dataInputs: sources.map((input) => {
147
- return {...input};
151
+ ...(messageInputs && {
152
+ dataInputs: messageInputs.map((input) => {
153
+ return {...input};
154
+ }),
148
155
  }),
149
156
  dataOutputs: this._getDataOutputs(dataOutputs),
150
157
  },
@@ -155,8 +162,12 @@ proto._onFormatComplete = function formatOnComplete(message) {
155
162
 
156
163
  broker.publish('format', endRoutingKey, {
157
164
  ioSpecification: {
158
- dataInputs: sources,
159
- dataOutputs: this._getDataOutputs(dataOutputs),
165
+ ...(messageInputs && {
166
+ dataInputs: messageInputs.map((input) => {
167
+ return {...input};
168
+ }),
169
+ }),
170
+ dataOutputs: sources,
160
171
  },
161
172
  });
162
173
  });
@@ -13,7 +13,6 @@ export default function Properties(activity, propertiesDef, context) {
13
13
  dataOutputObjects: [],
14
14
  };
15
15
 
16
-
17
16
  for (const {id, ...def} of propertiesDef.values) {
18
17
  const source = {
19
18
  id,
@@ -62,6 +61,9 @@ const proto = Properties.prototype;
62
61
 
63
62
  proto.activate = function activate(message) {
64
63
  if (this[kConsuming]) return;
64
+ if (message.fields.redelivered && message.fields.routingKey === 'run.start') {
65
+ this._onActivityEvent('activity.enter', message);
66
+ }
65
67
 
66
68
  if (message.fields.redelivered && message.content.properties) {
67
69
  this._onActivityEvent('activity.extension.resume', message);
@@ -75,16 +77,12 @@ proto.deactivate = function deactivate() {
75
77
  };
76
78
 
77
79
  proto._onActivityEvent = function onActivityEvent(routingKey, message) {
78
- if (routingKey === 'activity.enter') {
79
- return this._formatOnEnter(message);
80
- }
81
-
82
- if (routingKey === 'activity.extension.resume') {
83
- return this._formatOnEnter(message);
84
- }
85
-
86
- if (routingKey === 'activity.execution.completed') {
87
- return this._formatOnComplete(message);
80
+ switch (routingKey) {
81
+ case 'activity.enter':
82
+ case 'activity.extension.resume':
83
+ return this._formatOnEnter(message);
84
+ case 'activity.execution.completed':
85
+ return this._formatOnComplete(message);
88
86
  }
89
87
  };
90
88
 
@@ -260,7 +260,6 @@ proto.discard = function discard() {
260
260
  }, {type: 'discard'});
261
261
  };
262
262
 
263
-
264
263
  proto.getState = function getState() {
265
264
  const {children, flows, outboundMessageFlows, associations} = this[kElements];
266
265
  return {
@@ -533,6 +532,8 @@ proto._onChildMessage = function onChildMessage(routingKey, message) {
533
532
  return msg.content.source && msg.content.source.executionId === content.executionId;
534
533
  });
535
534
  if (eventCaughtBy) {
535
+ this[kActivityQ].queueMessage({routingKey: 'activity.caught'}, cloneContent(content), message.properties);
536
+ message.ack();
536
537
  return this._debug('error was caught');
537
538
  }
538
539
  return this._complete('error', {error: content.error});
@@ -46,9 +46,7 @@ proto.execute = function execute(executeMessage) {
46
46
 
47
47
  proto.getService = function getService(message) {
48
48
  let Service = this.activity.behaviour.Service;
49
- if (!Service) {
50
- Service = this.environment.settings.enableDummyService ? DummyService : null;
51
- }
49
+ if (!Service && this.environment.settings.enableDummyService) Service = DummyService;
52
50
  return Service && new Service(this.activity, cloneMessage(message));
53
51
  };
54
52
 
@@ -5,4 +5,3 @@ export default function StandardLoopCharacteristics(activity, loopCharacteristic
5
5
  behaviour = {...behaviour, isSequential: true};
6
6
  return new LoopCharacteristics(activity, {...loopCharacteristics, behaviour});
7
7
  }
8
-