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
- import {ActivityApi} from '../Api.js';
2
- import {cloneContent, cloneMessage} from '../messageHelper.js';
1
+ import { ActivityApi } from '../Api.js';
2
+ import { cloneContent, cloneMessage } from '../messageHelper.js';
3
3
 
4
4
  const kCompleted = Symbol.for('completed');
5
5
  const kExecuteQ = Symbol.for('executeQ');
@@ -16,7 +16,7 @@ function ActivityExecution(activity, context) {
16
16
  this.broker = activity.broker;
17
17
  this[kPostponed] = [];
18
18
  this[kCompleted] = false;
19
- this[kExecuteQ] = this.broker.assertQueue('execute-q', {durable: true, autoDelete: false});
19
+ this[kExecuteQ] = this.broker.assertQueue('execute-q', { durable: true, autoDelete: false });
20
20
 
21
21
  this[kMessageHandlers] = {
22
22
  onParentApiMessage: this._onParentApiMessage.bind(this),
@@ -36,11 +36,11 @@ ActivityExecution.prototype.execute = function execute(executeMessage) {
36
36
  if (!executionId) throw new Error('Execution requires execution id');
37
37
 
38
38
  this.executionId = executionId;
39
- const initMessage = this[kExecuteMessage] = cloneMessage(executeMessage, {
39
+ const initMessage = (this[kExecuteMessage] = cloneMessage(executeMessage, {
40
40
  executionId,
41
41
  state: 'start',
42
42
  isRootScope: true,
43
- });
43
+ }));
44
44
 
45
45
  if (executeMessage.fields.redelivered) {
46
46
  this[kPostponed].splice(0);
@@ -49,7 +49,7 @@ ActivityExecution.prototype.execute = function execute(executeMessage) {
49
49
  if (!this.source) this.source = new this.activity.Behaviour(this.activity, this.context);
50
50
 
51
51
  this.activate();
52
- return this.broker.publish('execution', 'execute.resume.execution', cloneContent(initMessage.content), {persistent: false});
52
+ return this.broker.publish('execution', 'execute.resume.execution', cloneContent(initMessage.content), { persistent: false });
53
53
  }
54
54
 
55
55
  this._debug('execute');
@@ -63,9 +63,9 @@ ActivityExecution.prototype.activate = function activate() {
63
63
 
64
64
  const broker = this.broker;
65
65
  const batchSize = this.activity.environment.settings.batchSize || 50;
66
- broker.bindQueue('execute-q', 'execution', 'execute.#', {priority: 100});
66
+ broker.bindQueue('execute-q', 'execution', 'execute.#', { priority: 100 });
67
67
 
68
- const {onExecuteMessage, onParentApiMessage} = this[kMessageHandlers];
68
+ const { onExecuteMessage, onParentApiMessage } = this[kMessageHandlers];
69
69
  this[kExecuteQ].assertConsumer(onExecuteMessage, {
70
70
  exclusive: true,
71
71
  prefetch: batchSize * 2,
@@ -131,11 +131,11 @@ ActivityExecution.prototype.getPostponed = function getPostponed() {
131
131
  };
132
132
 
133
133
  ActivityExecution.prototype.getState = function getState() {
134
- const result = {completed: this[kCompleted]};
134
+ const result = { completed: this[kCompleted] };
135
135
  const source = this.source;
136
136
 
137
137
  if (!source || !source.getState) return result;
138
- return {...result, ...source.getState()};
138
+ return { ...result, ...source.getState() };
139
139
  };
140
140
 
141
141
  ActivityExecution.prototype.recover = function recover(state) {
@@ -144,7 +144,7 @@ ActivityExecution.prototype.recover = function recover(state) {
144
144
  if (!state) return this;
145
145
  if ('completed' in state) this[kCompleted] = state.completed;
146
146
 
147
- const source = this.source = new this.activity.Behaviour(this.activity, this.context);
147
+ const source = (this.source = new this.activity.Behaviour(this.activity, this.context));
148
148
  if (source.recover) {
149
149
  source.recover(state);
150
150
  }
@@ -162,12 +162,12 @@ ActivityExecution.prototype._sourceExecute = function sourceExecute(executeMessa
162
162
  try {
163
163
  return this.source.execute(executeMessage);
164
164
  } catch (error) {
165
- return this.broker.publish('execution', 'execute.error', cloneContent(executeMessage.content, {error}));
165
+ return this.broker.publish('execution', 'execute.error', cloneContent(executeMessage.content, { error }));
166
166
  }
167
167
  };
168
168
 
169
169
  ActivityExecution.prototype._onExecuteMessage = function onExecuteMessage(routingKey, message) {
170
- const {fields, content, properties} = message;
170
+ const { fields, content, properties } = message;
171
171
  const isRedelivered = fields.redelivered;
172
172
 
173
173
  if (isRedelivered && properties.persistent === false) return message.ack();
@@ -200,7 +200,7 @@ ActivityExecution.prototype._onExecuteMessage = function onExecuteMessage(routin
200
200
  message.ack();
201
201
  break;
202
202
  }
203
- this.broker.publish('execution', 'execution.outbound.take', cloneContent(content), {type: 'outbound'});
203
+ this.broker.publish('execution', 'execution.outbound.take', cloneContent(content), { type: 'outbound' });
204
204
  break;
205
205
  }
206
206
  default: {
@@ -213,7 +213,7 @@ ActivityExecution.prototype._onExecuteMessage = function onExecuteMessage(routin
213
213
  };
214
214
 
215
215
  ActivityExecution.prototype._onStateChangeMessage = function onStateChangeMessage(message) {
216
- const {ignoreIfExecuting, executionId} = message.content;
216
+ const { ignoreIfExecuting, executionId } = message.content;
217
217
  const postponed = this[kPostponed];
218
218
  const idx = postponed.findIndex((msg) => msg.content.executionId === executionId);
219
219
  let previousMsg;
@@ -238,7 +238,7 @@ ActivityExecution.prototype._onExecutionCompleted = function onExecutionComplete
238
238
  if (!postponedMsg) return;
239
239
  const postponed = this[kPostponed];
240
240
 
241
- const {executionId, keep, isRootScope} = message.content;
241
+ const { executionId, keep, isRootScope } = message.content;
242
242
  if (!isRootScope) {
243
243
  this._debug('completed sub execution');
244
244
  if (!keep) message.ack();
@@ -259,12 +259,12 @@ ActivityExecution.prototype._onExecutionCompleted = function onExecutionComplete
259
259
  postponed.splice(0);
260
260
  for (const api of subApis) api.discard();
261
261
 
262
- this._publishExecutionCompleted('completed', {...postponedMsg.content, ...message.content}, message.properties.correlationId);
262
+ this._publishExecutionCompleted('completed', { ...postponedMsg.content, ...message.content }, message.properties.correlationId);
263
263
  };
264
264
 
265
265
  ActivityExecution.prototype._onExecutionDiscarded = function onExecutionDiscarded(discardType, message) {
266
266
  const postponedMsg = this._ackPostponed(message);
267
- const {isRootScope, error} = message.content;
267
+ const { isRootScope, error } = message.content;
268
268
  if (!isRootScope && !postponedMsg) return;
269
269
 
270
270
  const postponed = this[kPostponed];
@@ -272,7 +272,7 @@ ActivityExecution.prototype._onExecutionDiscarded = function onExecutionDiscarde
272
272
  if (!error && !isRootScope) {
273
273
  message.ack();
274
274
  if (postponed.length === 1 && postponed[0].content.isRootScope) {
275
- return this.broker.publish('execution', 'execute.discard', postponed[0].content, {correlationId});
275
+ return this.broker.publish('execution', 'execute.discard', postponed[0].content, { correlationId });
276
276
  }
277
277
  return;
278
278
  }
@@ -288,20 +288,29 @@ ActivityExecution.prototype._onExecutionDiscarded = function onExecutionDiscarde
288
288
  this._publishExecutionCompleted(discardType, cloneContent(message.content), correlationId);
289
289
  };
290
290
 
291
- ActivityExecution.prototype._publishExecutionCompleted = function publishExecutionCompleted(completionType, completeContent, correlationId) {
291
+ ActivityExecution.prototype._publishExecutionCompleted = function publishExecutionCompleted(
292
+ completionType,
293
+ completeContent,
294
+ correlationId,
295
+ ) {
292
296
  this[kCompleted] = true;
293
297
 
294
- this.broker.publish('execution', `execution.${completionType}`, {
295
- ...completeContent,
296
- state: completionType,
297
- }, {type: completionType, correlationId});
298
+ this.broker.publish(
299
+ 'execution',
300
+ `execution.${completionType}`,
301
+ {
302
+ ...completeContent,
303
+ state: completionType,
304
+ },
305
+ { type: completionType, correlationId },
306
+ );
298
307
  };
299
308
 
300
309
  ActivityExecution.prototype._ackPostponed = function ackPostponed(completeMessage) {
301
- const {executionId: eid} = completeMessage.content;
310
+ const { executionId: eid } = completeMessage.content;
302
311
 
303
312
  const postponed = this[kPostponed];
304
- const idx = postponed.findIndex(({content: c}) => c.executionId === eid);
313
+ const idx = postponed.findIndex(({ content: c }) => c.executionId === eid);
305
314
  if (idx === -1) return;
306
315
  const [msg] = postponed.splice(idx, 1);
307
316
  msg.ack();
@@ -311,9 +320,9 @@ ActivityExecution.prototype._ackPostponed = function ackPostponed(completeMessag
311
320
  ActivityExecution.prototype._onParentApiMessage = function onParentApiMessage(routingKey, message) {
312
321
  switch (message.properties.type) {
313
322
  case 'error':
314
- return this[kExecuteQ].queueMessage({routingKey: 'execute.error'}, {error: message.content.error});
323
+ return this[kExecuteQ].queueMessage({ routingKey: 'execute.error' }, { error: message.content.error });
315
324
  case 'discard':
316
- return this[kExecuteQ].queueMessage({routingKey: 'execute.discard'}, cloneContent(this[kExecuteMessage].content));
325
+ return this[kExecuteQ].queueMessage({ routingKey: 'execute.discard' }, cloneContent(this[kExecuteMessage].content));
317
326
  case 'stop': {
318
327
  return this._onStop(message);
319
328
  }
@@ -340,7 +349,7 @@ ActivityExecution.prototype._debug = function debug(logMessage, executionId) {
340
349
 
341
350
  function getExecuteMessage(message) {
342
351
  const result = cloneMessage(message, {
343
- ...(message.fields.redelivered && {isRecovered: true}),
352
+ ...(message.fields.redelivered && { isRecovered: true }),
344
353
  ignoreIfExecuting: undefined,
345
354
  });
346
355
  return result;
@@ -1,12 +1,12 @@
1
- import {cloneParent} from '../messageHelper.js';
1
+ import { cloneParent } from '../messageHelper.js';
2
2
 
3
3
  export default function DummyActivity(activityDef) {
4
- const {id, type = 'dummy', name, parent, behaviour} = activityDef;
4
+ const { id, type = 'dummy', name, parent, behaviour } = activityDef;
5
5
  return {
6
6
  id,
7
7
  type,
8
8
  name,
9
- behaviour: {...behaviour},
9
+ behaviour: { ...behaviour },
10
10
  parent: cloneParent(parent),
11
11
  placeholder: true,
12
12
  };
@@ -1,7 +1,7 @@
1
1
  export default function Escalation(signalDef, context) {
2
- const {id, type, name, parent: originalParent} = signalDef;
3
- const {environment} = context;
4
- const parent = {...originalParent};
2
+ const { id, type, name, parent: originalParent } = signalDef;
3
+ const { environment } = context;
4
+ const parent = { ...originalParent };
5
5
 
6
6
  return {
7
7
  id,
@@ -17,7 +17,7 @@ export default function Escalation(signalDef, context) {
17
17
  type,
18
18
  messageType: 'escalation',
19
19
  name: name && environment.resolveExpression(name, executionMessage),
20
- parent: {...parent},
20
+ parent: { ...parent },
21
21
  };
22
22
  }
23
23
  }
@@ -1,10 +1,10 @@
1
- import {cloneMessage} from '../messageHelper.js';
2
- import {ActivityError, BpmnError} from '../error/Errors.js';
1
+ import { cloneMessage } from '../messageHelper.js';
2
+ import { ActivityError, BpmnError } from '../error/Errors.js';
3
3
 
4
4
  export default function ExecutionScope(activity, initMessage) {
5
- const {id, type, environment, logger} = activity;
5
+ const { id, type, environment, logger } = activity;
6
6
 
7
- const {fields, content, properties} = cloneMessage(initMessage);
7
+ const { fields, content, properties } = cloneMessage(initMessage);
8
8
 
9
9
  const scope = {
10
10
  id,
@@ -1,7 +1,7 @@
1
1
  export default function Message(messageDef, context) {
2
- const {id, type, name, parent: originalParent} = messageDef;
3
- const {environment} = context;
4
- const parent = {...originalParent};
2
+ const { id, type, name, parent: originalParent } = messageDef;
3
+ const { environment } = context;
4
+ const parent = { ...originalParent };
5
5
 
6
6
  return {
7
7
  id,
@@ -16,8 +16,8 @@ export default function Message(messageDef, context) {
16
16
  id,
17
17
  type,
18
18
  messageType: 'message',
19
- ...(name && {name: environment.resolveExpression(name, executionMessage)}),
20
- parent: {...parent},
19
+ ...(name && { name: environment.resolveExpression(name, executionMessage) }),
20
+ parent: { ...parent },
21
21
  };
22
22
  }
23
23
  }
@@ -1,7 +1,7 @@
1
1
  export default function Signal(signalDef, context) {
2
- const {id, type = 'Signal', name, parent: originalParent} = signalDef;
3
- const {environment} = context;
4
- const parent = {...originalParent};
2
+ const { id, type = 'Signal', name, parent: originalParent } = signalDef;
3
+ const { environment } = context;
4
+ const parent = { ...originalParent };
5
5
 
6
6
  return {
7
7
  id,
@@ -16,8 +16,8 @@ export default function Signal(signalDef, context) {
16
16
  id,
17
17
  type,
18
18
  messageType: 'signal',
19
- ...(name && {name: environment.resolveExpression(name, executionMessage)}),
20
- parent: {...parent},
19
+ ...(name && { name: environment.resolveExpression(name, executionMessage) }),
20
+ parent: { ...parent },
21
21
  };
22
22
  }
23
23
  }
@@ -1,9 +1,9 @@
1
1
  import DefinitionExecution from './DefinitionExecution.js';
2
- import {DefinitionApi} from '../Api.js';
3
- import {DefinitionBroker} from '../EventBroker.js';
4
- import {getUniqueId, getOptionsAndCallback} from '../shared.js';
5
- import {makeErrorFromMessage} from '../error/Errors.js';
6
- import {cloneMessage, cloneContent} from '../messageHelper.js';
2
+ import { DefinitionApi } from '../Api.js';
3
+ import { DefinitionBroker } from '../EventBroker.js';
4
+ import { getUniqueId, getOptionsAndCallback } from '../shared.js';
5
+ import { makeErrorFromMessage } from '../error/Errors.js';
6
+ import { cloneMessage, cloneContent } from '../messageHelper.js';
7
7
 
8
8
  const kConsuming = Symbol.for('consuming');
9
9
  const kCounters = Symbol.for('counters');
@@ -20,7 +20,7 @@ export function Definition(context, options) {
20
20
  if (!(this instanceof Definition)) return new Definition(context, options);
21
21
  if (!context) throw new Error('No context');
22
22
 
23
- const {id, name, type = 'definition'} = context;
23
+ const { id, name, type = 'definition' } = context;
24
24
 
25
25
  this.id = id;
26
26
  this.type = type;
@@ -51,7 +51,7 @@ export function Definition(context, options) {
51
51
  onExecutionMessage: this._onExecutionMessage.bind(this),
52
52
  };
53
53
 
54
- const {broker, on, once, waitFor, emit, emitFatal} = DefinitionBroker(this, onBrokerReturn);
54
+ const { broker, on, once, waitFor, emit, emitFatal } = DefinitionBroker(this, onBrokerReturn);
55
55
  this.broker = broker;
56
56
 
57
57
  this.on = on;
@@ -66,7 +66,7 @@ export function Definition(context, options) {
66
66
  Object.defineProperties(Definition.prototype, {
67
67
  counters: {
68
68
  get() {
69
- return {...this[kCounters]};
69
+ return { ...this[kCounters] };
70
70
  },
71
71
  },
72
72
  execution: {
@@ -97,7 +97,7 @@ Object.defineProperties(Definition.prototype, {
97
97
  },
98
98
  activityStatus: {
99
99
  get() {
100
- return this[kExec].execution && this[kExec].execution.activityStatus || 'idle';
100
+ return (this[kExec].execution && this[kExec].execution.activityStatus) || 'idle';
101
101
  },
102
102
  },
103
103
  });
@@ -116,7 +116,7 @@ Definition.prototype.run = function run(optionsOrCallback, optionalCallback) {
116
116
 
117
117
  const exec = this[kExec];
118
118
  exec.executionId = getUniqueId(this.id);
119
- const content = this._createMessage({...runOptions});
119
+ const content = this._createMessage({ ...runOptions });
120
120
 
121
121
  const broker = this.broker;
122
122
  broker.publish('run', 'run.enter', content);
@@ -147,7 +147,7 @@ Definition.prototype.resume = function resume(callback) {
147
147
  this.logger.debug(`<${this.executionId} (${this.id})> resume`);
148
148
 
149
149
  const content = this._createMessage();
150
- this.broker.publish('run', 'run.resume', content, {persistent: false});
150
+ this.broker.publish('run', 'run.resume', content, { persistent: false });
151
151
  this._activateRunConsumers();
152
152
  return this;
153
153
  };
@@ -173,7 +173,7 @@ Definition.prototype.recover = function recover(state) {
173
173
  const exec = this[kExec];
174
174
  exec.executionId = state.executionId;
175
175
  if (state.counters) {
176
- this[kCounters] = {...this[kCounters], ...state.counters};
176
+ this[kCounters] = { ...this[kCounters], ...state.counters };
177
177
  }
178
178
 
179
179
  this.environment.recover(state.environment);
@@ -199,7 +199,7 @@ Definition.prototype.shake = function shake(startId) {
199
199
  } else bps = this.getProcesses();
200
200
 
201
201
  bps.forEach((bp) => {
202
- result = {...result, ...this._shakeProcess(bp, startId)};
202
+ result = { ...result, ...this._shakeProcess(bp, startId) };
203
203
  });
204
204
 
205
205
  return result;
@@ -208,13 +208,17 @@ Definition.prototype.shake = function shake(startId) {
208
208
  Definition.prototype._shakeProcess = function shakeProcess(shakeBp, startId) {
209
209
  let shovel;
210
210
  if (!shakeBp.isRunning) {
211
- shovel = shakeBp.broker.createShovel('shaker', {
212
- exchange: 'event',
213
- pattern: '*.shake#',
214
- }, {
215
- broker: this.broker,
216
- exchange: 'event',
217
- });
211
+ shovel = shakeBp.broker.createShovel(
212
+ 'shaker',
213
+ {
214
+ exchange: 'event',
215
+ pattern: '*.shake#',
216
+ },
217
+ {
218
+ broker: this.broker,
219
+ exchange: 'event',
220
+ },
221
+ );
218
222
  }
219
223
 
220
224
  const shakeResult = shakeBp.shake(startId);
@@ -273,24 +277,24 @@ Definition.prototype.getApi = function getApi(message) {
273
277
  };
274
278
 
275
279
  Definition.prototype.signal = function signal(message) {
276
- return this.getApi().signal(message, {delegate: true});
280
+ return this.getApi().signal(message, { delegate: true });
277
281
  };
278
282
 
279
283
  Definition.prototype.cancelActivity = function cancelActivity(message) {
280
- return this.getApi().cancel(message, {delegate: true});
284
+ return this.getApi().cancel(message, { delegate: true });
281
285
  };
282
286
 
283
287
  Definition.prototype.sendMessage = function sendMessage(message) {
284
- const messageContent = {message};
288
+ const messageContent = { message };
285
289
  let messageType = 'message';
286
290
  const reference = message && message.id && this.getElementById(message.id);
287
291
  if (reference && reference.resolve) {
288
- const resolvedReference = reference.resolve(this._createMessage({message}));
292
+ const resolvedReference = reference.resolve(this._createMessage({ message }));
289
293
  messageType = resolvedReference.messageType || messageType;
290
- messageContent.message = {...message, ...resolvedReference};
294
+ messageContent.message = { ...message, ...resolvedReference };
291
295
  }
292
296
 
293
- return this.getApi().sendApiMessage(messageType, messageContent, {delegate: true});
297
+ return this.getApi().sendApiMessage(messageType, messageContent, { delegate: true });
294
298
  };
295
299
 
296
300
  Definition.prototype.stop = function stop() {
@@ -301,7 +305,7 @@ Definition.prototype.stop = function stop() {
301
305
  Definition.prototype._activateRunConsumers = function activateRunConsumers() {
302
306
  this[kConsuming] = true;
303
307
  const broker = this.broker;
304
- const {onApiMessage, onRunMessage} = this[kMessageHandlers];
308
+ const { onApiMessage, onRunMessage } = this[kMessageHandlers];
305
309
  broker.subscribeTmp('api', `definition.*.${this.executionId}`, onApiMessage, {
306
310
  noAck: true,
307
311
  consumerTag: '_definition-api',
@@ -331,7 +335,7 @@ Definition.prototype._createMessage = function createMessage(override) {
331
335
  };
332
336
 
333
337
  Definition.prototype._onRunMessage = function onRunMessage(routingKey, message) {
334
- const {content, fields} = message;
338
+ const { content, fields } = message;
335
339
  if (routingKey === 'run.resume') {
336
340
  return this._onResumeMessage(message);
337
341
  }
@@ -388,10 +392,14 @@ Definition.prototype._onRunMessage = function onRunMessage(routingKey, message)
388
392
  break;
389
393
  }
390
394
  case 'run.error': {
391
- this._publishEvent('error', {
392
- ...content,
393
- error: fields.redelivered ? makeErrorFromMessage(message) : content.error,
394
- }, {mandatory: true});
395
+ this._publishEvent(
396
+ 'error',
397
+ {
398
+ ...content,
399
+ error: fields.redelivered ? makeErrorFromMessage(message) : content.error,
400
+ },
401
+ { mandatory: true },
402
+ );
395
403
  break;
396
404
  }
397
405
  case 'run.discarded': {
@@ -438,7 +446,7 @@ Definition.prototype._onResumeMessage = function onResumeMessage(message) {
438
446
  };
439
447
 
440
448
  Definition.prototype._onExecutionMessage = function onExecutionMessage(routingKey, message) {
441
- const {content, properties} = message;
449
+ const { content, properties } = message;
442
450
  const messageType = properties.type;
443
451
 
444
452
  message.ack();
@@ -508,9 +516,9 @@ function addConsumerCallbacks(definition, callback) {
508
516
  const broker = definition.broker;
509
517
  clearConsumers();
510
518
 
511
- broker.subscribeOnce('event', 'definition.stop', cbLeave, {consumerTag: '_definition-callback-stop'});
512
- broker.subscribeOnce('event', 'definition.leave', cbLeave, {consumerTag: '_definition-callback-leave'});
513
- broker.subscribeOnce('event', 'definition.error', cbError, {consumerTag: '_definition-callback-error'});
519
+ broker.subscribeOnce('event', 'definition.stop', cbLeave, { consumerTag: '_definition-callback-stop' });
520
+ broker.subscribeOnce('event', 'definition.leave', cbLeave, { consumerTag: '_definition-callback-leave' });
521
+ broker.subscribeOnce('event', 'definition.error', cbError, { consumerTag: '_definition-callback-error' });
514
522
 
515
523
  function cbLeave(_, message) {
516
524
  clearConsumers();