bpmn-elements 13.1.2 → 13.2.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.
Files changed (73) hide show
  1. package/README.md +1 -2
  2. package/dist/Context.js +36 -2
  3. package/dist/definition/DefinitionExecution.js +1 -1
  4. package/dist/getPropertyValue.js +1 -2
  5. package/dist/index.js +1 -1
  6. package/package.json +14 -13
  7. package/src/Api.js +18 -20
  8. package/src/Context.js +49 -7
  9. package/src/Environment.js +10 -20
  10. package/src/EventBroker.js +21 -27
  11. package/src/MessageFormatter.js +23 -19
  12. package/src/Tracker.js +4 -4
  13. package/src/activity/Activity.js +141 -109
  14. package/src/activity/ActivityExecution.js +38 -29
  15. package/src/activity/Dummy.js +3 -3
  16. package/src/activity/Escalation.js +4 -4
  17. package/src/activity/ExecutionScope.js +4 -4
  18. package/src/activity/Message.js +5 -5
  19. package/src/activity/Signal.js +5 -5
  20. package/src/definition/Definition.js +44 -36
  21. package/src/definition/DefinitionExecution.js +97 -66
  22. package/src/error/BpmnError.js +3 -3
  23. package/src/error/Errors.js +19 -14
  24. package/src/eventDefinitions/CancelEventDefinition.js +16 -11
  25. package/src/eventDefinitions/CompensateEventDefinition.js +28 -23
  26. package/src/eventDefinitions/ConditionalEventDefinition.js +42 -23
  27. package/src/eventDefinitions/ErrorEventDefinition.js +47 -34
  28. package/src/eventDefinitions/EscalationEventDefinition.js +21 -20
  29. package/src/eventDefinitions/EventDefinitionExecution.js +6 -6
  30. package/src/eventDefinitions/LinkEventDefinition.js +28 -22
  31. package/src/eventDefinitions/MessageEventDefinition.js +47 -36
  32. package/src/eventDefinitions/SignalEventDefinition.js +42 -31
  33. package/src/eventDefinitions/TerminateEventDefinition.js +4 -4
  34. package/src/eventDefinitions/TimerEventDefinition.js +41 -29
  35. package/src/events/BoundaryEvent.js +81 -46
  36. package/src/events/EndEvent.js +2 -2
  37. package/src/events/IntermediateCatchEvent.js +8 -4
  38. package/src/events/IntermediateThrowEvent.js +2 -2
  39. package/src/events/StartEvent.js +29 -18
  40. package/src/flows/Association.js +11 -11
  41. package/src/flows/MessageFlow.js +16 -14
  42. package/src/flows/SequenceFlow.js +22 -20
  43. package/src/gateways/EventBasedGateway.js +7 -6
  44. package/src/gateways/ExclusiveGateway.js +4 -4
  45. package/src/gateways/InclusiveGateway.js +3 -3
  46. package/src/gateways/ParallelGateway.js +4 -4
  47. package/src/getPropertyValue.js +3 -6
  48. package/src/index.js +1 -1
  49. package/src/io/BpmnIO.js +5 -6
  50. package/src/io/EnvironmentDataObject.js +2 -3
  51. package/src/io/EnvironmentDataStore.js +2 -2
  52. package/src/io/EnvironmentDataStoreReference.js +2 -2
  53. package/src/io/InputOutputSpecification.js +60 -54
  54. package/src/io/Properties.js +45 -33
  55. package/src/iso-duration.js +9 -13
  56. package/src/messageHelper.js +16 -23
  57. package/src/process/Lane.js +3 -3
  58. package/src/process/Process.js +40 -34
  59. package/src/process/ProcessExecution.js +122 -78
  60. package/src/tasks/CallActivity.js +109 -57
  61. package/src/tasks/LoopCharacteristics.js +30 -18
  62. package/src/tasks/ReceiveTask.js +59 -38
  63. package/src/tasks/ScriptTask.js +17 -8
  64. package/src/tasks/ServiceTask.js +16 -9
  65. package/src/tasks/SignalTask.js +47 -28
  66. package/src/tasks/StandardLoopCharacteristics.js +3 -3
  67. package/src/tasks/SubProcess.js +9 -8
  68. package/src/tasks/Task.js +4 -3
  69. package/src/tasks/Transaction.js +1 -1
  70. package/types/index.d.ts +6 -6
  71. package/types/types.d.ts +39 -35
  72. package/CHANGELOG.md +0 -459
  73. package/src/ExtensionsMapper.js +0 -42
@@ -1,5 +1,5 @@
1
1
  import Activity from '../activity/Activity.js';
2
- import {cloneContent} from '../messageHelper.js';
2
+ import { cloneContent } from '../messageHelper.js';
3
3
 
4
4
  const kCompleted = Symbol.for('completed');
5
5
  const kTargets = Symbol.for('targets');
@@ -19,14 +19,14 @@ export function EventBasedGatewayBehaviour(activity, context) {
19
19
 
20
20
  EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage) {
21
21
  const executeContent = executeMessage.content;
22
- const {executionId, outbound = [], outboundTaken} = executeContent;
22
+ const { executionId, outbound = [], outboundTaken } = executeContent;
23
23
 
24
24
  const targets = this[kTargets];
25
25
  this[kCompleted] = false;
26
26
  if (!targets.length) return this._complete(executeContent);
27
27
 
28
28
  for (const flow of this.activity.outbound) {
29
- outbound.push({id: flow.id, action: 'take'});
29
+ outbound.push({ id: flow.id, action: 'take' });
30
30
  }
31
31
 
32
32
  if (!this[kCompleted] && outboundTaken) return;
@@ -35,7 +35,7 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
35
35
 
36
36
  const onTargetCompleted = this._onTargetCompleted.bind(this, executeMessage);
37
37
  for (const target of this[kTargets]) {
38
- target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, {consumerTag: targetConsumerTag});
38
+ target.broker.subscribeOnce('event', 'activity.end', onTargetCompleted, { consumerTag: targetConsumerTag });
39
39
  }
40
40
 
41
41
  const broker = this.activity.broker;
@@ -44,11 +44,12 @@ EventBasedGatewayBehaviour.prototype.execute = function execute(executeMessage)
44
44
  });
45
45
 
46
46
  this[kCompleted] = false;
47
- if (!executeMessage.fields.redelivered) return broker.publish('execution', 'execute.outbound.take', cloneContent(executeContent, {outboundTaken: true}));
47
+ if (!executeMessage.fields.redelivered)
48
+ return broker.publish('execution', 'execute.outbound.take', cloneContent(executeContent, { outboundTaken: true }));
48
49
  };
49
50
 
50
51
  EventBasedGatewayBehaviour.prototype._onTargetCompleted = function onTargetCompleted(executeMessage, _, message, owner) {
51
- const {id: targetId, executionId: targetExecutionId} = message.content;
52
+ const { id: targetId, executionId: targetExecutionId } = message.content;
52
53
  const executeContent = executeMessage.content;
53
54
  const executionId = executeContent.executionId;
54
55
  this.activity.logger.debug(`<${executionId} (${this.id})> <${targetExecutionId}> completed run, discarding the rest`);
@@ -1,17 +1,17 @@
1
1
  import Activity from '../activity/Activity.js';
2
- import {cloneContent} from '../messageHelper.js';
2
+ import { cloneContent } from '../messageHelper.js';
3
3
 
4
4
  export default function ExclusiveGateway(activityDef, context) {
5
5
  return new Activity(ExclusiveGatewayBehaviour, activityDef, context);
6
6
  }
7
7
 
8
8
  export function ExclusiveGatewayBehaviour(activity) {
9
- const {id, type, broker} = activity;
9
+ const { id, type, broker } = activity;
10
10
  this.id = id;
11
11
  this.type = type;
12
12
  this.broker = broker;
13
13
  }
14
14
 
15
- ExclusiveGatewayBehaviour.prototype.execute = function execute({content}) {
16
- this.broker.publish('execution', 'execute.completed', cloneContent(content, {outboundTakeOne: true}));
15
+ ExclusiveGatewayBehaviour.prototype.execute = function execute({ content }) {
16
+ this.broker.publish('execution', 'execute.completed', cloneContent(content, { outboundTakeOne: true }));
17
17
  };
@@ -1,17 +1,17 @@
1
1
  import Activity from '../activity/Activity.js';
2
- import {cloneContent} from '../messageHelper.js';
2
+ import { cloneContent } from '../messageHelper.js';
3
3
 
4
4
  export default function InclusiveGateway(activityDef, context) {
5
5
  return new Activity(InclusiveGatewayBehaviour, activityDef, context);
6
6
  }
7
7
 
8
8
  export function InclusiveGatewayBehaviour(activity) {
9
- const {id, type, broker} = activity;
9
+ const { id, type, broker } = activity;
10
10
  this.id = id;
11
11
  this.type = type;
12
12
  this.broker = broker;
13
13
  }
14
14
 
15
- InclusiveGatewayBehaviour.prototype.execute = function execute({content}) {
15
+ InclusiveGatewayBehaviour.prototype.execute = function execute({ content }) {
16
16
  this.broker.publish('execution', 'execute.completed', cloneContent(content));
17
17
  };
@@ -1,17 +1,17 @@
1
1
  import Activity from '../activity/Activity.js';
2
- import {cloneContent} from '../messageHelper.js';
2
+ import { cloneContent } from '../messageHelper.js';
3
3
 
4
4
  export default function ParallelGateway(activityDef, context) {
5
- return new Activity(ParallelGatewayBehaviour, {...activityDef, isParallelGateway: true}, context);
5
+ return new Activity(ParallelGatewayBehaviour, { ...activityDef, isParallelGateway: true }, context);
6
6
  }
7
7
 
8
8
  export function ParallelGatewayBehaviour(activity) {
9
- const {id, type, broker} = activity;
9
+ const { id, type, broker } = activity;
10
10
  this.id = id;
11
11
  this.type = type;
12
12
  this.broker = broker;
13
13
  }
14
14
 
15
- ParallelGatewayBehaviour.prototype.execute = function execute({content}) {
15
+ ParallelGatewayBehaviour.prototype.execute = function execute({ content }) {
16
16
  this.broker.publish('execution', 'execute.completed', cloneContent(content));
17
17
  };
@@ -52,9 +52,9 @@ function executeFn(fn, args, base, fnScope) {
52
52
 
53
53
  if (!fnScope) return fn.apply(null, callArguments);
54
54
 
55
- return (function ScopedIIFE() { // eslint-disable-line no-extra-parens
55
+ return function ScopedIIFE() {
56
56
  return fn.apply(this, callArguments);
57
- }).call(fnScope);
57
+ }.call(fnScope);
58
58
  }
59
59
 
60
60
  function splitArguments(args, base, fnScope) {
@@ -69,14 +69,12 @@ function splitArguments(args, base, fnScope) {
69
69
  const charPos = args.charAt(i);
70
70
 
71
71
  if (!insideString) {
72
-
73
72
  if (charPos === ',') {
74
73
  argCompleted = true;
75
-
76
74
  } else if (charPos !== ' ') {
77
75
  arg += charPos;
78
76
 
79
- if (charPos === '\'' || charPos === '"') {
77
+ if (charPos === "'" || charPos === '"') {
80
78
  insideString = true;
81
79
  delimiter = charPos;
82
80
  }
@@ -90,7 +88,6 @@ function splitArguments(args, base, fnScope) {
90
88
  }
91
89
 
92
90
  if (argCompleted) {
93
-
94
91
  if (arg.length > 0) {
95
92
  callArguments.push(getFunctionArgument(base, arg.trim(), fnScope));
96
93
  }
package/src/index.js CHANGED
@@ -47,7 +47,7 @@ import Task from './tasks/Task.js';
47
47
  import TerminateEventDefinition from './eventDefinitions/TerminateEventDefinition.js';
48
48
  import TimerEventDefinition from './eventDefinitions/TimerEventDefinition.js';
49
49
  import Transaction from './tasks/Transaction.js';
50
- import {Timers} from './Timers.js';
50
+ import { Timers } from './Timers.js';
51
51
  import * as ISODuration from './iso-duration.js';
52
52
 
53
53
  export {
package/src/io/BpmnIO.js CHANGED
@@ -3,10 +3,7 @@ export default function BpmnIO(activity, context) {
3
3
  this.context = context;
4
4
  this.type = 'bpmnio';
5
5
 
6
- const {
7
- ioSpecification: ioSpecificationDef,
8
- properties: propertiesDef,
9
- } = activity.behaviour;
6
+ const { ioSpecification: ioSpecificationDef, properties: propertiesDef } = activity.behaviour;
10
7
 
11
8
  this.specification = ioSpecificationDef && new ioSpecificationDef.Behaviour(activity, ioSpecificationDef, context);
12
9
  this.properties = propertiesDef && new propertiesDef.Behaviour(activity, propertiesDef, context);
@@ -19,13 +16,15 @@ Object.defineProperty(BpmnIO.prototype, 'hasIo', {
19
16
  });
20
17
 
21
18
  BpmnIO.prototype.activate = function activate(message) {
22
- const properties = this.properties, specification = this.specification;
19
+ const properties = this.properties,
20
+ specification = this.specification;
23
21
  if (properties) properties.activate(message);
24
22
  if (specification) specification.activate(message);
25
23
  };
26
24
 
27
25
  BpmnIO.prototype.deactivate = function deactivate(message) {
28
- const properties = this.properties, specification = this.specification;
26
+ const properties = this.properties,
27
+ specification = this.specification;
29
28
  if (properties) properties.deactivate(message);
30
29
  if (specification) specification.deactivate(message);
31
30
  };
@@ -1,5 +1,5 @@
1
- export default function EnvironmentDataObject(dataObjectDef, {environment}) {
2
- const {id, type, name, behaviour, parent} = dataObjectDef;
1
+ export default function EnvironmentDataObject(dataObjectDef, { environment }) {
2
+ const { id, type, name, behaviour, parent } = dataObjectDef;
3
3
  this.id = id;
4
4
  this.type = type;
5
5
  this.name = name;
@@ -9,7 +9,6 @@ export default function EnvironmentDataObject(dataObjectDef, {environment}) {
9
9
  }
10
10
 
11
11
  EnvironmentDataObject.prototype.read = function read(broker, exchange, routingKeyPrefix, messageProperties) {
12
-
13
12
  const environment = this.environment;
14
13
  const value = environment.variables._data && environment.variables._data[this.id];
15
14
  const content = this._createContent(value);
@@ -1,5 +1,5 @@
1
- export default function EnvironmentDataStore(dataStoreDef, {environment}) {
2
- const {id, type, name, behaviour, parent} = dataStoreDef;
1
+ export default function EnvironmentDataStore(dataStoreDef, { environment }) {
2
+ const { id, type, name, behaviour, parent } = dataStoreDef;
3
3
  this.id = id;
4
4
  this.type = type;
5
5
  this.name = name;
@@ -1,5 +1,5 @@
1
- export default function EnvironmentDataStoreReference(dataObjectDef, {environment}) {
2
- const {id, type, name, behaviour, parent} = dataObjectDef;
1
+ export default function EnvironmentDataStoreReference(dataObjectDef, { environment }) {
2
+ const { id, type, name, behaviour, parent } = dataObjectDef;
3
3
  this.id = id;
4
4
  this.type = type;
5
5
  this.name = name;
@@ -1,10 +1,10 @@
1
1
  import getPropertyValue from '../getPropertyValue.js';
2
- import {brokerSafeId} from '../shared.js';
2
+ import { brokerSafeId } from '../shared.js';
3
3
 
4
4
  const kConsuming = Symbol.for('consuming');
5
5
 
6
6
  export default function IoSpecification(activity, ioSpecificationDef, context) {
7
- const {id, type = 'iospecification', behaviour = {}} = ioSpecificationDef;
7
+ const { id, type = 'iospecification', behaviour = {} } = ioSpecificationDef;
8
8
  this.id = id;
9
9
  this.type = type;
10
10
  this.behaviour = behaviour;
@@ -21,7 +21,7 @@ IoSpecification.prototype.activate = function activate(message) {
21
21
  if (message && message.fields.redelivered && message.fields.routingKey === 'run.end') {
22
22
  this._onFormatComplete(message);
23
23
  }
24
- this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
24
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
25
25
  };
26
26
 
27
27
  IoSpecification.prototype.deactivate = function deactivate() {
@@ -29,7 +29,7 @@ IoSpecification.prototype.deactivate = function deactivate() {
29
29
  };
30
30
 
31
31
  IoSpecification.prototype._onActivityEvent = function onActivityEvent(routingKey, message) {
32
- const {dataInputs, dataOutputs} = this.behaviour;
32
+ const { dataInputs, dataOutputs } = this.behaviour;
33
33
  if ((dataInputs || dataOutputs) && routingKey === 'activity.enter') {
34
34
  return this._onFormatEnter();
35
35
  }
@@ -42,7 +42,7 @@ IoSpecification.prototype._onActivityEvent = function onActivityEvent(routingKey
42
42
  IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
43
43
  const safeType = brokerSafeId(this.type).toLowerCase();
44
44
  const startRoutingKey = `run.onstart.${safeType}`;
45
- const {dataInputs, dataOutputs} = this.behaviour;
45
+ const { dataInputs, dataOutputs } = this.behaviour;
46
46
  const broker = this.broker;
47
47
  if (!dataInputs) {
48
48
  return broker.publish('format', startRoutingKey, {
@@ -52,24 +52,27 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
52
52
  });
53
53
  }
54
54
 
55
- const {dataObjects, sources} = dataInputs.reduce((result, ioSource, index) => {
56
- const source = {
57
- id: ioSource.id,
58
- type: ioSource.type,
59
- name: ioSource.name,
60
- };
61
- result.sources.push(source);
62
-
63
- const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.source.dataObject.id');
64
- if (!dataObjectId) return result;
65
- const dataObject = this.context.getDataObjectById(dataObjectId);
66
- if (!dataObject) return result;
67
- result.dataObjects.push({index, dataObject});
68
- return result;
69
- }, {
70
- dataObjects: [],
71
- sources: [],
72
- });
55
+ const { dataObjects, sources } = dataInputs.reduce(
56
+ (result, ioSource, index) => {
57
+ const source = {
58
+ id: ioSource.id,
59
+ type: ioSource.type,
60
+ name: ioSource.name,
61
+ };
62
+ result.sources.push(source);
63
+
64
+ const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.source.dataObject.id');
65
+ if (!dataObjectId) return result;
66
+ const dataObject = this.context.getDataObjectById(dataObjectId);
67
+ if (!dataObject) return result;
68
+ result.dataObjects.push({ index, dataObject });
69
+ return result;
70
+ },
71
+ {
72
+ dataObjects: [],
73
+ sources: [],
74
+ },
75
+ );
73
76
 
74
77
  if (!dataObjects.length) {
75
78
  return broker.publish('format', startRoutingKey, {
@@ -85,7 +88,7 @@ IoSpecification.prototype._onFormatEnter = function onFormatOnEnter() {
85
88
  endRoutingKey,
86
89
  ioSpecification: {
87
90
  dataInputs: sources.map((source) => {
88
- return {...source};
91
+ return { ...source };
89
92
  }),
90
93
  dataOutputs: this._getDataOutputs(dataOutputs),
91
94
  },
@@ -111,26 +114,29 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
111
114
  const broker = this.broker;
112
115
  const context = this.context;
113
116
 
114
- const {dataObjects, sources} = dataOutputs.reduce((result, ioSource, index) => {
115
- const {value} = messageOutputs.find((output) => output.id === ioSource.id) || {};
116
- const source = {
117
- id: ioSource.id,
118
- type: ioSource.type,
119
- name: ioSource.name,
120
- value,
121
- };
122
- result.sources.push(source);
123
-
124
- const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.target.dataObject.id');
125
- if (!dataObjectId) return result;
126
- const dataObject = context.getDataObjectById(dataObjectId);
127
- if (!dataObject) return result;
128
- result.dataObjects.push({index, dataObject, value});
129
- return result;
130
- }, {
131
- dataObjects: [],
132
- sources: [],
133
- });
117
+ const { dataObjects, sources } = dataOutputs.reduce(
118
+ (result, ioSource, index) => {
119
+ const { value } = messageOutputs.find((output) => output.id === ioSource.id) || {};
120
+ const source = {
121
+ id: ioSource.id,
122
+ type: ioSource.type,
123
+ name: ioSource.name,
124
+ value,
125
+ };
126
+ result.sources.push(source);
127
+
128
+ const dataObjectId = getPropertyValue(ioSource, 'behaviour.association.target.dataObject.id');
129
+ if (!dataObjectId) return result;
130
+ const dataObject = context.getDataObjectById(dataObjectId);
131
+ if (!dataObject) return result;
132
+ result.dataObjects.push({ index, dataObject, value });
133
+ return result;
134
+ },
135
+ {
136
+ dataObjects: [],
137
+ sources: [],
138
+ },
139
+ );
134
140
 
135
141
  const startRoutingKey = `run.onend.${safeType}`;
136
142
  if (!dataObjects.length) {
@@ -148,7 +154,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
148
154
  ioSpecification: {
149
155
  ...(messageInputs && {
150
156
  dataInputs: messageInputs.map((input) => {
151
- return {...input};
157
+ return { ...input };
152
158
  }),
153
159
  }),
154
160
  dataOutputs: this._getDataOutputs(dataOutputs),
@@ -162,7 +168,7 @@ IoSpecification.prototype._onFormatComplete = function formatOnComplete(message)
162
168
  ioSpecification: {
163
169
  ...(messageInputs && {
164
170
  dataInputs: messageInputs.map((input) => {
165
- return {...input};
171
+ return { ...input };
166
172
  }),
167
173
  }),
168
174
  dataOutputs: sources,
@@ -185,15 +191,15 @@ IoSpecification.prototype._getDataOutputs = function getDataOutputs(dataOutputs)
185
191
  function read(broker, dataObjectRefs, callback) {
186
192
  const responses = [];
187
193
  let count = 0;
188
- const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataObjectResponse, {noAck: true});
194
+ const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataObjectResponse, { noAck: true });
189
195
 
190
- for (const {dataObject} of dataObjectRefs) {
196
+ for (const { dataObject } of dataObjectRefs) {
191
197
  dataObject.read(broker, 'data', 'data.read.');
192
198
  }
193
199
 
194
200
  function onDataObjectResponse(routingKey, message) {
195
- const {index} = dataObjectRefs.find(({dataObject}) => dataObject.id === message.content.id);
196
- responses.push({...message.content, index});
201
+ const { index } = dataObjectRefs.find(({ dataObject }) => dataObject.id === message.content.id);
202
+ responses.push({ ...message.content, index });
197
203
 
198
204
  ++count;
199
205
 
@@ -207,15 +213,15 @@ function read(broker, dataObjectRefs, callback) {
207
213
  function write(broker, dataObjectRefs, callback) {
208
214
  const responses = [];
209
215
  let count = 0;
210
- broker.subscribeTmp('data', 'data.write.#', onDataObjectResponse, {noAck: true});
216
+ broker.subscribeTmp('data', 'data.write.#', onDataObjectResponse, { noAck: true });
211
217
 
212
- for (const {dataObject, value} of dataObjectRefs) {
218
+ for (const { dataObject, value } of dataObjectRefs) {
213
219
  dataObject.write(broker, 'data', 'data.write.', value);
214
220
  }
215
221
 
216
222
  function onDataObjectResponse(routingKey, message) {
217
- const idx = dataObjectRefs.findIndex(({dataObject}) => dataObject.id === message.content.id);
218
- responses[idx] = {index: idx, ...message.content};
223
+ const idx = dataObjectRefs.findIndex(({ dataObject }) => dataObject.id === message.content.id);
224
+ responses[idx] = { index: idx, ...message.content };
219
225
 
220
226
  ++count;
221
227
 
@@ -7,13 +7,13 @@ export default function Properties(activity, propertiesDef, context) {
7
7
  this.activity = activity;
8
8
  this.broker = activity.broker;
9
9
 
10
- const props = this[kProperties] = {
10
+ const props = (this[kProperties] = {
11
11
  properties: [],
12
12
  dataInputObjects: [],
13
13
  dataOutputObjects: [],
14
- };
14
+ });
15
15
 
16
- for (const {id, ...def} of propertiesDef.values) {
16
+ for (const { id, ...def } of propertiesDef.values) {
17
17
  const source = {
18
18
  id,
19
19
  type: def.type,
@@ -28,28 +28,28 @@ export default function Properties(activity, propertiesDef, context) {
28
28
 
29
29
  if (inputDataObjectId) {
30
30
  const reference = context.getDataObjectById(inputDataObjectId);
31
- props.dataInputObjects.push({id, reference});
31
+ props.dataInputObjects.push({ id, reference });
32
32
  source.input = {
33
33
  reference,
34
34
  };
35
35
  }
36
36
  if (outputDataObjectId) {
37
37
  const reference = context.getDataObjectById(outputDataObjectId);
38
- props.dataOutputObjects.push({id, reference: reference});
38
+ props.dataOutputObjects.push({ id, reference: reference });
39
39
  source.output = {
40
40
  reference,
41
41
  };
42
42
  }
43
43
  if (inputDataStoreId) {
44
44
  const reference = context.getDataStoreById(inputDataStoreId);
45
- props.dataInputObjects.push({id, reference});
45
+ props.dataInputObjects.push({ id, reference });
46
46
  source.input = {
47
47
  reference,
48
48
  };
49
49
  }
50
50
  if (outputDataStoreId) {
51
51
  const reference = context.getDataStoreById(outputDataStoreId);
52
- props.dataOutputObjects.push({id, reference});
52
+ props.dataOutputObjects.push({ id, reference });
53
53
  source.output = {
54
54
  reference,
55
55
  };
@@ -67,7 +67,7 @@ Properties.prototype.activate = function activate(message) {
67
67
  this._onActivityEvent('activity.extension.resume', message);
68
68
  }
69
69
 
70
- this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), {noAck: true});
70
+ this[kConsuming] = this.broker.subscribeTmp('event', 'activity.#', this._onActivityEvent.bind(this), { noAck: true });
71
71
  };
72
72
 
73
73
  Properties.prototype.deactivate = function deactivate() {
@@ -90,16 +90,22 @@ Properties.prototype._formatOnEnter = function formatOnEnter(message) {
90
90
  const dataInputObjects = this[kProperties].dataInputObjects;
91
91
  const broker = this.broker;
92
92
  if (!dataInputObjects.length) {
93
- return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
94
- properties: this._getProperties(message),
95
- });
93
+ return broker.getQueue('format-run-q').queueMessage(
94
+ { routingKey: startRoutingKey },
95
+ {
96
+ properties: this._getProperties(message),
97
+ },
98
+ );
96
99
  }
97
100
 
98
101
  const endRoutingKey = 'run.enter.bpmn-properties.end';
99
- broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
100
- endRoutingKey,
101
- properties: this._getProperties(message),
102
- });
102
+ broker.getQueue('format-run-q').queueMessage(
103
+ { routingKey: startRoutingKey },
104
+ {
105
+ endRoutingKey,
106
+ properties: this._getProperties(message),
107
+ },
108
+ );
103
109
 
104
110
  return read(broker, dataInputObjects, (_, responses) => {
105
111
  broker.publish('format', endRoutingKey, {
@@ -117,16 +123,22 @@ Properties.prototype._formatOnComplete = function formatOnComplete(message) {
117
123
  const dataOutputObjects = this[kProperties].dataOutputObjects;
118
124
  const broker = this.broker;
119
125
  if (!dataOutputObjects.length) {
120
- return broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
121
- properties: outputProperties,
122
- });
126
+ return broker.getQueue('format-run-q').queueMessage(
127
+ { routingKey: startRoutingKey },
128
+ {
129
+ properties: outputProperties,
130
+ },
131
+ );
123
132
  }
124
133
 
125
134
  const endRoutingKey = 'run.end.bpmn-properties.end';
126
- broker.getQueue('format-run-q').queueMessage({routingKey: startRoutingKey}, {
127
- endRoutingKey,
128
- properties: outputProperties,
129
- });
135
+ broker.getQueue('format-run-q').queueMessage(
136
+ { routingKey: startRoutingKey },
137
+ {
138
+ endRoutingKey,
139
+ properties: outputProperties,
140
+ },
141
+ );
130
142
 
131
143
  return write(broker, dataOutputObjects, outputProperties, (_, responses) => {
132
144
  broker.publish('format', endRoutingKey, {
@@ -139,12 +151,12 @@ Properties.prototype._getProperties = function getProperties(message, values) {
139
151
  let response = {};
140
152
 
141
153
  if (message.content.properties) {
142
- response = {...message.content.properties};
154
+ response = { ...message.content.properties };
143
155
  }
144
156
 
145
- for (const {id, type, name} of this[kProperties].properties) {
157
+ for (const { id, type, name } of this[kProperties].properties) {
146
158
  if (!(id in response)) {
147
- response[id] = {id, type, name};
159
+ response[id] = { id, type, name };
148
160
  }
149
161
 
150
162
  if (!values || !(id in values)) continue;
@@ -158,14 +170,14 @@ function read(broker, dataReferences, callback) {
158
170
  const responses = {};
159
171
  let count = 0;
160
172
 
161
- const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, {noAck: true});
173
+ const dataReadConsumer = broker.subscribeTmp('data', 'data.read.#', onDataReadResponse, { noAck: true });
162
174
 
163
- for (const {id: propertyId, reference} of dataReferences) {
164
- reference.read(broker, 'data', 'data.read.', {correlationId: propertyId});
175
+ for (const { id: propertyId, reference } of dataReferences) {
176
+ reference.read(broker, 'data', 'data.read.', { correlationId: propertyId });
165
177
  }
166
178
 
167
179
  function onDataReadResponse(routingKey, message) {
168
- responses[message.properties.correlationId] = {...message.content};
180
+ responses[message.properties.correlationId] = { ...message.content };
169
181
 
170
182
  if (++count < dataReferences.length) return;
171
183
 
@@ -177,15 +189,15 @@ function read(broker, dataReferences, callback) {
177
189
  function write(broker, dataReferences, properties, callback) {
178
190
  const responses = [];
179
191
  let count = 0;
180
- const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, {noAck: true});
192
+ const dataWriteConsumer = broker.subscribeTmp('data', 'data.write.#', onDataWriteResponse, { noAck: true });
181
193
 
182
- for (const {id: propertyId, reference} of dataReferences) {
194
+ for (const { id: propertyId, reference } of dataReferences) {
183
195
  const value = propertyId in properties ? properties[propertyId].value : undefined;
184
- reference.write(broker, 'data', 'data.write.', value, {correlationId: propertyId});
196
+ reference.write(broker, 'data', 'data.write.', value, { correlationId: propertyId });
185
197
  }
186
198
 
187
199
  function onDataWriteResponse(routingKey, message) {
188
- responses[message.properties.correlationId] = {...message.content};
200
+ responses[message.properties.correlationId] = { ...message.content };
189
201
 
190
202
  if (++count < dataReferences.length) return;
191
203
 
@@ -7,15 +7,7 @@ const timePattern = 'T('.concat(fractionalNumbers, 'H)?(').concat(fractionalNumb
7
7
 
8
8
  const rPattern = '(?:R('.concat(numbers).concat(')/)?');
9
9
  const iso8601 = rPattern.concat('P(?:').concat(datePattern, '(?:').concat(timePattern, ')?)');
10
- const objMap = [
11
- 'years',
12
- 'months',
13
- 'weeks',
14
- 'days',
15
- 'hours',
16
- 'minutes',
17
- 'seconds',
18
- ];
10
+ const objMap = ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'];
19
11
  const defaultDuration = Object.freeze({
20
12
  years: 0,
21
13
  months: 0,
@@ -44,10 +36,14 @@ export function parse(durationString) {
44
36
  throw new RangeError('invalid duration: ' + durationString);
45
37
  }
46
38
  // Check only one fraction is used
47
- if (slicedMatches.filter((v) => {
48
- return /\./.test(v || '');
49
- }).length > 1) {
50
- throw new RangeError('Fractions are allowed on the smallest unit in the string, e.g. P0.5D or PT1.0001S but not PT0.5M0.1S: ' + durationString);
39
+ if (
40
+ slicedMatches.filter((v) => {
41
+ return /\./.test(v || '');
42
+ }).length > 1
43
+ ) {
44
+ throw new RangeError(
45
+ 'Fractions are allowed on the smallest unit in the string, e.g. P0.5D or PT1.0001S but not PT0.5M0.1S: ' + durationString,
46
+ );
51
47
  }
52
48
 
53
49
  const result = {};