@dereekb/util 10.1.30 → 10.2.0

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.
Files changed (45) hide show
  1. package/fetch/LICENSE +21 -0
  2. package/fetch/index.cjs.d.ts +1 -0
  3. package/fetch/index.cjs.js +5480 -0
  4. package/fetch/index.esm.js +5448 -0
  5. package/fetch/package.json +15 -3
  6. package/fetch/src/lib/error.d.ts +7 -0
  7. package/fetch/src/lib/fetch.d.ts +5 -5
  8. package/fetch/src/lib/fetch.page.d.ts +116 -0
  9. package/fetch/src/lib/index.d.ts +1 -0
  10. package/fetch/src/lib/json.d.ts +17 -1
  11. package/index.cjs.js +1421 -1319
  12. package/index.esm.js +1560 -1437
  13. package/package.json +10 -5
  14. package/src/lib/date/date.d.ts +14 -0
  15. package/src/lib/model/model.d.ts +1 -0
  16. package/src/lib/number/round.d.ts +2 -1
  17. package/src/lib/object/object.equal.d.ts +2 -0
  18. package/src/lib/page/page.calculator.d.ts +6 -1
  19. package/src/lib/page/page.d.ts +0 -2
  20. package/src/lib/string/char.d.ts +4 -0
  21. package/src/lib/string/replace.d.ts +29 -1
  22. package/test/CHANGELOG.md +9 -0
  23. package/test/package.json +1 -1
  24. package/test/src/lib/jest.fail.d.ts +22 -3
  25. package/test/src/lib/jest.fail.js +29 -2
  26. package/test/src/lib/jest.fail.js.map +1 -1
  27. package/fetch/CHANGELOG.md +0 -931
  28. package/fetch/src/index.js +0 -5
  29. package/fetch/src/index.js.map +0 -1
  30. package/fetch/src/lib/error.js +0 -31
  31. package/fetch/src/lib/error.js.map +0 -1
  32. package/fetch/src/lib/fetch.js +0 -177
  33. package/fetch/src/lib/fetch.js.map +0 -1
  34. package/fetch/src/lib/fetch.type.js +0 -3
  35. package/fetch/src/lib/fetch.type.js.map +0 -1
  36. package/fetch/src/lib/index.js +0 -11
  37. package/fetch/src/lib/index.js.map +0 -1
  38. package/fetch/src/lib/json.js +0 -80
  39. package/fetch/src/lib/json.js.map +0 -1
  40. package/fetch/src/lib/provider.js +0 -9
  41. package/fetch/src/lib/provider.js.map +0 -1
  42. package/fetch/src/lib/timeout.js +0 -38
  43. package/fetch/src/lib/timeout.js.map +0 -1
  44. package/fetch/src/lib/url.js +0 -102
  45. package/fetch/src/lib/url.js.map +0 -1
package/index.esm.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { symmetricDifference } from 'extra-set';
2
2
  import { BaseError } from 'make-error';
3
- import { isEqual } from 'lodash';
4
3
 
5
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
5
 
@@ -9464,6 +9463,13 @@ function firstAndLastCharacterOccurrence(input, find) {
9464
9463
  };
9465
9464
  }
9466
9465
 
9466
+ /**
9467
+ * Returns true if the input string contains the character (or string) to find.
9468
+ */
9469
+ function stringContains(input, find) {
9470
+ return input.indexOf(find) !== -1;
9471
+ }
9472
+
9467
9473
  /**
9468
9474
  * Function that replaces the last character with the configured replacement string if it is any of the configured values.
9469
9475
  */
@@ -9594,6 +9600,63 @@ function findStringsRegexString(find) {
9594
9600
  return escapedInput.join('|');
9595
9601
  }
9596
9602
 
9603
+ /**
9604
+ * Function that properly "escapes" specific characters in a string.
9605
+ *
9606
+ * How the characters are escaped is determined by the function.
9607
+ */
9608
+
9609
+ /**
9610
+ * Creates an EscapeStringCharactersFunction
9611
+ *
9612
+ * @param config
9613
+ * @returns
9614
+ */
9615
+ function escapeStringCharactersFunction(config) {
9616
+ const {
9617
+ escapeTargets: inputEscapeTargets,
9618
+ escapeCharacter
9619
+ } = config;
9620
+ const escapeTargets = inputEscapeTargets instanceof Set ? inputEscapeTargets : new Set(inputEscapeTargets);
9621
+ return input => {
9622
+ /**
9623
+ * Find index of all occurences in the input to replace/merge together.
9624
+ */
9625
+ const occurrences = findAllCharacterOccurences(escapeTargets, input);
9626
+ let result;
9627
+ switch (occurrences.length) {
9628
+ case 0:
9629
+ result = input;
9630
+ break;
9631
+ case 1:
9632
+ const charToReplace = input[occurrences[0]];
9633
+ result = replaceCharacterAtIndexWith(input, occurrences[0], escapeCharacter(charToReplace)); //Add an escape to the character
9634
+ break;
9635
+ default:
9636
+ const parts = [];
9637
+ const endAt = occurrences.length;
9638
+ let start = 0;
9639
+ let occurrence = 0;
9640
+ for (let i = 0; i < endAt; i += 1) {
9641
+ occurrence = occurrences[i];
9642
+ const char = input[occurrence];
9643
+ const sub = input.substring(start, occurrence);
9644
+ const part = sub + escapeCharacter(char);
9645
+ parts.push(part);
9646
+ start = occurrence + 1;
9647
+ }
9648
+
9649
+ // add in the last substring
9650
+ parts.push(input.substring(start));
9651
+
9652
+ // join all parts together
9653
+ result = parts.join('');
9654
+ break;
9655
+ }
9656
+ return result;
9657
+ };
9658
+ }
9659
+
9597
9660
  /**
9598
9661
  * Escapes the input string to be usable in a Regex value.
9599
9662
  *
@@ -9601,46 +9664,12 @@ function findStringsRegexString(find) {
9601
9664
  *
9602
9665
  * @param input
9603
9666
  */
9604
- function escapeStringForRegex(input) {
9605
- /**
9606
- * index of all occurences in the input to replace/merge together.
9607
- */
9608
- const occurrences = findAllCharacterOccurences(REGEX_SPECIAL_CHARACTERS_SET, input);
9609
- let result;
9610
- function escapeCharacter(char) {
9667
+ const escapeStringForRegex = escapeStringCharactersFunction({
9668
+ escapeTargets: REGEX_SPECIAL_CHARACTERS_SET,
9669
+ escapeCharacter(char) {
9611
9670
  return `\\${char}`;
9612
9671
  }
9613
- switch (occurrences.length) {
9614
- case 0:
9615
- result = input;
9616
- break;
9617
- case 1:
9618
- const charToReplace = input[occurrences[0]];
9619
- result = replaceCharacterAtIndexWith(input, occurrences[0], escapeCharacter(charToReplace)); //Add an escape to the character
9620
- break;
9621
- default:
9622
- const parts = [];
9623
- const endAt = occurrences.length;
9624
- let start = 0;
9625
- let occurrence = 0;
9626
- for (let i = 0; i < endAt; i += 1) {
9627
- occurrence = occurrences[i];
9628
- const char = input[occurrence];
9629
- const sub = input.substring(start, occurrence);
9630
- const part = sub + escapeCharacter(char);
9631
- parts.push(part);
9632
- start = occurrence + 1;
9633
- }
9634
-
9635
- // add in the last substring
9636
- parts.push(input.substring(start));
9637
-
9638
- // join all parts together
9639
- result = parts.join('');
9640
- break;
9641
- }
9642
- return result;
9643
- }
9672
+ });
9644
9673
  function findAllCharacterOccurencesFunction(characterSet) {
9645
9674
  return (input, maxToReturn) => {
9646
9675
  const max = maxToReturn != null ? maxToReturn : Number.MAX_SAFE_INTEGER;
@@ -10988,6 +11017,10 @@ function compareEqualityWithValueFromItemsFunctionFactory(readValues) {
10988
11017
  * The past or future direction.
10989
11018
  */
10990
11019
 
11020
+ /**
11021
+ * Hour, minute, or second as a string.
11022
+ */
11023
+
10991
11024
  /**
10992
11025
  * A valid ISO8601 formatted date string.
10993
11026
  *
@@ -11185,6 +11218,8 @@ function monthDaySlashDateToDateString(slashDate) {
11185
11218
 
11186
11219
  /**
11187
11220
  * Time in seconds (instead of ms) since the epoch.
11221
+ *
11222
+ * Returned by Date.getTime().
11188
11223
  */
11189
11224
 
11190
11225
  /**
@@ -11248,6 +11283,17 @@ function isDate(value) {
11248
11283
  return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
11249
11284
  }
11250
11285
 
11286
+ /**
11287
+ * Returns true if the two input dates are equal.
11288
+ *
11289
+ * @param a
11290
+ * @param b
11291
+ * @returns
11292
+ */
11293
+ function isEqualDate(a, b) {
11294
+ return a.getTime() === b.getTime();
11295
+ }
11296
+
11251
11297
  /**
11252
11298
  * A number that represents hours and rounded to the nearest minute.
11253
11299
  *
@@ -14449,363 +14495,176 @@ function objectIsEmpty(obj) {
14449
14495
  }
14450
14496
 
14451
14497
  /**
14452
- * Performs a deep comparison to check if all values on the input filters are equal.
14453
- */
14454
- function areEqualPOJOValues(a, b) {
14455
- return isEqual(a, b);
14456
- }
14457
-
14458
- // MARK: ObjectFieldEqualityChecker
14459
- /**
14460
- * Configuration for an ObjectFieldEqualityChecker.
14461
- */
14462
-
14463
- /**
14464
- * Field configration for a single field of a ObjectFieldEqualityCheckerConfig.
14498
+ * Values that correspond to each day of the week.
14465
14499
  */
14466
14500
 
14467
14501
  /**
14468
- * Results of an ObjectFieldEqualityChecker.
14502
+ * Returns the day of the week for the input day.
14503
+ *
14504
+ * Equivalent to date.getDay()
14505
+ *
14506
+ * @param date
14507
+ * @returns
14469
14508
  */
14509
+ function dayOfWeek(date) {
14510
+ return date.getDay();
14511
+ }
14470
14512
 
14471
14513
  /**
14472
- * Function used to check if two objects are considered equal.
14514
+ * Decision function that checks whether or not the input DayOfWeek or the DayOfWeek for the input Date is in the set.
14473
14515
  */
14474
14516
 
14475
- function objectFieldEqualityChecker(config) {
14476
- const {
14477
- fields,
14478
- defaultEqualityFunction = (a, b) => a === b
14479
- } = config;
14480
- const _fields = new Map();
14481
- fields.forEach(input => {
14482
- let field;
14483
- if (typeof input === 'object') {
14484
- field = input;
14485
- } else {
14486
- field = {
14487
- fieldName: input,
14488
- isEqual: defaultEqualityFunction
14489
- };
14490
- }
14491
- _fields.set(field.fieldName, field);
14492
- });
14493
- const fn = (a, b) => {
14494
- const equalFields = [];
14495
- const unequalFields = [];
14496
- _fields.forEach((fieldConfig, fieldName) => {
14497
- const {
14498
- isEqual
14499
- } = fieldConfig;
14500
- isEqual(a[fieldName], b[fieldName]) ? equalFields.push(fieldName) : unequalFields.push(fieldName);
14501
- });
14502
- return {
14503
- a,
14504
- b,
14505
- isEqual: unequalFields.length === 0,
14506
- equalFields,
14507
- unequalFields
14508
- };
14509
- };
14510
- fn._fields = _fields;
14511
- return fn;
14512
- }
14513
-
14514
14517
  /**
14515
- * Creates a EqualityComparatorFunction that compares the two input values
14518
+ * Creates a DecisionFunction that checks whether or not the input day or days of
14516
14519
  *
14517
- * @param readKey
14520
+ * @param allowedDaysOfWeek
14518
14521
  * @returns
14519
14522
  */
14520
- function objectKeysEqualityComparatorFunction(readKey) {
14521
- const readKeysSet = readKeysSetFunction(readKey);
14522
- const readKeysArray = readKeysFunction(readKey);
14523
- return safeEqualityComparatorFunction((a, b) => {
14524
- if (a.length === b.length) {
14525
- if (a.length === 0) {
14526
- return true; // both the same/empty arrays
14527
- }
14528
-
14529
- const aKeys = readKeysSet(a);
14530
- const bKeys = readKeysArray(b);
14531
- if (aKeys.size === bKeys.length) {
14532
- return setContainsAllValues(aKeys, bKeys);
14533
- }
14534
- }
14535
- return false;
14523
+ function isInAllowedDaysOfWeekSet(allowedDaysOfWeek) {
14524
+ return isInSetDecisionFunction(allowedDaysOfWeek, x => {
14525
+ return typeof x === 'number' ? x : dayOfWeek(x);
14536
14526
  });
14537
14527
  }
14538
14528
 
14539
14529
  /**
14540
- * Creates a EqualityComparatorFunction that compares the two input values
14530
+ * Returns all days of the week starting from the given day up to the specified number of days.
14541
14531
  *
14542
- * @param readKey
14543
- * @returns
14532
+ * Returns 7 days by default.
14533
+ *
14534
+ * @param startingOn
14544
14535
  */
14545
- function objectKeyEqualityComparatorFunction(readKey) {
14546
- return safeEqualityComparatorFunction((a, b) => readKey(a) === readKey(b));
14536
+ function daysOfWeekArray(startingOn = Day.SUNDAY, maxDays = 7) {
14537
+ const days = [];
14538
+ let day = startingOn;
14539
+ while (days.length < maxDays) {
14540
+ days.push(day);
14541
+ if (day === Day.SATURDAY) {
14542
+ day = Day.SUNDAY;
14543
+ } else {
14544
+ day += 1;
14545
+ }
14546
+ }
14547
+ return days;
14547
14548
  }
14548
14549
 
14549
14550
  /**
14550
- * Used for copying one field from one partial object to a target object.
14551
+ * Enum for the days of the week.
14551
14552
  */
14553
+ let Day = /*#__PURE__*/function (Day) {
14554
+ Day[Day["SUNDAY"] = 0] = "SUNDAY";
14555
+ Day[Day["MONDAY"] = 1] = "MONDAY";
14556
+ Day[Day["TUESDAY"] = 2] = "TUESDAY";
14557
+ Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
14558
+ Day[Day["THURSDAY"] = 4] = "THURSDAY";
14559
+ Day[Day["FRIDAY"] = 5] = "FRIDAY";
14560
+ Day[Day["SATURDAY"] = 6] = "SATURDAY";
14561
+ return Day;
14562
+ }({});
14552
14563
 
14553
- function makeCopyModelFieldFunction(key, inputConfig) {
14554
- const config = inputConfig != null ? inputConfig : {};
14555
- const hasDefault = objectHasKey(config, 'default');
14556
- const defaultValue = config.default;
14557
- return (from, target) => {
14558
- if (objectHasKey(from, key)) {
14559
- var _from$key;
14560
- target[key] = (_from$key = from[key]) != null ? _from$key : defaultValue;
14561
- } else if (hasDefault) {
14562
- target[key] = defaultValue;
14563
- }
14564
- };
14565
- }
14566
-
14567
- // MARK: Model
14568
14564
  /**
14569
- * Type used to declare a sister-type to the generic object.
14565
+ * Object containing the name of every day and whether they're true/false.
14570
14566
  */
14571
14567
 
14572
- function makeModelMapFunctions(fields) {
14573
- const keys = filterKeyValueTuples(fields);
14574
- const conversionsByKey = keys.map(([key, field]) => [key, field]);
14575
- const fromConversions = conversionsByKey.map(([key, configs]) => [key, configs.from]);
14576
- const toConversions = conversionsByKey.map(([key, configs]) => [key, configs.to]);
14577
- const from = makeModelConversionFieldValuesFunction(fromConversions);
14578
- const to = makeModelConversionFieldValuesFunction(toConversions);
14568
+ function enabledDaysFromDaysOfWeek(input) {
14569
+ const set = new Set(input);
14579
14570
  return {
14580
- from,
14581
- to
14571
+ sunday: set.has(Day.SUNDAY),
14572
+ monday: set.has(Day.MONDAY),
14573
+ tuesday: set.has(Day.TUESDAY),
14574
+ wednesday: set.has(Day.WEDNESDAY),
14575
+ thursday: set.has(Day.THURSDAY),
14576
+ friday: set.has(Day.FRIDAY),
14577
+ saturday: set.has(Day.SATURDAY)
14582
14578
  };
14583
14579
  }
14584
-
14580
+ function daysOfWeekFromEnabledDays(input) {
14581
+ const daysOfWeek = [];
14582
+ if (input) {
14583
+ if (input.sunday) {
14584
+ daysOfWeek.push(Day.SUNDAY);
14585
+ }
14586
+ if (input.monday) {
14587
+ daysOfWeek.push(Day.MONDAY);
14588
+ }
14589
+ if (input.tuesday) {
14590
+ daysOfWeek.push(Day.TUESDAY);
14591
+ }
14592
+ if (input.wednesday) {
14593
+ daysOfWeek.push(Day.WEDNESDAY);
14594
+ }
14595
+ if (input.thursday) {
14596
+ daysOfWeek.push(Day.THURSDAY);
14597
+ }
14598
+ if (input.friday) {
14599
+ daysOfWeek.push(Day.FRIDAY);
14600
+ }
14601
+ if (input.saturday) {
14602
+ daysOfWeek.push(Day.SATURDAY);
14603
+ }
14604
+ }
14605
+ return daysOfWeek;
14606
+ }
14585
14607
  /**
14586
- * A model conversion function. Performs a conversion on all non-null values.
14608
+ * Returns an array of strinsg with each day of the week named.
14609
+ *
14610
+ * @returns
14587
14611
  */
14588
-
14589
- function makeModelConversionFieldValuesFunction(fields) {
14590
- return (input, inputTarget, options) => {
14591
- const target = inputTarget != null ? inputTarget : {};
14592
- if (input != null) {
14593
- let targetFields = fields;
14594
-
14595
- // if options are provided, filter down.
14596
- if (options) {
14597
- const fieldsToMap = new Set(findPOJOKeys(input, {
14598
- keysFilter: options.fields,
14599
- valueFilter: options.definedOnly === false ? KeyValueTypleValueFilter.NONE : KeyValueTypleValueFilter.UNDEFINED
14600
- }));
14601
- targetFields = fields.filter(x => fieldsToMap.has(x[0]));
14602
- }
14603
- targetFields.forEach(([key, convert]) => target[key] = convert(input[key]));
14612
+ function getDaysOfWeekNames(sundayFirst = true, transform) {
14613
+ const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
14614
+ const sunday = 'Sunday';
14615
+ let dayOfWeekNames;
14616
+ if (sundayFirst) {
14617
+ dayOfWeekNames = [sunday, ...days];
14618
+ } else {
14619
+ dayOfWeekNames = [...days, sunday];
14620
+ }
14621
+ if (transform != null) {
14622
+ if (transform.abbreviation) {
14623
+ dayOfWeekNames = dayOfWeekNames.map(x => x.slice(0, 3));
14604
14624
  }
14605
- return target;
14606
- };
14607
- }
14608
-
14609
- // MARK: Fields
14610
- /**
14611
- * An object map containing a ModelFieldMapFunctions entry for each key (required and optional) from the generic object.
14612
- */
14613
-
14614
- /**
14615
- * An object map containing a ModelFieldMapFunctionsConfig for each key (required and optional) from the generic object.
14616
- */
14617
-
14618
- function modelFieldConversions(config) {
14619
- return mapObjectMap(config, x => modelFieldMapFunctions(x));
14620
- }
14621
- function modelFieldMapFunctions(config) {
14622
- return {
14623
- from: modelFieldMapFunction(config.from),
14624
- to: modelFieldMapFunction(config.to)
14625
- };
14626
- }
14627
-
14628
- // MARK: Field
14629
- /**
14630
- * ModelFieldMapFunction configuration that can convert a MaybeValue to the target value.
14631
- */
14632
-
14633
- /**
14634
- * ModelFieldMapFunction configuration that handles the MaybeNot case with undefined.
14635
- */
14636
-
14637
- /**
14638
- * Configuration is either a ModelFieldMapMaybeTooConfig or a ModelFieldMapMaybeWithDefaultConfig
14639
- */
14640
-
14641
- /**
14642
- * Creates a ModelFieldMapFunction.
14643
- *
14644
- * @param config
14645
- * @returns
14646
- */
14647
- function modelFieldMapFunction(config) {
14648
- const convert = config.convert;
14649
- const convertMaybe = config.convertMaybe;
14650
- const defaultOutput = config.default;
14651
- const defaultInput = config.defaultInput;
14652
- const hasDefaultInput = defaultInput != null;
14653
- const getDefaultOutput = asGetter(defaultOutput);
14654
- const getDefaultInput = asGetter(defaultInput);
14655
- return input => {
14656
- let result;
14657
- if (isMaybeSo(input)) {
14658
- result = convert(input);
14659
- } else {
14660
- if (convertMaybe) {
14661
- result = convertMaybe(input != null ? input : getDefaultInput());
14662
- } else if (hasDefaultInput) {
14663
- result = convert(getDefaultInput());
14664
- } else {
14665
- result = getDefaultOutput();
14666
- }
14625
+ if (transform.uppercase) {
14626
+ dayOfWeekNames = dayOfWeekNames.map(x => x.toUpperCase());
14667
14627
  }
14668
- return result;
14669
- };
14670
- }
14671
-
14672
- // MARK: Utility
14673
-
14674
- /**
14675
- * Converts the input to a ModelFieldConversions value.
14676
- *
14677
- * @param input
14678
- * @returns
14679
- */
14680
- function toModelFieldConversions(input) {
14681
- var _fieldConversions;
14682
- const conversions = (_fieldConversions = input.fieldConversions) != null ? _fieldConversions : modelFieldConversions(input.fields);
14683
- return conversions;
14684
- }
14685
- function toModelMapFunctions(input) {
14686
- let mapFunctions;
14687
- if (input.mapFunctions != null) {
14688
- mapFunctions = input.mapFunctions;
14689
- } else {
14690
- const conversions = toModelFieldConversions(input);
14691
- mapFunctions = makeModelMapFunctions(conversions);
14692
14628
  }
14693
- return mapFunctions;
14629
+ return dayOfWeekNames;
14694
14630
  }
14695
-
14696
- /**
14697
- * Field conversion that copies the same value across.
14698
- *
14699
- * @param defaultValue
14700
- * @returns
14701
- */
14702
- function copyField(defaultOutput) {
14703
- return {
14704
- from: {
14705
- default: defaultOutput,
14706
- convert: x => x
14707
- },
14708
- to: {
14709
- default: defaultOutput,
14710
- convert: x => x
14711
- }
14712
- };
14631
+ function daysOfWeekNameMap(transform) {
14632
+ const dayOfWeekNames = getDaysOfWeekNames(true, transform);
14633
+ return new Map(dayOfWeekNames.map((x, i) => [i, x]));
14713
14634
  }
14714
-
14715
- function maybeMergeModelModifiers(input) {
14716
- const modifiers = asArray(input);
14717
- const allModifyData = filterMaybeValues(modifiers.map(x => x.modifyData));
14718
- const allModifyModel = filterMaybeValues(modifiers.map(x => x.modifyModel));
14719
- const modifyData = maybeMergeModifiers(allModifyData);
14720
- const modifyModel = maybeMergeModifiers(allModifyModel);
14721
- return {
14722
- modifyData,
14723
- modifyModel
14635
+ function daysOfWeekNameFunction(transform) {
14636
+ const map = daysOfWeekNameMap(transform);
14637
+ return dayOfWeek => {
14638
+ var _map$get;
14639
+ return (_map$get = map.get(dayOfWeek)) != null ? _map$get : 'UNKNOWN';
14724
14640
  };
14725
14641
  }
14726
- function modifyModelMapFunctions(config) {
14727
- const {
14728
- copy,
14729
- copyModel = copy,
14730
- copyData = copy,
14731
- mapFunctions,
14732
- modifiers
14733
- } = config;
14734
- const {
14735
- from,
14736
- to
14737
- } = mapFunctions;
14738
- const {
14739
- modifyData,
14740
- modifyModel
14741
- } = maybeMergeModelModifiers(modifiers);
14742
- const modifyFrom = modifyModelMapFunction(from, modifyData, copyData);
14743
- const modifyTo = modifyModelMapFunction(to, modifyModel, copyModel);
14744
- return {
14745
- from: modifyFrom,
14746
- to: modifyTo
14747
- };
14642
+ function getDayTomorrow(day) {
14643
+ return getNextDay(day, 1);
14748
14644
  }
14749
-
14750
- /**
14751
- * Merges a ModifierFunction with a ModelMapFunction
14752
- *
14753
- * @param mapFn
14754
- * @param modifyModel
14755
- * @param copy
14756
- * @returns
14757
- */
14758
- function modifyModelMapFunction(mapFn, modifyModel, copy = true) {
14759
- return modifyModel ? (input, target, options) => {
14760
- const inputToMap = copy && input != null ? Object.assign({}, input) : input;
14761
- if (inputToMap != null) {
14762
- modifyModel(inputToMap);
14763
- }
14764
- return mapFn(inputToMap, target, options);
14765
- } : mapFn;
14645
+ function getDayYesterday(day) {
14646
+ return getPreviousDay(day, 1);
14766
14647
  }
14767
-
14768
- /**
14769
- * Reads the input stream and encodes the data to a string.
14770
- */
14771
-
14772
- /**
14773
- * Creates a new ReadableStreamToStringFunction
14774
- * @param encoding
14775
- * @returns
14776
- */
14777
- function readableStreamToStringFunction(encoding) {
14778
- return stream => {
14779
- return readableStreamToBuffer(stream).then(x => x.toString(encoding));
14780
- };
14648
+ function getDayOffset(day, days) {
14649
+ if (days === 0) {
14650
+ return day;
14651
+ } else if (days < 0) {
14652
+ return getPreviousDay(day, days);
14653
+ } else {
14654
+ return getNextDay(day, days);
14655
+ }
14781
14656
  }
14782
-
14783
- /**
14784
- * ReadableStreamToStringFunction for Base64
14785
- */
14786
- const readableStreamToBase64 = readableStreamToStringFunction('base64');
14787
-
14788
- /**
14789
- * Converts a ReadableStream to a Buffer promise.
14790
- *
14791
- * @param encoding
14792
- * @returns
14793
- */
14794
- function readableStreamToBuffer(stream) {
14795
- const chunks = [];
14796
- return new Promise((resolve, reject) => {
14797
- stream.on('data', chunk => chunks.push(Buffer.from(chunk)));
14798
- stream.on('error', err => reject(err));
14799
- stream.on('end', () => resolve(Buffer.concat(chunks)));
14800
- });
14657
+ function getPreviousDay(day, days = 1) {
14658
+ const offset = Math.abs(days) % 7;
14659
+ const cap = 7 - offset;
14660
+ return getNextDay(day, cap);
14801
14661
  }
14802
-
14803
- function joinHostAndPort(config) {
14804
- if (config) {
14805
- return `${config.host}:${config.port}`;
14806
- } else {
14807
- return config;
14662
+ function getNextDay(day, days = 1) {
14663
+ let result = (day + days) % 7;
14664
+ if (result < 0) {
14665
+ result = 7 + result;
14808
14666
  }
14667
+ return result;
14809
14668
  }
14810
14669
 
14811
14670
  async function useCallback(use) {
@@ -15305,1387 +15164,1646 @@ function usePromise(input) {
15305
15164
  return useFn => _getter().then(useFn);
15306
15165
  }
15307
15166
 
15308
- let RelationChange = /*#__PURE__*/function (RelationChange) {
15309
- RelationChange["ADD"] = "add";
15310
- RelationChange["SET"] = "set";
15311
- RelationChange["REMOVE_AND_INSERT"] = "remove_and_insert";
15312
- RelationChange["REMOVE"] = "remove";
15313
- RelationChange["UPDATE"] = "update";
15314
- RelationChange["INSERT"] = "insert";
15315
- return RelationChange;
15316
- }({});
15317
-
15318
15167
  /**
15319
- * Merges the two input values. The "a" value is usually the existing/incumbent value, while "b" is the new value.
15320
- */
15321
-
15322
- /**
15323
- * Whether or not the object is changable as part of this request.
15168
+ * Returns the number of invocations that have occurred since the period started.
15169
+ *
15170
+ * When a new period has started, returns 0.
15324
15171
  */
15325
15172
 
15173
+ function timePeriodCounter(timePeriodLength, lastTimePeriodStart) {
15174
+ function reset(inputStart) {
15175
+ const start = inputStart != null ? inputStart : new Date();
15176
+ fn._timePeriodCount = 0;
15177
+ fn._lastTimePeriodStart = start;
15178
+ fn._nextTimePeriodEnd = new Date(start.getTime() + timePeriodLength);
15179
+ return fn._nextTimePeriodEnd;
15180
+ }
15181
+ const fn = () => {
15182
+ const now = new Date();
15183
+ if (now > fn._nextTimePeriodEnd) {
15184
+ reset(now);
15185
+ } else {
15186
+ fn._timePeriodCount += 1;
15187
+ }
15188
+ return fn._timePeriodCount;
15189
+ };
15190
+ fn._timePeriodLength = timePeriodLength;
15191
+ reset(lastTimePeriodStart);
15192
+ fn._timePeriodCount = -1;
15193
+ fn._reset = reset;
15194
+ return fn;
15195
+ }
15196
+
15326
15197
  /**
15327
- * Utility class for modifying a collection of relational objects.
15198
+ * Timer object that counts down a fixed duration amount.
15328
15199
  *
15329
- * For instance, a string collection of keys.
15200
+ * The timer is not required to start immediately.
15201
+ *
15202
+ * Once the timer has complete it cannot be reset.
15330
15203
  */
15331
- class ModelRelationUtility {
15332
- static modifyStringCollection(current, change, mods) {
15333
- return ModelRelationUtility.modifyCollection(current, change, mods, {
15334
- readKey: x => x,
15335
- merge: (a, b) => b
15336
- });
15337
- }
15338
- static modifyCollection(current, change, mods, config) {
15339
- var _current;
15340
- const {
15341
- mask,
15342
- readKey
15343
- } = config;
15344
- current = (_current = current) != null ? _current : []; //init current if not set.
15345
15204
 
15346
- if (mask) {
15347
- const {
15348
- included: currentModify,
15349
- excluded: currentRetain
15350
- } = separateValues(current, mask);
15351
- const {
15352
- included: modModify
15353
- } = separateValues(mods, mask);
15354
- const modifiedResults = this._modifyCollectionWithoutMask(currentModify, change, modModify, config);
15355
- return this._mergeMaskResults(current, currentRetain, modifiedResults, readKey);
15356
- } else {
15357
- return this._modifyCollectionWithoutMask(current, change, mods, config);
15205
+ class TimerCancelledError extends BaseError {
15206
+ constructor() {
15207
+ super(`The timer was destroyed before it was completed.`);
15208
+ }
15209
+ }
15210
+ class TimerInstance {
15211
+ constructor(duration, startImmediately = true) {
15212
+ this._createdAt = new Date();
15213
+ this._startedAt = new Date();
15214
+ this._pausedAt = void 0;
15215
+ this._state = 'paused';
15216
+ this._duration = void 0;
15217
+ this._promiseRef = promiseReference();
15218
+ this._duration = duration;
15219
+ if (startImmediately) {
15220
+ this.start();
15221
+ this._startedAt = this._createdAt;
15358
15222
  }
15359
15223
  }
15360
-
15361
- /**
15362
- * The mask results are merged together.
15363
- *
15364
- * Order from the "current" is retained. Anything in currentRetain overrides modifiedResults.
15365
- */
15366
- static _mergeMaskResults(current, currentRetain, modifiedResults, readKey) {
15367
- return restoreOrderWithValues(current, [...currentRetain, ...modifiedResults], {
15368
- readKey
15369
- });
15224
+ get state() {
15225
+ return this._state;
15370
15226
  }
15371
- static _modifyCollectionWithoutMask(current, change, mods, config) {
15372
- const {
15373
- readKey,
15374
- merge,
15375
- shouldRemove
15376
- } = config;
15377
- const readType = config.readType;
15378
- function remove(rCurrent = current, rMods = mods) {
15379
- return ModelRelationUtility._modifyCollection(rCurrent, rMods, (x, y) => {
15380
- return ModelRelationUtility.removeFromCollection(x, y, readKey, shouldRemove);
15381
- }, readType);
15227
+ get createdAt() {
15228
+ return this._createdAt;
15229
+ }
15230
+ get pausedAt() {
15231
+ return this._pausedAt;
15232
+ }
15233
+ get startedAt() {
15234
+ return this._startedAt;
15235
+ }
15236
+ get promise() {
15237
+ return this._promiseRef.promise;
15238
+ }
15239
+ get duration() {
15240
+ return this._duration;
15241
+ }
15242
+ get durationRemaining() {
15243
+ let remaining;
15244
+ switch (this._state) {
15245
+ case 'complete':
15246
+ remaining = 0;
15247
+ break;
15248
+ case 'running':
15249
+ remaining = Math.max(0, this._duration - (new Date().getTime() - this._startedAt.getTime()));
15250
+ break;
15251
+ case 'paused':
15252
+ remaining = null;
15253
+ break;
15382
15254
  }
15383
- function performAdd() {
15384
- return ModelRelationUtility._modifyCollection(current, mods, (x, y) => ModelRelationUtility.addToCollection(x, y, readKey), readType);
15255
+ return remaining;
15256
+ }
15257
+ start() {
15258
+ if (this._state === 'paused') {
15259
+ this._state = 'running';
15260
+ this._startedAt = new Date();
15261
+ this._enqueueCheck();
15385
15262
  }
15386
- function performInsert() {
15387
- return ModelRelationUtility.insertCollection(current, mods, {
15388
- readKey,
15389
- readType,
15390
- merge
15391
- });
15263
+ }
15264
+ stop() {
15265
+ if (this._state === 'running') {
15266
+ this._state = 'paused';
15267
+ this._pausedAt = new Date();
15392
15268
  }
15393
- switch (change) {
15394
- case RelationChange.SET:
15395
- current = []; // Set current before performing add.
15396
- return performAdd();
15397
- case RelationChange.ADD:
15398
- return performAdd();
15399
- case RelationChange.REMOVE:
15400
- return remove();
15401
- case RelationChange.UPDATE:
15402
- return ModelRelationUtility.updateCollection(current, mods, {
15403
- readKey,
15404
- readType,
15405
- merge
15406
- });
15407
- case RelationChange.REMOVE_AND_INSERT:
15408
- current = remove(current, current); // Remove all current values before performing an insert.
15409
- return performInsert();
15410
- case RelationChange.INSERT:
15411
- return performInsert();
15269
+ }
15270
+ reset() {
15271
+ if (this._state !== 'complete') {
15272
+ this._state = 'running';
15273
+ this._startedAt = new Date();
15274
+ this._enqueueCheck();
15412
15275
  }
15413
15276
  }
15414
- static updateCollection(current, update, {
15415
- readKey,
15416
- readType,
15417
- merge
15418
- }) {
15419
- ModelRelationUtility._assertMergeProvided(merge);
15420
- return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._updateSingleTypeCollection(x, y, {
15421
- readKey,
15422
- merge
15423
- }), readType);
15277
+ setDuration(duration) {
15278
+ this._duration = duration;
15424
15279
  }
15425
- static insertCollection(current, update, {
15426
- readKey,
15427
- readType,
15428
- merge
15429
- }) {
15430
- ModelRelationUtility._assertMergeProvided(merge);
15431
- return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._insertSingleTypeCollection(x, y, {
15432
- readKey,
15433
- merge
15434
- }), readType);
15280
+ destroy() {
15281
+ this._checkComplete();
15282
+ if (this._state === 'running') {
15283
+ const error = new TimerCancelledError();
15284
+ this._promiseRef.reject(error);
15285
+ this._state = 'complete'; // mark as complete
15286
+ }
15435
15287
  }
15436
15288
 
15437
- /**
15438
- * Used to modify a collection which may be multi-type. If readType is provided, the collection is handled as a multi-type map.
15439
- */
15440
- static _modifyCollection(current, mods, modifyCollection, readType) {
15441
- if (readType) {
15442
- return ModelRelationUtility._modifyMultiTypeCollection(current, mods, readType, modifyCollection);
15443
- } else {
15444
- return modifyCollection(current, mods);
15289
+ _checkComplete() {
15290
+ if (this._state !== 'complete' && this.durationRemaining === 0) {
15291
+ this._state = 'complete';
15292
+ this._promiseRef.resolve();
15445
15293
  }
15446
15294
  }
15447
- static _modifyMultiTypeCollection(input, mods, readType, modifyCollection) {
15448
- const inputMap = makeValuesGroupMap(input, readType);
15449
- const modsMap = makeValuesGroupMap(mods, readType);
15450
- const typesModified = new Set([...inputMap.keys(), ...modsMap.keys()]);
15295
+ _enqueueCheck() {
15296
+ const durationRemaining = this.durationRemaining;
15297
+ if (durationRemaining != null && this._state !== 'complete') {
15298
+ setTimeout(() => {
15299
+ this._checkComplete();
15300
+ this._enqueueCheck();
15301
+ }, durationRemaining);
15302
+ }
15303
+ }
15304
+ }
15305
+ function timer(duration, startNow = true) {
15306
+ return new TimerInstance(duration, startNow);
15307
+ }
15451
15308
 
15452
- // Break the collections up into their individual types and process separately.
15453
- const modifiedSubcollections = Array.from(typesModified).map(type => {
15454
- var _inputMap$get, _modsMap$get;
15455
- const values = (_inputMap$get = inputMap.get(type)) != null ? _inputMap$get : [];
15456
- const mods = (_modsMap$get = modsMap.get(type)) != null ? _modsMap$get : [];
15309
+ /**
15310
+ * Toggles the input Timer's running state.
15311
+ *
15312
+ * @param timer
15313
+ * @param toggleRun
15314
+ */
15315
+ function toggleTimerRunning(timer, toggleRun) {
15316
+ toggleRun = toggleRun != null ? toggleRun : timer.state !== 'running';
15317
+ if (toggleRun) {
15318
+ timer.start();
15319
+ } else {
15320
+ timer.stop();
15321
+ }
15322
+ }
15457
15323
 
15458
- // Only modify if they've got changes for their type.
15459
- if (mods.length === 0) {
15460
- return values; // No mods, no change to those types.
15461
- } else {
15462
- return modifyCollection(values, mods);
15463
- }
15464
- });
15465
-
15466
- // Rejoin all changes.
15467
- return modifiedSubcollections.reduce((x, y) => x.concat(y), []);
15468
- }
15469
- static _insertSingleTypeCollection(current, insert, {
15470
- readKey,
15471
- merge
15472
- }) {
15473
- const currentKeys = arrayToMap(current, readKey);
15474
- const updateValues = [];
15475
- const addValues = [];
15476
- insert.forEach(value => {
15477
- const key = readKey(value);
15478
- if (currentKeys.has(key)) {
15479
- updateValues.push(value);
15480
- } else {
15481
- addValues.push(value);
15482
- }
15483
- });
15484
- const added = ModelRelationUtility.addToCollection(current, addValues, readKey);
15485
- const results = ModelRelationUtility._updateSingleTypeCollection(added, updateValues, {
15486
- readKey,
15487
- merge
15488
- });
15489
- return results;
15490
- }
15491
- static _updateSingleTypeCollection(current, update, {
15492
- readKey,
15493
- merge
15494
- }) {
15495
- const keysToUpdate = arrayToMap(update, readKey);
15496
- const updateValues = [];
15497
- current.forEach(value => {
15498
- const key = readKey(value);
15499
- const mergeWith = keysToUpdate.get(key);
15500
- if (mergeWith != null) {
15501
- updateValues.push(merge(value, mergeWith));
15502
- }
15503
- });
15504
-
15505
- // Add to merge all values and remove duplicates.
15506
- return ModelRelationUtility.addToCollection(current, updateValues, readKey);
15507
- }
15508
- static addToCollection(current, add, readKey) {
15509
- var _current2;
15510
- current = (_current2 = current) != null ? _current2 : [];
15511
- return add != null && add.length ? ModelRelationUtility.removeDuplicates([...add, ...current], readKey) : current; // Will keep any "added" before any existing ones.
15512
- }
15513
-
15514
- static removeFromCollection(current, remove, readKey, shouldRemove) {
15515
- if (current != null && current.length) {
15516
- if (shouldRemove) {
15517
- const currentKeyPairs = makeKeyPairs(current, readKey);
15518
- const map = new Map(currentKeyPairs);
15519
- remove.forEach(x => {
15520
- const key = readKey(x);
15521
- const removalTarget = map.get(key);
15522
- if (removalTarget && shouldRemove(removalTarget)) {
15523
- map.delete(key); // Remove from the map.
15524
- }
15525
- });
15526
-
15527
- return currentKeyPairs.filter(x => map.has(x[0])).map(x => x[1]); // Retain order, remove from map.
15528
- } else {
15529
- return ModelRelationUtility.removeKeysFromCollection(current, remove.map(readKey), readKey);
15530
- }
15531
- } else {
15532
- return [];
15533
- }
15534
- }
15535
- static removeKeysFromCollection(current, keysToRemove, readKey) {
15536
- return ModelRelationUtility.removeDuplicates(current, readKey, keysToRemove);
15537
- }
15538
- static removeDuplicates(relations, readKey, additionalKeys = []) {
15539
- return relations != null && relations.length ? filterUniqueValues(relations, readKey, additionalKeys) : [];
15540
- }
15541
-
15542
- // MARK: Internal Utility
15543
- static _assertMergeProvided(merge) {
15544
- if (!merge) {
15545
- throw new Error('Merge was not provided.');
15546
- }
15324
+ /**
15325
+ * Returns the approximate end date of the given timer. If a timer is already complete, it returns the time for now.
15326
+ */
15327
+ function approximateTimerEndDate(timer) {
15328
+ const durationRemaining = timer.durationRemaining;
15329
+ if (durationRemaining != null) {
15330
+ return new Date(Date.now() + durationRemaining);
15331
+ } else {
15332
+ return null;
15547
15333
  }
15548
15334
  }
15549
15335
 
15550
15336
  /**
15551
- * Key used to signify
15337
+ * Represents a string for a time. This may be human-input, and
15338
+ * can be interpreted in various ways depending on the input.
15339
+ *
15340
+ * Examples:
15341
+ * - 1:20AM
15342
+ * - 1:20
15343
+ * - 120AM
15344
+ * - 120
15552
15345
  */
15553
- const CATCH_ALL_HANDLE_RESULT_KEY = '__CATCH_ALL_HANDLE_RESULT_KEY__';
15346
+
15347
+ let TimeAM = /*#__PURE__*/function (TimeAM) {
15348
+ TimeAM["AM"] = "AM";
15349
+ TimeAM["PM"] = "PM";
15350
+ return TimeAM;
15351
+ }({});
15352
+ const DATE_NOW_VALUE = 'now';
15554
15353
 
15555
15354
  /**
15556
- * Whether or not the input value was handled.
15355
+ * A date that is characterized by either a known string value, or a Date.
15557
15356
  */
15558
15357
 
15559
15358
  /**
15560
- * Used to perform a task on the input value.
15359
+ * Returns a Date value from the input LogicalDate.
15561
15360
  *
15562
- * If the value is not used/"handled", returns false.
15361
+ * @param logicalDate
15563
15362
  */
15564
15363
 
15565
- function handlerFactory(readKey) {
15566
- return () => {
15567
- let catchAll;
15568
- const map = new Map();
15569
- const set = (key, handle) => {
15570
- if (key === CATCH_ALL_HANDLE_RESULT_KEY) {
15571
- catchAll = handle;
15572
- } else {
15573
- setKeysOnMap(map, key, handle);
15574
- }
15575
- };
15576
- const bindSet = (bindTo, key, handle) => {
15577
- const bindHandle = handle.bind(bindTo);
15578
- set(key, bindHandle);
15579
- };
15580
- const fn = build({
15581
- base: value => {
15582
- var _ref;
15583
- const key = readKey(value);
15584
- const handler = (_ref = key != null ? map.get(key) : undefined) != null ? _ref : catchAll;
15585
- let handled = false;
15586
- if (handler) {
15587
- handled = handler(value);
15588
- }
15589
- return handled;
15590
- },
15591
- build: x => {
15592
- x.readKey = readKey;
15593
- x.set = set;
15594
- x.bindSet = bindSet;
15595
- }
15596
- });
15597
- return fn;
15598
- };
15599
- }
15600
- function makeHandler(readKey) {
15601
- return handlerFactory(readKey)();
15364
+ function dateFromLogicalDate(logicalDate) {
15365
+ let result;
15366
+ if (typeof logicalDate === 'string') {
15367
+ switch (logicalDate.toLocaleLowerCase()) {
15368
+ case DATE_NOW_VALUE:
15369
+ result = new Date();
15370
+ break;
15371
+ default:
15372
+ throw new Error(`Unknown logical date string "${logicalDate}"`);
15373
+ }
15374
+ } else {
15375
+ result = logicalDate;
15376
+ }
15377
+ return result;
15602
15378
  }
15603
- function catchAllHandlerKey() {
15604
- return CATCH_ALL_HANDLE_RESULT_KEY;
15379
+ function isLogicalDateStringCode(logicalDate) {
15380
+ let isLogicalDateStringCode = false;
15381
+ if (typeof logicalDate === 'string') {
15382
+ switch (logicalDate.toLocaleLowerCase()) {
15383
+ case DATE_NOW_VALUE:
15384
+ isLogicalDateStringCode = true;
15385
+ break;
15386
+ }
15387
+ }
15388
+ return isLogicalDateStringCode;
15605
15389
  }
15606
15390
 
15607
15391
  /**
15608
- * Wraps a HandlerAccessor and the item it is bound to in order to be a HandlerSetAccessor.
15609
- */
15610
-
15611
- /**
15612
- * Creates a HandlerBindAccessor<T, K> for the input values.
15392
+ * Performs a deep comparison to check if all values on the input filters are equal.
15613
15393
  *
15614
- * @param bindTo
15615
- * @param accessor
15616
- * @returns
15394
+ * Recursively compares Arrays, Objects, Maps, Sets, Primatives, and Dates.
15617
15395
  */
15618
- function handlerBindAccessor(boundTo, accessor) {
15619
- return {
15620
- accessor,
15621
- boundTo,
15622
- set: (key, handle) => {
15623
- accessor.bindSet(boundTo, key, handle);
15396
+ function areEqualPOJOValues(a, b) {
15397
+ // check self
15398
+ if (a === b) {
15399
+ return true;
15400
+ }
15401
+
15402
+ // check one value is nullish and other is not
15403
+ if ((a == null || b == null) && (a || b)) {
15404
+ return false;
15405
+ }
15406
+
15407
+ // object check
15408
+ if (typeof a === 'object') {
15409
+ // check if they are arrays
15410
+ if (isIterable(a, false)) {
15411
+ if (Array.isArray(a)) {
15412
+ if (a.length !== b.length) {
15413
+ return false;
15414
+ }
15415
+ const firstInequalityIndex = a.findIndex((aValue, i) => {
15416
+ const bValue = b[i];
15417
+ return !areEqualPOJOValues(aValue, bValue);
15418
+ });
15419
+ return firstInequalityIndex === -1;
15420
+ } else if (a instanceof Set) {
15421
+ return setsAreEquivalent(a, b);
15422
+ } else if (a instanceof Map) {
15423
+ const bMap = b;
15424
+ if (a.size !== bMap.size) {
15425
+ return false;
15426
+ }
15427
+ const firstInequalityIndex = Array.from(a.entries()).findIndex(([key, aValue]) => {
15428
+ const bValue = bMap.get(key);
15429
+ return !areEqualPOJOValues(aValue, bValue);
15430
+ });
15431
+ return firstInequalityIndex === -1;
15432
+ }
15433
+ } else if (typeof b === 'object') {
15434
+ // check contructors/types
15435
+ const firstType = a == null ? void 0 : a.constructor.name;
15436
+ const secondType = b == null ? void 0 : b.constructor.name;
15437
+ if (firstType !== secondType) {
15438
+ return false; // false if not the same type
15439
+ }
15440
+
15441
+ // check Date comparison
15442
+ if (isDate(a)) {
15443
+ return isEqualDate(a, b);
15444
+ }
15445
+
15446
+ // check object comparison via keys
15447
+ const aObject = a;
15448
+ const bObject = b;
15449
+ const aKeys = Object.keys(aObject);
15450
+ const bKeys = Object.keys(bObject);
15451
+
15452
+ // compare keys
15453
+ if (aKeys.length === bKeys.length) {
15454
+ const firstInequalityIndex = aKeys.findIndex(key => {
15455
+ const aKeyValue = aObject[key];
15456
+ const bKeyValue = bObject[key];
15457
+ return !areEqualPOJOValues(aKeyValue, bKeyValue);
15458
+ });
15459
+ if (firstInequalityIndex === -1) {
15460
+ return true; // is equal if no non-matching key/value pair is found
15461
+ }
15462
+ }
15624
15463
  }
15625
- };
15464
+ }
15465
+
15466
+ // still not equal if down here
15467
+ return false;
15626
15468
  }
15627
15469
 
15470
+ // MARK: ObjectFieldEqualityChecker
15628
15471
  /**
15629
- * Contextual function that configures the context's Handler with the input function for the context's key.
15472
+ * Configuration for an ObjectFieldEqualityChecker.
15630
15473
  */
15631
15474
 
15632
15475
  /**
15633
- * Creates a HandlerSetFunction.
15634
- *
15635
- * @param accessor
15636
- * @param key
15637
- * @returns
15476
+ * Field configration for a single field of a ObjectFieldEqualityCheckerConfig.
15638
15477
  */
15639
- function handlerSetFunction(accessor, key) {
15640
- const fn = handlerFunction => {
15641
- accessor.set(key, handlerFunction); // set the handler on the pre-defined key.
15642
- };
15643
-
15644
- fn.key = key;
15645
- return fn;
15646
- }
15647
- function handlerMappedSetFunction(accessor, key, mapFn) {
15648
- const handlerSet = handlerSetFunction(accessor, key);
15649
- return handlerFunction => {
15650
- // set an intermediary function that calls the target function. We don't use an arrow function so we have access to the "this", if bound.
15651
- handlerSet(function (value) {
15652
- const mapped = mapFn(value); // fowards "this" to the next call.
15653
- return handlerFunction.call(this, mapped);
15654
- });
15655
- };
15656
- }
15657
15478
 
15658
15479
  /**
15659
- * Factory for a HandlerMappedSetFunction<I>.
15480
+ * Results of an ObjectFieldEqualityChecker.
15660
15481
  */
15661
15482
 
15662
- function handlerMappedSetFunctionFactory(accessor, mapFn) {
15663
- return key => handlerMappedSetFunction(accessor, key, mapFn);
15664
- }
15665
-
15666
15483
  /**
15667
- * Config for handlerConfigurerFactory().
15484
+ * Function used to check if two objects are considered equal.
15668
15485
  */
15669
15486
 
15670
- function handlerConfigurerFactory(config) {
15671
- return handler => {
15672
- return (bindTo, configure) => {
15673
- const accessor = handlerBindAccessor(bindTo, handler);
15674
- const configurer = config.configurerForAccessor(accessor);
15675
- configure(configurer);
15487
+ function objectFieldEqualityChecker(config) {
15488
+ const {
15489
+ fields,
15490
+ defaultEqualityFunction = (a, b) => a === b
15491
+ } = config;
15492
+ const _fields = new Map();
15493
+ fields.forEach(input => {
15494
+ let field;
15495
+ if (typeof input === 'object') {
15496
+ field = input;
15497
+ } else {
15498
+ field = {
15499
+ fieldName: input,
15500
+ isEqual: defaultEqualityFunction
15501
+ };
15502
+ }
15503
+ _fields.set(field.fieldName, field);
15504
+ });
15505
+ const fn = (a, b) => {
15506
+ const equalFields = [];
15507
+ const unequalFields = [];
15508
+ _fields.forEach((fieldConfig, fieldName) => {
15509
+ const {
15510
+ isEqual
15511
+ } = fieldConfig;
15512
+ isEqual(a[fieldName], b[fieldName]) ? equalFields.push(fieldName) : unequalFields.push(fieldName);
15513
+ });
15514
+ return {
15515
+ a,
15516
+ b,
15517
+ isEqual: unequalFields.length === 0,
15518
+ equalFields,
15519
+ unequalFields
15676
15520
  };
15677
15521
  };
15522
+ fn._fields = _fields;
15523
+ return fn;
15678
15524
  }
15679
15525
 
15680
15526
  /**
15681
- * Registry used to load model services when requested.
15527
+ * Creates a EqualityComparatorFunction that compares the two input values
15528
+ *
15529
+ * @param readKey
15530
+ * @returns
15682
15531
  */
15532
+ function objectKeysEqualityComparatorFunction(readKey) {
15533
+ const readKeysSet = readKeysSetFunction(readKey);
15534
+ const readKeysArray = readKeysFunction(readKey);
15535
+ return safeEqualityComparatorFunction((a, b) => {
15536
+ if (a.length === b.length) {
15537
+ if (a.length === 0) {
15538
+ return true; // both the same/empty arrays
15539
+ }
15683
15540
 
15684
- /**
15685
- * TypedServiceRegistry implementation.
15686
- */
15687
- class TypedServiceRegistryInstance {
15688
- constructor() {
15689
- this._map = new Map();
15690
- }
15691
- registerServiceForType(type, service) {
15692
- const getter = asGetter(service);
15693
- this._map.set(type, getter);
15694
- }
15695
- serviceForType(type) {
15696
- const getter = this._map.get(type);
15697
- const service = getter == null ? void 0 : getter();
15698
- if (service == null) {
15699
- throw new Error(`no service registered for type "${type}"`);
15541
+ const aKeys = readKeysSet(a);
15542
+ const bKeys = readKeysArray(b);
15543
+ if (aKeys.size === bKeys.length) {
15544
+ return setContainsAllValues(aKeys, bKeys);
15545
+ }
15700
15546
  }
15701
- return service;
15702
- }
15547
+ return false;
15548
+ });
15703
15549
  }
15550
+
15704
15551
  /**
15705
- * Creates a new TypedServiceRegistryInstance and registers the input types.
15552
+ * Creates a EqualityComparatorFunction that compares the two input values
15553
+ *
15554
+ * @param readKey
15706
15555
  * @returns
15707
15556
  */
15708
- function typedServiceRegistry(config) {
15709
- const instance = new TypedServiceRegistryInstance();
15710
- forEachKeyValue(config.services, {
15711
- forEach: ([key, service]) => {
15712
- instance.registerServiceForType(key, service);
15713
- }
15714
- });
15715
- return instance;
15557
+ function objectKeyEqualityComparatorFunction(readKey) {
15558
+ return safeEqualityComparatorFunction((a, b) => readKey(a) === readKey(b));
15716
15559
  }
15717
15560
 
15718
- class StoredDataError extends BaseError {
15719
- constructor(message) {
15720
- super(message);
15721
- }
15722
- }
15723
- class DataDoesNotExistError extends StoredDataError {
15724
- constructor(message) {
15725
- super(message);
15726
- }
15561
+ /**
15562
+ * Used for copying one field from one partial object to a target object.
15563
+ */
15564
+
15565
+ function makeCopyModelFieldFunction(key, inputConfig) {
15566
+ const config = inputConfig != null ? inputConfig : {};
15567
+ const hasDefault = objectHasKey(config, 'default');
15568
+ const defaultValue = config.default;
15569
+ return (from, target) => {
15570
+ if (objectHasKey(from, key)) {
15571
+ var _from$key;
15572
+ target[key] = (_from$key = from[key]) != null ? _from$key : defaultValue;
15573
+ } else if (hasDefault) {
15574
+ target[key] = defaultValue;
15575
+ }
15576
+ };
15727
15577
  }
15728
- class DataIsExpiredError extends StoredDataError {
15729
- constructor(data, message) {
15730
- super(message);
15731
- this.data = data;
15732
- }
15578
+
15579
+ // MARK: Model
15580
+ /**
15581
+ * Type used to declare a sister-type to the generic object.
15582
+ */
15583
+
15584
+ function makeModelMapFunctions(fields) {
15585
+ const keys = filterKeyValueTuples(fields);
15586
+ const conversionsByKey = keys.map(([key, field]) => [key, field]);
15587
+ const fromConversions = conversionsByKey.map(([key, configs]) => [key, configs.from]);
15588
+ const toConversions = conversionsByKey.map(([key, configs]) => [key, configs.to]);
15589
+ const from = makeModelConversionFieldValuesFunction(fromConversions);
15590
+ const to = makeModelConversionFieldValuesFunction(toConversions);
15591
+ return {
15592
+ from,
15593
+ to
15594
+ };
15733
15595
  }
15734
15596
 
15735
- class MemoryStorageInstance {
15736
- constructor() {
15737
- this._length = 0;
15738
- this._storage = {};
15739
- }
15740
- get length() {
15741
- return this._length;
15742
- }
15743
- key(index) {
15744
- var _Object$keys$index;
15745
- return (_Object$keys$index = Object.keys(this._storage)[index]) != null ? _Object$keys$index : null;
15746
- }
15747
- hasKey(key) {
15748
- return objectHasKey(this._storage, key);
15749
- }
15750
- getItem(key) {
15751
- var _this$_storage$key;
15752
- return (_this$_storage$key = this._storage[key]) != null ? _this$_storage$key : null;
15753
- }
15754
- setItem(key, item) {
15755
- if (item == null) {
15756
- this.removeItem(key);
15757
- } else {
15758
- if (!this.hasKey(key)) {
15759
- this._length = this._length + 1;
15597
+ /**
15598
+ * A model conversion function. Performs a conversion on all non-null values.
15599
+ */
15600
+
15601
+ function makeModelConversionFieldValuesFunction(fields) {
15602
+ return (input, inputTarget, options) => {
15603
+ const target = inputTarget != null ? inputTarget : {};
15604
+ if (input != null) {
15605
+ let targetFields = fields;
15606
+
15607
+ // if options are provided, filter down.
15608
+ if (options) {
15609
+ const fieldsToMap = new Set(findPOJOKeys(input, {
15610
+ keysFilter: options.fields,
15611
+ valueFilter: options.definedOnly === false ? KeyValueTypleValueFilter.NONE : KeyValueTypleValueFilter.UNDEFINED
15612
+ }));
15613
+ targetFields = fields.filter(x => fieldsToMap.has(x[0]));
15760
15614
  }
15761
- this._storage[key] = String(item);
15762
- }
15763
- }
15764
- removeItem(key) {
15765
- if (this.hasKey(key)) {
15766
- delete this._storage[key]; // Remove the property
15767
- this._length = this._length - 1;
15615
+ targetFields.forEach(([key, convert]) => target[key] = convert(input[key]));
15768
15616
  }
15769
- }
15770
- clear() {
15771
- this._storage = {};
15772
- this._length = 0;
15773
- }
15617
+ return target;
15618
+ };
15774
15619
  }
15775
- const SHARED_MEMORY_STORAGE = new MemoryStorageInstance();
15776
15620
 
15621
+ // MARK: Fields
15777
15622
  /**
15778
- * Limited Class/Interface for storing string values synchronously.
15623
+ * An object map containing a ModelFieldMapFunctions entry for each key (required and optional) from the generic object.
15779
15624
  */
15780
- class SimpleStorageObject {}
15781
15625
 
15782
15626
  /**
15783
- * Synchronous Class/Interface for storing string values.
15784
- *
15785
- * Has the same interface as localStorage for the web.
15627
+ * An object map containing a ModelFieldMapFunctionsConfig for each key (required and optional) from the generic object.
15786
15628
  */
15787
- class StorageObject extends SimpleStorageObject {
15788
- constructor(...args) {
15789
- super(...args);
15790
- this.length = void 0;
15791
- }
15792
- /**
15793
- * Returns the string key for the index.
15794
- *
15795
- * Returns null if no key available.
15796
- */
15797
- }
15798
- class FullStorageObject extends StorageObject {
15799
- constructor(...args) {
15800
- super(...args);
15801
- this.isPersistant = void 0;
15802
- this.isAvailable = void 0;
15803
- }
15629
+
15630
+ function modelFieldConversions(config) {
15631
+ return mapObjectMap(config, x => modelFieldMapFunctions(x));
15804
15632
  }
15805
- class StorageObjectUtility {
15806
- static allKeysFromStorageObject(storageObject, prefix) {
15807
- const length = storageObject.length;
15808
- let result;
15809
- if (length > 0) {
15810
- result = range({
15811
- start: 0,
15812
- end: length
15813
- }).map(x => storageObject.key(x)).filter(hasNonNullValue);
15814
- if (prefix) {
15815
- result = result.filter(x => x.startsWith(prefix));
15816
- }
15817
- } else {
15818
- result = [];
15819
- }
15820
- return result;
15821
- }
15633
+ function modelFieldMapFunctions(config) {
15634
+ return {
15635
+ from: modelFieldMapFunction(config.from),
15636
+ to: modelFieldMapFunction(config.to)
15637
+ };
15822
15638
  }
15823
15639
 
15640
+ // MARK: Field
15824
15641
  /**
15825
- * Represents a single CSS class
15642
+ * ModelFieldMapFunction configuration that can convert a MaybeValue to the target value.
15826
15643
  */
15827
15644
 
15828
15645
  /**
15829
- * Represents one or more CssClasses that are space separated.
15646
+ * ModelFieldMapFunction configuration that handles the MaybeNot case with undefined.
15830
15647
  */
15831
15648
 
15832
15649
  /**
15833
- * One or more arrays of one or more CSS classes/arrays of classes.
15650
+ * Configuration is either a ModelFieldMapMaybeTooConfig or a ModelFieldMapMaybeWithDefaultConfig
15834
15651
  */
15835
15652
 
15836
15653
  /**
15837
- * Joins together various array of classes and only keeps the unique values.
15654
+ * Creates a ModelFieldMapFunction.
15838
15655
  *
15839
- * @param cssClasses
15656
+ * @param config
15840
15657
  * @returns
15841
15658
  */
15842
- function spaceSeparatedCssClasses(cssClasses) {
15843
- let result = '';
15844
- if (cssClasses) {
15845
- const allClasses = cssClassesSet(cssClasses);
15846
- result = joinStringsWithSpaces(Array.from(allClasses));
15847
- }
15848
- return result;
15659
+ function modelFieldMapFunction(config) {
15660
+ const convert = config.convert;
15661
+ const convertMaybe = config.convertMaybe;
15662
+ const defaultOutput = config.default;
15663
+ const defaultInput = config.defaultInput;
15664
+ const hasDefaultInput = defaultInput != null;
15665
+ const getDefaultOutput = asGetter(defaultOutput);
15666
+ const getDefaultInput = asGetter(defaultInput);
15667
+ return input => {
15668
+ let result;
15669
+ if (isMaybeSo(input)) {
15670
+ result = convert(input);
15671
+ } else {
15672
+ if (convertMaybe) {
15673
+ result = convertMaybe(input != null ? input : getDefaultInput());
15674
+ } else if (hasDefaultInput) {
15675
+ result = convert(getDefaultInput());
15676
+ } else {
15677
+ result = getDefaultOutput();
15678
+ }
15679
+ }
15680
+ return result;
15681
+ };
15849
15682
  }
15850
15683
 
15684
+ // MARK: Utility
15685
+
15851
15686
  /**
15852
- * Joins together various array of classes and returns the set of unique CSS classes.
15687
+ * Converts the input to a ModelFieldConversions value.
15853
15688
  *
15854
- * @param cssClasses
15689
+ * @param input
15855
15690
  * @returns
15856
15691
  */
15857
- function cssClassesSet(cssClasses) {
15858
- let result;
15859
- if (cssClasses) {
15860
- const arrayOfClasses = iterableToArray(cssClasses, false);
15861
- const arrayOfAllClassValues = arrayOfClasses.map(x => asArray(x).map(x => x.split(' ')).flat()).flat();
15862
- result = new Set(arrayOfAllClassValues);
15692
+ function toModelFieldConversions(input) {
15693
+ var _fieldConversions;
15694
+ const conversions = (_fieldConversions = input.fieldConversions) != null ? _fieldConversions : modelFieldConversions(input.fields);
15695
+ return conversions;
15696
+ }
15697
+ function toModelMapFunctions(input) {
15698
+ let mapFunctions;
15699
+ if (input.mapFunctions != null) {
15700
+ mapFunctions = input.mapFunctions;
15863
15701
  } else {
15864
- result = new Set();
15702
+ const conversions = toModelFieldConversions(input);
15703
+ mapFunctions = makeModelMapFunctions(conversions);
15865
15704
  }
15866
- return result;
15705
+ return mapFunctions;
15867
15706
  }
15868
15707
 
15869
15708
  /**
15870
- * SortCompareFunction by string.
15871
- */
15872
-
15873
- /**
15874
- * Creates a SortByStringFunction that sorts values in ascending order.
15709
+ * Field conversion that copies the same value across.
15710
+ *
15711
+ * @param defaultValue
15712
+ * @returns
15875
15713
  */
15876
- function sortByStringFunction(readStringFn) {
15877
- return (a, b) => {
15878
- const as = readStringFn(a);
15879
- const bs = readStringFn(b);
15880
- return as.localeCompare(bs);
15714
+ function copyField(defaultOutput) {
15715
+ return {
15716
+ from: {
15717
+ default: defaultOutput,
15718
+ convert: x => x
15719
+ },
15720
+ to: {
15721
+ default: defaultOutput,
15722
+ convert: x => x
15723
+ }
15881
15724
  };
15882
15725
  }
15883
15726
 
15884
- // MARK: Configured
15885
-
15886
- const sortByLabelFunction = sortByStringFunction(x => x.label);
15727
+ function maybeMergeModelModifiers(input) {
15728
+ const modifiers = asArray(input);
15729
+ const allModifyData = filterMaybeValues(modifiers.map(x => x.modifyData));
15730
+ const allModifyModel = filterMaybeValues(modifiers.map(x => x.modifyModel));
15731
+ const modifyData = maybeMergeModifiers(allModifyData);
15732
+ const modifyModel = maybeMergeModifiers(allModifyModel);
15733
+ return {
15734
+ modifyData,
15735
+ modifyModel
15736
+ };
15737
+ }
15738
+ function modifyModelMapFunctions(config) {
15739
+ const {
15740
+ copy,
15741
+ copyModel = copy,
15742
+ copyData = copy,
15743
+ mapFunctions,
15744
+ modifiers
15745
+ } = config;
15746
+ const {
15747
+ from,
15748
+ to
15749
+ } = mapFunctions;
15750
+ const {
15751
+ modifyData,
15752
+ modifyModel
15753
+ } = maybeMergeModelModifiers(modifiers);
15754
+ const modifyFrom = modifyModelMapFunction(from, modifyData, copyData);
15755
+ const modifyTo = modifyModelMapFunction(to, modifyModel, copyModel);
15756
+ return {
15757
+ from: modifyFrom,
15758
+ to: modifyTo
15759
+ };
15760
+ }
15887
15761
 
15888
- // MARK: Search Strings
15889
15762
  /**
15890
- * Decision function factory that is configured with search string values.
15763
+ * Merges a ModifierFunction with a ModelMapFunction
15764
+ *
15765
+ * @param mapFn
15766
+ * @param modifyModel
15767
+ * @param copy
15768
+ * @returns
15891
15769
  */
15770
+ function modifyModelMapFunction(mapFn, modifyModel, copy = true) {
15771
+ return modifyModel ? (input, target, options) => {
15772
+ const inputToMap = copy && input != null ? Object.assign({}, input) : input;
15773
+ if (inputToMap != null) {
15774
+ modifyModel(inputToMap);
15775
+ }
15776
+ return mapFn(inputToMap, target, options);
15777
+ } : mapFn;
15778
+ }
15892
15779
 
15893
15780
  /**
15894
- * Filters values by the input filter text.
15781
+ * Reads the input stream and encodes the data to a string.
15895
15782
  */
15896
15783
 
15897
15784
  /**
15898
- * Creates a SearchStringFilterFunction
15899
- *
15900
- * @param config
15785
+ * Creates a new ReadableStreamToStringFunction
15786
+ * @param encoding
15901
15787
  * @returns
15902
15788
  */
15903
- function searchStringFilterFunction(config) {
15904
- const {
15905
- readStrings,
15906
- decisionFactory = caseInsensitiveFilterByIndexOfDecisionFactory
15907
- } = typeof config === 'function' ? {
15908
- readStrings: config
15909
- } : config;
15910
- return (filterText, values) => {
15911
- const decision = decisionFactory(filterText);
15912
- return values.filter(value => {
15913
- const searchResult = readStrings(value);
15914
- let match = false;
15915
- if (Array.isArray(searchResult)) {
15916
- match = searchResult.findIndex(decision) !== -1;
15917
- } else if (searchResult != null) {
15918
- match = decision(searchResult);
15919
- }
15920
- return match;
15921
- });
15789
+ function readableStreamToStringFunction(encoding) {
15790
+ return stream => {
15791
+ return readableStreamToBuffer(stream).then(x => x.toString(encoding));
15922
15792
  };
15923
15793
  }
15924
15794
 
15925
15795
  /**
15926
- * SearchStringDecisionFunctionFactory that searches for string matches using the input search term/filter text.
15927
- *
15928
- * @param filterText
15929
- * @returns
15930
- */
15931
- const caseInsensitiveFilterByIndexOfDecisionFactory = filterText => {
15932
- const searchString = filterText.toLocaleLowerCase();
15933
- return string => string.toLocaleLowerCase().indexOf(searchString) !== -1;
15934
- };
15935
-
15936
- /**
15937
- * A tree node
15796
+ * ReadableStreamToStringFunction for Base64
15938
15797
  */
15798
+ const readableStreamToBase64 = readableStreamToStringFunction('base64');
15939
15799
 
15940
- const SPLIT_STRING_TREE_NODE_ROOT_VALUE = '';
15941
15800
  /**
15942
- * Creates a SplitStringTreeFactory with the configured splitter.
15801
+ * Converts a ReadableStream to a Buffer promise.
15943
15802
  *
15944
- * @param config
15803
+ * @param encoding
15945
15804
  * @returns
15946
15805
  */
15947
- function splitStringTreeFactory(config) {
15948
- const {
15949
- separator
15950
- } = config;
15951
- const fn = (input, existing) => {
15952
- const {
15953
- leafMeta,
15954
- nodeMeta,
15955
- values
15956
- } = input;
15957
- const result = existing != null ? existing : {
15958
- fullValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
15959
- nodeValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
15960
- children: {}
15961
- };
15962
- asArray(values).forEach(value => {
15963
- addToSplitStringTree(result, {
15964
- value,
15965
- leafMeta,
15966
- nodeMeta
15967
- }, config);
15968
- });
15969
- return result;
15970
- };
15971
- fn._separator = separator;
15972
- return fn;
15973
- }
15974
- function applySplitStringTreeWithMultipleValues(input) {
15975
- const {
15976
- entries,
15977
- factory,
15978
- existing
15979
- } = input;
15980
- let result = existing;
15981
- entries.forEach(entry => {
15982
- result = factory(entry, result);
15806
+ function readableStreamToBuffer(stream) {
15807
+ const chunks = [];
15808
+ return new Promise((resolve, reject) => {
15809
+ stream.on('data', chunk => chunks.push(Buffer.from(chunk)));
15810
+ stream.on('error', err => reject(err));
15811
+ stream.on('end', () => resolve(Buffer.concat(chunks)));
15983
15812
  });
15984
- if (!result) {
15985
- result = factory({
15986
- values: []
15987
- });
15813
+ }
15814
+
15815
+ function joinHostAndPort(config) {
15816
+ if (config) {
15817
+ return `${config.host}:${config.port}`;
15818
+ } else {
15819
+ return config;
15988
15820
  }
15989
- return result;
15990
15821
  }
15822
+
15823
+ let RelationChange = /*#__PURE__*/function (RelationChange) {
15824
+ RelationChange["ADD"] = "add";
15825
+ RelationChange["SET"] = "set";
15826
+ RelationChange["REMOVE_AND_INSERT"] = "remove_and_insert";
15827
+ RelationChange["REMOVE"] = "remove";
15828
+ RelationChange["UPDATE"] = "update";
15829
+ RelationChange["INSERT"] = "insert";
15830
+ return RelationChange;
15831
+ }({});
15832
+
15991
15833
  /**
15992
- * Adds a value to the target SplitStringTree.
15993
- *
15994
- * @param tree
15995
- * @param value
15996
- * @param separator
15997
- * @returns
15834
+ * Merges the two input values. The "a" value is usually the existing/incumbent value, while "b" is the new value.
15998
15835
  */
15999
- function addToSplitStringTree(tree, inputValue, config) {
16000
- const {
16001
- separator,
16002
- mergeMeta
16003
- } = config;
16004
- const {
16005
- value,
16006
- leafMeta,
16007
- nodeMeta
16008
- } = inputValue;
16009
- function nextMeta(node, nextMeta) {
16010
- if (mergeMeta && node.meta != null) {
16011
- return mergeMeta(node.meta, nextMeta);
15836
+
15837
+ /**
15838
+ * Whether or not the object is changable as part of this request.
15839
+ */
15840
+
15841
+ /**
15842
+ * Utility class for modifying a collection of relational objects.
15843
+ *
15844
+ * For instance, a string collection of keys.
15845
+ */
15846
+ class ModelRelationUtility {
15847
+ static modifyStringCollection(current, change, mods) {
15848
+ return ModelRelationUtility.modifyCollection(current, change, mods, {
15849
+ readKey: x => x,
15850
+ merge: (a, b) => b
15851
+ });
15852
+ }
15853
+ static modifyCollection(current, change, mods, config) {
15854
+ var _current;
15855
+ const {
15856
+ mask,
15857
+ readKey
15858
+ } = config;
15859
+ current = (_current = current) != null ? _current : []; //init current if not set.
15860
+
15861
+ if (mask) {
15862
+ const {
15863
+ included: currentModify,
15864
+ excluded: currentRetain
15865
+ } = separateValues(current, mask);
15866
+ const {
15867
+ included: modModify
15868
+ } = separateValues(mods, mask);
15869
+ const modifiedResults = this._modifyCollectionWithoutMask(currentModify, change, modModify, config);
15870
+ return this._mergeMaskResults(current, currentRetain, modifiedResults, readKey);
16012
15871
  } else {
16013
- return nextMeta;
15872
+ return this._modifyCollectionWithoutMask(current, change, mods, config);
16014
15873
  }
16015
15874
  }
16016
- const parts = value.split(separator);
16017
- let currentNode = tree;
16018
- parts.forEach(nodeValue => {
16019
- const existingChildNode = currentNode.children[nodeValue];
16020
- const childNode = existingChildNode != null ? existingChildNode : {
16021
- nodeValue,
16022
- children: {}
16023
- }; // use the existing node or create a new node
16024
15875
 
16025
- if (!existingChildNode) {
16026
- childNode.fullValue = currentNode.fullValue ? currentNode.fullValue + separator + nodeValue : nodeValue;
16027
- currentNode.children[nodeValue] = childNode;
15876
+ /**
15877
+ * The mask results are merged together.
15878
+ *
15879
+ * Order from the "current" is retained. Anything in currentRetain overrides modifiedResults.
15880
+ */
15881
+ static _mergeMaskResults(current, currentRetain, modifiedResults, readKey) {
15882
+ return restoreOrderWithValues(current, [...currentRetain, ...modifiedResults], {
15883
+ readKey
15884
+ });
15885
+ }
15886
+ static _modifyCollectionWithoutMask(current, change, mods, config) {
15887
+ const {
15888
+ readKey,
15889
+ merge,
15890
+ shouldRemove
15891
+ } = config;
15892
+ const readType = config.readType;
15893
+ function remove(rCurrent = current, rMods = mods) {
15894
+ return ModelRelationUtility._modifyCollection(rCurrent, rMods, (x, y) => {
15895
+ return ModelRelationUtility.removeFromCollection(x, y, readKey, shouldRemove);
15896
+ }, readType);
15897
+ }
15898
+ function performAdd() {
15899
+ return ModelRelationUtility._modifyCollection(current, mods, (x, y) => ModelRelationUtility.addToCollection(x, y, readKey), readType);
15900
+ }
15901
+ function performInsert() {
15902
+ return ModelRelationUtility.insertCollection(current, mods, {
15903
+ readKey,
15904
+ readType,
15905
+ merge
15906
+ });
15907
+ }
15908
+ switch (change) {
15909
+ case RelationChange.SET:
15910
+ current = []; // Set current before performing add.
15911
+ return performAdd();
15912
+ case RelationChange.ADD:
15913
+ return performAdd();
15914
+ case RelationChange.REMOVE:
15915
+ return remove();
15916
+ case RelationChange.UPDATE:
15917
+ return ModelRelationUtility.updateCollection(current, mods, {
15918
+ readKey,
15919
+ readType,
15920
+ merge
15921
+ });
15922
+ case RelationChange.REMOVE_AND_INSERT:
15923
+ current = remove(current, current); // Remove all current values before performing an insert.
15924
+ return performInsert();
15925
+ case RelationChange.INSERT:
15926
+ return performInsert();
16028
15927
  }
15928
+ }
15929
+ static updateCollection(current, update, {
15930
+ readKey,
15931
+ readType,
15932
+ merge
15933
+ }) {
15934
+ ModelRelationUtility._assertMergeProvided(merge);
15935
+ return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._updateSingleTypeCollection(x, y, {
15936
+ readKey,
15937
+ merge
15938
+ }), readType);
15939
+ }
15940
+ static insertCollection(current, update, {
15941
+ readKey,
15942
+ readType,
15943
+ merge
15944
+ }) {
15945
+ ModelRelationUtility._assertMergeProvided(merge);
15946
+ return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._insertSingleTypeCollection(x, y, {
15947
+ readKey,
15948
+ merge
15949
+ }), readType);
15950
+ }
16029
15951
 
16030
- // add the meta to the node
16031
- if (nodeMeta != null) {
16032
- childNode.meta = nextMeta(childNode, nodeMeta);
15952
+ /**
15953
+ * Used to modify a collection which may be multi-type. If readType is provided, the collection is handled as a multi-type map.
15954
+ */
15955
+ static _modifyCollection(current, mods, modifyCollection, readType) {
15956
+ if (readType) {
15957
+ return ModelRelationUtility._modifyMultiTypeCollection(current, mods, readType, modifyCollection);
15958
+ } else {
15959
+ return modifyCollection(current, mods);
16033
15960
  }
16034
- currentNode = childNode;
16035
- });
15961
+ }
15962
+ static _modifyMultiTypeCollection(input, mods, readType, modifyCollection) {
15963
+ const inputMap = makeValuesGroupMap(input, readType);
15964
+ const modsMap = makeValuesGroupMap(mods, readType);
15965
+ const typesModified = new Set([...inputMap.keys(), ...modsMap.keys()]);
16036
15966
 
16037
- // add the meta to the leaf node
16038
- if (leafMeta != null) {
16039
- currentNode.meta = nextMeta(currentNode, leafMeta);
15967
+ // Break the collections up into their individual types and process separately.
15968
+ const modifiedSubcollections = Array.from(typesModified).map(type => {
15969
+ var _inputMap$get, _modsMap$get;
15970
+ const values = (_inputMap$get = inputMap.get(type)) != null ? _inputMap$get : [];
15971
+ const mods = (_modsMap$get = modsMap.get(type)) != null ? _modsMap$get : [];
15972
+
15973
+ // Only modify if they've got changes for their type.
15974
+ if (mods.length === 0) {
15975
+ return values; // No mods, no change to those types.
15976
+ } else {
15977
+ return modifyCollection(values, mods);
15978
+ }
15979
+ });
15980
+
15981
+ // Rejoin all changes.
15982
+ return modifiedSubcollections.reduce((x, y) => x.concat(y), []);
15983
+ }
15984
+ static _insertSingleTypeCollection(current, insert, {
15985
+ readKey,
15986
+ merge
15987
+ }) {
15988
+ const currentKeys = arrayToMap(current, readKey);
15989
+ const updateValues = [];
15990
+ const addValues = [];
15991
+ insert.forEach(value => {
15992
+ const key = readKey(value);
15993
+ if (currentKeys.has(key)) {
15994
+ updateValues.push(value);
15995
+ } else {
15996
+ addValues.push(value);
15997
+ }
15998
+ });
15999
+ const added = ModelRelationUtility.addToCollection(current, addValues, readKey);
16000
+ const results = ModelRelationUtility._updateSingleTypeCollection(added, updateValues, {
16001
+ readKey,
16002
+ merge
16003
+ });
16004
+ return results;
16005
+ }
16006
+ static _updateSingleTypeCollection(current, update, {
16007
+ readKey,
16008
+ merge
16009
+ }) {
16010
+ const keysToUpdate = arrayToMap(update, readKey);
16011
+ const updateValues = [];
16012
+ current.forEach(value => {
16013
+ const key = readKey(value);
16014
+ const mergeWith = keysToUpdate.get(key);
16015
+ if (mergeWith != null) {
16016
+ updateValues.push(merge(value, mergeWith));
16017
+ }
16018
+ });
16019
+
16020
+ // Add to merge all values and remove duplicates.
16021
+ return ModelRelationUtility.addToCollection(current, updateValues, readKey);
16022
+ }
16023
+ static addToCollection(current, add, readKey) {
16024
+ var _current2;
16025
+ current = (_current2 = current) != null ? _current2 : [];
16026
+ return add != null && add.length ? ModelRelationUtility.removeDuplicates([...add, ...current], readKey) : current; // Will keep any "added" before any existing ones.
16027
+ }
16028
+
16029
+ static removeFromCollection(current, remove, readKey, shouldRemove) {
16030
+ if (current != null && current.length) {
16031
+ if (shouldRemove) {
16032
+ const currentKeyPairs = makeKeyPairs(current, readKey);
16033
+ const map = new Map(currentKeyPairs);
16034
+ remove.forEach(x => {
16035
+ const key = readKey(x);
16036
+ const removalTarget = map.get(key);
16037
+ if (removalTarget && shouldRemove(removalTarget)) {
16038
+ map.delete(key); // Remove from the map.
16039
+ }
16040
+ });
16041
+
16042
+ return currentKeyPairs.filter(x => map.has(x[0])).map(x => x[1]); // Retain order, remove from map.
16043
+ } else {
16044
+ return ModelRelationUtility.removeKeysFromCollection(current, remove.map(readKey), readKey);
16045
+ }
16046
+ } else {
16047
+ return [];
16048
+ }
16049
+ }
16050
+ static removeKeysFromCollection(current, keysToRemove, readKey) {
16051
+ return ModelRelationUtility.removeDuplicates(current, readKey, keysToRemove);
16052
+ }
16053
+ static removeDuplicates(relations, readKey, additionalKeys = []) {
16054
+ return relations != null && relations.length ? filterUniqueValues(relations, readKey, additionalKeys) : [];
16055
+ }
16056
+
16057
+ // MARK: Internal Utility
16058
+ static _assertMergeProvided(merge) {
16059
+ if (!merge) {
16060
+ throw new Error('Merge was not provided.');
16061
+ }
16040
16062
  }
16041
- return tree;
16042
16063
  }
16043
16064
 
16044
- // MARK: Search
16045
16065
  /**
16046
- * Returns the best match for the value in the tree, including the input tree value.
16047
- *
16048
- * Only returns a result if there is match of any kind.
16049
- *
16050
- * @param tree
16051
- * @param value
16052
- * @returns
16066
+ * Key used to signify
16053
16067
  */
16054
- function findBestSplitStringTreeMatch(tree, value) {
16055
- return lastValue(findBestSplitStringTreeMatchPath(tree, value));
16056
- }
16068
+ const CATCH_ALL_HANDLE_RESULT_KEY = '__CATCH_ALL_HANDLE_RESULT_KEY__';
16057
16069
 
16058
16070
  /**
16059
- * Returns the best match for the value in the true, excluding the input tree value.
16060
- *
16061
- * Only returns a result if there is match of any kind.
16071
+ * Whether or not the input value was handled.
16072
+ */
16073
+
16074
+ /**
16075
+ * Used to perform a task on the input value.
16062
16076
  *
16063
- * @param tree
16064
- * @param value
16065
- * @returns
16077
+ * If the value is not used/"handled", returns false.
16066
16078
  */
16067
- function findBestSplitStringTreeChildMatch(tree, value) {
16068
- return lastValue(findBestSplitStringTreeChildMatchPath(tree, value));
16079
+
16080
+ function handlerFactory(readKey) {
16081
+ return () => {
16082
+ let catchAll;
16083
+ const map = new Map();
16084
+ const set = (key, handle) => {
16085
+ if (key === CATCH_ALL_HANDLE_RESULT_KEY) {
16086
+ catchAll = handle;
16087
+ } else {
16088
+ setKeysOnMap(map, key, handle);
16089
+ }
16090
+ };
16091
+ const bindSet = (bindTo, key, handle) => {
16092
+ const bindHandle = handle.bind(bindTo);
16093
+ set(key, bindHandle);
16094
+ };
16095
+ const fn = build({
16096
+ base: value => {
16097
+ var _ref;
16098
+ const key = readKey(value);
16099
+ const handler = (_ref = key != null ? map.get(key) : undefined) != null ? _ref : catchAll;
16100
+ let handled = false;
16101
+ if (handler) {
16102
+ handled = handler(value);
16103
+ }
16104
+ return handled;
16105
+ },
16106
+ build: x => {
16107
+ x.readKey = readKey;
16108
+ x.set = set;
16109
+ x.bindSet = bindSet;
16110
+ }
16111
+ });
16112
+ return fn;
16113
+ };
16114
+ }
16115
+ function makeHandler(readKey) {
16116
+ return handlerFactory(readKey)();
16117
+ }
16118
+ function catchAllHandlerKey() {
16119
+ return CATCH_ALL_HANDLE_RESULT_KEY;
16069
16120
  }
16070
16121
 
16071
16122
  /**
16072
- * Returns the best match for the value in the tree, including the input tree value.
16073
- *
16074
- * Only returns a result if there is match of any kind.
16075
- *
16076
- * @param tree
16077
- * @param value
16078
- * @returns
16123
+ * Wraps a HandlerAccessor and the item it is bound to in order to be a HandlerSetAccessor.
16079
16124
  */
16080
- function findBestSplitStringTreeMatchPath(tree, value) {
16081
- let bestResult = findBestSplitStringTreeChildMatchPath(tree, value);
16082
- if (!bestResult && tree.fullValue && value.startsWith(tree.fullValue)) {
16083
- bestResult = [tree];
16084
- }
16085
- return bestResult;
16086
- }
16087
16125
 
16088
16126
  /**
16089
- * Returns the best match for the value in the true, excluding the input tree value.
16090
- *
16091
- * Only returns a result if there is match of any kind.
16127
+ * Creates a HandlerBindAccessor<T, K> for the input values.
16092
16128
  *
16093
- * @param tree
16094
- * @param value
16129
+ * @param bindTo
16130
+ * @param accessor
16095
16131
  * @returns
16096
16132
  */
16097
- function findBestSplitStringTreeChildMatchPath(tree, value) {
16098
- const {
16099
- children
16100
- } = tree;
16101
- let bestMatchPath;
16102
- Object.entries(children).find(([_, child]) => {
16103
- let stopScan = false;
16104
- if (value.startsWith(child.fullValue)) {
16105
- var _findBestSplitStringT;
16106
- const bestChildPath = (_findBestSplitStringT = findBestSplitStringTreeChildMatchPath(child, value)) != null ? _findBestSplitStringT : [];
16107
- bestMatchPath = [child, ...bestChildPath];
16108
- stopScan = true;
16133
+ function handlerBindAccessor(boundTo, accessor) {
16134
+ return {
16135
+ accessor,
16136
+ boundTo,
16137
+ set: (key, handle) => {
16138
+ accessor.bindSet(boundTo, key, handle);
16109
16139
  }
16110
- return stopScan;
16111
- });
16112
- return bestMatchPath;
16140
+ };
16113
16141
  }
16114
16142
 
16115
- /*eslint @typescript-eslint/no-explicit-any:"off"*/
16116
- // any is used with intent here, as the recursive TreeNode value requires its use to terminate.
16117
-
16118
- // MARK: Expand
16119
-
16120
16143
  /**
16121
- * ExpandTreeFunction configuration.
16144
+ * Contextual function that configures the context's Handler with the input function for the context's key.
16122
16145
  */
16123
16146
 
16124
16147
  /**
16125
- * Extended ExpandTree configuration with custom node building.
16148
+ * Creates a HandlerSetFunction.
16149
+ *
16150
+ * @param accessor
16151
+ * @param key
16152
+ * @returns
16126
16153
  */
16154
+ function handlerSetFunction(accessor, key) {
16155
+ const fn = handlerFunction => {
16156
+ accessor.set(key, handlerFunction); // set the handler on the pre-defined key.
16157
+ };
16158
+
16159
+ fn.key = key;
16160
+ return fn;
16161
+ }
16162
+ function handlerMappedSetFunction(accessor, key, mapFn) {
16163
+ const handlerSet = handlerSetFunction(accessor, key);
16164
+ return handlerFunction => {
16165
+ // set an intermediary function that calls the target function. We don't use an arrow function so we have access to the "this", if bound.
16166
+ handlerSet(function (value) {
16167
+ const mapped = mapFn(value); // fowards "this" to the next call.
16168
+ return handlerFunction.call(this, mapped);
16169
+ });
16170
+ };
16171
+ }
16127
16172
 
16128
16173
  /**
16129
- * Expands the input value into a TreeNode.
16174
+ * Factory for a HandlerMappedSetFunction<I>.
16130
16175
  */
16131
16176
 
16177
+ function handlerMappedSetFunctionFactory(accessor, mapFn) {
16178
+ return key => handlerMappedSetFunction(accessor, key, mapFn);
16179
+ }
16180
+
16132
16181
  /**
16133
- * Creates an ExpandTreeFunction from the input configuration.
16134
- *
16135
- * @param config
16182
+ * Config for handlerConfigurerFactory().
16136
16183
  */
16137
16184
 
16138
- function expandTreeFunction(config) {
16139
- var _makeNode;
16140
- const makeNode = (_makeNode = config.makeNode) != null ? _makeNode : node => node;
16141
- const expandFn = (value, parent) => {
16142
- const depth = parent ? parent.depth + 1 : 0;
16143
- const treeNode = {
16144
- depth,
16145
- parent,
16146
- value
16185
+ function handlerConfigurerFactory(config) {
16186
+ return handler => {
16187
+ return (bindTo, configure) => {
16188
+ const accessor = handlerBindAccessor(bindTo, handler);
16189
+ const configurer = config.configurerForAccessor(accessor);
16190
+ configure(configurer);
16147
16191
  };
16148
- const node = makeNode(treeNode);
16149
- const childrenValues = config.getChildren(value);
16150
- node.children = childrenValues ? childrenValues.map(x => expandFn(x, node)) : undefined;
16151
- return node;
16152
16192
  };
16153
- return root => expandFn(root);
16154
16193
  }
16155
16194
 
16156
16195
  /**
16157
- * Convenience function for expanding multiple values into trees then merging them together into a single array.
16158
- *
16159
- * @param values
16160
- * @param expandFn
16161
- * @returns
16196
+ * Registry used to load model services when requested.
16162
16197
  */
16163
- function expandTrees(values, expandFn) {
16164
- return values.map(expandFn);
16165
- }
16166
16198
 
16167
- // MARK: Flatten
16168
16199
  /**
16169
- * Flattens the tree by pushing the values into the input array, or a new array and returns the value.
16200
+ * TypedServiceRegistry implementation.
16170
16201
  */
16171
-
16202
+ class TypedServiceRegistryInstance {
16203
+ constructor() {
16204
+ this._map = new Map();
16205
+ }
16206
+ registerServiceForType(type, service) {
16207
+ const getter = asGetter(service);
16208
+ this._map.set(type, getter);
16209
+ }
16210
+ serviceForType(type) {
16211
+ const getter = this._map.get(type);
16212
+ const service = getter == null ? void 0 : getter();
16213
+ if (service == null) {
16214
+ throw new Error(`no service registered for type "${type}"`);
16215
+ }
16216
+ return service;
16217
+ }
16218
+ }
16172
16219
  /**
16173
- * Traverses the tree and flattens it into all tree nodes.
16220
+ * Creates a new TypedServiceRegistryInstance and registers the input types.
16221
+ * @returns
16174
16222
  */
16175
- function flattenTree(tree) {
16176
- return flattenTreeToArray(tree, []);
16223
+ function typedServiceRegistry(config) {
16224
+ const instance = new TypedServiceRegistryInstance();
16225
+ forEachKeyValue(config.services, {
16226
+ forEach: ([key, service]) => {
16227
+ instance.registerServiceForType(key, service);
16228
+ }
16229
+ });
16230
+ return instance;
16231
+ }
16232
+
16233
+ class StoredDataError extends BaseError {
16234
+ constructor(message) {
16235
+ super(message);
16236
+ }
16237
+ }
16238
+ class DataDoesNotExistError extends StoredDataError {
16239
+ constructor(message) {
16240
+ super(message);
16241
+ }
16242
+ }
16243
+ class DataIsExpiredError extends StoredDataError {
16244
+ constructor(data, message) {
16245
+ super(message);
16246
+ this.data = data;
16247
+ }
16248
+ }
16249
+
16250
+ class MemoryStorageInstance {
16251
+ constructor() {
16252
+ this._length = 0;
16253
+ this._storage = {};
16254
+ }
16255
+ get length() {
16256
+ return this._length;
16257
+ }
16258
+ key(index) {
16259
+ var _Object$keys$index;
16260
+ return (_Object$keys$index = Object.keys(this._storage)[index]) != null ? _Object$keys$index : null;
16261
+ }
16262
+ hasKey(key) {
16263
+ return objectHasKey(this._storage, key);
16264
+ }
16265
+ getItem(key) {
16266
+ var _this$_storage$key;
16267
+ return (_this$_storage$key = this._storage[key]) != null ? _this$_storage$key : null;
16268
+ }
16269
+ setItem(key, item) {
16270
+ if (item == null) {
16271
+ this.removeItem(key);
16272
+ } else {
16273
+ if (!this.hasKey(key)) {
16274
+ this._length = this._length + 1;
16275
+ }
16276
+ this._storage[key] = String(item);
16277
+ }
16278
+ }
16279
+ removeItem(key) {
16280
+ if (this.hasKey(key)) {
16281
+ delete this._storage[key]; // Remove the property
16282
+ this._length = this._length - 1;
16283
+ }
16284
+ }
16285
+ clear() {
16286
+ this._storage = {};
16287
+ this._length = 0;
16288
+ }
16177
16289
  }
16290
+ const SHARED_MEMORY_STORAGE = new MemoryStorageInstance();
16178
16291
 
16179
16292
  /**
16180
- * Traverses the tree and pushes the nodes into the input array.
16293
+ * Limited Class/Interface for storing string values synchronously.
16294
+ */
16295
+ class SimpleStorageObject {}
16296
+
16297
+ /**
16298
+ * Synchronous Class/Interface for storing string values.
16181
16299
  *
16182
- * @param tree
16183
- * @param array
16184
- * @returns
16300
+ * Has the same interface as localStorage for the web.
16185
16301
  */
16186
- function flattenTreeToArray(tree, array) {
16187
- return flattenTreeToArrayFunction()(tree, array);
16302
+ class StorageObject extends SimpleStorageObject {
16303
+ constructor(...args) {
16304
+ super(...args);
16305
+ this.length = void 0;
16306
+ }
16307
+ /**
16308
+ * Returns the string key for the index.
16309
+ *
16310
+ * Returns null if no key available.
16311
+ */
16188
16312
  }
16189
- function flattenTreeToArrayFunction(mapNodeFn) {
16190
- const mapNode = mapNodeFn != null ? mapNodeFn : x => x;
16191
- const flattenFn = (tree, array = []) => {
16192
- array.push(mapNode(tree));
16193
- if (tree.children) {
16194
- tree.children.forEach(x => flattenFn(x, array));
16313
+ class FullStorageObject extends StorageObject {
16314
+ constructor(...args) {
16315
+ super(...args);
16316
+ this.isPersistant = void 0;
16317
+ this.isAvailable = void 0;
16318
+ }
16319
+ }
16320
+ class StorageObjectUtility {
16321
+ static allKeysFromStorageObject(storageObject, prefix) {
16322
+ const length = storageObject.length;
16323
+ let result;
16324
+ if (length > 0) {
16325
+ result = range({
16326
+ start: 0,
16327
+ end: length
16328
+ }).map(x => storageObject.key(x)).filter(hasNonNullValue);
16329
+ if (prefix) {
16330
+ result = result.filter(x => x.startsWith(prefix));
16331
+ }
16332
+ } else {
16333
+ result = [];
16195
16334
  }
16196
- return array;
16197
- };
16198
- return flattenFn;
16335
+ return result;
16336
+ }
16199
16337
  }
16200
16338
 
16201
16339
  /**
16202
- * Convenience function for flattening multiple trees with a flatten function.
16203
- *
16204
- * @param trees
16205
- * @param flattenFn
16206
- * @returns
16340
+ * Represents a single CSS class
16207
16341
  */
16208
- function flattenTrees(trees, flattenFn) {
16209
- const array = [];
16210
- trees.forEach(x => flattenFn(x, array));
16211
- return array;
16212
- }
16213
16342
 
16214
- /*eslint @typescript-eslint/no-explicit-any:"off"*/
16343
+ /**
16344
+ * Represents one or more CssClasses that are space separated.
16345
+ */
16215
16346
 
16216
16347
  /**
16217
- * Function that expands the input values into a tree, and then flattens the tree to produce a single array of values of another type.
16348
+ * One or more arrays of one or more CSS classes/arrays of classes.
16218
16349
  */
16219
16350
 
16220
16351
  /**
16221
- * Creates an ExpandFlattenTree function.
16352
+ * Joins together various array of classes and only keeps the unique values.
16222
16353
  *
16223
- * @param expand
16224
- * @param flatten
16354
+ * @param cssClasses
16225
16355
  * @returns
16226
16356
  */
16227
- function expandFlattenTreeFunction(expand, flatten) {
16228
- return values => {
16229
- return flattenTrees(expandTrees(values, expand), flatten);
16230
- };
16231
- }
16232
-
16233
- // MARK: Reduce
16234
- function reduceBooleansWithAnd(array, emptyArrayValue) {
16235
- return reduceBooleansWithAndFn(emptyArrayValue)(array);
16236
- }
16237
- function reduceBooleansWithOr(array, emptyArrayValue) {
16238
- return reduceBooleansWithOrFn(emptyArrayValue)(array);
16239
- }
16240
- function reduceBooleansWithAndFn(emptyArrayValue) {
16241
- return reduceBooleansFn((a, b) => a && b, emptyArrayValue);
16242
- }
16243
- function reduceBooleansWithOrFn(emptyArrayValue) {
16244
- return reduceBooleansFn((a, b) => a || b, emptyArrayValue);
16245
- }
16246
- function reduceBooleansFn(reduceFn, emptyArrayValue) {
16247
- const rFn = array => Boolean(array.reduce(reduceFn));
16248
- if (emptyArrayValue != null) {
16249
- return array => array.length ? rFn(array) : emptyArrayValue;
16250
- } else {
16251
- return rFn;
16357
+ function spaceSeparatedCssClasses(cssClasses) {
16358
+ let result = '';
16359
+ if (cssClasses) {
16360
+ const allClasses = cssClassesSet(cssClasses);
16361
+ result = joinStringsWithSpaces(Array.from(allClasses));
16252
16362
  }
16363
+ return result;
16253
16364
  }
16254
16365
 
16255
- // MARK: Random
16256
16366
  /**
16257
- * Factory that generates boolean values.
16367
+ * Joins together various array of classes and returns the set of unique CSS classes.
16368
+ *
16369
+ * @param cssClasses
16370
+ * @returns
16258
16371
  */
16372
+ function cssClassesSet(cssClasses) {
16373
+ let result;
16374
+ if (cssClasses) {
16375
+ const arrayOfClasses = iterableToArray(cssClasses, false);
16376
+ const arrayOfAllClassValues = arrayOfClasses.map(x => asArray(x).map(x => x.split(' ')).flat()).flat();
16377
+ result = new Set(arrayOfAllClassValues);
16378
+ } else {
16379
+ result = new Set();
16380
+ }
16381
+ return result;
16382
+ }
16259
16383
 
16260
16384
  /**
16261
- * Number from 0.0 to 100.0 used for the chance to return true.
16385
+ * SortCompareFunction by string.
16262
16386
  */
16263
16387
 
16264
16388
  /**
16265
- * Creates a new BooleanFactory.
16266
- *
16267
- * @param config
16268
- * @returns
16389
+ * Creates a SortByStringFunction that sorts values in ascending order.
16269
16390
  */
16270
- function booleanFactory(config) {
16271
- const {
16272
- chance: inputChance
16273
- } = config;
16274
- const chance = inputChance / 100;
16275
- return () => {
16276
- const roll = Math.random();
16277
- const result = roll <= chance;
16278
- return result;
16391
+ function sortByStringFunction(readStringFn) {
16392
+ return (a, b) => {
16393
+ const as = readStringFn(a);
16394
+ const bs = readStringFn(b);
16395
+ return as.localeCompare(bs);
16279
16396
  };
16280
16397
  }
16281
16398
 
16282
- /**
16283
- * Returns a random boolean.
16284
- *
16285
- * @param chance Number between 0 and 100
16286
- * @returns
16287
- */
16288
- function randomBoolean(chance = 50) {
16289
- return booleanFactory({
16290
- chance
16291
- })();
16292
- }
16399
+ // MARK: Configured
16293
16400
 
16294
- /**
16295
- * Values that correspond to each day of the week.
16296
- */
16401
+ const sortByLabelFunction = sortByStringFunction(x => x.label);
16297
16402
 
16403
+ // MARK: Search Strings
16298
16404
  /**
16299
- * Returns the day of the week for the input day.
16300
- *
16301
- * Equivalent to date.getDay()
16302
- *
16303
- * @param date
16304
- * @returns
16405
+ * Decision function factory that is configured with search string values.
16305
16406
  */
16306
- function dayOfWeek(date) {
16307
- return date.getDay();
16308
- }
16309
16407
 
16310
16408
  /**
16311
- * Decision function that checks whether or not the input DayOfWeek or the DayOfWeek for the input Date is in the set.
16409
+ * Filters values by the input filter text.
16312
16410
  */
16313
16411
 
16314
16412
  /**
16315
- * Creates a DecisionFunction that checks whether or not the input day or days of
16413
+ * Creates a SearchStringFilterFunction
16316
16414
  *
16317
- * @param allowedDaysOfWeek
16415
+ * @param config
16318
16416
  * @returns
16319
16417
  */
16320
- function isInAllowedDaysOfWeekSet(allowedDaysOfWeek) {
16321
- return isInSetDecisionFunction(allowedDaysOfWeek, x => {
16322
- return typeof x === 'number' ? x : dayOfWeek(x);
16323
- });
16418
+ function searchStringFilterFunction(config) {
16419
+ const {
16420
+ readStrings,
16421
+ decisionFactory = caseInsensitiveFilterByIndexOfDecisionFactory
16422
+ } = typeof config === 'function' ? {
16423
+ readStrings: config
16424
+ } : config;
16425
+ return (filterText, values) => {
16426
+ const decision = decisionFactory(filterText);
16427
+ return values.filter(value => {
16428
+ const searchResult = readStrings(value);
16429
+ let match = false;
16430
+ if (Array.isArray(searchResult)) {
16431
+ match = searchResult.findIndex(decision) !== -1;
16432
+ } else if (searchResult != null) {
16433
+ match = decision(searchResult);
16434
+ }
16435
+ return match;
16436
+ });
16437
+ };
16324
16438
  }
16325
16439
 
16326
16440
  /**
16327
- * Returns all days of the week starting from the given day up to the specified number of days.
16328
- *
16329
- * Returns 7 days by default.
16441
+ * SearchStringDecisionFunctionFactory that searches for string matches using the input search term/filter text.
16330
16442
  *
16331
- * @param startingOn
16443
+ * @param filterText
16444
+ * @returns
16332
16445
  */
16333
- function daysOfWeekArray(startingOn = Day.SUNDAY, maxDays = 7) {
16334
- const days = [];
16335
- let day = startingOn;
16336
- while (days.length < maxDays) {
16337
- days.push(day);
16338
- if (day === Day.SATURDAY) {
16339
- day = Day.SUNDAY;
16340
- } else {
16341
- day += 1;
16342
- }
16343
- }
16344
- return days;
16345
- }
16446
+ const caseInsensitiveFilterByIndexOfDecisionFactory = filterText => {
16447
+ const searchString = filterText.toLocaleLowerCase();
16448
+ return string => string.toLocaleLowerCase().indexOf(searchString) !== -1;
16449
+ };
16346
16450
 
16347
16451
  /**
16348
- * Enum for the days of the week.
16452
+ * A tree node
16349
16453
  */
16350
- let Day = /*#__PURE__*/function (Day) {
16351
- Day[Day["SUNDAY"] = 0] = "SUNDAY";
16352
- Day[Day["MONDAY"] = 1] = "MONDAY";
16353
- Day[Day["TUESDAY"] = 2] = "TUESDAY";
16354
- Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
16355
- Day[Day["THURSDAY"] = 4] = "THURSDAY";
16356
- Day[Day["FRIDAY"] = 5] = "FRIDAY";
16357
- Day[Day["SATURDAY"] = 6] = "SATURDAY";
16358
- return Day;
16359
- }({});
16360
16454
 
16455
+ const SPLIT_STRING_TREE_NODE_ROOT_VALUE = '';
16361
16456
  /**
16362
- * Object containing the name of every day and whether they're true/false.
16457
+ * Creates a SplitStringTreeFactory with the configured splitter.
16458
+ *
16459
+ * @param config
16460
+ * @returns
16363
16461
  */
16364
-
16365
- function enabledDaysFromDaysOfWeek(input) {
16366
- const set = new Set(input);
16367
- return {
16368
- sunday: set.has(Day.SUNDAY),
16369
- monday: set.has(Day.MONDAY),
16370
- tuesday: set.has(Day.TUESDAY),
16371
- wednesday: set.has(Day.WEDNESDAY),
16372
- thursday: set.has(Day.THURSDAY),
16373
- friday: set.has(Day.FRIDAY),
16374
- saturday: set.has(Day.SATURDAY)
16375
- };
16376
- }
16377
- function daysOfWeekFromEnabledDays(input) {
16378
- const daysOfWeek = [];
16379
- if (input) {
16380
- if (input.sunday) {
16381
- daysOfWeek.push(Day.SUNDAY);
16382
- }
16383
- if (input.monday) {
16384
- daysOfWeek.push(Day.MONDAY);
16385
- }
16386
- if (input.tuesday) {
16387
- daysOfWeek.push(Day.TUESDAY);
16388
- }
16389
- if (input.wednesday) {
16390
- daysOfWeek.push(Day.WEDNESDAY);
16391
- }
16392
- if (input.thursday) {
16393
- daysOfWeek.push(Day.THURSDAY);
16394
- }
16395
- if (input.friday) {
16396
- daysOfWeek.push(Day.FRIDAY);
16397
- }
16398
- if (input.saturday) {
16399
- daysOfWeek.push(Day.SATURDAY);
16400
- }
16462
+ function splitStringTreeFactory(config) {
16463
+ const {
16464
+ separator
16465
+ } = config;
16466
+ const fn = (input, existing) => {
16467
+ const {
16468
+ leafMeta,
16469
+ nodeMeta,
16470
+ values
16471
+ } = input;
16472
+ const result = existing != null ? existing : {
16473
+ fullValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
16474
+ nodeValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
16475
+ children: {}
16476
+ };
16477
+ asArray(values).forEach(value => {
16478
+ addToSplitStringTree(result, {
16479
+ value,
16480
+ leafMeta,
16481
+ nodeMeta
16482
+ }, config);
16483
+ });
16484
+ return result;
16485
+ };
16486
+ fn._separator = separator;
16487
+ return fn;
16488
+ }
16489
+ function applySplitStringTreeWithMultipleValues(input) {
16490
+ const {
16491
+ entries,
16492
+ factory,
16493
+ existing
16494
+ } = input;
16495
+ let result = existing;
16496
+ entries.forEach(entry => {
16497
+ result = factory(entry, result);
16498
+ });
16499
+ if (!result) {
16500
+ result = factory({
16501
+ values: []
16502
+ });
16401
16503
  }
16402
- return daysOfWeek;
16504
+ return result;
16403
16505
  }
16404
16506
  /**
16405
- * Returns an array of strinsg with each day of the week named.
16507
+ * Adds a value to the target SplitStringTree.
16406
16508
  *
16509
+ * @param tree
16510
+ * @param value
16511
+ * @param separator
16407
16512
  * @returns
16408
16513
  */
16409
- function getDaysOfWeekNames(sundayFirst = true, transform) {
16410
- const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
16411
- const sunday = 'Sunday';
16412
- let dayOfWeekNames;
16413
- if (sundayFirst) {
16414
- dayOfWeekNames = [sunday, ...days];
16415
- } else {
16416
- dayOfWeekNames = [...days, sunday];
16514
+ function addToSplitStringTree(tree, inputValue, config) {
16515
+ const {
16516
+ separator,
16517
+ mergeMeta
16518
+ } = config;
16519
+ const {
16520
+ value,
16521
+ leafMeta,
16522
+ nodeMeta
16523
+ } = inputValue;
16524
+ function nextMeta(node, nextMeta) {
16525
+ if (mergeMeta && node.meta != null) {
16526
+ return mergeMeta(node.meta, nextMeta);
16527
+ } else {
16528
+ return nextMeta;
16529
+ }
16417
16530
  }
16418
- if (transform != null) {
16419
- if (transform.abbreviation) {
16420
- dayOfWeekNames = dayOfWeekNames.map(x => x.slice(0, 3));
16531
+ const parts = value.split(separator);
16532
+ let currentNode = tree;
16533
+ parts.forEach(nodeValue => {
16534
+ const existingChildNode = currentNode.children[nodeValue];
16535
+ const childNode = existingChildNode != null ? existingChildNode : {
16536
+ nodeValue,
16537
+ children: {}
16538
+ }; // use the existing node or create a new node
16539
+
16540
+ if (!existingChildNode) {
16541
+ childNode.fullValue = currentNode.fullValue ? currentNode.fullValue + separator + nodeValue : nodeValue;
16542
+ currentNode.children[nodeValue] = childNode;
16421
16543
  }
16422
- if (transform.uppercase) {
16423
- dayOfWeekNames = dayOfWeekNames.map(x => x.toUpperCase());
16544
+
16545
+ // add the meta to the node
16546
+ if (nodeMeta != null) {
16547
+ childNode.meta = nextMeta(childNode, nodeMeta);
16424
16548
  }
16549
+ currentNode = childNode;
16550
+ });
16551
+
16552
+ // add the meta to the leaf node
16553
+ if (leafMeta != null) {
16554
+ currentNode.meta = nextMeta(currentNode, leafMeta);
16425
16555
  }
16426
- return dayOfWeekNames;
16427
- }
16428
- function daysOfWeekNameMap(transform) {
16429
- const dayOfWeekNames = getDaysOfWeekNames(true, transform);
16430
- return new Map(dayOfWeekNames.map((x, i) => [i, x]));
16431
- }
16432
- function daysOfWeekNameFunction(transform) {
16433
- const map = daysOfWeekNameMap(transform);
16434
- return dayOfWeek => {
16435
- var _map$get;
16436
- return (_map$get = map.get(dayOfWeek)) != null ? _map$get : 'UNKNOWN';
16437
- };
16438
- }
16439
- function getDayTomorrow(day) {
16440
- return getNextDay(day, 1);
16441
- }
16442
- function getDayYesterday(day) {
16443
- return getPreviousDay(day, 1);
16444
- }
16445
- function getDayOffset(day, days) {
16446
- if (days === 0) {
16447
- return day;
16448
- } else if (days < 0) {
16449
- return getPreviousDay(day, days);
16450
- } else {
16451
- return getNextDay(day, days);
16452
- }
16453
- }
16454
- function getPreviousDay(day, days = 1) {
16455
- const offset = Math.abs(days) % 7;
16456
- const cap = 7 - offset;
16457
- return getNextDay(day, cap);
16458
- }
16459
- function getNextDay(day, days = 1) {
16460
- let result = (day + days) % 7;
16461
- if (result < 0) {
16462
- result = 7 + result;
16463
- }
16464
- return result;
16556
+ return tree;
16465
16557
  }
16466
16558
 
16559
+ // MARK: Search
16467
16560
  /**
16468
- * Returns the number of invocations that have occurred since the period started.
16561
+ * Returns the best match for the value in the tree, including the input tree value.
16469
16562
  *
16470
- * When a new period has started, returns 0.
16563
+ * Only returns a result if there is match of any kind.
16564
+ *
16565
+ * @param tree
16566
+ * @param value
16567
+ * @returns
16471
16568
  */
16472
-
16473
- function timePeriodCounter(timePeriodLength, lastTimePeriodStart) {
16474
- function reset(inputStart) {
16475
- const start = inputStart != null ? inputStart : new Date();
16476
- fn._timePeriodCount = 0;
16477
- fn._lastTimePeriodStart = start;
16478
- fn._nextTimePeriodEnd = new Date(start.getTime() + timePeriodLength);
16479
- return fn._nextTimePeriodEnd;
16480
- }
16481
- const fn = () => {
16482
- const now = new Date();
16483
- if (now > fn._nextTimePeriodEnd) {
16484
- reset(now);
16485
- } else {
16486
- fn._timePeriodCount += 1;
16487
- }
16488
- return fn._timePeriodCount;
16489
- };
16490
- fn._timePeriodLength = timePeriodLength;
16491
- reset(lastTimePeriodStart);
16492
- fn._timePeriodCount = -1;
16493
- fn._reset = reset;
16494
- return fn;
16569
+ function findBestSplitStringTreeMatch(tree, value) {
16570
+ return lastValue(findBestSplitStringTreeMatchPath(tree, value));
16495
16571
  }
16496
16572
 
16497
16573
  /**
16498
- * Timer object that counts down a fixed duration amount.
16574
+ * Returns the best match for the value in the true, excluding the input tree value.
16499
16575
  *
16500
- * The timer is not required to start immediately.
16576
+ * Only returns a result if there is match of any kind.
16501
16577
  *
16502
- * Once the timer has complete it cannot be reset.
16578
+ * @param tree
16579
+ * @param value
16580
+ * @returns
16503
16581
  */
16504
-
16505
- class TimerCancelledError extends BaseError {
16506
- constructor() {
16507
- super(`The timer was destroyed before it was completed.`);
16508
- }
16582
+ function findBestSplitStringTreeChildMatch(tree, value) {
16583
+ return lastValue(findBestSplitStringTreeChildMatchPath(tree, value));
16509
16584
  }
16510
- class TimerInstance {
16511
- constructor(duration, startImmediately = true) {
16512
- this._createdAt = new Date();
16513
- this._startedAt = new Date();
16514
- this._pausedAt = void 0;
16515
- this._state = 'paused';
16516
- this._duration = void 0;
16517
- this._promiseRef = promiseReference();
16518
- this._duration = duration;
16519
- if (startImmediately) {
16520
- this.start();
16521
- this._startedAt = this._createdAt;
16522
- }
16523
- }
16524
- get state() {
16525
- return this._state;
16526
- }
16527
- get createdAt() {
16528
- return this._createdAt;
16529
- }
16530
- get pausedAt() {
16531
- return this._pausedAt;
16532
- }
16533
- get startedAt() {
16534
- return this._startedAt;
16535
- }
16536
- get promise() {
16537
- return this._promiseRef.promise;
16538
- }
16539
- get duration() {
16540
- return this._duration;
16541
- }
16542
- get durationRemaining() {
16543
- let remaining;
16544
- switch (this._state) {
16545
- case 'complete':
16546
- remaining = 0;
16547
- break;
16548
- case 'running':
16549
- remaining = Math.max(0, this._duration - (new Date().getTime() - this._startedAt.getTime()));
16550
- break;
16551
- case 'paused':
16552
- remaining = null;
16553
- break;
16554
- }
16555
- return remaining;
16556
- }
16557
- start() {
16558
- if (this._state === 'paused') {
16559
- this._state = 'running';
16560
- this._startedAt = new Date();
16561
- this._enqueueCheck();
16562
- }
16563
- }
16564
- stop() {
16565
- if (this._state === 'running') {
16566
- this._state = 'paused';
16567
- this._pausedAt = new Date();
16568
- }
16569
- }
16570
- reset() {
16571
- if (this._state !== 'complete') {
16572
- this._state = 'running';
16573
- this._startedAt = new Date();
16574
- this._enqueueCheck();
16575
- }
16576
- }
16577
- setDuration(duration) {
16578
- this._duration = duration;
16579
- }
16580
- destroy() {
16581
- this._checkComplete();
16582
- if (this._state === 'running') {
16583
- const error = new TimerCancelledError();
16584
- this._promiseRef.reject(error);
16585
- this._state = 'complete'; // mark as complete
16586
- }
16585
+
16586
+ /**
16587
+ * Returns the best match for the value in the tree, including the input tree value.
16588
+ *
16589
+ * Only returns a result if there is match of any kind.
16590
+ *
16591
+ * @param tree
16592
+ * @param value
16593
+ * @returns
16594
+ */
16595
+ function findBestSplitStringTreeMatchPath(tree, value) {
16596
+ let bestResult = findBestSplitStringTreeChildMatchPath(tree, value);
16597
+ if (!bestResult && tree.fullValue && value.startsWith(tree.fullValue)) {
16598
+ bestResult = [tree];
16587
16599
  }
16600
+ return bestResult;
16601
+ }
16588
16602
 
16589
- _checkComplete() {
16590
- if (this._state !== 'complete' && this.durationRemaining === 0) {
16591
- this._state = 'complete';
16592
- this._promiseRef.resolve();
16593
- }
16594
- }
16595
- _enqueueCheck() {
16596
- const durationRemaining = this.durationRemaining;
16597
- if (durationRemaining != null && this._state !== 'complete') {
16598
- setTimeout(() => {
16599
- this._checkComplete();
16600
- this._enqueueCheck();
16601
- }, durationRemaining);
16603
+ /**
16604
+ * Returns the best match for the value in the true, excluding the input tree value.
16605
+ *
16606
+ * Only returns a result if there is match of any kind.
16607
+ *
16608
+ * @param tree
16609
+ * @param value
16610
+ * @returns
16611
+ */
16612
+ function findBestSplitStringTreeChildMatchPath(tree, value) {
16613
+ const {
16614
+ children
16615
+ } = tree;
16616
+ let bestMatchPath;
16617
+ Object.entries(children).find(([_, child]) => {
16618
+ let stopScan = false;
16619
+ if (value.startsWith(child.fullValue)) {
16620
+ var _findBestSplitStringT;
16621
+ const bestChildPath = (_findBestSplitStringT = findBestSplitStringTreeChildMatchPath(child, value)) != null ? _findBestSplitStringT : [];
16622
+ bestMatchPath = [child, ...bestChildPath];
16623
+ stopScan = true;
16602
16624
  }
16603
- }
16625
+ return stopScan;
16626
+ });
16627
+ return bestMatchPath;
16604
16628
  }
16605
- function timer(duration, startNow = true) {
16606
- return new TimerInstance(duration, startNow);
16629
+
16630
+ /*eslint @typescript-eslint/no-explicit-any:"off"*/
16631
+ // any is used with intent here, as the recursive TreeNode value requires its use to terminate.
16632
+
16633
+ // MARK: Expand
16634
+
16635
+ /**
16636
+ * ExpandTreeFunction configuration.
16637
+ */
16638
+
16639
+ /**
16640
+ * Extended ExpandTree configuration with custom node building.
16641
+ */
16642
+
16643
+ /**
16644
+ * Expands the input value into a TreeNode.
16645
+ */
16646
+
16647
+ /**
16648
+ * Creates an ExpandTreeFunction from the input configuration.
16649
+ *
16650
+ * @param config
16651
+ */
16652
+
16653
+ function expandTreeFunction(config) {
16654
+ var _makeNode;
16655
+ const makeNode = (_makeNode = config.makeNode) != null ? _makeNode : node => node;
16656
+ const expandFn = (value, parent) => {
16657
+ const depth = parent ? parent.depth + 1 : 0;
16658
+ const treeNode = {
16659
+ depth,
16660
+ parent,
16661
+ value
16662
+ };
16663
+ const node = makeNode(treeNode);
16664
+ const childrenValues = config.getChildren(value);
16665
+ node.children = childrenValues ? childrenValues.map(x => expandFn(x, node)) : undefined;
16666
+ return node;
16667
+ };
16668
+ return root => expandFn(root);
16607
16669
  }
16608
16670
 
16609
16671
  /**
16610
- * Toggles the input Timer's running state.
16672
+ * Convenience function for expanding multiple values into trees then merging them together into a single array.
16611
16673
  *
16612
- * @param timer
16613
- * @param toggleRun
16674
+ * @param values
16675
+ * @param expandFn
16676
+ * @returns
16614
16677
  */
16615
- function toggleTimerRunning(timer, toggleRun) {
16616
- toggleRun = toggleRun != null ? toggleRun : timer.state !== 'running';
16617
- if (toggleRun) {
16618
- timer.start();
16619
- } else {
16620
- timer.stop();
16621
- }
16678
+ function expandTrees(values, expandFn) {
16679
+ return values.map(expandFn);
16622
16680
  }
16623
16681
 
16682
+ // MARK: Flatten
16624
16683
  /**
16625
- * Returns the approximate end date of the given timer. If a timer is already complete, it returns the time for now.
16684
+ * Flattens the tree by pushing the values into the input array, or a new array and returns the value.
16626
16685
  */
16627
- function approximateTimerEndDate(timer) {
16628
- const durationRemaining = timer.durationRemaining;
16629
- if (durationRemaining != null) {
16630
- return new Date(Date.now() + durationRemaining);
16631
- } else {
16632
- return null;
16633
- }
16686
+
16687
+ /**
16688
+ * Traverses the tree and flattens it into all tree nodes.
16689
+ */
16690
+ function flattenTree(tree) {
16691
+ return flattenTreeToArray(tree, []);
16634
16692
  }
16635
16693
 
16636
16694
  /**
16637
- * Represents a string for a time. This may be human-input, and
16638
- * can be interpreted in various ways depending on the input.
16695
+ * Traverses the tree and pushes the nodes into the input array.
16639
16696
  *
16640
- * Examples:
16641
- * - 1:20AM
16642
- * - 1:20
16643
- * - 120AM
16644
- * - 120
16697
+ * @param tree
16698
+ * @param array
16699
+ * @returns
16645
16700
  */
16701
+ function flattenTreeToArray(tree, array) {
16702
+ return flattenTreeToArrayFunction()(tree, array);
16703
+ }
16704
+ function flattenTreeToArrayFunction(mapNodeFn) {
16705
+ const mapNode = mapNodeFn != null ? mapNodeFn : x => x;
16706
+ const flattenFn = (tree, array = []) => {
16707
+ array.push(mapNode(tree));
16708
+ if (tree.children) {
16709
+ tree.children.forEach(x => flattenFn(x, array));
16710
+ }
16711
+ return array;
16712
+ };
16713
+ return flattenFn;
16714
+ }
16646
16715
 
16647
- let TimeAM = /*#__PURE__*/function (TimeAM) {
16648
- TimeAM["AM"] = "AM";
16649
- TimeAM["PM"] = "PM";
16650
- return TimeAM;
16651
- }({});
16652
- const DATE_NOW_VALUE = 'now';
16716
+ /**
16717
+ * Convenience function for flattening multiple trees with a flatten function.
16718
+ *
16719
+ * @param trees
16720
+ * @param flattenFn
16721
+ * @returns
16722
+ */
16723
+ function flattenTrees(trees, flattenFn) {
16724
+ const array = [];
16725
+ trees.forEach(x => flattenFn(x, array));
16726
+ return array;
16727
+ }
16728
+
16729
+ /*eslint @typescript-eslint/no-explicit-any:"off"*/
16653
16730
 
16654
16731
  /**
16655
- * A date that is characterized by either a known string value, or a Date.
16732
+ * Function that expands the input values into a tree, and then flattens the tree to produce a single array of values of another type.
16656
16733
  */
16657
16734
 
16658
16735
  /**
16659
- * Returns a Date value from the input LogicalDate.
16736
+ * Creates an ExpandFlattenTree function.
16660
16737
  *
16661
- * @param logicalDate
16738
+ * @param expand
16739
+ * @param flatten
16740
+ * @returns
16662
16741
  */
16742
+ function expandFlattenTreeFunction(expand, flatten) {
16743
+ return values => {
16744
+ return flattenTrees(expandTrees(values, expand), flatten);
16745
+ };
16746
+ }
16663
16747
 
16664
- function dateFromLogicalDate(logicalDate) {
16665
- let result;
16666
- if (typeof logicalDate === 'string') {
16667
- switch (logicalDate.toLocaleLowerCase()) {
16668
- case DATE_NOW_VALUE:
16669
- result = new Date();
16670
- break;
16671
- default:
16672
- throw new Error(`Unknown logical date string "${logicalDate}"`);
16673
- }
16748
+ // MARK: Reduce
16749
+ function reduceBooleansWithAnd(array, emptyArrayValue) {
16750
+ return reduceBooleansWithAndFn(emptyArrayValue)(array);
16751
+ }
16752
+ function reduceBooleansWithOr(array, emptyArrayValue) {
16753
+ return reduceBooleansWithOrFn(emptyArrayValue)(array);
16754
+ }
16755
+ function reduceBooleansWithAndFn(emptyArrayValue) {
16756
+ return reduceBooleansFn((a, b) => a && b, emptyArrayValue);
16757
+ }
16758
+ function reduceBooleansWithOrFn(emptyArrayValue) {
16759
+ return reduceBooleansFn((a, b) => a || b, emptyArrayValue);
16760
+ }
16761
+ function reduceBooleansFn(reduceFn, emptyArrayValue) {
16762
+ const rFn = array => Boolean(array.reduce(reduceFn));
16763
+ if (emptyArrayValue != null) {
16764
+ return array => array.length ? rFn(array) : emptyArrayValue;
16674
16765
  } else {
16675
- result = logicalDate;
16766
+ return rFn;
16676
16767
  }
16677
- return result;
16678
16768
  }
16679
- function isLogicalDateStringCode(logicalDate) {
16680
- let isLogicalDateStringCode = false;
16681
- if (typeof logicalDate === 'string') {
16682
- switch (logicalDate.toLocaleLowerCase()) {
16683
- case DATE_NOW_VALUE:
16684
- isLogicalDateStringCode = true;
16685
- break;
16686
- }
16687
- }
16688
- return isLogicalDateStringCode;
16769
+
16770
+ // MARK: Random
16771
+ /**
16772
+ * Factory that generates boolean values.
16773
+ */
16774
+
16775
+ /**
16776
+ * Number from 0.0 to 100.0 used for the chance to return true.
16777
+ */
16778
+
16779
+ /**
16780
+ * Creates a new BooleanFactory.
16781
+ *
16782
+ * @param config
16783
+ * @returns
16784
+ */
16785
+ function booleanFactory(config) {
16786
+ const {
16787
+ chance: inputChance
16788
+ } = config;
16789
+ const chance = inputChance / 100;
16790
+ return () => {
16791
+ const roll = Math.random();
16792
+ const result = roll <= chance;
16793
+ return result;
16794
+ };
16795
+ }
16796
+
16797
+ /**
16798
+ * Returns a random boolean.
16799
+ *
16800
+ * @param chance Number between 0 and 100
16801
+ * @returns
16802
+ */
16803
+ function randomBoolean(chance = 50) {
16804
+ return booleanFactory({
16805
+ chance
16806
+ })();
16689
16807
  }
16690
16808
 
16691
16809
  /**
@@ -16786,9 +16904,14 @@ function isFinalPage(page) {
16786
16904
  }
16787
16905
 
16788
16906
  // MARK: PageCalculator
16907
+ /**
16908
+ * @deprecated
16909
+ */
16789
16910
 
16790
16911
  /**
16791
- * Page calcuaktion context for calculating the amount to skip/etc.
16912
+ * Page calculation context for calculating the amount to skip/etc.
16913
+ *
16914
+ * @deprecated
16792
16915
  */
16793
16916
  class PageCalculator {
16794
16917
  constructor(config) {
@@ -16873,4 +16996,4 @@ async function iterateFilteredPages(inputPage, loadFn, iterFn) {
16873
16996
  return count;
16874
16997
  }
16875
16998
 
16876
- 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, MINUTE_OF_DAY_MAXMIMUM, MINUTE_OF_DAY_MINIUMUM, 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, NUMBER_STRING_DENCODER_64, NUMBER_STRING_DENCODER_64_DEFAULT_NEGATIVE_PREFIX, NUMBER_STRING_DENCODER_64_DIGITS, 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, SPLIT_STRING_TREE_NODE_ROOT_VALUE, 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, TimerCancelledError, TimerInstance, 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, addToSplitStringTree, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, allowValueOnceFilter, applyBestFit, applySplitStringTreeWithMultipleValues, applyToMultipleFields, approximateTimerEndDate, areEqualContext, areEqualPOJOValues, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asMinuteOfDay, 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, compareWithMappedValuesFunction, computeNextFractionalHour, computeNextFreeIndexFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countAllInNestedArray, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromLogicalDate, dateFromMinuteOfDay, dateToHoursAndMinutes, dateToMinuteOfDay, 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, filterUniqueByIndex, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findBestSplitStringTreeChildMatch, findBestSplitStringTreeChildMatchPath, findBestSplitStringTreeMatch, findBestSplitStringTreeMatchPath, 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, indexRefMap, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEqualToValueDecisionFunction, 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, isMinuteOfDay, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStringOrTrue, isTrueBooleanKeyArray, isUTCDateString, isUniqueKeyedFunction, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterableToSet, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, labeledValueMap, 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, minutesToHoursAndMinutes, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, numberStringDencoder, numberStringDencoderDecodedNumberValueFunction, numberStringDencoderEncodedStringValueFunction, numberStringDencoderFunction, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, padStartFunction, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksFromFactoryInParallelFunction, 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, sequentialIncrementingNumberStringModelIdFactory, 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, splitStringTreeFactory, startOfDayForSystemDateInUTC, startOfDayForUTCDateInUTC, stepsFromIndex, stepsFromIndexFunction, stringCharactersToIndexRecord, stringFactoryFromFactory, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, terminatingFactoryFromArray, throwKeyIsRequired, timePeriodCounter, timer, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toMinuteOfDay, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, toggleTimerRunning, 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 };
16999
+ 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, MINUTE_OF_DAY_MAXMIMUM, MINUTE_OF_DAY_MINIUMUM, 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, NUMBER_STRING_DENCODER_64, NUMBER_STRING_DENCODER_64_DEFAULT_NEGATIVE_PREFIX, NUMBER_STRING_DENCODER_64_DIGITS, 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, SPLIT_STRING_TREE_NODE_ROOT_VALUE, 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, TimerCancelledError, TimerInstance, 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, addToSplitStringTree, allFalsyOrEmptyKeys, allIndexesInIndexRange, allKeyValueTuples, allMaybeSoKeys, allNonUndefinedKeys, allObjectsAreEqual, allValuesAreMaybeNot, allValuesAreNotMaybe, allowValueOnceFilter, applyBestFit, applySplitStringTreeWithMultipleValues, applyToMultipleFields, approximateTimerEndDate, areEqualContext, areEqualPOJOValues, arrayContainsDuplicateValue, arrayContentsDiffer, arrayDecision, arrayDecisionFunction, arrayFactory, arrayInputFactory, arrayToLowercase, arrayToMap, arrayToObject, arrayToUppercase, asArray, asDecisionFunction, asGetter, asIndexRangeCheckFunctionConfig, asIterable, asMinuteOfDay, 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, compareWithMappedValuesFunction, computeNextFractionalHour, computeNextFreeIndexFunction, concatArrays, concatArraysUnique, containsAllStringsAnyCase, containsAllValues, containsAnyStringAnyCase, containsAnyValue, containsAnyValueFromSet, containsNoValueFromSet, containsNoneOfValue, containsStringAnyCase, convertEmailParticipantStringToParticipant, convertMaybeToArray, convertParticipantToEmailParticipantString, convertToArray, copyArray, copyField, copyLatLngBound, copyLatLngPoint, copyObject, copySetAndDo, countAllInNestedArray, countPOJOKeys, countPOJOKeysFunction, cronExpressionRepeatingEveryNMinutes, cssClassesSet, cutToPrecision, cutValueToInteger, cutValueToPrecision, cutValueToPrecisionFunction, dateFromLogicalDate, dateFromMinuteOfDay, dateToHoursAndMinutes, dateToMinuteOfDay, dayOfWeek, daysOfWeekArray, daysOfWeekFromEnabledDays, daysOfWeekNameFunction, daysOfWeekNameMap, decisionFunction, decodeHashedValues, decodeHashedValuesWithDecodeMap, decodeModelKeyTypePair, defaultFilterFromPOJOFunctionNoCopy, defaultForwardFunctionFactory, defaultLatLngPoint, defaultLatLngString, dencodeBitwiseSet, diffLatLngBoundPoints, diffLatLngPoints, dollarAmountString, e164PhoneNumberExtensionPair, e164PhoneNumberFromE164PhoneNumberExtensionPair, enabledDaysFromDaysOfWeek, encodeBitwiseSet, encodeModelKeyTypePair, errorMessageContainsString, errorMessageContainsStringFunction, escapeStringCharactersFunction, 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, filterUniqueByIndex, filterUniqueCaseInsensitiveStrings, filterUniqueFunction, filterUniqueTransform, filterUniqueValues, filterValuesByDistance, filterValuesByDistanceNoOrder, filterValuesToSet, filterValuesUsingSet, filteredPage, findAllCharacterOccurences, findAllCharacterOccurencesFunction, findBest, findBestIndexMatch, findBestIndexMatchFunction, findBestIndexSetPair, findBestSplitStringTreeChildMatch, findBestSplitStringTreeChildMatchPath, findBestSplitStringTreeMatch, findBestSplitStringTreeMatchPath, 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, indexRefMap, indexedValuesArrayAccessorFactory, insertIntoBooleanKeyArray, invertBooleanReturnFunction, invertDecision, invertFilter, isAllowed, isClassLikeType, isCompleteUnitedStatesAddress, isConsideredUtcTimezoneString, isDate, isDefaultLatLngPoint, isDefaultLatLngPointValue, isDefaultReadableError, isDefinedAndNotFalse, isDollarAmountString, isE164PhoneNumber, isE164PhoneNumberWithExtension, isEmptyIterable, isEqualContext, isEqualDate, isEqualToValueDecisionFunction, 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, isMinuteOfDay, isModelKey, isMonthDaySlashDate, isNonClassFunction, isNotNullOrEmptyString, isNumberDivisibleBy, isObjectWithConstructor, isOddNumber, isPromise, isPromiseLike, isSameLatLngBound, isSameLatLngPoint, isSameNonNullValue, isSameVector, isSelectedDecisionFunctionFactory, isSelectedIndexDecisionFunction, isServerError, isSlashPathFile, isSlashPathFolder, isSlashPathTypedFile, isStringOrTrue, isTrueBooleanKeyArray, isUTCDateString, isUniqueKeyedFunction, isUsStateCodeString, isValidLatLngPoint, isValidLatitude, isValidLongitude, isValidNumberBound, isValidPhoneExtensionNumber, isValidSlashPath, isWebsiteUrl, isWebsiteUrlWithPrefix, isWithinLatLngBoundFunction, isolateSlashPath, isolateSlashPathFunction, isolateWebsitePathFunction, itemCountForBatchIndex, iterableToArray, iterableToMap, iterableToSet, iterablesAreSetEquivalent, iterate, iterateFilteredPages, joinHostAndPort, joinStringsWithSpaces, keepCharactersAfterFirstCharacterOccurence, keepCharactersAfterFirstCharacterOccurenceFunction, keepFromSetCopy, keepValuesFromArray, keepValuesFromSet, keyValueMapFactory, labeledValueMap, 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, minutesToHoursAndMinutes, modelFieldConversions, modelFieldMapFunction, modelFieldMapFunctions, modelTypeDataPairFactory, modifier, modifierMapToFunction, modifyModelMapFunction, modifyModelMapFunctions, monthDaySlashDateToDateString, monthOfYearFromDate, monthOfYearFromDateMonth, multiKeyValueMapFactory, multiValueMapBuilder, neMostLatLngPoint, nearestDivisibleValues, numberStringDencoder, numberStringDencoderDecodedNumberValueFunction, numberStringDencoderEncodedStringValueFunction, numberStringDencoderFunction, objectCopyFactory, objectDeltaArrayCompressor, objectFieldEqualityChecker, objectFlatMergeMatrix, objectHasKey, objectHasKeys, objectHasNoKeys, objectIsEmpty, objectKeyEqualityComparatorFunction, objectKeysEqualityComparatorFunction, objectMergeMatrix, objectToMap, objectToTuples, overlapsLatLngBoundFunction, overrideInObject, overrideInObjectFunctionFactory, padStartFunction, pairGroupValues, parseISO8601DayStringToUTCDate, partialServerError, passThrough, percentNumberFromDecimal, percentNumberToDecimal, performAsyncTask, performAsyncTasks, performBatchLoop, performMakeLoop, performTaskCountLoop, performTaskLoop, performTasksFromFactoryInParallelFunction, 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, sequentialIncrementingNumberStringModelIdFactory, 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, splitStringTreeFactory, startOfDayForSystemDateInUTC, startOfDayForUTCDateInUTC, stepsFromIndex, stepsFromIndexFunction, stringCharactersToIndexRecord, stringContains, stringFactoryFromFactory, stringToLowercaseFunction, stringToUppercaseFunction, stringTrimFunction, sumOfIntegersBetween, swMostLatLngPoint, symmetricDifferenceArray, symmetricDifferenceArrayBetweenSets, symmetricDifferenceWithModels, takeFront, takeLast, takeValuesFromIterable, telUrlString, telUrlStringForE164PhoneNumberPair, terminatingFactoryFromArray, throwKeyIsRequired, timePeriodCounter, timer, toAbsoluteSlashPathStartType, toCaseInsensitiveStringArray, toMinuteOfDay, toModelFieldConversions, toModelMapFunctions, toReadableError, toRelativeSlashPathStartType, toggleInSet, toggleInSetCopy, toggleTimerRunning, 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 };