@izara_project/izara-core-library-asynchronous-flow 1.0.17 → 1.0.19

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/index.js CHANGED
@@ -18,45 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
 
20
20
  // Import the Asynchronous Flow shared library functions
21
- const asyncFlowSharedLib = require('./src/AsyncFlowSharedLib');
21
+ import asyncFlowSharedLib from './src/AsyncFlowSharedLib.js';
22
22
 
23
23
  // Export all the functions
24
- module.exports = {
25
- // Identifier creation
26
- createFieldNameUniqueRequestId: asyncFlowSharedLib.createFieldNameUniqueRequestId,
27
- createConcatenatedAwaitingStepId: asyncFlowSharedLib.createConcatenatedAwaitingStepId,
28
- createConcatenatedPendingStepId: asyncFlowSharedLib.createConcatenatedPendingStepId,
29
- createAwaitingStepId: asyncFlowSharedLib.createAwaitingStepId,
30
- createPendingStepId: asyncFlowSharedLib.createPendingStepId,
31
- explodePendingStepId: asyncFlowSharedLib.explodePendingStepId,
32
-
33
- // Awaiting Multiple Steps
34
- createAwaitingMultipleStepsWithAdditionalAttributes: asyncFlowSharedLib.createAwaitingMultipleStepsWithAdditionalAttributes,
35
- createAwaitingMultipleSteps: asyncFlowSharedLib.createAwaitingMultipleSteps,
36
- findPendingStepIdsAwaitingMultipleSteps: asyncFlowSharedLib.findPendingStepIdsAwaitingMultipleSteps,
37
- findPendingStepsAwaitingMultipleSteps: asyncFlowSharedLib.findPendingStepsAwaitingMultipleSteps,
38
- findPendingStepAwaitingMultipleSteps: asyncFlowSharedLib.findPendingStepAwaitingMultipleSteps,
39
- findAwaitingMultipleStepByPending: asyncFlowSharedLib.findAwaitingMultipleStepByPending,
40
- // Awaiting Step
41
- createAwaitingStep: asyncFlowSharedLib.createAwaitingStep,
42
- findPendingStepIdsAwaitingStep: asyncFlowSharedLib.findPendingStepIdsAwaitingStep,
43
- findPendingStepsAwaitingStep: asyncFlowSharedLib.findPendingStepsAwaitingStep,
44
- findPendingStepAwaitingStep: asyncFlowSharedLib.findPendingStepAwaitingStep,
45
- findPendingStepAwaitingStepWithCallingFlow: asyncFlowSharedLib.findPendingStepAwaitingStepWithCallingFlow,
46
- // Checking and clearing steps
47
- checkAllAwaitingStepsFinished: asyncFlowSharedLib.checkAllAwaitingStepsFinished,
48
- clearAllAwaitingSteps: asyncFlowSharedLib.clearAllAwaitingSteps,
49
- removeAwaitingStep: asyncFlowSharedLib.removeAwaitingStep,
50
- removeAwaitingMultipleStep: asyncFlowSharedLib.removeAwaitingMultipleStep,
51
- removeAwaitingStepWithCheckUniqueRequestId: asyncFlowSharedLib.removeAwaitingStepWithCheckUniqueRequestId,
52
-
53
- // Request and cache processing
54
- checkUniqueRequestProcessing: asyncFlowSharedLib.checkUniqueRequestProcessing,
55
- checkTimeCacheComplete: asyncFlowSharedLib.checkTimeCacheComplete,
56
- checkAndGetTimeCacheComplete: asyncFlowSharedLib.checkAndGetTimeCacheComplete,
57
- checkCacheUniqueRequestId: asyncFlowSharedLib.checkCacheUniqueRequestId,
58
-
59
- // Pagination and invocation helpers
60
- validateStartKeyParam: asyncFlowSharedLib.validateStartKeyParam,
61
- validateMultipleInvocations: asyncFlowSharedLib.validateMultipleInvocations
62
- };
24
+ export default asyncFlowSharedLib;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-library-asynchronous-flow",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Shared asynchronous flow logic",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,16 +14,17 @@
14
14
  "license": "AGPL-3.0-or-later",
15
15
  "homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-asynchronous-flow#readme",
16
16
  "devDependencies": {
17
- "jest": "^29.7.0"
17
+ "jest": "^30.2.0"
18
18
  },
19
19
  "jest": {
20
20
  "testEnvironment": "node"
21
21
  },
22
+ "type": "module",
22
23
  "dependencies": {
23
- "@izara_project/izara-core-library-core": "^1.0.18",
24
- "@izara_project/izara-core-library-dynamodb": "^1.0.4",
25
- "@izara_project/izara-core-library-external-request": "^1.0.18",
26
- "@izara_project/izara-core-library-logger": "^1.0.7",
27
- "@izara_project/izara-core-library-sqs": "^1.0.4"
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"
28
29
  }
29
30
  }
@@ -18,15 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
  'use strict';
19
19
 
20
20
  // Core libraries
21
- const { NoRetryError } = require('@izara_project/izara-core-library-core');
22
- const Logger = require('@izara_project/izara-core-library-logger');
21
+ import { NoRetryError } from '@izara_project/izara-core-library-core';
22
+ import Logger from '@izara_project/izara-core-library-logger';
23
23
 
24
24
  // Data and service interaction libraries
25
- const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
26
- const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
25
+ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
26
+ import sqsSharedLib from '@izara_project/izara-core-library-sqs';
27
27
 
28
28
  // External service interactions
29
- const { sqs } = require('@izara_project/izara-core-library-external-request');
29
+ import { sqs } from '@izara_project/izara-core-library-external-request';
30
30
 
31
31
 
32
32
  /**
@@ -963,7 +963,6 @@ async function checkUniqueRequestProcessing(
963
963
  queryElementsWhenUpdate,
964
964
  { complexAttributes: true }, // force to complex
965
965
  )
966
-
967
966
  } catch (err) { // catch error when put and handle errors.
968
967
  _izContext.logger.debug('updateItem storedCache expired err', err);
969
968
  if (err.name == 'ConditionalCheckFailedException') {
@@ -977,11 +976,14 @@ async function checkUniqueRequestProcessing(
977
976
  } else if (existingRecord[uniqueRequestIdFieldName] !== uniqueRequestId) {
978
977
 
979
978
  // when another request/uniqueRequestId need to stop process
980
- returnStatus = "stop";
981
- }
982
- // if existingRecord[uniqueRequestIdFieldName] == uniqueRequestId then return "process"
979
+ return ["stop", existingRecord];
980
+
981
+ } else if (existingRecord[uniqueRequestIdFieldName] == uniqueRequestId) {
983
982
 
984
- return [returnStatus, existingRecord];
983
+ // if existingRecord[uniqueRequestIdFieldName] == uniqueRequestId then return "process
984
+ return [returnStatus, existingRecord];
985
+
986
+ }
985
987
 
986
988
  } // end loop 2 times
987
989
  //should never get here
@@ -1261,7 +1263,7 @@ async function validateMultipleInvocations(
1261
1263
  }
1262
1264
  }
1263
1265
 
1264
- module.exports = {
1266
+ export default {
1265
1267
  // Helper functions
1266
1268
  createFieldNameUniqueRequestId,
1267
1269
  createConcatenatedAwaitingStepId,