bpmn-elements 6.0.1 → 7.0.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 (116) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/README.md +3 -0
  3. package/dist/index.js +52 -44
  4. package/dist/src/Api.js +77 -76
  5. package/dist/src/Context.js +169 -175
  6. package/dist/src/Environment.js +90 -102
  7. package/dist/src/EventBroker.js +89 -88
  8. package/dist/src/ExtensionsMapper.js +2 -2
  9. package/dist/src/MessageFormatter.js +164 -95
  10. package/dist/src/Scripts.js +6 -2
  11. package/dist/src/activity/Activity.js +1106 -916
  12. package/dist/src/activity/ActivityExecution.js +342 -297
  13. package/dist/src/activity/Dummy.js +3 -3
  14. package/dist/src/definition/Definition.js +498 -444
  15. package/dist/src/definition/DefinitionExecution.js +722 -409
  16. package/dist/src/error/Errors.js +17 -7
  17. package/dist/src/eventDefinitions/CancelEventDefinition.js +190 -150
  18. package/dist/src/eventDefinitions/CompensateEventDefinition.js +194 -161
  19. package/dist/src/eventDefinitions/ConditionalEventDefinition.js +197 -135
  20. package/dist/src/eventDefinitions/ErrorEventDefinition.js +207 -165
  21. package/dist/src/eventDefinitions/EscalationEventDefinition.js +175 -141
  22. package/dist/src/eventDefinitions/EventDefinitionExecution.js +157 -129
  23. package/dist/src/eventDefinitions/LinkEventDefinition.js +174 -149
  24. package/dist/src/eventDefinitions/MessageEventDefinition.js +213 -176
  25. package/dist/src/eventDefinitions/SignalEventDefinition.js +203 -161
  26. package/dist/src/eventDefinitions/TerminateEventDefinition.js +21 -23
  27. package/dist/src/eventDefinitions/TimerEventDefinition.js +243 -228
  28. package/dist/src/events/BoundaryEvent.js +180 -144
  29. package/dist/src/events/EndEvent.js +18 -23
  30. package/dist/src/events/IntermediateCatchEvent.js +44 -58
  31. package/dist/src/events/IntermediateThrowEvent.js +18 -23
  32. package/dist/src/events/StartEvent.js +109 -94
  33. package/dist/src/flows/Association.js +94 -100
  34. package/dist/src/flows/MessageFlow.js +86 -103
  35. package/dist/src/flows/SequenceFlow.js +173 -182
  36. package/dist/src/gateways/EventBasedGateway.js +88 -84
  37. package/dist/src/gateways/ExclusiveGateway.js +13 -16
  38. package/dist/src/gateways/InclusiveGateway.js +11 -14
  39. package/dist/src/gateways/ParallelGateway.js +11 -14
  40. package/dist/src/getPropertyValue.js +34 -34
  41. package/dist/src/io/BpmnIO.js +17 -14
  42. package/dist/src/io/EnvironmentDataObject.js +33 -29
  43. package/dist/src/io/EnvironmentDataStore.js +33 -29
  44. package/dist/src/io/EnvironmentDataStoreReference.js +35 -31
  45. package/dist/src/io/InputOutputSpecification.js +177 -168
  46. package/dist/src/io/Properties.js +117 -124
  47. package/dist/src/messageHelper.js +1 -1
  48. package/dist/src/process/Process.js +433 -359
  49. package/dist/src/process/ProcessExecution.js +744 -645
  50. package/dist/src/shared.js +2 -2
  51. package/dist/src/tasks/CallActivity.js +160 -0
  52. package/dist/src/tasks/LoopCharacteristics.js +309 -330
  53. package/dist/src/tasks/ReceiveTask.js +233 -182
  54. package/dist/src/tasks/ScriptTask.js +35 -41
  55. package/dist/src/tasks/ServiceImplementation.js +13 -20
  56. package/dist/src/tasks/ServiceTask.js +82 -75
  57. package/dist/src/tasks/SignalTask.js +97 -93
  58. package/dist/src/tasks/StandardLoopCharacteristics.js +1 -1
  59. package/dist/src/tasks/SubProcess.js +195 -175
  60. package/dist/src/tasks/Task.js +17 -19
  61. package/index.js +2 -0
  62. package/package.json +13 -13
  63. package/src/Api.js +65 -59
  64. package/src/Context.js +138 -141
  65. package/src/Environment.js +88 -100
  66. package/src/EventBroker.js +67 -68
  67. package/src/ExtensionsMapper.js +2 -2
  68. package/src/MessageFormatter.js +132 -74
  69. package/src/activity/Activity.js +915 -775
  70. package/src/activity/ActivityExecution.js +293 -247
  71. package/src/activity/Dummy.js +2 -2
  72. package/src/definition/Definition.js +436 -401
  73. package/src/definition/DefinitionExecution.js +603 -343
  74. package/src/error/Errors.js +11 -6
  75. package/src/eventDefinitions/CancelEventDefinition.js +164 -121
  76. package/src/eventDefinitions/CompensateEventDefinition.js +158 -124
  77. package/src/eventDefinitions/ConditionalEventDefinition.js +147 -104
  78. package/src/eventDefinitions/ErrorEventDefinition.js +190 -131
  79. package/src/eventDefinitions/EscalationEventDefinition.js +139 -101
  80. package/src/eventDefinitions/EventDefinitionExecution.js +127 -95
  81. package/src/eventDefinitions/LinkEventDefinition.js +160 -129
  82. package/src/eventDefinitions/MessageEventDefinition.js +178 -121
  83. package/src/eventDefinitions/SignalEventDefinition.js +162 -106
  84. package/src/eventDefinitions/TerminateEventDefinition.js +19 -19
  85. package/src/eventDefinitions/TimerEventDefinition.js +202 -167
  86. package/src/events/BoundaryEvent.js +156 -115
  87. package/src/events/EndEvent.js +15 -18
  88. package/src/events/IntermediateCatchEvent.js +40 -44
  89. package/src/events/IntermediateThrowEvent.js +15 -18
  90. package/src/events/StartEvent.js +84 -50
  91. package/src/flows/Association.js +98 -112
  92. package/src/flows/MessageFlow.js +81 -97
  93. package/src/flows/SequenceFlow.js +146 -160
  94. package/src/gateways/EventBasedGateway.js +75 -68
  95. package/src/gateways/ExclusiveGateway.js +8 -13
  96. package/src/gateways/InclusiveGateway.js +8 -13
  97. package/src/gateways/ParallelGateway.js +8 -13
  98. package/src/getPropertyValue.js +34 -33
  99. package/src/io/BpmnIO.js +16 -15
  100. package/src/io/EnvironmentDataObject.js +29 -18
  101. package/src/io/EnvironmentDataStore.js +29 -18
  102. package/src/io/EnvironmentDataStoreReference.js +31 -20
  103. package/src/io/InputOutputSpecification.js +154 -157
  104. package/src/io/Properties.js +95 -97
  105. package/src/process/Process.js +374 -333
  106. package/src/process/ProcessExecution.js +606 -554
  107. package/src/tasks/CallActivity.js +130 -0
  108. package/src/tasks/LoopCharacteristics.js +290 -289
  109. package/src/tasks/ReceiveTask.js +174 -107
  110. package/src/tasks/ScriptTask.js +27 -30
  111. package/src/tasks/ServiceImplementation.js +13 -18
  112. package/src/tasks/ServiceTask.js +67 -60
  113. package/src/tasks/SignalTask.js +77 -52
  114. package/src/tasks/StandardLoopCharacteristics.js +1 -1
  115. package/src/tasks/SubProcess.js +184 -157
  116. package/src/tasks/Task.js +15 -19
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ActivityBroker = ActivityBroker;
7
7
  exports.DefinitionBroker = DefinitionBroker;
8
+ exports.EventBroker = EventBroker;
8
9
  exports.MessageFlowBroker = MessageFlowBroker;
9
10
  exports.ProcessBroker = ProcessBroker;
10
- exports.EventBroker = EventBroker;
11
11
 
12
12
  var _smqp = require("smqp");
13
13
 
@@ -27,7 +27,7 @@ function DefinitionBroker(owner, onBrokerReturn) {
27
27
  }
28
28
 
29
29
  function MessageFlowBroker(owner) {
30
- const eventBroker = EventBroker(owner, {
30
+ const eventBroker = new EventBroker(owner, {
31
31
  prefix: 'messageflow',
32
32
  autoDelete: false,
33
33
  durable: false
@@ -46,7 +46,7 @@ function MessageFlowBroker(owner) {
46
46
  }
47
47
 
48
48
  function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
49
- const eventBroker = EventBroker(brokerOwner, {
49
+ const eventBroker = new EventBroker(brokerOwner, {
50
50
  prefix,
51
51
  autoDelete: false,
52
52
  durable: false
@@ -84,104 +84,105 @@ function ExecutionBroker(brokerOwner, prefix, onBrokerReturn) {
84
84
  }
85
85
 
86
86
  function EventBroker(brokerOwner, options, onBrokerReturn) {
87
- const broker = (0, _smqp.Broker)(brokerOwner);
88
- const pfx = options.prefix;
87
+ this.options = options;
88
+ this.eventPrefix = options.prefix;
89
+ const broker = this.broker = (0, _smqp.Broker)(brokerOwner);
89
90
  broker.assertExchange('event', 'topic', options);
90
- broker.on('return', onBrokerReturn || onBrokerReturnFn);
91
- return {
92
- eventPrefix: pfx,
93
- broker,
94
- on,
95
- once,
96
- waitFor,
97
- emit,
98
- emitFatal
99
- };
100
-
101
- function on(eventName, callback, eventOptions = {
102
- once: false
103
- }) {
104
- const key = getEventRoutingKey(eventName);
105
- if (eventOptions.once) return broker.subscribeOnce('event', key, eventCallback, eventOptions);
106
- return broker.subscribeTmp('event', key, eventCallback, { ...eventOptions,
107
- noAck: true
108
- });
91
+ broker.on('return', onBrokerReturn ? onBrokerReturn.bind(brokerOwner) : this._onBrokerReturnFn.bind(this));
92
+ this.on = this.on.bind(this);
93
+ this.once = this.once.bind(this);
94
+ this.waitFor = this.waitFor.bind(this);
95
+ this.emit = this.emit.bind(this);
96
+ this.emitFatal = this.emitFatal.bind(this);
97
+ }
109
98
 
110
- function eventCallback(routingKey, message, owner) {
111
- if (eventName === 'error') return callback((0, _Errors.makeErrorFromMessage)(message));
112
- callback(owner.getApi(message));
113
- }
114
- }
99
+ EventBroker.prototype.on = function on(eventName, callback, eventOptions = {
100
+ once: false
101
+ }) {
102
+ const key = this._getEventRoutingKey(eventName);
103
+
104
+ if (eventOptions.once) return this.broker.subscribeOnce('event', key, eventCallback, eventOptions);
105
+ return this.broker.subscribeTmp('event', key, eventCallback, { ...eventOptions,
106
+ noAck: true
107
+ });
115
108
 
116
- function once(eventName, callback, eventOptions = {}) {
117
- return on(eventName, callback, { ...eventOptions,
118
- once: true
119
- });
109
+ function eventCallback(routingKey, message, owner) {
110
+ if (eventName === 'error') return callback((0, _Errors.makeErrorFromMessage)(message));
111
+ callback(owner.getApi(message));
120
112
  }
113
+ };
121
114
 
122
- function waitFor(eventName, onMessage) {
123
- const key = getEventRoutingKey(eventName);
124
- return new Promise((resolve, reject) => {
125
- const consumers = [broker.subscribeTmp('event', key, eventCallback, {
126
- noAck: true
127
- }), broker.subscribeTmp('event', '*.error', errorCallback, {
128
- noAck: true
129
- })];
130
-
131
- function eventCallback(routingKey, message, owner) {
132
- if (onMessage && !onMessage(routingKey, message, owner)) return;
133
- unsubscribe();
134
- return resolve(owner.getApi(message));
135
- }
115
+ EventBroker.prototype.once = function once(eventName, callback, eventOptions = {}) {
116
+ return this.on(eventName, callback, { ...eventOptions,
117
+ once: true
118
+ });
119
+ };
136
120
 
137
- function errorCallback(routingKey, message, owner) {
138
- if (!message.properties.mandatory) return;
139
- unsubscribe();
140
- return reject((0, _Errors.makeErrorFromMessage)(message, owner));
141
- }
121
+ EventBroker.prototype.waitFor = function waitFor(eventName, onMessage) {
122
+ const key = this._getEventRoutingKey(eventName);
142
123
 
143
- function unsubscribe() {
144
- consumers.forEach(consumer => consumer.cancel());
145
- }
146
- });
147
- }
124
+ return new Promise((resolve, reject) => {
125
+ const consumers = [this.broker.subscribeTmp('event', key, eventCallback, {
126
+ noAck: true
127
+ }), this.broker.subscribeTmp('event', '*.error', errorCallback, {
128
+ noAck: true
129
+ })];
148
130
 
149
- function onBrokerReturnFn(message) {
150
- if (message.properties.type === 'error') {
151
- const err = (0, _Errors.makeErrorFromMessage)(message);
152
- throw err;
131
+ function eventCallback(routingKey, message, owner) {
132
+ if (onMessage && !onMessage(routingKey, message, owner)) return;
133
+ unsubscribe();
134
+ return resolve(owner.getApi(message));
153
135
  }
154
- }
155
136
 
156
- function getEventRoutingKey(eventName) {
157
- if (eventName.indexOf('.') > -1) return eventName;
158
-
159
- switch (eventName) {
160
- case 'wait':
161
- {
162
- return `activity.${eventName}`;
163
- }
137
+ function errorCallback(routingKey, message, owner) {
138
+ if (!message.properties.mandatory) return;
139
+ unsubscribe();
140
+ return reject((0, _Errors.makeErrorFromMessage)(message, owner));
141
+ }
164
142
 
165
- default:
166
- {
167
- return `${pfx}.${eventName}`;
168
- }
143
+ function unsubscribe() {
144
+ for (const consumer of consumers) {
145
+ consumer.cancel();
146
+ }
169
147
  }
170
- }
148
+ });
149
+ };
171
150
 
172
- function emit(eventName, content = {}, props = {}) {
173
- broker.publish('event', `${pfx}.${eventName}`, { ...content
174
- }, {
175
- type: eventName,
176
- ...props
177
- });
151
+ EventBroker.prototype.emit = function emit(eventName, content, props) {
152
+ this.broker.publish('event', `${this.eventPrefix}.${eventName}`, { ...content
153
+ }, {
154
+ type: eventName,
155
+ ...props
156
+ });
157
+ };
158
+
159
+ EventBroker.prototype.emitFatal = function emitFatal(error, content) {
160
+ this.emit('error', { ...content,
161
+ error
162
+ }, {
163
+ mandatory: true
164
+ });
165
+ };
166
+
167
+ EventBroker.prototype._onBrokerReturnFn = function onBrokerReturnFn(message) {
168
+ if (message.properties.type === 'error') {
169
+ const err = (0, _Errors.makeErrorFromMessage)(message);
170
+ throw err;
178
171
  }
172
+ };
173
+
174
+ EventBroker.prototype._getEventRoutingKey = function getEventRoutingKey(eventName) {
175
+ if (eventName.indexOf('.') > -1) return eventName;
179
176
 
180
- function emitFatal(error, content = {}) {
181
- emit('error', { ...content,
182
- error
183
- }, {
184
- mandatory: true
185
- });
177
+ switch (eventName) {
178
+ case 'wait':
179
+ {
180
+ return `activity.${eventName}`;
181
+ }
182
+
183
+ default:
184
+ {
185
+ return `${this.eventPrefix}.${eventName}`;
186
+ }
186
187
  }
187
- }
188
+ };
@@ -28,11 +28,11 @@ function ExtensionsMapper(context) {
28
28
  }
29
29
 
30
30
  function activate(message) {
31
- activityExtensions.forEach(extension => extension.activate(message));
31
+ for (const extension of activityExtensions) extension.activate(message);
32
32
  }
33
33
 
34
34
  function deactivate(message) {
35
- activityExtensions.forEach(extension => extension.deactivate(message));
35
+ for (const extension of activityExtensions) extension.deactivate(message);
36
36
  }
37
37
  }
38
38
 
@@ -13,114 +13,183 @@ var _Errors = require("./error/Errors");
13
13
 
14
14
  var _smqp = require("smqp");
15
15
 
16
+ const onMessageSymbol = Symbol.for('onMessage');
17
+ const executionSymbol = Symbol.for('execution');
18
+
16
19
  function Formatter(element, formatQ) {
17
20
  const {
18
21
  id,
19
22
  broker,
20
23
  logger
21
24
  } = element;
22
- return function formatRunMessage(runMessage, callback) {
23
- const startFormatMsg = formatQ.get();
24
- if (!startFormatMsg) return callback(null, runMessage.content, false);
25
- const pendingFormats = [];
26
- const {
27
- fields,
28
- content
29
- } = runMessage;
30
- const fundamentals = {
31
- id: content.id,
32
- type: content.type,
33
- parent: (0, _messageHelper.cloneParent)(content.parent),
34
- attachedTo: content.attachedTo,
35
- executionId: content.executionId,
36
- isSubProcess: content.isSubProcess,
37
- isMultiInstance: content.isMultiInstance
38
- };
39
-
40
- if (content.inbound) {
41
- fundamentals.inbound = content.inbound.slice();
42
- }
43
-
44
- if (content.outbound) {
45
- fundamentals.outbound = content.outbound.slice();
46
- }
25
+ this.id = id;
26
+ this.broker = broker;
27
+ this.logger = logger;
28
+ this.formatQ = formatQ;
29
+ this.pendingFormats = [];
30
+ this[onMessageSymbol] = this._onMessage.bind(this);
31
+ }
32
+
33
+ Formatter.prototype.format = function format(message, callback) {
34
+ const correlationId = this._runId = (0, _shared.getUniqueId)(message.fields.routingKey);
35
+ const consumerTag = '_formatter-' + correlationId;
36
+ const formatQ = this.formatQ;
37
+ formatQ.queueMessage({
38
+ routingKey: '_formatting.exec'
39
+ }, {}, {
40
+ correlationId,
41
+ persistent: false
42
+ });
43
+ this[executionSymbol] = {
44
+ correlationId,
45
+ formatKey: message.fields.routingKey,
46
+ runMessage: (0, _messageHelper.cloneMessage)(message),
47
+ callback,
48
+ pending: [],
49
+ formatted: false,
50
+ executeMessage: null
51
+ };
52
+ formatQ.consume(this[onMessageSymbol], {
53
+ consumerTag,
54
+ prefetch: 100
55
+ });
56
+ };
47
57
 
48
- let formattingError;
49
- let formattedContent = (0, _messageHelper.cloneContent)(content);
50
- const depleted = formatQ.on('depleted', () => {
51
- if (pendingFormats.length) return;
52
- depleted.cancel();
53
- logger.debug(`<${id}> completed formatting ${fields.routingKey}`);
54
- broker.cancel('_format-consumer');
55
- if (formattingError) return callback(formattingError);
56
- return callback(null, (0, _shared.filterUndefined)(formattedContent), true);
57
- });
58
- startFormatMsg.nack(false, true);
59
- formatQ.assertConsumer(onFormatMessage, {
60
- consumerTag: '_format-consumer',
61
- prefetch: 100
62
- });
63
-
64
- function onFormatMessage(routingKey, message) {
65
- const {
66
- endRoutingKey,
67
- error
68
- } = message.content || {};
69
-
70
- if (endRoutingKey) {
71
- pendingFormats.push(message);
72
- return logger.debug(`<${id}> start formatting ${fields.routingKey} message content with formatter ${routingKey}`);
58
+ Formatter.prototype._onMessage = function onMessage(routingKey, message) {
59
+ const {
60
+ formatKey,
61
+ correlationId,
62
+ pending,
63
+ executeMessage
64
+ } = this[executionSymbol];
65
+ const asyncFormatting = pending.length;
66
+
67
+ switch (routingKey) {
68
+ case '_formatting.exec':
69
+ if (message.properties.correlationId !== correlationId) return message.ack();
70
+
71
+ if (!asyncFormatting) {
72
+ message.ack();
73
+ return this._complete(message);
73
74
  }
74
75
 
75
- const {
76
- isError,
77
- message: formatStart
78
- } = popFormattingStart(routingKey);
79
- logger.debug(`<${id}> format ${fields.routingKey} message content with formatter ${routingKey}`);
80
- formattedContent = { ...formattedContent,
81
- ...message.content,
82
- ...fundamentals
83
- };
84
- message.ack();
85
-
86
- if (formatStart) {
87
- if (isError) {
88
- const errMessage = error && error.message || 'formatting failed';
89
- logger.debug(`<${id}> formatting of ${fields.routingKey} failed with ${routingKey}: ${errMessage}`);
90
- formattingError = new _Errors.ActivityError(errMessage, (0, _messageHelper.cloneMessage)(runMessage, formattedContent), error);
91
- pendingFormats.splice(0).forEach(({
92
- nack
93
- }) => nack(false, false));
76
+ this[executionSymbol].executeMessage = message;
77
+ break;
78
+
79
+ default:
80
+ {
81
+ message.ack();
82
+ const endRoutingKey = message.content && message.content.endRoutingKey;
83
+
84
+ if (endRoutingKey) {
85
+ this._decorate(message.content);
86
+
87
+ pending.push(message);
88
+ return this._debug(`start formatting ${formatKey} message content with formatter ${routingKey}`);
94
89
  }
95
90
 
96
- formatStart.ack(isError);
97
- }
98
- }
91
+ if (asyncFormatting) {
92
+ const {
93
+ isError,
94
+ message: startMessage
95
+ } = this._popFormatStart(pending, routingKey);
96
+
97
+ if (startMessage) startMessage.ack();
98
+
99
+ if (isError) {
100
+ return this._complete(message, true);
101
+ }
102
+ }
103
+
104
+ this._decorate(message.content);
99
105
 
100
- function popFormattingStart(routingKey) {
101
- for (let i = 0; i < pendingFormats.length; i++) {
102
- const pendingFormat = pendingFormats[i];
103
- const {
104
- endRoutingKey,
105
- errorRoutingKey = '#.error'
106
- } = pendingFormat.content;
107
-
108
- if ((0, _smqp.getRoutingKeyPattern)(endRoutingKey).test(routingKey)) {
109
- logger.debug(`<${id}> completed formatting ${fields.routingKey} message content with formatter ${routingKey}`);
110
- pendingFormats.splice(i, 1);
111
- return {
112
- message: pendingFormat
113
- };
114
- } else if ((0, _smqp.getRoutingKeyPattern)(errorRoutingKey).test(routingKey)) {
115
- pendingFormats.splice(i, 1);
116
- return {
117
- isError: true,
118
- message: pendingFormat
119
- };
106
+ this._debug(`format ${message.fields.routingKey} message content with formatter ${routingKey}`);
107
+
108
+ if (executeMessage && asyncFormatting && !pending.length) {
109
+ this._complete(message);
120
110
  }
121
111
  }
112
+ }
113
+ };
122
114
 
123
- return {};
115
+ Formatter.prototype._complete = function complete(message, isError) {
116
+ const {
117
+ runMessage,
118
+ formatKey,
119
+ callback,
120
+ formatted,
121
+ executeMessage
122
+ } = this[executionSymbol];
123
+ this[executionSymbol] = null;
124
+ if (executeMessage) executeMessage.ack();
125
+ this.broker.cancel(message.fields.consumerTag);
126
+
127
+ if (isError) {
128
+ const error = message.content && message.content.error || new Error('formatting failed');
129
+ const errMessage = error.message || 'formatting failed';
130
+
131
+ this._debug(`formatting of ${formatKey} failed with ${message.fields.routingKey}: ${errMessage}`);
132
+
133
+ return callback(new _Errors.ActivityError(errMessage, (0, _messageHelper.cloneMessage)(runMessage), error));
134
+ }
135
+
136
+ return callback(null, runMessage.content, formatted);
137
+ };
138
+
139
+ Formatter.prototype._decorate = function decorate(withContent) {
140
+ const content = this[executionSymbol].runMessage.content;
141
+
142
+ for (const key in withContent) {
143
+ switch (key) {
144
+ case 'id':
145
+ case 'type':
146
+ case 'parent':
147
+ case 'attachedTo':
148
+ case 'executionId':
149
+ case 'isSubProcess':
150
+ case 'isMultiInstance':
151
+ case 'inbound':
152
+ case 'outbound':
153
+ case 'endRoutingKey':
154
+ case 'errorRoutingKey':
155
+ break;
156
+
157
+ default:
158
+ {
159
+ content[key] = withContent[key];
160
+ this[executionSymbol].formatted = true;
161
+ }
124
162
  }
125
- };
126
- }
163
+ }
164
+ };
165
+
166
+ Formatter.prototype._popFormatStart = function popFormattingStart(pending, routingKey) {
167
+ for (let idx = 0; idx < pending.length; idx++) {
168
+ const msg = pending[idx];
169
+ const {
170
+ endRoutingKey,
171
+ errorRoutingKey = '#.error'
172
+ } = msg.content;
173
+
174
+ if (endRoutingKey && (0, _smqp.getRoutingKeyPattern)(endRoutingKey).test(routingKey)) {
175
+ this._debug(`completed formatting ${msg.fields.routingKey} message content with formatter ${routingKey}`);
176
+
177
+ pending.splice(idx, 1);
178
+ return {
179
+ message: msg
180
+ };
181
+ } else if ((0, _smqp.getRoutingKeyPattern)(errorRoutingKey).test(routingKey)) {
182
+ pending.splice(idx, 1);
183
+ return {
184
+ isError: true,
185
+ message: msg
186
+ };
187
+ }
188
+ }
189
+
190
+ return {};
191
+ };
192
+
193
+ Formatter.prototype._debug = function debug(msg) {
194
+ this.logger.debug(`<${this.id}> ${msg}`);
195
+ };
@@ -11,7 +11,11 @@ function Scripts() {
11
11
  register
12
12
  };
13
13
 
14
- function getScript() {}
14
+ function
15
+ /*scriptType, activity*/
16
+ getScript() {}
15
17
 
16
- function register() {}
18
+ function
19
+ /*activity*/
20
+ register() {}
17
21
  }