bpmn-elements 8.2.4 → 9.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 (123) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/{src/Api.js → Api.js} +11 -12
  3. package/dist/{src/Context.js → Context.js} +26 -27
  4. package/dist/{src/Environment.js → Environment.js} +15 -16
  5. package/dist/{src/EventBroker.js → EventBroker.js} +1 -1
  6. package/dist/{src/Expressions.js → Expressions.js} +1 -1
  7. package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
  8. package/dist/{src/activity → activity}/Activity.js +62 -63
  9. package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
  10. package/dist/{src/activity → activity}/Dummy.js +1 -1
  11. package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
  12. package/dist/{src/definition → definition}/Definition.js +41 -42
  13. package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
  14. package/dist/{src/error → error}/Errors.js +1 -1
  15. package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
  16. package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
  17. package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
  18. package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
  19. package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
  20. package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
  21. package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
  22. package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
  23. package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
  24. package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
  25. package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
  26. package/dist/{src/events → events}/BoundaryEvent.js +15 -16
  27. package/dist/{src/events → events}/EndEvent.js +3 -3
  28. package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
  29. package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
  30. package/dist/{src/events → events}/StartEvent.js +8 -9
  31. package/dist/{src/flows → flows}/Association.js +15 -16
  32. package/dist/{src/flows → flows}/MessageFlow.js +16 -14
  33. package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
  34. package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
  35. package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
  36. package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
  37. package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
  38. package/dist/index.js +48 -48
  39. package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
  40. package/dist/{src/io → io}/Properties.js +7 -8
  41. package/dist/package.json +3 -0
  42. package/dist/{src/process → process}/Process.js +39 -40
  43. package/dist/{src/process → process}/ProcessExecution.js +42 -43
  44. package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
  45. package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
  46. package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
  47. package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
  48. package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
  49. package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
  50. package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
  51. package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
  52. package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
  53. package/dist/{src/tasks → tasks}/Task.js +2 -2
  54. package/dist/{src/tasks → tasks}/Transaction.js +1 -1
  55. package/package.json +30 -30
  56. package/src/Api.js +11 -13
  57. package/src/Context.js +26 -28
  58. package/src/Environment.js +15 -17
  59. package/src/EventBroker.js +1 -1
  60. package/src/Expressions.js +1 -1
  61. package/src/MessageFormatter.js +3 -3
  62. package/src/activity/Activity.js +62 -64
  63. package/src/activity/ActivityExecution.js +23 -25
  64. package/src/activity/Dummy.js +1 -1
  65. package/src/activity/ExecutionScope.js +2 -2
  66. package/src/definition/Definition.js +41 -43
  67. package/src/definition/DefinitionExecution.js +45 -47
  68. package/src/error/Errors.js +1 -1
  69. package/src/eventDefinitions/CancelEventDefinition.js +12 -14
  70. package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
  71. package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
  72. package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
  73. package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
  74. package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
  75. package/src/eventDefinitions/LinkEventDefinition.js +14 -16
  76. package/src/eventDefinitions/MessageEventDefinition.js +13 -15
  77. package/src/eventDefinitions/SignalEventDefinition.js +13 -15
  78. package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
  79. package/src/eventDefinitions/TimerEventDefinition.js +15 -17
  80. package/src/events/BoundaryEvent.js +15 -17
  81. package/src/events/EndEvent.js +3 -3
  82. package/src/events/IntermediateCatchEvent.js +3 -3
  83. package/src/events/IntermediateThrowEvent.js +3 -3
  84. package/src/events/StartEvent.js +8 -10
  85. package/src/flows/Association.js +15 -17
  86. package/src/flows/MessageFlow.js +14 -15
  87. package/src/flows/SequenceFlow.js +16 -20
  88. package/src/gateways/EventBasedGateway.js +2 -2
  89. package/src/gateways/ExclusiveGateway.js +2 -2
  90. package/src/gateways/InclusiveGateway.js +2 -2
  91. package/src/gateways/ParallelGateway.js +2 -2
  92. package/src/index.js +106 -0
  93. package/src/io/InputOutputSpecification.js +8 -10
  94. package/src/io/Properties.js +7 -9
  95. package/src/process/Process.js +39 -41
  96. package/src/process/ProcessExecution.js +42 -44
  97. package/src/tasks/CallActivity.js +7 -9
  98. package/src/tasks/LoopCharacteristics.js +2 -2
  99. package/src/tasks/ReceiveTask.js +215 -217
  100. package/src/tasks/ScriptTask.js +4 -4
  101. package/src/tasks/ServiceImplementation.js +1 -1
  102. package/src/tasks/ServiceTask.js +6 -8
  103. package/src/tasks/SignalTask.js +7 -9
  104. package/src/tasks/StandardLoopCharacteristics.js +1 -1
  105. package/src/tasks/SubProcess.js +17 -19
  106. package/src/tasks/Task.js +2 -2
  107. package/src/tasks/Transaction.js +1 -1
  108. package/types/index.d.ts +491 -0
  109. package/index.js +0 -106
  110. /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
  111. /package/dist/{src/Scripts.js → Scripts.js} +0 -0
  112. /package/dist/{src/Timers.js → Timers.js} +0 -0
  113. /package/dist/{src/activity → activity}/Escalation.js +0 -0
  114. /package/dist/{src/activity → activity}/Message.js +0 -0
  115. /package/dist/{src/activity → activity}/Signal.js +0 -0
  116. /package/dist/{src/error → error}/BpmnError.js +0 -0
  117. /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
  118. /package/dist/{src/io → io}/BpmnIO.js +0 -0
  119. /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
  120. /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
  121. /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
  122. /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
  123. /package/dist/{src/shared.js → shared.js} +0 -0
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ReceiveTaskBehaviour = ReceiveTaskBehaviour;
7
7
  exports.default = ReceiveTask;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _messageHelper = require("../messageHelper.js");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const kCompleted = Symbol.for('completed');
12
12
  const kExecuteMessage = Symbol.for('executeMessage');
@@ -59,8 +59,7 @@ function ReceiveTaskExecution(parent) {
59
59
  this.referenceElement = parent[kReferenceElement];
60
60
  this[kCompleted] = false;
61
61
  }
62
- const proto = ReceiveTaskExecution.prototype;
63
- proto.execute = function execute(executeMessage) {
62
+ ReceiveTaskExecution.prototype.execute = function execute(executeMessage) {
64
63
  this[kExecuteMessage] = executeMessage;
65
64
  const executeContent = executeMessage.content;
66
65
  const {
@@ -94,7 +93,7 @@ proto.execute = function execute(executeMessage) {
94
93
  }
95
94
  }));
96
95
  };
97
- proto._onCatchMessage = function onCatchMessage(routingKey, message) {
96
+ ReceiveTaskExecution.prototype._onCatchMessage = function onCatchMessage(routingKey, message) {
98
97
  const content = message.content;
99
98
  const {
100
99
  id: signalId,
@@ -135,7 +134,7 @@ proto._onCatchMessage = function onCatchMessage(routingKey, message) {
135
134
  correlationId
136
135
  });
137
136
  };
138
- proto._onApiMessage = function onApiMessage(routingKey, message) {
137
+ ReceiveTaskExecution.prototype._onApiMessage = function onApiMessage(routingKey, message) {
139
138
  const {
140
139
  type: messageType,
141
140
  correlationId
@@ -162,20 +161,20 @@ proto._onApiMessage = function onApiMessage(routingKey, message) {
162
161
  }
163
162
  }
164
163
  };
165
- proto._complete = function complete(output, options) {
164
+ ReceiveTaskExecution.prototype._complete = function complete(output, options) {
166
165
  this[kCompleted] = true;
167
166
  this._stop();
168
167
  return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(this[kExecuteMessage].content, {
169
168
  output
170
169
  }), options);
171
170
  };
172
- proto._stop = function stop() {
171
+ ReceiveTaskExecution.prototype._stop = function stop() {
173
172
  const broker = this.broker,
174
173
  executionId = this.executionId;
175
174
  broker.cancel(`_onmessage-${executionId}`);
176
175
  broker.cancel(`_api-${executionId}`);
177
176
  };
178
- proto._setupMessageHandling = function setupMessageHandling(executionId) {
177
+ ReceiveTaskExecution.prototype._setupMessageHandling = function setupMessageHandling(executionId) {
179
178
  const broker = this.broker;
180
179
  broker.subscribeTmp('api', '#.signal.*', this._onDelegateMessage.bind(this), {
181
180
  noAck: true,
@@ -195,14 +194,14 @@ proto._setupMessageHandling = function setupMessageHandling(executionId) {
195
194
  noAck: true
196
195
  });
197
196
  };
198
- proto._onDelegateMessage = function onDelegateMessage(_, message) {
197
+ ReceiveTaskExecution.prototype._onDelegateMessage = function onDelegateMessage(_, message) {
199
198
  if (!message.properties.delegate) return;
200
199
  this.broker.sendToQueue('message', message.content, message.properties);
201
200
  };
202
- proto._onStopApiMessage = function onStopApiMessage() {
201
+ ReceiveTaskExecution.prototype._onStopApiMessage = function onStopApiMessage() {
203
202
  this._stopMessageHandling(true);
204
203
  };
205
- proto._onExecutionComplete = function onExecutionComplete(routingKey, {
204
+ ReceiveTaskExecution.prototype._onExecutionComplete = function onExecutionComplete(routingKey, {
206
205
  content
207
206
  }) {
208
207
  if (!content.isRootScope) return;
@@ -214,7 +213,7 @@ proto._onExecutionComplete = function onExecutionComplete(routingKey, {
214
213
  break;
215
214
  }
216
215
  };
217
- proto._stopMessageHandling = function stop(keepMessageQ) {
216
+ ReceiveTaskExecution.prototype._stopMessageHandling = function stop(keepMessageQ) {
218
217
  const broker = this.broker,
219
218
  executionId = this.executionId;
220
219
  broker.cancel(`_api-delegated-${executionId}`);
@@ -222,7 +221,7 @@ proto._stopMessageHandling = function stop(keepMessageQ) {
222
221
  broker.cancel(`_execution-complete-${executionId}`);
223
222
  if (!keepMessageQ) broker.purgeQueue('message');
224
223
  };
225
- proto._getReferenceInfo = function getReferenceInfo(message) {
224
+ ReceiveTaskExecution.prototype._getReferenceInfo = function getReferenceInfo(message) {
226
225
  const referenceElement = this.referenceElement;
227
226
  if (!referenceElement) {
228
227
  return {
@@ -238,6 +237,6 @@ proto._getReferenceInfo = function getReferenceInfo(message) {
238
237
  result.description = `${result.message.name} <${result.message.id}>`;
239
238
  return result;
240
239
  };
241
- proto._debug = function debug(msg) {
240
+ ReceiveTaskExecution.prototype._debug = function debug(msg) {
242
241
  this.logger.debug(`<${this.executionId} (${this.id})> ${msg}`);
243
242
  };
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ScriptTaskBehaviour = ScriptTaskBehaviour;
7
7
  exports.default = ScriptTask;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _ExecutionScope = _interopRequireDefault(require("../activity/ExecutionScope"));
10
- var _Errors = require("../error/Errors");
11
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _ExecutionScope = _interopRequireDefault(require("../activity/ExecutionScope.js"));
10
+ var _Errors = require("../error/Errors.js");
11
+ var _messageHelper = require("../messageHelper.js");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function ScriptTask(activityDef, context) {
14
14
  return new _Activity.default(ScriptTaskBehaviour, activityDef, context);
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = ServiceImplementation;
7
- var _ExecutionScope = _interopRequireDefault(require("../activity/ExecutionScope"));
7
+ var _ExecutionScope = _interopRequireDefault(require("../activity/ExecutionScope.js"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
9
  function ServiceImplementation(activity) {
10
10
  this.type = `${activity.type}:implementation`;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ServiceTaskBehaviour = ServiceTaskBehaviour;
7
7
  exports.default = ServiceTask;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _Errors = require("../error/Errors");
10
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _Errors = require("../error/Errors.js");
10
+ var _messageHelper = require("../messageHelper.js");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  function ServiceTask(activityDef, context) {
13
13
  return new _Activity.default(ServiceTaskBehaviour, activityDef, context);
@@ -25,8 +25,7 @@ function ServiceTaskBehaviour(activity) {
25
25
  this.environment = activity.environment;
26
26
  this.broker = activity.broker;
27
27
  }
28
- const proto = ServiceTaskBehaviour.prototype;
29
- proto.execute = function execute(executeMessage) {
28
+ ServiceTaskBehaviour.prototype.execute = function execute(executeMessage) {
30
29
  const executeContent = executeMessage.content;
31
30
  const loopCharacteristics = this.loopCharacteristics;
32
31
  if (loopCharacteristics && executeContent.isRootScope) {
@@ -55,12 +54,12 @@ proto.execute = function execute(executeMessage) {
55
54
  }));
56
55
  });
57
56
  };
58
- proto.getService = function getService(message) {
57
+ ServiceTaskBehaviour.prototype.getService = function getService(message) {
59
58
  let Service = this.activity.behaviour.Service;
60
59
  if (!Service && this.environment.settings.enableDummyService) Service = DummyService;
61
60
  return Service && new Service(this.activity, (0, _messageHelper.cloneMessage)(message));
62
61
  };
63
- proto._onApiMessage = function onApiMessage(executeMessage, _, message) {
62
+ ServiceTaskBehaviour.prototype._onApiMessage = function onApiMessage(executeMessage, _, message) {
64
63
  const broker = this.broker;
65
64
  switch (message.properties.type) {
66
65
  case 'discard':
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SignalTaskBehaviour = SignalTaskBehaviour;
7
7
  exports.default = SignalTask;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _Errors = require("../error/Errors");
10
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _Errors = require("../error/Errors.js");
10
+ var _messageHelper = require("../messageHelper.js");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  function SignalTask(activityDef, context) {
13
13
  return new _Activity.default(SignalTaskBehaviour, activityDef, context);
@@ -24,8 +24,7 @@ function SignalTaskBehaviour(activity) {
24
24
  this.activity = activity;
25
25
  this.broker = activity.broker;
26
26
  }
27
- const proto = SignalTaskBehaviour.prototype;
28
- proto.execute = function execute(executeMessage) {
27
+ SignalTaskBehaviour.prototype.execute = function execute(executeMessage) {
29
28
  const executeContent = executeMessage.content;
30
29
  const loopCharacteristics = this.loopCharacteristics;
31
30
  if (loopCharacteristics && executeContent.isRootScope) {
@@ -45,7 +44,7 @@ proto.execute = function execute(executeMessage) {
45
44
  state: 'wait'
46
45
  }));
47
46
  };
48
- proto._onDelegatedApiMessage = function onDelegatedApiMessage(executeMessage, routingKey, message) {
47
+ SignalTaskBehaviour.prototype._onDelegatedApiMessage = function onDelegatedApiMessage(executeMessage, routingKey, message) {
49
48
  if (!message.properties.delegate) return;
50
49
  const {
51
50
  content: delegateContent
@@ -72,7 +71,7 @@ proto._onDelegatedApiMessage = function onDelegatedApiMessage(executeMessage, ro
72
71
  });
73
72
  return this._onApiMessage(executeMessage, routingKey, message);
74
73
  };
75
- proto._onApiMessage = function onApiMessage(executeMessage, routingKey, message) {
74
+ SignalTaskBehaviour.prototype._onApiMessage = function onApiMessage(executeMessage, routingKey, message) {
76
75
  const {
77
76
  type: messageType,
78
77
  correlationId
@@ -104,7 +103,7 @@ proto._onApiMessage = function onApiMessage(executeMessage, routingKey, message)
104
103
  });
105
104
  }
106
105
  };
107
- proto._stop = function stop(executionId) {
106
+ SignalTaskBehaviour.prototype._stop = function stop(executionId) {
108
107
  const broker = this.broker;
109
108
  broker.cancel(`_api-${executionId}`);
110
109
  broker.cancel(`_api-delegated-${executionId}`);
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = StandardLoopCharacteristics;
7
- var _LoopCharacteristics = _interopRequireDefault(require("./LoopCharacteristics"));
7
+ var _LoopCharacteristics = _interopRequireDefault(require("./LoopCharacteristics.js"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
9
  function StandardLoopCharacteristics(activity, loopCharacteristics) {
10
10
  let {
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SubProcessBehaviour = SubProcessBehaviour;
7
7
  exports.default = SubProcess;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _ProcessExecution = _interopRequireDefault(require("../process/ProcessExecution"));
10
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _ProcessExecution = _interopRequireDefault(require("../process/ProcessExecution.js"));
10
+ var _messageHelper = require("../messageHelper.js");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  const kExecutions = Symbol.for('executions');
13
13
  const kMessageHandlers = Symbol.for('messageHandlers');
@@ -60,18 +60,17 @@ function SubProcessBehaviour(activity, context) {
60
60
  onExecutionCompleted: this._onExecutionCompleted.bind(this)
61
61
  };
62
62
  }
63
- const proto = SubProcessBehaviour.prototype;
64
- Object.defineProperty(proto, 'execution', {
63
+ Object.defineProperty(SubProcessBehaviour.prototype, 'execution', {
65
64
  get() {
66
65
  return this[kExecutions][0];
67
66
  }
68
67
  });
69
- Object.defineProperty(proto, 'executions', {
68
+ Object.defineProperty(SubProcessBehaviour.prototype, 'executions', {
70
69
  get() {
71
70
  return this[kExecutions].slice();
72
71
  }
73
72
  });
74
- proto.execute = function execute(executeMessage) {
73
+ SubProcessBehaviour.prototype.execute = function execute(executeMessage) {
75
74
  const content = executeMessage.content;
76
75
  let executionId = this.executionId;
77
76
  if (content.isRootScope) {
@@ -90,21 +89,21 @@ proto.execute = function execute(executeMessage) {
90
89
  if (!processExecution) return;
91
90
  return processExecution.execute(executeMessage);
92
91
  };
93
- proto.stop = function stop() {
92
+ SubProcessBehaviour.prototype.stop = function stop() {
94
93
  for (const execution of this[kExecutions]) {
95
94
  this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
96
95
  this.broker.cancel(`_sub-process-api-${execution.executionId}`);
97
96
  execution.stop();
98
97
  }
99
98
  };
100
- proto.discard = function discard() {
99
+ SubProcessBehaviour.prototype.discard = function discard() {
101
100
  for (const execution of this[kExecutions]) {
102
101
  this.broker.cancel(`_sub-process-execution-${execution.executionId}`);
103
102
  this.broker.cancel(`_sub-process-api-${execution.executionId}`);
104
103
  execution.discard();
105
104
  }
106
105
  };
107
- proto.getState = function getState() {
106
+ SubProcessBehaviour.prototype.getState = function getState() {
108
107
  if (this.loopCharacteristics) {
109
108
  return {
110
109
  executions: this[kExecutions].map(pe => {
@@ -121,7 +120,7 @@ proto.getState = function getState() {
121
120
  return state;
122
121
  }
123
122
  };
124
- proto.recover = function recover(state) {
123
+ SubProcessBehaviour.prototype.recover = function recover(state) {
125
124
  if (!state) return;
126
125
  const executions = this[kExecutions];
127
126
  const loopCharacteristics = this.loopCharacteristics;
@@ -141,13 +140,13 @@ proto.recover = function recover(state) {
141
140
  executions.push(execution);
142
141
  return execution;
143
142
  };
144
- proto.getPostponed = function getPostponed() {
143
+ SubProcessBehaviour.prototype.getPostponed = function getPostponed() {
145
144
  return this[kExecutions].reduce((result, pe) => {
146
145
  result = result.concat(pe.getPostponed());
147
146
  return result;
148
147
  }, []);
149
148
  };
150
- proto._onApiRootMessage = function onApiRootMessage(_, message) {
149
+ SubProcessBehaviour.prototype._onApiRootMessage = function onApiRootMessage(_, message) {
151
150
  const messageType = message.properties.type;
152
151
  switch (messageType) {
153
152
  case 'stop':
@@ -160,7 +159,7 @@ proto._onApiRootMessage = function onApiRootMessage(_, message) {
160
159
  break;
161
160
  }
162
161
  };
163
- proto._upsertExecution = function upsertExecution(executeMessage) {
162
+ SubProcessBehaviour.prototype._upsertExecution = function upsertExecution(executeMessage) {
164
163
  const content = executeMessage.content;
165
164
  const executionId = content.executionId;
166
165
  let execution = this._getExecutionById(executionId);
@@ -175,13 +174,13 @@ proto._upsertExecution = function upsertExecution(executeMessage) {
175
174
  this._addListeners(execution, executionId);
176
175
  return execution;
177
176
  };
178
- proto._addListeners = function addListeners(processExecution, executionId) {
177
+ SubProcessBehaviour.prototype._addListeners = function addListeners(processExecution, executionId) {
179
178
  this.broker.subscribeTmp('subprocess-execution', `execution.#.${executionId}`, this[kMessageHandlers].onExecutionCompleted, {
180
179
  noAck: true,
181
180
  consumerTag: `_sub-process-execution-${executionId}`
182
181
  });
183
182
  };
184
- proto._onExecutionCompleted = function onExecutionCompleted(_, message) {
183
+ SubProcessBehaviour.prototype._onExecutionCompleted = function onExecutionCompleted(_, message) {
185
184
  if (message.fields.redelivered && message.properties.persistent === false) return;
186
185
  const content = message.content;
187
186
  const messageType = message.properties.type;
@@ -216,7 +215,7 @@ proto._onExecutionCompleted = function onExecutionCompleted(_, message) {
216
215
  }
217
216
  }
218
217
  };
219
- proto.getApi = function getApi(apiMessage) {
218
+ SubProcessBehaviour.prototype.getApi = function getApi(apiMessage) {
220
219
  const content = apiMessage.content;
221
220
  if (content.id === this.id) return;
222
221
  let execution;
@@ -227,6 +226,6 @@ proto.getApi = function getApi(apiMessage) {
227
226
  if (execution = this._getExecutionById(pp.executionId)) return execution.getApi(apiMessage);
228
227
  }
229
228
  };
230
- proto._getExecutionById = function getExecutionById(executionId) {
229
+ SubProcessBehaviour.prototype._getExecutionById = function getExecutionById(executionId) {
231
230
  return this[kExecutions].find(pe => pe.executionId === executionId);
232
231
  };
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TaskBehaviour = TaskBehaviour;
7
7
  exports.default = Task;
8
- var _Activity = _interopRequireDefault(require("../activity/Activity"));
9
- var _messageHelper = require("../messageHelper");
8
+ var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
9
+ var _messageHelper = require("../messageHelper.js");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  function Task(activityDef, context) {
12
12
  return new _Activity.default(TaskBehaviour, activityDef, context);
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = Transaction;
7
- var _SubProcess = _interopRequireDefault(require("./SubProcess"));
7
+ var _SubProcess = _interopRequireDefault(require("./SubProcess.js"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
9
  function Transaction(activityDef, context) {
10
10
  const transaction = {
package/package.json CHANGED
@@ -1,18 +1,25 @@
1
1
  {
2
2
  "name": "bpmn-elements",
3
- "version": "8.2.4",
3
+ "version": "9.0.0",
4
4
  "description": "Executable workflow elements based on BPMN 2.0",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
6
- "module": "index.js",
7
+ "module": "src/index.js",
8
+ "jsnext:main": "./src/index.js",
9
+ "types": "./types",
10
+ "exports": {
11
+ "import": "./src/index.js",
12
+ "require": "./dist/index.js"
13
+ },
7
14
  "sideEffects": false,
8
15
  "scripts": {
9
16
  "test": "mocha -R dot",
10
- "posttest": "npm run dist && eslint . --cache",
11
- "prepare": "npm run dist",
12
- "cov:html": "nyc mocha -R dot && nyc report --reporter=html",
13
- "test:lcov": "nyc mocha -R dot && nyc report --reporter lcov && npm run posttest",
14
- "dist": "babel index.js -d dist && babel src -d dist/src",
15
- "predist": "node -e \"fs.rmdirSync('./dist/src', {recursive: true});\""
17
+ "posttest": "npm run lint && npm run dist",
18
+ "lint": "eslint . --cache",
19
+ "prepack": "npm run dist",
20
+ "cov:html": "c8 -r html -r text mocha -R dot",
21
+ "test:lcov": "c8 -r lcov mocha && npm run lint",
22
+ "dist": "babel src -d dist/"
16
23
  },
17
24
  "repository": {
18
25
  "type": "git",
@@ -31,40 +38,33 @@
31
38
  "isomorphic",
32
39
  "tree-shakeable"
33
40
  ],
34
- "nyc": {
35
- "exclude": [
36
- "dist",
37
- "test",
38
- "babel.config.js"
39
- ]
40
- },
41
41
  "files": [
42
- "dist/src",
43
- "dist/index.js",
44
- "src",
45
- "index.js"
42
+ "dist",
43
+ "types",
44
+ "src"
46
45
  ],
47
46
  "devDependencies": {
48
47
  "@aircall/expression-parser": "^1.0.4",
49
- "@babel/cli": "^7.19.3",
50
- "@babel/core": "^7.20.5",
48
+ "@babel/cli": "^7.21.0",
49
+ "@babel/core": "^7.21.3",
51
50
  "@babel/preset-env": "^7.20.2",
52
- "@babel/register": "^7.18.9",
53
- "bpmn-moddle": "^7.1.2",
54
- "camunda-bpmn-moddle": "^6.1.2",
51
+ "@babel/register": "^7.21.0",
52
+ "bpmn-moddle": "^8.0.1",
53
+ "c8": "^7.13.0",
54
+ "camunda-bpmn-moddle": "^7.0.1",
55
55
  "chai": "^4.3.7",
56
56
  "chronokinesis": "^4.0.1",
57
57
  "debug": "^4.3.4",
58
- "eslint": "^8.29.0",
59
- "got": "^11.8.6",
58
+ "eslint": "^8.36.0",
59
+ "eslint-plugin-import": "^2.27.5",
60
+ "got": "^12.6.0",
60
61
  "mocha": "^10.1.0",
61
62
  "mocha-cakes-2": "^3.3.0",
62
- "moddle-context-serializer": "^2.1.0",
63
- "nock": "^13.2.8",
64
- "nyc": "^15.1.0"
63
+ "moddle-context-serializer": "^3.2.2",
64
+ "nock": "^13.2.8"
65
65
  },
66
66
  "dependencies": {
67
67
  "iso8601-duration": "^2.1.1",
68
- "smqp": "^6.0.0"
68
+ "smqp": "^7.1.3"
69
69
  }
70
70
  }
package/src/Api.js CHANGED
@@ -1,5 +1,5 @@
1
- import {cloneMessage} from './messageHelper';
2
- import {getUniqueId} from './shared';
1
+ import {cloneMessage} from './messageHelper.js';
2
+ import {getUniqueId} from './shared.js';
3
3
 
4
4
  export {
5
5
  ActivityApi,
@@ -44,29 +44,27 @@ function Api(pfx, broker, sourceMessage, environment) {
44
44
  this.messagePrefix = pfx;
45
45
  }
46
46
 
47
- const proto = Api.prototype;
48
-
49
- proto.cancel = function cancel(message, options) {
47
+ Api.prototype.cancel = function cancel(message, options) {
50
48
  this.sendApiMessage('cancel', {message}, options);
51
49
  };
52
50
 
53
- proto.discard = function discard() {
51
+ Api.prototype.discard = function discard() {
54
52
  this.sendApiMessage('discard');
55
53
  };
56
54
 
57
- proto.fail = function fail(error) {
55
+ Api.prototype.fail = function fail(error) {
58
56
  this.sendApiMessage('error', {error});
59
57
  };
60
58
 
61
- proto.signal = function signal(message, options) {
59
+ Api.prototype.signal = function signal(message, options) {
62
60
  this.sendApiMessage('signal', {message}, options);
63
61
  };
64
62
 
65
- proto.stop = function stop() {
63
+ Api.prototype.stop = function stop() {
66
64
  this.sendApiMessage('stop');
67
65
  };
68
66
 
69
- proto.resolveExpression = function resolveExpression(expression) {
67
+ Api.prototype.resolveExpression = function resolveExpression(expression) {
70
68
  return this.environment.resolveExpression(expression, {
71
69
  fields: this.fields,
72
70
  content: this.content,
@@ -74,20 +72,20 @@ proto.resolveExpression = function resolveExpression(expression) {
74
72
  }, this.owner);
75
73
  };
76
74
 
77
- proto.sendApiMessage = function sendApiMessage(action, content, options) {
75
+ Api.prototype.sendApiMessage = function sendApiMessage(action, content, options) {
78
76
  const correlationId = (options && options.correlationId) || getUniqueId(`${this.id || this.messagePrefix}_signal`);
79
77
  let key = `${this.messagePrefix}.${action}`;
80
78
  if (this.executionId) key += `.${this.executionId}`;
81
79
  this.broker.publish('api', key, this.createMessage(content), {...options, correlationId, type: action});
82
80
  };
83
81
 
84
- proto.getPostponed = function getPostponed(...args) {
82
+ Api.prototype.getPostponed = function getPostponed(...args) {
85
83
  if (this.owner.getPostponed) return this.owner.getPostponed(...args);
86
84
  if (this.owner.isSubProcess && this.owner.execution) return this.owner.execution.getPostponed(...args);
87
85
  return [];
88
86
  };
89
87
 
90
- proto.createMessage = function createMessage(content) {
88
+ Api.prototype.createMessage = function createMessage(content) {
91
89
  return {
92
90
  ...this.content,
93
91
  ...content,