bpmn-elements 11.0.0 → 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 +14 -1
- package/README.md +1 -1
- package/dist/definition/DefinitionExecution.js +10 -1
- package/dist/events/BoundaryEvent.js +20 -5
- package/package.json +6 -6
- package/src/definition/DefinitionExecution.js +10 -1
- package/src/events/BoundaryEvent.js +11 -3
- package/types/index.d.ts +47 -12
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
|
|
279
|
+
Transactions and compensation if cancelled.
|
|
267
280
|
|
|
268
281
|
## Additions
|
|
269
282
|
- Add support for Transaction
|
package/README.md
CHANGED
|
@@ -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.
|
|
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
|
|
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(`<${
|
|
114
|
-
attachedTo.
|
|
115
|
-
|
|
116
|
-
|
|
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.
|
|
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.
|
|
49
|
-
"@babel/core": "^7.22.
|
|
50
|
-
"@babel/preset-env": "^7.22.
|
|
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.
|
|
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": "^
|
|
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.
|
|
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
|
|
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(`<${
|
|
110
|
+
this.activity.logger.debug(`<${executionId} (${this.id})> cancel ${attachedTo.status} activity <${attachedToContent.executionId} (${attachedToContent.id})>`);
|
|
111
111
|
|
|
112
|
-
|
|
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}) {
|
package/types/index.d.ts
CHANGED
|
@@ -129,6 +129,23 @@ declare module 'bpmn-elements' {
|
|
|
129
129
|
|
|
130
130
|
type filterPostponed = (elementApi: Api<ElementBase>) => boolean;
|
|
131
131
|
|
|
132
|
+
const enum DefinitionRunStatus {
|
|
133
|
+
Entered = 'entered',
|
|
134
|
+
Start = 'start',
|
|
135
|
+
Executing = 'executing',
|
|
136
|
+
End = 'end',
|
|
137
|
+
Discarded = 'discarded',
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const enum ProcessRunStatus {
|
|
141
|
+
Entered = 'entered',
|
|
142
|
+
Start = 'start',
|
|
143
|
+
Executing = 'executing',
|
|
144
|
+
Errored = 'errored',
|
|
145
|
+
End = 'end',
|
|
146
|
+
Discarded = 'discarded',
|
|
147
|
+
}
|
|
148
|
+
|
|
132
149
|
/**
|
|
133
150
|
* Activity status
|
|
134
151
|
* Can be used to decide when to save states, Timer and Wait is recommended.
|
|
@@ -153,6 +170,30 @@ declare module 'bpmn-elements' {
|
|
|
153
170
|
Wait = 'wait',
|
|
154
171
|
}
|
|
155
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Activity run status
|
|
175
|
+
*/
|
|
176
|
+
const enum ActivityRunStatus {
|
|
177
|
+
/** Run entered, triggered by taken inbound flow */
|
|
178
|
+
Entered = 'entered',
|
|
179
|
+
/** Run started */
|
|
180
|
+
Started = 'started',
|
|
181
|
+
/** Executing activity behaviour */
|
|
182
|
+
Executing = 'executing',
|
|
183
|
+
/** Activity behaviour execution completed successfully */
|
|
184
|
+
Executed = 'executed',
|
|
185
|
+
/** Run end, take outbound flows */
|
|
186
|
+
End = 'end',
|
|
187
|
+
/** Entering discard run, triggered by discarded inbound flow */
|
|
188
|
+
Discard = 'discard',
|
|
189
|
+
/** Run was discarded, discard outbound flows */
|
|
190
|
+
Discarded = 'discarded',
|
|
191
|
+
/** Activity behaviour execution failed, discard run */
|
|
192
|
+
Error = 'error',
|
|
193
|
+
/** Formatting next run message */
|
|
194
|
+
Formatting = 'formatting',
|
|
195
|
+
}
|
|
196
|
+
|
|
156
197
|
interface DefinitionExecution {
|
|
157
198
|
get id(): string;
|
|
158
199
|
get type(): string;
|
|
@@ -162,7 +203,7 @@ declare module 'bpmn-elements' {
|
|
|
162
203
|
get executionId(): string;
|
|
163
204
|
get stopped(): boolean;
|
|
164
205
|
get completed(): boolean;
|
|
165
|
-
get status():
|
|
206
|
+
get status(): string;
|
|
166
207
|
get processes(): Process[];
|
|
167
208
|
get postponedCount(): number;
|
|
168
209
|
get isRunning(): boolean;
|
|
@@ -314,7 +355,6 @@ declare module 'bpmn-elements' {
|
|
|
314
355
|
interface ElementState {
|
|
315
356
|
id: string;
|
|
316
357
|
type: string;
|
|
317
|
-
name: string;
|
|
318
358
|
broker?: BrokerState;
|
|
319
359
|
[x: string]: any;
|
|
320
360
|
}
|
|
@@ -333,9 +373,9 @@ declare module 'bpmn-elements' {
|
|
|
333
373
|
}
|
|
334
374
|
|
|
335
375
|
interface ActivityState extends ElementState {
|
|
376
|
+
status?: string,
|
|
336
377
|
executionId: string;
|
|
337
378
|
stopped: boolean;
|
|
338
|
-
behaviour: Record<string, any>;
|
|
339
379
|
counters: { taken: number, discarded: number };
|
|
340
380
|
execution?: ActivityExecutionState;
|
|
341
381
|
}
|
|
@@ -344,17 +384,12 @@ declare module 'bpmn-elements' {
|
|
|
344
384
|
counters: {take: number, discard: number, looped: number};
|
|
345
385
|
}
|
|
346
386
|
|
|
347
|
-
interface MessageFlowState {
|
|
348
|
-
id: string;
|
|
349
|
-
type: string;
|
|
387
|
+
interface MessageFlowState extends ElementState {
|
|
350
388
|
counters: {messages: number};
|
|
351
389
|
}
|
|
352
390
|
|
|
353
391
|
interface AssociationState extends ElementState {
|
|
354
392
|
counters: {take: number, discard: number };
|
|
355
|
-
sourceId: string;
|
|
356
|
-
targetId: string;
|
|
357
|
-
isAssociation: boolean;
|
|
358
393
|
}
|
|
359
394
|
|
|
360
395
|
interface ProcessExecutionState {
|
|
@@ -401,7 +436,7 @@ declare module 'bpmn-elements' {
|
|
|
401
436
|
get execution(): DefinitionExecution;
|
|
402
437
|
get executionId(): string;
|
|
403
438
|
get isRunning(): boolean;
|
|
404
|
-
get status():
|
|
439
|
+
get status(): DefinitionRunStatus | undefined;
|
|
405
440
|
get stopped(): boolean;
|
|
406
441
|
get activityStatus(): ActivityStatus;
|
|
407
442
|
run(): Definition;
|
|
@@ -437,7 +472,7 @@ declare module 'bpmn-elements' {
|
|
|
437
472
|
get isRunning(): boolean;
|
|
438
473
|
get executionId(): string;
|
|
439
474
|
get execution(): ProcessExecution;
|
|
440
|
-
get status():
|
|
475
|
+
get status(): ProcessRunStatus | undefined;
|
|
441
476
|
get activityStatus(): ActivityStatus;
|
|
442
477
|
init(useAsExecutionId?: string): void;
|
|
443
478
|
run(runContent?: Record<string, any>): void;
|
|
@@ -602,7 +637,7 @@ declare module 'bpmn-elements' {
|
|
|
602
637
|
interface Activity extends Element<Activity> {
|
|
603
638
|
get Behaviour(): ActivityBehaviour;
|
|
604
639
|
get stopped(): boolean;
|
|
605
|
-
get status():
|
|
640
|
+
get status(): ActivityRunStatus | undefined;
|
|
606
641
|
get counters(): { taken: number, discarded: number };
|
|
607
642
|
get execution(): ActivityExecution;
|
|
608
643
|
get executionId(): string;
|