@dereekb/util 10.1.30 → 11.0.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 (53) hide show
  1. package/fetch/LICENSE +21 -0
  2. package/fetch/index.cjs.d.ts +1 -0
  3. package/fetch/index.cjs.js +5558 -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 +5155 -3866
  12. package/index.esm.js +1610 -1457
  13. package/package.json +10 -5
  14. package/src/lib/array/array.d.ts +0 -12
  15. package/src/lib/date/date.d.ts +22 -1
  16. package/src/lib/model/model.d.ts +1 -0
  17. package/src/lib/number/round.d.ts +2 -1
  18. package/src/lib/object/object.equal.d.ts +2 -0
  19. package/src/lib/page/page.calculator.d.ts +6 -1
  20. package/src/lib/page/page.d.ts +0 -2
  21. package/src/lib/promise/index.d.ts +1 -0
  22. package/src/lib/promise/promise.factory.d.ts +33 -0
  23. package/src/lib/string/char.d.ts +4 -0
  24. package/src/lib/string/replace.d.ts +29 -1
  25. package/src/lib/value/point.d.ts +1 -1
  26. package/test/CHANGELOG.md +13 -0
  27. package/test/package.json +1 -1
  28. package/test/src/lib/jest.fail.d.ts +22 -3
  29. package/test/src/lib/jest.fail.js +30 -3
  30. package/test/src/lib/jest.fail.js.map +1 -1
  31. package/test/src/lib/jest.js +8 -7
  32. package/test/src/lib/jest.js.map +1 -1
  33. package/test/src/lib/jest.wrap.js +16 -15
  34. package/test/src/lib/jest.wrap.js.map +1 -1
  35. package/fetch/CHANGELOG.md +0 -931
  36. package/fetch/src/index.js +0 -5
  37. package/fetch/src/index.js.map +0 -1
  38. package/fetch/src/lib/error.js +0 -31
  39. package/fetch/src/lib/error.js.map +0 -1
  40. package/fetch/src/lib/fetch.js +0 -177
  41. package/fetch/src/lib/fetch.js.map +0 -1
  42. package/fetch/src/lib/fetch.type.js +0 -3
  43. package/fetch/src/lib/fetch.type.js.map +0 -1
  44. package/fetch/src/lib/index.js +0 -11
  45. package/fetch/src/lib/index.js.map +0 -1
  46. package/fetch/src/lib/json.js +0 -80
  47. package/fetch/src/lib/json.js.map +0 -1
  48. package/fetch/src/lib/provider.js +0 -9
  49. package/fetch/src/lib/provider.js.map +0 -1
  50. package/fetch/src/lib/timeout.js +0 -38
  51. package/fetch/src/lib/timeout.js.map +0 -1
  52. package/fetch/src/lib/url.js +0 -102
  53. 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
 
@@ -1848,22 +1847,6 @@ function countAllInNestedArray(array) {
1848
1847
  return array.reduce((acc, curr) => acc + curr.length, 0);
1849
1848
  }
1850
1849
 
1851
- // MARK: Compat
1852
- /**
1853
- * @deprecated Use mergeArraysIntoArray() instead. Will be removed in v10.1.
1854
- */
1855
- const mergeIntoArray = mergeArraysIntoArray;
1856
-
1857
- /**
1858
- * @deprecated Use pushArrayItemsIntoArray() instead. Will be removed in v10.1.
1859
- */
1860
- const mergeArrayIntoArray = pushArrayItemsIntoArray;
1861
-
1862
- /**
1863
- * @deprecated Use pushArrayItemsOrItemIntoArray() instead. Will be removed in v10.1.
1864
- */
1865
- const mergeArrayOrValueIntoArray = pushItemOrArrayItemsIntoArray;
1866
-
1867
1850
  var wellKnownSymbol$d = wellKnownSymbol$k;
1868
1851
 
1869
1852
  var TO_STRING_TAG$1 = wellKnownSymbol$d('toStringTag');
@@ -2591,8 +2574,6 @@ function containsAnyValue(values, valuesToFind, emptyValuesToFindArrayResult) {
2591
2574
  return setContainsAnyValue(set, valuesToFind, emptyValuesToFindArrayResult);
2592
2575
  }
2593
2576
 
2594
- // TODO: Continue checking all values
2595
-
2596
2577
  /**
2597
2578
  * Returns true if one or more of the input values are contained within the input set.
2598
2579
  *
@@ -6497,7 +6478,7 @@ function sliceIndexRangeFunction(inputRange) {
6497
6478
  * If order is irrelevant, use filterValuesByDistanceNoOrder().
6498
6479
  */
6499
6480
  function filterValuesByDistance(input, minDistance, getValue) {
6500
- // TODO: Implement if needed.
6481
+ // TODO(FUTURE): Implement if needed.
6501
6482
 
6502
6483
  throw new Error('Incomplete implementation!');
6503
6484
  }
@@ -6513,7 +6494,7 @@ function filterValuesByDistanceNoOrder(input, minDistance, getValue) {
6513
6494
  return _filterValuesByDistance(values, minDistance, x => x[0]);
6514
6495
  }
6515
6496
 
6516
- // TODO: Can add a "mergeValuesByDistance" too to merge together values that are too close together.
6497
+ // TODO(FUTURE): Can add a "mergeValuesByDistance" too to merge together values that are too close together.
6517
6498
 
6518
6499
  function _filterValuesByDistance(values, minDistance, toOutputValue) {
6519
6500
  // Exit if nothing to do.
@@ -9464,6 +9445,13 @@ function firstAndLastCharacterOccurrence(input, find) {
9464
9445
  };
9465
9446
  }
9466
9447
 
9448
+ /**
9449
+ * Returns true if the input string contains the character (or string) to find.
9450
+ */
9451
+ function stringContains(input, find) {
9452
+ return input.indexOf(find) !== -1;
9453
+ }
9454
+
9467
9455
  /**
9468
9456
  * Function that replaces the last character with the configured replacement string if it is any of the configured values.
9469
9457
  */
@@ -9594,6 +9582,63 @@ function findStringsRegexString(find) {
9594
9582
  return escapedInput.join('|');
9595
9583
  }
9596
9584
 
9585
+ /**
9586
+ * Function that properly "escapes" specific characters in a string.
9587
+ *
9588
+ * How the characters are escaped is determined by the function.
9589
+ */
9590
+
9591
+ /**
9592
+ * Creates an EscapeStringCharactersFunction
9593
+ *
9594
+ * @param config
9595
+ * @returns
9596
+ */
9597
+ function escapeStringCharactersFunction(config) {
9598
+ const {
9599
+ escapeTargets: inputEscapeTargets,
9600
+ escapeCharacter
9601
+ } = config;
9602
+ const escapeTargets = inputEscapeTargets instanceof Set ? inputEscapeTargets : new Set(inputEscapeTargets);
9603
+ return input => {
9604
+ /**
9605
+ * Find index of all occurences in the input to replace/merge together.
9606
+ */
9607
+ const occurrences = findAllCharacterOccurences(escapeTargets, input);
9608
+ let result;
9609
+ switch (occurrences.length) {
9610
+ case 0:
9611
+ result = input;
9612
+ break;
9613
+ case 1:
9614
+ const charToReplace = input[occurrences[0]];
9615
+ result = replaceCharacterAtIndexWith(input, occurrences[0], escapeCharacter(charToReplace)); //Add an escape to the character
9616
+ break;
9617
+ default:
9618
+ const parts = [];
9619
+ const endAt = occurrences.length;
9620
+ let start = 0;
9621
+ let occurrence = 0;
9622
+ for (let i = 0; i < endAt; i += 1) {
9623
+ occurrence = occurrences[i];
9624
+ const char = input[occurrence];
9625
+ const sub = input.substring(start, occurrence);
9626
+ const part = sub + escapeCharacter(char);
9627
+ parts.push(part);
9628
+ start = occurrence + 1;
9629
+ }
9630
+
9631
+ // add in the last substring
9632
+ parts.push(input.substring(start));
9633
+
9634
+ // join all parts together
9635
+ result = parts.join('');
9636
+ break;
9637
+ }
9638
+ return result;
9639
+ };
9640
+ }
9641
+
9597
9642
  /**
9598
9643
  * Escapes the input string to be usable in a Regex value.
9599
9644
  *
@@ -9601,46 +9646,12 @@ function findStringsRegexString(find) {
9601
9646
  *
9602
9647
  * @param input
9603
9648
  */
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) {
9649
+ const escapeStringForRegex = escapeStringCharactersFunction({
9650
+ escapeTargets: REGEX_SPECIAL_CHARACTERS_SET,
9651
+ escapeCharacter(char) {
9611
9652
  return `\\${char}`;
9612
9653
  }
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
- }
9654
+ });
9644
9655
  function findAllCharacterOccurencesFunction(characterSet) {
9645
9656
  return (input, maxToReturn) => {
9646
9657
  const max = maxToReturn != null ? maxToReturn : Number.MAX_SAFE_INTEGER;
@@ -10123,7 +10134,7 @@ const TOTAL_LONGITUDE_RANGE = MAX_LONGITUDE_VALUE - MIN_LONGITUDE_VALUE;
10123
10134
  /**
10124
10135
  * A point decorated as LonLat.
10125
10136
  *
10126
- * NOTE: This library prefers the use of LatLngPoint over LonLatPoint. This is only provided as compatability for libraries (like Mapbox) that have LonLat-like points
10137
+ * NOTE: This library (dbx-components) prefers the use of LatLngPoint over LonLatPoint. This is only provided as compatability for libraries (like Mapbox) that have LonLat-like points
10127
10138
  */
10128
10139
 
10129
10140
  function isLatLngPoint(input) {
@@ -10988,6 +10999,10 @@ function compareEqualityWithValueFromItemsFunctionFactory(readValues) {
10988
10999
  * The past or future direction.
10989
11000
  */
10990
11001
 
11002
+ /**
11003
+ * Hour, minute, or second as a string.
11004
+ */
11005
+
10991
11006
  /**
10992
11007
  * A valid ISO8601 formatted date string.
10993
11008
  *
@@ -10995,7 +11010,7 @@ function compareEqualityWithValueFromItemsFunctionFactory(readValues) {
10995
11010
  */
10996
11011
 
10997
11012
  /**
10998
- * TODO: Need to improve to support negative years.
11013
+ * TODO(FUTURE): Need to improve to support negative years.
10999
11014
  */
11000
11015
  const ISO_8601_DATE_STRING_REGEX = /(\d{4,})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})(Z|[+-](\d{2})\:(\d{2}))?/;
11001
11016
  function isISO8601DateString(input) {
@@ -11185,6 +11200,8 @@ function monthDaySlashDateToDateString(slashDate) {
11185
11200
 
11186
11201
  /**
11187
11202
  * Time in seconds (instead of ms) since the epoch.
11203
+ *
11204
+ * Returned by Date.getTime().
11188
11205
  */
11189
11206
 
11190
11207
  /**
@@ -11248,6 +11265,27 @@ function isDate(value) {
11248
11265
  return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
11249
11266
  }
11250
11267
 
11268
+ /**
11269
+ * Returns true if the two input dates are equal.
11270
+ *
11271
+ * @param a
11272
+ * @param b
11273
+ * @returns
11274
+ */
11275
+ function isEqualDate(a, b) {
11276
+ return a.getTime() === b.getTime();
11277
+ }
11278
+
11279
+ /**
11280
+ * Returns true if the input date is in the past.
11281
+ *
11282
+ * @param input
11283
+ * @returns
11284
+ */
11285
+ function isPast(input) {
11286
+ return input.getTime() < Date.now();
11287
+ }
11288
+
11251
11289
  /**
11252
11290
  * A number that represents hours and rounded to the nearest minute.
11253
11291
  *
@@ -14251,7 +14289,7 @@ function numberStringDencoderDecodedNumberValueFunction(dencoder) {
14251
14289
  };
14252
14290
  }
14253
14291
 
14254
- // TODO: can add a function that can encode/decode fractions by splitting at the decimal point and encoding twice.
14292
+ // TODO(FUTURE): can add a function that can encode/decode fractions by splitting at the decimal point and encoding twice.
14255
14293
 
14256
14294
  /**
14257
14295
  * A factory for generating a unique model identifier.
@@ -14449,364 +14487,177 @@ function objectIsEmpty(obj) {
14449
14487
  }
14450
14488
 
14451
14489
  /**
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.
14490
+ * Values that correspond to each day of the week.
14465
14491
  */
14466
14492
 
14467
14493
  /**
14468
- * Results of an ObjectFieldEqualityChecker.
14494
+ * Returns the day of the week for the input day.
14495
+ *
14496
+ * Equivalent to date.getDay()
14497
+ *
14498
+ * @param date
14499
+ * @returns
14469
14500
  */
14501
+ function dayOfWeek(date) {
14502
+ return date.getDay();
14503
+ }
14470
14504
 
14471
14505
  /**
14472
- * Function used to check if two objects are considered equal.
14506
+ * Decision function that checks whether or not the input DayOfWeek or the DayOfWeek for the input Date is in the set.
14473
14507
  */
14474
14508
 
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
14509
  /**
14515
- * Creates a EqualityComparatorFunction that compares the two input values
14510
+ * Creates a DecisionFunction that checks whether or not the input day or days of
14516
14511
  *
14517
- * @param readKey
14512
+ * @param allowedDaysOfWeek
14518
14513
  * @returns
14519
14514
  */
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;
14515
+ function isInAllowedDaysOfWeekSet(allowedDaysOfWeek) {
14516
+ return isInSetDecisionFunction(allowedDaysOfWeek, x => {
14517
+ return typeof x === 'number' ? x : dayOfWeek(x);
14536
14518
  });
14537
14519
  }
14538
14520
 
14539
14521
  /**
14540
- * Creates a EqualityComparatorFunction that compares the two input values
14522
+ * Returns all days of the week starting from the given day up to the specified number of days.
14541
14523
  *
14542
- * @param readKey
14543
- * @returns
14524
+ * Returns 7 days by default.
14525
+ *
14526
+ * @param startingOn
14544
14527
  */
14545
- function objectKeyEqualityComparatorFunction(readKey) {
14546
- return safeEqualityComparatorFunction((a, b) => readKey(a) === readKey(b));
14528
+ function daysOfWeekArray(startingOn = Day.SUNDAY, maxDays = 7) {
14529
+ const days = [];
14530
+ let day = startingOn;
14531
+ while (days.length < maxDays) {
14532
+ days.push(day);
14533
+ if (day === Day.SATURDAY) {
14534
+ day = Day.SUNDAY;
14535
+ } else {
14536
+ day += 1;
14537
+ }
14538
+ }
14539
+ return days;
14547
14540
  }
14548
14541
 
14549
14542
  /**
14550
- * Used for copying one field from one partial object to a target object.
14543
+ * Enum for the days of the week.
14551
14544
  */
14545
+ let Day = /*#__PURE__*/function (Day) {
14546
+ Day[Day["SUNDAY"] = 0] = "SUNDAY";
14547
+ Day[Day["MONDAY"] = 1] = "MONDAY";
14548
+ Day[Day["TUESDAY"] = 2] = "TUESDAY";
14549
+ Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
14550
+ Day[Day["THURSDAY"] = 4] = "THURSDAY";
14551
+ Day[Day["FRIDAY"] = 5] = "FRIDAY";
14552
+ Day[Day["SATURDAY"] = 6] = "SATURDAY";
14553
+ return Day;
14554
+ }({});
14552
14555
 
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
14556
  /**
14569
- * Type used to declare a sister-type to the generic object.
14557
+ * Object containing the name of every day and whether they're true/false.
14570
14558
  */
14571
14559
 
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);
14560
+ function enabledDaysFromDaysOfWeek(input) {
14561
+ const set = new Set(input);
14579
14562
  return {
14580
- from,
14581
- to
14563
+ sunday: set.has(Day.SUNDAY),
14564
+ monday: set.has(Day.MONDAY),
14565
+ tuesday: set.has(Day.TUESDAY),
14566
+ wednesday: set.has(Day.WEDNESDAY),
14567
+ thursday: set.has(Day.THURSDAY),
14568
+ friday: set.has(Day.FRIDAY),
14569
+ saturday: set.has(Day.SATURDAY)
14582
14570
  };
14583
14571
  }
14584
-
14585
- /**
14586
- * A model conversion function. Performs a conversion on all non-null values.
14587
- */
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]));
14572
+ function daysOfWeekFromEnabledDays(input) {
14573
+ const daysOfWeek = [];
14574
+ if (input) {
14575
+ if (input.sunday) {
14576
+ daysOfWeek.push(Day.SUNDAY);
14604
14577
  }
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
- }
14578
+ if (input.monday) {
14579
+ daysOfWeek.push(Day.MONDAY);
14667
14580
  }
14668
- return result;
14669
- };
14581
+ if (input.tuesday) {
14582
+ daysOfWeek.push(Day.TUESDAY);
14583
+ }
14584
+ if (input.wednesday) {
14585
+ daysOfWeek.push(Day.WEDNESDAY);
14586
+ }
14587
+ if (input.thursday) {
14588
+ daysOfWeek.push(Day.THURSDAY);
14589
+ }
14590
+ if (input.friday) {
14591
+ daysOfWeek.push(Day.FRIDAY);
14592
+ }
14593
+ if (input.saturday) {
14594
+ daysOfWeek.push(Day.SATURDAY);
14595
+ }
14596
+ }
14597
+ return daysOfWeek;
14670
14598
  }
14671
-
14672
- // MARK: Utility
14673
-
14674
14599
  /**
14675
- * Converts the input to a ModelFieldConversions value.
14600
+ * Returns an array of strinsg with each day of the week named.
14676
14601
  *
14677
- * @param input
14678
14602
  * @returns
14679
14603
  */
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;
14604
+ function getDaysOfWeekNames(sundayFirst = true, transform) {
14605
+ const days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
14606
+ const sunday = 'Sunday';
14607
+ let dayOfWeekNames;
14608
+ if (sundayFirst) {
14609
+ dayOfWeekNames = [sunday, ...days];
14689
14610
  } else {
14690
- const conversions = toModelFieldConversions(input);
14691
- mapFunctions = makeModelMapFunctions(conversions);
14611
+ dayOfWeekNames = [...days, sunday];
14692
14612
  }
14693
- return mapFunctions;
14694
- }
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
14613
+ if (transform != null) {
14614
+ if (transform.abbreviation) {
14615
+ dayOfWeekNames = dayOfWeekNames.map(x => x.slice(0, 3));
14711
14616
  }
14712
- };
14617
+ if (transform.uppercase) {
14618
+ dayOfWeekNames = dayOfWeekNames.map(x => x.toUpperCase());
14619
+ }
14620
+ }
14621
+ return dayOfWeekNames;
14713
14622
  }
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
14724
- };
14623
+ function daysOfWeekNameMap(transform) {
14624
+ const dayOfWeekNames = getDaysOfWeekNames(true, transform);
14625
+ return new Map(dayOfWeekNames.map((x, i) => [i, x]));
14725
14626
  }
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
14627
+ function daysOfWeekNameFunction(transform) {
14628
+ const map = daysOfWeekNameMap(transform);
14629
+ return dayOfWeek => {
14630
+ var _map$get;
14631
+ return (_map$get = map.get(dayOfWeek)) != null ? _map$get : 'UNKNOWN';
14747
14632
  };
14748
14633
  }
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;
14766
- }
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
- };
14634
+ function getDayTomorrow(day) {
14635
+ return getNextDay(day, 1);
14781
14636
  }
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
- });
14637
+ function getDayYesterday(day) {
14638
+ return getPreviousDay(day, 1);
14801
14639
  }
14802
-
14803
- function joinHostAndPort(config) {
14804
- if (config) {
14805
- return `${config.host}:${config.port}`;
14640
+ function getDayOffset(day, days) {
14641
+ if (days === 0) {
14642
+ return day;
14643
+ } else if (days < 0) {
14644
+ return getPreviousDay(day, days);
14806
14645
  } else {
14807
- return config;
14646
+ return getNextDay(day, days);
14808
14647
  }
14809
14648
  }
14649
+ function getPreviousDay(day, days = 1) {
14650
+ const offset = Math.abs(days) % 7;
14651
+ const cap = 7 - offset;
14652
+ return getNextDay(day, cap);
14653
+ }
14654
+ function getNextDay(day, days = 1) {
14655
+ let result = (day + days) % 7;
14656
+ if (result < 0) {
14657
+ result = 7 + result;
14658
+ }
14659
+ return result;
14660
+ }
14810
14661
 
14811
14662
  async function useCallback(use) {
14812
14663
  return new Promise((resolve, reject) => {
@@ -15291,11 +15142,49 @@ function performTasksFromFactoryInParallelFunction(config) {
15291
15142
  }
15292
15143
 
15293
15144
  /**
15294
- * Uses a cached promise value.
15145
+ * Function that uses an array of Factories to produce Promises, one after the other, to attempt to return the value.
15146
+ *
15147
+ * Returns a Maybe value of the expected output, and returns null if no factory/promise returns the intended value.
15295
15148
  */
15296
15149
 
15297
- /**
15298
- * Creates a UsePromiseFunction.
15150
+ function tryWithPromiseFactoriesFunction(config) {
15151
+ const {
15152
+ promiseFactories,
15153
+ successOnMaybe: defaultSuccessOnMaybe,
15154
+ throwErrors: defaultThrowErrors
15155
+ } = config;
15156
+ return async (input, config) => {
15157
+ const {
15158
+ successOnMaybe: inputSuccessOnMaybe,
15159
+ throwErrors: inputThrowErrors
15160
+ } = config != null ? config : {};
15161
+ const successOnMaybe = inputSuccessOnMaybe != null ? inputSuccessOnMaybe : defaultSuccessOnMaybe;
15162
+ const throwErrors = inputThrowErrors != null ? inputThrowErrors : defaultThrowErrors;
15163
+ let result;
15164
+ for (let i = 0; i < promiseFactories.length; i += 1) {
15165
+ try {
15166
+ const nextPromise = promiseFactories[i](input);
15167
+ result = await nextPromise;
15168
+ if (result != null || successOnMaybe) {
15169
+ break; // end loop early
15170
+ }
15171
+ } catch (e) {
15172
+ if (throwErrors) {
15173
+ throw e; // throw the error if requested
15174
+ }
15175
+ }
15176
+ }
15177
+
15178
+ return result;
15179
+ };
15180
+ }
15181
+
15182
+ /**
15183
+ * Uses a cached promise value.
15184
+ */
15185
+
15186
+ /**
15187
+ * Creates a UsePromiseFunction.
15299
15188
  *
15300
15189
  * @param input
15301
15190
  * @returns
@@ -15305,1387 +15194,1646 @@ function usePromise(input) {
15305
15194
  return useFn => _getter().then(useFn);
15306
15195
  }
15307
15196
 
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
15197
  /**
15319
- * Merges the two input values. The "a" value is usually the existing/incumbent value, while "b" is the new value.
15198
+ * Returns the number of invocations that have occurred since the period started.
15199
+ *
15200
+ * When a new period has started, returns 0.
15320
15201
  */
15321
15202
 
15322
- /**
15323
- * Whether or not the object is changable as part of this request.
15324
- */
15203
+ function timePeriodCounter(timePeriodLength, lastTimePeriodStart) {
15204
+ function reset(inputStart) {
15205
+ const start = inputStart != null ? inputStart : new Date();
15206
+ fn._timePeriodCount = 0;
15207
+ fn._lastTimePeriodStart = start;
15208
+ fn._nextTimePeriodEnd = new Date(start.getTime() + timePeriodLength);
15209
+ return fn._nextTimePeriodEnd;
15210
+ }
15211
+ const fn = () => {
15212
+ const now = new Date();
15213
+ if (now > fn._nextTimePeriodEnd) {
15214
+ reset(now);
15215
+ } else {
15216
+ fn._timePeriodCount += 1;
15217
+ }
15218
+ return fn._timePeriodCount;
15219
+ };
15220
+ fn._timePeriodLength = timePeriodLength;
15221
+ reset(lastTimePeriodStart);
15222
+ fn._timePeriodCount = -1;
15223
+ fn._reset = reset;
15224
+ return fn;
15225
+ }
15325
15226
 
15326
15227
  /**
15327
- * Utility class for modifying a collection of relational objects.
15228
+ * Timer object that counts down a fixed duration amount.
15328
15229
  *
15329
- * For instance, a string collection of keys.
15230
+ * The timer is not required to start immediately.
15231
+ *
15232
+ * Once the timer has complete it cannot be reset.
15330
15233
  */
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
15234
 
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);
15235
+ class TimerCancelledError extends BaseError {
15236
+ constructor() {
15237
+ super(`The timer was destroyed before it was completed.`);
15238
+ }
15239
+ }
15240
+ class TimerInstance {
15241
+ constructor(duration, startImmediately = true) {
15242
+ this._createdAt = new Date();
15243
+ this._startedAt = new Date();
15244
+ this._pausedAt = void 0;
15245
+ this._state = 'paused';
15246
+ this._duration = void 0;
15247
+ this._promiseRef = promiseReference();
15248
+ this._duration = duration;
15249
+ if (startImmediately) {
15250
+ this.start();
15251
+ this._startedAt = this._createdAt;
15358
15252
  }
15359
15253
  }
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
- });
15254
+ get state() {
15255
+ return this._state;
15370
15256
  }
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);
15257
+ get createdAt() {
15258
+ return this._createdAt;
15259
+ }
15260
+ get pausedAt() {
15261
+ return this._pausedAt;
15262
+ }
15263
+ get startedAt() {
15264
+ return this._startedAt;
15265
+ }
15266
+ get promise() {
15267
+ return this._promiseRef.promise;
15268
+ }
15269
+ get duration() {
15270
+ return this._duration;
15271
+ }
15272
+ get durationRemaining() {
15273
+ let remaining;
15274
+ switch (this._state) {
15275
+ case 'complete':
15276
+ remaining = 0;
15277
+ break;
15278
+ case 'running':
15279
+ remaining = Math.max(0, this._duration - (new Date().getTime() - this._startedAt.getTime()));
15280
+ break;
15281
+ case 'paused':
15282
+ remaining = null;
15283
+ break;
15382
15284
  }
15383
- function performAdd() {
15384
- return ModelRelationUtility._modifyCollection(current, mods, (x, y) => ModelRelationUtility.addToCollection(x, y, readKey), readType);
15285
+ return remaining;
15286
+ }
15287
+ start() {
15288
+ if (this._state === 'paused') {
15289
+ this._state = 'running';
15290
+ this._startedAt = new Date();
15291
+ this._enqueueCheck();
15385
15292
  }
15386
- function performInsert() {
15387
- return ModelRelationUtility.insertCollection(current, mods, {
15388
- readKey,
15389
- readType,
15390
- merge
15391
- });
15293
+ }
15294
+ stop() {
15295
+ if (this._state === 'running') {
15296
+ this._state = 'paused';
15297
+ this._pausedAt = new Date();
15392
15298
  }
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();
15299
+ }
15300
+ reset() {
15301
+ if (this._state !== 'complete') {
15302
+ this._state = 'running';
15303
+ this._startedAt = new Date();
15304
+ this._enqueueCheck();
15412
15305
  }
15413
15306
  }
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);
15307
+ setDuration(duration) {
15308
+ this._duration = duration;
15424
15309
  }
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);
15310
+ destroy() {
15311
+ this._checkComplete();
15312
+ if (this._state === 'running') {
15313
+ const error = new TimerCancelledError();
15314
+ this._promiseRef.reject(error);
15315
+ this._state = 'complete'; // mark as complete
15316
+ }
15435
15317
  }
15436
15318
 
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);
15319
+ _checkComplete() {
15320
+ if (this._state !== 'complete' && this.durationRemaining === 0) {
15321
+ this._state = 'complete';
15322
+ this._promiseRef.resolve();
15445
15323
  }
15446
15324
  }
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()]);
15451
-
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 : [];
15457
-
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 [];
15325
+ _enqueueCheck() {
15326
+ const durationRemaining = this.durationRemaining;
15327
+ if (durationRemaining != null && this._state !== 'complete') {
15328
+ setTimeout(() => {
15329
+ this._checkComplete();
15330
+ this._enqueueCheck();
15331
+ }, durationRemaining);
15533
15332
  }
15534
15333
  }
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) : [];
15334
+ }
15335
+ function timer(duration, startNow = true) {
15336
+ return new TimerInstance(duration, startNow);
15337
+ }
15338
+
15339
+ /**
15340
+ * Toggles the input Timer's running state.
15341
+ *
15342
+ * @param timer
15343
+ * @param toggleRun
15344
+ */
15345
+ function toggleTimerRunning(timer, toggleRun) {
15346
+ toggleRun = toggleRun != null ? toggleRun : timer.state !== 'running';
15347
+ if (toggleRun) {
15348
+ timer.start();
15349
+ } else {
15350
+ timer.stop();
15540
15351
  }
15352
+ }
15541
15353
 
15542
- // MARK: Internal Utility
15543
- static _assertMergeProvided(merge) {
15544
- if (!merge) {
15545
- throw new Error('Merge was not provided.');
15546
- }
15354
+ /**
15355
+ * Returns the approximate end date of the given timer. If a timer is already complete, it returns the time for now.
15356
+ */
15357
+ function approximateTimerEndDate(timer) {
15358
+ const durationRemaining = timer.durationRemaining;
15359
+ if (durationRemaining != null) {
15360
+ return new Date(Date.now() + durationRemaining);
15361
+ } else {
15362
+ return null;
15547
15363
  }
15548
15364
  }
15549
15365
 
15550
15366
  /**
15551
- * Key used to signify
15367
+ * Represents a string for a time. This may be human-input, and
15368
+ * can be interpreted in various ways depending on the input.
15369
+ *
15370
+ * Examples:
15371
+ * - 1:20AM
15372
+ * - 1:20
15373
+ * - 120AM
15374
+ * - 120
15552
15375
  */
15553
- const CATCH_ALL_HANDLE_RESULT_KEY = '__CATCH_ALL_HANDLE_RESULT_KEY__';
15376
+
15377
+ let TimeAM = /*#__PURE__*/function (TimeAM) {
15378
+ TimeAM["AM"] = "AM";
15379
+ TimeAM["PM"] = "PM";
15380
+ return TimeAM;
15381
+ }({});
15382
+ const DATE_NOW_VALUE = 'now';
15554
15383
 
15555
15384
  /**
15556
- * Whether or not the input value was handled.
15385
+ * A date that is characterized by either a known string value, or a Date.
15557
15386
  */
15558
15387
 
15559
15388
  /**
15560
- * Used to perform a task on the input value.
15389
+ * Returns a Date value from the input LogicalDate.
15561
15390
  *
15562
- * If the value is not used/"handled", returns false.
15391
+ * @param logicalDate
15563
15392
  */
15564
15393
 
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);
15394
+ function dateFromLogicalDate(logicalDate) {
15395
+ let result;
15396
+ if (typeof logicalDate === 'string') {
15397
+ switch (logicalDate.toLocaleLowerCase()) {
15398
+ case DATE_NOW_VALUE:
15399
+ result = new Date();
15400
+ break;
15401
+ default:
15402
+ throw new Error(`Unknown logical date string "${logicalDate}"`);
15403
+ }
15404
+ } else {
15405
+ result = logicalDate;
15406
+ }
15407
+ return result;
15408
+ }
15409
+ function isLogicalDateStringCode(logicalDate) {
15410
+ let isLogicalDateStringCode = false;
15411
+ if (typeof logicalDate === 'string') {
15412
+ switch (logicalDate.toLocaleLowerCase()) {
15413
+ case DATE_NOW_VALUE:
15414
+ isLogicalDateStringCode = true;
15415
+ break;
15416
+ }
15417
+ }
15418
+ return isLogicalDateStringCode;
15419
+ }
15420
+
15421
+ /**
15422
+ * Performs a deep comparison to check if all values on the input filters are equal.
15423
+ *
15424
+ * Recursively compares Arrays, Objects, Maps, Sets, Primatives, and Dates.
15425
+ */
15426
+ function areEqualPOJOValues(a, b) {
15427
+ // check self
15428
+ if (a === b) {
15429
+ return true;
15430
+ }
15431
+
15432
+ // check one value is nullish and other is not
15433
+ if ((a == null || b == null) && (a || b)) {
15434
+ return false;
15435
+ }
15436
+
15437
+ // object check
15438
+ if (typeof a === 'object') {
15439
+ // check if they are arrays
15440
+ if (isIterable(a, false)) {
15441
+ if (Array.isArray(a)) {
15442
+ if (a.length !== b.length) {
15443
+ return false;
15444
+ }
15445
+ const firstInequalityIndex = a.findIndex((aValue, i) => {
15446
+ const bValue = b[i];
15447
+ return !areEqualPOJOValues(aValue, bValue);
15448
+ });
15449
+ return firstInequalityIndex === -1;
15450
+ } else if (a instanceof Set) {
15451
+ return setsAreEquivalent(a, b);
15452
+ } else if (a instanceof Map) {
15453
+ const bMap = b;
15454
+ if (a.size !== bMap.size) {
15455
+ return false;
15456
+ }
15457
+ const firstInequalityIndex = Array.from(a.entries()).findIndex(([key, aValue]) => {
15458
+ const bValue = bMap.get(key);
15459
+ return !areEqualPOJOValues(aValue, bValue);
15460
+ });
15461
+ return firstInequalityIndex === -1;
15574
15462
  }
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);
15463
+ } else if (typeof b === 'object') {
15464
+ // check contructors/types
15465
+ const firstType = a == null ? void 0 : a.constructor.name;
15466
+ const secondType = b == null ? void 0 : b.constructor.name;
15467
+ if (firstType !== secondType) {
15468
+ return false; // false if not the same type
15469
+ }
15470
+
15471
+ // check Date comparison
15472
+ if (isDate(a)) {
15473
+ return isEqualDate(a, b);
15474
+ }
15475
+
15476
+ // check object comparison via keys
15477
+ const aObject = a;
15478
+ const bObject = b;
15479
+ const aKeys = Object.keys(aObject);
15480
+ const bKeys = Object.keys(bObject);
15481
+
15482
+ // compare keys
15483
+ if (aKeys.length === bKeys.length) {
15484
+ const firstInequalityIndex = aKeys.findIndex(key => {
15485
+ const aKeyValue = aObject[key];
15486
+ const bKeyValue = bObject[key];
15487
+ return !areEqualPOJOValues(aKeyValue, bKeyValue);
15488
+ });
15489
+ if (firstInequalityIndex === -1) {
15490
+ return true; // is equal if no non-matching key/value pair is found
15588
15491
  }
15589
- return handled;
15590
- },
15591
- build: x => {
15592
- x.readKey = readKey;
15593
- x.set = set;
15594
- x.bindSet = bindSet;
15595
15492
  }
15596
- });
15597
- return fn;
15598
- };
15599
- }
15600
- function makeHandler(readKey) {
15601
- return handlerFactory(readKey)();
15602
- }
15603
- function catchAllHandlerKey() {
15604
- return CATCH_ALL_HANDLE_RESULT_KEY;
15493
+ }
15494
+ }
15495
+
15496
+ // still not equal if down here
15497
+ return false;
15605
15498
  }
15606
15499
 
15500
+ // MARK: ObjectFieldEqualityChecker
15607
15501
  /**
15608
- * Wraps a HandlerAccessor and the item it is bound to in order to be a HandlerSetAccessor.
15502
+ * Configuration for an ObjectFieldEqualityChecker.
15609
15503
  */
15610
15504
 
15611
15505
  /**
15612
- * Creates a HandlerBindAccessor<T, K> for the input values.
15613
- *
15614
- * @param bindTo
15615
- * @param accessor
15616
- * @returns
15506
+ * Field configration for a single field of a ObjectFieldEqualityCheckerConfig.
15617
15507
  */
15618
- function handlerBindAccessor(boundTo, accessor) {
15619
- return {
15620
- accessor,
15621
- boundTo,
15622
- set: (key, handle) => {
15623
- accessor.bindSet(boundTo, key, handle);
15624
- }
15625
- };
15626
- }
15627
15508
 
15628
15509
  /**
15629
- * Contextual function that configures the context's Handler with the input function for the context's key.
15510
+ * Results of an ObjectFieldEqualityChecker.
15630
15511
  */
15631
15512
 
15632
15513
  /**
15633
- * Creates a HandlerSetFunction.
15634
- *
15635
- * @param accessor
15636
- * @param key
15637
- * @returns
15514
+ * Function used to check if two objects are considered equal.
15638
15515
  */
15639
- function handlerSetFunction(accessor, key) {
15640
- const fn = handlerFunction => {
15641
- accessor.set(key, handlerFunction); // set the handler on the pre-defined key.
15642
- };
15643
15516
 
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);
15517
+ function objectFieldEqualityChecker(config) {
15518
+ const {
15519
+ fields,
15520
+ defaultEqualityFunction = (a, b) => a === b
15521
+ } = config;
15522
+ const _fields = new Map();
15523
+ fields.forEach(input => {
15524
+ let field;
15525
+ if (typeof input === 'object') {
15526
+ field = input;
15527
+ } else {
15528
+ field = {
15529
+ fieldName: input,
15530
+ isEqual: defaultEqualityFunction
15531
+ };
15532
+ }
15533
+ _fields.set(field.fieldName, field);
15534
+ });
15535
+ const fn = (a, b) => {
15536
+ const equalFields = [];
15537
+ const unequalFields = [];
15538
+ _fields.forEach((fieldConfig, fieldName) => {
15539
+ const {
15540
+ isEqual
15541
+ } = fieldConfig;
15542
+ isEqual(a[fieldName], b[fieldName]) ? equalFields.push(fieldName) : unequalFields.push(fieldName);
15654
15543
  });
15544
+ return {
15545
+ a,
15546
+ b,
15547
+ isEqual: unequalFields.length === 0,
15548
+ equalFields,
15549
+ unequalFields
15550
+ };
15655
15551
  };
15552
+ fn._fields = _fields;
15553
+ return fn;
15656
15554
  }
15657
15555
 
15658
15556
  /**
15659
- * Factory for a HandlerMappedSetFunction<I>.
15557
+ * Creates a EqualityComparatorFunction that compares the two input values
15558
+ *
15559
+ * @param readKey
15560
+ * @returns
15660
15561
  */
15562
+ function objectKeysEqualityComparatorFunction(readKey) {
15563
+ const readKeysSet = readKeysSetFunction(readKey);
15564
+ const readKeysArray = readKeysFunction(readKey);
15565
+ return safeEqualityComparatorFunction((a, b) => {
15566
+ if (a.length === b.length) {
15567
+ if (a.length === 0) {
15568
+ return true; // both the same/empty arrays
15569
+ }
15661
15570
 
15662
- function handlerMappedSetFunctionFactory(accessor, mapFn) {
15663
- return key => handlerMappedSetFunction(accessor, key, mapFn);
15571
+ const aKeys = readKeysSet(a);
15572
+ const bKeys = readKeysArray(b);
15573
+ if (aKeys.size === bKeys.length) {
15574
+ return setContainsAllValues(aKeys, bKeys);
15575
+ }
15576
+ }
15577
+ return false;
15578
+ });
15664
15579
  }
15665
15580
 
15666
15581
  /**
15667
- * Config for handlerConfigurerFactory().
15582
+ * Creates a EqualityComparatorFunction that compares the two input values
15583
+ *
15584
+ * @param readKey
15585
+ * @returns
15586
+ */
15587
+ function objectKeyEqualityComparatorFunction(readKey) {
15588
+ return safeEqualityComparatorFunction((a, b) => readKey(a) === readKey(b));
15589
+ }
15590
+
15591
+ /**
15592
+ * Used for copying one field from one partial object to a target object.
15668
15593
  */
15669
15594
 
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);
15676
- };
15595
+ function makeCopyModelFieldFunction(key, inputConfig) {
15596
+ const config = inputConfig != null ? inputConfig : {};
15597
+ const hasDefault = objectHasKey(config, 'default');
15598
+ const defaultValue = config.default;
15599
+ return (from, target) => {
15600
+ if (objectHasKey(from, key)) {
15601
+ var _from$key;
15602
+ target[key] = (_from$key = from[key]) != null ? _from$key : defaultValue;
15603
+ } else if (hasDefault) {
15604
+ target[key] = defaultValue;
15605
+ }
15677
15606
  };
15678
15607
  }
15679
15608
 
15609
+ // MARK: Model
15680
15610
  /**
15681
- * Registry used to load model services when requested.
15611
+ * Type used to declare a sister-type to the generic object.
15682
15612
  */
15683
15613
 
15614
+ function makeModelMapFunctions(fields) {
15615
+ const keys = filterKeyValueTuples(fields);
15616
+ const conversionsByKey = keys.map(([key, field]) => [key, field]);
15617
+ const fromConversions = conversionsByKey.map(([key, configs]) => [key, configs.from]);
15618
+ const toConversions = conversionsByKey.map(([key, configs]) => [key, configs.to]);
15619
+ const from = makeModelConversionFieldValuesFunction(fromConversions);
15620
+ const to = makeModelConversionFieldValuesFunction(toConversions);
15621
+ return {
15622
+ from,
15623
+ to
15624
+ };
15625
+ }
15626
+
15684
15627
  /**
15685
- * TypedServiceRegistry implementation.
15628
+ * A model conversion function. Performs a conversion on all non-null values.
15686
15629
  */
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}"`);
15630
+
15631
+ function makeModelConversionFieldValuesFunction(fields) {
15632
+ return (input, inputTarget, options) => {
15633
+ const target = inputTarget != null ? inputTarget : {};
15634
+ if (input != null) {
15635
+ let targetFields = fields;
15636
+
15637
+ // if options are provided, filter down.
15638
+ if (options) {
15639
+ const fieldsToMap = new Set(findPOJOKeys(input, {
15640
+ keysFilter: options.fields,
15641
+ valueFilter: options.definedOnly === false ? KeyValueTypleValueFilter.NONE : KeyValueTypleValueFilter.UNDEFINED
15642
+ }));
15643
+ targetFields = fields.filter(x => fieldsToMap.has(x[0]));
15644
+ }
15645
+ targetFields.forEach(([key, convert]) => target[key] = convert(input[key]));
15700
15646
  }
15701
- return service;
15702
- }
15647
+ return target;
15648
+ };
15703
15649
  }
15650
+
15651
+ // MARK: Fields
15704
15652
  /**
15705
- * Creates a new TypedServiceRegistryInstance and registers the input types.
15706
- * @returns
15653
+ * An object map containing a ModelFieldMapFunctions entry for each key (required and optional) from the generic object.
15707
15654
  */
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;
15716
- }
15717
15655
 
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
- }
15656
+ /**
15657
+ * An object map containing a ModelFieldMapFunctionsConfig for each key (required and optional) from the generic object.
15658
+ */
15659
+
15660
+ function modelFieldConversions(config) {
15661
+ return mapObjectMap(config, x => modelFieldMapFunctions(x));
15727
15662
  }
15728
- class DataIsExpiredError extends StoredDataError {
15729
- constructor(data, message) {
15730
- super(message);
15731
- this.data = data;
15732
- }
15663
+ function modelFieldMapFunctions(config) {
15664
+ return {
15665
+ from: modelFieldMapFunction(config.from),
15666
+ to: modelFieldMapFunction(config.to)
15667
+ };
15733
15668
  }
15734
15669
 
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;
15760
- }
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;
15768
- }
15769
- }
15770
- clear() {
15771
- this._storage = {};
15772
- this._length = 0;
15773
- }
15774
- }
15775
- const SHARED_MEMORY_STORAGE = new MemoryStorageInstance();
15670
+ // MARK: Field
15671
+ /**
15672
+ * ModelFieldMapFunction configuration that can convert a MaybeValue to the target value.
15673
+ */
15776
15674
 
15777
15675
  /**
15778
- * Limited Class/Interface for storing string values synchronously.
15676
+ * ModelFieldMapFunction configuration that handles the MaybeNot case with undefined.
15779
15677
  */
15780
- class SimpleStorageObject {}
15781
15678
 
15782
15679
  /**
15783
- * Synchronous Class/Interface for storing string values.
15680
+ * Configuration is either a ModelFieldMapMaybeTooConfig or a ModelFieldMapMaybeWithDefaultConfig
15681
+ */
15682
+
15683
+ /**
15684
+ * Creates a ModelFieldMapFunction.
15784
15685
  *
15785
- * Has the same interface as localStorage for the web.
15686
+ * @param config
15687
+ * @returns
15786
15688
  */
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
- }
15804
- }
15805
- class StorageObjectUtility {
15806
- static allKeysFromStorageObject(storageObject, prefix) {
15807
- const length = storageObject.length;
15689
+ function modelFieldMapFunction(config) {
15690
+ const convert = config.convert;
15691
+ const convertMaybe = config.convertMaybe;
15692
+ const defaultOutput = config.default;
15693
+ const defaultInput = config.defaultInput;
15694
+ const hasDefaultInput = defaultInput != null;
15695
+ const getDefaultOutput = asGetter(defaultOutput);
15696
+ const getDefaultInput = asGetter(defaultInput);
15697
+ return input => {
15808
15698
  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
- }
15699
+ if (isMaybeSo(input)) {
15700
+ result = convert(input);
15817
15701
  } else {
15818
- result = [];
15702
+ if (convertMaybe) {
15703
+ result = convertMaybe(input != null ? input : getDefaultInput());
15704
+ } else if (hasDefaultInput) {
15705
+ result = convert(getDefaultInput());
15706
+ } else {
15707
+ result = getDefaultOutput();
15708
+ }
15819
15709
  }
15820
15710
  return result;
15821
- }
15711
+ };
15822
15712
  }
15823
15713
 
15824
- /**
15825
- * Represents a single CSS class
15826
- */
15827
-
15828
- /**
15829
- * Represents one or more CssClasses that are space separated.
15830
- */
15714
+ // MARK: Utility
15831
15715
 
15832
15716
  /**
15833
- * One or more arrays of one or more CSS classes/arrays of classes.
15717
+ * Converts the input to a ModelFieldConversions value.
15718
+ *
15719
+ * @param input
15720
+ * @returns
15834
15721
  */
15722
+ function toModelFieldConversions(input) {
15723
+ var _fieldConversions;
15724
+ const conversions = (_fieldConversions = input.fieldConversions) != null ? _fieldConversions : modelFieldConversions(input.fields);
15725
+ return conversions;
15726
+ }
15727
+ function toModelMapFunctions(input) {
15728
+ let mapFunctions;
15729
+ if (input.mapFunctions != null) {
15730
+ mapFunctions = input.mapFunctions;
15731
+ } else {
15732
+ const conversions = toModelFieldConversions(input);
15733
+ mapFunctions = makeModelMapFunctions(conversions);
15734
+ }
15735
+ return mapFunctions;
15736
+ }
15835
15737
 
15836
15738
  /**
15837
- * Joins together various array of classes and only keeps the unique values.
15739
+ * Field conversion that copies the same value across.
15838
15740
  *
15839
- * @param cssClasses
15741
+ * @param defaultValue
15840
15742
  * @returns
15841
15743
  */
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;
15744
+ function copyField(defaultOutput) {
15745
+ return {
15746
+ from: {
15747
+ default: defaultOutput,
15748
+ convert: x => x
15749
+ },
15750
+ to: {
15751
+ default: defaultOutput,
15752
+ convert: x => x
15753
+ }
15754
+ };
15755
+ }
15756
+
15757
+ function maybeMergeModelModifiers(input) {
15758
+ const modifiers = asArray(input);
15759
+ const allModifyData = filterMaybeValues(modifiers.map(x => x.modifyData));
15760
+ const allModifyModel = filterMaybeValues(modifiers.map(x => x.modifyModel));
15761
+ const modifyData = maybeMergeModifiers(allModifyData);
15762
+ const modifyModel = maybeMergeModifiers(allModifyModel);
15763
+ return {
15764
+ modifyData,
15765
+ modifyModel
15766
+ };
15767
+ }
15768
+ function modifyModelMapFunctions(config) {
15769
+ const {
15770
+ copy,
15771
+ copyModel = copy,
15772
+ copyData = copy,
15773
+ mapFunctions,
15774
+ modifiers
15775
+ } = config;
15776
+ const {
15777
+ from,
15778
+ to
15779
+ } = mapFunctions;
15780
+ const {
15781
+ modifyData,
15782
+ modifyModel
15783
+ } = maybeMergeModelModifiers(modifiers);
15784
+ const modifyFrom = modifyModelMapFunction(from, modifyData, copyData);
15785
+ const modifyTo = modifyModelMapFunction(to, modifyModel, copyModel);
15786
+ return {
15787
+ from: modifyFrom,
15788
+ to: modifyTo
15789
+ };
15849
15790
  }
15850
15791
 
15851
15792
  /**
15852
- * Joins together various array of classes and returns the set of unique CSS classes.
15793
+ * Merges a ModifierFunction with a ModelMapFunction
15853
15794
  *
15854
- * @param cssClasses
15795
+ * @param mapFn
15796
+ * @param modifyModel
15797
+ * @param copy
15855
15798
  * @returns
15856
15799
  */
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);
15863
- } else {
15864
- result = new Set();
15865
- }
15866
- return result;
15800
+ function modifyModelMapFunction(mapFn, modifyModel, copy = true) {
15801
+ return modifyModel ? (input, target, options) => {
15802
+ const inputToMap = copy && input != null ? Object.assign({}, input) : input;
15803
+ if (inputToMap != null) {
15804
+ modifyModel(inputToMap);
15805
+ }
15806
+ return mapFn(inputToMap, target, options);
15807
+ } : mapFn;
15867
15808
  }
15868
15809
 
15869
15810
  /**
15870
- * SortCompareFunction by string.
15811
+ * Reads the input stream and encodes the data to a string.
15871
15812
  */
15872
15813
 
15873
15814
  /**
15874
- * Creates a SortByStringFunction that sorts values in ascending order.
15815
+ * Creates a new ReadableStreamToStringFunction
15816
+ * @param encoding
15817
+ * @returns
15875
15818
  */
15876
- function sortByStringFunction(readStringFn) {
15877
- return (a, b) => {
15878
- const as = readStringFn(a);
15879
- const bs = readStringFn(b);
15880
- return as.localeCompare(bs);
15819
+ function readableStreamToStringFunction(encoding) {
15820
+ return stream => {
15821
+ return readableStreamToBuffer(stream).then(x => x.toString(encoding));
15881
15822
  };
15882
15823
  }
15883
15824
 
15884
- // MARK: Configured
15885
-
15886
- const sortByLabelFunction = sortByStringFunction(x => x.label);
15887
-
15888
- // MARK: Search Strings
15889
- /**
15890
- * Decision function factory that is configured with search string values.
15891
- */
15892
-
15893
15825
  /**
15894
- * Filters values by the input filter text.
15826
+ * ReadableStreamToStringFunction for Base64
15895
15827
  */
15828
+ const readableStreamToBase64 = readableStreamToStringFunction('base64');
15896
15829
 
15897
15830
  /**
15898
- * Creates a SearchStringFilterFunction
15831
+ * Converts a ReadableStream to a Buffer promise.
15899
15832
  *
15900
- * @param config
15833
+ * @param encoding
15901
15834
  * @returns
15902
15835
  */
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
- });
15922
- };
15836
+ function readableStreamToBuffer(stream) {
15837
+ const chunks = [];
15838
+ return new Promise((resolve, reject) => {
15839
+ stream.on('data', chunk => chunks.push(Buffer.from(chunk)));
15840
+ stream.on('error', err => reject(err));
15841
+ stream.on('end', () => resolve(Buffer.concat(chunks)));
15842
+ });
15843
+ }
15844
+
15845
+ function joinHostAndPort(config) {
15846
+ if (config) {
15847
+ return `${config.host}:${config.port}`;
15848
+ } else {
15849
+ return config;
15850
+ }
15923
15851
  }
15924
15852
 
15853
+ let RelationChange = /*#__PURE__*/function (RelationChange) {
15854
+ RelationChange["ADD"] = "add";
15855
+ RelationChange["SET"] = "set";
15856
+ RelationChange["REMOVE_AND_INSERT"] = "remove_and_insert";
15857
+ RelationChange["REMOVE"] = "remove";
15858
+ RelationChange["UPDATE"] = "update";
15859
+ RelationChange["INSERT"] = "insert";
15860
+ return RelationChange;
15861
+ }({});
15862
+
15925
15863
  /**
15926
- * SearchStringDecisionFunctionFactory that searches for string matches using the input search term/filter text.
15927
- *
15928
- * @param filterText
15929
- * @returns
15864
+ * Merges the two input values. The "a" value is usually the existing/incumbent value, while "b" is the new value.
15930
15865
  */
15931
- const caseInsensitiveFilterByIndexOfDecisionFactory = filterText => {
15932
- const searchString = filterText.toLocaleLowerCase();
15933
- return string => string.toLocaleLowerCase().indexOf(searchString) !== -1;
15934
- };
15935
15866
 
15936
15867
  /**
15937
- * A tree node
15868
+ * Whether or not the object is changable as part of this request.
15938
15869
  */
15939
15870
 
15940
- const SPLIT_STRING_TREE_NODE_ROOT_VALUE = '';
15941
15871
  /**
15942
- * Creates a SplitStringTreeFactory with the configured splitter.
15872
+ * Utility class for modifying a collection of relational objects.
15943
15873
  *
15944
- * @param config
15945
- * @returns
15874
+ * For instance, a string collection of keys.
15946
15875
  */
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);
15983
- });
15984
- if (!result) {
15985
- result = factory({
15986
- values: []
15876
+ class ModelRelationUtility {
15877
+ static modifyStringCollection(current, change, mods) {
15878
+ return ModelRelationUtility.modifyCollection(current, change, mods, {
15879
+ readKey: x => x,
15880
+ merge: (a, b) => b
15987
15881
  });
15988
15882
  }
15989
- return result;
15990
- }
15991
- /**
15992
- * Adds a value to the target SplitStringTree.
15993
- *
15994
- * @param tree
15995
- * @param value
15996
- * @param separator
15997
- * @returns
15998
- */
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);
15883
+ static modifyCollection(current, change, mods, config) {
15884
+ var _current;
15885
+ const {
15886
+ mask,
15887
+ readKey
15888
+ } = config;
15889
+ current = (_current = current) != null ? _current : []; //init current if not set.
15890
+
15891
+ if (mask) {
15892
+ const {
15893
+ included: currentModify,
15894
+ excluded: currentRetain
15895
+ } = separateValues(current, mask);
15896
+ const {
15897
+ included: modModify
15898
+ } = separateValues(mods, mask);
15899
+ const modifiedResults = this._modifyCollectionWithoutMask(currentModify, change, modModify, config);
15900
+ return this._mergeMaskResults(current, currentRetain, modifiedResults, readKey);
16012
15901
  } else {
16013
- return nextMeta;
15902
+ return this._modifyCollectionWithoutMask(current, change, mods, config);
16014
15903
  }
16015
15904
  }
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
15905
 
16025
- if (!existingChildNode) {
16026
- childNode.fullValue = currentNode.fullValue ? currentNode.fullValue + separator + nodeValue : nodeValue;
16027
- currentNode.children[nodeValue] = childNode;
15906
+ /**
15907
+ * The mask results are merged together.
15908
+ *
15909
+ * Order from the "current" is retained. Anything in currentRetain overrides modifiedResults.
15910
+ */
15911
+ static _mergeMaskResults(current, currentRetain, modifiedResults, readKey) {
15912
+ return restoreOrderWithValues(current, [...currentRetain, ...modifiedResults], {
15913
+ readKey
15914
+ });
15915
+ }
15916
+ static _modifyCollectionWithoutMask(current, change, mods, config) {
15917
+ const {
15918
+ readKey,
15919
+ merge,
15920
+ shouldRemove
15921
+ } = config;
15922
+ const readType = config.readType;
15923
+ function remove(rCurrent = current, rMods = mods) {
15924
+ return ModelRelationUtility._modifyCollection(rCurrent, rMods, (x, y) => {
15925
+ return ModelRelationUtility.removeFromCollection(x, y, readKey, shouldRemove);
15926
+ }, readType);
15927
+ }
15928
+ function performAdd() {
15929
+ return ModelRelationUtility._modifyCollection(current, mods, (x, y) => ModelRelationUtility.addToCollection(x, y, readKey), readType);
15930
+ }
15931
+ function performInsert() {
15932
+ return ModelRelationUtility.insertCollection(current, mods, {
15933
+ readKey,
15934
+ readType,
15935
+ merge
15936
+ });
15937
+ }
15938
+ switch (change) {
15939
+ case RelationChange.SET:
15940
+ current = []; // Set current before performing add.
15941
+ return performAdd();
15942
+ case RelationChange.ADD:
15943
+ return performAdd();
15944
+ case RelationChange.REMOVE:
15945
+ return remove();
15946
+ case RelationChange.UPDATE:
15947
+ return ModelRelationUtility.updateCollection(current, mods, {
15948
+ readKey,
15949
+ readType,
15950
+ merge
15951
+ });
15952
+ case RelationChange.REMOVE_AND_INSERT:
15953
+ current = remove(current, current); // Remove all current values before performing an insert.
15954
+ return performInsert();
15955
+ case RelationChange.INSERT:
15956
+ return performInsert();
16028
15957
  }
15958
+ }
15959
+ static updateCollection(current, update, {
15960
+ readKey,
15961
+ readType,
15962
+ merge
15963
+ }) {
15964
+ ModelRelationUtility._assertMergeProvided(merge);
15965
+ return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._updateSingleTypeCollection(x, y, {
15966
+ readKey,
15967
+ merge
15968
+ }), readType);
15969
+ }
15970
+ static insertCollection(current, update, {
15971
+ readKey,
15972
+ readType,
15973
+ merge
15974
+ }) {
15975
+ ModelRelationUtility._assertMergeProvided(merge);
15976
+ return ModelRelationUtility._modifyCollection(current, update, (x, y) => ModelRelationUtility._insertSingleTypeCollection(x, y, {
15977
+ readKey,
15978
+ merge
15979
+ }), readType);
15980
+ }
16029
15981
 
16030
- // add the meta to the node
16031
- if (nodeMeta != null) {
16032
- childNode.meta = nextMeta(childNode, nodeMeta);
15982
+ /**
15983
+ * Used to modify a collection which may be multi-type. If readType is provided, the collection is handled as a multi-type map.
15984
+ */
15985
+ static _modifyCollection(current, mods, modifyCollection, readType) {
15986
+ if (readType) {
15987
+ return ModelRelationUtility._modifyMultiTypeCollection(current, mods, readType, modifyCollection);
15988
+ } else {
15989
+ return modifyCollection(current, mods);
16033
15990
  }
16034
- currentNode = childNode;
16035
- });
15991
+ }
15992
+ static _modifyMultiTypeCollection(input, mods, readType, modifyCollection) {
15993
+ const inputMap = makeValuesGroupMap(input, readType);
15994
+ const modsMap = makeValuesGroupMap(mods, readType);
15995
+ const typesModified = new Set([...inputMap.keys(), ...modsMap.keys()]);
16036
15996
 
16037
- // add the meta to the leaf node
16038
- if (leafMeta != null) {
16039
- currentNode.meta = nextMeta(currentNode, leafMeta);
15997
+ // Break the collections up into their individual types and process separately.
15998
+ const modifiedSubcollections = Array.from(typesModified).map(type => {
15999
+ var _inputMap$get, _modsMap$get;
16000
+ const values = (_inputMap$get = inputMap.get(type)) != null ? _inputMap$get : [];
16001
+ const mods = (_modsMap$get = modsMap.get(type)) != null ? _modsMap$get : [];
16002
+
16003
+ // Only modify if they've got changes for their type.
16004
+ if (mods.length === 0) {
16005
+ return values; // No mods, no change to those types.
16006
+ } else {
16007
+ return modifyCollection(values, mods);
16008
+ }
16009
+ });
16010
+
16011
+ // Rejoin all changes.
16012
+ return modifiedSubcollections.reduce((x, y) => x.concat(y), []);
16013
+ }
16014
+ static _insertSingleTypeCollection(current, insert, {
16015
+ readKey,
16016
+ merge
16017
+ }) {
16018
+ const currentKeys = arrayToMap(current, readKey);
16019
+ const updateValues = [];
16020
+ const addValues = [];
16021
+ insert.forEach(value => {
16022
+ const key = readKey(value);
16023
+ if (currentKeys.has(key)) {
16024
+ updateValues.push(value);
16025
+ } else {
16026
+ addValues.push(value);
16027
+ }
16028
+ });
16029
+ const added = ModelRelationUtility.addToCollection(current, addValues, readKey);
16030
+ const results = ModelRelationUtility._updateSingleTypeCollection(added, updateValues, {
16031
+ readKey,
16032
+ merge
16033
+ });
16034
+ return results;
16035
+ }
16036
+ static _updateSingleTypeCollection(current, update, {
16037
+ readKey,
16038
+ merge
16039
+ }) {
16040
+ const keysToUpdate = arrayToMap(update, readKey);
16041
+ const updateValues = [];
16042
+ current.forEach(value => {
16043
+ const key = readKey(value);
16044
+ const mergeWith = keysToUpdate.get(key);
16045
+ if (mergeWith != null) {
16046
+ updateValues.push(merge(value, mergeWith));
16047
+ }
16048
+ });
16049
+
16050
+ // Add to merge all values and remove duplicates.
16051
+ return ModelRelationUtility.addToCollection(current, updateValues, readKey);
16052
+ }
16053
+ static addToCollection(current, add, readKey) {
16054
+ var _current2;
16055
+ current = (_current2 = current) != null ? _current2 : [];
16056
+ return add != null && add.length ? ModelRelationUtility.removeDuplicates([...add, ...current], readKey) : current; // Will keep any "added" before any existing ones.
16057
+ }
16058
+
16059
+ static removeFromCollection(current, remove, readKey, shouldRemove) {
16060
+ if (current != null && current.length) {
16061
+ if (shouldRemove) {
16062
+ const currentKeyPairs = makeKeyPairs(current, readKey);
16063
+ const map = new Map(currentKeyPairs);
16064
+ remove.forEach(x => {
16065
+ const key = readKey(x);
16066
+ const removalTarget = map.get(key);
16067
+ if (removalTarget && shouldRemove(removalTarget)) {
16068
+ map.delete(key); // Remove from the map.
16069
+ }
16070
+ });
16071
+
16072
+ return currentKeyPairs.filter(x => map.has(x[0])).map(x => x[1]); // Retain order, remove from map.
16073
+ } else {
16074
+ return ModelRelationUtility.removeKeysFromCollection(current, remove.map(readKey), readKey);
16075
+ }
16076
+ } else {
16077
+ return [];
16078
+ }
16079
+ }
16080
+ static removeKeysFromCollection(current, keysToRemove, readKey) {
16081
+ return ModelRelationUtility.removeDuplicates(current, readKey, keysToRemove);
16082
+ }
16083
+ static removeDuplicates(relations, readKey, additionalKeys = []) {
16084
+ return relations != null && relations.length ? filterUniqueValues(relations, readKey, additionalKeys) : [];
16085
+ }
16086
+
16087
+ // MARK: Internal Utility
16088
+ static _assertMergeProvided(merge) {
16089
+ if (!merge) {
16090
+ throw new Error('Merge was not provided.');
16091
+ }
16040
16092
  }
16041
- return tree;
16042
16093
  }
16043
16094
 
16044
- // MARK: Search
16045
16095
  /**
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
16096
+ * Key used to signify
16053
16097
  */
16054
- function findBestSplitStringTreeMatch(tree, value) {
16055
- return lastValue(findBestSplitStringTreeMatchPath(tree, value));
16056
- }
16098
+ const CATCH_ALL_HANDLE_RESULT_KEY = '__CATCH_ALL_HANDLE_RESULT_KEY__';
16057
16099
 
16058
16100
  /**
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.
16101
+ * Whether or not the input value was handled.
16102
+ */
16103
+
16104
+ /**
16105
+ * Used to perform a task on the input value.
16062
16106
  *
16063
- * @param tree
16064
- * @param value
16065
- * @returns
16107
+ * If the value is not used/"handled", returns false.
16066
16108
  */
16067
- function findBestSplitStringTreeChildMatch(tree, value) {
16068
- return lastValue(findBestSplitStringTreeChildMatchPath(tree, value));
16109
+
16110
+ function handlerFactory(readKey) {
16111
+ return () => {
16112
+ let catchAll;
16113
+ const map = new Map();
16114
+ const set = (key, handle) => {
16115
+ if (key === CATCH_ALL_HANDLE_RESULT_KEY) {
16116
+ catchAll = handle;
16117
+ } else {
16118
+ setKeysOnMap(map, key, handle);
16119
+ }
16120
+ };
16121
+ const bindSet = (bindTo, key, handle) => {
16122
+ const bindHandle = handle.bind(bindTo);
16123
+ set(key, bindHandle);
16124
+ };
16125
+ const fn = build({
16126
+ base: value => {
16127
+ var _ref;
16128
+ const key = readKey(value);
16129
+ const handler = (_ref = key != null ? map.get(key) : undefined) != null ? _ref : catchAll;
16130
+ let handled = false;
16131
+ if (handler) {
16132
+ handled = handler(value);
16133
+ }
16134
+ return handled;
16135
+ },
16136
+ build: x => {
16137
+ x.readKey = readKey;
16138
+ x.set = set;
16139
+ x.bindSet = bindSet;
16140
+ }
16141
+ });
16142
+ return fn;
16143
+ };
16144
+ }
16145
+ function makeHandler(readKey) {
16146
+ return handlerFactory(readKey)();
16147
+ }
16148
+ function catchAllHandlerKey() {
16149
+ return CATCH_ALL_HANDLE_RESULT_KEY;
16069
16150
  }
16070
16151
 
16071
16152
  /**
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
16153
+ * Wraps a HandlerAccessor and the item it is bound to in order to be a HandlerSetAccessor.
16079
16154
  */
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
16155
 
16088
16156
  /**
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.
16157
+ * Creates a HandlerBindAccessor<T, K> for the input values.
16092
16158
  *
16093
- * @param tree
16094
- * @param value
16159
+ * @param bindTo
16160
+ * @param accessor
16095
16161
  * @returns
16096
16162
  */
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;
16163
+ function handlerBindAccessor(boundTo, accessor) {
16164
+ return {
16165
+ accessor,
16166
+ boundTo,
16167
+ set: (key, handle) => {
16168
+ accessor.bindSet(boundTo, key, handle);
16109
16169
  }
16110
- return stopScan;
16111
- });
16112
- return bestMatchPath;
16170
+ };
16113
16171
  }
16114
16172
 
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
16173
  /**
16121
- * ExpandTreeFunction configuration.
16174
+ * Contextual function that configures the context's Handler with the input function for the context's key.
16122
16175
  */
16123
16176
 
16124
16177
  /**
16125
- * Extended ExpandTree configuration with custom node building.
16178
+ * Creates a HandlerSetFunction.
16179
+ *
16180
+ * @param accessor
16181
+ * @param key
16182
+ * @returns
16126
16183
  */
16184
+ function handlerSetFunction(accessor, key) {
16185
+ const fn = handlerFunction => {
16186
+ accessor.set(key, handlerFunction); // set the handler on the pre-defined key.
16187
+ };
16188
+
16189
+ fn.key = key;
16190
+ return fn;
16191
+ }
16192
+ function handlerMappedSetFunction(accessor, key, mapFn) {
16193
+ const handlerSet = handlerSetFunction(accessor, key);
16194
+ return handlerFunction => {
16195
+ // 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.
16196
+ handlerSet(function (value) {
16197
+ const mapped = mapFn(value); // fowards "this" to the next call.
16198
+ return handlerFunction.call(this, mapped);
16199
+ });
16200
+ };
16201
+ }
16127
16202
 
16128
16203
  /**
16129
- * Expands the input value into a TreeNode.
16204
+ * Factory for a HandlerMappedSetFunction<I>.
16130
16205
  */
16131
16206
 
16207
+ function handlerMappedSetFunctionFactory(accessor, mapFn) {
16208
+ return key => handlerMappedSetFunction(accessor, key, mapFn);
16209
+ }
16210
+
16132
16211
  /**
16133
- * Creates an ExpandTreeFunction from the input configuration.
16134
- *
16135
- * @param config
16212
+ * Config for handlerConfigurerFactory().
16136
16213
  */
16137
16214
 
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
16215
+ function handlerConfigurerFactory(config) {
16216
+ return handler => {
16217
+ return (bindTo, configure) => {
16218
+ const accessor = handlerBindAccessor(bindTo, handler);
16219
+ const configurer = config.configurerForAccessor(accessor);
16220
+ configure(configurer);
16147
16221
  };
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
16222
  };
16153
- return root => expandFn(root);
16154
16223
  }
16155
16224
 
16156
16225
  /**
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
16226
+ * Registry used to load model services when requested.
16162
16227
  */
16163
- function expandTrees(values, expandFn) {
16164
- return values.map(expandFn);
16165
- }
16166
16228
 
16167
- // MARK: Flatten
16168
16229
  /**
16169
- * Flattens the tree by pushing the values into the input array, or a new array and returns the value.
16230
+ * TypedServiceRegistry implementation.
16170
16231
  */
16171
-
16232
+ class TypedServiceRegistryInstance {
16233
+ constructor() {
16234
+ this._map = new Map();
16235
+ }
16236
+ registerServiceForType(type, service) {
16237
+ const getter = asGetter(service);
16238
+ this._map.set(type, getter);
16239
+ }
16240
+ serviceForType(type) {
16241
+ const getter = this._map.get(type);
16242
+ const service = getter == null ? void 0 : getter();
16243
+ if (service == null) {
16244
+ throw new Error(`no service registered for type "${type}"`);
16245
+ }
16246
+ return service;
16247
+ }
16248
+ }
16172
16249
  /**
16173
- * Traverses the tree and flattens it into all tree nodes.
16250
+ * Creates a new TypedServiceRegistryInstance and registers the input types.
16251
+ * @returns
16174
16252
  */
16175
- function flattenTree(tree) {
16176
- return flattenTreeToArray(tree, []);
16253
+ function typedServiceRegistry(config) {
16254
+ const instance = new TypedServiceRegistryInstance();
16255
+ forEachKeyValue(config.services, {
16256
+ forEach: ([key, service]) => {
16257
+ instance.registerServiceForType(key, service);
16258
+ }
16259
+ });
16260
+ return instance;
16261
+ }
16262
+
16263
+ class StoredDataError extends BaseError {
16264
+ constructor(message) {
16265
+ super(message);
16266
+ }
16267
+ }
16268
+ class DataDoesNotExistError extends StoredDataError {
16269
+ constructor(message) {
16270
+ super(message);
16271
+ }
16272
+ }
16273
+ class DataIsExpiredError extends StoredDataError {
16274
+ constructor(data, message) {
16275
+ super(message);
16276
+ this.data = data;
16277
+ }
16278
+ }
16279
+
16280
+ class MemoryStorageInstance {
16281
+ constructor() {
16282
+ this._length = 0;
16283
+ this._storage = {};
16284
+ }
16285
+ get length() {
16286
+ return this._length;
16287
+ }
16288
+ key(index) {
16289
+ var _Object$keys$index;
16290
+ return (_Object$keys$index = Object.keys(this._storage)[index]) != null ? _Object$keys$index : null;
16291
+ }
16292
+ hasKey(key) {
16293
+ return objectHasKey(this._storage, key);
16294
+ }
16295
+ getItem(key) {
16296
+ var _this$_storage$key;
16297
+ return (_this$_storage$key = this._storage[key]) != null ? _this$_storage$key : null;
16298
+ }
16299
+ setItem(key, item) {
16300
+ if (item == null) {
16301
+ this.removeItem(key);
16302
+ } else {
16303
+ if (!this.hasKey(key)) {
16304
+ this._length = this._length + 1;
16305
+ }
16306
+ this._storage[key] = String(item);
16307
+ }
16308
+ }
16309
+ removeItem(key) {
16310
+ if (this.hasKey(key)) {
16311
+ delete this._storage[key]; // Remove the property
16312
+ this._length = this._length - 1;
16313
+ }
16314
+ }
16315
+ clear() {
16316
+ this._storage = {};
16317
+ this._length = 0;
16318
+ }
16177
16319
  }
16320
+ const SHARED_MEMORY_STORAGE = new MemoryStorageInstance();
16178
16321
 
16179
16322
  /**
16180
- * Traverses the tree and pushes the nodes into the input array.
16323
+ * Limited Class/Interface for storing string values synchronously.
16324
+ */
16325
+ class SimpleStorageObject {}
16326
+
16327
+ /**
16328
+ * Synchronous Class/Interface for storing string values.
16181
16329
  *
16182
- * @param tree
16183
- * @param array
16184
- * @returns
16330
+ * Has the same interface as localStorage for the web.
16185
16331
  */
16186
- function flattenTreeToArray(tree, array) {
16187
- return flattenTreeToArrayFunction()(tree, array);
16332
+ class StorageObject extends SimpleStorageObject {
16333
+ constructor(...args) {
16334
+ super(...args);
16335
+ this.length = void 0;
16336
+ }
16337
+ /**
16338
+ * Returns the string key for the index.
16339
+ *
16340
+ * Returns null if no key available.
16341
+ */
16188
16342
  }
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));
16343
+ class FullStorageObject extends StorageObject {
16344
+ constructor(...args) {
16345
+ super(...args);
16346
+ this.isPersistant = void 0;
16347
+ this.isAvailable = void 0;
16348
+ }
16349
+ }
16350
+ class StorageObjectUtility {
16351
+ static allKeysFromStorageObject(storageObject, prefix) {
16352
+ const length = storageObject.length;
16353
+ let result;
16354
+ if (length > 0) {
16355
+ result = range({
16356
+ start: 0,
16357
+ end: length
16358
+ }).map(x => storageObject.key(x)).filter(hasNonNullValue);
16359
+ if (prefix) {
16360
+ result = result.filter(x => x.startsWith(prefix));
16361
+ }
16362
+ } else {
16363
+ result = [];
16195
16364
  }
16196
- return array;
16197
- };
16198
- return flattenFn;
16365
+ return result;
16366
+ }
16199
16367
  }
16200
16368
 
16201
16369
  /**
16202
- * Convenience function for flattening multiple trees with a flatten function.
16203
- *
16204
- * @param trees
16205
- * @param flattenFn
16206
- * @returns
16370
+ * Represents a single CSS class
16207
16371
  */
16208
- function flattenTrees(trees, flattenFn) {
16209
- const array = [];
16210
- trees.forEach(x => flattenFn(x, array));
16211
- return array;
16212
- }
16213
16372
 
16214
- /*eslint @typescript-eslint/no-explicit-any:"off"*/
16373
+ /**
16374
+ * Represents one or more CssClasses that are space separated.
16375
+ */
16215
16376
 
16216
16377
  /**
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.
16378
+ * One or more arrays of one or more CSS classes/arrays of classes.
16218
16379
  */
16219
16380
 
16220
16381
  /**
16221
- * Creates an ExpandFlattenTree function.
16382
+ * Joins together various array of classes and only keeps the unique values.
16222
16383
  *
16223
- * @param expand
16224
- * @param flatten
16384
+ * @param cssClasses
16225
16385
  * @returns
16226
16386
  */
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;
16387
+ function spaceSeparatedCssClasses(cssClasses) {
16388
+ let result = '';
16389
+ if (cssClasses) {
16390
+ const allClasses = cssClassesSet(cssClasses);
16391
+ result = joinStringsWithSpaces(Array.from(allClasses));
16252
16392
  }
16393
+ return result;
16253
16394
  }
16254
16395
 
16255
- // MARK: Random
16256
16396
  /**
16257
- * Factory that generates boolean values.
16397
+ * Joins together various array of classes and returns the set of unique CSS classes.
16398
+ *
16399
+ * @param cssClasses
16400
+ * @returns
16258
16401
  */
16402
+ function cssClassesSet(cssClasses) {
16403
+ let result;
16404
+ if (cssClasses) {
16405
+ const arrayOfClasses = iterableToArray(cssClasses, false);
16406
+ const arrayOfAllClassValues = arrayOfClasses.map(x => asArray(x).map(x => x.split(' ')).flat()).flat();
16407
+ result = new Set(arrayOfAllClassValues);
16408
+ } else {
16409
+ result = new Set();
16410
+ }
16411
+ return result;
16412
+ }
16259
16413
 
16260
16414
  /**
16261
- * Number from 0.0 to 100.0 used for the chance to return true.
16415
+ * SortCompareFunction by string.
16262
16416
  */
16263
16417
 
16264
16418
  /**
16265
- * Creates a new BooleanFactory.
16266
- *
16267
- * @param config
16268
- * @returns
16419
+ * Creates a SortByStringFunction that sorts values in ascending order.
16269
16420
  */
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;
16421
+ function sortByStringFunction(readStringFn) {
16422
+ return (a, b) => {
16423
+ const as = readStringFn(a);
16424
+ const bs = readStringFn(b);
16425
+ return as.localeCompare(bs);
16279
16426
  };
16280
16427
  }
16281
16428
 
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
- }
16429
+ // MARK: Configured
16293
16430
 
16294
- /**
16295
- * Values that correspond to each day of the week.
16296
- */
16431
+ const sortByLabelFunction = sortByStringFunction(x => x.label);
16297
16432
 
16433
+ // MARK: Search Strings
16298
16434
  /**
16299
- * Returns the day of the week for the input day.
16300
- *
16301
- * Equivalent to date.getDay()
16302
- *
16303
- * @param date
16304
- * @returns
16435
+ * Decision function factory that is configured with search string values.
16305
16436
  */
16306
- function dayOfWeek(date) {
16307
- return date.getDay();
16308
- }
16309
16437
 
16310
16438
  /**
16311
- * Decision function that checks whether or not the input DayOfWeek or the DayOfWeek for the input Date is in the set.
16439
+ * Filters values by the input filter text.
16312
16440
  */
16313
16441
 
16314
16442
  /**
16315
- * Creates a DecisionFunction that checks whether or not the input day or days of
16443
+ * Creates a SearchStringFilterFunction
16316
16444
  *
16317
- * @param allowedDaysOfWeek
16445
+ * @param config
16318
16446
  * @returns
16319
16447
  */
16320
- function isInAllowedDaysOfWeekSet(allowedDaysOfWeek) {
16321
- return isInSetDecisionFunction(allowedDaysOfWeek, x => {
16322
- return typeof x === 'number' ? x : dayOfWeek(x);
16323
- });
16448
+ function searchStringFilterFunction(config) {
16449
+ const {
16450
+ readStrings,
16451
+ decisionFactory = caseInsensitiveFilterByIndexOfDecisionFactory
16452
+ } = typeof config === 'function' ? {
16453
+ readStrings: config
16454
+ } : config;
16455
+ return (filterText, values) => {
16456
+ const decision = decisionFactory(filterText);
16457
+ return values.filter(value => {
16458
+ const searchResult = readStrings(value);
16459
+ let match = false;
16460
+ if (Array.isArray(searchResult)) {
16461
+ match = searchResult.findIndex(decision) !== -1;
16462
+ } else if (searchResult != null) {
16463
+ match = decision(searchResult);
16464
+ }
16465
+ return match;
16466
+ });
16467
+ };
16324
16468
  }
16325
16469
 
16326
16470
  /**
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.
16471
+ * SearchStringDecisionFunctionFactory that searches for string matches using the input search term/filter text.
16330
16472
  *
16331
- * @param startingOn
16473
+ * @param filterText
16474
+ * @returns
16332
16475
  */
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
- }
16476
+ const caseInsensitiveFilterByIndexOfDecisionFactory = filterText => {
16477
+ const searchString = filterText.toLocaleLowerCase();
16478
+ return string => string.toLocaleLowerCase().indexOf(searchString) !== -1;
16479
+ };
16346
16480
 
16347
16481
  /**
16348
- * Enum for the days of the week.
16482
+ * A tree node
16349
16483
  */
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
16484
 
16485
+ const SPLIT_STRING_TREE_NODE_ROOT_VALUE = '';
16361
16486
  /**
16362
- * Object containing the name of every day and whether they're true/false.
16487
+ * Creates a SplitStringTreeFactory with the configured splitter.
16488
+ *
16489
+ * @param config
16490
+ * @returns
16363
16491
  */
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
- }
16492
+ function splitStringTreeFactory(config) {
16493
+ const {
16494
+ separator
16495
+ } = config;
16496
+ const fn = (input, existing) => {
16497
+ const {
16498
+ leafMeta,
16499
+ nodeMeta,
16500
+ values
16501
+ } = input;
16502
+ const result = existing != null ? existing : {
16503
+ fullValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
16504
+ nodeValue: SPLIT_STRING_TREE_NODE_ROOT_VALUE,
16505
+ children: {}
16506
+ };
16507
+ asArray(values).forEach(value => {
16508
+ addToSplitStringTree(result, {
16509
+ value,
16510
+ leafMeta,
16511
+ nodeMeta
16512
+ }, config);
16513
+ });
16514
+ return result;
16515
+ };
16516
+ fn._separator = separator;
16517
+ return fn;
16518
+ }
16519
+ function applySplitStringTreeWithMultipleValues(input) {
16520
+ const {
16521
+ entries,
16522
+ factory,
16523
+ existing
16524
+ } = input;
16525
+ let result = existing;
16526
+ entries.forEach(entry => {
16527
+ result = factory(entry, result);
16528
+ });
16529
+ if (!result) {
16530
+ result = factory({
16531
+ values: []
16532
+ });
16401
16533
  }
16402
- return daysOfWeek;
16534
+ return result;
16403
16535
  }
16404
16536
  /**
16405
- * Returns an array of strinsg with each day of the week named.
16537
+ * Adds a value to the target SplitStringTree.
16406
16538
  *
16539
+ * @param tree
16540
+ * @param value
16541
+ * @param separator
16407
16542
  * @returns
16408
16543
  */
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];
16544
+ function addToSplitStringTree(tree, inputValue, config) {
16545
+ const {
16546
+ separator,
16547
+ mergeMeta
16548
+ } = config;
16549
+ const {
16550
+ value,
16551
+ leafMeta,
16552
+ nodeMeta
16553
+ } = inputValue;
16554
+ function nextMeta(node, nextMeta) {
16555
+ if (mergeMeta && node.meta != null) {
16556
+ return mergeMeta(node.meta, nextMeta);
16557
+ } else {
16558
+ return nextMeta;
16559
+ }
16417
16560
  }
16418
- if (transform != null) {
16419
- if (transform.abbreviation) {
16420
- dayOfWeekNames = dayOfWeekNames.map(x => x.slice(0, 3));
16561
+ const parts = value.split(separator);
16562
+ let currentNode = tree;
16563
+ parts.forEach(nodeValue => {
16564
+ const existingChildNode = currentNode.children[nodeValue];
16565
+ const childNode = existingChildNode != null ? existingChildNode : {
16566
+ nodeValue,
16567
+ children: {}
16568
+ }; // use the existing node or create a new node
16569
+
16570
+ if (!existingChildNode) {
16571
+ childNode.fullValue = currentNode.fullValue ? currentNode.fullValue + separator + nodeValue : nodeValue;
16572
+ currentNode.children[nodeValue] = childNode;
16421
16573
  }
16422
- if (transform.uppercase) {
16423
- dayOfWeekNames = dayOfWeekNames.map(x => x.toUpperCase());
16574
+
16575
+ // add the meta to the node
16576
+ if (nodeMeta != null) {
16577
+ childNode.meta = nextMeta(childNode, nodeMeta);
16424
16578
  }
16579
+ currentNode = childNode;
16580
+ });
16581
+
16582
+ // add the meta to the leaf node
16583
+ if (leafMeta != null) {
16584
+ currentNode.meta = nextMeta(currentNode, leafMeta);
16425
16585
  }
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;
16586
+ return tree;
16465
16587
  }
16466
16588
 
16589
+ // MARK: Search
16467
16590
  /**
16468
- * Returns the number of invocations that have occurred since the period started.
16591
+ * Returns the best match for the value in the tree, including the input tree value.
16469
16592
  *
16470
- * When a new period has started, returns 0.
16593
+ * Only returns a result if there is match of any kind.
16594
+ *
16595
+ * @param tree
16596
+ * @param value
16597
+ * @returns
16471
16598
  */
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;
16599
+ function findBestSplitStringTreeMatch(tree, value) {
16600
+ return lastValue(findBestSplitStringTreeMatchPath(tree, value));
16495
16601
  }
16496
16602
 
16497
16603
  /**
16498
- * Timer object that counts down a fixed duration amount.
16604
+ * Returns the best match for the value in the true, excluding the input tree value.
16499
16605
  *
16500
- * The timer is not required to start immediately.
16606
+ * Only returns a result if there is match of any kind.
16501
16607
  *
16502
- * Once the timer has complete it cannot be reset.
16608
+ * @param tree
16609
+ * @param value
16610
+ * @returns
16503
16611
  */
16504
-
16505
- class TimerCancelledError extends BaseError {
16506
- constructor() {
16507
- super(`The timer was destroyed before it was completed.`);
16508
- }
16612
+ function findBestSplitStringTreeChildMatch(tree, value) {
16613
+ return lastValue(findBestSplitStringTreeChildMatchPath(tree, value));
16509
16614
  }
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
- }
16615
+
16616
+ /**
16617
+ * Returns the best match for the value in the tree, including the input tree value.
16618
+ *
16619
+ * Only returns a result if there is match of any kind.
16620
+ *
16621
+ * @param tree
16622
+ * @param value
16623
+ * @returns
16624
+ */
16625
+ function findBestSplitStringTreeMatchPath(tree, value) {
16626
+ let bestResult = findBestSplitStringTreeChildMatchPath(tree, value);
16627
+ if (!bestResult && tree.fullValue && value.startsWith(tree.fullValue)) {
16628
+ bestResult = [tree];
16587
16629
  }
16630
+ return bestResult;
16631
+ }
16588
16632
 
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);
16633
+ /**
16634
+ * Returns the best match for the value in the true, excluding the input tree value.
16635
+ *
16636
+ * Only returns a result if there is match of any kind.
16637
+ *
16638
+ * @param tree
16639
+ * @param value
16640
+ * @returns
16641
+ */
16642
+ function findBestSplitStringTreeChildMatchPath(tree, value) {
16643
+ const {
16644
+ children
16645
+ } = tree;
16646
+ let bestMatchPath;
16647
+ Object.entries(children).find(([_, child]) => {
16648
+ let stopScan = false;
16649
+ if (value.startsWith(child.fullValue)) {
16650
+ var _findBestSplitStringT;
16651
+ const bestChildPath = (_findBestSplitStringT = findBestSplitStringTreeChildMatchPath(child, value)) != null ? _findBestSplitStringT : [];
16652
+ bestMatchPath = [child, ...bestChildPath];
16653
+ stopScan = true;
16602
16654
  }
16603
- }
16655
+ return stopScan;
16656
+ });
16657
+ return bestMatchPath;
16604
16658
  }
16605
- function timer(duration, startNow = true) {
16606
- return new TimerInstance(duration, startNow);
16659
+
16660
+ /*eslint @typescript-eslint/no-explicit-any:"off"*/
16661
+ // any is used with intent here, as the recursive TreeNode value requires its use to terminate.
16662
+
16663
+ // MARK: Expand
16664
+
16665
+ /**
16666
+ * ExpandTreeFunction configuration.
16667
+ */
16668
+
16669
+ /**
16670
+ * Extended ExpandTree configuration with custom node building.
16671
+ */
16672
+
16673
+ /**
16674
+ * Expands the input value into a TreeNode.
16675
+ */
16676
+
16677
+ /**
16678
+ * Creates an ExpandTreeFunction from the input configuration.
16679
+ *
16680
+ * @param config
16681
+ */
16682
+
16683
+ function expandTreeFunction(config) {
16684
+ var _makeNode;
16685
+ const makeNode = (_makeNode = config.makeNode) != null ? _makeNode : node => node;
16686
+ const expandFn = (value, parent) => {
16687
+ const depth = parent ? parent.depth + 1 : 0;
16688
+ const treeNode = {
16689
+ depth,
16690
+ parent,
16691
+ value
16692
+ };
16693
+ const node = makeNode(treeNode);
16694
+ const childrenValues = config.getChildren(value);
16695
+ node.children = childrenValues ? childrenValues.map(x => expandFn(x, node)) : undefined;
16696
+ return node;
16697
+ };
16698
+ return root => expandFn(root);
16607
16699
  }
16608
16700
 
16609
16701
  /**
16610
- * Toggles the input Timer's running state.
16702
+ * Convenience function for expanding multiple values into trees then merging them together into a single array.
16611
16703
  *
16612
- * @param timer
16613
- * @param toggleRun
16704
+ * @param values
16705
+ * @param expandFn
16706
+ * @returns
16614
16707
  */
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
- }
16708
+ function expandTrees(values, expandFn) {
16709
+ return values.map(expandFn);
16622
16710
  }
16623
16711
 
16712
+ // MARK: Flatten
16624
16713
  /**
16625
- * Returns the approximate end date of the given timer. If a timer is already complete, it returns the time for now.
16714
+ * Flattens the tree by pushing the values into the input array, or a new array and returns the value.
16626
16715
  */
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
- }
16716
+
16717
+ /**
16718
+ * Traverses the tree and flattens it into all tree nodes.
16719
+ */
16720
+ function flattenTree(tree) {
16721
+ return flattenTreeToArray(tree, []);
16634
16722
  }
16635
16723
 
16636
16724
  /**
16637
- * Represents a string for a time. This may be human-input, and
16638
- * can be interpreted in various ways depending on the input.
16725
+ * Traverses the tree and pushes the nodes into the input array.
16639
16726
  *
16640
- * Examples:
16641
- * - 1:20AM
16642
- * - 1:20
16643
- * - 120AM
16644
- * - 120
16727
+ * @param tree
16728
+ * @param array
16729
+ * @returns
16645
16730
  */
16731
+ function flattenTreeToArray(tree, array) {
16732
+ return flattenTreeToArrayFunction()(tree, array);
16733
+ }
16734
+ function flattenTreeToArrayFunction(mapNodeFn) {
16735
+ const mapNode = mapNodeFn != null ? mapNodeFn : x => x;
16736
+ const flattenFn = (tree, array = []) => {
16737
+ array.push(mapNode(tree));
16738
+ if (tree.children) {
16739
+ tree.children.forEach(x => flattenFn(x, array));
16740
+ }
16741
+ return array;
16742
+ };
16743
+ return flattenFn;
16744
+ }
16646
16745
 
16647
- let TimeAM = /*#__PURE__*/function (TimeAM) {
16648
- TimeAM["AM"] = "AM";
16649
- TimeAM["PM"] = "PM";
16650
- return TimeAM;
16651
- }({});
16652
- const DATE_NOW_VALUE = 'now';
16746
+ /**
16747
+ * Convenience function for flattening multiple trees with a flatten function.
16748
+ *
16749
+ * @param trees
16750
+ * @param flattenFn
16751
+ * @returns
16752
+ */
16753
+ function flattenTrees(trees, flattenFn) {
16754
+ const array = [];
16755
+ trees.forEach(x => flattenFn(x, array));
16756
+ return array;
16757
+ }
16758
+
16759
+ /*eslint @typescript-eslint/no-explicit-any:"off"*/
16653
16760
 
16654
16761
  /**
16655
- * A date that is characterized by either a known string value, or a Date.
16762
+ * 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
16763
  */
16657
16764
 
16658
16765
  /**
16659
- * Returns a Date value from the input LogicalDate.
16766
+ * Creates an ExpandFlattenTree function.
16660
16767
  *
16661
- * @param logicalDate
16768
+ * @param expand
16769
+ * @param flatten
16770
+ * @returns
16662
16771
  */
16772
+ function expandFlattenTreeFunction(expand, flatten) {
16773
+ return values => {
16774
+ return flattenTrees(expandTrees(values, expand), flatten);
16775
+ };
16776
+ }
16663
16777
 
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
- }
16778
+ // MARK: Reduce
16779
+ function reduceBooleansWithAnd(array, emptyArrayValue) {
16780
+ return reduceBooleansWithAndFn(emptyArrayValue)(array);
16781
+ }
16782
+ function reduceBooleansWithOr(array, emptyArrayValue) {
16783
+ return reduceBooleansWithOrFn(emptyArrayValue)(array);
16784
+ }
16785
+ function reduceBooleansWithAndFn(emptyArrayValue) {
16786
+ return reduceBooleansFn((a, b) => a && b, emptyArrayValue);
16787
+ }
16788
+ function reduceBooleansWithOrFn(emptyArrayValue) {
16789
+ return reduceBooleansFn((a, b) => a || b, emptyArrayValue);
16790
+ }
16791
+ function reduceBooleansFn(reduceFn, emptyArrayValue) {
16792
+ const rFn = array => Boolean(array.reduce(reduceFn));
16793
+ if (emptyArrayValue != null) {
16794
+ return array => array.length ? rFn(array) : emptyArrayValue;
16674
16795
  } else {
16675
- result = logicalDate;
16796
+ return rFn;
16676
16797
  }
16677
- return result;
16678
16798
  }
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;
16799
+
16800
+ // MARK: Random
16801
+ /**
16802
+ * Factory that generates boolean values.
16803
+ */
16804
+
16805
+ /**
16806
+ * Number from 0.0 to 100.0 used for the chance to return true.
16807
+ */
16808
+
16809
+ /**
16810
+ * Creates a new BooleanFactory.
16811
+ *
16812
+ * @param config
16813
+ * @returns
16814
+ */
16815
+ function booleanFactory(config) {
16816
+ const {
16817
+ chance: inputChance
16818
+ } = config;
16819
+ const chance = inputChance / 100;
16820
+ return () => {
16821
+ const roll = Math.random();
16822
+ const result = roll <= chance;
16823
+ return result;
16824
+ };
16825
+ }
16826
+
16827
+ /**
16828
+ * Returns a random boolean.
16829
+ *
16830
+ * @param chance Number between 0 and 100
16831
+ * @returns
16832
+ */
16833
+ function randomBoolean(chance = 50) {
16834
+ return booleanFactory({
16835
+ chance
16836
+ })();
16689
16837
  }
16690
16838
 
16691
16839
  /**
@@ -16786,9 +16934,14 @@ function isFinalPage(page) {
16786
16934
  }
16787
16935
 
16788
16936
  // MARK: PageCalculator
16937
+ /**
16938
+ * @deprecated
16939
+ */
16789
16940
 
16790
16941
  /**
16791
- * Page calcuaktion context for calculating the amount to skip/etc.
16942
+ * Page calculation context for calculating the amount to skip/etc.
16943
+ *
16944
+ * @deprecated
16792
16945
  */
16793
16946
  class PageCalculator {
16794
16947
  constructor(config) {
@@ -16873,4 +17026,4 @@ async function iterateFilteredPages(inputPage, loadFn, iterFn) {
16873
17026
  return count;
16874
17027
  }
16875
17028
 
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 };
17029
+ 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, isPast, 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, mergeArrays, mergeArraysIntoArray, mergeFilterFunctions, 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, tryWithPromiseFactoriesFunction, 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 };