bpmn-elements 17.2.2 → 17.3.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.
|
@@ -86,7 +86,7 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
86
86
|
}
|
|
87
87
|
const outboundSequenceFlows = context.getOutboundSequenceFlows(id);
|
|
88
88
|
const isParallelJoin = activityDef.isParallelGateway && inboundSequenceFlows.length > 1;
|
|
89
|
-
|
|
89
|
+
this[kFlows] = {
|
|
90
90
|
inboundSequenceFlows,
|
|
91
91
|
inboundAssociations,
|
|
92
92
|
inboundTriggers,
|
|
@@ -100,8 +100,8 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
100
100
|
})
|
|
101
101
|
};
|
|
102
102
|
this[kFlags] = {
|
|
103
|
-
isEnd:
|
|
104
|
-
isStart:
|
|
103
|
+
isEnd: !outboundSequenceFlows.length,
|
|
104
|
+
isStart: !inboundTriggers.length && !behaviour.triggeredByEvent,
|
|
105
105
|
isSubProcess: activityDef.isSubProcess,
|
|
106
106
|
isMultiInstance: !!behaviour.loopCharacteristics,
|
|
107
107
|
isForCompensation,
|
|
@@ -245,8 +245,7 @@ Object.defineProperties(Activity.prototype, {
|
|
|
245
245
|
Activity.prototype.activate = function activate() {
|
|
246
246
|
if (this[kActivated]) return;
|
|
247
247
|
this[kActivated] = true;
|
|
248
|
-
this.addInboundListeners();
|
|
249
|
-
return this._consumeInbound();
|
|
248
|
+
return this.addInboundListeners() && this._consumeInbound();
|
|
250
249
|
};
|
|
251
250
|
Activity.prototype.deactivate = function deactivate() {
|
|
252
251
|
this[kActivated] = false;
|
|
@@ -349,26 +348,30 @@ Activity.prototype.discard = function discard(discardContent) {
|
|
|
349
348
|
this._consumeRunQ();
|
|
350
349
|
};
|
|
351
350
|
Activity.prototype.addInboundListeners = function addInboundListeners() {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
351
|
+
const triggers = this[kFlows].inboundTriggers;
|
|
352
|
+
if (triggers.length) {
|
|
353
|
+
const onInboundEvent = this._onInboundEvent.bind(this);
|
|
354
|
+
const triggerConsumerTag = `_inbound-${this.id}`;
|
|
355
|
+
for (const trigger of triggers) {
|
|
356
|
+
if (trigger.isSequenceFlow) {
|
|
357
|
+
trigger.broker.subscribeTmp('event', 'flow.#', onInboundEvent, {
|
|
358
|
+
noAck: true,
|
|
359
|
+
consumerTag: triggerConsumerTag
|
|
360
|
+
});
|
|
361
|
+
} else if (this.isForCompensation) {
|
|
362
|
+
trigger.broker.subscribeTmp('event', 'association.#', onInboundEvent, {
|
|
363
|
+
noAck: true,
|
|
364
|
+
consumerTag: triggerConsumerTag
|
|
365
|
+
});
|
|
366
|
+
} else {
|
|
367
|
+
trigger.broker.subscribeTmp('event', 'activity.#', onInboundEvent, {
|
|
368
|
+
noAck: true,
|
|
369
|
+
consumerTag: triggerConsumerTag
|
|
370
|
+
});
|
|
371
|
+
}
|
|
370
372
|
}
|
|
371
373
|
}
|
|
374
|
+
return triggers.length;
|
|
372
375
|
};
|
|
373
376
|
Activity.prototype.removeInboundListeners = function removeInboundListeners() {
|
|
374
377
|
const triggerConsumerTag = `_inbound-${this.id}`;
|
|
@@ -471,16 +474,16 @@ Activity.prototype._shakeOutbound = function shakeOutbound(sourceMessage) {
|
|
|
471
474
|
};
|
|
472
475
|
Activity.prototype._consumeInbound = function consumeInbound() {
|
|
473
476
|
if (!this[kActivated]) return;
|
|
474
|
-
if (this.status) return;
|
|
477
|
+
if (this.status || !this[kFlows].inboundTriggers.length) return;
|
|
475
478
|
const inboundQ = this.broker.getQueue('inbound-q');
|
|
476
479
|
const onInbound = this[kMessageHandlers].onInbound;
|
|
477
480
|
if (this[kFlags].isParallelJoin) {
|
|
478
|
-
return inboundQ.
|
|
481
|
+
return inboundQ.assertConsumer(onInbound, {
|
|
479
482
|
consumerTag: '_run-on-inbound',
|
|
480
483
|
prefetch: 1000
|
|
481
484
|
});
|
|
482
485
|
}
|
|
483
|
-
return inboundQ.
|
|
486
|
+
return inboundQ.assertConsumer(onInbound, {
|
|
484
487
|
consumerTag: '_run-on-inbound'
|
|
485
488
|
});
|
|
486
489
|
};
|
package/dist/getPropertyValue.js
CHANGED
|
@@ -335,7 +335,7 @@ ProcessExecution.prototype.getApi = function getApi(message) {
|
|
|
335
335
|
return api;
|
|
336
336
|
};
|
|
337
337
|
ProcessExecution.prototype._start = function start() {
|
|
338
|
-
if (this[kElements].children.length
|
|
338
|
+
if (!this[kElements].children.length) {
|
|
339
339
|
return this._complete('completed');
|
|
340
340
|
}
|
|
341
341
|
this[kStatus] = 'start';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-elements",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "Executable workflow elements based on BPMN 2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@0dep/piso": "^3.0.1",
|
|
106
|
-
"smqp": "^
|
|
106
|
+
"smqp": "^11.0.1"
|
|
107
107
|
}
|
|
108
108
|
}
|
package/src/activity/Activity.js
CHANGED
|
@@ -72,7 +72,7 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
72
72
|
|
|
73
73
|
const isParallelJoin = activityDef.isParallelGateway && inboundSequenceFlows.length > 1;
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
this[kFlows] = {
|
|
76
76
|
inboundSequenceFlows,
|
|
77
77
|
inboundAssociations,
|
|
78
78
|
inboundTriggers,
|
|
@@ -82,11 +82,11 @@ function Activity(Behaviour, activityDef, context) {
|
|
|
82
82
|
inboundJoinFlows: new Set(),
|
|
83
83
|
inboundSourceIds: new Set(inboundSequenceFlows.map(({ sourceId }) => sourceId)),
|
|
84
84
|
}),
|
|
85
|
-
}
|
|
85
|
+
};
|
|
86
86
|
|
|
87
87
|
this[kFlags] = {
|
|
88
|
-
isEnd:
|
|
89
|
-
isStart:
|
|
88
|
+
isEnd: !outboundSequenceFlows.length,
|
|
89
|
+
isStart: !inboundTriggers.length && !behaviour.triggeredByEvent,
|
|
90
90
|
isSubProcess: activityDef.isSubProcess,
|
|
91
91
|
isMultiInstance: !!behaviour.loopCharacteristics,
|
|
92
92
|
isForCompensation,
|
|
@@ -233,8 +233,7 @@ Object.defineProperties(Activity.prototype, {
|
|
|
233
233
|
Activity.prototype.activate = function activate() {
|
|
234
234
|
if (this[kActivated]) return;
|
|
235
235
|
this[kActivated] = true;
|
|
236
|
-
this.addInboundListeners();
|
|
237
|
-
return this._consumeInbound();
|
|
236
|
+
return this.addInboundListeners() && this._consumeInbound();
|
|
238
237
|
};
|
|
239
238
|
|
|
240
239
|
Activity.prototype.deactivate = function deactivate() {
|
|
@@ -346,17 +345,21 @@ Activity.prototype.discard = function discard(discardContent) {
|
|
|
346
345
|
};
|
|
347
346
|
|
|
348
347
|
Activity.prototype.addInboundListeners = function addInboundListeners() {
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
348
|
+
const triggers = this[kFlows].inboundTriggers;
|
|
349
|
+
if (triggers.length) {
|
|
350
|
+
const onInboundEvent = this._onInboundEvent.bind(this);
|
|
351
|
+
const triggerConsumerTag = `_inbound-${this.id}`;
|
|
352
|
+
for (const trigger of triggers) {
|
|
353
|
+
if (trigger.isSequenceFlow) {
|
|
354
|
+
trigger.broker.subscribeTmp('event', 'flow.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
|
|
355
|
+
} else if (this.isForCompensation) {
|
|
356
|
+
trigger.broker.subscribeTmp('event', 'association.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
|
|
357
|
+
} else {
|
|
358
|
+
trigger.broker.subscribeTmp('event', 'activity.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
|
|
359
|
+
}
|
|
358
360
|
}
|
|
359
361
|
}
|
|
362
|
+
return triggers.length;
|
|
360
363
|
};
|
|
361
364
|
|
|
362
365
|
Activity.prototype.removeInboundListeners = function removeInboundListeners() {
|
|
@@ -466,16 +469,16 @@ Activity.prototype._shakeOutbound = function shakeOutbound(sourceMessage) {
|
|
|
466
469
|
Activity.prototype._consumeInbound = function consumeInbound() {
|
|
467
470
|
if (!this[kActivated]) return;
|
|
468
471
|
|
|
469
|
-
if (this.status) return;
|
|
472
|
+
if (this.status || !this[kFlows].inboundTriggers.length) return;
|
|
470
473
|
|
|
471
474
|
const inboundQ = this.broker.getQueue('inbound-q');
|
|
472
475
|
const onInbound = this[kMessageHandlers].onInbound;
|
|
473
476
|
|
|
474
477
|
if (this[kFlags].isParallelJoin) {
|
|
475
|
-
return inboundQ.
|
|
478
|
+
return inboundQ.assertConsumer(onInbound, { consumerTag: '_run-on-inbound', prefetch: 1000 });
|
|
476
479
|
}
|
|
477
480
|
|
|
478
|
-
return inboundQ.
|
|
481
|
+
return inboundQ.assertConsumer(onInbound, { consumerTag: '_run-on-inbound' });
|
|
479
482
|
};
|
|
480
483
|
|
|
481
484
|
Activity.prototype._onInbound = function onInbound(routingKey, message) {
|
package/src/getPropertyValue.js
CHANGED
|
@@ -359,7 +359,7 @@ ProcessExecution.prototype.getApi = function getApi(message) {
|
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
ProcessExecution.prototype._start = function start() {
|
|
362
|
-
if (this[kElements].children.length
|
|
362
|
+
if (!this[kElements].children.length) {
|
|
363
363
|
return this._complete('completed');
|
|
364
364
|
}
|
|
365
365
|
|