@onify/flow-extensions 6.0.0 → 7.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
- Changelog
2
- =========
1
+ # Changelog
2
+
3
+ # 7.1.0
4
+
5
+ - add process attribute `historyTimeToLive` to process environment variables when running
6
+ - add process attribute `historyTimeToLive` as timer to definition context via `extendFn`, formatted as ISO8601 duration
7
+ - use prettier since eslint will deprecate formatting rules in the next major release
8
+
9
+ # 7.0.0
10
+
11
+ Attempting to mitigate Boundary Event formatting interrupting normal execution flow. Asynchronous formatting prevents catching events from attached task. Should probably be done in bpmn-elements but the developer is busy.
12
+
13
+ ## Breaking
14
+
15
+ - No async formatting on boundary events before end
16
+ - Boundary event start execution listener will be executed but _without_ formatting capabilities and detached from execution. Occasional error will just be logged
17
+ - Boundary event end execution listener is still executed _with_ formatting capabilities
3
18
 
4
19
  # 6.0.0
5
20
 
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Onify Flow Extensions
2
- =====================
1
+ # Onify Flow Extensions
3
2
 
4
3
  [![Built latest](https://github.com/onify/flow-extensions/actions/workflows/build-latest.yaml/badge.svg)](https://github.com/onify/flow-extensions/actions/workflows/build-latest.yaml)[![Coverage Status](https://coveralls.io/repos/github/onify/flow-extensions/badge.svg?branch=default)](https://coveralls.io/github/onify/flow-extensions?branch=default)
5
4
 
@@ -13,8 +12,8 @@ Onify Flow Extensions
13
12
  ## Bpmn engine example
14
13
 
15
14
  ```js
16
- const {Engine} = require('bpmn-engine');
17
- const {extensions} = require('@onify/flow-extensions');
15
+ const { Engine } = require('bpmn-engine');
16
+ const { extensions } = require('@onify/flow-extensions');
18
17
  const FlowScripts = require('@onify/flow-extensions/dist/src/FlowScripts');
19
18
 
20
19
  const source = `
@@ -41,8 +40,8 @@ const engine = new Engine({
41
40
  },
42
41
  services: {
43
42
  serviceFn(scope, callback) {
44
- callback(null, {data: 1});
45
- }
43
+ callback(null, { data: 1 });
44
+ },
46
45
  },
47
46
  extensions: {
48
47
  onify: extensions,
@@ -63,11 +62,11 @@ engine.execute((err, instance) => {
63
62
  ## Extract scripts with extend function
64
63
 
65
64
  ```js
66
- const {extendFn} = require('@onify/flow-extensions');
65
+ const { extendFn } = require('@onify/flow-extensions');
67
66
 
68
67
  const BpmnModdle = require('bpmn-moddle');
69
68
  const Elements = require('bpmn-elements');
70
- const {default: Serializer, TypeResolver} = require('moddle-context-serializer');
69
+ const { default: Serializer, TypeResolver } = require('moddle-context-serializer');
71
70
 
72
71
  const source = `
73
72
  <definitions id="Def_0" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
@@ -124,9 +123,9 @@ function getModdleContext(source, options) {
124
123
  ## Extend sequence flow with properties and take listeners
125
124
 
126
125
  ```js
127
- const {OnifySequenceFlow, extensions} = require('@onify/flow-extensions');
126
+ const { OnifySequenceFlow, extensions } = require('@onify/flow-extensions');
128
127
  const FlowScripts = require('@onify/flow-extensions/dist/src/FlowScripts');
129
- const {Engine} = require('bpmn-engine');
128
+ const { Engine } = require('bpmn-engine');
130
129
  const Elements = require('bpmn-elements');
131
130
 
132
131
  const source = `
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OnifyBoundaryEventExtensions = void 0;
7
+ var _OnifyElementExtensions = require("./OnifyElementExtensions.js");
8
+ class OnifyBoundaryEventExtensions extends _OnifyElementExtensions.OnifyElementExtensions {
9
+ constructor(activity, context) {
10
+ super(activity, context);
11
+ this._syncFormatOnEnter = this._syncFormatOnEnter.bind(this);
12
+ }
13
+ activate(message) {
14
+ const activity = this.activity;
15
+ const formatQ = activity.broker.getQueue('format-run-q');
16
+ const executionListeners = this.extensions.listeners;
17
+ if (message.fields.redelivered && message.fields.routingKey === 'run.start') {
18
+ activity.on('start', this._syncFormatOnEnter, {
19
+ consumerTag: '_onify-extension-on-enter'
20
+ });
21
+ } else {
22
+ activity.on('enter', this._syncFormatOnEnter, {
23
+ consumerTag: '_onify-extension-on-enter'
24
+ });
25
+ }
26
+ activity.on('activity.execution.completed', elementApi => {
27
+ return this._onExecutionCompleted(elementApi, formatQ);
28
+ }, {
29
+ consumerTag: '_onify-extension-on-executed'
30
+ });
31
+ if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onStart) {
32
+ activity.on('start', async elementApi => {
33
+ try {
34
+ await executionListeners.execute('start', elementApi);
35
+ } catch (err) {
36
+ return activity.logger.error(`<${activity.id}> execution listener error`, err);
37
+ }
38
+ }, {
39
+ consumerTag: '_onify-extension-on-listenerstart'
40
+ });
41
+ }
42
+ if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onEnd) {
43
+ activity.on('end', elementApi => {
44
+ this._executeExecutionListener('end', elementApi, formatQ);
45
+ }, {
46
+ consumerTag: '_onify-extension-on-listenerend'
47
+ });
48
+ }
49
+ }
50
+ _syncFormatOnEnter(elementApi) {
51
+ try {
52
+ var format = this._onEnterSync(elementApi);
53
+ } catch (err) {
54
+ return elementApi.broker.publish('format', 'run.enter.error', {
55
+ error: err
56
+ }, {
57
+ persistent: false
58
+ });
59
+ }
60
+ elementApi.broker.publish('format', 'run.enter.complete', format, {
61
+ persistent: false
62
+ });
63
+ }
64
+ _onEnterSync(elementApi) {
65
+ var _io$output;
66
+ const {
67
+ format,
68
+ properties,
69
+ io
70
+ } = this.extensions;
71
+ const result = {};
72
+ Object.assign(result, format.resolve(elementApi));
73
+ Object.assign(elementApi.content, result);
74
+ if (properties) {
75
+ Object.assign(result, {
76
+ properties: properties.resolve(elementApi)
77
+ });
78
+ Object.assign(elementApi.content, result);
79
+ }
80
+ if (io !== null && io !== void 0 && (_io$output = io.output) !== null && _io$output !== void 0 && _io$output.length) {
81
+ result.assignToOutput = true;
82
+ }
83
+ return result;
84
+ }
85
+ }
86
+ exports.OnifyBoundaryEventExtensions = OnifyBoundaryEventExtensions;
@@ -9,6 +9,8 @@ class OnifyElementExtensions {
9
9
  constructor(activity, context) {
10
10
  this.activity = activity;
11
11
  this.context = context;
12
+ this.formatQ = activity.broker.getQueue('format-run-q');
13
+ this._asyncFormatOnEnter = this._asyncFormatOnEnter.bind(this);
12
14
  const {
13
15
  Service
14
16
  } = this.extensions = (0, _getExtensions.getExtensions)(activity, context);
@@ -18,100 +20,31 @@ class OnifyElementExtensions {
18
20
  }
19
21
  activate(message) {
20
22
  const activity = this.activity;
21
- const broker = activity.broker;
22
- const formatQ = activity.broker.getQueue('format-run-q');
23
23
  const executionListeners = this.extensions.listeners;
24
24
  if (message.fields.redelivered && message.fields.routingKey === 'run.start') {
25
- activity.on('start', elementApi => {
26
- this._formatOnEnter(broker, formatQ, elementApi);
27
- }, {
25
+ activity.on('start', this._asyncFormatOnEnter, {
28
26
  consumerTag: '_onify-extension-on-enter'
29
27
  });
30
28
  } else {
31
- activity.on('enter', elementApi => {
32
- this._formatOnEnter(broker, formatQ, elementApi);
33
- }, {
29
+ activity.on('enter', this._asyncFormatOnEnter, {
34
30
  consumerTag: '_onify-extension-on-enter'
35
31
  });
36
32
  }
37
- activity.on('activity.execution.completed', async elementApi => {
38
- if (activity.isSubProcess && activity.id !== elementApi.id) return;
39
- formatQ.queueMessage({
40
- routingKey: 'run.end.format'
41
- }, {
42
- endRoutingKey: 'run.end.complete'
43
- }, {
44
- persistent: false
45
- });
46
- try {
47
- var format = await this._onExecuted(elementApi);
48
- } catch (err) {
49
- return broker.publish('format', 'run.end.error', {
50
- error: err
51
- }, {
52
- persistent: false
53
- });
54
- }
55
- broker.publish('format', 'run.end.complete', {
56
- ...format
57
- }, {
58
- persistent: false
59
- });
33
+ activity.on('activity.execution.completed', elementApi => {
34
+ return this._onExecutionCompleted(elementApi);
60
35
  }, {
61
36
  consumerTag: '_onify-extension-on-executed'
62
37
  });
63
38
  if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onStart) {
64
- activity.on('start', async elementApi => {
65
- if (activity.isSubProcess && activity.id !== elementApi.id) return;
66
- formatQ.queueMessage({
67
- routingKey: 'run.listener.start'
68
- }, {
69
- endRoutingKey: 'run.listener.start.complete'
70
- }, {
71
- persistent: false
72
- });
73
- try {
74
- var format = await executionListeners.execute('start', elementApi);
75
- } catch (err) {
76
- return broker.publish('format', 'run.listener.start.error', {
77
- error: err
78
- }, {
79
- persistent: false
80
- });
81
- }
82
- broker.publish('format', 'run.listener.start.complete', {
83
- ...format
84
- }, {
85
- persistent: false
86
- });
39
+ activity.on('start', elementApi => {
40
+ this._executeExecutionListener('start', elementApi);
87
41
  }, {
88
42
  consumerTag: '_onify-extension-on-listenerstart'
89
43
  });
90
44
  }
91
45
  if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onEnd) {
92
- activity.on('end', async elementApi => {
93
- if (activity.isSubProcess && activity.id !== elementApi.id) return;
94
- formatQ.queueMessage({
95
- routingKey: 'run.listener.end'
96
- }, {
97
- endRoutingKey: 'run.listener.end.complete'
98
- }, {
99
- persistent: false
100
- });
101
- try {
102
- var format = await executionListeners.execute('end', elementApi);
103
- } catch (err) {
104
- return broker.publish('format', 'run.listener.end.error', {
105
- error: err
106
- }, {
107
- persistent: false
108
- });
109
- }
110
- broker.publish('format', 'run.listener.end.complete', {
111
- ...format
112
- }, {
113
- persistent: false
114
- });
46
+ activity.on('end', elementApi => {
47
+ this._executeExecutionListener('end', elementApi);
115
48
  }, {
116
49
  consumerTag: '_onify-extension-on-listenerend'
117
50
  });
@@ -124,9 +57,8 @@ class OnifyElementExtensions {
124
57
  broker.cancel('_onify-extension-on-listenerstart');
125
58
  broker.cancel('_onify-extension-on-listenerend');
126
59
  }
127
- async _formatOnEnter(broker, formatQ, elementApi) {
128
- if (this.activity.isSubProcess && this.activity.id !== elementApi.id) return;
129
- formatQ.queueMessage({
60
+ async _asyncFormatOnEnter(elementApi) {
61
+ this.formatQ.queueMessage({
130
62
  routingKey: 'run.enter.format'
131
63
  }, {
132
64
  endRoutingKey: 'run.enter.complete'
@@ -134,19 +66,42 @@ class OnifyElementExtensions {
134
66
  persistent: false
135
67
  });
136
68
  try {
137
- var format = await this._onEnter(elementApi);
69
+ var format = await this._onEnterAsync(elementApi);
138
70
  } catch (err) {
139
- return broker.publish('format', 'run.enter.error', {
71
+ return elementApi.broker.publish('format', 'run.enter.error', {
140
72
  error: err
141
73
  }, {
142
74
  persistent: false
143
75
  });
144
76
  }
145
- broker.publish('format', 'run.enter.complete', format, {
77
+ elementApi.broker.publish('format', 'run.enter.complete', format, {
146
78
  persistent: false
147
79
  });
148
80
  }
149
- async _onEnter(elementApi) {
81
+ async _onExecutionCompleted(elementApi) {
82
+ this.formatQ.queueMessage({
83
+ routingKey: 'run.end.format'
84
+ }, {
85
+ endRoutingKey: 'run.end.complete'
86
+ }, {
87
+ persistent: false
88
+ });
89
+ try {
90
+ var format = await this._onExecuted(elementApi);
91
+ } catch (err) {
92
+ return elementApi.broker.publish('format', 'run.end.error', {
93
+ error: err
94
+ }, {
95
+ persistent: false
96
+ });
97
+ }
98
+ elementApi.broker.publish('format', 'run.end.complete', {
99
+ ...format
100
+ }, {
101
+ persistent: false
102
+ });
103
+ }
104
+ async _onEnterAsync(elementApi) {
150
105
  const {
151
106
  format,
152
107
  properties,
@@ -220,5 +175,30 @@ class OnifyElementExtensions {
220
175
  }
221
176
  return result;
222
177
  }
178
+ async _executeExecutionListener(eventName, elementApi) {
179
+ const routingKey = 'run.listener.' + eventName;
180
+ const endRoutingKey = routingKey + '.complete';
181
+ this.formatQ.queueMessage({
182
+ routingKey
183
+ }, {
184
+ endRoutingKey
185
+ }, {
186
+ persistent: false
187
+ });
188
+ try {
189
+ var format = await this.extensions.listeners.execute(eventName, elementApi);
190
+ } catch (err) {
191
+ return elementApi.broker.publish('format', routingKey + '.error', {
192
+ error: err
193
+ }, {
194
+ persistent: false
195
+ });
196
+ }
197
+ elementApi.broker.publish('format', endRoutingKey, {
198
+ ...format
199
+ }, {
200
+ persistent: false
201
+ });
202
+ }
223
203
  }
224
204
  exports.OnifyElementExtensions = OnifyElementExtensions;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OnifySubProcessExtensions = void 0;
7
+ var _OnifyElementExtensions = require("./OnifyElementExtensions.js");
8
+ class OnifySubProcessExtensions extends _OnifyElementExtensions.OnifyElementExtensions {
9
+ constructor(activity, context) {
10
+ super(activity, context);
11
+ }
12
+ activate(runMessage) {
13
+ const activity = this.activity;
14
+ const broker = activity.broker;
15
+ const executionListeners = this.extensions.listeners;
16
+ if (runMessage.fields.redelivered && runMessage.fields.routingKey === 'run.start') {
17
+ this._setupListener(broker, 'activity.start', elementApi => {
18
+ return this._asyncFormatOnEnter(elementApi);
19
+ }, '_onify-extension-on-enter');
20
+ } else {
21
+ this._setupListener(broker, 'activity.enter', elementApi => {
22
+ return this._asyncFormatOnEnter(elementApi);
23
+ }, '_onify-extension-on-enter');
24
+ }
25
+ this._setupListener(broker, 'activity.execution.completed', elementApi => {
26
+ return this._onExecutionCompleted(elementApi);
27
+ }, '_onify-extension-on-executed');
28
+ if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onStart) {
29
+ this._setupListener(broker, 'activity.start', elementApi => {
30
+ this._executeExecutionListener('start', elementApi);
31
+ }, '_onify-extension-on-listenerstart');
32
+ }
33
+ if (executionListeners !== null && executionListeners !== void 0 && executionListeners.onEnd) {
34
+ this._setupListener(broker, 'activity.end', elementApi => {
35
+ this._executeExecutionListener('end', elementApi);
36
+ }, '_onify-extension-on-listenerend');
37
+ }
38
+ }
39
+ _setupListener(broker, routingKey, callback, consumerTag) {
40
+ const activity = this.activity;
41
+ broker.subscribeTmp('event', routingKey, (_, message) => {
42
+ if (activity.id !== message.content.id) return;
43
+ return callback(activity.getApi(message));
44
+ }, {
45
+ noAck: true,
46
+ consumerTag
47
+ });
48
+ }
49
+ }
50
+ exports.OnifySubProcessExtensions = OnifySubProcessExtensions;
@@ -77,6 +77,10 @@ exports.FormatActivity = FormatActivity;
77
77
  class FormatProcess {
78
78
  constructor(bp) {
79
79
  this.process = bp;
80
+ this._historyTTL = undefined;
81
+ if (bp.behaviour.historyTimeToLive) {
82
+ this._historyTTL = bp.context.definitionContext.getTimersByElementId(bp.id).find(t => t.timer.type === 'historyTimeToLive');
83
+ }
80
84
  }
81
85
  resolve(elementApi) {
82
86
  var _documentation$2, _user2, _groups2;
@@ -99,6 +103,9 @@ class FormatProcess {
99
103
  }),
100
104
  ...(!elementApi.content.description && description && {
101
105
  description: elementApi.resolveExpression(description)
106
+ }),
107
+ ...(this._historyTTL && {
108
+ historyTimeToLive: this._historyTTL.timer.value
102
109
  })
103
110
  };
104
111
  }
package/dist/index.js CHANGED
@@ -19,22 +19,50 @@ exports.extendFn = extendFn;
19
19
  exports.extensions = extensions;
20
20
  var _OnifyProcessExtensions = require("./OnifyProcessExtensions.js");
21
21
  var _OnifyElementExtensions = require("./OnifyElementExtensions.js");
22
+ var _OnifyBoundaryEventExtensions = require("./OnifyBoundaryEventExtensions.js");
23
+ var _OnifySubProcessExtensions = require("./OnifySubProcessExtensions.js");
22
24
  var _OnifySequenceFlow = require("./OnifySequenceFlow.js");
23
25
  var _OnifyTimerEventDefinition = require("./OnifyTimerEventDefinition.js");
24
26
  function extensions(element, context) {
25
- if (element.type === 'bpmn:Process') return new _OnifyProcessExtensions.OnifyProcessExtensions(element, context);
26
- return new _OnifyElementExtensions.OnifyElementExtensions(element, context);
27
+ switch (element.type) {
28
+ case 'bpmn:Process':
29
+ return new _OnifyProcessExtensions.OnifyProcessExtensions(element, context);
30
+ case 'bpmn:SubProcess':
31
+ case 'bpmn:Transaction':
32
+ return new _OnifySubProcessExtensions.OnifySubProcessExtensions(element, context);
33
+ case 'bpmn:BoundaryEvent':
34
+ return new _OnifyBoundaryEventExtensions.OnifyBoundaryEventExtensions(element, context);
35
+ default:
36
+ return new _OnifyElementExtensions.OnifyElementExtensions(element, context);
37
+ }
27
38
  }
28
39
  function extendFn(behaviour, context) {
29
40
  var _behaviour$extensionE;
30
- if (behaviour.$type === 'bpmn:StartEvent' && behaviour.eventDefinitions) {
31
- const timer = behaviour.eventDefinitions.find(({
32
- type,
33
- behaviour: edBehaviour
34
- }) => edBehaviour && type === 'bpmn:TimerEventDefinition');
35
- if (timer && timer.behaviour.timeCycle) Object.assign(behaviour, {
36
- scheduledStart: timer.behaviour.timeCycle
37
- });
41
+ switch (behaviour.$type) {
42
+ case 'bpmn:StartEvent':
43
+ {
44
+ if (!behaviour.eventDefinitions) break;
45
+ const timer = behaviour.eventDefinitions.find(({
46
+ type,
47
+ behaviour: edBehaviour
48
+ }) => edBehaviour && type === 'bpmn:TimerEventDefinition');
49
+ if (timer && timer.behaviour.timeCycle) Object.assign(behaviour, {
50
+ scheduledStart: timer.behaviour.timeCycle
51
+ });
52
+ break;
53
+ }
54
+ case 'bpmn:Process':
55
+ {
56
+ if (!behaviour.isExecutable) break;
57
+ const {
58
+ historyTimeToLive,
59
+ isExecutable
60
+ } = behaviour;
61
+ if (historyTimeToLive && isExecutable) {
62
+ context.addTimer(behaviour.id + ':historyTimeToLive', getHistoryTimeToLiveTimer(behaviour));
63
+ }
64
+ break;
65
+ }
38
66
  }
39
67
  if (!Array.isArray((_behaviour$extensionE = behaviour.extensionElements) === null || _behaviour$extensionE === void 0 ? void 0 : _behaviour$extensionE.values)) return;
40
68
  let listener = 0;
@@ -98,4 +126,25 @@ function registerListenerScript(parentId, context, type, listener, pos) {
98
126
  resource: script.resource
99
127
  })
100
128
  });
129
+ }
130
+ function getHistoryTimeToLiveTimer(behaviour) {
131
+ const {
132
+ id,
133
+ $type: type,
134
+ historyTimeToLive
135
+ } = behaviour;
136
+ let value = historyTimeToLive;
137
+ if (/^\d+$/.test(historyTimeToLive)) {
138
+ value = `P${historyTimeToLive}D`;
139
+ }
140
+ return {
141
+ id: `${type}/${id}:historyTimeToLive`,
142
+ type: 'historyTimeToLive',
143
+ timerType: 'timeDuration',
144
+ value,
145
+ parent: {
146
+ id,
147
+ type
148
+ }
149
+ };
101
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onify/flow-extensions",
3
- "version": "6.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Onify Flow extensions",
5
5
  "type": "module",
6
6
  "module": "src/index.js",
@@ -14,7 +14,7 @@
14
14
  "scripts": {
15
15
  "test": "mocha -R dot",
16
16
  "posttest": "npm run lint && npm run dist",
17
- "lint": "eslint . --cache",
17
+ "lint": "eslint . --cache && prettier . --check --cache",
18
18
  "prepare": "npm run dist",
19
19
  "dist": "babel src -d dist && babel test/helpers/FlowScripts.js -d dist",
20
20
  "test:lcov": "c8 -r lcov mocha && npm run lint",
@@ -39,23 +39,24 @@
39
39
  "devDependencies": {
40
40
  "@aircall/expression-parser": "^1.0.4",
41
41
  "@babel/cli": "^7.23.4",
42
- "@babel/core": "^7.23.5",
43
- "@babel/preset-env": "^7.23.5",
44
- "@babel/register": "^7.22.15",
42
+ "@babel/core": "^7.23.7",
43
+ "@babel/preset-env": "^7.23.8",
44
+ "@babel/register": "^7.23.7",
45
45
  "bpmn-elements-8-1": "npm:bpmn-elements@8.1",
46
- "bpmn-engine": "^17.1.1",
46
+ "bpmn-engine": "^18.0.0",
47
47
  "bpmn-engine-14": "npm:bpmn-engine@14",
48
- "bpmn-moddle": "^8.0.1",
49
- "c8": "^8.0.1",
48
+ "bpmn-moddle": "^8.1.0",
49
+ "c8": "^9.1.0",
50
50
  "camunda-bpmn-moddle": "^7.0.1",
51
- "chai": "^4.3.10",
51
+ "chai": "^5.0.0",
52
52
  "chronokinesis": "^6.0.0",
53
53
  "debug": "^4.3.4",
54
- "eslint": "^8.55.0",
55
- "eslint-plugin-import": "^2.29.0",
54
+ "eslint": "^8.56.0",
55
+ "eslint-plugin-import": "^2.29.1",
56
56
  "mocha": "^10.2.0",
57
57
  "mocha-cakes-2": "^3.3.0",
58
- "moddle-context-serializer": "^4.1.1"
58
+ "moddle-context-serializer": "^4.1.1",
59
+ "prettier": "^3.2.4"
59
60
  },
60
61
  "peerDependencies": {
61
62
  "bpmn-elements": ">=8"
package/src/Connector.js CHANGED
@@ -1,4 +1,4 @@
1
- import {NotImplemented} from './Errors.js';
1
+ import { NotImplemented } from './Errors.js';
2
2
 
3
3
  export default function Connector(connectorId, io, activity, executionMessage) {
4
4
  if (!(this instanceof Connector)) return new Connector(connectorId, io, activity, executionMessage);
@@ -22,7 +22,7 @@ Connector.prototype.execute = async function execute(...args) {
22
22
  if (!serviceFunction) return callback(new NotImplemented(connectorId));
23
23
 
24
24
  try {
25
- const input = io && await io.getInput(activity, executionMessage);
25
+ const input = io && (await io.getInput(activity, executionMessage));
26
26
  await serviceFunction.call(activity, input, ...args);
27
27
  } catch (err) {
28
28
  return callback(err);
@@ -33,7 +33,7 @@ Connector.prototype.execute = async function execute(...args) {
33
33
  if (!io?.output.length) return callback(null, result);
34
34
 
35
35
  try {
36
- const formattedResult = await io.getOutput(activity, {...executionMessage, ...result});
36
+ const formattedResult = await io.getOutput(activity, { ...executionMessage, ...result });
37
37
  return callback(null, formattedResult);
38
38
  } catch (err) {
39
39
  return callback(err);
package/src/Errors.js CHANGED
@@ -2,7 +2,7 @@ export class NotImplemented extends Error {
2
2
  constructor(serviceId) {
3
3
  super(`${serviceId} service function not found`);
4
4
  this.code = 'EFLOW_NOT_IMPLEMENTED';
5
- this.output = {statusCode: 501};
5
+ this.output = { statusCode: 501 };
6
6
  }
7
7
  }
8
8
 
@@ -10,6 +10,6 @@ export class FormatError extends Error {
10
10
  constructor(elementId, err) {
11
11
  super(`<${elementId}> ${err.message}`);
12
12
  this.code = 'EFLOW_FORMAT';
13
- this.output = {statusCode: 500};
13
+ this.output = { statusCode: 500 };
14
14
  }
15
15
  }