@izara_project/izara-core-library-asynchronous-flow 1.0.30 → 1.0.31
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 +16 -8
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.
|
|
6
|
+
"version": "1.0.31",
|
|
7
7
|
"description": "Shared asynchronous flow logic",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "index.js",
|
|
@@ -26,6 +26,20 @@ import { identifierUuid } from '@izara_project/izara-shared-core';
|
|
|
26
26
|
// One pendingStepId can have multiple awaitingStepIds it is awaiting
|
|
27
27
|
// logic can prepend any prefix to awaitingStepId if want to be share one table and differentiate different external step ids
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Create multiple parent Ids.
|
|
31
|
+
* @async
|
|
32
|
+
* @param {number} count - The number of parent Ids to create.
|
|
33
|
+
* @param {string} [prefix=''] - The prefix to prepend to the parent Ids.
|
|
34
|
+
* @returns {Promise<string[]>} The list of parent Ids created.
|
|
35
|
+
*/
|
|
36
|
+
export function createParendIds(count, prefix = '') {
|
|
37
|
+
return Array.from(
|
|
38
|
+
{ length: count },
|
|
39
|
+
() => (prefix ? `${prefix}_` : '') + identifierUuid.generate()
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
/**
|
|
30
44
|
* Create multiple awaiting records with optional per-record additional attributes.
|
|
31
45
|
* Writes to both "AwaitingMultipleSteps" and "AwaitingMultipleStepByPending".
|
|
@@ -199,7 +213,7 @@ export async function createAwaitingMultipleSteps(
|
|
|
199
213
|
* @async
|
|
200
214
|
* @param {IzContext} _izContext
|
|
201
215
|
* @param {string} pendingStepId
|
|
202
|
-
* @param {
|
|
216
|
+
* @param {string[]} parendIds
|
|
203
217
|
* @param {Object.<string, any>} [additionalAttributes={}] - Shared attributes stored for every step in AwaitingMultipleStepByPending.
|
|
204
218
|
* The same object is applied to all steps (caller cannot know the generated UUIDs beforehand).
|
|
205
219
|
* @returns {Promise<string[]>} The list of awaiting step IDs created.
|
|
@@ -207,8 +221,7 @@ export async function createAwaitingMultipleSteps(
|
|
|
207
221
|
export async function createNewAwaitingMultipleSteps(
|
|
208
222
|
_izContext,
|
|
209
223
|
pendingStepId,
|
|
210
|
-
|
|
211
|
-
prefix = '',
|
|
224
|
+
parendIds,
|
|
212
225
|
additionalAttributes = {}
|
|
213
226
|
) {
|
|
214
227
|
_izContext.logger.debug(
|
|
@@ -220,11 +233,6 @@ export async function createNewAwaitingMultipleSteps(
|
|
|
220
233
|
}
|
|
221
234
|
);
|
|
222
235
|
|
|
223
|
-
const parendIds = Array.from(
|
|
224
|
-
{ length: countAwaitingMultipleSteps },
|
|
225
|
-
() => (prefix ? `${prefix}_` : '') + identifierUuid.generate()
|
|
226
|
-
);
|
|
227
|
-
|
|
228
236
|
const promiseArray = [];
|
|
229
237
|
|
|
230
238
|
for (const parendId of parendIds) {
|