bpmn-elements 11.0.1 → 11.1.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ # 11.1.1
5
+
6
+ - fix boundary event not cancelling task if resumed before task was resumed
7
+ - a cancelled call activity should also cancel the called process even if resumed before called process was resumed later
8
+
9
+ # 11.1.0
10
+
11
+ - bump [smqp@8](https://github.com/paed01/smqp/blob/default/CHANGELOG.md)
12
+
13
+ # 11.0.1
14
+
15
+ - update neglected type definition
16
+
4
17
  # 11.0.0
5
18
 
6
19
  - slim activity state by removing properties not needed for recover, might be breaking if state is inspected
@@ -263,7 +276,7 @@ Refactor scripts again
263
276
 
264
277
  # 2.1.0
265
278
 
266
- Transactions and compensation if canceled.
279
+ Transactions and compensation if cancelled.
267
280
 
268
281
  ## Additions
269
282
  - Add support for Transaction
package/README.md CHANGED
@@ -62,7 +62,7 @@ The following elements are tested and supported.
62
62
  - SignalEventDefinition
63
63
  - throw
64
64
  - catch
65
- - SignalTask
65
+ - [SignalTask](/docs/SignalTask.md)
66
66
  - ManualTask
67
67
  - UserTask
68
68
  - [StandardLoopCharacteristics](/docs/LoopCharacteristics.md)
@@ -602,7 +602,16 @@ DefinitionExecution.prototype._onCancelCallActivity = function onCancelCallActiv
602
602
  const targetProcess = this.getProcessByExecutionId(bpExecutionId);
603
603
  if (!targetProcess) return;
604
604
  this._debug(`cancel call from <${fromParent.id}.${fromId}> to <${calledElement}>`);
605
- targetProcess.getApi().discard();
605
+ if (!targetProcess.isRunning) {
606
+ targetProcess.getApi({
607
+ content: {
608
+ id: targetProcess.id,
609
+ executionId: targetProcess.executionId
610
+ }
611
+ }).discard();
612
+ } else {
613
+ targetProcess.getApi().discard();
614
+ }
606
615
  };
607
616
  DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(routingKey, executeMessage) {
608
617
  const content = executeMessage.content;
@@ -107,13 +107,28 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {
107
107
  }));
108
108
  }
109
109
  this[kCompleteContent] = content;
110
- const inbound = this[kExecuteMessage].content.inbound;
110
+ const {
111
+ inbound,
112
+ executionId
113
+ } = this[kExecuteMessage].content;
111
114
  const attachedToContent = inbound && inbound[0];
112
115
  const attachedTo = this.attachedTo;
113
- this.activity.logger.debug(`<${this.executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
114
- attachedTo.getApi({
115
- content: attachedToContent
116
- }).discard();
116
+ this.activity.logger.debug(`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
117
+ if (content.isRecovered && !attachedTo.isRunning) {
118
+ const attachedExecuteTag = `_on-attached-execute-${executionId}`;
119
+ this[kAttachedTags].push(attachedExecuteTag);
120
+ attachedTo.broker.subscribeOnce('execution', '#', () => {
121
+ attachedTo.getApi({
122
+ content: attachedToContent
123
+ }).discard();
124
+ }, {
125
+ consumerTag: attachedExecuteTag
126
+ });
127
+ } else {
128
+ attachedTo.getApi({
129
+ content: attachedToContent
130
+ }).discard();
131
+ }
117
132
  };
118
133
  BoundaryEventBehaviour.prototype._onAttachedLeave = function onAttachedLeave(_, {
119
134
  content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-elements",
3
- "version": "11.0.1",
3
+ "version": "11.1.1",
4
4
  "description": "Executable workflow elements based on BPMN 2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,9 +45,9 @@
45
45
  ],
46
46
  "devDependencies": {
47
47
  "@aircall/expression-parser": "^1.0.4",
48
- "@babel/cli": "^7.22.5",
49
- "@babel/core": "^7.22.5",
50
- "@babel/preset-env": "^7.22.5",
48
+ "@babel/cli": "^7.22.9",
49
+ "@babel/core": "^7.22.9",
50
+ "@babel/preset-env": "^7.22.9",
51
51
  "@babel/register": "^7.22.5",
52
52
  "@bonniernews/hot-bev": "^0.4.0",
53
53
  "bpmn-moddle": "^8.0.1",
@@ -56,7 +56,7 @@
56
56
  "chai": "^4.3.7",
57
57
  "chronokinesis": "^5.0.2",
58
58
  "debug": "^4.3.4",
59
- "eslint": "^8.43.0",
59
+ "eslint": "^8.44.0",
60
60
  "eslint-plugin-import": "^2.27.5",
61
61
  "got": "^12.6.1",
62
62
  "mocha": "^10.1.0",
@@ -65,6 +65,6 @@
65
65
  "nock": "^13.3.1"
66
66
  },
67
67
  "dependencies": {
68
- "smqp": "^7.1.4"
68
+ "smqp": "^8.0.0"
69
69
  }
70
70
  }
@@ -614,7 +614,16 @@ DefinitionExecution.prototype._onCancelCallActivity = function onCancelCallActiv
614
614
 
615
615
  this._debug(`cancel call from <${fromParent.id}.${fromId}> to <${calledElement}>`);
616
616
 
617
- targetProcess.getApi().discard();
617
+ if (!targetProcess.isRunning) {
618
+ targetProcess.getApi({
619
+ content: {
620
+ id: targetProcess.id,
621
+ executionId: targetProcess.executionId,
622
+ },
623
+ }).discard();
624
+ } else {
625
+ targetProcess.getApi().discard();
626
+ }
618
627
  };
619
628
 
620
629
  DefinitionExecution.prototype._onDelegateMessage = function onDelegateMessage(routingKey, executeMessage) {
@@ -103,13 +103,21 @@ BoundaryEventBehaviour.prototype._onCompleted = function onCompleted(_, {content
103
103
 
104
104
  this[kCompleteContent] = content;
105
105
 
106
- const inbound = this[kExecuteMessage].content.inbound;
106
+ const {inbound, executionId} = this[kExecuteMessage].content;
107
107
  const attachedToContent = inbound && inbound[0];
108
108
  const attachedTo = this.attachedTo;
109
109
 
110
- this.activity.logger.debug(`<${this.executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
110
+ this.activity.logger.debug(`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
111
111
 
112
- attachedTo.getApi({content: attachedToContent}).discard();
112
+ if (content.isRecovered && !attachedTo.isRunning) {
113
+ const attachedExecuteTag = `_on-attached-execute-${executionId}`;
114
+ this[kAttachedTags].push(attachedExecuteTag);
115
+ attachedTo.broker.subscribeOnce('execution', '#', () => {
116
+ attachedTo.getApi({content: attachedToContent}).discard();
117
+ }, {consumerTag: attachedExecuteTag});
118
+ } else {
119
+ attachedTo.getApi({content: attachedToContent}).discard();
120
+ }
113
121
  };
114
122
 
115
123
  BoundaryEventBehaviour.prototype._onAttachedLeave = function onAttachedLeave(_, {content}) {