@izara_project/izara-core-library-asynchronous-flow 1.0.22 → 1.0.24

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/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-library-asynchronous-flow",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Shared asynchronous flow logic",
5
+ "type": "module",
5
6
  "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js"
9
+ },
6
10
  "scripts": {
7
11
  "test": "jest"
8
12
  },
@@ -14,17 +18,18 @@
14
18
  "license": "AGPL-3.0-or-later",
15
19
  "homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-asynchronous-flow#readme",
16
20
  "devDependencies": {
17
- "jest": "^30.2.0"
21
+ "jest": "^30.4.2"
18
22
  },
19
23
  "jest": {
20
24
  "testEnvironment": "node"
21
25
  },
22
- "type": "module",
23
- "dependencies": {
24
- "@izara_project/izara-core-library-core": "^1.0.28",
25
- "@izara_project/izara-core-library-dynamodb": "^1.0.12",
26
- "@izara_project/izara-core-library-external-request": "^1.0.22",
27
- "@izara_project/izara-core-library-logger": "^1.0.8",
28
- "@izara_project/izara-core-library-sqs": "^1.0.5"
29
- }
26
+ "peerDependencies": {
27
+ "@izara_project/izara-core-library-core": "^1.0.32",
28
+ "@izara_project/izara-core-library-dynamodb": "^1.0.18",
29
+ "@izara_project/izara-core-library-external-request": "^1.0.29",
30
+ "@izara_project/izara-core-library-logger": "^1.0.9",
31
+ "@izara_project/izara-core-library-sqs": "^1.0.7"
32
+ },
33
+ "peerDependenciesMeta": {},
34
+ "dependencies": {}
30
35
  }
@@ -310,7 +310,7 @@ export async function findAwaitingMultipleStepByPending(
310
310
  * @param {Attrs} [additionalAttributes={}]
311
311
  * @returns {Promise<boolean>}
312
312
  */
313
- export async function checkAllAwaitingStepsFinishedWithError(
313
+ export async function checkAllAwaitingStepsFinished(
314
314
  _izContext,
315
315
  pendingStepId,
316
316
  currentAwaitingStepId = null,
@@ -526,7 +526,7 @@ export async function syncAndCheckStepsCompletion(
526
526
  {
527
527
  complete: true,
528
528
  errorsFound,
529
- ...additionalAttributes
529
+ additionalAttributes
530
530
  }
531
531
  );
532
532
  }
@@ -536,25 +536,28 @@ export async function syncAndCheckStepsCompletion(
536
536
  dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleStepByPending'),
537
537
  { pendingStepId },
538
538
  {
539
- limit: 50 // arbitrary limit so not pull too many results, need >2 because some others might be marked as "complete" = true
539
+ limit: 50
540
540
  }
541
541
  );
542
542
 
543
+ _izContext.logger.debug('awaitingStepItems:::', awaitingStepItems);
544
+
543
545
  const collectedAttributes = {};
546
+ const collectedErrors = [];
547
+
544
548
  for (const item of awaitingStepItems.Items) {
545
- // For any step OTHER than the one we just completed, if it's not marked as complete,
546
- // then the overall process is not finished.
547
549
  if (item.awaitingStepId !== currentAwaitingStepId && !item.complete) {
548
- return [false, null];
550
+ return [false, null, []];
551
+ }
552
+
553
+ if (item.errorsFound?.length > 0) {
554
+ collectedErrors.push(...item.errorsFound);
549
555
  }
550
556
 
551
- // If the step is complete (which all should be if we reach this point),
552
- // collect its attributes if they exist.
553
557
  if (item.additionalAttributes) {
554
558
  collectedAttributes[item.awaitingStepId] = item.additionalAttributes;
555
559
  }
556
560
  }
557
561
 
558
- // If the loop completes, it means all steps were finished.
559
- return [true, collectedAttributes];
562
+ return [true, collectedAttributes, collectedErrors];
560
563
  }