Skip to content

Commit ac65407

Browse files
committed
bump smqp@11
1 parent 6881b2f commit ac65407

File tree

10 files changed

+108
-74
lines changed

10 files changed

+108
-74
lines changed

CHANGELOG.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,54 @@
22

33
## Unreleased
44

5-
## [17.2.2] - 2025-11-14
5+
## v17.3.0 - 2025-12-03
6+
7+
- major upgrade of [smqp@11](https://github.com/paed01/smqp/blob/default/CHANGELOG.md)
8+
9+
## v17.2.2 - 2025-11-14
610

711
- npm package provenance release
812

9-
## [17.2.1] - 2025-08-13
13+
## v17.2.1 - 2025-08-13
1014

1115
- major upgrade of [@0dep/piso@3](https://www.npmjs.com/package/@0dep/piso)
1216

13-
## [17.2.0] - 2025-07-22
17+
## v17.2.0 - 2025-07-22
1418

1519
- major upgrade of [smqp@10.0.0](https://github.com/paed01/smqp/blob/default/CHANGELOG.md)
1620

17-
## [17.1.0] - 2025-04-30
21+
## v17.1.0 - 2025-04-30
1822

1923
- add support for ad-hoc subprocess. The behavior is the same as for an ordinary subprocess
2024

21-
## [17.0.0] - 2025-02-08
25+
## v17.0.0 - 2025-02-08
2226

2327
- refactor message formatting, not sure if it breaking or not, but now it behaves as expected when formatting with multiple listeners
2428
- fix activity discard run when activity has completed executing but not yet reached end, status `executed`
2529
- use es5 trailing comma
2630

27-
## [16.2.2] - 2024-12-26
31+
## v16.2.2 - 2024-12-26
2832

2933
- fix call activities ignoring delegated cancel api message
3034

31-
## 16.2.1
35+
## v16.2.1
3236

3337
- fix call activities not represented with `activityStatus=wait`
3438
- bump [@0dep/piso@2.2](https://www.npmjs.com/package/@0dep/piso) with support for ISO week
3539
- use optional chaining (?) and nullish coalescing (??) where feasible since it's widely available, in nodejs since v14
3640
- replace arrays with set and remove unnecessary object assignments
3741

38-
## 16.2.0
42+
## v16.2.0
3943

4044
### Breaking
4145

4246
- refactor outbound sequence flow evaluation in an attempt to mitigate nasty discard loops when multiple outbound flows have the same target. What happens now is that only one (1) flow will be touched triggering the targeted activity. E.g: all outbound are discarded - only the last discarded flow is discarded; all but one flow is discarded - only taken flow is touched; all flows taken - only the last taken flow is taken. What about conditional flows? No worries, all conditional flows conditions are still evaluated
4347

44-
## 16.1.0
48+
## v16.1.0
4549

4650
- support ISO8601 interval timers with unbounded number of repetitions, e.g `R/PT1M` or `R-1/PT1M`
4751

48-
## 16.0.0
52+
## v16.0.0
4953

5054
### Breaking
5155

@@ -57,35 +61,35 @@
5761
- support conditional event definition condition script
5862
- export event definitions and flows
5963

60-
## [15.0.3] - 2024-07-08
64+
## v15.0.3 - 2024-07-08
6165

6266
- bump [@0dep/piso@2](https://www.npmjs.com/package/@0dep/piso) who totally forgot about applying declared offset before returning date
6367

64-
## 15.0.2
68+
## v15.0.2
6569

6670
- bump [@0dep/piso@1](https://www.npmjs.com/package/@0dep/piso)
6771

68-
## 15.0.1
72+
## v15.0.1
6973

7074
- fix parallel join inbound triggers not behaving as expected if inbound flow is taken more than once, unfortunately only for synchronous tasks
7175
- bump [smqp@9.0.2](https://github.com/paed01/smqp/blob/default/CHANGELOG.md)
7276
- add an image for activity execution documentation
7377

74-
## 15.0.0
78+
## v15.0.0
7579

7680
- use Set and Map where feasible to increase performance
7781
- bump [smqp@9](https://github.com/paed01/smqp/blob/default/CHANGELOG.md)
7882

79-
## 14.1.0
83+
## v14.1.0
8084

8185
- delegate Signal within a process
8286
- make sure message flow targeting process works as expected, successful but was not tested
8387

84-
## 14.0.1
88+
## v14.0.1
8589

8690
- throw `RunError` if `TimerEventDefinition` timer value parsing fails, referencing the complaining activity in the error source property
8791

88-
## 14.0.0
92+
## v14.0.0
8993

9094
Use [`@0dep/piso`](https://www.npmjs.com/package/@0dep/piso) to parse TimerEventDefinition duration and time date.
9195

@@ -99,29 +103,29 @@ Use [`@0dep/piso`](https://www.npmjs.com/package/@0dep/piso) to parse TimerEvent
99103

100104
- an activity discarded on enter, e.g. discarded by a BoundaryEvent, continued running, that arrogant behavior was unacceptable and stops now
101105

102-
## 13.2.0
106+
## v13.2.0
103107

104108
- hoist process environment output to definition environment on process error
105109
- major update of eslint
106110
- use prettier for formatting rules, touched basically ALL files
107111

108-
## 13.1.2
112+
## v13.1.2
109113

110114
- fix another lingering leave message. Now it was the definition execution that kept `process.leave` messages around for sentimental reasons
111115

112-
## 13.1.1
116+
## v13.1.1
113117

114118
- found the real reason behind ever groving state size - `activity.leave` messages were not acked by process execution. Doh!
115119

116-
## 13.1.0
120+
## v13.1.0
117121

118122
- introduce `disableTrackState` setting. Tracking of elements is done by counters, e.g. activity taken or discarded, sequence flow taken and discarded. Counters are saved when getting state. If you run really big flows the state will keep all elements just to be able to recover the number of times an element has been touched. Needless to say it the state will grow out of it's comfort zone. Setting `disableTrackState` to true will only return state for elements that are actually running
119123

120124
### Breaking
121125

122126
- `getState()` can return undefined
123127

124-
## 13.0.0
128+
## v13.0.0
125129

126130
- export task-, events-, and gateway activity behaviors through `bpmn-elements/tasks`, `bpmn-elements/events`, and `bpmn-elements/gateways` respectively
127131
- refactor type definitions for three days to make the above type safe and VS-code happy. Why is it so freaking complicated? Ambient bla bla bla ts(4-digit-number)??? Looped through all 10.000 ts-typescript errors. Patches are inevitable and imminent

dist/activity/Activity.js

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function Activity(Behaviour, activityDef, context) {
8686
}
8787
const outboundSequenceFlows = context.getOutboundSequenceFlows(id);
8888
const isParallelJoin = activityDef.isParallelGateway && inboundSequenceFlows.length > 1;
89-
const flows = this[kFlows] = {
89+
this[kFlows] = {
9090
inboundSequenceFlows,
9191
inboundAssociations,
9292
inboundTriggers,
@@ -100,8 +100,8 @@ function Activity(Behaviour, activityDef, context) {
100100
})
101101
};
102102
this[kFlags] = {
103-
isEnd: flows.outboundSequenceFlows.length === 0,
104-
isStart: flows.inboundSequenceFlows.length === 0 && !attachedTo && !behaviour.triggeredByEvent && !isForCompensation,
103+
isEnd: !outboundSequenceFlows.length,
104+
isStart: !inboundTriggers.length && !behaviour.triggeredByEvent,
105105
isSubProcess: activityDef.isSubProcess,
106106
isMultiInstance: !!behaviour.loopCharacteristics,
107107
isForCompensation,
@@ -245,8 +245,7 @@ Object.defineProperties(Activity.prototype, {
245245
Activity.prototype.activate = function activate() {
246246
if (this[kActivated]) return;
247247
this[kActivated] = true;
248-
this.addInboundListeners();
249-
return this._consumeInbound();
248+
return this.addInboundListeners() && this._consumeInbound();
250249
};
251250
Activity.prototype.deactivate = function deactivate() {
252251
this[kActivated] = false;
@@ -349,26 +348,30 @@ Activity.prototype.discard = function discard(discardContent) {
349348
this._consumeRunQ();
350349
};
351350
Activity.prototype.addInboundListeners = function addInboundListeners() {
352-
const onInboundEvent = this._onInboundEvent.bind(this);
353-
const triggerConsumerTag = `_inbound-${this.id}`;
354-
for (const trigger of this[kFlows].inboundTriggers) {
355-
if (trigger.isSequenceFlow) {
356-
trigger.broker.subscribeTmp('event', 'flow.#', onInboundEvent, {
357-
noAck: true,
358-
consumerTag: triggerConsumerTag
359-
});
360-
} else if (this.isForCompensation) {
361-
trigger.broker.subscribeTmp('event', 'association.#', onInboundEvent, {
362-
noAck: true,
363-
consumerTag: triggerConsumerTag
364-
});
365-
} else {
366-
trigger.broker.subscribeTmp('event', 'activity.#', onInboundEvent, {
367-
noAck: true,
368-
consumerTag: triggerConsumerTag
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+
}
370372
}
371373
}
374+
return triggers.length;
372375
};
373376
Activity.prototype.removeInboundListeners = function removeInboundListeners() {
374377
const triggerConsumerTag = `_inbound-${this.id}`;
@@ -471,16 +474,16 @@ Activity.prototype._shakeOutbound = function shakeOutbound(sourceMessage) {
471474
};
472475
Activity.prototype._consumeInbound = function consumeInbound() {
473476
if (!this[kActivated]) return;
474-
if (this.status) return;
477+
if (this.status || !this[kFlows].inboundTriggers.length) return;
475478
const inboundQ = this.broker.getQueue('inbound-q');
476479
const onInbound = this[kMessageHandlers].onInbound;
477480
if (this[kFlags].isParallelJoin) {
478-
return inboundQ.consume(onInbound, {
481+
return inboundQ.assertConsumer(onInbound, {
479482
consumerTag: '_run-on-inbound',
480483
prefetch: 1000
481484
});
482485
}
483-
return inboundQ.consume(onInbound, {
486+
return inboundQ.assertConsumer(onInbound, {
484487
consumerTag: '_run-on-inbound'
485488
});
486489
};

dist/getPropertyValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function splitArguments(args, base, fnScope) {
7676
}
7777
}
7878
if (argCompleted) {
79-
if (arg.length > 0) {
79+
if (arg.length) {
8080
callArguments.push(getFunctionArgument(base, arg.trim(), fnScope));
8181
}
8282
arg = '';

dist/process/ProcessExecution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ ProcessExecution.prototype.getApi = function getApi(message) {
335335
return api;
336336
};
337337
ProcessExecution.prototype._start = function start() {
338-
if (this[kElements].children.length === 0) {
338+
if (!this[kElements].children.length) {
339339
return this._complete('completed');
340340
}
341341
this[kStatus] = 'start';

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bpmn-elements",
3-
"version": "17.2.2",
3+
"version": "17.3.0",
44
"description": "Executable workflow elements based on BPMN 2.0",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -103,6 +103,6 @@
103103
},
104104
"dependencies": {
105105
"@0dep/piso": "^3.0.1",
106-
"smqp": "^10.0.0"
106+
"smqp": "^11.0.1"
107107
}
108108
}

src/activity/Activity.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function Activity(Behaviour, activityDef, context) {
7272

7373
const isParallelJoin = activityDef.isParallelGateway && inboundSequenceFlows.length > 1;
7474

75-
const flows = (this[kFlows] = {
75+
this[kFlows] = {
7676
inboundSequenceFlows,
7777
inboundAssociations,
7878
inboundTriggers,
@@ -82,11 +82,11 @@ function Activity(Behaviour, activityDef, context) {
8282
inboundJoinFlows: new Set(),
8383
inboundSourceIds: new Set(inboundSequenceFlows.map(({ sourceId }) => sourceId)),
8484
}),
85-
});
85+
};
8686

8787
this[kFlags] = {
88-
isEnd: flows.outboundSequenceFlows.length === 0,
89-
isStart: flows.inboundSequenceFlows.length === 0 && !attachedTo && !behaviour.triggeredByEvent && !isForCompensation,
88+
isEnd: !outboundSequenceFlows.length,
89+
isStart: !inboundTriggers.length && !behaviour.triggeredByEvent,
9090
isSubProcess: activityDef.isSubProcess,
9191
isMultiInstance: !!behaviour.loopCharacteristics,
9292
isForCompensation,
@@ -233,8 +233,7 @@ Object.defineProperties(Activity.prototype, {
233233
Activity.prototype.activate = function activate() {
234234
if (this[kActivated]) return;
235235
this[kActivated] = true;
236-
this.addInboundListeners();
237-
return this._consumeInbound();
236+
return this.addInboundListeners() && this._consumeInbound();
238237
};
239238

240239
Activity.prototype.deactivate = function deactivate() {
@@ -346,17 +345,21 @@ Activity.prototype.discard = function discard(discardContent) {
346345
};
347346

348347
Activity.prototype.addInboundListeners = function addInboundListeners() {
349-
const onInboundEvent = this._onInboundEvent.bind(this);
350-
const triggerConsumerTag = `_inbound-${this.id}`;
351-
for (const trigger of this[kFlows].inboundTriggers) {
352-
if (trigger.isSequenceFlow) {
353-
trigger.broker.subscribeTmp('event', 'flow.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
354-
} else if (this.isForCompensation) {
355-
trigger.broker.subscribeTmp('event', 'association.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
356-
} else {
357-
trigger.broker.subscribeTmp('event', 'activity.#', onInboundEvent, { noAck: true, consumerTag: triggerConsumerTag });
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+
}
358360
}
359361
}
362+
return triggers.length;
360363
};
361364

362365
Activity.prototype.removeInboundListeners = function removeInboundListeners() {
@@ -466,16 +469,16 @@ Activity.prototype._shakeOutbound = function shakeOutbound(sourceMessage) {
466469
Activity.prototype._consumeInbound = function consumeInbound() {
467470
if (!this[kActivated]) return;
468471

469-
if (this.status) return;
472+
if (this.status || !this[kFlows].inboundTriggers.length) return;
470473

471474
const inboundQ = this.broker.getQueue('inbound-q');
472475
const onInbound = this[kMessageHandlers].onInbound;
473476

474477
if (this[kFlags].isParallelJoin) {
475-
return inboundQ.consume(onInbound, { consumerTag: '_run-on-inbound', prefetch: 1000 });
478+
return inboundQ.assertConsumer(onInbound, { consumerTag: '_run-on-inbound', prefetch: 1000 });
476479
}
477480

478-
return inboundQ.consume(onInbound, { consumerTag: '_run-on-inbound' });
481+
return inboundQ.assertConsumer(onInbound, { consumerTag: '_run-on-inbound' });
479482
};
480483

481484
Activity.prototype._onInbound = function onInbound(routingKey, message) {

src/getPropertyValue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function splitArguments(args, base, fnScope) {
8686
}
8787

8888
if (argCompleted) {
89-
if (arg.length > 0) {
89+
if (arg.length) {
9090
callArguments.push(getFunctionArgument(base, arg.trim(), fnScope));
9191
}
9292
arg = '';

src/process/ProcessExecution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ ProcessExecution.prototype.getApi = function getApi(message) {
359359
};
360360

361361
ProcessExecution.prototype._start = function start() {
362-
if (this[kElements].children.length === 0) {
362+
if (!this[kElements].children.length) {
363363
return this._complete('completed');
364364
}
365365

0 commit comments

Comments
 (0)