@izara_project/izara-core-library-asynchronous-flow 1.0.48 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,20 @@
1
1
  # izara-core-library-asynchronous-flow
2
2
 
3
3
  # update version
4
+
4
5
  - commit code first
5
- npm version patch || npm version minor || npm version major
6
+ npm version patch || npm version minor || npm version major
6
7
 
7
8
  # can also push to repo ..
9
+
8
10
  git push
11
+
9
12
  # make sure commits look correct
10
13
 
11
14
  # push to npm
15
+
12
16
  npm publish
13
17
 
14
18
  # update project that uses this package
15
- npm update @izara_project/izara-core-library-asynchronous-flow
19
+
20
+ npm update @izara_project/izara-core-library-asynchronous-flow
package/index.js CHANGED
@@ -15,12 +15,12 @@ You should have received a copy of the GNU Affero General Public License
15
15
  along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
- import * as asyncFlowSharedLib from './src/asyncFlowSharedLib.js';
19
- import * as awaitingStep from './src/awaitingStep.js';
20
- import * as awaitingMultipleSteps from './src/awaitingMultipleSteps.js';
18
+ import * as asyncFlowSharedLib from "./src/asyncFlowSharedLib.js";
19
+ import * as awaitingStep from "./src/awaitingStep.js";
20
+ import * as awaitingMultipleSteps from "./src/awaitingMultipleSteps.js";
21
21
 
22
22
  export default {
23
23
  ...asyncFlowSharedLib,
24
24
  ...awaitingStep,
25
- ...awaitingMultipleSteps
25
+ ...awaitingMultipleSteps,
26
26
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Sven Mason <thebarbariansven@gmail.com>",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-asynchronous-flow#readme",
6
- "version": "1.0.48",
6
+ "version": "1.0.50",
7
7
  "description": "Shared asynchronous flow logic",
8
8
  "type": "module",
9
9
  "main": "index.js",
@@ -16,17 +16,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  // Core libraries
19
- import { NoRetryError } from '@izara_project/izara-core-library-core';
20
- import Logger from '@izara_project/izara-core-library-logger';
19
+ import { NoRetryError } from "@izara_project/izara-core-library-core";
20
+ import Logger from "@izara_project/izara-core-library-logger";
21
21
 
22
22
  // Data and service interaction libraries
23
- import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
24
- import sqsSharedLib from '@izara_project/izara-core-library-sqs';
23
+ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
24
+ import sqsSharedLib from "@izara_project/izara-core-library-sqs";
25
25
 
26
26
  // External service interactions
27
- import { sqs } from '@izara_project/izara-core-library-external-request';
27
+ import { sqs } from "@izara_project/izara-core-library-external-request";
28
28
 
29
- import { identifierUuid } from '@izara_project/izara-shared-core';
29
+ import { identifierUuid } from "@izara_project/izara-shared-core";
30
30
 
31
31
  /**
32
32
  * Helper to safely join a prefix and an ID with a single underscore.
@@ -35,18 +35,18 @@ import { identifierUuid } from '@izara_project/izara-shared-core';
35
35
  * @param {string} [prefix='']
36
36
  * @returns {string}
37
37
  */
38
- function _joinPrefixAndId(id, prefix = '') {
38
+ function _joinPrefixAndId(id, prefix = "") {
39
39
  if (!prefix) {
40
40
  return id;
41
41
  }
42
42
 
43
43
  let cleanPrefix = prefix;
44
- if (prefix.endsWith('_')) {
44
+ if (prefix.endsWith("_")) {
45
45
  cleanPrefix = prefix.slice(0, -1);
46
46
  }
47
47
 
48
48
  let cleanId = id;
49
- if (id.startsWith('_')) {
49
+ if (id.startsWith("_")) {
50
50
  cleanId = id.slice(1);
51
51
  }
52
52
 
@@ -59,7 +59,7 @@ function _joinPrefixAndId(id, prefix = '') {
59
59
  * @param {string} [prefix='']
60
60
  * @returns {string}
61
61
  */
62
- function createAwaitingStepId(partitionKey, prefix = '') {
62
+ function createAwaitingStepId(partitionKey, prefix = "") {
63
63
  return _joinPrefixAndId(partitionKey, prefix);
64
64
  }
65
65
 
@@ -69,7 +69,7 @@ function createAwaitingStepId(partitionKey, prefix = '') {
69
69
  * @param {string} [prefix='']
70
70
  * @returns {string}
71
71
  */
72
- function createPendingStepId(identifierId, prefix = '') {
72
+ function createPendingStepId(identifierId, prefix = "") {
73
73
  return _joinPrefixAndId(identifierId, prefix);
74
74
  }
75
75
 
@@ -81,7 +81,7 @@ function createPendingStepId(identifierId, prefix = '') {
81
81
  */
82
82
  function createFieldNameUniqueRequestId(
83
83
  prefix,
84
- uniqueRequestIdFieldName = 'UniqueRequestId'
84
+ uniqueRequestIdFieldName = "UniqueRequestId",
85
85
  ) {
86
86
  return prefix + uniqueRequestIdFieldName;
87
87
  }
@@ -93,8 +93,8 @@ function createFieldNameUniqueRequestId(
93
93
  * @param {string} [prefix=""]
94
94
  * @returns {string}
95
95
  */
96
- function createConcatenatedAwaitingStepId(partitionKey, sortId, prefix = '') {
97
- return prefix + partitionKey + '_' + sortId;
96
+ function createConcatenatedAwaitingStepId(partitionKey, sortId, prefix = "") {
97
+ return prefix + partitionKey + "_" + sortId;
98
98
  }
99
99
 
100
100
  /**
@@ -104,7 +104,7 @@ function createConcatenatedAwaitingStepId(partitionKey, sortId, prefix = '') {
104
104
  * @returns {string}
105
105
  */
106
106
  function createConcatenatedPendingStepId(parentId, childId) {
107
- return parentId + '_' + childId;
107
+ return parentId + "_" + childId;
108
108
  }
109
109
 
110
110
  /**
@@ -113,7 +113,7 @@ function createConcatenatedPendingStepId(parentId, childId) {
113
113
  * @param {string} [prefix=''] - The prefix to prepend to the parent Ids.
114
114
  * @returns {string} The parent Flow Id created.
115
115
  */
116
- function createParentFlowId(prefix = '') {
116
+ function createParentFlowId(prefix = "") {
117
117
  return _joinPrefixAndId(identifierUuid(), prefix);
118
118
  }
119
119
 
@@ -124,9 +124,9 @@ function createParentFlowId(prefix = '') {
124
124
  * @returns {string}
125
125
  * @throws {NoRetryError} If stripped value equals prefix (invalid)
126
126
  */
127
- function explodePendingStepId(pendingStepId, prefix = '') {
127
+ function explodePendingStepId(pendingStepId, prefix = "") {
128
128
  if (!pendingStepId) {
129
- throw new NoRetryError('pendingStepId is required');
129
+ throw new NoRetryError("pendingStepId is required");
130
130
  }
131
131
  if (!prefix) {
132
132
  return pendingStepId;
@@ -134,10 +134,10 @@ function explodePendingStepId(pendingStepId, prefix = '') {
134
134
 
135
135
  const identifierId = pendingStepId.slice(prefix.length + 1);
136
136
  if (identifierId === prefix) {
137
- throw new NoRetryError('IdentifierId should not be like prefix.');
137
+ throw new NoRetryError("IdentifierId should not be like prefix.");
138
138
  }
139
139
 
140
- Logger.debug('return explode:', { identifierId });
140
+ Logger.debug("return explode:", { identifierId });
141
141
  return identifierId;
142
142
  }
143
143
 
@@ -177,29 +177,29 @@ async function checkUniqueRequestProcessing(
177
177
  _izContext,
178
178
  tableName,
179
179
  primaryKey,
180
- prefix = '',
180
+ prefix = "",
181
181
  overwriteUniqueRequestId = null,
182
- uniqueRequestIdFieldName = 'UniqueRequestId' // if set will check/add this fieldname with _izContext.uniqueRequestId value
182
+ uniqueRequestIdFieldName = "UniqueRequestId", // if set will check/add this fieldname with _izContext.uniqueRequestId value
183
183
  ) {
184
184
  _izContext.logger.debug(
185
- '[Lib:AsyncFlow:checkUniqueRequestProcessing] Input:',
185
+ "[Lib:AsyncFlow:checkUniqueRequestProcessing] Input:",
186
186
  {
187
187
  _izContext,
188
188
  tableName,
189
189
  primaryKey,
190
190
  prefix,
191
191
  overwriteUniqueRequestId,
192
- uniqueRequestIdFieldName
193
- }
192
+ uniqueRequestIdFieldName,
193
+ },
194
194
  );
195
195
 
196
196
  if (!tableName || !primaryKey) {
197
- throw new NoRetryError('tableName and primaryKey are required');
197
+ throw new NoRetryError("tableName and primaryKey are required");
198
198
  }
199
199
 
200
200
  try {
201
- _izContext.logger.debug('[Lib:checkUniqueRequestProcessing] reqId', {
202
- uniqueRequestId: _izContext.uniqueRequestId
201
+ _izContext.logger.debug("[Lib:checkUniqueRequestProcessing] reqId", {
202
+ uniqueRequestId: _izContext.uniqueRequestId,
203
203
  });
204
204
 
205
205
  let uniqueRequestId = overwriteUniqueRequestId;
@@ -209,26 +209,26 @@ async function checkUniqueRequestProcessing(
209
209
 
210
210
  uniqueRequestIdFieldName = createFieldNameUniqueRequestId(
211
211
  prefix,
212
- uniqueRequestIdFieldName
212
+ uniqueRequestIdFieldName,
213
213
  );
214
214
 
215
215
  for (let i = 0; i < 2; i++) {
216
216
  const existingRecord = await dynamodbSharedLib.getItem(
217
217
  _izContext,
218
218
  dynamodbSharedLib.tableName(_izContext, tableName),
219
- primaryKey
219
+ primaryKey,
220
220
  );
221
221
 
222
222
  if (!existingRecord) {
223
- return ['recordNotFound', {}];
223
+ return ["recordNotFound", {}];
224
224
  }
225
225
 
226
226
  const currentReqId = existingRecord[uniqueRequestIdFieldName];
227
227
  if (currentReqId === uniqueRequestId) {
228
- return ['process', existingRecord];
228
+ return ["process", existingRecord];
229
229
  }
230
230
  if (currentReqId) {
231
- return ['stop', existingRecord];
231
+ return ["stop", existingRecord];
232
232
  }
233
233
 
234
234
  try {
@@ -239,25 +239,25 @@ async function checkUniqueRequestProcessing(
239
239
  [
240
240
  {
241
241
  attributeName: uniqueRequestIdFieldName,
242
- action: 'set',
243
- value: _izContext.uniqueRequestId
244
- }
242
+ action: "set",
243
+ value: _izContext.uniqueRequestId,
244
+ },
245
245
  ],
246
246
  {
247
247
  logicalElements: [
248
248
  {
249
- type: 'function',
250
- function: 'attribute_not_exists',
251
- attribute: uniqueRequestIdFieldName
252
- }
249
+ type: "function",
250
+ function: "attribute_not_exists",
251
+ attribute: uniqueRequestIdFieldName,
252
+ },
253
253
  ],
254
- returnValues: 'ALL_NEW'
254
+ returnValues: "ALL_NEW",
255
255
  },
256
- { complexAttributes: true }
256
+ { complexAttributes: true },
257
257
  );
258
- return ['process', updateRecord];
258
+ return ["process", updateRecord];
259
259
  } catch (err) {
260
- if (err.name === 'ConditionalCheckFailedException') {
260
+ if (err.name === "ConditionalCheckFailedException") {
261
261
  continue;
262
262
  }
263
263
  throw err;
@@ -266,13 +266,12 @@ async function checkUniqueRequestProcessing(
266
266
 
267
267
  throw new NoRetryError(
268
268
  `unable to set uniqueRequestId in table ${tableName}`,
269
- { primaryKey }
269
+ { primaryKey },
270
270
  );
271
271
  } catch (err) {
272
- _izContext.logger.error(
273
- '[Lib:checkUniqueRequestProcessing] Error',
274
- { err }
275
- );
272
+ _izContext.logger.error("[Lib:checkUniqueRequestProcessing] Error", {
273
+ err,
274
+ });
276
275
  throw err;
277
276
  }
278
277
  }
@@ -294,31 +293,30 @@ async function checkTimeCacheComplete(
294
293
  fullMainTableName,
295
294
  keyValues,
296
295
  timeCacheComplete,
297
- prefix
296
+ prefix,
298
297
  ) {
299
- _izContext.logger.debug('[Lib:AsyncFlow:checkTimeCacheComplete] Input:', {
298
+ _izContext.logger.debug("[Lib:AsyncFlow:checkTimeCacheComplete] Input:", {
300
299
  _izContext,
301
300
  fullMainTableName,
302
301
  keyValues,
303
302
  timeCacheComplete,
304
- prefix
303
+ prefix,
305
304
  });
306
305
 
307
306
  if (!fullMainTableName || !keyValues || !timeCacheComplete || !prefix) {
308
307
  throw new NoRetryError(
309
- 'fullMainTableName, keyValues, timeCacheComplete' +
310
- ' and prefix are required'
308
+ "fullMainTableName, keyValues, timeCacheComplete" +
309
+ " and prefix are required",
311
310
  );
312
311
  }
313
312
 
314
- const [returnValue, , uniqueRequestId] =
315
- await checkAndGetTimeCacheComplete(
316
- _izContext,
317
- fullMainTableName,
318
- keyValues,
319
- timeCacheComplete,
320
- prefix
321
- );
313
+ const [returnValue, , uniqueRequestId] = await checkAndGetTimeCacheComplete(
314
+ _izContext,
315
+ fullMainTableName,
316
+ keyValues,
317
+ timeCacheComplete,
318
+ prefix,
319
+ );
322
320
  return [returnValue, uniqueRequestId];
323
321
  }
324
322
 
@@ -340,34 +338,34 @@ async function checkAndGetTimeCacheComplete(
340
338
  fullMainTableName,
341
339
  keyValues,
342
340
  timeCacheComplete,
343
- prefix
341
+ prefix,
344
342
  ) {
345
343
  _izContext.logger.debug(
346
- '[Lib:AsyncFlow:checkAndGetTimeCacheComplete] Input:',
344
+ "[Lib:AsyncFlow:checkAndGetTimeCacheComplete] Input:",
347
345
  {
348
346
  fullMainTableName,
349
347
  keyValues,
350
348
  timeCacheComplete,
351
- prefix
352
- }
349
+ prefix,
350
+ },
353
351
  );
354
352
 
355
- const uniqueRequestIdFieldName = createFieldNameUniqueRequestId('cache');
356
- const cacheCompleteFieldName = prefix + 'CacheComplete';
353
+ const uniqueRequestIdFieldName = createFieldNameUniqueRequestId("cache");
354
+ const cacheCompleteFieldName = prefix + "CacheComplete";
357
355
 
358
356
  const getTimeCacheComplete = await dynamodbSharedLib.getItem(
359
357
  _izContext,
360
358
  fullMainTableName,
361
- keyValues
359
+ keyValues,
362
360
  );
363
361
  _izContext.logger.debug(
364
362
  `[Lib:checkAndGetTimeCacheComplete] ${fullMainTableName}`,
365
- { getTimeCacheComplete }
363
+ { getTimeCacheComplete },
366
364
  );
367
365
 
368
366
  if (!getTimeCacheComplete) {
369
367
  throw new NoRetryError(
370
- `cannot getTimeCacheComplete from ${fullMainTableName}`
368
+ `cannot getTimeCacheComplete from ${fullMainTableName}`,
371
369
  );
372
370
  }
373
371
 
@@ -393,7 +391,7 @@ async function checkAndGetTimeCacheComplete(
393
391
  return [
394
392
  true,
395
393
  getTimeCacheComplete[cacheCompleteFieldName],
396
- getTimeCacheComplete[uniqueRequestIdFieldName]
394
+ getTimeCacheComplete[uniqueRequestIdFieldName],
397
395
  ];
398
396
  }
399
397
 
@@ -413,20 +411,18 @@ async function checkCacheUniqueRequestId(
413
411
  fullMainTableName,
414
412
  keyValues,
415
413
  checkUniqueRequestId,
416
- uniqueRequestIdCompleteFieldName
414
+ uniqueRequestIdCompleteFieldName,
417
415
  ) {
418
416
  const cacheObject = await dynamodbSharedLib.getItem(
419
417
  _izContext,
420
418
  fullMainTableName,
421
- keyValues
419
+ keyValues,
422
420
  );
423
- _izContext.logger.debug('[Lib:checkCacheUniqueRequestId] Output', {
424
- cacheObject
421
+ _izContext.logger.debug("[Lib:checkCacheUniqueRequestId] Output", {
422
+ cacheObject,
425
423
  });
426
424
 
427
- return (
428
- cacheObject[uniqueRequestIdCompleteFieldName] === checkUniqueRequestId
429
- );
425
+ return cacheObject[uniqueRequestIdCompleteFieldName] === checkUniqueRequestId;
430
426
  }
431
427
 
432
428
  //====================================== end Multiple Lambda Invocations (Logic pagination of handling results)
@@ -446,12 +442,12 @@ function validateStartKeyParam(
446
442
  _izContext,
447
443
  startKey,
448
444
  partitionKeyFieldName,
449
- sortKeyFieldName
445
+ sortKeyFieldName,
450
446
  ) {
451
- _izContext.logger.debug('[Lib:AsyncFlow:validateStartKeyParam] Input:', {
447
+ _izContext.logger.debug("[Lib:AsyncFlow:validateStartKeyParam] Input:", {
452
448
  startKey,
453
449
  partitionKeyFieldName,
454
- sortKeyFieldName
450
+ sortKeyFieldName,
455
451
  });
456
452
 
457
453
  const stringNotEmptyRegex = /^[A-Za-z0-9_-]+$/;
@@ -463,16 +459,16 @@ function validateStartKeyParam(
463
459
  !stringNotEmptyRegex.test(sortKeyFieldName)
464
460
  ) {
465
461
  throw new NoRetryError(
466
- 'validateStartKeyParam:' +
467
- ' Invalid partitionKeyFieldName or sortKeyFieldName'
462
+ "validateStartKeyParam:" +
463
+ " Invalid partitionKeyFieldName or sortKeyFieldName",
468
464
  );
469
465
  }
470
466
 
471
467
  if (startKey && Object.keys(startKey).length !== 0) {
472
468
  if (!startKey[partitionKeyFieldName] || !startKey[sortKeyFieldName]) {
473
469
  throw new NoRetryError(
474
- 'validateStartKeyParam: Invalid startKey,' +
475
- ' missing partitionKeyFieldName or sortKeyFieldName'
470
+ "validateStartKeyParam: Invalid startKey," +
471
+ " missing partitionKeyFieldName or sortKeyFieldName",
476
472
  );
477
473
  }
478
474
  return startKey;
@@ -499,48 +495,45 @@ async function validateMultipleInvocations(
499
495
  messageProperty,
500
496
  passOnStartKey = {},
501
497
  numberInvocation,
502
- queueName
498
+ queueName,
503
499
  ) {
504
500
  _izContext.logger.debug(
505
- '[Lib:AsyncFlow:validateMultipleInvocations] Input:',
501
+ "[Lib:AsyncFlow:validateMultipleInvocations] Input:",
506
502
  {
507
503
  messageProperty,
508
504
  passOnStartKey,
509
505
  numberInvocation,
510
- queueName
511
- }
506
+ queueName,
507
+ },
512
508
  );
513
509
 
514
510
  try {
515
511
  const maxProcessInvocationCountImport = 20;
516
512
  if (numberInvocation >= maxProcessInvocationCountImport) {
517
513
  _izContext.logger.error(
518
- 'numberInvocation exceeds maxProcessInvocationCountImport limit'
514
+ "numberInvocation exceeds maxProcessInvocationCountImport limit",
519
515
  );
520
516
  throw new NoRetryError(
521
- 'numberInvocation exceeds maxProcessInvocationCountImport limit'
517
+ "numberInvocation exceeds maxProcessInvocationCountImport limit",
522
518
  );
523
519
  }
524
520
 
525
521
  if (passOnStartKey) {
526
- messageProperty['startKey'] = passOnStartKey;
522
+ messageProperty["startKey"] = passOnStartKey;
527
523
  }
528
- messageProperty['numberInvocation'] = numberInvocation;
524
+ messageProperty["numberInvocation"] = numberInvocation;
529
525
 
530
526
  const messageReInvokeFunction = {
531
527
  MessageBody: JSON.stringify(messageProperty),
532
- QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, queueName)
528
+ QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, queueName),
533
529
  };
534
530
  _izContext.logger.debug(
535
531
  `[Lib:validateMultipleInvocations] Send message to Dsq:${queueName}`,
536
- { messageReInvokeFunction }
532
+ { messageReInvokeFunction },
537
533
  );
538
534
  await sqs.sendMessage(_izContext, messageReInvokeFunction);
539
535
  } catch (err) {
540
- _izContext.logger.error(
541
- '[Lib:validateMultipleInvocations] Error',
542
- { err }
543
- );
536
+ _izContext.logger.error("[Lib:validateMultipleInvocations] Error", { err });
544
537
  throw err;
545
538
  }
546
539
  }
@@ -558,5 +551,5 @@ export {
558
551
  checkAndGetTimeCacheComplete,
559
552
  checkCacheUniqueRequestId,
560
553
  validateStartKeyParam,
561
- validateMultipleInvocations
554
+ validateMultipleInvocations,
562
555
  };
@@ -14,20 +14,20 @@ You should have received a copy of the GNU Affero General Public License
14
14
  along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
  */
16
16
 
17
- import { NoRetryError } from '@izara_project/izara-core-library-core';
18
- import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
19
- import { sns } from '@izara_project/izara-core-library-external-request';
20
- import snsSharedLib from '@izara_project/izara-core-library-sns';
17
+ import { NoRetryError } from "@izara_project/izara-core-library-core";
18
+ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
19
+ import { sns } from "@izara_project/izara-core-library-external-request";
20
+ import snsSharedLib from "@izara_project/izara-core-library-sns";
21
21
 
22
22
  import {
23
23
  createParentFlowId,
24
24
  createPendingStepId,
25
- createAwaitingStepId
26
- } from './asyncFlowSharedLib.js';
25
+ createAwaitingStepId,
26
+ } from "./asyncFlowSharedLib.js";
27
27
 
28
28
  function _assertPendingStepId(pendingStepId) {
29
29
  if (!pendingStepId) {
30
- throw new NoRetryError('pendingStepId required');
30
+ throw new NoRetryError("pendingStepId required");
31
31
  }
32
32
  }
33
33
 
@@ -35,15 +35,15 @@ async function _putAwaitingMultipleStepRecords(
35
35
  _izContext,
36
36
  records,
37
37
  pendingStepId,
38
- sharedAttributes = {}
38
+ sharedAttributes = {},
39
39
  ) {
40
40
  const tableSteps = dynamodbSharedLib.tableName(
41
41
  _izContext,
42
- 'AwaitingMultipleSteps'
42
+ "AwaitingMultipleSteps",
43
43
  );
44
44
  const tablePending = dynamodbSharedLib.tableName(
45
45
  _izContext,
46
- 'AwaitingMultipleStepByPending'
46
+ "AwaitingMultipleStepByPending",
47
47
  );
48
48
 
49
49
  await Promise.all(
@@ -52,29 +52,36 @@ async function _putAwaitingMultipleStepRecords(
52
52
 
53
53
  const itemPending = {
54
54
  ...keys,
55
- ...sharedAttributes
55
+ ...sharedAttributes,
56
56
  };
57
57
  if (additionalAttributes) {
58
- itemPending.additionalAttributes = additionalAttributes;
58
+ if (sharedAttributes.additionalAttributes) {
59
+ itemPending.additionalAttributes = {
60
+ ...sharedAttributes.additionalAttributes,
61
+ ...additionalAttributes
62
+ };
63
+ } else {
64
+ itemPending.additionalAttributes = additionalAttributes;
65
+ }
59
66
  }
60
67
 
61
68
  return [
62
69
  dynamodbSharedLib.putItem(_izContext, tableSteps, keys),
63
- dynamodbSharedLib.putItem(_izContext, tablePending, itemPending)
70
+ dynamodbSharedLib.putItem(_izContext, tablePending, itemPending),
64
71
  ];
65
- })
72
+ }),
66
73
  );
67
74
  }
68
75
 
69
76
  async function _queryPendingStepsByAwaitingStepId(_izContext, awaitingStepId) {
70
77
  if (!awaitingStepId) {
71
- throw new NoRetryError('awaitingStepId required');
78
+ throw new NoRetryError("awaitingStepId required");
72
79
  }
73
80
 
74
81
  const { Items } = await dynamodbSharedLib.query(
75
82
  _izContext,
76
- dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
77
- { awaitingStepId }
83
+ dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
84
+ { awaitingStepId },
78
85
  );
79
86
 
80
87
  return Items;
@@ -85,9 +92,9 @@ async function _queryAwaitingStepsByPendingStepId(_izContext, pendingStepId) {
85
92
 
86
93
  const { Items } = await dynamodbSharedLib.query(
87
94
  _izContext,
88
- dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleStepByPending'),
95
+ dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleStepByPending"),
89
96
  { pendingStepId },
90
- { limit: 50 }
97
+ { limit: 50 },
91
98
  );
92
99
 
93
100
  return Items;
@@ -124,18 +131,18 @@ export async function createAwaitingMultipleSteps(
124
131
  _izContext,
125
132
  pendingStepId,
126
133
  records = [],
127
- options = {}
134
+ options = {},
128
135
  ) {
129
- const { prefix = '', additionalAttributes = {}, flowType = null } = options;
136
+ const { prefix = "", additionalAttributes = {}, flowType = null } = options;
130
137
 
131
- _izContext.logger.debug('[Lib:AsyncFlow:createAwaitingMultipleSteps] Input', {
138
+ _izContext.logger.debug("[Lib:AsyncFlow:createAwaitingMultipleSteps] Input", {
132
139
  pendingStepId,
133
- options
140
+ options,
134
141
  });
135
142
 
136
143
  const finalPendingStepId = createPendingStepId(pendingStepId, prefix);
137
144
 
138
- const hasFlowPublish = flowType || records.some(r => r.flowType);
145
+ const hasFlowPublish = flowType || records.some((r) => r.flowType);
139
146
 
140
147
  let finalRecords = records;
141
148
 
@@ -143,13 +150,13 @@ export async function createAwaitingMultipleSteps(
143
150
  finalRecords = [
144
151
  {
145
152
  awaitingStepId: createParentFlowId(prefix),
146
- additionalAttributes
147
- }
153
+ additionalAttributes,
154
+ },
148
155
  ];
149
156
  }
150
157
 
151
158
  if (hasFlowPublish) {
152
- finalRecords = records.map(record => {
159
+ finalRecords = records.map((record) => {
153
160
  const recordFlowType = record.flowType || flowType;
154
161
 
155
162
  if (
@@ -158,7 +165,7 @@ export async function createAwaitingMultipleSteps(
158
165
  !recordFlowType.serviceTag
159
166
  ) {
160
167
  throw new NoRetryError(
161
- 'record.flowType must have both flowTag and serviceTag'
168
+ "record.flowType must have both flowTag and serviceTag",
162
169
  );
163
170
  }
164
171
 
@@ -171,13 +178,13 @@ export async function createAwaitingMultipleSteps(
171
178
  additionalAttributes: record.additionalAttributes,
172
179
  message: {
173
180
  ...record.message,
174
- parentFlowId: awaitingStepId
181
+ parentFlowId: awaitingStepId,
175
182
  },
176
183
  topicArn: snsSharedLib.snsTopicArnByFlowSchema(
177
184
  _izContext,
178
185
  recordFlowType.flowTag,
179
- recordFlowType.serviceTag
180
- )
186
+ recordFlowType.serviceTag,
187
+ ),
181
188
  };
182
189
  });
183
190
  }
@@ -197,7 +204,7 @@ export async function createAwaitingMultipleSteps(
197
204
  awaitingStepId: createAwaitingStepId(awaitingStepId, prefix),
198
205
  additionalAttributes: mergedAttributes
199
206
  };
200
- }
207
+ },
201
208
  );
202
209
 
203
210
  await _putAwaitingMultipleStepRecords(
@@ -206,8 +213,8 @@ export async function createAwaitingMultipleSteps(
206
213
  finalPendingStepId,
207
214
  {
208
215
  complete: false,
209
- errorsFound: []
210
- }
216
+ errorsFound: [],
217
+ },
211
218
  );
212
219
 
213
220
  if (hasFlowPublish) {
@@ -215,9 +222,9 @@ export async function createAwaitingMultipleSteps(
215
222
  finalRecords.map(async ({ message, topicArn }) => {
216
223
  await sns.publishAsync(_izContext, {
217
224
  TopicArn: `${topicArn}_In`,
218
- Message: JSON.stringify(message)
225
+ Message: JSON.stringify(message),
219
226
  });
220
- })
227
+ }),
221
228
  );
222
229
  }
223
230
 
@@ -240,23 +247,23 @@ export async function updateAwaitingMultipleStep(
240
247
  _izContext,
241
248
  awaitingStepId,
242
249
  pendingStepId,
243
- data
250
+ data,
244
251
  ) {
245
252
  const tableSteps = dynamodbSharedLib.tableName(
246
253
  _izContext,
247
- 'AwaitingMultipleSteps'
254
+ "AwaitingMultipleSteps",
248
255
  );
249
256
 
250
257
  await dynamodbSharedLib.updateItem(
251
258
  _izContext,
252
259
  tableSteps,
253
260
  { awaitingStepId, pendingStepId },
254
- data
261
+ data,
255
262
  );
256
263
 
257
- _izContext.logger.debug('[Lib:updateAwaitingMultipleStep] Output', {
264
+ _izContext.logger.debug("[Lib:updateAwaitingMultipleStep] Output", {
258
265
  awaitingStepId,
259
- data
266
+ data,
260
267
  });
261
268
 
262
269
  return { ...data, awaitingStepId };
@@ -271,15 +278,15 @@ export async function updateAwaitingMultipleStep(
271
278
  */
272
279
  export async function findPendingStepAwaitingMultipleSteps(
273
280
  _izContext,
274
- awaitingStepId
281
+ awaitingStepId,
275
282
  ) {
276
- _izContext.logger.debug('[Lib:findPendingStepAwaitingMultipleSteps] Input', {
277
- awaitingStepId
283
+ _izContext.logger.debug("[Lib:findPendingStepAwaitingMultipleSteps] Input", {
284
+ awaitingStepId,
278
285
  });
279
286
 
280
287
  const items = await _queryPendingStepsByAwaitingStepId(
281
288
  _izContext,
282
- awaitingStepId
289
+ awaitingStepId,
283
290
  );
284
291
 
285
292
  if (items && items.length > 0) {
@@ -297,7 +304,7 @@ export async function findPendingStepAwaitingMultipleSteps(
297
304
  */
298
305
  export async function findPendingStepsAwaitingMultipleSteps(
299
306
  _izContext,
300
- awaitingStepId
307
+ awaitingStepId,
301
308
  ) {
302
309
  return _queryPendingStepsByAwaitingStepId(_izContext, awaitingStepId);
303
310
  }
@@ -311,11 +318,11 @@ export async function findPendingStepsAwaitingMultipleSteps(
311
318
  */
312
319
  export async function findPendingStepIdAwaitingMultipleSteps(
313
320
  _izContext,
314
- awaitingStepId
321
+ awaitingStepId,
315
322
  ) {
316
323
  const items = await _queryPendingStepsByAwaitingStepId(
317
324
  _izContext,
318
- awaitingStepId
325
+ awaitingStepId,
319
326
  );
320
327
  if (items && items[0] && items[0].pendingStepId) {
321
328
  return items[0].pendingStepId;
@@ -332,7 +339,7 @@ export async function findPendingStepIdAwaitingMultipleSteps(
332
339
  */
333
340
  export async function findAwaitingMultipleStepByPending(
334
341
  _izContext,
335
- pendingStepId
342
+ pendingStepId,
336
343
  ) {
337
344
  return _queryAwaitingStepsByPendingStepId(_izContext, pendingStepId);
338
345
  }
@@ -355,16 +362,16 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
355
362
  currentAwaitingStepId,
356
363
  errorsFound = [],
357
364
  returnValues = {},
358
- settings = { checkIsAllError: false }
365
+ settings = { checkIsAllError: false },
359
366
  ) {
360
367
  _izContext.logger.debug(
361
- '[Lib:checkAllAwaitingStepsFinishedWithReturnParams] Input parameters',
368
+ "[Lib:checkAllAwaitingStepsFinishedWithReturnParams] Input parameters",
362
369
  {
363
370
  pendingStepId,
364
371
  currentAwaitingStepId,
365
372
  errorsFound,
366
- returnValues
367
- }
373
+ returnValues,
374
+ },
368
375
  );
369
376
 
370
377
  _assertPendingStepId(pendingStepId);
@@ -383,16 +390,26 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
383
390
 
384
391
  await dynamodbSharedLib.updateItem(
385
392
  _izContext,
386
- dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleStepByPending'),
393
+ dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleStepByPending"),
387
394
  {
388
395
  pendingStepId,
389
- awaitingStepId: currentAwaitingStepId
396
+ awaitingStepId: currentAwaitingStepId,
390
397
  },
391
398
  {
392
399
  complete: true,
393
400
  errorsFound,
394
- returnValues
395
- }
401
+ returnValues,
402
+ },
403
+ );
404
+
405
+ _izContext.logger.debug(
406
+ '[Lib:checkAllAwaitingStepsFinishedWithReturnParams] After updating awaitingStepItems',
407
+ {
408
+ pendingStepId,
409
+ awaitingStepId: currentAwaitingStepId,
410
+ errorsFound,
411
+ returnValues,
412
+ },
396
413
  );
397
414
 
398
415
  _izContext.logger.debug(
@@ -408,10 +425,12 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
408
425
 
409
426
  const awaitingStepItems = await _queryAwaitingStepsByPendingStepId(
410
427
  _izContext,
411
- pendingStepId
428
+ pendingStepId,
412
429
  );
413
430
 
414
431
  _izContext.logger.debug(
432
+ "[Lib:checkAllAwaitingStepsFinishedWithReturnParams] awaitingStepItems",
433
+ { awaitingStepItems },
415
434
  '[Lib:checkAllAwaitingStepsFinishedWithReturnParams] Queried awaitingStepItems',
416
435
  {
417
436
  pendingStepId,
@@ -437,7 +456,7 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
437
456
  }
438
457
 
439
458
  const hasIncomplete = awaitingStepItems.some(
440
- item => item.awaitingStepId !== currentAwaitingStepId && !item.complete
459
+ (item) => item.awaitingStepId !== currentAwaitingStepId && !item.complete,
441
460
  );
442
461
 
443
462
  let defaultAttrs = null;
@@ -508,7 +527,7 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
508
527
  collectedReturnValueByAwaitingStepId: null,
509
528
  collectedErrors: [],
510
529
  returnValues: null,
511
- additionalAttributes: defaultAttrs
530
+ additionalAttributes: defaultAttrs,
512
531
  };
513
532
  }
514
533
 
@@ -532,7 +551,7 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
532
551
  if (item.errorsFound && item.errorsFound.length > 0) {
533
552
  collectedErrors.push(
534
553
  `Error found in step ${item.awaitingStepId}`,
535
- ...item.errorsFound
554
+ ...item.errorsFound,
536
555
  );
537
556
  }
538
557
  }
@@ -542,12 +561,12 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
542
561
  collectedReturnValueByAwaitingStepId,
543
562
  collectedErrors,
544
563
  returnValues: sharedReturnValues,
545
- additionalAttributes: defaultAttrs
564
+ additionalAttributes: defaultAttrs,
546
565
  };
547
566
 
548
567
  if (settings.checkIsAllError) {
549
568
  result.isAllError = awaitingStepItems.every(
550
- item => item.errorsFound && item.errorsFound.length > 0
569
+ (item) => item.errorsFound && item.errorsFound.length > 0,
551
570
  );
552
571
  }
553
572
 
@@ -570,21 +589,21 @@ export async function checkAllAwaitingStepsFinishedWithReturnParams(
570
589
  * @returns {Promise<boolean>} True if operations completed successfully.
571
590
  */
572
591
  export async function clearAllAwaitingSteps(_izContext, pendingStepId) {
573
- _izContext.logger.debug('[Lib:clearAllAwaitingSteps] Input parameters', {
574
- pendingStepId
592
+ _izContext.logger.debug("[Lib:clearAllAwaitingSteps] Input parameters", {
593
+ pendingStepId,
575
594
  });
576
595
 
577
596
  const awaitingStepItems = await _queryAwaitingStepsByPendingStepId(
578
597
  _izContext,
579
- pendingStepId
598
+ pendingStepId,
580
599
  );
581
600
  const tableSteps = dynamodbSharedLib.tableName(
582
601
  _izContext,
583
- 'AwaitingMultipleSteps'
602
+ "AwaitingMultipleSteps",
584
603
  );
585
604
  const tablePending = dynamodbSharedLib.tableName(
586
605
  _izContext,
587
- 'AwaitingMultipleStepByPending'
606
+ "AwaitingMultipleStepByPending",
588
607
  );
589
608
 
590
609
  await Promise.all(
@@ -592,14 +611,14 @@ export async function clearAllAwaitingSteps(_izContext, pendingStepId) {
592
611
  ({ awaitingStepId, pendingStepId: itemPendingStepId }) => [
593
612
  dynamodbSharedLib.deleteItem(_izContext, tableSteps, {
594
613
  awaitingStepId,
595
- pendingStepId: itemPendingStepId
614
+ pendingStepId: itemPendingStepId,
596
615
  }),
597
616
  dynamodbSharedLib.deleteItem(_izContext, tablePending, {
598
617
  awaitingStepId,
599
- pendingStepId: itemPendingStepId
600
- })
601
- ]
602
- )
618
+ pendingStepId: itemPendingStepId,
619
+ }),
620
+ ],
621
+ ),
603
622
  );
604
623
 
605
624
  return true;
@@ -618,12 +637,12 @@ export async function removeAwaitingMultipleStep(
618
637
  _izContext,
619
638
  awaitingStepId,
620
639
  pendingStepId,
621
- errorsFound = []
640
+ errorsFound = [],
622
641
  ) {
623
- _izContext.logger.debug('[Lib:removeAwaitingMultipleStep] Input parameters', {
642
+ _izContext.logger.debug("[Lib:removeAwaitingMultipleStep] Input parameters", {
624
643
  awaitingStepId,
625
644
  pendingStepId,
626
- errorsFound
645
+ errorsFound,
627
646
  });
628
647
 
629
648
  if (!awaitingStepId || !pendingStepId) {
@@ -637,9 +656,9 @@ export async function removeAwaitingMultipleStep(
637
656
  const promises = [
638
657
  dynamodbSharedLib.deleteItem(
639
658
  _izContext,
640
- dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
641
- keys
642
- )
659
+ dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
660
+ keys,
661
+ ),
643
662
  ];
644
663
 
645
664
  if (errorsFound.length === 0) {
@@ -648,10 +667,10 @@ export async function removeAwaitingMultipleStep(
648
667
  _izContext,
649
668
  dynamodbSharedLib.tableName(
650
669
  _izContext,
651
- 'AwaitingMultipleStepByPending'
670
+ "AwaitingMultipleStepByPending",
652
671
  ),
653
- keys
654
- )
672
+ keys,
673
+ ),
655
674
  );
656
675
  }
657
676
 
@@ -668,9 +687,10 @@ export async function removeAwaitingMultipleStep(
668
687
  export async function completeAction(
669
688
  _izContext,
670
689
  parentFlowId,
671
- prefix = '',
690
+ prefix = "",
672
691
  returnValue = {},
673
- errorsFound = []
692
+ errorsFound = [],
693
+ settings = { checkIsAllError: false }
674
694
  ) {
675
695
  _izContext.logger.debug('[Lib:CompleteAction] Input parameters', {
676
696
  parentFlowId,
@@ -678,14 +698,17 @@ export async function completeAction(
678
698
  });
679
699
 
680
700
  try {
681
- const { pendingStepId } = await findPendingStepAwaitingMultipleSteps(
701
+ const {pendingStepId} = await findPendingStepAwaitingMultipleSteps(
682
702
  _izContext,
683
- createAwaitingStepId(parentFlowId, prefix)
703
+ createAwaitingStepId(
704
+ parentFlowId,
705
+ prefix
706
+ )
684
707
  );
685
708
 
686
709
  if (!pendingStepId) {
687
710
  _izContext.logger.warn(
688
- `No pending step found for awaitingStepId: ${awaitingStepId}`
711
+ `No pending step found for awaitingStepId: ${awaitingStepId}`,
689
712
  );
690
713
  return { returnValue, errorsFound };
691
714
  }
@@ -695,11 +718,17 @@ export async function completeAction(
695
718
  collectedReturnValueByAwaitingStepId,
696
719
  collectedErrors,
697
720
  returnValues,
698
- additionalAttributes
721
+ additionalAttributes,
699
722
  } = await checkAllAwaitingStepsFinishedWithReturnParams(
700
723
  _izContext,
701
724
  pendingStepId,
702
- createAwaitingStepId(parentFlowId, prefix)
725
+ createAwaitingStepId(
726
+ parentFlowId,
727
+ prefix
728
+ ),
729
+ errorsFound,
730
+ returnValue,
731
+ { checkIsAllError: settings.checkIsAllError }
703
732
  );
704
733
 
705
734
  let status = true;
@@ -714,22 +743,22 @@ export async function completeAction(
714
743
 
715
744
  if (status) {
716
745
  await Promise.all(
717
- (pendingStepId.listOfRecords ?? []).flatMap(records =>
746
+ (additionalAttributes.listOfRecords ?? []).flatMap(records =>
718
747
  Object.values(records).map(async record =>
719
- dynamodbSharedLib.putItem(
748
+ dynamodbSharedLib.updateItem(
720
749
  _izContext,
721
750
  await dynamodbSharedLib.tableName(
722
751
  _izContext,
723
752
  record.tableName,
724
- record.serviceTag
753
+ record.serviceTag,
725
754
  ),
726
755
  {
727
756
  ...record.objInstanceFull.identifiers,
728
- ...record.objInstanceFull.fields
729
- }
730
- )
731
- )
732
- )
757
+ ...record.objInstanceFull.fields,
758
+ },
759
+ ),
760
+ ),
761
+ ),
733
762
  );
734
763
  }
735
764
 
@@ -14,28 +14,28 @@ You should have received a copy of the GNU Affero General Public License
14
14
  along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
  */
16
16
 
17
- import { NoRetryError } from '@izara_project/izara-core-library-core';
18
- import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
17
+ import { NoRetryError } from "@izara_project/izara-core-library-core";
18
+ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
19
19
 
20
- import { createFieldNameUniqueRequestId } from './asyncFlowSharedLib.js';
20
+ import { createFieldNameUniqueRequestId } from "./asyncFlowSharedLib.js";
21
21
 
22
22
  async function _findSinglePendingStep(_izContext, awaitingStepId) {
23
- _izContext.logger.debug('[Lib:AsyncFlow:findSinglePendingStep] Input', {
24
- awaitingStepId
23
+ _izContext.logger.debug("[Lib:AsyncFlow:findSinglePendingStep] Input", {
24
+ awaitingStepId,
25
25
  });
26
26
 
27
27
  if (!awaitingStepId) {
28
- throw new NoRetryError('awaitingStepId is required');
28
+ throw new NoRetryError("awaitingStepId is required");
29
29
  }
30
30
 
31
31
  const { Items } = await dynamodbSharedLib.query(
32
32
  _izContext,
33
- dynamodbSharedLib.tableName(_izContext, 'AwaitingStep'),
34
- { awaitingStepId }
33
+ dynamodbSharedLib.tableName(_izContext, "AwaitingStep"),
34
+ { awaitingStepId },
35
35
  );
36
36
 
37
37
  if (Items.length !== 1) {
38
- throw new NoRetryError('listPendingSteps not equals 1');
38
+ throw new NoRetryError("listPendingSteps not equals 1");
39
39
  }
40
40
 
41
41
  return Items[0];
@@ -64,13 +64,13 @@ export async function createAwaitingStep(
64
64
  awaitingStepId,
65
65
  pendingStepId,
66
66
  additionalAttributes = {},
67
- callingFlowConfig = {}
67
+ callingFlowConfig = {},
68
68
  ) {
69
- _izContext.logger.debug('[Lib:AsyncFlow:createAwaitingStep] Input', {
69
+ _izContext.logger.debug("[Lib:AsyncFlow:createAwaitingStep] Input", {
70
70
  awaitingStepId,
71
71
  pendingStepId,
72
72
  additionalAttributes,
73
- callingFlowConfig
73
+ callingFlowConfig,
74
74
  });
75
75
 
76
76
  const attributesWhenCreate = {
@@ -78,7 +78,7 @@ export async function createAwaitingStep(
78
78
  pendingStepId,
79
79
  timestamp: Date.now(),
80
80
  uniqueRequestId: _izContext.uniqueRequestId,
81
- ...additionalAttributes
81
+ ...additionalAttributes,
82
82
  };
83
83
 
84
84
  if (Object.keys(callingFlowConfig).length > 0) {
@@ -87,8 +87,8 @@ export async function createAwaitingStep(
87
87
 
88
88
  await dynamodbSharedLib.putItem(
89
89
  _izContext,
90
- dynamodbSharedLib.tableName(_izContext, 'AwaitingStep'),
91
- attributesWhenCreate
90
+ dynamodbSharedLib.tableName(_izContext, "AwaitingStep"),
91
+ attributesWhenCreate,
92
92
  );
93
93
  }
94
94
 
@@ -116,21 +116,21 @@ export async function findPendingStep(_izContext, awaitingStepId) {
116
116
  export async function removeAwaitingStep(
117
117
  _izContext,
118
118
  awaitingStepId,
119
- pendingStepId
119
+ pendingStepId,
120
120
  ) {
121
- _izContext.logger.debug('[Lib:AsyncFlow:removeAwaitingStep] Input', {
121
+ _izContext.logger.debug("[Lib:AsyncFlow:removeAwaitingStep] Input", {
122
122
  awaitingStepId,
123
- pendingStepId
123
+ pendingStepId,
124
124
  });
125
125
 
126
126
  if (!awaitingStepId || !pendingStepId) {
127
- throw new NoRetryError('awaitingStepId, pendingStepId required');
127
+ throw new NoRetryError("awaitingStepId, pendingStepId required");
128
128
  }
129
129
 
130
130
  await dynamodbSharedLib.deleteItem(
131
131
  _izContext,
132
- dynamodbSharedLib.tableName(_izContext, 'AwaitingStep'),
133
- { awaitingStepId, pendingStepId }
132
+ dynamodbSharedLib.tableName(_izContext, "AwaitingStep"),
133
+ { awaitingStepId, pendingStepId },
134
134
  );
135
135
  }
136
136
 
@@ -150,16 +150,16 @@ export async function removeAwaitingStepWithCheckUniqueRequestId(
150
150
  awaitingStepId,
151
151
  pendingStepId,
152
152
  checkUniqueRequestId,
153
- prefix = ''
153
+ prefix = "",
154
154
  ) {
155
155
  _izContext.logger.debug(
156
- '[Lib:AsyncFlow:removeAwaitingStepWithCheckUniqueRequestId] Input',
157
- { awaitingStepId, pendingStepId, checkUniqueRequestId, prefix }
156
+ "[Lib:AsyncFlow:removeAwaitingStepWithCheckUniqueRequestId] Input",
157
+ { awaitingStepId, pendingStepId, checkUniqueRequestId, prefix },
158
158
  );
159
159
 
160
160
  if (!awaitingStepId || !pendingStepId || !checkUniqueRequestId) {
161
161
  throw new NoRetryError(
162
- 'awaitingStepId, pendingStepId, checkUniqueRequestId required'
162
+ "awaitingStepId, pendingStepId, checkUniqueRequestId required",
163
163
  );
164
164
  }
165
165
 
@@ -167,19 +167,19 @@ export async function removeAwaitingStepWithCheckUniqueRequestId(
167
167
  additionalAttributes: { checkUniqueRequestId },
168
168
  logicalElements: [
169
169
  {
170
- type: 'logical',
171
- comparison: 'equals',
170
+ type: "logical",
171
+ comparison: "equals",
172
172
  lhsAttribute: createFieldNameUniqueRequestId(prefix),
173
- rhsReference: 'checkUniqueRequestId'
174
- }
175
- ]
173
+ rhsReference: "checkUniqueRequestId",
174
+ },
175
+ ],
176
176
  };
177
177
 
178
178
  await dynamodbSharedLib.deleteItem(
179
179
  _izContext,
180
- dynamodbSharedLib.tableName(_izContext, 'AwaitingStep'),
180
+ dynamodbSharedLib.tableName(_izContext, "AwaitingStep"),
181
181
  { awaitingStepId, pendingStepId },
182
182
  queryElementsCondition,
183
- { errorOnConditionalExpNotPass: false }
183
+ { errorOnConditionalExpNotPass: false },
184
184
  );
185
185
  }