bpmn-elements 8.2.3 → 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.
- package/CHANGELOG.md +10 -0
- package/dist/{src/Api.js → Api.js} +11 -12
- package/dist/{src/Context.js → Context.js} +26 -27
- package/dist/{src/Environment.js → Environment.js} +15 -16
- package/dist/{src/EventBroker.js → EventBroker.js} +8 -2
- package/dist/{src/Expressions.js → Expressions.js} +1 -1
- package/dist/{src/MessageFormatter.js → MessageFormatter.js} +3 -3
- package/dist/{src/activity → activity}/Activity.js +62 -63
- package/dist/{src/activity → activity}/ActivityExecution.js +23 -24
- package/dist/{src/activity → activity}/Dummy.js +1 -1
- package/dist/{src/activity → activity}/ExecutionScope.js +2 -2
- package/dist/{src/definition → definition}/Definition.js +41 -42
- package/dist/{src/definition → definition}/DefinitionExecution.js +45 -46
- package/dist/{src/error → error}/Errors.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/CancelEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/CompensateEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/ConditionalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/ErrorEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/EscalationEventDefinition.js +12 -13
- package/dist/{src/eventDefinitions → eventDefinitions}/EventDefinitionExecution.js +10 -11
- package/dist/{src/eventDefinitions → eventDefinitions}/LinkEventDefinition.js +14 -15
- package/dist/{src/eventDefinitions → eventDefinitions}/MessageEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/SignalEventDefinition.js +13 -14
- package/dist/{src/eventDefinitions → eventDefinitions}/TerminateEventDefinition.js +1 -1
- package/dist/{src/eventDefinitions → eventDefinitions}/TimerEventDefinition.js +15 -16
- package/dist/{src/events → events}/BoundaryEvent.js +15 -16
- package/dist/{src/events → events}/EndEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateCatchEvent.js +3 -3
- package/dist/{src/events → events}/IntermediateThrowEvent.js +3 -3
- package/dist/{src/events → events}/StartEvent.js +8 -9
- package/dist/{src/flows → flows}/Association.js +15 -16
- package/dist/{src/flows → flows}/MessageFlow.js +16 -14
- package/dist/{src/flows → flows}/SequenceFlow.js +16 -18
- package/dist/{src/gateways → gateways}/EventBasedGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ExclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/InclusiveGateway.js +2 -2
- package/dist/{src/gateways → gateways}/ParallelGateway.js +2 -2
- package/dist/index.js +48 -48
- package/dist/{src/io → io}/InputOutputSpecification.js +8 -9
- package/dist/{src/io → io}/Properties.js +7 -8
- package/dist/package.json +3 -0
- package/dist/{src/process → process}/Process.js +39 -40
- package/dist/{src/process → process}/ProcessExecution.js +55 -48
- package/dist/{src/tasks → tasks}/CallActivity.js +7 -8
- package/dist/{src/tasks → tasks}/LoopCharacteristics.js +2 -2
- package/dist/{src/tasks → tasks}/ReceiveTask.js +14 -15
- package/dist/{src/tasks → tasks}/ScriptTask.js +4 -4
- package/dist/{src/tasks → tasks}/ServiceImplementation.js +1 -1
- package/dist/{src/tasks → tasks}/ServiceTask.js +6 -7
- package/dist/{src/tasks → tasks}/SignalTask.js +7 -8
- package/dist/{src/tasks → tasks}/StandardLoopCharacteristics.js +1 -1
- package/dist/{src/tasks → tasks}/SubProcess.js +17 -18
- package/dist/{src/tasks → tasks}/Task.js +2 -2
- package/dist/{src/tasks → tasks}/Transaction.js +1 -1
- package/package.json +31 -31
- package/src/Api.js +11 -13
- package/src/Context.js +26 -28
- package/src/Environment.js +15 -17
- package/src/EventBroker.js +5 -2
- package/src/Expressions.js +1 -1
- package/src/MessageFormatter.js +3 -3
- package/src/activity/Activity.js +62 -64
- package/src/activity/ActivityExecution.js +23 -25
- package/src/activity/Dummy.js +1 -1
- package/src/activity/ExecutionScope.js +2 -2
- package/src/definition/Definition.js +41 -43
- package/src/definition/DefinitionExecution.js +45 -47
- package/src/error/Errors.js +1 -1
- package/src/eventDefinitions/CancelEventDefinition.js +12 -14
- package/src/eventDefinitions/CompensateEventDefinition.js +12 -14
- package/src/eventDefinitions/ConditionalEventDefinition.js +13 -15
- package/src/eventDefinitions/ErrorEventDefinition.js +13 -15
- package/src/eventDefinitions/EscalationEventDefinition.js +12 -14
- package/src/eventDefinitions/EventDefinitionExecution.js +10 -12
- package/src/eventDefinitions/LinkEventDefinition.js +14 -16
- package/src/eventDefinitions/MessageEventDefinition.js +13 -15
- package/src/eventDefinitions/SignalEventDefinition.js +13 -15
- package/src/eventDefinitions/TerminateEventDefinition.js +1 -1
- package/src/eventDefinitions/TimerEventDefinition.js +15 -17
- package/src/events/BoundaryEvent.js +15 -17
- package/src/events/EndEvent.js +3 -3
- package/src/events/IntermediateCatchEvent.js +3 -3
- package/src/events/IntermediateThrowEvent.js +3 -3
- package/src/events/StartEvent.js +8 -10
- package/src/flows/Association.js +15 -17
- package/src/flows/MessageFlow.js +14 -15
- package/src/flows/SequenceFlow.js +16 -20
- package/src/gateways/EventBasedGateway.js +2 -2
- package/src/gateways/ExclusiveGateway.js +2 -2
- package/src/gateways/InclusiveGateway.js +2 -2
- package/src/gateways/ParallelGateway.js +2 -2
- package/src/index.js +106 -0
- package/src/io/InputOutputSpecification.js +8 -10
- package/src/io/Properties.js +7 -9
- package/src/process/Process.js +39 -41
- package/src/process/ProcessExecution.js +55 -49
- package/src/tasks/CallActivity.js +7 -9
- package/src/tasks/LoopCharacteristics.js +2 -2
- package/src/tasks/ReceiveTask.js +215 -217
- package/src/tasks/ScriptTask.js +4 -4
- package/src/tasks/ServiceImplementation.js +1 -1
- package/src/tasks/ServiceTask.js +6 -8
- package/src/tasks/SignalTask.js +7 -9
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +17 -19
- package/src/tasks/Task.js +2 -2
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +491 -0
- package/index.js +0 -106
- /package/dist/{src/ExtensionsMapper.js → ExtensionsMapper.js} +0 -0
- /package/dist/{src/Scripts.js → Scripts.js} +0 -0
- /package/dist/{src/Timers.js → Timers.js} +0 -0
- /package/dist/{src/activity → activity}/Escalation.js +0 -0
- /package/dist/{src/activity → activity}/Message.js +0 -0
- /package/dist/{src/activity → activity}/Signal.js +0 -0
- /package/dist/{src/error → error}/BpmnError.js +0 -0
- /package/dist/{src/getPropertyValue.js → getPropertyValue.js} +0 -0
- /package/dist/{src/io → io}/BpmnIO.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataObject.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStore.js +0 -0
- /package/dist/{src/io → io}/EnvironmentDataStoreReference.js +0 -0
- /package/dist/{src/messageHelper.js → messageHelper.js} +0 -0
- /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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
+
ReceiveTaskExecution.prototype._onStopApiMessage = function onStopApiMessage() {
|
|
203
202
|
this._stopMessageHandling(true);
|
|
204
203
|
};
|
|
205
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
68
|
+
Object.defineProperty(SubProcessBehaviour.prototype, 'executions', {
|
|
70
69
|
get() {
|
|
71
70
|
return this[kExecutions].slice();
|
|
72
71
|
}
|
|
73
72
|
});
|
|
74
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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": "
|
|
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
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
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
|
|
43
|
-
"
|
|
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.
|
|
50
|
-
"@babel/core": "^7.
|
|
48
|
+
"@babel/cli": "^7.21.0",
|
|
49
|
+
"@babel/core": "^7.21.3",
|
|
51
50
|
"@babel/preset-env": "^7.20.2",
|
|
52
|
-
"@babel/register": "^7.
|
|
53
|
-
"bpmn-moddle": "^
|
|
54
|
-
"
|
|
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
|
-
"chronokinesis": "^
|
|
56
|
+
"chronokinesis": "^4.0.1",
|
|
57
57
|
"debug": "^4.3.4",
|
|
58
|
-
"eslint": "^8.
|
|
59
|
-
"
|
|
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.
|
|
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": "^
|
|
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
|
-
|
|
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
|
-
|
|
51
|
+
Api.prototype.discard = function discard() {
|
|
54
52
|
this.sendApiMessage('discard');
|
|
55
53
|
};
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
Api.prototype.fail = function fail(error) {
|
|
58
56
|
this.sendApiMessage('error', {error});
|
|
59
57
|
};
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
Api.prototype.signal = function signal(message, options) {
|
|
62
60
|
this.sendApiMessage('signal', {message}, options);
|
|
63
61
|
};
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
Api.prototype.stop = function stop() {
|
|
66
64
|
this.sendApiMessage('stop');
|
|
67
65
|
};
|
|
68
66
|
|
|
69
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
88
|
+
Api.prototype.createMessage = function createMessage(content) {
|
|
91
89
|
return {
|
|
92
90
|
...this.content,
|
|
93
91
|
...content,
|