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