@izara_project/izara-core-library-asynchronous-flow 1.0.34 → 1.0.35

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
@@ -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.34",
6
+ "version": "1.0.35",
7
7
  "description": "Shared asynchronous flow logic",
8
8
  "type": "module",
9
9
  "main": "index.js",
@@ -455,6 +455,17 @@ export async function findAwaitingMultipleStepByPending(
455
455
  return listAwaitingSteps.Items;
456
456
  }
457
457
 
458
+ /**
459
+ * Updates the completion status of a specific awaiting step within a multiple-step pending process.
460
+ * Marks the given awaiting step as complete and stores any encountered errors or additional attributes.
461
+ *
462
+ * @param {Object} _izContext - The execution context object containing logger and other utilities.
463
+ * @param {string} pendingStepId - The unique identifier of the parent pending step.
464
+ * @param {string|null} [currentAwaitingStepId=null] - The unique identifier of the specific awaiting step being processed. If null, no update is performed.
465
+ * @param {Array<Object|string>} [errorsFound=[]] - An array of errors encountered during the step's execution.
466
+ * @param {Object} [additionalAttributes={}] - Any extra data to save along with the completion status.
467
+ * @returns {Promise<void>} Resolves when the update operation is complete.
468
+ */
458
469
  export async function checkAllAwaitingStepsFinishedShared(
459
470
  _izContext,
460
471
  pendingStepId,
@@ -482,7 +493,7 @@ export async function checkAllAwaitingStepsFinishedShared(
482
493
  {
483
494
  complete: true,
484
495
  errorsFound: errorsFound,
485
- ...additionalAttributes
496
+ additionalAttributes: additionalAttributes
486
497
  }
487
498
  );
488
499
  }
@@ -790,6 +801,21 @@ export async function removeAwaitingMultipleStep(
790
801
  await Promise.all(promiseArray);
791
802
  }
792
803
 
804
+ /**
805
+ * Creates multiple awaiting steps with additional attributes and publishes corresponding messages to an SNS topic.
806
+ * Each message is augmented with a new `parentFlowId` representing its awaiting step before being published.
807
+ *
808
+ * @param {Object} _izContext - The execution context object containing logger and other utilities.
809
+ * @param {Array<Object>} messages - An array of messages to be augmented and published.
810
+ * @param {string} [prefix=''] - An optional prefix used when generating new awaiting step IDs.
811
+ * @param {Object} [flowType={}] - Defines the target SNS topic. Must contain `flowTag` and `serviceTag`.
812
+ * @param {string} flowType.flowTag - The flow tag identifier.
813
+ * @param {string} flowType.serviceTag - The service tag identifier.
814
+ * @param {Object} [additionalAttributes={}] - Additional attributes to save with each new awaiting step.
815
+ * @param {string} pendingStepId - The unique identifier of the parent pending step that waits for these new steps.
816
+ * @returns {Promise<void>} Resolves when all awaiting steps are created and messages are published.
817
+ * @throws {Error} Throws a NoRetryError if `messages` is not an array, or if `flowType` is missing `flowTag` or `serviceTag`.
818
+ */
793
819
  export async function createAwaitingMultipleStepsWithAdditionalAttributesAndPublish(
794
820
  _izContext,
795
821
  messages,