@dereekb/util 10.0.9 → 10.0.11

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.
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [10.0.11](https://github.com/dereekb/dbx-components/compare/v10.0.10-dev...v10.0.11) (2024-01-25)
6
+
7
+
8
+
9
+ ## [10.0.10](https://github.com/dereekb/dbx-components/compare/v10.0.9-dev...v10.0.10) (2024-01-21)
10
+
11
+
12
+
5
13
  ## [10.0.9](https://github.com/dereekb/dbx-components/compare/v10.0.8-dev...v10.0.9) (2024-01-15)
6
14
 
7
15
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "10.0.9",
3
+ "version": "10.0.11",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"
package/index.cjs.js CHANGED
@@ -2213,6 +2213,49 @@ function filterFromIterable(values, fn) {
2213
2213
  }
2214
2214
  return keep;
2215
2215
  }
2216
+ /**
2217
+ * Wraps the input tuple values as an array. The tuples should all be the same length in order to wrap them properly, and the tuple value cannot consist of only arrays of the same length.
2218
+ *
2219
+ * This is used to prevent functions from treating the tuple itself as an array.
2220
+ *
2221
+ * @param input
2222
+ */
2223
+ function wrapTuples(input) {
2224
+ if (Array.isArray(input)) {
2225
+ // check if the first item is an array. Tuples can contain arrays as the first value.
2226
+ if (input.length > 0) {
2227
+ const firstValueInPotentialTupleOrArray = input[0];
2228
+ let inputIsSingleTuple = false;
2229
+ if (Array.isArray(firstValueInPotentialTupleOrArray)) {
2230
+ // if the first nested value is an array then the top-level value may be an array and not a tuple. Check the length of all the other values in the array to see if they have the same length.
2231
+ const expectedLength = firstValueInPotentialTupleOrArray.length;
2232
+ // if it is an array of tuples, all values should be the same length and be arrays. If not an array, then we're looking at a tuple.
2233
+ const firstNonUniformTupleValueIndex = input.findIndex(x => {
2234
+ if (Array.isArray(x)) {
2235
+ return x.length !== expectedLength;
2236
+ } else {
2237
+ return true; // non-array value. The input is a tuple.
2238
+ }
2239
+ });
2240
+
2241
+ inputIsSingleTuple = firstNonUniformTupleValueIndex !== -1;
2242
+ } else {
2243
+ inputIsSingleTuple = true;
2244
+ return [input];
2245
+ }
2246
+ // first value of the tuple could also be an array. If it is, check the other tuples all have the same length.
2247
+ if (inputIsSingleTuple) {
2248
+ return [input];
2249
+ } else {
2250
+ return input;
2251
+ }
2252
+ } else {
2253
+ return input; // is an empty array.
2254
+ }
2255
+ } else {
2256
+ throw new Error('Input is not an array/tuple...');
2257
+ }
2258
+ }
2216
2259
 
2217
2260
  /**
2218
2261
  * Creates a ReadKeysFromFunction using a ReadKeyFunction.
@@ -3880,19 +3923,6 @@ function makeValuesGroupMap(values, groupKeyFn) {
3880
3923
  return map;
3881
3924
  }
3882
3925
 
3883
- /**
3884
- * map utility function for an iterable that maps and places the results into an array.
3885
- *
3886
- * @param values
3887
- * @param fn
3888
- * @returns
3889
- */
3890
- function mapIterable(values, fn) {
3891
- const mapping = [];
3892
- forEachInIterable(values, value => mapping.push(fn(value)));
3893
- return mapping;
3894
- }
3895
-
3896
3926
  /**
3897
3927
  *
3898
3928
  * @param maps
@@ -4013,20 +4043,29 @@ function readMultipleKeysToMap(values, read) {
4013
4043
  */
4014
4044
  function multiValueMapBuilder() {
4015
4045
  const map = new Map();
4046
+ const add = (key, value) => {
4047
+ let array = map.get(key);
4048
+ if (array == null) {
4049
+ array = [];
4050
+ map.set(key, array);
4051
+ }
4052
+ useIterableOrValue(value, x => array.push(x));
4053
+ };
4016
4054
  const builder = {
4017
4055
  map: () => map,
4018
4056
  entries: () => mapToTuples(map),
4019
4057
  tuples: () => expandArrayMapTuples(map),
4020
4058
  delete: key => {
4021
- map.delete(key);
4059
+ return map.delete(key);
4022
4060
  },
4023
- add: (key, value) => {
4024
- let array = map.get(key);
4025
- if (array == null) {
4026
- array = [];
4027
- map.set(key, array);
4028
- }
4029
- useIterableOrValue(value, x => array.push(x));
4061
+ add,
4062
+ addTuples: (key, value) => add(key, wrapTuples(value)),
4063
+ has: key => {
4064
+ return map.has(key);
4065
+ },
4066
+ get: key => {
4067
+ var _a;
4068
+ return (_a = map.get(key)) !== null && _a !== void 0 ? _a : [];
4030
4069
  }
4031
4070
  };
4032
4071
  return builder;
@@ -4996,6 +5035,11 @@ function sortByNumberFunction(readNumberFn) {
4996
5035
  }
4997
5036
  const sortNumbersAscendingFunction = sortByNumberFunction(a => a);
4998
5037
 
5038
+ function transformNumberFunctionConfig(config) {
5039
+ return config ? typeof config === 'function' ? {
5040
+ transform: config
5041
+ } : config : undefined;
5042
+ }
4999
5043
  function transformNumberFunction(config) {
5000
5044
  const transformFunctions = [config.transform];
5001
5045
  if (config.roundToStep) {
@@ -6586,6 +6630,19 @@ function repeatString(string, reapeat) {
6586
6630
  return result;
6587
6631
  }
6588
6632
 
6633
+ /**
6634
+ * map utility function for an iterable that maps and places the results into an array.
6635
+ *
6636
+ * @param values
6637
+ * @param fn
6638
+ * @returns
6639
+ */
6640
+ function mapIterable(values, fn) {
6641
+ const mapping = [];
6642
+ forEachInIterable(values, value => mapping.push(fn(value)));
6643
+ return mapping;
6644
+ }
6645
+
6589
6646
  var isRegExp$1 = isRegexp;
6590
6647
 
6591
6648
  var $TypeError$5 = TypeError;
@@ -6685,6 +6742,11 @@ function stringToUppercaseFunction(input) {
6685
6742
  function stringToLowercaseFunction(input) {
6686
6743
  return input.toLowerCase();
6687
6744
  }
6745
+ function transformStringFunctionConfig(config) {
6746
+ return config ? typeof config === 'function' ? {
6747
+ transform: config
6748
+ } : config : undefined;
6749
+ }
6688
6750
  function transformStringFunction(config) {
6689
6751
  let baseTransform;
6690
6752
  if (config.transform) {
@@ -12058,6 +12120,17 @@ function mapPromiseOrValue(input, mapFn) {
12058
12120
  }
12059
12121
  }
12060
12122
 
12123
+ /**
12124
+ * Wraps another factory with a ToStringFactory function to generate strings from the original factory.
12125
+ *
12126
+ * @param factory
12127
+ * @param toStringFunction
12128
+ * @returns
12129
+ */
12130
+ function stringFactoryFromFactory(factory, toStringFunction) {
12131
+ return () => toStringFunction(factory());
12132
+ }
12133
+
12061
12134
  /**
12062
12135
  * Runs the task using the input config, and returns the value. Is always configured to throw the error if it fails.
12063
12136
  */
@@ -12099,10 +12172,12 @@ function performAsyncTasks(input, taskFn, config = {
12099
12172
  const {
12100
12173
  sequential,
12101
12174
  maxParallelTasks,
12102
- waitBetweenTasks
12175
+ waitBetweenTasks,
12176
+ nonConcurrentTaskKeyFactory
12103
12177
  } = config;
12104
12178
  const taskResults = [];
12105
12179
  yield performTasksInParallelFunction({
12180
+ nonConcurrentTaskKeyFactory,
12106
12181
  taskFactory: (value, i) => _performAsyncTask(value, taskFn, config).then(x => {
12107
12182
  taskResults[i] = x;
12108
12183
  }),
@@ -12209,17 +12284,19 @@ function performTasksInParallel(input, config) {
12209
12284
  * @param config
12210
12285
  */
12211
12286
  function performTasksInParallelFunction(config) {
12287
+ const defaultNonConcurrentTaskKeyFactory = stringFactoryFromFactory(incrementingNumberFactory(), x => x.toString());
12212
12288
  const {
12213
12289
  taskFactory,
12214
12290
  sequential,
12291
+ nonConcurrentTaskKeyFactory,
12215
12292
  maxParallelTasks: inputMaxParallelTasks,
12216
12293
  waitBetweenTasks
12217
12294
  } = config;
12218
12295
  const maxParallelTasks = inputMaxParallelTasks !== null && inputMaxParallelTasks !== void 0 ? inputMaxParallelTasks : sequential ? 1 : undefined;
12219
- if (!maxParallelTasks) {
12220
- // if the max number of parallel tasks is not defined, then run all tasks at once
12296
+ if (!maxParallelTasks && !nonConcurrentTaskKeyFactory) {
12297
+ // if the max number of parallel tasks is not defined, then run all tasks at once, unless there is a nonConcurrentTaskKeyFactory
12221
12298
  return input => __awaiter(this, void 0, void 0, function* () {
12222
- yield Promise.all(input.map((value, i) => taskFactory(value, i)));
12299
+ yield Promise.all(input.map((value, i) => taskFactory(value, i, defaultNonConcurrentTaskKeyFactory())));
12223
12300
  });
12224
12301
  } else {
12225
12302
  return input => {
@@ -12227,29 +12304,99 @@ function performTasksInParallelFunction(config) {
12227
12304
  return Promise.resolve();
12228
12305
  }
12229
12306
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
12230
- const maxPromisesToRunAtOneTime = Math.min(maxParallelTasks, input.length);
12231
- const endIndex = input.length;
12232
- let i = 0;
12307
+ const taskKeyFactory = nonConcurrentTaskKeyFactory !== null && nonConcurrentTaskKeyFactory !== void 0 ? nonConcurrentTaskKeyFactory : defaultNonConcurrentTaskKeyFactory;
12308
+ const maxPromisesToRunAtOneTime = Math.min(maxParallelTasks !== null && maxParallelTasks !== void 0 ? maxParallelTasks : 100, input.length);
12309
+ const incompleteTasks = input.map((x, i) => [x, asArray(taskKeyFactory(x)), i]).reverse(); // reverse to use push/pop
12310
+ let currentRunIndex = 0;
12233
12311
  let finishedParallels = 0;
12234
12312
  let hasEncounteredFailure = false;
12313
+ /**
12314
+ * Set of tasks keys that are currently running.
12315
+ */
12316
+ const currentParellelTaskKeys = new Set();
12317
+ const visitedTaskIndexes = new Set();
12318
+ const waitingConcurrentTasks = multiValueMapBuilder();
12319
+ function getNextTask() {
12320
+ let nextTask = undefined;
12321
+ while (!nextTask) {
12322
+ nextTask = incompleteTasks.pop();
12323
+ if (nextTask != null) {
12324
+ const nextTaskTuple = nextTask;
12325
+ const nextTaskTupleIndex = nextTaskTuple[2];
12326
+ if (visitedTaskIndexes.has(nextTaskTupleIndex)) {
12327
+ // already run. Ignore.
12328
+ nextTask = undefined;
12329
+ } else {
12330
+ const keys = nextTaskTuple[1];
12331
+ const keyOfTaskCurrentlyInUse = setContainsAnyValue(currentParellelTaskKeys, keys);
12332
+ if (keyOfTaskCurrentlyInUse) {
12333
+ keys.forEach(key => waitingConcurrentTasks.addTuples(key, nextTaskTuple)); // add to each key as waiting
12334
+ nextTask = undefined; // clear to continue loop
12335
+ } else {
12336
+ addToSet(currentParellelTaskKeys, keys); // add to the current task keys, exit loop
12337
+ break;
12338
+ }
12339
+ }
12340
+ } else {
12341
+ break; // no tasks remaining, break.
12342
+ }
12343
+ }
12344
+
12345
+ if (nextTask) {
12346
+ // mark to prevent running again/concurrent runs
12347
+ visitedTaskIndexes.add(nextTask[2]);
12348
+ }
12349
+ return nextTask;
12350
+ }
12351
+ function onTaskCompleted(task) {
12352
+ const keys = task[1];
12353
+ const indexesPushed = new Set();
12354
+ keys.forEach(key => {
12355
+ // un-reserve the key from each parallel task
12356
+ currentParellelTaskKeys.delete(key);
12357
+ const waitingForKey = waitingConcurrentTasks.get(key);
12358
+ while (true) {
12359
+ const nextWaitingTask = waitingForKey.shift(); // take from the front to retain unique task order
12360
+ if (nextWaitingTask) {
12361
+ const nextWaitingTaskIndex = nextWaitingTask[2];
12362
+ if (visitedTaskIndexes.has(nextWaitingTaskIndex) || indexesPushed.has(nextWaitingTaskIndex)) {
12363
+ // if the task has already been visited, then don't push back onto incomplete tasks.
12364
+ continue;
12365
+ } else {
12366
+ // push to front for the next dispatch to take for this key
12367
+ incompleteTasks.push(nextWaitingTask);
12368
+ // mark to prevent pushing this one again since it will not get run
12369
+ indexesPushed.add(nextWaitingTaskIndex);
12370
+ break;
12371
+ }
12372
+ } else {
12373
+ break;
12374
+ }
12375
+ }
12376
+ });
12377
+ }
12235
12378
  // start initial promises
12236
12379
  function dispatchNextPromise() {
12237
- const hasNext = i < endIndex;
12238
- if (hasNext && !hasEncounteredFailure) {
12239
- const value = input[i];
12240
- const promise = taskFactory(value, i);
12241
- i += 1;
12242
- promise.then(() => {
12243
- setTimeout(dispatchNextPromise, waitBetweenTasks);
12244
- }, e => {
12245
- hasEncounteredFailure = true;
12246
- reject(e);
12247
- });
12248
- } else if (!hasNext) {
12249
- finishedParallels += 1;
12250
- // only resolve after the last parallel is complete
12251
- if (finishedParallels === maxPromisesToRunAtOneTime) {
12252
- resolve();
12380
+ // if a failure has been encountered then the promise has already been rejected.
12381
+ if (!hasEncounteredFailure) {
12382
+ const nextTask = getNextTask();
12383
+ if (nextTask) {
12384
+ // build/start promise
12385
+ const promise = taskFactory(nextTask[0], currentRunIndex, nextTask[1]);
12386
+ currentRunIndex += 1;
12387
+ promise.then(() => {
12388
+ onTaskCompleted(nextTask);
12389
+ setTimeout(dispatchNextPromise, waitBetweenTasks);
12390
+ }, e => {
12391
+ hasEncounteredFailure = true;
12392
+ reject(e);
12393
+ });
12394
+ } else {
12395
+ finishedParallels += 1;
12396
+ // only resolve after the last parallel is complete
12397
+ if (finishedParallels === maxPromisesToRunAtOneTime) {
12398
+ resolve();
12399
+ }
12253
12400
  }
12254
12401
  }
12255
12402
  }
@@ -14310,6 +14457,7 @@ exports.splitStringAtFirstCharacterOccurenceFunction = splitStringAtFirstCharact
14310
14457
  exports.splitStringAtIndex = splitStringAtIndex;
14311
14458
  exports.stepsFromIndex = stepsFromIndex;
14312
14459
  exports.stepsFromIndexFunction = stepsFromIndexFunction;
14460
+ exports.stringFactoryFromFactory = stringFactoryFromFactory;
14313
14461
  exports.stringToLowercaseFunction = stringToLowercaseFunction;
14314
14462
  exports.stringToUppercaseFunction = stringToUppercaseFunction;
14315
14463
  exports.stringTrimFunction = stringTrimFunction;
@@ -14333,7 +14481,9 @@ exports.toRelativeSlashPathStartType = toRelativeSlashPathStartType;
14333
14481
  exports.toggleInSet = toggleInSet;
14334
14482
  exports.toggleInSetCopy = toggleInSetCopy;
14335
14483
  exports.transformNumberFunction = transformNumberFunction;
14484
+ exports.transformNumberFunctionConfig = transformNumberFunctionConfig;
14336
14485
  exports.transformStringFunction = transformStringFunction;
14486
+ exports.transformStringFunctionConfig = transformStringFunctionConfig;
14337
14487
  exports.transformStrings = transformStrings;
14338
14488
  exports.trimArray = trimArray;
14339
14489
  exports.typedServiceRegistry = typedServiceRegistry;
@@ -14371,5 +14521,6 @@ exports.wrapLatLngPoint = wrapLatLngPoint;
14371
14521
  exports.wrapLngValue = wrapLngValue;
14372
14522
  exports.wrapMapFunctionOutput = wrapMapFunctionOutput;
14373
14523
  exports.wrapNumberFunction = wrapNumberFunction;
14524
+ exports.wrapTuples = wrapTuples;
14374
14525
  exports.wrapUseAsyncFunction = wrapUseAsyncFunction;
14375
14526
  exports.wrapUseFunction = wrapUseFunction;
package/index.esm.js CHANGED
@@ -2244,6 +2244,52 @@ function filterFromIterable(values, fn) {
2244
2244
  return keep;
2245
2245
  }
2246
2246
 
2247
+ /**
2248
+ * Wraps the input tuple values as an array. The tuples should all be the same length in order to wrap them properly, and the tuple value cannot consist of only arrays of the same length.
2249
+ *
2250
+ * This is used to prevent functions from treating the tuple itself as an array.
2251
+ *
2252
+ * @param input
2253
+ */
2254
+ function wrapTuples(input) {
2255
+ if (Array.isArray(input)) {
2256
+ // check if the first item is an array. Tuples can contain arrays as the first value.
2257
+ if (input.length > 0) {
2258
+ const firstValueInPotentialTupleOrArray = input[0];
2259
+ let inputIsSingleTuple = false;
2260
+ if (Array.isArray(firstValueInPotentialTupleOrArray)) {
2261
+ // if the first nested value is an array then the top-level value may be an array and not a tuple. Check the length of all the other values in the array to see if they have the same length.
2262
+ const expectedLength = firstValueInPotentialTupleOrArray.length;
2263
+
2264
+ // if it is an array of tuples, all values should be the same length and be arrays. If not an array, then we're looking at a tuple.
2265
+ const firstNonUniformTupleValueIndex = input.findIndex(x => {
2266
+ if (Array.isArray(x)) {
2267
+ return x.length !== expectedLength;
2268
+ } else {
2269
+ return true; // non-array value. The input is a tuple.
2270
+ }
2271
+ });
2272
+
2273
+ inputIsSingleTuple = firstNonUniformTupleValueIndex !== -1;
2274
+ } else {
2275
+ inputIsSingleTuple = true;
2276
+ return [input];
2277
+ }
2278
+
2279
+ // first value of the tuple could also be an array. If it is, check the other tuples all have the same length.
2280
+ if (inputIsSingleTuple) {
2281
+ return [input];
2282
+ } else {
2283
+ return input;
2284
+ }
2285
+ } else {
2286
+ return input; // is an empty array.
2287
+ }
2288
+ } else {
2289
+ throw new Error('Input is not an array/tuple...');
2290
+ }
2291
+ }
2292
+
2247
2293
  /**
2248
2294
  * A key made up of either a string or number value.
2249
2295
  */
@@ -2256,6 +2302,10 @@ function filterFromIterable(values, fn) {
2256
2302
  * Reads a key from the input object.
2257
2303
  */
2258
2304
 
2305
+ /**
2306
+ * Reads one or more keys from the input object.
2307
+ */
2308
+
2259
2309
  /**
2260
2310
  * Reads multiple keys from the input object.
2261
2311
  */
@@ -4212,19 +4262,6 @@ function makeValuesGroupMap(values, groupKeyFn) {
4212
4262
  return map;
4213
4263
  }
4214
4264
 
4215
- /**
4216
- * map utility function for an iterable that maps and places the results into an array.
4217
- *
4218
- * @param values
4219
- * @param fn
4220
- * @returns
4221
- */
4222
- function mapIterable(values, fn) {
4223
- const mapping = [];
4224
- forEachInIterable(values, value => mapping.push(fn(value)));
4225
- return mapping;
4226
- }
4227
-
4228
4265
  /**
4229
4266
  *
4230
4267
  * @param maps
@@ -4365,20 +4402,29 @@ function readMultipleKeysToMap(values, read) {
4365
4402
  */
4366
4403
  function multiValueMapBuilder() {
4367
4404
  const map = new Map();
4405
+ const add = (key, value) => {
4406
+ let array = map.get(key);
4407
+ if (array == null) {
4408
+ array = [];
4409
+ map.set(key, array);
4410
+ }
4411
+ useIterableOrValue(value, x => array.push(x));
4412
+ };
4368
4413
  const builder = {
4369
4414
  map: () => map,
4370
4415
  entries: () => mapToTuples(map),
4371
4416
  tuples: () => expandArrayMapTuples(map),
4372
4417
  delete: key => {
4373
- map.delete(key);
4418
+ return map.delete(key);
4374
4419
  },
4375
- add: (key, value) => {
4376
- let array = map.get(key);
4377
- if (array == null) {
4378
- array = [];
4379
- map.set(key, array);
4380
- }
4381
- useIterableOrValue(value, x => array.push(x));
4420
+ add,
4421
+ addTuples: (key, value) => add(key, wrapTuples(value)),
4422
+ has: key => {
4423
+ return map.has(key);
4424
+ },
4425
+ get: key => {
4426
+ var _map$get;
4427
+ return (_map$get = map.get(key)) != null ? _map$get : [];
4382
4428
  }
4383
4429
  };
4384
4430
  return builder;
@@ -5707,6 +5753,11 @@ function sortByNumberFunction(readNumberFn) {
5707
5753
  }
5708
5754
  const sortNumbersAscendingFunction = sortByNumberFunction(a => a);
5709
5755
 
5756
+ function transformNumberFunctionConfig(config) {
5757
+ return config ? typeof config === 'function' ? {
5758
+ transform: config
5759
+ } : config : undefined;
5760
+ }
5710
5761
  function transformNumberFunction(config) {
5711
5762
  const transformFunctions = [config.transform];
5712
5763
  if (config.roundToStep) {
@@ -7521,6 +7572,19 @@ function repeatString(string, reapeat) {
7521
7572
  return result;
7522
7573
  }
7523
7574
 
7575
+ /**
7576
+ * map utility function for an iterable that maps and places the results into an array.
7577
+ *
7578
+ * @param values
7579
+ * @param fn
7580
+ * @returns
7581
+ */
7582
+ function mapIterable(values, fn) {
7583
+ const mapping = [];
7584
+ forEachInIterable(values, value => mapping.push(fn(value)));
7585
+ return mapping;
7586
+ }
7587
+
7524
7588
  var isRegExp$1 = isRegexp;
7525
7589
 
7526
7590
  var $TypeError$5 = TypeError;
@@ -7620,6 +7684,11 @@ function stringToUppercaseFunction(input) {
7620
7684
  function stringToLowercaseFunction(input) {
7621
7685
  return input.toLowerCase();
7622
7686
  }
7687
+ function transformStringFunctionConfig(config) {
7688
+ return config ? typeof config === 'function' ? {
7689
+ transform: config
7690
+ } : config : undefined;
7691
+ }
7623
7692
  function transformStringFunction(config) {
7624
7693
  let baseTransform;
7625
7694
  if (config.transform) {
@@ -13854,6 +13923,17 @@ function mapPromiseOrValue(input, mapFn) {
13854
13923
  }
13855
13924
  }
13856
13925
 
13926
+ /**
13927
+ * Wraps another factory with a ToStringFactory function to generate strings from the original factory.
13928
+ *
13929
+ * @param factory
13930
+ * @param toStringFunction
13931
+ * @returns
13932
+ */
13933
+ function stringFactoryFromFactory(factory, toStringFunction) {
13934
+ return () => toStringFunction(factory());
13935
+ }
13936
+
13857
13937
  /**
13858
13938
  * Runs the task using the input config, and returns the value. Is always configured to throw the error if it fails.
13859
13939
  */
@@ -13894,10 +13974,12 @@ async function performAsyncTasks(input, taskFn, config = {
13894
13974
  const {
13895
13975
  sequential,
13896
13976
  maxParallelTasks,
13897
- waitBetweenTasks
13977
+ waitBetweenTasks,
13978
+ nonConcurrentTaskKeyFactory
13898
13979
  } = config;
13899
13980
  const taskResults = [];
13900
13981
  await performTasksInParallelFunction({
13982
+ nonConcurrentTaskKeyFactory,
13901
13983
  taskFactory: (value, i) => _performAsyncTask(value, taskFn, config).then(x => {
13902
13984
  taskResults[i] = x;
13903
13985
  }),
@@ -13979,6 +14061,9 @@ async function _performAsyncTask(value, taskFn, config = {}) {
13979
14061
  }
13980
14062
 
13981
14063
  // MARK: Parallel
14064
+ /**
14065
+ * Used as a key to identify the "group" that a task belongs to to prevent other concurrent tasks from that group from running in parallel when parallel execution is desired.
14066
+ */
13982
14067
 
13983
14068
  /**
13984
14069
  * Function that awaits a promise generate from each of the input values.
@@ -14003,17 +14088,19 @@ function performTasksInParallel(input, config) {
14003
14088
  * @param config
14004
14089
  */
14005
14090
  function performTasksInParallelFunction(config) {
14091
+ const defaultNonConcurrentTaskKeyFactory = stringFactoryFromFactory(incrementingNumberFactory(), x => x.toString());
14006
14092
  const {
14007
14093
  taskFactory,
14008
14094
  sequential,
14095
+ nonConcurrentTaskKeyFactory,
14009
14096
  maxParallelTasks: inputMaxParallelTasks,
14010
14097
  waitBetweenTasks
14011
14098
  } = config;
14012
14099
  const maxParallelTasks = inputMaxParallelTasks != null ? inputMaxParallelTasks : sequential ? 1 : undefined;
14013
- if (!maxParallelTasks) {
14014
- // if the max number of parallel tasks is not defined, then run all tasks at once
14100
+ if (!maxParallelTasks && !nonConcurrentTaskKeyFactory) {
14101
+ // if the max number of parallel tasks is not defined, then run all tasks at once, unless there is a nonConcurrentTaskKeyFactory
14015
14102
  return async input => {
14016
- await Promise.all(input.map((value, i) => taskFactory(value, i)));
14103
+ await Promise.all(input.map((value, i) => taskFactory(value, i, defaultNonConcurrentTaskKeyFactory())));
14017
14104
  };
14018
14105
  } else {
14019
14106
  return input => {
@@ -14021,31 +14108,104 @@ function performTasksInParallelFunction(config) {
14021
14108
  return Promise.resolve();
14022
14109
  }
14023
14110
  return new Promise(async (resolve, reject) => {
14024
- const maxPromisesToRunAtOneTime = Math.min(maxParallelTasks, input.length);
14025
- const endIndex = input.length;
14026
- let i = 0;
14111
+ const taskKeyFactory = nonConcurrentTaskKeyFactory != null ? nonConcurrentTaskKeyFactory : defaultNonConcurrentTaskKeyFactory;
14112
+ const maxPromisesToRunAtOneTime = Math.min(maxParallelTasks != null ? maxParallelTasks : 100, input.length);
14113
+ const incompleteTasks = input.map((x, i) => [x, asArray(taskKeyFactory(x)), i]).reverse(); // reverse to use push/pop
14114
+
14115
+ let currentRunIndex = 0;
14027
14116
  let finishedParallels = 0;
14028
14117
  let hasEncounteredFailure = false;
14029
14118
 
14119
+ /**
14120
+ * Set of tasks keys that are currently running.
14121
+ */
14122
+ const currentParellelTaskKeys = new Set();
14123
+ const visitedTaskIndexes = new Set();
14124
+ const waitingConcurrentTasks = multiValueMapBuilder();
14125
+ function getNextTask() {
14126
+ let nextTask = undefined;
14127
+ while (!nextTask) {
14128
+ nextTask = incompleteTasks.pop();
14129
+ if (nextTask != null) {
14130
+ const nextTaskTuple = nextTask;
14131
+ const nextTaskTupleIndex = nextTaskTuple[2];
14132
+ if (visitedTaskIndexes.has(nextTaskTupleIndex)) {
14133
+ // already run. Ignore.
14134
+ nextTask = undefined;
14135
+ } else {
14136
+ const keys = nextTaskTuple[1];
14137
+ const keyOfTaskCurrentlyInUse = setContainsAnyValue(currentParellelTaskKeys, keys);
14138
+ if (keyOfTaskCurrentlyInUse) {
14139
+ keys.forEach(key => waitingConcurrentTasks.addTuples(key, nextTaskTuple)); // add to each key as waiting
14140
+ nextTask = undefined; // clear to continue loop
14141
+ } else {
14142
+ addToSet(currentParellelTaskKeys, keys); // add to the current task keys, exit loop
14143
+ break;
14144
+ }
14145
+ }
14146
+ } else {
14147
+ break; // no tasks remaining, break.
14148
+ }
14149
+ }
14150
+
14151
+ if (nextTask) {
14152
+ // mark to prevent running again/concurrent runs
14153
+ visitedTaskIndexes.add(nextTask[2]);
14154
+ }
14155
+ return nextTask;
14156
+ }
14157
+ function onTaskCompleted(task) {
14158
+ const keys = task[1];
14159
+ const indexesPushed = new Set();
14160
+ keys.forEach(key => {
14161
+ // un-reserve the key from each parallel task
14162
+ currentParellelTaskKeys.delete(key);
14163
+ const waitingForKey = waitingConcurrentTasks.get(key);
14164
+ while (true) {
14165
+ const nextWaitingTask = waitingForKey.shift(); // take from the front to retain unique task order
14166
+
14167
+ if (nextWaitingTask) {
14168
+ const nextWaitingTaskIndex = nextWaitingTask[2];
14169
+ if (visitedTaskIndexes.has(nextWaitingTaskIndex) || indexesPushed.has(nextWaitingTaskIndex)) {
14170
+ // if the task has already been visited, then don't push back onto incomplete tasks.
14171
+ continue;
14172
+ } else {
14173
+ // push to front for the next dispatch to take for this key
14174
+ incompleteTasks.push(nextWaitingTask);
14175
+ // mark to prevent pushing this one again since it will not get run
14176
+ indexesPushed.add(nextWaitingTaskIndex);
14177
+ break;
14178
+ }
14179
+ } else {
14180
+ break;
14181
+ }
14182
+ }
14183
+ });
14184
+ }
14185
+
14030
14186
  // start initial promises
14031
14187
  function dispatchNextPromise() {
14032
- const hasNext = i < endIndex;
14033
- if (hasNext && !hasEncounteredFailure) {
14034
- const value = input[i];
14035
- const promise = taskFactory(value, i);
14036
- i += 1;
14037
- promise.then(() => {
14038
- setTimeout(dispatchNextPromise, waitBetweenTasks);
14039
- }, e => {
14040
- hasEncounteredFailure = true;
14041
- reject(e);
14042
- });
14043
- } else if (!hasNext) {
14044
- finishedParallels += 1;
14045
-
14046
- // only resolve after the last parallel is complete
14047
- if (finishedParallels === maxPromisesToRunAtOneTime) {
14048
- resolve();
14188
+ // if a failure has been encountered then the promise has already been rejected.
14189
+ if (!hasEncounteredFailure) {
14190
+ const nextTask = getNextTask();
14191
+ if (nextTask) {
14192
+ // build/start promise
14193
+ const promise = taskFactory(nextTask[0], currentRunIndex, nextTask[1]);
14194
+ currentRunIndex += 1;
14195
+ promise.then(() => {
14196
+ onTaskCompleted(nextTask);
14197
+ setTimeout(dispatchNextPromise, waitBetweenTasks);
14198
+ }, e => {
14199
+ hasEncounteredFailure = true;
14200
+ reject(e);
14201
+ });
14202
+ } else {
14203
+ finishedParallels += 1;
14204
+
14205
+ // only resolve after the last parallel is complete
14206
+ if (finishedParallels === maxPromisesToRunAtOneTime) {
14207
+ resolve();
14208
+ }
14049
14209
  }
14050
14210
  }
14051
14211
  }
@@ -15740,4 +15900,4 @@ async function iterateFilteredPages(inputPage, loadFn, iterFn) {
15740
15900
  return count;
15741
15901
  }
15742
15902
 
15743
- export { ALL_DOUBLE_SLASHES_REGEX, ALL_SLASHES_REGEX, ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX, ASSERTION_ERROR_CODE, ASSERTION_HANDLER, AUTH_ADMIN_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ROLE_CLAIMS_DEFAULT_CLAIM_VALUE, AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE, AUTH_TOS_SIGNED_ROLE, AUTH_USER_ROLE, AbstractUniqueModel, Assert, AssertMax, AssertMin, AssertionError, AssertionIssueHandler, BooleanKeyArrayUtilityInstance, BooleanStringKeyArrayUtilityInstance, CATCH_ALL_HANDLE_RESULT_KEY, CUT_VALUE_TO_ZERO_PRECISION, DATE_NOW_VALUE, DEFAULT_LAT_LNG_STRING_VALUE, DEFAULT_RANDOM_EMAIL_FACTORY_CONFIG, DEFAULT_RANDOM_PHONE_NUMBER_FACTORY_CONFIG, DEFAULT_READABLE_ERROR_CODE, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT, DEFAULT_UNKNOWN_MODEL_TYPE_STRING, DOLLAR_AMOUNT_PRECISION, DOLLAR_AMOUNT_STRING_REGEX, DataDoesNotExistError, DataIsExpiredError, Day, DestroyFunctionObject, E164PHONE_NUMBER_REGEX, E164PHONE_NUMBER_WITH_EXTENSION_REGEX, E164PHONE_NUMBER_WITH_OPTIONAL_EXTENSION_REGEX, FINAL_PAGE, FIRST_PAGE, FRACTIONAL_HOURS_PRECISION_FUNCTION, FullStorageObject, HAS_WEBSITE_DOMAIN_NAME_REGEX, HOURS_IN_DAY, HTTP_OR_HTTPS_REGEX, HashSet, ISO8601_DAY_STRING_REGEX, ISO8601_DAY_STRING_START_REGEX, ISO_8601_DATE_STRING_REGEX, KeyValueTypleValueFilter, LAT_LNG_PATTERN, LAT_LNG_PATTERN_MAX_PRECISION, LAT_LONG_100KM_PRECISION, LAT_LONG_100M_PRECISION, LAT_LONG_10CM_PRECISION, LAT_LONG_10KM_PRECISION, LAT_LONG_10M_PRECISION, LAT_LONG_1CM_PRECISION, LAT_LONG_1KM_PRECISION, LAT_LONG_1MM_PRECISION, LAT_LONG_1M_PRECISION, LAT_LONG_GRAINS_OF_SAND_PRECISION, LEADING_SLASHES_REGEX, MAP_IDENTITY, MAX_BITWISE_SET_SIZE, MAX_LATITUDE_VALUE, MAX_LONGITUDE_VALUE, MINUTES_IN_DAY, MINUTES_IN_HOUR, MIN_LATITUDE_VALUE, MIN_LONGITUDE_VALUE, MONTH_DAY_SLASH_DATE_STRING_REGEX, MS_IN_DAY, MS_IN_HOUR, MS_IN_MINUTE, MS_IN_SECOND, MemoryStorageInstance, ModelRelationUtility, NOOP_MODIFIER, PHONE_EXTENSION_NUMBER_REGEX, PRIMATIVE_KEY_DENCODER_VALUE, PageCalculator, PropertyDescriptorUtility, REGEX_SPECIAL_CHARACTERS, REGEX_SPECIAL_CHARACTERS_SET, RelationChange, SECONDS_IN_MINUTE, SHARED_MEMORY_STORAGE, SLASH_PATH_FILE_TYPE_SEPARATOR, SLASH_PATH_SEPARATOR, SORT_VALUE_EQUAL, SORT_VALUE_GREATER_THAN, SORT_VALUE_LESS_THAN, ServerErrorResponse, SetDeltaChange, SimpleStorageObject, StorageObject, StorageObjectUtility, StoredDataError, SyncState, TOTAL_LATITUDE_RANGE, TOTAL_LONGITUDE_RANGE, TOTAL_SPAN_OF_LONGITUDE, TRAILING_FILE_TYPE_SEPARATORS_REGEX, TRAILING_SLASHES_REGEX, TimeAM, TypedServiceRegistryInstance, UNLOADED_PAGE, US_STATE_CODE_STRING_REGEX, UTC_DATE_STRING_REGEX, UTC_TIMEZONE_STRING, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, UnauthorizedServerErrorResponse, WEB_PROTOCOL_PREFIX_REGEX, ZIP_CODE_STRING_REGEX, addHttpToUrl, addLatLngPoints, addModifiers, addPlusPrefixToNumber, addPrefix, addPrefixFunction, addSuffix, addSuffixFunction, addToSet, addToSetCopy, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, applyBestFit, applyToMultipleFields, areEqualContext, areEqualPOJOValues, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asNumber, asObjectCopyFactory, asPromise, asSet, assignValuesToPOJO, assignValuesToPOJOFunction, authClaims, authRoleClaimsService, authRolesSetHasRoles, baseWebsiteUrl, batch, batchCalc, bitwiseObjectDencoder, bitwiseObjectEncoder, bitwiseObjectdecoder, bitwiseSetDecoder, bitwiseSetDencoder, booleanFactory, boundNumber, boundNumberFunction, boundToRectangle, build, cachedGetter, capLatValue, capitalizeFirstLetter, caseInsensitiveFilterByIndexOfDecisionFactory, caseInsensitiveString, catchAllHandlerKey, chainMapFunction, chainMapSameFunctions, coerceToEmailParticipants, combineMaps, compareEqualityWithValueFromItemsFunction, compareEqualityWithValueFromItemsFunctionFactory, compareFnOrder, computeNextFractionalHour, computeNextFreeIndexFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromLogicalDate, dayOfWeek, daysOfWeekArray, daysOfWeekFromEnabledDays, daysOfWeekNameFunction, daysOfWeekNameMap, decisionFunction, decodeHashedValues, decodeHashedValuesWithDecodeMap, decodeModelKeyTypePair, defaultFilterFromPOJOFunctionNoCopy, defaultForwardFunctionFactory, defaultLatLngPoint, defaultLatLngString, dencodeBitwiseSet, diffLatLngBoundPoints, diffLatLngPoints, dollarAmountString, e164PhoneNumberExtensionPair, e164PhoneNumberFromE164PhoneNumberExtensionPair, enabledDaysFromDaysOfWeek, encodeBitwiseSet, encodeModelKeyTypePair, errorMessageContainsString, errorMessageContainsStringFunction, escapeStringForRegex, excludeValues, excludeValuesFromArray, excludeValuesFromSet, existsInIterable, expandArrayMapTuples, expandArrayValueTuples, expandFlattenTreeFunction, expandIndexSet, expandTreeFunction, expandTrees, extendLatLngBound, filterAndMapFunction, filterEmptyValues, filterFalsyAndEmptyValues, filterFromIterable, filterFromPOJO, filterFromPOJOFunction, filterKeyValueTupleFunction, filterKeyValueTuples, filterKeyValueTuplesFunction, filterKeyValueTuplesInputToFilter, filterMaybeValues, filterNullAndUndefinedValues, filterOnlyUndefinedValues, filterUndefinedValues, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findFirstCharacterOccurence, findInIterable, findIndexOfFirstDuplicateValue, findItemsByIndex, findNext, findPOJOKeys, findPOJOKeysFunction, findStringsRegexString, findToIndexSet, findValuesFrom, firstAndLastCharacterOccurrence, firstAndLastValue, firstValue, firstValueFromIterable, fitToIndexRangeFunction, fixExtraQueryParameters, fixMultiSlashesInSlashPath, flattenArray, flattenArrayOrValueArray, flattenArrayToSet, flattenArrayUnique, flattenArrayUniqueCaseInsensitiveStrings, flattenTree, flattenTreeToArray, flattenTreeToArrayFunction, flattenTrees, forEachInIterable, forEachKeyValue, forEachKeyValueOnPOJOFunction, forEachWithArray, forwardFunction, fractionalHoursToMinutes, generateIfDoesNotExist, getArrayNextIndex, getDayOffset, getDayTomorrow, getDayYesterday, getDaysOfWeekNames, getFunctionType, getNextDay, getNextPageNumber, getOverlappingRectangle, getPageNumber, getPreviousDay, getValueFromGetter, groupValues, handlerBindAccessor, handlerConfigurerFactory, handlerFactory, handlerMappedSetFunction, handlerMappedSetFunctionFactory, handlerSetFunction, hasDifferentStringsNoCase, hasDifferentValues, hasHttpPrefix, hasNonNullValue, hasSameTimezone, hasSameValues, hasValueFunction, hasValueOrNotEmpty, hasValueOrNotEmptyObject, hasWebsiteDomain, hashSetForIndexed, hourToFractionalHour, idBatchFactory, incrementingNumberFactory, indexDeltaGroup, indexDeltaGroupFunction, indexRange, indexRangeCheckFunction, indexRangeCheckReaderFunction, indexRangeForArray, indexRangeOverlapsIndexRange, indexRangeOverlapsIndexRangeFunction, indexRangeReaderPairFactory, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEvenNumber, isFalseBooleanKeyArray, isFinalPage, isGetter, isISO8601DateString, isISO8601DayString, isISO8601DayStringStart, isInAllowedDaysOfWeekSet, isInNumberBoundFunction, isInSetDecisionFunction, isIndexNumberInIndexRange, isIndexNumberInIndexRangeFunction, isIndexRangeInIndexRange, isIndexRangeInIndexRangeFunction, isIterable, isLatLngBound, isLatLngBoundWithinLatLngBound, isLatLngPoint, isLatLngPointWithinLatLngBound, isLatLngString, isLogicalDateStringCode, isMapIdentityFunction, isMaybeNot, isMaybeNotOrTrue, isMaybeSo, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStringOrTrue, isTrueBooleanKeyArray, isUTCDateString, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, lastValue, latLngBound, latLngBoundCenterPoint, latLngBoundEastBound, latLngBoundFromInput, latLngBoundFullyWrapsMap, latLngBoundFunction, latLngBoundNorthBound, latLngBoundNorthEastPoint, latLngBoundNorthWestPoint, latLngBoundOverlapsLatLngBound, latLngBoundSouthBound, latLngBoundSouthEastPoint, latLngBoundSouthWestPoint, latLngBoundStrictlyWrapsMap, latLngBoundTuple, latLngBoundTupleFunction, latLngBoundWestBound, latLngBoundWrapsMap, latLngDataPointFunction, latLngPoint, latLngPointFromString, latLngPointFunction, latLngPointPrecisionFunction, latLngString, latLngStringFunction, latLngTuple, latLngTupleFunction, limitArray, lonLatTuple, lowercaseFirstLetter, mailToUrlString, makeBestFit, makeCopyModelFieldFunction, makeDateMonthForMonthOfYear, makeGetter, makeHandler, makeHashDecodeMap, makeKeyPairs, makeModelConversionFieldValuesFunction, makeModelMap, makeModelMapFunctions, makeMultiModelKeyMap, makeValuesGroupMap, makeWithFactory, makeWithFactoryInput, mapArrayFunction, mapFunctionOutput, mapFunctionOutputPair, mapGetter, mapGetterFactory, mapIdentityFunction, mapIterable, mapKeysIntersectionObjectToArray, mapMaybeFunction, mapObjectMap, mapObjectMapFunction, mapObjectToTargetObject, mapPromiseOrValue, mapToObject, mapToTuples, mapValuesToSet, mappedUseAsyncFunction, mappedUseFunction, mapsHaveSameKeys, maybeMergeModelModifiers, maybeMergeModifiers, maybeModifierMapToFunction, maybeSet, mergeArrayIntoArray, mergeArrayOrValueIntoArray, mergeArrays, mergeArraysIntoArray, mergeFilterFunctions, mergeIntoArray, mergeModifiers, mergeObjects, mergeObjectsFunction, mergeSlashPaths, messageFromError, minAndMaxFunction, minAndMaxIndex, minAndMaxIndexFunction, minAndMaxIndexItemsFunction, minAndMaxNumber, minutesToFractionalHours, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksInParallel, performTasksInParallelFunction, pickOneRandomly, poll, primativeKeyDencoder, primativeKeyDencoderMap, primativeKeyStringDencoder, primativeValuesDelta, promiseReference, protectedFactory, pushArrayItemsIntoArray, pushElementOntoArray, pushItemOrArrayItemsIntoArray, randomArrayFactory, randomArrayIndex, randomBoolean, randomEmailFactory, randomFromArrayFactory, randomLatLngFactory, randomLatLngFromCenterFactory, randomNumber, randomNumberFactory, randomPhoneNumberFactory, randomPickFactory, range, rangedIndexedValuesArrayAccessorFactory, rangedIndexedValuesArrayAccessorInfoFactory, readBooleanKeySafetyWrap, readDomainFromEmailAddress, readDomainsFromEmailAddresses, readEmailDomainFromUrlOrEmailAddress, readIndexNumber, readKeysFrom, readKeysFromFilterUniqueFunctionAdditionalKeys, readKeysFromFilterUniqueFunctionAdditionalKeysInput, readKeysFunction, readKeysSetFrom, readKeysSetFunction, readKeysToMap, readModelKey, readModelKeyFromObject, readModelKeys, readModelKeysFromObjects, readMultipleKeysToMap, readUniqueModelKey, readableError, readableStreamToBase64, readableStreamToBuffer, readableStreamToStringFunction, rectangleOverlapsRectangle, reduceBooleansFn, reduceBooleansWithAnd, reduceBooleansWithAndFn, reduceBooleansWithOr, reduceBooleansWithOrFn, reduceNumbers, reduceNumbersFn, reduceNumbersWithAdd, reduceNumbersWithAddFn, reduceNumbersWithMax, reduceNumbersWithMaxFn, reduceNumbersWithMin, reduceNumbersWithMinFn, removeByKeyFromBooleanKeyArray, removeCharactersAfterFirstCharacterOccurence, removeCharactersAfterFirstCharacterOccurenceFunction, removeExtensionFromPhoneNumber, removeFromBooleanKeyArray, removeFromSet, removeFromSetCopy, removeHttpFromUrl, removeModelsWithKey, removeModelsWithSameKey, removeModifiers, removeTrailingFileTypeSeparators, removeTrailingSlashes, removeWebProtocolPrefix, repeatString, replaceCharacterAtIndexIf, replaceCharacterAtIndexWith, replaceInvalidFilePathTypeSeparatorsInSlashPath, replaceInvalidFilePathTypeSeparatorsInSlashPathFunction, replaceLastCharacterIf, replaceLastCharacterIfIsFunction, replaceMultipleFilePathsInSlashPath, replaceStringsFunction, requireModelKey, restoreOrder, restoreOrderWithValues, reverseCompareFn, roundNumberToStepFunction, roundNumberUpToStep, roundToPrecision, roundToPrecisionFunction, roundingFunction, runAsyncTaskForValue, runAsyncTasksForValues, safeCompareEquality, safeEqualityComparatorFunction, safeFindBestIndexMatch, searchStringFilterFunction, separateValues, separateValuesToSets, serverError, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, setDeltaChangeKeys, setDeltaFunction, setHasValueFunction, setIncludes, setIncludesFunction, setKeysOnMap, setWebProtocolPrefix, setsAreEquivalent, simpleSortValuesFunctionWithSortRef, slashPathFactory, slashPathInvalidError, slashPathName, slashPathParts, slashPathStartTypeFactory, slashPathType, slashPathValidationFactory, sliceIndexRangeFunction, sortAscendingIndexNumberRefFunction, sortByIndexAscendingCompareFunction, sortByIndexRangeAscendingCompareFunction, sortByLabelFunction, sortByNumberFunction, sortByStringFunction, sortCompareNumberFunction, sortNumbersAscendingFunction, sortValues, sortValuesFunctionOrMapIdentityWithSortRef, sortValuesFunctionWithSortRef, spaceSeparatedCssClasses, splitCommaSeparatedString, splitCommaSeparatedStringToSet, splitJoinNameString, splitJoinRemainder, splitStringAtFirstCharacterOccurence, splitStringAtFirstCharacterOccurenceFunction, splitStringAtIndex, stepsFromIndex, stepsFromIndexFunction, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, throwKeyIsRequired, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, transformNumberFunction, transformStringFunction, transformStrings, trimArray, typedServiceRegistry, unique, uniqueCaseInsensitiveStrings, uniqueCaseInsensitiveStringsSet, uniqueKeys, uniqueModels, unitedStatesAddressString, urlWithoutParameters, useAsync, useCallback, useContextFunction, useIterableOrValue, useModelOrKey, usePromise, useValue, validLatLngPoint, validLatLngPointFunction, valueAtIndex, valuesAreBothNullishOrEquivalent, valuesFromPOJO, valuesFromPOJOFunction, vectorMinimumSizeResizeFunction, vectorsAreEqual, waitForMs, websiteDomainAndPathPair, websiteDomainAndPathPairFromWebsiteUrl, websitePathAndQueryPair, websitePathFromWebsiteDomainAndPath, websitePathFromWebsiteUrl, websiteUrlFromPaths, wrapIndexRangeFunction, wrapLatLngPoint, wrapLngValue, wrapMapFunctionOutput, wrapNumberFunction, wrapUseAsyncFunction, wrapUseFunction };
15903
+ export { ALL_DOUBLE_SLASHES_REGEX, ALL_SLASHES_REGEX, ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX, ASSERTION_ERROR_CODE, ASSERTION_HANDLER, AUTH_ADMIN_ROLE, AUTH_ONBOARDED_ROLE, AUTH_ROLE_CLAIMS_DEFAULT_CLAIM_VALUE, AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE, AUTH_TOS_SIGNED_ROLE, AUTH_USER_ROLE, AbstractUniqueModel, Assert, AssertMax, AssertMin, AssertionError, AssertionIssueHandler, BooleanKeyArrayUtilityInstance, BooleanStringKeyArrayUtilityInstance, CATCH_ALL_HANDLE_RESULT_KEY, CUT_VALUE_TO_ZERO_PRECISION, DATE_NOW_VALUE, DEFAULT_LAT_LNG_STRING_VALUE, DEFAULT_RANDOM_EMAIL_FACTORY_CONFIG, DEFAULT_RANDOM_PHONE_NUMBER_FACTORY_CONFIG, DEFAULT_READABLE_ERROR_CODE, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS, DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT, DEFAULT_UNKNOWN_MODEL_TYPE_STRING, DOLLAR_AMOUNT_PRECISION, DOLLAR_AMOUNT_STRING_REGEX, DataDoesNotExistError, DataIsExpiredError, Day, DestroyFunctionObject, E164PHONE_NUMBER_REGEX, E164PHONE_NUMBER_WITH_EXTENSION_REGEX, E164PHONE_NUMBER_WITH_OPTIONAL_EXTENSION_REGEX, FINAL_PAGE, FIRST_PAGE, FRACTIONAL_HOURS_PRECISION_FUNCTION, FullStorageObject, HAS_WEBSITE_DOMAIN_NAME_REGEX, HOURS_IN_DAY, HTTP_OR_HTTPS_REGEX, HashSet, ISO8601_DAY_STRING_REGEX, ISO8601_DAY_STRING_START_REGEX, ISO_8601_DATE_STRING_REGEX, KeyValueTypleValueFilter, LAT_LNG_PATTERN, LAT_LNG_PATTERN_MAX_PRECISION, LAT_LONG_100KM_PRECISION, LAT_LONG_100M_PRECISION, LAT_LONG_10CM_PRECISION, LAT_LONG_10KM_PRECISION, LAT_LONG_10M_PRECISION, LAT_LONG_1CM_PRECISION, LAT_LONG_1KM_PRECISION, LAT_LONG_1MM_PRECISION, LAT_LONG_1M_PRECISION, LAT_LONG_GRAINS_OF_SAND_PRECISION, LEADING_SLASHES_REGEX, MAP_IDENTITY, MAX_BITWISE_SET_SIZE, MAX_LATITUDE_VALUE, MAX_LONGITUDE_VALUE, MINUTES_IN_DAY, MINUTES_IN_HOUR, MIN_LATITUDE_VALUE, MIN_LONGITUDE_VALUE, MONTH_DAY_SLASH_DATE_STRING_REGEX, MS_IN_DAY, MS_IN_HOUR, MS_IN_MINUTE, MS_IN_SECOND, MemoryStorageInstance, ModelRelationUtility, NOOP_MODIFIER, PHONE_EXTENSION_NUMBER_REGEX, PRIMATIVE_KEY_DENCODER_VALUE, PageCalculator, PropertyDescriptorUtility, REGEX_SPECIAL_CHARACTERS, REGEX_SPECIAL_CHARACTERS_SET, RelationChange, SECONDS_IN_MINUTE, SHARED_MEMORY_STORAGE, SLASH_PATH_FILE_TYPE_SEPARATOR, SLASH_PATH_SEPARATOR, SORT_VALUE_EQUAL, SORT_VALUE_GREATER_THAN, SORT_VALUE_LESS_THAN, ServerErrorResponse, SetDeltaChange, SimpleStorageObject, StorageObject, StorageObjectUtility, StoredDataError, SyncState, TOTAL_LATITUDE_RANGE, TOTAL_LONGITUDE_RANGE, TOTAL_SPAN_OF_LONGITUDE, TRAILING_FILE_TYPE_SEPARATORS_REGEX, TRAILING_SLASHES_REGEX, TimeAM, TypedServiceRegistryInstance, UNLOADED_PAGE, US_STATE_CODE_STRING_REGEX, UTC_DATE_STRING_REGEX, UTC_TIMEZONE_STRING, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, UnauthorizedServerErrorResponse, WEB_PROTOCOL_PREFIX_REGEX, ZIP_CODE_STRING_REGEX, addHttpToUrl, addLatLngPoints, addModifiers, addPlusPrefixToNumber, addPrefix, addPrefixFunction, addSuffix, addSuffixFunction, addToSet, addToSetCopy, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, applyBestFit, applyToMultipleFields, areEqualContext, areEqualPOJOValues, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asNumber, asObjectCopyFactory, asPromise, asSet, assignValuesToPOJO, assignValuesToPOJOFunction, authClaims, authRoleClaimsService, authRolesSetHasRoles, baseWebsiteUrl, batch, batchCalc, bitwiseObjectDencoder, bitwiseObjectEncoder, bitwiseObjectdecoder, bitwiseSetDecoder, bitwiseSetDencoder, booleanFactory, boundNumber, boundNumberFunction, boundToRectangle, build, cachedGetter, capLatValue, capitalizeFirstLetter, caseInsensitiveFilterByIndexOfDecisionFactory, caseInsensitiveString, catchAllHandlerKey, chainMapFunction, chainMapSameFunctions, coerceToEmailParticipants, combineMaps, compareEqualityWithValueFromItemsFunction, compareEqualityWithValueFromItemsFunctionFactory, compareFnOrder, computeNextFractionalHour, computeNextFreeIndexFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromLogicalDate, dayOfWeek, daysOfWeekArray, daysOfWeekFromEnabledDays, daysOfWeekNameFunction, daysOfWeekNameMap, decisionFunction, decodeHashedValues, decodeHashedValuesWithDecodeMap, decodeModelKeyTypePair, defaultFilterFromPOJOFunctionNoCopy, defaultForwardFunctionFactory, defaultLatLngPoint, defaultLatLngString, dencodeBitwiseSet, diffLatLngBoundPoints, diffLatLngPoints, dollarAmountString, e164PhoneNumberExtensionPair, e164PhoneNumberFromE164PhoneNumberExtensionPair, enabledDaysFromDaysOfWeek, encodeBitwiseSet, encodeModelKeyTypePair, errorMessageContainsString, errorMessageContainsStringFunction, escapeStringForRegex, excludeValues, excludeValuesFromArray, excludeValuesFromSet, existsInIterable, expandArrayMapTuples, expandArrayValueTuples, expandFlattenTreeFunction, expandIndexSet, expandTreeFunction, expandTrees, extendLatLngBound, filterAndMapFunction, filterEmptyValues, filterFalsyAndEmptyValues, filterFromIterable, filterFromPOJO, filterFromPOJOFunction, filterKeyValueTupleFunction, filterKeyValueTuples, filterKeyValueTuplesFunction, filterKeyValueTuplesInputToFilter, filterMaybeValues, filterNullAndUndefinedValues, filterOnlyUndefinedValues, filterUndefinedValues, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findFirstCharacterOccurence, findInIterable, findIndexOfFirstDuplicateValue, findItemsByIndex, findNext, findPOJOKeys, findPOJOKeysFunction, findStringsRegexString, findToIndexSet, findValuesFrom, firstAndLastCharacterOccurrence, firstAndLastValue, firstValue, firstValueFromIterable, fitToIndexRangeFunction, fixExtraQueryParameters, fixMultiSlashesInSlashPath, flattenArray, flattenArrayOrValueArray, flattenArrayToSet, flattenArrayUnique, flattenArrayUniqueCaseInsensitiveStrings, flattenTree, flattenTreeToArray, flattenTreeToArrayFunction, flattenTrees, forEachInIterable, forEachKeyValue, forEachKeyValueOnPOJOFunction, forEachWithArray, forwardFunction, fractionalHoursToMinutes, generateIfDoesNotExist, getArrayNextIndex, getDayOffset, getDayTomorrow, getDayYesterday, getDaysOfWeekNames, getFunctionType, getNextDay, getNextPageNumber, getOverlappingRectangle, getPageNumber, getPreviousDay, getValueFromGetter, groupValues, handlerBindAccessor, handlerConfigurerFactory, handlerFactory, handlerMappedSetFunction, handlerMappedSetFunctionFactory, handlerSetFunction, hasDifferentStringsNoCase, hasDifferentValues, hasHttpPrefix, hasNonNullValue, hasSameTimezone, hasSameValues, hasValueFunction, hasValueOrNotEmpty, hasValueOrNotEmptyObject, hasWebsiteDomain, hashSetForIndexed, hourToFractionalHour, idBatchFactory, incrementingNumberFactory, indexDeltaGroup, indexDeltaGroupFunction, indexRange, indexRangeCheckFunction, indexRangeCheckReaderFunction, indexRangeForArray, indexRangeOverlapsIndexRange, indexRangeOverlapsIndexRangeFunction, indexRangeReaderPairFactory, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEvenNumber, isFalseBooleanKeyArray, isFinalPage, isGetter, isISO8601DateString, isISO8601DayString, isISO8601DayStringStart, isInAllowedDaysOfWeekSet, isInNumberBoundFunction, isInSetDecisionFunction, isIndexNumberInIndexRange, isIndexNumberInIndexRangeFunction, isIndexRangeInIndexRange, isIndexRangeInIndexRangeFunction, isIterable, isLatLngBound, isLatLngBoundWithinLatLngBound, isLatLngPoint, isLatLngPointWithinLatLngBound, isLatLngString, isLogicalDateStringCode, isMapIdentityFunction, isMaybeNot, isMaybeNotOrTrue, isMaybeSo, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStringOrTrue, isTrueBooleanKeyArray, isUTCDateString, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, lastValue, latLngBound, latLngBoundCenterPoint, latLngBoundEastBound, latLngBoundFromInput, latLngBoundFullyWrapsMap, latLngBoundFunction, latLngBoundNorthBound, latLngBoundNorthEastPoint, latLngBoundNorthWestPoint, latLngBoundOverlapsLatLngBound, latLngBoundSouthBound, latLngBoundSouthEastPoint, latLngBoundSouthWestPoint, latLngBoundStrictlyWrapsMap, latLngBoundTuple, latLngBoundTupleFunction, latLngBoundWestBound, latLngBoundWrapsMap, latLngDataPointFunction, latLngPoint, latLngPointFromString, latLngPointFunction, latLngPointPrecisionFunction, latLngString, latLngStringFunction, latLngTuple, latLngTupleFunction, limitArray, lonLatTuple, lowercaseFirstLetter, mailToUrlString, makeBestFit, makeCopyModelFieldFunction, makeDateMonthForMonthOfYear, makeGetter, makeHandler, makeHashDecodeMap, makeKeyPairs, makeModelConversionFieldValuesFunction, makeModelMap, makeModelMapFunctions, makeMultiModelKeyMap, makeValuesGroupMap, makeWithFactory, makeWithFactoryInput, mapArrayFunction, mapFunctionOutput, mapFunctionOutputPair, mapGetter, mapGetterFactory, mapIdentityFunction, mapIterable, mapKeysIntersectionObjectToArray, mapMaybeFunction, mapObjectMap, mapObjectMapFunction, mapObjectToTargetObject, mapPromiseOrValue, mapToObject, mapToTuples, mapValuesToSet, mappedUseAsyncFunction, mappedUseFunction, mapsHaveSameKeys, maybeMergeModelModifiers, maybeMergeModifiers, maybeModifierMapToFunction, maybeSet, mergeArrayIntoArray, mergeArrayOrValueIntoArray, mergeArrays, mergeArraysIntoArray, mergeFilterFunctions, mergeIntoArray, mergeModifiers, mergeObjects, mergeObjectsFunction, mergeSlashPaths, messageFromError, minAndMaxFunction, minAndMaxIndex, minAndMaxIndexFunction, minAndMaxIndexItemsFunction, minAndMaxNumber, minutesToFractionalHours, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksInParallel, performTasksInParallelFunction, pickOneRandomly, poll, primativeKeyDencoder, primativeKeyDencoderMap, primativeKeyStringDencoder, primativeValuesDelta, promiseReference, protectedFactory, pushArrayItemsIntoArray, pushElementOntoArray, pushItemOrArrayItemsIntoArray, randomArrayFactory, randomArrayIndex, randomBoolean, randomEmailFactory, randomFromArrayFactory, randomLatLngFactory, randomLatLngFromCenterFactory, randomNumber, randomNumberFactory, randomPhoneNumberFactory, randomPickFactory, range, rangedIndexedValuesArrayAccessorFactory, rangedIndexedValuesArrayAccessorInfoFactory, readBooleanKeySafetyWrap, readDomainFromEmailAddress, readDomainsFromEmailAddresses, readEmailDomainFromUrlOrEmailAddress, readIndexNumber, readKeysFrom, readKeysFromFilterUniqueFunctionAdditionalKeys, readKeysFromFilterUniqueFunctionAdditionalKeysInput, readKeysFunction, readKeysSetFrom, readKeysSetFunction, readKeysToMap, readModelKey, readModelKeyFromObject, readModelKeys, readModelKeysFromObjects, readMultipleKeysToMap, readUniqueModelKey, readableError, readableStreamToBase64, readableStreamToBuffer, readableStreamToStringFunction, rectangleOverlapsRectangle, reduceBooleansFn, reduceBooleansWithAnd, reduceBooleansWithAndFn, reduceBooleansWithOr, reduceBooleansWithOrFn, reduceNumbers, reduceNumbersFn, reduceNumbersWithAdd, reduceNumbersWithAddFn, reduceNumbersWithMax, reduceNumbersWithMaxFn, reduceNumbersWithMin, reduceNumbersWithMinFn, removeByKeyFromBooleanKeyArray, removeCharactersAfterFirstCharacterOccurence, removeCharactersAfterFirstCharacterOccurenceFunction, removeExtensionFromPhoneNumber, removeFromBooleanKeyArray, removeFromSet, removeFromSetCopy, removeHttpFromUrl, removeModelsWithKey, removeModelsWithSameKey, removeModifiers, removeTrailingFileTypeSeparators, removeTrailingSlashes, removeWebProtocolPrefix, repeatString, replaceCharacterAtIndexIf, replaceCharacterAtIndexWith, replaceInvalidFilePathTypeSeparatorsInSlashPath, replaceInvalidFilePathTypeSeparatorsInSlashPathFunction, replaceLastCharacterIf, replaceLastCharacterIfIsFunction, replaceMultipleFilePathsInSlashPath, replaceStringsFunction, requireModelKey, restoreOrder, restoreOrderWithValues, reverseCompareFn, roundNumberToStepFunction, roundNumberUpToStep, roundToPrecision, roundToPrecisionFunction, roundingFunction, runAsyncTaskForValue, runAsyncTasksForValues, safeCompareEquality, safeEqualityComparatorFunction, safeFindBestIndexMatch, searchStringFilterFunction, separateValues, separateValuesToSets, serverError, setContainsAllValues, setContainsAnyValue, setContainsNoneOfValue, setDeltaChangeKeys, setDeltaFunction, setHasValueFunction, setIncludes, setIncludesFunction, setKeysOnMap, setWebProtocolPrefix, setsAreEquivalent, simpleSortValuesFunctionWithSortRef, slashPathFactory, slashPathInvalidError, slashPathName, slashPathParts, slashPathStartTypeFactory, slashPathType, slashPathValidationFactory, sliceIndexRangeFunction, sortAscendingIndexNumberRefFunction, sortByIndexAscendingCompareFunction, sortByIndexRangeAscendingCompareFunction, sortByLabelFunction, sortByNumberFunction, sortByStringFunction, sortCompareNumberFunction, sortNumbersAscendingFunction, sortValues, sortValuesFunctionOrMapIdentityWithSortRef, sortValuesFunctionWithSortRef, spaceSeparatedCssClasses, splitCommaSeparatedString, splitCommaSeparatedStringToSet, splitJoinNameString, splitJoinRemainder, splitStringAtFirstCharacterOccurence, splitStringAtFirstCharacterOccurenceFunction, splitStringAtIndex, stepsFromIndex, stepsFromIndexFunction, stringFactoryFromFactory, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, throwKeyIsRequired, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, transformNumberFunction, transformNumberFunctionConfig, transformStringFunction, transformStringFunctionConfig, transformStrings, trimArray, typedServiceRegistry, unique, uniqueCaseInsensitiveStrings, uniqueCaseInsensitiveStringsSet, uniqueKeys, uniqueModels, unitedStatesAddressString, urlWithoutParameters, useAsync, useCallback, useContextFunction, useIterableOrValue, useModelOrKey, usePromise, useValue, validLatLngPoint, validLatLngPointFunction, valueAtIndex, valuesAreBothNullishOrEquivalent, valuesFromPOJO, valuesFromPOJOFunction, vectorMinimumSizeResizeFunction, vectorsAreEqual, waitForMs, websiteDomainAndPathPair, websiteDomainAndPathPairFromWebsiteUrl, websitePathAndQueryPair, websitePathFromWebsiteDomainAndPath, websitePathFromWebsiteUrl, websiteUrlFromPaths, wrapIndexRangeFunction, wrapLatLngPoint, wrapLngValue, wrapMapFunctionOutput, wrapNumberFunction, wrapTuples, wrapUseAsyncFunction, wrapUseFunction };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "10.0.9",
3
+ "version": "10.0.11",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -79,3 +79,11 @@ export declare function existsInIterable<T>(values: Iterable<T>, fn: DecisionFun
79
79
  * @returns
80
80
  */
81
81
  export declare function filterFromIterable<T>(values: Iterable<T>, fn: DecisionFunction<T>): T[];
82
+ /**
83
+ * Wraps the input tuple values as an array. The tuples should all be the same length in order to wrap them properly, and the tuple value cannot consist of only arrays of the same length.
84
+ *
85
+ * This is used to prevent functions from treating the tuple itself as an array.
86
+ *
87
+ * @param input
88
+ */
89
+ export declare function wrapTuples<T>(input: IterableOrValue<T>): T[];
package/src/lib/key.d.ts CHANGED
@@ -13,6 +13,10 @@ export type FieldOfType<T> = keyof T;
13
13
  * Reads a key from the input object.
14
14
  */
15
15
  export type ReadKeyFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, Maybe<K>>;
16
+ /**
17
+ * Reads one or more keys from the input object.
18
+ */
19
+ export type ReadOneOrMoreKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, ArrayOrValue<K>>;
16
20
  /**
17
21
  * Reads multiple keys from the input object.
18
22
  */
@@ -1,5 +1,5 @@
1
1
  import { type PrimativeKey, type ReadKeyFunction, type ReadMultipleKeysFunction } from '../key';
2
- import { type IterableOrValue } from '../iterable';
2
+ import { type IterableOrValue } from '../iterable/iterable';
3
3
  import { type Maybe } from '../value/maybe.type';
4
4
  /**
5
5
  * Creates a map by reading keys from the input values. Values without a key are ignored.
@@ -46,8 +46,42 @@ export interface MultiValueMapBuilder<T, K extends PrimativeKey = PrimativeKey>
46
46
  map(): MultiValueMap<T, K>;
47
47
  entries(): [Maybe<K>, T[]][];
48
48
  tuples(): [Maybe<K>, T][];
49
- delete(key: Maybe<K>): void;
49
+ /**
50
+ * Deletes all values from the map with the input key.
51
+ *
52
+ * Returns true if a value was deleted.
53
+ *
54
+ * @param key
55
+ */
56
+ delete(key: Maybe<K>): boolean;
57
+ /**
58
+ * Adds the input key/value pair to the map. Use for inserting all Tuple values.
59
+ *
60
+ * @param key
61
+ * @param value
62
+ */
63
+ addTuples(key: Maybe<K>, value: IterableOrValue<T>): void;
64
+ /**
65
+ * Adds the input key/value(s) pair to the map.
66
+ *
67
+ * Use the addTuple() function if adding a single tuple value to the array.
68
+ *
69
+ * @param key
70
+ * @param value
71
+ */
50
72
  add(key: Maybe<K>, value: IterableOrValue<T>): void;
73
+ /**
74
+ * Returns true if the map contains the input key.
75
+ *
76
+ * @param key
77
+ */
78
+ has(key: Maybe<K>): boolean;
79
+ /**
80
+ * Returns all current values for the input key. If no values are found,
81
+ *
82
+ * @param key
83
+ */
84
+ get(key: Maybe<K>): T[];
51
85
  }
52
86
  /**
53
87
  * Creates a new MultiValueMapBuilder
@@ -1,4 +1,5 @@
1
1
  import { type MapFunction } from '../value/map';
2
+ import { type Maybe } from '../value/maybe.type';
2
3
  import { type BoundNumberFunctionConfig } from './bound';
3
4
  import { type NumberPrecision, type RoundNumberToStepFunctionInput } from './round';
4
5
  export type TransformNumberFunctionConfig<N extends number = number> = {
@@ -23,4 +24,6 @@ export interface TransformNumberFunctionConfigRef<N extends number = number> {
23
24
  transform: TransformNumberFunctionConfig<N>;
24
25
  }
25
26
  export type TransformNumberFunction<N extends number = number> = MapFunction<N, N>;
27
+ export type TransformNumberFunctionConfigInput<S extends number = number> = TransformNumberFunctionConfig<S> | TransformNumberFunction<S>;
28
+ export declare function transformNumberFunctionConfig<S extends number = number>(config?: TransformNumberFunctionConfigInput<S>): Maybe<TransformNumberFunctionConfig<S>>;
26
29
  export declare function transformNumberFunction<N extends number = number>(config: TransformNumberFunctionConfig<N>): TransformNumberFunction<N>;
@@ -1,4 +1,5 @@
1
1
  import { type Milliseconds } from '../date/date';
2
+ import { type PrimativeKey, type ReadOneOrMoreKeysFunction } from '../key';
2
3
  import { type IndexNumber } from '../value';
3
4
  import { type Maybe } from '../value/maybe.type';
4
5
  export type RunAsyncTaskForValueConfig<T = unknown> = Omit<PerformAsyncTaskConfig<T>, 'throwError'>;
@@ -47,20 +48,30 @@ export interface PerformAsyncTaskConfig<I = unknown> {
47
48
  */
48
49
  readonly beforeRetry?: (value: I, tryNumber?: number) => void | Promise<void>;
49
50
  }
50
- export interface PerformAsyncTasksConfig<I = unknown> extends PerformAsyncTaskConfig<I>, Omit<PerformTasksInParallelFunctionConfig<I>, 'taskFactory'> {
51
+ export interface PerformAsyncTasksConfig<I = unknown, K extends PrimativeKey = PerformTasksInParallelTaskUniqueKey> extends PerformAsyncTaskConfig<I>, Omit<PerformTasksInParallelFunctionConfig<I, K>, 'taskFactory'> {
51
52
  }
52
53
  /**
53
54
  * Performs the input tasks, and will retry tasks if they fail, up to a certain point.
54
55
  *
55
56
  * This is useful for retrying sections that may experience optimistic concurrency collisions.
56
57
  */
57
- export declare function performAsyncTasks<I, O = unknown>(input: I[], taskFn: PromiseAsyncTaskFn<I, O>, config?: PerformAsyncTasksConfig<I>): Promise<PerformAsyncTasksResult<I, O>>;
58
+ export declare function performAsyncTasks<I, O = unknown, K extends PrimativeKey = PerformTasksInParallelTaskUniqueKey>(input: I[], taskFn: PromiseAsyncTaskFn<I, O>, config?: PerformAsyncTasksConfig<I, K>): Promise<PerformAsyncTasksResult<I, O>>;
58
59
  export declare function performAsyncTask<O>(taskFn: () => Promise<O>, config?: PerformAsyncTaskConfig<0>): Promise<PerformAsyncTaskResult<O>>;
59
- export interface PerformTasksInParallelFunctionConfig<I> {
60
+ /**
61
+ * Used as a key to identify the "group" that a task belongs to to prevent other concurrent tasks from that group from running in parallel when parallel execution is desired.
62
+ */
63
+ export type PerformTasksInParallelTaskUniqueKey = string;
64
+ export interface PerformTasksInParallelFunctionConfig<I, K extends PrimativeKey = PerformTasksInParallelTaskUniqueKey> {
60
65
  /**
61
66
  * Creates a promise from the input.
62
67
  */
63
- readonly taskFactory: (input: I, value: IndexNumber) => Promise<void>;
68
+ readonly taskFactory: (input: I, value: IndexNumber, taskKeys: K[]) => Promise<void>;
69
+ /**
70
+ * This function is used to uniquely identify tasks that may use the same resources to prevent such tasks from running concurrently.
71
+ *
72
+ * When in use the order is not guranteed.
73
+ */
74
+ readonly nonConcurrentTaskKeyFactory?: ReadOneOrMoreKeysFunction<I, K>;
64
75
  /**
65
76
  * Whether or not tasks are performed sequentially or if tasks are all done in "parellel".
66
77
  *
@@ -89,10 +100,10 @@ export type PerformTasksInParallelFunction<I> = (input: I[]) => Promise<void>;
89
100
  * @param config
90
101
  * @returns
91
102
  */
92
- export declare function performTasksInParallel<I>(input: I[], config: PerformTasksInParallelFunctionConfig<I>): Promise<void>;
103
+ export declare function performTasksInParallel<I, K extends PrimativeKey = PerformTasksInParallelTaskUniqueKey>(input: I[], config: PerformTasksInParallelFunctionConfig<I, K>): Promise<void>;
93
104
  /**
94
105
  * Creates a function that performs tasks in parallel.
95
106
  *
96
107
  * @param config
97
108
  */
98
- export declare function performTasksInParallelFunction<I>(config: PerformTasksInParallelFunctionConfig<I>): PerformTasksInParallelFunction<I>;
109
+ export declare function performTasksInParallelFunction<I, K extends PrimativeKey = PerformTasksInParallelTaskUniqueKey>(config: PerformTasksInParallelFunctionConfig<I, K>): PerformTasksInParallelFunction<I>;
@@ -0,0 +1,11 @@
1
+ import { type Factory, type FactoryWithRequiredInput } from '../getter';
2
+ export type StringFactory<K extends string = string> = Factory<K>;
3
+ export type ToStringFunction<T, K extends string = string> = FactoryWithRequiredInput<K, T>;
4
+ /**
5
+ * Wraps another factory with a ToStringFactory function to generate strings from the original factory.
6
+ *
7
+ * @param factory
8
+ * @param toStringFunction
9
+ * @returns
10
+ */
11
+ export declare function stringFactoryFromFactory<T, K extends string = string>(factory: Factory<T>, toStringFunction: ToStringFunction<T, K>): StringFactory<K>;
@@ -1,5 +1,6 @@
1
1
  export * from './char';
2
2
  export * from './dencoder';
3
+ export * from './factory';
3
4
  export * from './html';
4
5
  export * from './password';
5
6
  export * from './string';
@@ -1,4 +1,5 @@
1
1
  import { type MapFunction } from '../value/map';
2
+ import { type Maybe } from '../value/maybe.type';
2
3
  export declare function stringTrimFunction(input: string): string;
3
4
  export declare function stringToUppercaseFunction(input: string): string;
4
5
  export declare function stringToLowercaseFunction(input: string): string;
@@ -24,7 +25,9 @@ export interface TransformStringFunctionConfigRef<S extends string = string> {
24
25
  transform: TransformStringFunctionConfig<S>;
25
26
  }
26
27
  export type TransformStringFunction<S extends string = string> = MapFunction<S, S>;
27
- export declare function transformStringFunction<S extends string = string>(config: TransformStringFunctionConfig): TransformStringFunction<S>;
28
+ export type TransformStringFunctionConfigInput<S extends string = string> = TransformStringFunctionConfig<S> | TransformStringFunction<S>;
29
+ export declare function transformStringFunctionConfig<S extends string = string>(config?: TransformStringFunctionConfigInput<S>): Maybe<TransformStringFunctionConfig<S>>;
30
+ export declare function transformStringFunction<S extends string = string>(config: TransformStringFunctionConfig<S>): TransformStringFunction<S>;
28
31
  export declare function addPrefix(prefix: string, input: string): string;
29
32
  /**
30
33
  * Function that adds a configured prefix to the input string if it does not exist on that string.
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [10.0.11](https://github.com/dereekb/dbx-components/compare/v10.0.10-dev...v10.0.11) (2024-01-25)
6
+
7
+
8
+
9
+ ## [10.0.10](https://github.com/dereekb/dbx-components/compare/v10.0.9-dev...v10.0.10) (2024-01-21)
10
+
11
+
12
+
5
13
  ## [10.0.9](https://github.com/dereekb/dbx-components/compare/v10.0.8-dev...v10.0.9) (2024-01-15)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "10.0.9",
3
+ "version": "10.0.11",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"