@izara_project/izara-core-library-asynchronous-flow 1.0.22 → 1.0.23
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 +1 -1
- package/src/awaitingMultipleSteps.js +13 -10
package/package.json
CHANGED
|
@@ -310,7 +310,7 @@ export async function findAwaitingMultipleStepByPending(
|
|
|
310
310
|
* @param {Attrs} [additionalAttributes={}]
|
|
311
311
|
* @returns {Promise<boolean>}
|
|
312
312
|
*/
|
|
313
|
-
export async function
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
559
|
-
return [true, collectedAttributes];
|
|
562
|
+
return [true, collectedAttributes, collectedErrors];
|
|
560
563
|
}
|