bpmn-elements 13.1.2 → 14.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/README.md +1 -2
- package/dist/Context.js +36 -2
- package/dist/activity/Activity.js +32 -15
- package/dist/definition/DefinitionExecution.js +1 -1
- package/dist/error/Errors.js +6 -1
- package/dist/eventDefinitions/TimerEventDefinition.js +18 -31
- package/dist/getPropertyValue.js +1 -2
- package/dist/index.js +13 -5
- package/package.json +16 -14
- package/src/Api.js +18 -20
- package/src/Context.js +49 -7
- package/src/Environment.js +10 -20
- package/src/EventBroker.js +21 -27
- package/src/MessageFormatter.js +23 -19
- package/src/Tracker.js +4 -4
- package/src/activity/Activity.js +174 -121
- package/src/activity/ActivityExecution.js +38 -29
- package/src/activity/Dummy.js +3 -3
- package/src/activity/Escalation.js +4 -4
- package/src/activity/ExecutionScope.js +4 -4
- package/src/activity/Message.js +5 -5
- package/src/activity/Signal.js +5 -5
- package/src/definition/Definition.js +44 -36
- package/src/definition/DefinitionExecution.js +97 -66
- package/src/error/BpmnError.js +3 -3
- package/src/error/Errors.js +27 -15
- package/src/eventDefinitions/CancelEventDefinition.js +16 -11
- package/src/eventDefinitions/CompensateEventDefinition.js +28 -23
- package/src/eventDefinitions/ConditionalEventDefinition.js +42 -23
- package/src/eventDefinitions/ErrorEventDefinition.js +47 -34
- package/src/eventDefinitions/EscalationEventDefinition.js +21 -20
- package/src/eventDefinitions/EventDefinitionExecution.js +6 -6
- package/src/eventDefinitions/LinkEventDefinition.js +28 -22
- package/src/eventDefinitions/MessageEventDefinition.js +47 -36
- package/src/eventDefinitions/SignalEventDefinition.js +42 -31
- package/src/eventDefinitions/TerminateEventDefinition.js +4 -4
- package/src/eventDefinitions/TimerEventDefinition.js +56 -57
- package/src/events/BoundaryEvent.js +81 -46
- package/src/events/EndEvent.js +2 -2
- package/src/events/IntermediateCatchEvent.js +8 -4
- package/src/events/IntermediateThrowEvent.js +2 -2
- package/src/events/StartEvent.js +29 -18
- package/src/flows/Association.js +11 -11
- package/src/flows/MessageFlow.js +16 -14
- package/src/flows/SequenceFlow.js +22 -20
- package/src/gateways/EventBasedGateway.js +7 -6
- package/src/gateways/ExclusiveGateway.js +4 -4
- package/src/gateways/InclusiveGateway.js +3 -3
- package/src/gateways/ParallelGateway.js +4 -4
- package/src/getPropertyValue.js +3 -6
- package/src/index.js +3 -3
- package/src/io/BpmnIO.js +5 -6
- package/src/io/EnvironmentDataObject.js +2 -3
- package/src/io/EnvironmentDataStore.js +2 -2
- package/src/io/EnvironmentDataStoreReference.js +2 -2
- package/src/io/InputOutputSpecification.js +60 -54
- package/src/io/Properties.js +45 -33
- package/src/messageHelper.js +16 -23
- package/src/process/Lane.js +3 -3
- package/src/process/Process.js +40 -34
- package/src/process/ProcessExecution.js +122 -78
- package/src/tasks/CallActivity.js +109 -57
- package/src/tasks/LoopCharacteristics.js +30 -18
- package/src/tasks/ReceiveTask.js +59 -38
- package/src/tasks/ScriptTask.js +17 -8
- package/src/tasks/ServiceTask.js +16 -9
- package/src/tasks/SignalTask.js +47 -28
- package/src/tasks/StandardLoopCharacteristics.js +3 -3
- package/src/tasks/SubProcess.js +9 -8
- package/src/tasks/Task.js +4 -3
- package/src/tasks/Transaction.js +1 -1
- package/types/index.d.ts +6 -6
- package/types/types.d.ts +39 -35
- package/CHANGELOG.md +0 -459
- package/src/ExtensionsMapper.js +0 -42
- package/src/iso-duration.js +0 -91
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Activity from '../activity/Activity.js';
|
|
2
|
-
import {cloneContent} from '../messageHelper.js';
|
|
2
|
+
import { cloneContent } from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
const kCompleted = Symbol.for('completed');
|
|
5
5
|
const kTargets = Symbol.for('targets');
|
|
@@ -19,14 +19,14 @@ export function EventBasedGatewayBehaviour(activity, context) {
|
|
|
19
19
|
|
|
20
20
|
EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage) {
|
|
21
21
|
const executeContent = executeMessage.content;
|
|
22
|
-
const {executionId, outbound = [], outboundTaken} = executeContent;
|
|
22
|
+
const { executionId, outbound = [], outboundTaken } = executeContent;
|
|
23
23
|
|
|
24
24
|
const targets = this[kTargets];
|
|
25
25
|
this[kCompleted] = false;
|
|
26
26
|
if (!targets.length) return this._complete(executeContent);
|
|
27
27
|
|
|
28
28
|
for (const flow of this.activity.outbound) {
|
|
29
|
-
outbound.push({id: flow.id, action: 'take'});
|
|
29
|
+
outbound.push({ id: flow.id, action: 'take' });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (!this[kCompleted] && outboundTaken) return;
|
|
@@ -35,7 +35,7 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
|
|
|
35
35
|
|
|
36
36
|
const onTargetCompleted = this._onTargetCompleted.bind(this, executeMessage);
|
|
37
37
|
for (const target of this[kTargets]) {
|
|
38
|
-
target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, {consumerTag: targetConsumerTag});
|
|
38
|
+
target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, { consumerTag: targetConsumerTag });
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const broker = this.activity.broker;
|
|
@@ -44,11 +44,12 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
this[kCompleted] = false;
|
|
47
|
-
if (!executeMessage.fields.redelivered)
|
|
47
|
+
if (!executeMessage.fields.redelivered)
|
|
48
|
+
return broker.publish('execution', 'execute.outbound.take', cloneContent(executeContent, { outboundTaken: true }));
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompleted(executeMessage, _, message, owner) {
|
|
51
|
-
const {id: targetId, executionId: targetExecutionId} = message.content;
|
|
52
|
+
const { id: targetId, executionId: targetExecutionId } = message.content;
|
|
52
53
|
const executeContent = executeMessage.content;
|
|
53
54
|
const executionId = executeContent.executionId;
|
|
54
55
|
this.activity.logger.debug(`<${executionId} (${this.id})> <${targetExecutionId}> completed run, discarding the rest`);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import Activity from '../activity/Activity.js';
|
|
2
|
-
import {cloneContent} from '../messageHelper.js';
|
|
2
|
+
import { cloneContent } from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
export default function ExclusiveGateway(activityDef, context) {
|
|
5
5
|
return new Activity(ExclusiveGatewayBehaviour, activityDef, context);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function ExclusiveGatewayBehaviour(activity) {
|
|
9
|
-
const {id, type, broker} = activity;
|
|
9
|
+
const { id, type, broker } = activity;
|
|
10
10
|
this.id = id;
|
|
11
11
|
this.type = type;
|
|
12
12
|
this.broker = broker;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
ExclusiveGatewayBehaviour.prototype.execute = function execute({content}) {
|
|
16
|
-
this.broker.publish('execution', 'execute.completed', cloneContent(content, {outboundTakeOne: true}));
|
|
15
|
+
ExclusiveGatewayBehaviour.prototype.execute = function execute({ content }) {
|
|
16
|
+
this.broker.publish('execution', 'execute.completed', cloneContent(content, { outboundTakeOne: true }));
|
|
17
17
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import Activity from '../activity/Activity.js';
|
|
2
|
-
import {cloneContent} from '../messageHelper.js';
|
|
2
|
+
import { cloneContent } from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
export default function InclusiveGateway(activityDef, context) {
|
|
5
5
|
return new Activity(InclusiveGatewayBehaviour, activityDef, context);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function InclusiveGatewayBehaviour(activity) {
|
|
9
|
-
const {id, type, broker} = activity;
|
|
9
|
+
const { id, type, broker } = activity;
|
|
10
10
|
this.id = id;
|
|
11
11
|
this.type = type;
|
|
12
12
|
this.broker = broker;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
InclusiveGatewayBehaviour.prototype.execute = function execute({content}) {
|
|
15
|
+
InclusiveGatewayBehaviour.prototype.execute = function execute({ content }) {
|
|
16
16
|
this.broker.publish('execution', 'execute.completed', cloneContent(content));
|
|
17
17
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import Activity from '../activity/Activity.js';
|
|
2
|
-
import {cloneContent} from '../messageHelper.js';
|
|
2
|
+
import { cloneContent } from '../messageHelper.js';
|
|
3
3
|
|
|
4
4
|
export default function ParallelGateway(activityDef, context) {
|
|
5
|
-
return new Activity(ParallelGatewayBehaviour, {...activityDef, isParallelGateway: true}, context);
|
|
5
|
+
return new Activity(ParallelGatewayBehaviour, { ...activityDef, isParallelGateway: true }, context);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function ParallelGatewayBehaviour(activity) {
|
|
9
|
-
const {id, type, broker} = activity;
|
|
9
|
+
const { id, type, broker } = activity;
|
|
10
10
|
this.id = id;
|
|
11
11
|
this.type = type;
|
|
12
12
|
this.broker = broker;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
ParallelGatewayBehaviour.prototype.execute = function execute({content}) {
|
|
15
|
+
ParallelGatewayBehaviour.prototype.execute = function execute({ content }) {
|
|
16
16
|
this.broker.publish('execution', 'execute.completed', cloneContent(content));
|
|
17
17
|
};
|
package/src/getPropertyValue.js
CHANGED
|
@@ -52,9 +52,9 @@ function executeFn(fn, args, base, fnScope) {
|
|
|
52
52
|
|
|
53
53
|
if (!fnScope) return fn.apply(null, callArguments);
|
|
54
54
|
|
|
55
|
-
return
|
|
55
|
+
return function ScopedIIFE() {
|
|
56
56
|
return fn.apply(this, callArguments);
|
|
57
|
-
}
|
|
57
|
+
}.call(fnScope);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function splitArguments(args, base, fnScope) {
|
|
@@ -69,14 +69,12 @@ function splitArguments(args, base, fnScope) {
|
|
|
69
69
|
const charPos = args.charAt(i);
|
|
70
70
|
|
|
71
71
|
if (!insideString) {
|
|
72
|
-
|
|
73
72
|
if (charPos === ',') {
|
|
74
73
|
argCompleted = true;
|
|
75
|
-
|
|
76
74
|
} else if (charPos !== ' ') {
|
|
77
75
|
arg += charPos;
|
|
78
76
|
|
|
79
|
-
if (charPos === '
|
|
77
|
+
if (charPos === "'" || charPos === '"') {
|
|
80
78
|
insideString = true;
|
|
81
79
|
delimiter = charPos;
|
|
82
80
|
}
|
|
@@ -90,7 +88,6 @@ function splitArguments(args, base, fnScope) {
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
if (argCompleted) {
|
|
93
|
-
|
|
94
91
|
if (arg.length > 0) {
|
|
95
92
|
callArguments.push(getFunctionArgument(base, arg.trim(), fnScope));
|
|
96
93
|
}
|
package/src/index.js
CHANGED
|
@@ -47,8 +47,9 @@ import Task from './tasks/Task.js';
|
|
|
47
47
|
import TerminateEventDefinition from './eventDefinitions/TerminateEventDefinition.js';
|
|
48
48
|
import TimerEventDefinition from './eventDefinitions/TimerEventDefinition.js';
|
|
49
49
|
import Transaction from './tasks/Transaction.js';
|
|
50
|
-
import {Timers} from './Timers.js';
|
|
51
|
-
|
|
50
|
+
import { Timers } from './Timers.js';
|
|
51
|
+
|
|
52
|
+
export { ActivityError, RunError } from './error/Errors.js';
|
|
52
53
|
|
|
53
54
|
export {
|
|
54
55
|
Association,
|
|
@@ -108,5 +109,4 @@ export {
|
|
|
108
109
|
TimerEventDefinition,
|
|
109
110
|
Transaction,
|
|
110
111
|
Timers,
|
|
111
|
-
ISODuration,
|
|
112
112
|
};
|
package/src/io/BpmnIO.js
CHANGED
|
@@ -3,10 +3,7 @@ export default function BpmnIO(activity, context) {
|
|
|
3
3
|
this.context = context;
|
|
4
4
|
this.type = 'bpmnio';
|
|
5
5
|
|
|
6
|
-
const {
|
|
7
|
-
ioSpecification: ioSpecificationDef,
|
|
8
|
-
properties: propertiesDef,
|
|
9
|
-
} = activity.behaviour;
|
|
6
|
+
const { ioSpecification: ioSpecificationDef, properties: propertiesDef } = activity.behaviour;
|
|
10
7
|
|
|
11
8
|
this.specification = ioSpecificationDef && new ioSpecificationDef.Behaviour(activity, ioSpecificationDef, context);
|
|
12
9
|
this.properties = propertiesDef && new propertiesDef.Behaviour(activity, propertiesDef, context);
|
|
@@ -19,13 +16,15 @@ Object.defineProperty(BpmnIO.prototype, 'hasIo', {
|
|
|
19
16
|
});
|
|
20
17
|
|
|
21
18
|
BpmnIO.prototype.activate = function activate(message) {
|
|
22
|
-
const properties = this.properties,
|
|
19
|
+
const properties = this.properties,
|
|
20
|
+
specification = this.specification;
|
|
23
21
|
if (properties) properties.activate(message);
|
|
24
22
|
if (specification) specification.activate(message);
|
|
25
23
|
};
|
|
26
24
|
|
|
27
25
|
BpmnIO.prototype.deactivate = function deactivate(message) {
|
|
28
|
-
const properties = this.properties,
|
|
26
|
+
const properties = this.properties,
|
|
27
|
+
specification = this.specification;
|
|
29
28
|
if (properties) properties.deactivate(message);
|
|
30
29
|
if (specification) specification.deactivate(message);
|
|
31
30
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function EnvironmentDataObject(dataObjectDef, {environment}) {
|
|
2
|
-
const {id, type, name, behaviour, parent} = dataObjectDef;
|
|
1
|
+
export default function EnvironmentDataObject(dataObjectDef, { environment }) {
|
|
2
|
+
const { id, type, name, behaviour, parent } = dataObjectDef;
|
|
3
3
|
this.id = id;
|
|
4
4
|
this.type = type;
|
|
5
5
|
this.name = name;
|
|
@@ -9,7 +9,6 @@ export default function EnvironmentDataObject(dataObjectDef, {environment}) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
EnvironmentDataObject.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
12
|
-
|
|
13
12
|
const environment = this.environment;
|
|
14
13
|
const value = environment.variables._data && environment.variables._data[this.id];
|
|
15
14
|
const content = this._createContent(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function EnvironmentDataStore(dataStoreDef, {environment}) {
|
|
2
|
-
const {id, type, name, behaviour, parent} = dataStoreDef;
|
|
1
|
+
export default function EnvironmentDataStore(dataStoreDef, { environment }) {
|
|
2
|
+
const { id, type, name, behaviour, parent } = dataStoreDef;
|
|
3
3
|
this.id = id;
|
|
4
4
|
this.type = type;
|
|
5
5
|
this.name = name;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function EnvironmentDataStoreReference(dataObjectDef, {environment}) {
|
|
2
|
-
const {id, type, name, behaviour, parent} = dataObjectDef;
|
|
1
|
+
export default function EnvironmentDataStoreReference(dataObjectDef, { environment }) {
|
|
2
|
+
const { id, type, name, behaviour, parent } = dataObjectDef;
|
|
3
3
|
this.id = id;
|
|
4
4
|
this.type = type;
|
|
5
5
|
this.name = name;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
-
import {brokerSafeId} from '../shared.js';
|
|
2
|
+
import { brokerSafeId } from '../shared.js';
|
|
3
3
|
|
|
4
4
|
const kConsuming = Symbol.for('consuming');
|
|
5
5
|
|
|
6
6
|
export default function IoSpecification(activity, ioSpecificationDef, context) {
|
|
7
|
-
const {id, type = 'iospecification', behaviour = {}} = ioSpecificationDef;
|
|
7
|
+
const { id, type = 'iospecification', behaviour = {} } = ioSpecificationDef;
|
|
8
8
|
this.id = id;
|
|
9
9
|
this.type = type;
|
|
10
10
|
this.behaviour = behaviour;
|
|
@@ -21,7 +21,7 @@ IoSpecification.prototype.activate = function activate(message) {
|
|
|
21
21
|
if (message && message.fields.redelivered && message.fields.routingKey === 'run.end') {
|
|
22
22
|
this._onFormatComplete(message);
|
|
23
23
|
}
|
|
24
|
-
this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
|
|
24
|
+
this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
IoSpecification.prototype.deactivate = function deactivate() {
|
|
@@ -29,7 +29,7 @@ IoSpecification.prototype.deactivate = function deactivate() {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
IoSpecification.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
32
|
-
const {dataInputs, dataOutputs} = this.behaviour;
|
|
32
|
+
const { dataInputs, dataOutputs } = this.behaviour;
|
|
33
33
|
if ((dataInputs || dataOutputs) && routingKey === 'activity.enter') {
|
|
34
34
|
return this._onFormatEnter();
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ IoSpecification.prototype._onActivityEvent = function onActivityEvent(routingKey
|
|
|
42
42
|
IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
|
|
43
43
|
const safeType = brokerSafeId(this.type).toLowerCase();
|
|
44
44
|
const startRoutingKey = `run.onstart.${safeType}`;
|
|
45
|
-
const {dataInputs, dataOutputs} = this.behaviour;
|
|
45
|
+
const { dataInputs, dataOutputs } = this.behaviour;
|
|
46
46
|
const broker = this.broker;
|
|
47
47
|
if (!dataInputs) {
|
|
48
48
|
return broker.publish('format', startRoutingKey, {
|
|
@@ -52,24 +52,27 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const {dataObjects, sources} = dataInputs.reduce(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
const { dataObjects, sources } = dataInputs.reduce(
|
|
56
|
+
(result, ioSource, index) => {
|
|
57
|
+
const source = {
|
|
58
|
+
id: ioSource.id,
|
|
59
|
+
type: ioSource.type,
|
|
60
|
+
name: ioSource.name,
|
|
61
|
+
};
|
|
62
|
+
result.sources.push(source);
|
|
63
|
+
|
|
64
|
+
const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.source.dataObject.id');
|
|
65
|
+
if (!dataObjectId) return result;
|
|
66
|
+
const dataObject = this.context.getDataObjectById(dataObjectId);
|
|
67
|
+
if (!dataObject) return result;
|
|
68
|
+
result.dataObjects.push({ index, dataObject });
|
|
69
|
+
return result;
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
dataObjects: [],
|
|
73
|
+
sources: [],
|
|
74
|
+
},
|
|
75
|
+
);
|
|
73
76
|
|
|
74
77
|
if (!dataObjects.length) {
|
|
75
78
|
return broker.publish('format', startRoutingKey, {
|
|
@@ -85,7 +88,7 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
|
|
|
85
88
|
endRoutingKey,
|
|
86
89
|
ioSpecification: {
|
|
87
90
|
dataInputs: sources.map((source) => {
|
|
88
|
-
return {...source};
|
|
91
|
+
return { ...source };
|
|
89
92
|
}),
|
|
90
93
|
dataOutputs: this._getDataOutputs(dataOutputs),
|
|
91
94
|
},
|
|
@@ -111,26 +114,29 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
|
|
|
111
114
|
const broker = this.broker;
|
|
112
115
|
const context = this.context;
|
|
113
116
|
|
|
114
|
-
const {dataObjects, sources} = dataOutputs.reduce(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
const { dataObjects, sources } = dataOutputs.reduce(
|
|
118
|
+
(result, ioSource, index) => {
|
|
119
|
+
const { value } = messageOutputs.find((output) => output.id === ioSource.id) || {};
|
|
120
|
+
const source = {
|
|
121
|
+
id: ioSource.id,
|
|
122
|
+
type: ioSource.type,
|
|
123
|
+
name: ioSource.name,
|
|
124
|
+
value,
|
|
125
|
+
};
|
|
126
|
+
result.sources.push(source);
|
|
127
|
+
|
|
128
|
+
const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.target.dataObject.id');
|
|
129
|
+
if (!dataObjectId) return result;
|
|
130
|
+
const dataObject = context.getDataObjectById(dataObjectId);
|
|
131
|
+
if (!dataObject) return result;
|
|
132
|
+
result.dataObjects.push({ index, dataObject, value });
|
|
133
|
+
return result;
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
dataObjects: [],
|
|
137
|
+
sources: [],
|
|
138
|
+
},
|
|
139
|
+
);
|
|
134
140
|
|
|
135
141
|
const startRoutingKey = `run.onend.${safeType}`;
|
|
136
142
|
if (!dataObjects.length) {
|
|
@@ -148,7 +154,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
|
|
|
148
154
|
ioSpecification: {
|
|
149
155
|
...(messageInputs && {
|
|
150
156
|
dataInputs: messageInputs.map((input) => {
|
|
151
|
-
return {...input};
|
|
157
|
+
return { ...input };
|
|
152
158
|
}),
|
|
153
159
|
}),
|
|
154
160
|
dataOutputs: this._getDataOutputs(dataOutputs),
|
|
@@ -162,7 +168,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
|
|
|
162
168
|
ioSpecification: {
|
|
163
169
|
...(messageInputs && {
|
|
164
170
|
dataInputs: messageInputs.map((input) => {
|
|
165
|
-
return {...input};
|
|
171
|
+
return { ...input };
|
|
166
172
|
}),
|
|
167
173
|
}),
|
|
168
174
|
dataOutputs: sources,
|
|
@@ -185,15 +191,15 @@ IoSpecification.prototype._getDataOutputs = function getDataOutputs(dataOutputs)
|
|
|
185
191
|
function read(broker, dataObjectRefs, callback) {
|
|
186
192
|
const responses = [];
|
|
187
193
|
let count = 0;
|
|
188
|
-
const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataObjectResponse, {noAck: true});
|
|
194
|
+
const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataObjectResponse, { noAck: true });
|
|
189
195
|
|
|
190
|
-
for (const {dataObject} of dataObjectRefs) {
|
|
196
|
+
for (const { dataObject } of dataObjectRefs) {
|
|
191
197
|
dataObject.read(broker, 'data', 'data.read.');
|
|
192
198
|
}
|
|
193
199
|
|
|
194
200
|
function onDataObjectResponse(routingKey, message) {
|
|
195
|
-
const {index} = dataObjectRefs.find(({dataObject}) => dataObject.id === message.content.id);
|
|
196
|
-
responses.push({...message.content, index});
|
|
201
|
+
const { index } = dataObjectRefs.find(({ dataObject }) => dataObject.id === message.content.id);
|
|
202
|
+
responses.push({ ...message.content, index });
|
|
197
203
|
|
|
198
204
|
++count;
|
|
199
205
|
|
|
@@ -207,15 +213,15 @@ function read(broker, dataObjectRefs, callback) {
|
|
|
207
213
|
function write(broker, dataObjectRefs, callback) {
|
|
208
214
|
const responses = [];
|
|
209
215
|
let count = 0;
|
|
210
|
-
broker.subscribeTmp('data', 'data.write.#', onDataObjectResponse, {noAck: true});
|
|
216
|
+
broker.subscribeTmp('data', 'data.write.#', onDataObjectResponse, { noAck: true });
|
|
211
217
|
|
|
212
|
-
for (const {dataObject, value} of dataObjectRefs) {
|
|
218
|
+
for (const { dataObject, value } of dataObjectRefs) {
|
|
213
219
|
dataObject.write(broker, 'data', 'data.write.', value);
|
|
214
220
|
}
|
|
215
221
|
|
|
216
222
|
function onDataObjectResponse(routingKey, message) {
|
|
217
|
-
const idx = dataObjectRefs.findIndex(({dataObject}) => dataObject.id === message.content.id);
|
|
218
|
-
responses[idx] = {index: idx, ...message.content};
|
|
223
|
+
const idx = dataObjectRefs.findIndex(({ dataObject }) => dataObject.id === message.content.id);
|
|
224
|
+
responses[idx] = { index: idx, ...message.content };
|
|
219
225
|
|
|
220
226
|
++count;
|
|
221
227
|
|
package/src/io/Properties.js
CHANGED
|
@@ -7,13 +7,13 @@ export default function Properties(activity, propertiesDef, context) {
|
|
|
7
7
|
this.activity = activity;
|
|
8
8
|
this.broker = activity.broker;
|
|
9
9
|
|
|
10
|
-
const props = this[kProperties] = {
|
|
10
|
+
const props = (this[kProperties] = {
|
|
11
11
|
properties: [],
|
|
12
12
|
dataInputObjects: [],
|
|
13
13
|
dataOutputObjects: [],
|
|
14
|
-
};
|
|
14
|
+
});
|
|
15
15
|
|
|
16
|
-
for (const {id, ...def} of propertiesDef.values) {
|
|
16
|
+
for (const { id, ...def } of propertiesDef.values) {
|
|
17
17
|
const source = {
|
|
18
18
|
id,
|
|
19
19
|
type: def.type,
|
|
@@ -28,28 +28,28 @@ export default function Properties(activity, propertiesDef, context) {
|
|
|
28
28
|
|
|
29
29
|
if (inputDataObjectId) {
|
|
30
30
|
const reference = context.getDataObjectById(inputDataObjectId);
|
|
31
|
-
props.dataInputObjects.push({id, reference});
|
|
31
|
+
props.dataInputObjects.push({ id, reference });
|
|
32
32
|
source.input = {
|
|
33
33
|
reference,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
if (outputDataObjectId) {
|
|
37
37
|
const reference = context.getDataObjectById(outputDataObjectId);
|
|
38
|
-
props.dataOutputObjects.push({id, reference: reference});
|
|
38
|
+
props.dataOutputObjects.push({ id, reference: reference });
|
|
39
39
|
source.output = {
|
|
40
40
|
reference,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
if (inputDataStoreId) {
|
|
44
44
|
const reference = context.getDataStoreById(inputDataStoreId);
|
|
45
|
-
props.dataInputObjects.push({id, reference});
|
|
45
|
+
props.dataInputObjects.push({ id, reference });
|
|
46
46
|
source.input = {
|
|
47
47
|
reference,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
if (outputDataStoreId) {
|
|
51
51
|
const reference = context.getDataStoreById(outputDataStoreId);
|
|
52
|
-
props.dataOutputObjects.push({id, reference});
|
|
52
|
+
props.dataOutputObjects.push({ id, reference });
|
|
53
53
|
source.output = {
|
|
54
54
|
reference,
|
|
55
55
|
};
|
|
@@ -67,7 +67,7 @@ Properties.prototype.activate = function activate(message) {
|
|
|
67
67
|
this._onActivityEvent('activity.extension.resume', message);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
|
|
70
|
+
this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
Properties.prototype.deactivate = function deactivate() {
|
|
@@ -90,16 +90,22 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
|
|
|
90
90
|
const dataInputObjects = this[kProperties].dataInputObjects;
|
|
91
91
|
const broker = this.broker;
|
|
92
92
|
if (!dataInputObjects.length) {
|
|
93
|
-
return broker.getQueue('format-run-q').queueMessage(
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
return broker.getQueue('format-run-q').queueMessage(
|
|
94
|
+
{ routingKey: startRoutingKey },
|
|
95
|
+
{
|
|
96
|
+
properties: this._getProperties(message),
|
|
97
|
+
},
|
|
98
|
+
);
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
const endRoutingKey = 'run.enter.bpmn-properties.end';
|
|
99
|
-
broker.getQueue('format-run-q').queueMessage(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
broker.getQueue('format-run-q').queueMessage(
|
|
103
|
+
{ routingKey: startRoutingKey },
|
|
104
|
+
{
|
|
105
|
+
endRoutingKey,
|
|
106
|
+
properties: this._getProperties(message),
|
|
107
|
+
},
|
|
108
|
+
);
|
|
103
109
|
|
|
104
110
|
return read(broker, dataInputObjects, (_, responses) => {
|
|
105
111
|
broker.publish('format', endRoutingKey, {
|
|
@@ -117,16 +123,22 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
|
|
|
117
123
|
const dataOutputObjects = this[kProperties].dataOutputObjects;
|
|
118
124
|
const broker = this.broker;
|
|
119
125
|
if (!dataOutputObjects.length) {
|
|
120
|
-
return broker.getQueue('format-run-q').queueMessage(
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
return broker.getQueue('format-run-q').queueMessage(
|
|
127
|
+
{ routingKey: startRoutingKey },
|
|
128
|
+
{
|
|
129
|
+
properties: outputProperties,
|
|
130
|
+
},
|
|
131
|
+
);
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
const endRoutingKey = 'run.end.bpmn-properties.end';
|
|
126
|
-
broker.getQueue('format-run-q').queueMessage(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
broker.getQueue('format-run-q').queueMessage(
|
|
136
|
+
{ routingKey: startRoutingKey },
|
|
137
|
+
{
|
|
138
|
+
endRoutingKey,
|
|
139
|
+
properties: outputProperties,
|
|
140
|
+
},
|
|
141
|
+
);
|
|
130
142
|
|
|
131
143
|
return write(broker, dataOutputObjects, outputProperties, (_, responses) => {
|
|
132
144
|
broker.publish('format', endRoutingKey, {
|
|
@@ -139,12 +151,12 @@ Properties.prototype._getProperties = function getProperties(message, values) {
|
|
|
139
151
|
let response = {};
|
|
140
152
|
|
|
141
153
|
if (message.content.properties) {
|
|
142
|
-
response = {...message.content.properties};
|
|
154
|
+
response = { ...message.content.properties };
|
|
143
155
|
}
|
|
144
156
|
|
|
145
|
-
for (const {id, type, name} of this[kProperties].properties) {
|
|
157
|
+
for (const { id, type, name } of this[kProperties].properties) {
|
|
146
158
|
if (!(id in response)) {
|
|
147
|
-
response[id] = {id, type, name};
|
|
159
|
+
response[id] = { id, type, name };
|
|
148
160
|
}
|
|
149
161
|
|
|
150
162
|
if (!values || !(id in values)) continue;
|
|
@@ -158,14 +170,14 @@ function read(broker, dataReferences, callback) {
|
|
|
158
170
|
const responses = {};
|
|
159
171
|
let count = 0;
|
|
160
172
|
|
|
161
|
-
const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, {noAck: true});
|
|
173
|
+
const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, { noAck: true });
|
|
162
174
|
|
|
163
|
-
for (const {id: propertyId, reference} of dataReferences) {
|
|
164
|
-
reference.read(broker, 'data', 'data.read.', {correlationId: propertyId});
|
|
175
|
+
for (const { id: propertyId, reference } of dataReferences) {
|
|
176
|
+
reference.read(broker, 'data', 'data.read.', { correlationId: propertyId });
|
|
165
177
|
}
|
|
166
178
|
|
|
167
179
|
function onDataReadResponse(routingKey, message) {
|
|
168
|
-
responses[message.properties.correlationId] = {...message.content};
|
|
180
|
+
responses[message.properties.correlationId] = { ...message.content };
|
|
169
181
|
|
|
170
182
|
if (++count < dataReferences.length) return;
|
|
171
183
|
|
|
@@ -177,15 +189,15 @@ function read(broker, dataReferences, callback) {
|
|
|
177
189
|
function write(broker, dataReferences, properties, callback) {
|
|
178
190
|
const responses = [];
|
|
179
191
|
let count = 0;
|
|
180
|
-
const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, {noAck: true});
|
|
192
|
+
const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, { noAck: true });
|
|
181
193
|
|
|
182
|
-
for (const {id: propertyId, reference} of dataReferences) {
|
|
194
|
+
for (const { id: propertyId, reference } of dataReferences) {
|
|
183
195
|
const value = propertyId in properties ? properties[propertyId].value : undefined;
|
|
184
|
-
reference.write(broker, 'data', 'data.write.', value, {correlationId: propertyId});
|
|
196
|
+
reference.write(broker, 'data', 'data.write.', value, { correlationId: propertyId });
|
|
185
197
|
}
|
|
186
198
|
|
|
187
199
|
function onDataWriteResponse(routingKey, message) {
|
|
188
|
-
responses[message.properties.correlationId] = {...message.content};
|
|
200
|
+
responses[message.properties.correlationId] = { ...message.content };
|
|
189
201
|
|
|
190
202
|
if (++count < dataReferences.length) return;
|
|
191
203
|
|