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
package/src/Environment.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import Expressions from './Expressions.js';
|
|
2
|
-
import {Scripts as IScripts} from './Scripts.js';
|
|
3
|
-
import {Timers} from './Timers.js';
|
|
2
|
+
import { Scripts as IScripts } from './Scripts.js';
|
|
3
|
+
import { Timers } from './Timers.js';
|
|
4
4
|
|
|
5
5
|
const kServices = Symbol.for('services');
|
|
6
6
|
const kVariables = Symbol.for('variables');
|
|
7
7
|
|
|
8
|
-
const defaultOptions = [
|
|
9
|
-
'expressions',
|
|
10
|
-
'extensions',
|
|
11
|
-
'Logger',
|
|
12
|
-
'output',
|
|
13
|
-
'scripts',
|
|
14
|
-
'services',
|
|
15
|
-
'settings',
|
|
16
|
-
'timers',
|
|
17
|
-
'variables',
|
|
18
|
-
];
|
|
8
|
+
const defaultOptions = ['expressions', 'extensions', 'Logger', 'output', 'scripts', 'services', 'settings', 'timers', 'variables'];
|
|
19
9
|
|
|
20
10
|
export default function Environment(options = {}) {
|
|
21
11
|
this.options = validateOptions(options);
|
|
@@ -25,7 +15,7 @@ export default function Environment(options = {}) {
|
|
|
25
15
|
this.output = options.output || {};
|
|
26
16
|
this.scripts = options.scripts || IScripts();
|
|
27
17
|
this.timers = options.timers || new Timers();
|
|
28
|
-
this.settings = {...options.settings};
|
|
18
|
+
this.settings = { ...options.settings };
|
|
29
19
|
this.Logger = options.Logger || DummyLogger;
|
|
30
20
|
this[kServices] = options.services || {};
|
|
31
21
|
this[kVariables] = options.variables || {};
|
|
@@ -53,9 +43,9 @@ Object.defineProperties(Environment.prototype, {
|
|
|
53
43
|
|
|
54
44
|
Environment.prototype.getState = function getState() {
|
|
55
45
|
return {
|
|
56
|
-
settings: {...this.settings},
|
|
57
|
-
variables: {...this[kVariables]},
|
|
58
|
-
output: {...this.output},
|
|
46
|
+
settings: { ...this.settings },
|
|
47
|
+
variables: { ...this[kVariables] },
|
|
48
|
+
output: { ...this.output },
|
|
59
49
|
};
|
|
60
50
|
};
|
|
61
51
|
|
|
@@ -72,8 +62,8 @@ Environment.prototype.recover = function recover(state) {
|
|
|
72
62
|
Environment.prototype.clone = function clone(overrideOptions = {}) {
|
|
73
63
|
const services = this[kServices];
|
|
74
64
|
const newOptions = {
|
|
75
|
-
settings: {...this.settings},
|
|
76
|
-
variables: {...this[kVariables]},
|
|
65
|
+
settings: { ...this.settings },
|
|
66
|
+
variables: { ...this[kVariables] },
|
|
77
67
|
Logger: this.Logger,
|
|
78
68
|
extensions: this.extensions,
|
|
79
69
|
scripts: this.scripts,
|
|
@@ -84,7 +74,7 @@ Environment.prototype.clone = function clone(overrideOptions = {}) {
|
|
|
84
74
|
services,
|
|
85
75
|
};
|
|
86
76
|
|
|
87
|
-
if (overrideOptions.services) newOptions.services = {...services, ...overrideOptions.services};
|
|
77
|
+
if (overrideOptions.services) newOptions.services = { ...services, ...overrideOptions.services };
|
|
88
78
|
|
|
89
79
|
return new this.constructor(newOptions);
|
|
90
80
|
};
|
package/src/EventBroker.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { Broker } from 'smqp';
|
|
2
2
|
import { makeErrorFromMessage } from './error/Errors.js';
|
|
3
3
|
|
|
4
|
-
export {
|
|
5
|
-
ActivityBroker,
|
|
6
|
-
DefinitionBroker,
|
|
7
|
-
MessageFlowBroker,
|
|
8
|
-
ProcessBroker,
|
|
9
|
-
EventBroker
|
|
10
|
-
};
|
|
4
|
+
export { ActivityBroker, DefinitionBroker, MessageFlowBroker, ProcessBroker, EventBroker };
|
|
11
5
|
|
|
12
6
|
function ActivityBroker(activity) {
|
|
13
7
|
const executionBroker = ExecutionBroker(activity, 'activity');
|
|
@@ -16,7 +10,7 @@ function ActivityBroker(activity) {
|
|
|
16
10
|
|
|
17
11
|
function ProcessBroker(owner) {
|
|
18
12
|
const executionBroker = ExecutionBroker(owner, 'process');
|
|
19
|
-
executionBroker.broker.assertQueue('api-q', {durable: false, autoDelete: false});
|
|
13
|
+
executionBroker.broker.assertQueue('api-q', { durable: false, autoDelete: false });
|
|
20
14
|
executionBroker.broker.bindQueue('api-q', 'api', '#');
|
|
21
15
|
return executionBroker;
|
|
22
16
|
}
|
|
@@ -26,29 +20,29 @@ function DefinitionBroker(owner, onBrokerReturn) {
|
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
function MessageFlowBroker(owner) {
|
|
29
|
-
const eventBroker = new EventBroker(owner, {prefix: 'messageflow', autoDelete: false, durable: false});
|
|
23
|
+
const eventBroker = new EventBroker(owner, { prefix: 'messageflow', autoDelete: false, durable: false });
|
|
30
24
|
const broker = eventBroker.broker;
|
|
31
25
|
|
|
32
|
-
broker.assertExchange('message', 'topic', {durable: true, autoDelete: false});
|
|
33
|
-
broker.assertQueue('message-q', {durable: true, autoDelete: false});
|
|
26
|
+
broker.assertExchange('message', 'topic', { durable: true, autoDelete: false });
|
|
27
|
+
broker.assertQueue('message-q', { durable: true, autoDelete: false });
|
|
34
28
|
broker.bindQueue('message-q', 'message', 'message.#');
|
|
35
29
|
|
|
36
30
|
return eventBroker;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
|
|
40
|
-
const eventBroker = new EventBroker(brokerOwner, {prefix, autoDelete: false, durable: false}, onBrokerReturn);
|
|
34
|
+
const eventBroker = new EventBroker(brokerOwner, { prefix, autoDelete: false, durable: false }, onBrokerReturn);
|
|
41
35
|
const broker = eventBroker.broker;
|
|
42
36
|
|
|
43
|
-
broker.assertExchange('api', 'topic', {autoDelete: false, durable: false});
|
|
44
|
-
broker.assertExchange('run', 'topic', {autoDelete: false});
|
|
45
|
-
broker.assertExchange('format', 'topic', {autoDelete: false});
|
|
46
|
-
broker.assertExchange('execution', 'topic', {autoDelete: false});
|
|
37
|
+
broker.assertExchange('api', 'topic', { autoDelete: false, durable: false });
|
|
38
|
+
broker.assertExchange('run', 'topic', { autoDelete: false });
|
|
39
|
+
broker.assertExchange('format', 'topic', { autoDelete: false });
|
|
40
|
+
broker.assertExchange('execution', 'topic', { autoDelete: false });
|
|
47
41
|
|
|
48
|
-
const runQ = broker.assertQueue('run-q', {durable: true, autoDelete: false});
|
|
49
|
-
const formatRunQ = broker.assertQueue('format-run-q', {durable: true, autoDelete: false});
|
|
50
|
-
const executionQ = broker.assertQueue('execution-q', {durable: true, autoDelete: false});
|
|
51
|
-
broker.assertQueue('inbound-q', {durable: true, autoDelete: false});
|
|
42
|
+
const runQ = broker.assertQueue('run-q', { durable: true, autoDelete: false });
|
|
43
|
+
const formatRunQ = broker.assertQueue('format-run-q', { durable: true, autoDelete: false });
|
|
44
|
+
const executionQ = broker.assertQueue('execution-q', { durable: true, autoDelete: false });
|
|
45
|
+
broker.assertQueue('inbound-q', { durable: true, autoDelete: false });
|
|
52
46
|
|
|
53
47
|
broker.bindQueue(runQ.name, 'run', 'run.#');
|
|
54
48
|
broker.bindQueue(formatRunQ.name, 'format', 'run.#');
|
|
@@ -61,7 +55,7 @@ function EventBroker(brokerOwner, options, onBrokerReturn) {
|
|
|
61
55
|
this.options = options;
|
|
62
56
|
this.eventPrefix = options.prefix;
|
|
63
57
|
|
|
64
|
-
const broker = this.broker = Broker(brokerOwner);
|
|
58
|
+
const broker = (this.broker = Broker(brokerOwner));
|
|
65
59
|
broker.assertExchange('event', 'topic', options);
|
|
66
60
|
broker.on('return', onBrokerReturn ? onBrokerReturn.bind(brokerOwner) : this._onBrokerReturnFn.bind(this));
|
|
67
61
|
|
|
@@ -76,7 +70,7 @@ EventBroker.prototype.on = function on(eventName, callback, eventOptions = { onc
|
|
|
76
70
|
const key = this._getEventRoutingKey(eventName);
|
|
77
71
|
|
|
78
72
|
if (eventOptions.once) return this.broker.subscribeOnce('event', key, eventCallback, eventOptions);
|
|
79
|
-
return this.broker.subscribeTmp('event', key, eventCallback, {...eventOptions, noAck: true});
|
|
73
|
+
return this.broker.subscribeTmp('event', key, eventCallback, { ...eventOptions, noAck: true });
|
|
80
74
|
|
|
81
75
|
function eventCallback(routingKey, message, owner) {
|
|
82
76
|
if (eventName === 'error') return callback(makeErrorFromMessage(message));
|
|
@@ -85,7 +79,7 @@ EventBroker.prototype.on = function on(eventName, callback, eventOptions = { onc
|
|
|
85
79
|
};
|
|
86
80
|
|
|
87
81
|
EventBroker.prototype.once = function once(eventName, callback, eventOptions = {}) {
|
|
88
|
-
return this.on(eventName, callback, {...eventOptions, once: true});
|
|
82
|
+
return this.on(eventName, callback, { ...eventOptions, once: true });
|
|
89
83
|
};
|
|
90
84
|
|
|
91
85
|
EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
@@ -93,8 +87,8 @@ EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
|
93
87
|
|
|
94
88
|
return new Promise((resolve, reject) => {
|
|
95
89
|
const consumers = [
|
|
96
|
-
this.broker.subscribeTmp('event', key, eventCallback, {noAck: true}),
|
|
97
|
-
this.broker.subscribeTmp('event', '*.error', errorCallback, {noAck: true}),
|
|
90
|
+
this.broker.subscribeTmp('event', key, eventCallback, { noAck: true }),
|
|
91
|
+
this.broker.subscribeTmp('event', '*.error', errorCallback, { noAck: true }),
|
|
98
92
|
];
|
|
99
93
|
|
|
100
94
|
function eventCallback(routingKey, message, owner) {
|
|
@@ -118,11 +112,11 @@ EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
|
118
112
|
};
|
|
119
113
|
|
|
120
114
|
EventBroker.prototype.emit = function emit(eventName, content, props) {
|
|
121
|
-
this.broker.publish('event', `${this.eventPrefix}.${eventName}`, {...content}, {type: eventName, ...props});
|
|
115
|
+
this.broker.publish('event', `${this.eventPrefix}.${eventName}`, { ...content }, { type: eventName, ...props });
|
|
122
116
|
};
|
|
123
117
|
|
|
124
118
|
EventBroker.prototype.emitFatal = function emitFatal(error, content) {
|
|
125
|
-
this.emit('error', {...content, error}, {mandatory: true});
|
|
119
|
+
this.emit('error', { ...content, error }, { mandatory: true });
|
|
126
120
|
};
|
|
127
121
|
|
|
128
122
|
EventBroker.prototype._onBrokerReturnFn = function onBrokerReturnFn(message) {
|
package/src/MessageFormatter.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {cloneMessage} from './messageHelper.js';
|
|
2
|
-
import {getUniqueId} from './shared.js';
|
|
3
|
-
import {ActivityError} from './error/Errors.js';
|
|
4
|
-
import {getRoutingKeyPattern} from 'smqp';
|
|
1
|
+
import { cloneMessage } from './messageHelper.js';
|
|
2
|
+
import { getUniqueId } from './shared.js';
|
|
3
|
+
import { ActivityError } from './error/Errors.js';
|
|
4
|
+
import { getRoutingKeyPattern } from 'smqp';
|
|
5
5
|
|
|
6
6
|
const kOnMessage = Symbol.for('onMessage');
|
|
7
7
|
const kExecution = Symbol.for('execution');
|
|
8
8
|
|
|
9
|
-
export {Formatter};
|
|
9
|
+
export { Formatter };
|
|
10
10
|
|
|
11
11
|
function Formatter(element, formatQ) {
|
|
12
|
-
const {id, broker, logger} = element;
|
|
12
|
+
const { id, broker, logger } = element;
|
|
13
13
|
this.id = id;
|
|
14
14
|
this.broker = broker;
|
|
15
15
|
this.logger = logger;
|
|
@@ -21,16 +21,20 @@ function Formatter(element, formatQ) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
Formatter.prototype.format = function format(message, callback) {
|
|
24
|
-
const correlationId = this._runId = getUniqueId(message.fields.routingKey);
|
|
24
|
+
const correlationId = (this._runId = getUniqueId(message.fields.routingKey));
|
|
25
25
|
const consumerTag = '_formatter-' + correlationId;
|
|
26
26
|
const formatQ = this.formatQ;
|
|
27
27
|
|
|
28
|
-
formatQ.queueMessage(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
formatQ.queueMessage(
|
|
29
|
+
{
|
|
30
|
+
routingKey: '_formatting.exec',
|
|
31
|
+
},
|
|
32
|
+
{},
|
|
33
|
+
{
|
|
34
|
+
correlationId,
|
|
35
|
+
persistent: false,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
34
38
|
|
|
35
39
|
this[kExecution] = {
|
|
36
40
|
correlationId,
|
|
@@ -49,7 +53,7 @@ Formatter.prototype.format = function format(message, callback) {
|
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
52
|
-
const {formatKey, correlationId, pending, executeMessage} = this[kExecution];
|
|
56
|
+
const { formatKey, correlationId, pending, executeMessage } = this[kExecution];
|
|
53
57
|
const asyncFormatting = pending.length;
|
|
54
58
|
|
|
55
59
|
switch (routingKey) {
|
|
@@ -72,7 +76,7 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
if (asyncFormatting) {
|
|
75
|
-
const {isError, message: startMessage} = this._popFormatStart(pending, routingKey);
|
|
79
|
+
const { isError, message: startMessage } = this._popFormatStart(pending, routingKey);
|
|
76
80
|
if (startMessage) startMessage.ack();
|
|
77
81
|
|
|
78
82
|
if (isError) {
|
|
@@ -91,7 +95,7 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
91
95
|
};
|
|
92
96
|
|
|
93
97
|
Formatter.prototype._complete = function complete(message, isError) {
|
|
94
|
-
const {runMessage, formatKey, callback, formatted, executeMessage} = this[kExecution];
|
|
98
|
+
const { runMessage, formatKey, callback, formatted, executeMessage } = this[kExecution];
|
|
95
99
|
this[kExecution] = null;
|
|
96
100
|
if (executeMessage) executeMessage.ack();
|
|
97
101
|
|
|
@@ -134,15 +138,15 @@ Formatter.prototype._decorate = function decorate(withContent) {
|
|
|
134
138
|
Formatter.prototype._popFormatStart = function popFormattingStart(pending, routingKey) {
|
|
135
139
|
for (let idx = 0; idx < pending.length; idx++) {
|
|
136
140
|
const msg = pending[idx];
|
|
137
|
-
const {endRoutingKey, errorRoutingKey = '#.error'} = msg.content;
|
|
141
|
+
const { endRoutingKey, errorRoutingKey = '#.error' } = msg.content;
|
|
138
142
|
|
|
139
143
|
if (endRoutingKey && getRoutingKeyPattern(endRoutingKey).test(routingKey)) {
|
|
140
144
|
this._debug(`completed formatting ${msg.fields.routingKey} message content with formatter ${routingKey}`);
|
|
141
145
|
pending.splice(idx, 1);
|
|
142
|
-
return {message: msg};
|
|
146
|
+
return { message: msg };
|
|
143
147
|
} else if (getRoutingKeyPattern(errorRoutingKey).test(routingKey)) {
|
|
144
148
|
pending.splice(idx, 1);
|
|
145
|
-
return {isError: true, message: msg};
|
|
149
|
+
return { isError: true, message: msg };
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
package/src/Tracker.js
CHANGED
|
@@ -45,28 +45,28 @@ ActivityTracker.prototype.track = function track(routingKey, message) {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
ActivityTracker.prototype._executing = function executing(id) {
|
|
48
|
-
const {wait, execute} = this.status;
|
|
48
|
+
const { wait, execute } = this.status;
|
|
49
49
|
if (execute.indexOf(id) === -1) execute.push(id);
|
|
50
50
|
let idx;
|
|
51
51
|
if ((idx = wait.indexOf(id)) !== -1) wait.splice(idx, 1);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
ActivityTracker.prototype._waiting = function waiting(id) {
|
|
55
|
-
const {wait, execute} = this.status;
|
|
55
|
+
const { wait, execute } = this.status;
|
|
56
56
|
if (wait.indexOf(id) === -1) wait.push(id);
|
|
57
57
|
let idx;
|
|
58
58
|
if ((idx = execute.indexOf(id)) !== -1) execute.splice(idx, 1);
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
ActivityTracker.prototype._timer = function timerFn(id) {
|
|
62
|
-
const {timer, execute} = this.status;
|
|
62
|
+
const { timer, execute } = this.status;
|
|
63
63
|
if (timer.indexOf(id) === -1) timer.push(id);
|
|
64
64
|
let idx;
|
|
65
65
|
if ((idx = execute.indexOf(id)) !== -1) execute.splice(idx, 1);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
ActivityTracker.prototype._leave = function leave(id) {
|
|
69
|
-
const {wait, execute, timer} = this.status;
|
|
69
|
+
const { wait, execute, timer } = this.status;
|
|
70
70
|
let idx;
|
|
71
71
|
if ((idx = wait.indexOf(id)) !== -1) wait.splice(idx, 1);
|
|
72
72
|
if ((idx = execute.indexOf(id)) !== -1) execute.splice(idx, 1);
|