bpmn-elements 6.0.1 → 7.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 +322 -0
- package/README.md +3 -0
- package/dist/index.js +52 -44
- package/dist/src/Api.js +77 -76
- package/dist/src/Context.js +169 -175
- package/dist/src/Environment.js +90 -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 +722 -409
- 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 +433 -359
- package/dist/src/process/ProcessExecution.js +744 -645
- 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 +195 -175
- package/dist/src/tasks/Task.js +17 -19
- package/index.js +2 -0
- package/package.json +13 -13
- package/src/Api.js +65 -59
- package/src/Context.js +138 -141
- package/src/Environment.js +88 -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 +436 -401
- package/src/definition/DefinitionExecution.js +603 -343
- package/src/error/Errors.js +11 -6
- package/src/eventDefinitions/CancelEventDefinition.js +164 -121
- package/src/eventDefinitions/CompensateEventDefinition.js +158 -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 +16 -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 +374 -333
- package/src/process/ProcessExecution.js +606 -554
- 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/src/io/Properties.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import getPropertyValue from '../getPropertyValue';
|
|
2
2
|
|
|
3
|
+
const propertiesSymbol = Symbol.for('properties');
|
|
4
|
+
const consumingSymbol = Symbol.for('consuming');
|
|
5
|
+
|
|
3
6
|
export default function Properties(activity, propertiesDef, context) {
|
|
4
|
-
|
|
7
|
+
this.activity = activity;
|
|
8
|
+
this.broker = activity.broker;
|
|
9
|
+
|
|
10
|
+
const props = this[propertiesSymbol] = {
|
|
11
|
+
properties: [],
|
|
12
|
+
dataInputObjects: [],
|
|
13
|
+
dataOutputObjects: [],
|
|
14
|
+
};
|
|
5
15
|
|
|
6
|
-
const {broker, environment} = activity;
|
|
7
|
-
const formatQ = broker.getQueue('format-run-q');
|
|
8
|
-
let activityConsumer;
|
|
9
16
|
|
|
10
|
-
const {
|
|
17
|
+
for (const {id, ...def} of propertiesDef.values) {
|
|
11
18
|
const source = {
|
|
12
19
|
id,
|
|
13
20
|
type: def.type,
|
|
14
|
-
name: def.name,
|
|
21
|
+
name: def.behaviour && def.behaviour.name,
|
|
15
22
|
};
|
|
16
|
-
|
|
23
|
+
props.properties.push(source);
|
|
17
24
|
|
|
18
25
|
const inputDataObjectId = getPropertyValue(def, 'behaviour.dataInput.association.source.dataObject.id');
|
|
19
26
|
const outputDataObjectId = getPropertyValue(def, 'behaviour.dataOutput.association.target.dataObject.id');
|
|
@@ -22,141 +29,134 @@ export default function Properties(activity, propertiesDef, context) {
|
|
|
22
29
|
|
|
23
30
|
if (inputDataObjectId) {
|
|
24
31
|
const reference = context.getDataObjectById(inputDataObjectId);
|
|
25
|
-
|
|
32
|
+
props.dataInputObjects.push({id, reference});
|
|
26
33
|
source.input = {
|
|
27
34
|
reference,
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
if (outputDataObjectId) {
|
|
31
38
|
const reference = context.getDataObjectById(outputDataObjectId);
|
|
32
|
-
|
|
39
|
+
props.dataOutputObjects.push({id, reference: reference});
|
|
33
40
|
source.output = {
|
|
34
41
|
reference,
|
|
35
42
|
};
|
|
36
43
|
}
|
|
37
44
|
if (inputDataStoreId) {
|
|
38
45
|
const reference = context.getDataStoreById(inputDataStoreId);
|
|
39
|
-
|
|
46
|
+
props.dataInputObjects.push({id, reference});
|
|
40
47
|
source.input = {
|
|
41
48
|
reference,
|
|
42
49
|
};
|
|
43
50
|
}
|
|
44
51
|
if (outputDataStoreId) {
|
|
45
52
|
const reference = context.getDataStoreById(outputDataStoreId);
|
|
46
|
-
|
|
53
|
+
props.dataOutputObjects.push({id, reference});
|
|
47
54
|
source.output = {
|
|
48
55
|
reference,
|
|
49
56
|
};
|
|
50
57
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
properties: [],
|
|
54
|
-
dataInputObjects: [],
|
|
55
|
-
dataOutputObjects: [],
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const propertiesApi = {
|
|
59
|
-
type: 'properties',
|
|
60
|
-
activate,
|
|
61
|
-
deactivate,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return propertiesApi;
|
|
65
|
-
|
|
66
|
-
function activate(message) {
|
|
67
|
-
if (activityConsumer) return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
onActivityEvent('activity.extension.resume', message);
|
|
71
|
-
}
|
|
61
|
+
const proto = Properties.prototype;
|
|
72
62
|
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
proto.activate = function activate(message) {
|
|
64
|
+
if (this[consumingSymbol]) return;
|
|
75
65
|
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
if (message.fields.redelivered && message.content.properties) {
|
|
67
|
+
this._onActivityEvent('activity.extension.resume', message);
|
|
78
68
|
}
|
|
79
69
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return formatOnEnter(message);
|
|
83
|
-
}
|
|
70
|
+
this[consumingSymbol] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
|
|
71
|
+
};
|
|
84
72
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
proto.deactivate = function deactivate() {
|
|
74
|
+
if (this[consumingSymbol]) this[consumingSymbol] = this[consumingSymbol].cancel();
|
|
75
|
+
};
|
|
88
76
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
proto._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
78
|
+
if (routingKey === 'activity.enter') {
|
|
79
|
+
return this._formatOnEnter(message);
|
|
92
80
|
}
|
|
93
81
|
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
if (routingKey === 'activity.extension.resume') {
|
|
83
|
+
return this._formatOnEnter(message);
|
|
84
|
+
}
|
|
96
85
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
86
|
+
if (routingKey === 'activity.execution.completed') {
|
|
87
|
+
return this._formatOnComplete(message);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
endRoutingKey,
|
|
106
|
-
properties: getProperties(message),
|
|
107
|
-
});
|
|
91
|
+
proto._formatOnEnter = function formatOnEnter(message) {
|
|
92
|
+
const startRoutingKey = 'run.enter.bpmn-properties';
|
|
108
93
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
const dataInputObjects = this[propertiesSymbol].dataInputObjects;
|
|
95
|
+
const broker = this.broker;
|
|
96
|
+
if (!dataInputObjects.length) {
|
|
97
|
+
return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
|
|
98
|
+
properties: this._getProperties(message),
|
|
113
99
|
});
|
|
114
100
|
}
|
|
115
101
|
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
const endRoutingKey = 'run.enter.bpmn-properties.end';
|
|
103
|
+
broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
|
|
104
|
+
endRoutingKey,
|
|
105
|
+
properties: this._getProperties(message),
|
|
106
|
+
});
|
|
118
107
|
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
return read(broker, dataInputObjects, (_, responses) => {
|
|
109
|
+
broker.publish('format', endRoutingKey, {
|
|
110
|
+
properties: this._getProperties(message, responses),
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
proto._formatOnComplete = function formatOnComplete(message) {
|
|
116
|
+
const startRoutingKey = 'run.end.bpmn-properties';
|
|
117
|
+
|
|
118
|
+
const messageOutput = getPropertyValue(message, 'content.output.properties') || {};
|
|
119
|
+
const outputProperties = this._getProperties(message, messageOutput);
|
|
127
120
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
const dataOutputObjects = this[propertiesSymbol].dataOutputObjects;
|
|
122
|
+
const broker = this.broker;
|
|
123
|
+
if (!dataOutputObjects.length) {
|
|
124
|
+
return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
|
|
131
125
|
properties: outputProperties,
|
|
132
126
|
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const endRoutingKey = 'run.end.bpmn-properties.end';
|
|
130
|
+
broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
|
|
131
|
+
endRoutingKey,
|
|
132
|
+
properties: outputProperties,
|
|
133
|
+
});
|
|
133
134
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
135
|
+
return write(broker, dataOutputObjects, outputProperties, (_, responses) => {
|
|
136
|
+
broker.publish('format', endRoutingKey, {
|
|
137
|
+
properties: this._getProperties(message, responses),
|
|
138
138
|
});
|
|
139
|
-
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
proto._getProperties = function getProperties(message, values) {
|
|
143
|
+
let response = {};
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
if (message.content.properties) {
|
|
146
|
+
response = {...message.content.properties};
|
|
147
|
+
}
|
|
147
148
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
for (const {id, type, name} of this[propertiesSymbol].properties) {
|
|
150
|
+
if (!(id in response)) {
|
|
151
|
+
response[id] = {id, type, name};
|
|
152
|
+
}
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
result[id].value = values[id].value;
|
|
156
|
-
return result;
|
|
157
|
-
}, response);
|
|
154
|
+
if (!values || !(id in values)) continue;
|
|
155
|
+
response[id].value = values[id].value;
|
|
158
156
|
}
|
|
159
|
-
|
|
157
|
+
|
|
158
|
+
return response;
|
|
159
|
+
};
|
|
160
160
|
|
|
161
161
|
function read(broker, dataReferences, callback) {
|
|
162
162
|
const responses = {};
|
|
@@ -164,8 +164,7 @@ function read(broker, dataReferences, callback) {
|
|
|
164
164
|
|
|
165
165
|
const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, {noAck: true});
|
|
166
166
|
|
|
167
|
-
for (
|
|
168
|
-
const {id: propertyId, reference} = dataReferences[i];
|
|
167
|
+
for (const {id: propertyId, reference} of dataReferences) {
|
|
169
168
|
reference.read(broker, 'data', 'data.read.', {correlationId: propertyId});
|
|
170
169
|
}
|
|
171
170
|
|
|
@@ -184,8 +183,7 @@ function write(broker, dataReferences, properties, callback) {
|
|
|
184
183
|
let count = 0;
|
|
185
184
|
const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, {noAck: true});
|
|
186
185
|
|
|
187
|
-
for (
|
|
188
|
-
const {id: propertyId, reference} = dataReferences[i];
|
|
186
|
+
for (const {id: propertyId, reference} of dataReferences) {
|
|
189
187
|
const value = propertyId in properties ? properties[propertyId].value : undefined;
|
|
190
188
|
reference.write(broker, 'data', 'data.write.', value, {correlationId: propertyId});
|
|
191
189
|
}
|