bpmn-elements 6.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +335 -0
- package/README.md +3 -0
- package/dist/index.js +52 -44
- package/dist/src/Api.js +77 -76
- package/dist/src/Context.js +176 -172
- package/dist/src/Environment.js +110 -102
- package/dist/src/EventBroker.js +89 -88
- package/dist/src/ExtensionsMapper.js +2 -2
- package/dist/src/MessageFormatter.js +164 -95
- package/dist/src/Scripts.js +6 -2
- package/dist/src/activity/Activity.js +1106 -916
- package/dist/src/activity/ActivityExecution.js +342 -297
- package/dist/src/activity/Dummy.js +3 -3
- package/dist/src/definition/Definition.js +498 -444
- package/dist/src/definition/DefinitionExecution.js +710 -408
- package/dist/src/error/Errors.js +17 -7
- package/dist/src/eventDefinitions/CancelEventDefinition.js +190 -150
- package/dist/src/eventDefinitions/CompensateEventDefinition.js +194 -161
- package/dist/src/eventDefinitions/ConditionalEventDefinition.js +197 -135
- package/dist/src/eventDefinitions/ErrorEventDefinition.js +207 -165
- package/dist/src/eventDefinitions/EscalationEventDefinition.js +175 -141
- package/dist/src/eventDefinitions/EventDefinitionExecution.js +157 -129
- package/dist/src/eventDefinitions/LinkEventDefinition.js +174 -149
- package/dist/src/eventDefinitions/MessageEventDefinition.js +213 -176
- package/dist/src/eventDefinitions/SignalEventDefinition.js +203 -161
- package/dist/src/eventDefinitions/TerminateEventDefinition.js +21 -23
- package/dist/src/eventDefinitions/TimerEventDefinition.js +243 -228
- package/dist/src/events/BoundaryEvent.js +180 -144
- package/dist/src/events/EndEvent.js +18 -23
- package/dist/src/events/IntermediateCatchEvent.js +44 -58
- package/dist/src/events/IntermediateThrowEvent.js +18 -23
- package/dist/src/events/StartEvent.js +109 -94
- package/dist/src/flows/Association.js +94 -100
- package/dist/src/flows/MessageFlow.js +86 -103
- package/dist/src/flows/SequenceFlow.js +173 -182
- package/dist/src/gateways/EventBasedGateway.js +88 -84
- package/dist/src/gateways/ExclusiveGateway.js +13 -16
- package/dist/src/gateways/InclusiveGateway.js +11 -14
- package/dist/src/gateways/ParallelGateway.js +11 -14
- package/dist/src/getPropertyValue.js +34 -34
- package/dist/src/io/BpmnIO.js +17 -14
- package/dist/src/io/EnvironmentDataObject.js +33 -29
- package/dist/src/io/EnvironmentDataStore.js +33 -29
- package/dist/src/io/EnvironmentDataStoreReference.js +35 -31
- package/dist/src/io/InputOutputSpecification.js +177 -168
- package/dist/src/io/Properties.js +117 -124
- package/dist/src/messageHelper.js +1 -1
- package/dist/src/process/Process.js +439 -362
- package/dist/src/process/ProcessExecution.js +748 -646
- package/dist/src/shared.js +2 -2
- package/dist/src/tasks/CallActivity.js +160 -0
- package/dist/src/tasks/LoopCharacteristics.js +309 -330
- package/dist/src/tasks/ReceiveTask.js +233 -182
- package/dist/src/tasks/ScriptTask.js +35 -41
- package/dist/src/tasks/ServiceImplementation.js +13 -20
- package/dist/src/tasks/ServiceTask.js +82 -75
- package/dist/src/tasks/SignalTask.js +97 -93
- package/dist/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/dist/src/tasks/SubProcess.js +193 -175
- package/dist/src/tasks/Task.js +17 -19
- package/index.js +2 -0
- package/package.json +15 -15
- package/src/Api.js +65 -59
- package/src/Context.js +145 -140
- package/src/Environment.js +116 -100
- package/src/EventBroker.js +67 -68
- package/src/ExtensionsMapper.js +2 -2
- package/src/MessageFormatter.js +132 -74
- package/src/activity/Activity.js +915 -775
- package/src/activity/ActivityExecution.js +293 -247
- package/src/activity/Dummy.js +2 -2
- package/src/definition/Definition.js +437 -401
- package/src/definition/DefinitionExecution.js +598 -340
- package/src/error/Errors.js +11 -6
- package/src/eventDefinitions/CancelEventDefinition.js +164 -121
- package/src/eventDefinitions/CompensateEventDefinition.js +159 -124
- package/src/eventDefinitions/ConditionalEventDefinition.js +147 -104
- package/src/eventDefinitions/ErrorEventDefinition.js +190 -131
- package/src/eventDefinitions/EscalationEventDefinition.js +139 -101
- package/src/eventDefinitions/EventDefinitionExecution.js +127 -95
- package/src/eventDefinitions/LinkEventDefinition.js +160 -129
- package/src/eventDefinitions/MessageEventDefinition.js +178 -121
- package/src/eventDefinitions/SignalEventDefinition.js +162 -106
- package/src/eventDefinitions/TerminateEventDefinition.js +19 -19
- package/src/eventDefinitions/TimerEventDefinition.js +202 -167
- package/src/events/BoundaryEvent.js +156 -115
- package/src/events/EndEvent.js +15 -18
- package/src/events/IntermediateCatchEvent.js +40 -44
- package/src/events/IntermediateThrowEvent.js +15 -18
- package/src/events/StartEvent.js +84 -50
- package/src/flows/Association.js +98 -112
- package/src/flows/MessageFlow.js +81 -97
- package/src/flows/SequenceFlow.js +146 -160
- package/src/gateways/EventBasedGateway.js +75 -68
- package/src/gateways/ExclusiveGateway.js +8 -13
- package/src/gateways/InclusiveGateway.js +8 -13
- package/src/gateways/ParallelGateway.js +8 -13
- package/src/getPropertyValue.js +34 -33
- package/src/io/BpmnIO.js +20 -15
- package/src/io/EnvironmentDataObject.js +29 -18
- package/src/io/EnvironmentDataStore.js +29 -18
- package/src/io/EnvironmentDataStoreReference.js +31 -20
- package/src/io/InputOutputSpecification.js +154 -157
- package/src/io/Properties.js +95 -97
- package/src/process/Process.js +378 -333
- package/src/process/ProcessExecution.js +603 -553
- package/src/tasks/CallActivity.js +130 -0
- package/src/tasks/LoopCharacteristics.js +290 -289
- package/src/tasks/ReceiveTask.js +174 -107
- package/src/tasks/ScriptTask.js +27 -30
- package/src/tasks/ServiceImplementation.js +13 -18
- package/src/tasks/ServiceTask.js +67 -60
- package/src/tasks/SignalTask.js +77 -52
- package/src/tasks/StandardLoopCharacteristics.js +1 -1
- package/src/tasks/SubProcess.js +184 -157
- package/src/tasks/Task.js +15 -19
package/dist/src/shared.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.generateId = generateId;
|
|
7
6
|
exports.brokerSafeId = brokerSafeId;
|
|
8
|
-
exports.getUniqueId = getUniqueId;
|
|
9
7
|
exports.filterUndefined = filterUndefined;
|
|
8
|
+
exports.generateId = generateId;
|
|
10
9
|
exports.getOptionsAndCallback = getOptionsAndCallback;
|
|
10
|
+
exports.getUniqueId = getUniqueId;
|
|
11
11
|
const safePattern = /[./\\#*:\s]/g;
|
|
12
12
|
|
|
13
13
|
function generateId() {
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CallActivityBehaviour = CallActivityBehaviour;
|
|
7
|
+
exports.default = CallActivity;
|
|
8
|
+
|
|
9
|
+
var _Activity = _interopRequireDefault(require("../activity/Activity"));
|
|
10
|
+
|
|
11
|
+
var _Errors = require("../error/Errors");
|
|
12
|
+
|
|
13
|
+
var _messageHelper = require("../messageHelper");
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
function CallActivity(activityDef, context) {
|
|
18
|
+
return new _Activity.default(CallActivityBehaviour, activityDef, context);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function CallActivityBehaviour(activity) {
|
|
22
|
+
const {
|
|
23
|
+
id,
|
|
24
|
+
type,
|
|
25
|
+
behaviour = {}
|
|
26
|
+
} = activity;
|
|
27
|
+
this.id = id;
|
|
28
|
+
this.type = type;
|
|
29
|
+
this.calledElement = behaviour.calledElement;
|
|
30
|
+
this.loopCharacteristics = behaviour.loopCharacteristics && new behaviour.loopCharacteristics.Behaviour(activity, behaviour.loopCharacteristics);
|
|
31
|
+
this.activity = activity;
|
|
32
|
+
this.broker = activity.broker;
|
|
33
|
+
this.environment = activity.environment;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const proto = CallActivityBehaviour.prototype;
|
|
37
|
+
|
|
38
|
+
proto.execute = function execute(executeMessage) {
|
|
39
|
+
const executeContent = executeMessage.content;
|
|
40
|
+
const loopCharacteristics = this.loopCharacteristics;
|
|
41
|
+
|
|
42
|
+
if (loopCharacteristics && executeContent.isRootScope) {
|
|
43
|
+
return loopCharacteristics.execute(executeMessage);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const broker = this.broker;
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
var calledElement = this.environment.resolveExpression(this.calledElement); // eslint-disable-line no-var
|
|
50
|
+
} catch (err) {
|
|
51
|
+
return broker.publish('execution', 'execute.error', (0, _messageHelper.cloneContent)(executeContent, {
|
|
52
|
+
error: new _Errors.ActivityError(err.message, executeMessage, err)
|
|
53
|
+
}, {
|
|
54
|
+
mandatory: true
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const executionId = executeContent.executionId;
|
|
59
|
+
broker.subscribeTmp('api', `activity.#.${executionId}`, (...args) => {
|
|
60
|
+
this._onApiMessage(calledElement, executeMessage, ...args);
|
|
61
|
+
}, {
|
|
62
|
+
noAck: true,
|
|
63
|
+
consumerTag: `_api-${executionId}`,
|
|
64
|
+
priority: 300
|
|
65
|
+
});
|
|
66
|
+
broker.subscribeTmp('api', '#.signal.*', (...args) => this._onDelegatedApiMessage(calledElement, executeMessage, ...args), {
|
|
67
|
+
noAck: true,
|
|
68
|
+
consumerTag: `_api-delegated-${executionId}`
|
|
69
|
+
});
|
|
70
|
+
broker.publish('event', 'activity.call', (0, _messageHelper.cloneContent)(executeContent, {
|
|
71
|
+
state: 'wait',
|
|
72
|
+
calledElement
|
|
73
|
+
}), {
|
|
74
|
+
type: 'call'
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
proto._onDelegatedApiMessage = function onDelegatedApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
79
|
+
if (!message.properties.delegate) return;
|
|
80
|
+
const {
|
|
81
|
+
content: delegateContent
|
|
82
|
+
} = message;
|
|
83
|
+
if (!delegateContent || !delegateContent.message) return;
|
|
84
|
+
const executeContent = executeMessage.content;
|
|
85
|
+
const {
|
|
86
|
+
id: signalId,
|
|
87
|
+
executionId: signalExecutionId
|
|
88
|
+
} = delegateContent.message;
|
|
89
|
+
if (this.loopCharacteristics && signalExecutionId !== executeContent.executionId) return;
|
|
90
|
+
if (signalId !== this.id && signalExecutionId !== executeContent.executionId) return;
|
|
91
|
+
const {
|
|
92
|
+
type: messageType,
|
|
93
|
+
correlationId
|
|
94
|
+
} = message.properties;
|
|
95
|
+
this.broker.publish('event', 'activity.consumed', (0, _messageHelper.cloneContent)(executeContent, {
|
|
96
|
+
message: { ...delegateContent.message
|
|
97
|
+
}
|
|
98
|
+
}), {
|
|
99
|
+
correlationId,
|
|
100
|
+
type: messageType
|
|
101
|
+
});
|
|
102
|
+
return this._onApiMessage(calledElement, executeMessage, routingKey, message);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
proto._onApiMessage = function onApiMessage(calledElement, executeMessage, routingKey, message) {
|
|
106
|
+
const {
|
|
107
|
+
type: messageType,
|
|
108
|
+
correlationId
|
|
109
|
+
} = message.properties;
|
|
110
|
+
const executeContent = executeMessage.content;
|
|
111
|
+
|
|
112
|
+
switch (messageType) {
|
|
113
|
+
case 'stop':
|
|
114
|
+
return this._stop(executeContent.executionId);
|
|
115
|
+
|
|
116
|
+
case 'cancel':
|
|
117
|
+
{
|
|
118
|
+
this.broker.publish('event', 'activity.call.cancel', (0, _messageHelper.cloneContent)(executeContent, {
|
|
119
|
+
state: 'cancel',
|
|
120
|
+
calledElement
|
|
121
|
+
}), {
|
|
122
|
+
type: 'cancel'
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
case 'signal':
|
|
127
|
+
this._stop(executeContent.executionId);
|
|
128
|
+
|
|
129
|
+
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeContent, {
|
|
130
|
+
output: message.content.message,
|
|
131
|
+
state: messageType
|
|
132
|
+
}), {
|
|
133
|
+
correlationId
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
case 'error':
|
|
137
|
+
this._stop(executeContent.executionId);
|
|
138
|
+
|
|
139
|
+
return this.broker.publish('execution', 'execute.error', (0, _messageHelper.cloneContent)(executeContent, {
|
|
140
|
+
error: new _Errors.ActivityError(message.content.message, executeMessage, message.content)
|
|
141
|
+
}, {
|
|
142
|
+
mandatory: true,
|
|
143
|
+
correlationId
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
case 'discard':
|
|
147
|
+
return this.broker.publish('event', 'activity.call.cancel', (0, _messageHelper.cloneContent)(executeContent, {
|
|
148
|
+
state: 'discard',
|
|
149
|
+
calledElement
|
|
150
|
+
}), {
|
|
151
|
+
type: 'discard'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
proto._stop = function stop(executionId) {
|
|
157
|
+
const broker = this.broker;
|
|
158
|
+
broker.cancel(`_api-${executionId}`);
|
|
159
|
+
broker.cancel(`_api-delegated-${executionId}`);
|
|
160
|
+
};
|