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
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Builtin data store. Reads from / writes to `environment.variables._data`.
|
|
3
|
+
* @param {import('moddle-context-serializer').DataStore} dataStoreDef
|
|
4
|
+
* @param {import('#types').ContextInstance} context
|
|
5
|
+
* @satisfies {import('#types').IIOData}
|
|
6
|
+
*/
|
|
7
|
+
export function EnvironmentDataStore(dataStoreDef, { environment }) {
|
|
2
8
|
const { id, type, name, behaviour, parent } = dataStoreDef;
|
|
3
9
|
this.id = id;
|
|
4
10
|
this.type = type;
|
|
5
11
|
this.name = name;
|
|
12
|
+
/** @type {Record<string, any>} */
|
|
6
13
|
this.behaviour = behaviour;
|
|
14
|
+
/** @type {import('moddle-context-serializer').Parent | undefined} */
|
|
7
15
|
this.parent = parent;
|
|
8
16
|
this.environment = environment;
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @param {import('smqp').Broker} broker
|
|
21
|
+
* @param {string} exchange
|
|
22
|
+
* @param {string} routingKeyPrefix
|
|
23
|
+
* @param {Record<string, any>} [messageProperties]
|
|
24
|
+
*/
|
|
11
25
|
EnvironmentDataStore.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
12
26
|
const environment = this.environment;
|
|
13
27
|
const value = environment.variables._data?.[this.id];
|
|
@@ -15,6 +29,13 @@ EnvironmentDataStore.prototype.read = function read(broker, exchange, routingKey
|
|
|
15
29
|
return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
|
|
16
30
|
};
|
|
17
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('smqp').Broker} broker
|
|
34
|
+
* @param {string} exchange
|
|
35
|
+
* @param {string} routingKeyPrefix
|
|
36
|
+
* @param {any} value
|
|
37
|
+
* @param {Record<string, any>} [messageProperties]
|
|
38
|
+
*/
|
|
18
39
|
EnvironmentDataStore.prototype.write = function write(broker, exchange, routingKeyPrefix, value, messageProperties) {
|
|
19
40
|
const environment = this.environment;
|
|
20
41
|
environment.variables._data = environment.variables._data || {};
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Builtin data store reference. Reads from / writes to `environment.variables._data`.
|
|
3
|
+
* @param {import('moddle-context-serializer').DataStore} dataObjectDef
|
|
4
|
+
* @param {import('#types').ContextInstance} context
|
|
5
|
+
* @satisfies {import('#types').IIOData}
|
|
6
|
+
*/
|
|
7
|
+
export function EnvironmentDataStoreReference(dataObjectDef, { environment }) {
|
|
2
8
|
const { id, type, name, behaviour, parent } = dataObjectDef;
|
|
3
9
|
this.id = id;
|
|
4
10
|
this.type = type;
|
|
5
11
|
this.name = name;
|
|
12
|
+
/** @type {Record<string, any>} */
|
|
6
13
|
this.behaviour = behaviour;
|
|
14
|
+
/** @type {import('moddle-context-serializer').Parent | undefined} */
|
|
7
15
|
this.parent = parent;
|
|
8
16
|
this.environment = environment;
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @param {import('smqp').Broker} broker
|
|
21
|
+
* @param {string} exchange
|
|
22
|
+
* @param {string} routingKeyPrefix
|
|
23
|
+
* @param {Record<string, any>} [messageProperties]
|
|
24
|
+
*/
|
|
11
25
|
EnvironmentDataStoreReference.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
|
|
12
26
|
const environment = this.environment;
|
|
13
27
|
const value = environment.variables._data?.[this.id];
|
|
@@ -15,6 +29,13 @@ EnvironmentDataStoreReference.prototype.read = function read(broker, exchange, r
|
|
|
15
29
|
return broker.publish(exchange, `${routingKeyPrefix}response`, content, messageProperties);
|
|
16
30
|
};
|
|
17
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @param {import('smqp').Broker} broker
|
|
34
|
+
* @param {string} exchange
|
|
35
|
+
* @param {string} routingKeyPrefix
|
|
36
|
+
* @param {any} value
|
|
37
|
+
* @param {Record<string, any>} [messageProperties]
|
|
38
|
+
*/
|
|
18
39
|
EnvironmentDataStoreReference.prototype.write = function write(broker, exchange, routingKeyPrefix, value, messageProperties) {
|
|
19
40
|
const environment = this.environment;
|
|
20
41
|
environment.variables._data = environment.variables._data || {};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue.js';
|
|
1
|
+
import { getPropertyValue } from '../getPropertyValue.js';
|
|
2
2
|
import { brokerSafeId } from '../shared.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { K_CONSUMING } from '../constants.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Activity ioSpecification behaviour. Reads bound data objects on enter and writes them on completion.
|
|
7
|
+
* @param {import('#types').Activity} activity
|
|
8
|
+
* @param {import('moddle-context-serializer').IoSpecification} ioSpecificationDef
|
|
9
|
+
* @param {import('#types').ContextInstance} context
|
|
10
|
+
* @satisfies {import('#types').IExtension}
|
|
11
|
+
*/
|
|
12
|
+
export function IoSpecification(activity, ioSpecificationDef, context) {
|
|
7
13
|
const { id, type = 'iospecification', behaviour = {} } = ioSpecificationDef;
|
|
8
14
|
this.id = id;
|
|
9
15
|
this.type = type;
|
|
@@ -13,19 +19,22 @@ export default function IoSpecification(activity, ioSpecificationDef, context) {
|
|
|
13
19
|
this.context = context;
|
|
14
20
|
}
|
|
15
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @param {import('#types').ElementBrokerMessage} [message]
|
|
24
|
+
*/
|
|
16
25
|
IoSpecification.prototype.activate = function activate(message) {
|
|
17
|
-
if (this[
|
|
26
|
+
if (this[K_CONSUMING]) return;
|
|
18
27
|
if (message?.fields.redelivered && message.fields.routingKey === 'run.start') {
|
|
19
28
|
this._onFormatEnter();
|
|
20
29
|
}
|
|
21
30
|
if (message?.fields.redelivered && message.fields.routingKey === 'run.end') {
|
|
22
31
|
this._onFormatComplete(message);
|
|
23
32
|
}
|
|
24
|
-
this[
|
|
33
|
+
this[K_CONSUMING] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
|
|
25
34
|
};
|
|
26
35
|
|
|
27
36
|
IoSpecification.prototype.deactivate = function deactivate() {
|
|
28
|
-
if (this[
|
|
37
|
+
if (this[K_CONSUMING]) this[K_CONSUMING] = this[K_CONSUMING].cancel();
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
IoSpecification.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
|
package/src/io/Properties.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import getPropertyValue from '../getPropertyValue.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { getPropertyValue } from '../getPropertyValue.js';
|
|
2
|
+
import { K_CONSUMING } from '../constants.js';
|
|
3
|
+
|
|
4
|
+
const K_PROPERTIES = Symbol.for('properties');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Activity properties behaviour. Resolves bound data input/output references during the run.
|
|
8
|
+
* @param {import('#types').Activity} activity
|
|
9
|
+
* @param {{ type: 'properties', values: import('moddle-context-serializer').IElement[] }} propertiesDef
|
|
10
|
+
* @param {import('#types').ContextInstance} context
|
|
11
|
+
* @satisfies {import('#types').IExtension}
|
|
12
|
+
*/
|
|
13
|
+
export function Properties(activity, propertiesDef, context) {
|
|
7
14
|
this.activity = activity;
|
|
8
15
|
this.broker = activity.broker;
|
|
9
16
|
|
|
10
|
-
const props = (this[
|
|
17
|
+
const props = (this[K_PROPERTIES] = {
|
|
11
18
|
properties: new Set(),
|
|
12
19
|
dataInputObjects: new Set(),
|
|
13
20
|
dataOutputObjects: new Set(),
|
|
@@ -57,8 +64,11 @@ export default function Properties(activity, propertiesDef, context) {
|
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @param {import('#types').ElementBrokerMessage} message
|
|
69
|
+
*/
|
|
60
70
|
Properties.prototype.activate = function activate(message) {
|
|
61
|
-
if (this[
|
|
71
|
+
if (this[K_CONSUMING]) return;
|
|
62
72
|
if (message.fields.redelivered && message.fields.routingKey === 'run.start') {
|
|
63
73
|
this._onActivityEvent('activity.enter', message);
|
|
64
74
|
}
|
|
@@ -67,11 +77,11 @@ Properties.prototype.activate = function activate(message) {
|
|
|
67
77
|
this._onActivityEvent('activity.extension.resume', message);
|
|
68
78
|
}
|
|
69
79
|
|
|
70
|
-
this[
|
|
80
|
+
this[K_CONSUMING] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
|
|
71
81
|
};
|
|
72
82
|
|
|
73
83
|
Properties.prototype.deactivate = function deactivate() {
|
|
74
|
-
if (this[
|
|
84
|
+
if (this[K_CONSUMING]) this[K_CONSUMING] = this[K_CONSUMING].cancel();
|
|
75
85
|
};
|
|
76
86
|
|
|
77
87
|
Properties.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
|
|
@@ -87,7 +97,7 @@ Properties.prototype._onActivityEvent = function onActivityEvent(routingKey, mes
|
|
|
87
97
|
Properties.prototype._formatOnEnter = function formatOnEnter(message) {
|
|
88
98
|
const startRoutingKey = 'run.enter.bpmn-properties';
|
|
89
99
|
|
|
90
|
-
const dataInputObjects = this[
|
|
100
|
+
const dataInputObjects = this[K_PROPERTIES].dataInputObjects;
|
|
91
101
|
const broker = this.broker;
|
|
92
102
|
if (!dataInputObjects.size) {
|
|
93
103
|
return broker.getQueue('format-run-q').queueMessage(
|
|
@@ -120,7 +130,7 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
|
|
|
120
130
|
const messageOutput = getPropertyValue(message, 'content.output.properties') || {};
|
|
121
131
|
const outputProperties = this._getProperties(message, messageOutput);
|
|
122
132
|
|
|
123
|
-
const dataOutputObjects = this[
|
|
133
|
+
const dataOutputObjects = this[K_PROPERTIES].dataOutputObjects;
|
|
124
134
|
const broker = this.broker;
|
|
125
135
|
if (!dataOutputObjects.size) {
|
|
126
136
|
return broker.getQueue('format-run-q').queueMessage(
|
|
@@ -154,7 +164,7 @@ Properties.prototype._getProperties = function getProperties(message, values) {
|
|
|
154
164
|
response = { ...message.content.properties };
|
|
155
165
|
}
|
|
156
166
|
|
|
157
|
-
for (const { id, type, name } of this[
|
|
167
|
+
for (const { id, type, name } of this[K_PROPERTIES].properties) {
|
|
158
168
|
if (!(id in response)) {
|
|
159
169
|
response[id] = { id, type, name };
|
|
160
170
|
}
|
package/src/messageHelper.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clone message content
|
|
3
|
+
* @param {import('#types').ElementMessageContent} content
|
|
4
|
+
* @param {Record<string, any>} [extend]
|
|
5
|
+
* @returns cloned content
|
|
6
|
+
*/
|
|
1
7
|
export function cloneContent(content, extend) {
|
|
2
|
-
const {
|
|
8
|
+
const { inbound, outbound, parent, sequence } = content;
|
|
3
9
|
|
|
10
|
+
/** @type {import('#types').ElementMessageContent} */
|
|
4
11
|
const clone = {
|
|
5
12
|
...content,
|
|
6
13
|
...extend,
|
|
@@ -9,9 +16,6 @@ export function cloneContent(content, extend) {
|
|
|
9
16
|
if (parent) {
|
|
10
17
|
clone.parent = cloneParent(parent);
|
|
11
18
|
}
|
|
12
|
-
if (discardSequence) {
|
|
13
|
-
clone.discardSequence = discardSequence.slice();
|
|
14
|
-
}
|
|
15
19
|
if (inbound) {
|
|
16
20
|
clone.inbound = inbound.map((c) => cloneContent(c));
|
|
17
21
|
}
|
|
@@ -25,6 +29,12 @@ export function cloneContent(content, extend) {
|
|
|
25
29
|
return clone;
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Clone message
|
|
34
|
+
* @param {import('#types').ElementBrokerMessage} message
|
|
35
|
+
* @param {Record<string, any>} [overrideContent]
|
|
36
|
+
* @returns {Pick<ElementBrokerMessage, 'fields' | 'content', 'properties'>}
|
|
37
|
+
*/
|
|
28
38
|
export function cloneMessage(message, overrideContent) {
|
|
29
39
|
return {
|
|
30
40
|
fields: { ...message.fields },
|
|
@@ -33,6 +43,11 @@ export function cloneMessage(message, overrideContent) {
|
|
|
33
43
|
};
|
|
34
44
|
}
|
|
35
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Clone parent
|
|
48
|
+
* @param {import('#types').ElementParent} parent
|
|
49
|
+
* @returns {import('#types').ElementParent} cloned parent
|
|
50
|
+
*/
|
|
36
51
|
export function cloneParent(parent) {
|
|
37
52
|
const { path } = parent;
|
|
38
53
|
const clone = { ...parent };
|
|
@@ -45,6 +60,12 @@ export function cloneParent(parent) {
|
|
|
45
60
|
return clone;
|
|
46
61
|
}
|
|
47
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Add parent to top of path
|
|
65
|
+
* @param {import('#types').ElementParent} parent
|
|
66
|
+
* @param {import('#types').ElementMessageContent} adoptingParent
|
|
67
|
+
* @returns {import('#types').ElementParent}
|
|
68
|
+
*/
|
|
48
69
|
export function unshiftParent(parent, adoptingParent) {
|
|
49
70
|
const { id, type, executionId } = adoptingParent;
|
|
50
71
|
if (!parent) {
|
|
@@ -67,6 +88,11 @@ export function unshiftParent(parent, adoptingParent) {
|
|
|
67
88
|
return clone;
|
|
68
89
|
}
|
|
69
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Remove top parent from path
|
|
93
|
+
* @param {import('#types').ElementParent} parent
|
|
94
|
+
* @returns {import('#types').ElementParent}
|
|
95
|
+
*/
|
|
70
96
|
export function shiftParent(parent) {
|
|
71
97
|
if (!parent) return;
|
|
72
98
|
if (!parent.path || !parent.path.length) return;
|
|
@@ -80,6 +106,12 @@ export function shiftParent(parent) {
|
|
|
80
106
|
return clone;
|
|
81
107
|
}
|
|
82
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Add ancestor parent at end
|
|
111
|
+
* @param {import('#types').ElementParent} parent
|
|
112
|
+
* @param {import('#types').ElementMessageContent} ancestor
|
|
113
|
+
* @returns {import('#types').ElementParent}
|
|
114
|
+
*/
|
|
83
115
|
export function pushParent(parent, ancestor) {
|
|
84
116
|
const { id, type, executionId } = ancestor;
|
|
85
117
|
if (!parent) return { id, type, executionId };
|
package/src/process/Lane.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const K_PROCESS = Symbol.for('process');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Process lane. Wraps a `<bpmn:lane>` definition and points back to its owning process;
|
|
5
|
+
* activities reference their lane through `Activity.lane`.
|
|
6
|
+
* @param {import('#types').Process} process
|
|
7
|
+
* @param {import('moddle-context-serializer').SerializableElement} laneDefinition
|
|
8
|
+
*/
|
|
9
|
+
export function Lane(process, laneDefinition) {
|
|
4
10
|
const { broker, environment } = process;
|
|
5
11
|
const { id, type, behaviour } = laneDefinition;
|
|
6
12
|
|
|
7
|
-
this[
|
|
13
|
+
this[K_PROCESS] = process;
|
|
8
14
|
|
|
9
15
|
this.id = id;
|
|
10
16
|
this.type = type;
|
|
17
|
+
/** @type {string} */
|
|
11
18
|
this.name = behaviour.name;
|
|
19
|
+
/** @type {import('moddle-context-serializer').Parent} */
|
|
12
20
|
this.parent = {
|
|
13
21
|
id: process.id,
|
|
14
22
|
type: process.type,
|
|
15
23
|
};
|
|
24
|
+
/** @type {Record<string, any>} */
|
|
16
25
|
this.behaviour = { ...behaviour };
|
|
17
26
|
this.environment = environment;
|
|
18
27
|
this.broker = broker;
|
|
@@ -21,7 +30,8 @@ export default function Lane(process, laneDefinition) {
|
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
Object.defineProperty(Lane.prototype, 'process', {
|
|
33
|
+
/** @returns {import('#types').Process} */
|
|
24
34
|
get() {
|
|
25
|
-
return this[
|
|
35
|
+
return this[K_PROCESS];
|
|
26
36
|
},
|
|
27
37
|
});
|