bpmn-elements 17.2.2 → 18.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 +3 -1
- package/dist/Api.js +83 -0
- package/dist/Context.js +228 -22
- package/dist/Environment.js +111 -31
- package/dist/EventBroker.js +57 -1
- package/dist/Expressions.js +3 -4
- package/dist/MessageFormatter.js +29 -16
- package/dist/Timers.js +13 -9
- package/dist/Tracker.js +1 -0
- package/dist/activity/Activity.js +458 -254
- package/dist/activity/ActivityExecution.js +113 -40
- package/dist/activity/Dummy.js +6 -1
- package/dist/activity/Escalation.js +36 -24
- package/dist/activity/ExecutionScope.js +1 -1
- package/dist/activity/Message.js +36 -24
- package/dist/activity/Signal.js +36 -24
- package/dist/activity/outbound-evaluator.js +1 -1
- package/dist/condition.js +12 -6
- package/dist/constants.js +21 -0
- package/dist/definition/Definition.js +182 -64
- package/dist/definition/DefinitionExecution.js +195 -82
- package/dist/error/BpmnError.js +12 -1
- package/dist/error/Errors.js +50 -9
- package/dist/eventDefinitions/CancelEventDefinition.js +29 -11
- package/dist/eventDefinitions/CompensateEventDefinition.js +51 -31
- package/dist/eventDefinitions/ConditionalEventDefinition.js +21 -9
- package/dist/eventDefinitions/ErrorEventDefinition.js +46 -30
- package/dist/eventDefinitions/EscalationEventDefinition.js +44 -27
- package/dist/eventDefinitions/EventDefinitionExecution.js +30 -23
- package/dist/eventDefinitions/LinkEventDefinition.js +45 -120
- package/dist/eventDefinitions/MessageEventDefinition.js +44 -29
- package/dist/eventDefinitions/SignalEventDefinition.js +46 -31
- package/dist/eventDefinitions/TerminateEventDefinition.js +10 -1
- package/dist/eventDefinitions/TimerEventDefinition.js +57 -37
- package/dist/eventDefinitions/index.js +20 -21
- package/dist/events/BoundaryEvent.js +52 -40
- package/dist/events/EndEvent.js +22 -8
- package/dist/events/IntermediateCatchEvent.js +26 -8
- package/dist/events/IntermediateThrowEvent.js +24 -9
- package/dist/events/StartEvent.js +30 -14
- package/dist/events/index.js +10 -11
- package/dist/flows/Association.js +50 -7
- package/dist/flows/MessageFlow.js +49 -10
- package/dist/flows/SequenceFlow.js +93 -22
- package/dist/flows/index.js +6 -7
- package/dist/gateways/EventBasedGateway.js +29 -15
- package/dist/gateways/ExclusiveGateway.js +20 -5
- package/dist/gateways/InclusiveGateway.js +21 -5
- package/dist/gateways/ParallelGateway.js +253 -15
- package/dist/gateways/index.js +8 -9
- package/dist/getPropertyValue.js +2 -2
- package/dist/index.js +42 -43
- package/dist/io/BpmnIO.js +15 -1
- package/dist/io/EnvironmentDataObject.js +29 -1
- package/dist/io/EnvironmentDataStore.js +24 -1
- package/dist/io/EnvironmentDataStoreReference.js +24 -1
- package/dist/io/InputOutputSpecification.js +21 -11
- package/dist/io/Properties.js +28 -17
- package/dist/messageHelper.js +41 -4
- package/dist/process/Lane.js +15 -4
- package/dist/process/Process.js +174 -76
- package/dist/process/ProcessExecution.js +362 -177
- package/dist/shared.js +2 -0
- package/dist/tasks/CallActivity.js +19 -4
- package/dist/tasks/LoopCharacteristics.js +94 -9
- package/dist/tasks/ReceiveTask.js +36 -21
- package/dist/tasks/ScriptTask.js +22 -6
- package/dist/tasks/ServiceImplementation.js +7 -4
- package/dist/tasks/ServiceTask.js +19 -4
- package/dist/tasks/SignalTask.js +19 -4
- package/dist/tasks/StandardLoopCharacteristics.js +8 -4
- package/dist/tasks/SubProcess.js +44 -29
- package/dist/tasks/Task.js +19 -4
- package/dist/tasks/Transaction.js +8 -4
- package/dist/tasks/index.js +16 -18
- package/package.json +31 -13
- package/src/Api.js +70 -0
- package/src/Context.js +200 -19
- package/src/Environment.js +99 -30
- package/src/EventBroker.js +46 -1
- package/src/Expressions.js +2 -3
- package/src/MessageFormatter.js +24 -16
- package/src/Timers.js +12 -9
- package/src/Tracker.js +1 -0
- package/src/activity/Activity.js +388 -231
- package/src/activity/ActivityExecution.js +93 -42
- package/src/activity/Dummy.js +6 -1
- package/src/activity/Escalation.js +25 -18
- package/src/activity/ExecutionScope.js +1 -1
- package/src/activity/Message.js +25 -18
- package/src/activity/Signal.js +25 -18
- package/src/activity/outbound-evaluator.js +1 -1
- package/src/condition.js +11 -5
- package/src/constants.js +15 -0
- package/src/definition/Definition.js +157 -62
- package/src/definition/DefinitionExecution.js +161 -83
- package/src/error/BpmnError.js +11 -1
- package/src/error/Errors.js +44 -5
- package/src/eventDefinitions/CancelEventDefinition.js +27 -13
- package/src/eventDefinitions/CompensateEventDefinition.js +48 -32
- package/src/eventDefinitions/ConditionalEventDefinition.js +20 -10
- package/src/eventDefinitions/ErrorEventDefinition.js +44 -33
- package/src/eventDefinitions/EscalationEventDefinition.js +39 -26
- package/src/eventDefinitions/EventDefinitionExecution.js +30 -24
- package/src/eventDefinitions/LinkEventDefinition.js +34 -120
- package/src/eventDefinitions/MessageEventDefinition.js +42 -31
- package/src/eventDefinitions/SignalEventDefinition.js +43 -32
- package/src/eventDefinitions/TerminateEventDefinition.js +9 -1
- package/src/eventDefinitions/TimerEventDefinition.js +53 -35
- package/src/eventDefinitions/index.js +10 -23
- package/src/events/BoundaryEvent.js +50 -39
- package/src/events/EndEvent.js +19 -7
- package/src/events/IntermediateCatchEvent.js +24 -8
- package/src/events/IntermediateThrowEvent.js +24 -8
- package/src/events/StartEvent.js +25 -14
- package/src/events/index.js +5 -18
- package/src/flows/Association.js +43 -9
- package/src/flows/MessageFlow.js +41 -10
- package/src/flows/SequenceFlow.js +82 -19
- package/src/flows/index.js +3 -4
- package/src/gateways/EventBasedGateway.js +27 -15
- package/src/gateways/ExclusiveGateway.js +16 -3
- package/src/gateways/InclusiveGateway.js +16 -3
- package/src/gateways/ParallelGateway.js +301 -10
- package/src/gateways/index.js +4 -4
- package/src/getPropertyValue.js +2 -2
- package/src/index.js +19 -19
- package/src/io/BpmnIO.js +13 -1
- package/src/io/EnvironmentDataObject.js +26 -1
- package/src/io/EnvironmentDataStore.js +22 -1
- package/src/io/EnvironmentDataStoreReference.js +22 -1
- package/src/io/InputOutputSpecification.js +17 -8
- package/src/io/Properties.js +23 -13
- package/src/messageHelper.js +36 -4
- package/src/process/Lane.js +14 -4
- package/src/process/Process.js +154 -72
- package/src/process/ProcessExecution.js +326 -175
- package/src/shared.js +1 -0
- package/src/tasks/CallActivity.js +16 -2
- package/src/tasks/LoopCharacteristics.js +77 -11
- package/src/tasks/ReceiveTask.js +33 -22
- package/src/tasks/ScriptTask.js +17 -3
- package/src/tasks/ServiceImplementation.js +6 -3
- package/src/tasks/ServiceTask.js +16 -2
- package/src/tasks/SignalTask.js +16 -2
- package/src/tasks/StandardLoopCharacteristics.js +7 -3
- package/src/tasks/SubProcess.js +37 -23
- package/src/tasks/Task.js +16 -2
- package/src/tasks/Transaction.js +7 -3
- package/src/tasks/index.js +8 -9
- package/types/bundle-errors.d.ts +1 -0
- package/types/bundle.d.ts +97 -0
- package/types/index.d.ts +2614 -84
- package/types/interfaces.d.ts +636 -0
- package/types/types.d.ts +0 -765
package/src/EventBroker.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { Broker } from 'smqp';
|
|
2
2
|
import { makeErrorFromMessage } from './error/Errors.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Build the broker for an activity, including run/format/execution/api exchanges and queues.
|
|
6
|
+
* @param {import('#types').Activity} activity
|
|
7
|
+
* @returns {import('#types').EventBroker<import('#types').Activity>}
|
|
8
|
+
*/
|
|
4
9
|
export function ActivityBroker(activity) {
|
|
5
10
|
const executionBroker = ExecutionBroker(activity, 'activity');
|
|
6
11
|
return executionBroker;
|
|
7
12
|
}
|
|
8
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Build the broker for a process, with an additional api-q bound to all api routing keys.
|
|
16
|
+
* @param {import('#types').Process} owner
|
|
17
|
+
* @returns {import('#types').EventBroker<import('#types').Process>}
|
|
18
|
+
*/
|
|
9
19
|
export function ProcessBroker(owner) {
|
|
10
20
|
const executionBroker = ExecutionBroker(owner, 'process');
|
|
11
21
|
executionBroker.broker.assertQueue('api-q', { durable: false, autoDelete: false });
|
|
@@ -13,10 +23,21 @@ export function ProcessBroker(owner) {
|
|
|
13
23
|
return executionBroker;
|
|
14
24
|
}
|
|
15
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Build the broker for a definition. Optionally registers a custom return-message handler.
|
|
28
|
+
* @param {import('#types').Definition} owner
|
|
29
|
+
* @param {(message: import('#types').ElementBrokerMessage) => void} [onBrokerReturn]
|
|
30
|
+
* @returns {import('#types').EventBroker<import('#types').Definition>}
|
|
31
|
+
*/
|
|
16
32
|
export function DefinitionBroker(owner, onBrokerReturn) {
|
|
17
33
|
return ExecutionBroker(owner, 'definition', onBrokerReturn);
|
|
18
34
|
}
|
|
19
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Build the broker for a message flow with a durable message exchange and message-q.
|
|
38
|
+
* @param {import('./flows/MessageFlow.js').MessageFlow} owner
|
|
39
|
+
* @returns {import('#types').EventBroker<import('./flows/MessageFlow.js').MessageFlow>}
|
|
40
|
+
*/
|
|
20
41
|
export function MessageFlowBroker(owner) {
|
|
21
42
|
const eventBroker = new EventBroker(owner, { prefix: 'messageflow', autoDelete: false, durable: false });
|
|
22
43
|
const broker = eventBroker.broker;
|
|
@@ -49,11 +70,17 @@ function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
|
|
|
49
70
|
return eventBroker;
|
|
50
71
|
}
|
|
51
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Owns an smqp Broker on behalf of the calling element and exposes prefixed event helpers.
|
|
75
|
+
* @param {any} brokerOwner Element that owns the broker, accessed as `broker.owner`
|
|
76
|
+
* @param {{ prefix: string, autoDelete?: boolean, durable?: boolean }} options
|
|
77
|
+
* @param {(message: import('#types').ElementBrokerMessage) => void} [onBrokerReturn] Override for unrouted return messages
|
|
78
|
+
*/
|
|
52
79
|
export function EventBroker(brokerOwner, options, onBrokerReturn) {
|
|
53
80
|
this.options = options;
|
|
54
81
|
this.eventPrefix = options.prefix;
|
|
55
82
|
|
|
56
|
-
const broker = (this.broker = Broker(brokerOwner));
|
|
83
|
+
const broker = (this.broker = new Broker(brokerOwner));
|
|
57
84
|
broker.assertExchange('event', 'topic', options);
|
|
58
85
|
broker.on('return', onBrokerReturn ? onBrokerReturn.bind(brokerOwner) : this._onBrokerReturnFn.bind(this));
|
|
59
86
|
|
|
@@ -64,6 +91,10 @@ export function EventBroker(brokerOwner, options, onBrokerReturn) {
|
|
|
64
91
|
this.emitFatal = this.emitFatal.bind(this);
|
|
65
92
|
}
|
|
66
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Subscribe to a prefixed event. Errors are unwrapped via `makeErrorFromMessage`,
|
|
96
|
+
* other events resolve to the owner's Api wrapper.
|
|
97
|
+
*/
|
|
67
98
|
EventBroker.prototype.on = function on(eventName, callback, eventOptions = { once: false }) {
|
|
68
99
|
const key = this._getEventRoutingKey(eventName);
|
|
69
100
|
|
|
@@ -76,10 +107,16 @@ EventBroker.prototype.on = function on(eventName, callback, eventOptions = { onc
|
|
|
76
107
|
}
|
|
77
108
|
};
|
|
78
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Subscribe to the next occurrence of an event.
|
|
112
|
+
*/
|
|
79
113
|
EventBroker.prototype.once = function once(eventName, callback, eventOptions) {
|
|
80
114
|
return this.on(eventName, callback, { ...eventOptions, once: true });
|
|
81
115
|
};
|
|
82
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Promise-style wait for an event. Rejects on a mandatory `*.error` message.
|
|
119
|
+
*/
|
|
83
120
|
EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
84
121
|
const key = this._getEventRoutingKey(eventName);
|
|
85
122
|
|
|
@@ -109,14 +146,21 @@ EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
|
|
|
109
146
|
});
|
|
110
147
|
};
|
|
111
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Publish a prefixed event message.
|
|
151
|
+
*/
|
|
112
152
|
EventBroker.prototype.emit = function emit(eventName, content, props) {
|
|
113
153
|
this.broker.publish('event', `${this.eventPrefix}.${eventName}`, { ...content }, { type: eventName, ...props });
|
|
114
154
|
};
|
|
115
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Emit a mandatory error event. Surfaces via `on('error', ...)` or causes a return message to throw.
|
|
158
|
+
*/
|
|
116
159
|
EventBroker.prototype.emitFatal = function emitFatal(error, content) {
|
|
117
160
|
this.emit('error', { ...content, error }, { mandatory: true });
|
|
118
161
|
};
|
|
119
162
|
|
|
163
|
+
/** @internal */
|
|
120
164
|
EventBroker.prototype._onBrokerReturnFn = function onBrokerReturnFn(message) {
|
|
121
165
|
if (message.properties.type === 'error') {
|
|
122
166
|
const err = makeErrorFromMessage(message);
|
|
@@ -124,6 +168,7 @@ EventBroker.prototype._onBrokerReturnFn = function onBrokerReturnFn(message) {
|
|
|
124
168
|
}
|
|
125
169
|
};
|
|
126
170
|
|
|
171
|
+
/** @internal */
|
|
127
172
|
EventBroker.prototype._getEventRoutingKey = function getEventRoutingKey(eventName) {
|
|
128
173
|
if (eventName.indexOf('.') > -1) return eventName;
|
|
129
174
|
|
package/src/Expressions.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import getPropertyValue from './getPropertyValue.js';
|
|
2
|
-
|
|
1
|
+
import { getPropertyValue } from './getPropertyValue.js';
|
|
3
2
|
const isExpressionPattern = /^\${(.+?)}$/;
|
|
4
3
|
const expressionPattern = /\${(.+?)}/;
|
|
5
4
|
|
|
6
|
-
export
|
|
5
|
+
export function Expressions() {
|
|
7
6
|
return {
|
|
8
7
|
resolveExpression,
|
|
9
8
|
isExpression,
|
package/src/MessageFormatter.js
CHANGED
|
@@ -2,28 +2,31 @@ import { cloneMessage } from './messageHelper.js';
|
|
|
2
2
|
import { getUniqueId } from './shared.js';
|
|
3
3
|
import { ActivityError } from './error/Errors.js';
|
|
4
4
|
import { getRoutingKeyPattern } from 'smqp';
|
|
5
|
+
import { K_EXECUTION } from './constants.js';
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
-
const kExecution = Symbol.for('execution');
|
|
7
|
+
const K_ON_MESSAGE = Symbol.for('onMessage');
|
|
8
8
|
|
|
9
9
|
const EXEC_ROUTING_KEY = 'run._formatting.exec';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Enriches an element run message via async format start/end messages on the `format` exchange
|
|
13
|
+
* before the run message is continued. Handlers publish enrichment by responding to a start
|
|
14
|
+
* message with a matching end (or error) routing key.
|
|
15
|
+
* @param {import('#types').ElementBase} element
|
|
14
16
|
*/
|
|
15
17
|
export function Formatter(element) {
|
|
16
18
|
const { id, broker, logger } = element;
|
|
17
19
|
this.id = id;
|
|
18
20
|
this.broker = broker;
|
|
19
21
|
this.logger = logger;
|
|
20
|
-
this[
|
|
22
|
+
this[K_ON_MESSAGE] = this._onMessage.bind(this);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
* Format message
|
|
25
|
-
*
|
|
26
|
-
* @param {
|
|
26
|
+
* Format the given run message. Callback fires with `(err, content, formatted)` once
|
|
27
|
+
* formatting completes; `formatted` is true when content was actually enriched.
|
|
28
|
+
* @param {import('#types').ElementBrokerMessage} message
|
|
29
|
+
* @param {(err: Error | null, content?: import('#types').ElementMessageContent, formatted?: boolean) => void} callback
|
|
27
30
|
*/
|
|
28
31
|
Formatter.prototype.format = function format(message, callback) {
|
|
29
32
|
const correlationId = (this._runId = getUniqueId(message.fields.routingKey));
|
|
@@ -32,7 +35,7 @@ Formatter.prototype.format = function format(message, callback) {
|
|
|
32
35
|
|
|
33
36
|
broker.publish('format', EXEC_ROUTING_KEY, {}, { correlationId, persistent: false });
|
|
34
37
|
|
|
35
|
-
this[
|
|
38
|
+
this[K_EXECUTION] = {
|
|
36
39
|
correlationId,
|
|
37
40
|
formatKey: message.fields.routingKey,
|
|
38
41
|
runMessage: cloneMessage(message),
|
|
@@ -42,14 +45,15 @@ Formatter.prototype.format = function format(message, callback) {
|
|
|
42
45
|
executeMessage: null,
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
broker.consume('format-run-q', this[
|
|
48
|
+
broker.consume('format-run-q', this[K_ON_MESSAGE], {
|
|
46
49
|
consumerTag,
|
|
47
50
|
prefetch: 100,
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
53
|
|
|
54
|
+
/** @internal */
|
|
51
55
|
Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
52
|
-
const { formatKey, correlationId, pending, executeMessage } = this[
|
|
56
|
+
const { formatKey, correlationId, pending, executeMessage } = this[K_EXECUTION];
|
|
53
57
|
const asyncFormatting = pending.size;
|
|
54
58
|
|
|
55
59
|
if (routingKey === EXEC_ROUTING_KEY) {
|
|
@@ -58,7 +62,7 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
58
62
|
if (!asyncFormatting) {
|
|
59
63
|
return this._complete(message);
|
|
60
64
|
}
|
|
61
|
-
this[
|
|
65
|
+
this[K_EXECUTION].executeMessage = message;
|
|
62
66
|
} else {
|
|
63
67
|
message.ack();
|
|
64
68
|
|
|
@@ -87,9 +91,10 @@ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
|
|
|
87
91
|
}
|
|
88
92
|
};
|
|
89
93
|
|
|
94
|
+
/** @internal */
|
|
90
95
|
Formatter.prototype._complete = function complete(message, isError) {
|
|
91
|
-
const { runMessage, formatKey, callback, formatted, executeMessage } = this[
|
|
92
|
-
this[
|
|
96
|
+
const { runMessage, formatKey, callback, formatted, executeMessage } = this[K_EXECUTION];
|
|
97
|
+
this[K_EXECUTION] = null;
|
|
93
98
|
if (executeMessage) executeMessage.ack();
|
|
94
99
|
|
|
95
100
|
this.broker.cancel(message.fields.consumerTag);
|
|
@@ -104,8 +109,9 @@ Formatter.prototype._complete = function complete(message, isError) {
|
|
|
104
109
|
return callback(null, runMessage.content, formatted);
|
|
105
110
|
};
|
|
106
111
|
|
|
112
|
+
/** @internal */
|
|
107
113
|
Formatter.prototype._enrich = function enrich(withContent) {
|
|
108
|
-
const content = this[
|
|
114
|
+
const content = this[K_EXECUTION].runMessage.content;
|
|
109
115
|
for (const key in withContent) {
|
|
110
116
|
switch (key) {
|
|
111
117
|
case 'id':
|
|
@@ -122,12 +128,13 @@ Formatter.prototype._enrich = function enrich(withContent) {
|
|
|
122
128
|
break;
|
|
123
129
|
default: {
|
|
124
130
|
content[key] = withContent[key];
|
|
125
|
-
this[
|
|
131
|
+
this[K_EXECUTION].formatted = true;
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
};
|
|
130
136
|
|
|
137
|
+
/** @internal */
|
|
131
138
|
Formatter.prototype._popFormatStart = function popFormattingStart(pending, routingKey) {
|
|
132
139
|
for (const msg of pending) {
|
|
133
140
|
const { endRoutingKey, errorRoutingKey = '#.error' } = msg.content;
|
|
@@ -144,6 +151,7 @@ Formatter.prototype._popFormatStart = function popFormattingStart(pending, routi
|
|
|
144
151
|
return {};
|
|
145
152
|
};
|
|
146
153
|
|
|
154
|
+
/** @internal */
|
|
147
155
|
Formatter.prototype._debug = function debug(msg) {
|
|
148
156
|
this.logger.debug(`<${this.id}> ${msg}`);
|
|
149
157
|
};
|
package/src/Timers.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const K_EXECUTING = Symbol.for('executing');
|
|
2
|
+
const K_TIMER_API = Symbol.for('timers api');
|
|
3
3
|
|
|
4
4
|
const MAX_DELAY = 2147483647;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('#types').TimersOptions} options
|
|
8
|
+
*/
|
|
6
9
|
export function Timers(options) {
|
|
7
10
|
this.count = 0;
|
|
8
11
|
this.options = {
|
|
@@ -10,14 +13,14 @@ export function Timers(options) {
|
|
|
10
13
|
clearTimeout,
|
|
11
14
|
...options,
|
|
12
15
|
};
|
|
13
|
-
this[
|
|
16
|
+
this[K_EXECUTING] = new Set();
|
|
14
17
|
this.setTimeout = this.setTimeout.bind(this);
|
|
15
18
|
this.clearTimeout = this.clearTimeout.bind(this);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
Object.defineProperty(Timers.prototype, 'executing', {
|
|
19
22
|
get() {
|
|
20
|
-
return [...this[
|
|
23
|
+
return [...this[K_EXECUTING]];
|
|
21
24
|
},
|
|
22
25
|
});
|
|
23
26
|
|
|
@@ -30,7 +33,7 @@ Timers.prototype.setTimeout = function wrappedSetTimeout(callback, delay, ...arg
|
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
Timers.prototype.clearTimeout = function wrappedClearTimeout(ref) {
|
|
33
|
-
if (this[
|
|
36
|
+
if (this[K_EXECUTING].delete(ref)) {
|
|
34
37
|
ref.timerRef = this.options.clearTimeout(ref.timerRef);
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
@@ -38,7 +41,7 @@ Timers.prototype.clearTimeout = function wrappedClearTimeout(ref) {
|
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
Timers.prototype._setTimeout = function setTimeout(owner, callback, delay, ...args) {
|
|
41
|
-
const executing = this[
|
|
44
|
+
const executing = this[K_EXECUTING];
|
|
42
45
|
const ref = this._getReference(owner, callback, delay, args);
|
|
43
46
|
executing.add(ref);
|
|
44
47
|
if (delay < MAX_DELAY) {
|
|
@@ -57,19 +60,19 @@ Timers.prototype._getReference = function getReference(owner, callback, delay, a
|
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
function RegisteredTimers(timersApi, owner) {
|
|
60
|
-
this[
|
|
63
|
+
this[K_TIMER_API] = timersApi;
|
|
61
64
|
this.owner = owner;
|
|
62
65
|
this.setTimeout = this.setTimeout.bind(this);
|
|
63
66
|
this.clearTimeout = this.clearTimeout.bind(this);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
RegisteredTimers.prototype.setTimeout = function registeredSetTimeout(callback, delay, ...args) {
|
|
67
|
-
const timersApi = this[
|
|
70
|
+
const timersApi = this[K_TIMER_API];
|
|
68
71
|
return timersApi._setTimeout(this.owner, callback, delay, ...args);
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
RegisteredTimers.prototype.clearTimeout = function registeredClearTimeout(ref) {
|
|
72
|
-
this[
|
|
75
|
+
this[K_TIMER_API].clearTimeout(ref);
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
function Timer(owner, timerId, callback, delay, args) {
|
package/src/Tracker.js
CHANGED
|
@@ -29,6 +29,7 @@ ActivityTracker.prototype.track = function track(routingKey, message) {
|
|
|
29
29
|
this._executing(executionId);
|
|
30
30
|
break;
|
|
31
31
|
case 'activity.execution.outbound.take':
|
|
32
|
+
case 'activity.converge':
|
|
32
33
|
case 'activity.detach':
|
|
33
34
|
case 'activity.call':
|
|
34
35
|
case 'activity.wait': {
|