bpmn-engine 20.0.0 → 20.0.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
4
4
 
5
- [![Build Status](https://app.travis-ci.com/paed01/bpmn-engine.svg?branch=master)](https://app.travis-ci.com/paed01/bpmn-engine)[![Build status](https://ci.appveyor.com/api/projects/status/670n39fivq1g3nu5?svg=true)](https://ci.appveyor.com/project/paed01/bpmn-engine)[![Coverage Status](https://coveralls.io/repos/github/paed01/bpmn-engine/badge.svg?branch=master)](https://coveralls.io/github/paed01/bpmn-engine?branch=master)
5
+ [![Build](https://github.com/paed01/bpmn-engine/actions/workflows/build.yaml/badge.svg)](https://github.com/paed01/bpmn-engine/actions/workflows/build.yaml)[![Build status](https://ci.appveyor.com/api/projects/status/670n39fivq1g3nu5?svg=true)](https://ci.appveyor.com/project/paed01/bpmn-engine)[![Coverage Status](https://coveralls.io/repos/github/paed01/bpmn-engine/badge.svg?branch=master)](https://coveralls.io/github/paed01/bpmn-engine?branch=master)
6
6
 
7
7
  # Introduction
8
8
 
package/lib/index.cjs CHANGED
@@ -613,30 +613,19 @@ Execution.prototype._onChildMessage = function onChildMessage(routingKey, messag
613
613
 
614
614
  newState = 'idle';
615
615
  break;
616
- case 'definition.error':
616
+ case 'definition.error': {
617
+ this._saveOutput(owner.environment.output);
617
618
  this._teardownDefinition(owner);
618
619
  newState = 'error';
619
620
  break;
621
+ }
620
622
  case 'activity.wait': {
621
623
  if (listener) listener.emit('wait', owner.getApi(message), this);
622
624
  break;
623
625
  }
624
626
  case 'process.end': {
625
- if (!message.content.output) break;
626
- const environment = this.environment;
627
-
628
- for (const key in message.content.output) {
629
- switch (key) {
630
- case 'data': {
631
- environment.output.data = environment.output.data || {};
632
- environment.output.data = { ...environment.output.data, ...message.content.output.data };
633
- break;
634
- }
635
- default: {
636
- environment.output[key] = message.content.output[key];
637
- }
638
- }
639
- }
627
+ if (message.content.inbound) break;
628
+ this._saveOutput(message.content.output);
640
629
  break;
641
630
  }
642
631
  }
@@ -678,6 +667,21 @@ Execution.prototype._teardownDefinition = function teardownDefinition(definition
678
667
  definition.broker.cancel('_engine_definition');
679
668
  };
680
669
 
670
+ Execution.prototype._saveOutput = function saveOutput(output) {
671
+ if (!output || typeof output !== 'object') return;
672
+
673
+ const environmentOutput = this.environment.output;
674
+
675
+ for (const key in output) {
676
+ if (key === 'data') {
677
+ const data = (environmentOutput.data = environmentOutput.data || {});
678
+ environmentOutput.data = { ...data, ...output.data };
679
+ } else {
680
+ environmentOutput[key] = output[key];
681
+ }
682
+ }
683
+ };
684
+
681
685
  Execution.prototype.getState = function getState() {
682
686
  const definitions = [];
683
687
  for (const definition of this.definitions) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bpmn-engine",
3
3
  "description": "BPMN 2.0 execution engine. Open source javascript workflow engine.",
4
- "version": "20.0.0",
4
+ "version": "20.0.1",
5
5
  "type": "module",
6
6
  "module": "./src/index.js",
7
7
  "main": "./lib/index.cjs",
@@ -54,13 +54,13 @@
54
54
  "@bonniernews/hot-bev": "^0.4.0",
55
55
  "@rollup/plugin-commonjs": "^25.0.7",
56
56
  "@types/bpmn-moddle": "^5.1.6",
57
+ "@types/node": "^18.19.31",
57
58
  "bent": "^7.3.12",
58
59
  "c8": "^9.1.0",
59
60
  "camunda-bpmn-moddle": "^7.0.1",
60
61
  "chai": "^5.1.0",
61
62
  "chronokinesis": "^6.0.0",
62
- "eslint": "^8.45.0",
63
- "eslint-plugin-import": "^2.29.1",
63
+ "eslint": "^9.0.0",
64
64
  "markdown-toc": "^1.2.0",
65
65
  "mocha": "^10.2.0",
66
66
  "mocha-cakes-2": "^3.3.0",
@@ -69,10 +69,10 @@
69
69
  "rollup": "^4.10.0"
70
70
  },
71
71
  "dependencies": {
72
- "bpmn-elements": "^13.1.2",
73
- "bpmn-moddle": "^8.0.1",
72
+ "bpmn-elements": "^13.2.0",
73
+ "bpmn-moddle": "^9.0.1",
74
74
  "debug": "^4.3.4",
75
- "moddle-context-serializer": "^4.0.0",
76
- "smqp": "^8.0.0"
75
+ "moddle-context-serializer": "^4.2.0",
76
+ "smqp": "^8.2.3"
77
77
  }
78
78
  }
package/src/index.js CHANGED
@@ -467,30 +467,19 @@ Execution.prototype._onChildMessage = function onChildMessage(routingKey, messag
467
467
 
468
468
  newState = 'idle';
469
469
  break;
470
- case 'definition.error':
470
+ case 'definition.error': {
471
+ this._saveOutput(owner.environment.output);
471
472
  this._teardownDefinition(owner);
472
473
  newState = 'error';
473
474
  break;
475
+ }
474
476
  case 'activity.wait': {
475
477
  if (listener) listener.emit('wait', owner.getApi(message), this);
476
478
  break;
477
479
  }
478
480
  case 'process.end': {
479
- if (!message.content.output) break;
480
- const environment = this.environment;
481
-
482
- for (const key in message.content.output) {
483
- switch (key) {
484
- case 'data': {
485
- environment.output.data = environment.output.data || {};
486
- environment.output.data = { ...environment.output.data, ...message.content.output.data };
487
- break;
488
- }
489
- default: {
490
- environment.output[key] = message.content.output[key];
491
- }
492
- }
493
- }
481
+ if (message.content.inbound) break;
482
+ this._saveOutput(message.content.output);
494
483
  break;
495
484
  }
496
485
  }
@@ -532,6 +521,21 @@ Execution.prototype._teardownDefinition = function teardownDefinition(definition
532
521
  definition.broker.cancel('_engine_definition');
533
522
  };
534
523
 
524
+ Execution.prototype._saveOutput = function saveOutput(output) {
525
+ if (!output || typeof output !== 'object') return;
526
+
527
+ const environmentOutput = this.environment.output;
528
+
529
+ for (const key in output) {
530
+ if (key === 'data') {
531
+ const data = (environmentOutput.data = environmentOutput.data || {});
532
+ environmentOutput.data = { ...data, ...output.data };
533
+ } else {
534
+ environmentOutput[key] = output[key];
535
+ }
536
+ }
537
+ };
538
+
535
539
  Execution.prototype.getState = function getState() {
536
540
  const definitions = [];
537
541
  for (const definition of this.definitions) {
@@ -16,6 +16,7 @@ import {
16
16
  ILogger,
17
17
  EnvironmentState,
18
18
  IScripts,
19
+ Script,
19
20
  } from 'bpmn-elements';
20
21
 
21
22
  declare module 'bpmn-engine' {