@izara_project/izara-core-library-asynchronous-flow 1.0.38 → 1.0.39
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 +3 -13
- package/src/asyncFlowSharedLib.js +2 -40
- package/src/awaitingMultipleSteps.js +24 -32
- package/src/awaitingStep.js +1 -19
package/package.json
CHANGED
|
@@ -3,34 +3,25 @@
|
|
|
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.
|
|
6
|
+
"version": "1.0.39",
|
|
7
7
|
"description": "Shared asynchronous flow logic",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./index.js"
|
|
12
12
|
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"test": "jest"
|
|
15
|
-
},
|
|
16
13
|
"repository": {
|
|
17
14
|
"type": "git",
|
|
18
15
|
"url": "git+ssh://git@bitbucket.org/izara-core-libraries/izara-core-library-asynchronous-flow.git"
|
|
19
16
|
},
|
|
20
|
-
"jest": {
|
|
21
|
-
"testEnvironment": "node"
|
|
22
|
-
},
|
|
23
17
|
"devDependencies": {
|
|
24
|
-
"@aws-sdk/client-s3": "^3.1077.0",
|
|
25
18
|
"@izara_project/izara-core-library-core": "^1.0.32",
|
|
26
19
|
"@izara_project/izara-core-library-dynamodb": "^1.0.20",
|
|
27
20
|
"@izara_project/izara-core-library-external-request": "^1.0.30",
|
|
28
21
|
"@izara_project/izara-core-library-logger": "^1.0.9",
|
|
29
22
|
"@izara_project/izara-core-library-sns": "^1.0.8",
|
|
30
23
|
"@izara_project/izara-core-library-sqs": "^1.0.7",
|
|
31
|
-
"@izara_project/izara-shared-core": "^1.0.13"
|
|
32
|
-
"jest": "^30.4.2",
|
|
33
|
-
"ws": "^8.21.0"
|
|
24
|
+
"@izara_project/izara-shared-core": "^1.0.13"
|
|
34
25
|
},
|
|
35
26
|
"peerDependencies": {
|
|
36
27
|
"@izara_project/izara-core-library-core": "^1.0.32",
|
|
@@ -40,6 +31,5 @@
|
|
|
40
31
|
"@izara_project/izara-core-library-sns": "^1.0.8",
|
|
41
32
|
"@izara_project/izara-core-library-sqs": "^1.0.7",
|
|
42
33
|
"@izara_project/izara-shared-core": "^1.0.12"
|
|
43
|
-
}
|
|
44
|
-
"peerDependenciesMeta": {}
|
|
34
|
+
}
|
|
45
35
|
}
|
|
@@ -66,26 +66,6 @@ export function createConcatenatedPendingStepId(parentId, childId) {
|
|
|
66
66
|
return parentId + '_' + childId;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* Create a simple awaitingStepId (prefix + partitionKey).
|
|
71
|
-
* @param {string} partitionKey
|
|
72
|
-
* @param {string} [prefix=""]
|
|
73
|
-
* @returns {string}
|
|
74
|
-
*/
|
|
75
|
-
export function createAwaitingStepId(partitionKey, prefix = '') {
|
|
76
|
-
return prefix + partitionKey;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Create a simple pendingStepId (prefix + identifierId).
|
|
81
|
-
* @param {string} identifierId
|
|
82
|
-
* @param {string} [prefix=""]
|
|
83
|
-
* @returns {string}
|
|
84
|
-
*/
|
|
85
|
-
export function createPendingStepId(identifierId, prefix = '') {
|
|
86
|
-
return prefix + identifierId;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
69
|
/**
|
|
90
70
|
* Create parent Flow Id.
|
|
91
71
|
* @async
|
|
@@ -117,24 +97,6 @@ export function explodePendingStepId(pendingStepId, prefix = '') {
|
|
|
117
97
|
}
|
|
118
98
|
|
|
119
99
|
// copy from izara-core-library-trigger-cache
|
|
120
|
-
/**
|
|
121
|
-
* Build the field name that stores "cache complete" marker.
|
|
122
|
-
* @param {string} [prefix='cache']
|
|
123
|
-
* @returns {string}
|
|
124
|
-
*/
|
|
125
|
-
export function createFieldNameCacheComplete(prefix = 'cache') {
|
|
126
|
-
return prefix + 'CacheComplete';
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Build the field name that stores a cache "status".
|
|
131
|
-
* @param {string} [prefix='cache']
|
|
132
|
-
* @returns {string}
|
|
133
|
-
*/
|
|
134
|
-
export function createFieldNameStatus(prefix = 'cache') {
|
|
135
|
-
return prefix + 'Status';
|
|
136
|
-
}
|
|
137
|
-
|
|
138
100
|
/**
|
|
139
101
|
* Checks if record has uniqueRequestId set, if not set to this requests uniqueRequestId and continue to process
|
|
140
102
|
* if already set check if matches this request uniqueRequestId, if yes continue to process, if not then stop processing
|
|
@@ -333,8 +295,8 @@ export async function checkAndGetTimeCacheComplete(
|
|
|
333
295
|
);
|
|
334
296
|
|
|
335
297
|
const uniqueRequestIdFieldName = createFieldNameUniqueRequestId('cache');
|
|
336
|
-
const cacheCompleteFieldName =
|
|
337
|
-
const statusFieldName =
|
|
298
|
+
const cacheCompleteFieldName = prefix + 'CacheComplete';
|
|
299
|
+
const statusFieldName = prefix + 'Status';
|
|
338
300
|
|
|
339
301
|
let getTimeCacheComplete = await dynamodbSharedLib.getItem(
|
|
340
302
|
_izContext,
|
|
@@ -109,7 +109,11 @@ export async function createAwaitingMultipleSteps(
|
|
|
109
109
|
options
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
const formattedPrefix = prefix
|
|
112
|
+
const formattedPrefix = prefix
|
|
113
|
+
? prefix.endsWith('_')
|
|
114
|
+
? prefix
|
|
115
|
+
: `${prefix}_`
|
|
116
|
+
: '';
|
|
113
117
|
const finalPendingStepId =
|
|
114
118
|
formattedPrefix && !pendingStepId.startsWith(formattedPrefix)
|
|
115
119
|
? formattedPrefix + pendingStepId
|
|
@@ -186,42 +190,30 @@ export async function createAwaitingMultipleSteps(
|
|
|
186
190
|
return finalRecords[0]?.awaitingStepId;
|
|
187
191
|
}
|
|
188
192
|
|
|
189
|
-
export async function
|
|
190
|
-
_izContext,
|
|
191
|
-
records,
|
|
192
|
-
pendingStepId
|
|
193
|
-
) {
|
|
194
|
-
return createAwaitingMultipleSteps(_izContext, pendingStepId, records);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export async function createAwaitingMultipleStep(
|
|
193
|
+
export async function updateAwaitingMultipleStep(
|
|
198
194
|
_izContext,
|
|
195
|
+
awaitingStepId,
|
|
199
196
|
pendingStepId,
|
|
200
|
-
|
|
201
|
-
additionalAttributes = {}
|
|
197
|
+
data
|
|
202
198
|
) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
199
|
+
const tableSteps = dynamodbSharedLib.tableName(
|
|
200
|
+
_izContext,
|
|
201
|
+
'AwaitingMultipleSteps'
|
|
202
|
+
);
|
|
208
203
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
additionalAttributes,
|
|
220
|
-
publishConfig: {
|
|
221
|
-
messages,
|
|
222
|
-
flowType
|
|
223
|
-
}
|
|
204
|
+
await dynamodbSharedLib.updateItem(
|
|
205
|
+
_izContext,
|
|
206
|
+
tableSteps,
|
|
207
|
+
{ awaitingStepId, pendingStepId },
|
|
208
|
+
data
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
_izContext.logger.debug('[Lib:updateAwaitingMultipleStep] Output', {
|
|
212
|
+
awaitingStepId,
|
|
213
|
+
data
|
|
224
214
|
});
|
|
215
|
+
|
|
216
|
+
return { ...data, awaitingStepId };
|
|
225
217
|
}
|
|
226
218
|
|
|
227
219
|
export async function findPendingStepAwaitingMultipleSteps(
|
package/src/awaitingStep.js
CHANGED
|
@@ -80,26 +80,8 @@ export async function createAwaitingStep(
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export async function findPendingStepIdAwaitingStep(
|
|
84
|
-
_izContext,
|
|
85
|
-
awaitingStepId
|
|
86
|
-
) {
|
|
87
|
-
const item = await _findSinglePendingStep(_izContext, awaitingStepId);
|
|
88
|
-
return item.pendingStepId;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
83
|
export async function findPendingStep(_izContext, awaitingStepId) {
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export async function findPendingStepAwaitingStepWithCallingFlow(
|
|
96
|
-
_izContext,
|
|
97
|
-
awaitingStepId
|
|
98
|
-
) {
|
|
99
|
-
const awaitingStep = await findPendingStep(_izContext, awaitingStepId);
|
|
100
|
-
const { callingFlowConfig = null, ...restAwaitingStep } = awaitingStep;
|
|
101
|
-
|
|
102
|
-
return [restAwaitingStep, callingFlowConfig];
|
|
84
|
+
return _findSinglePendingStep(_izContext, awaitingStepId);
|
|
103
85
|
}
|
|
104
86
|
|
|
105
87
|
export async function removeAwaitingStep(
|