@dereekb/util 13.11.14 → 13.11.15
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/eslint/index.cjs.js +10008 -394
- package/eslint/index.esm.js +9982 -392
- package/eslint/package.json +4 -4
- package/eslint/src/lib/comments.d.ts +14 -3
- package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
- package/eslint/src/lib/index.d.ts +26 -3
- package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
- package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
- package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
- package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
- package/eslint/src/lib/plugin.d.ts +52 -1
- package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
- package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
- package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
- package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
- package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
- package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
- package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
- package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
- package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
- package/fetch/index.cjs.js +95 -80
- package/fetch/index.esm.js +95 -80
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +2 -2
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/fetch.file.d.ts +5 -5
- package/fetch/src/lib/fetch.limit.d.ts +2 -2
- package/fetch/src/lib/fetch.page.d.ts +1 -1
- package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
- package/fetch/src/lib/fetch.type.d.ts +3 -2
- package/fetch/src/lib/fetch.url.d.ts +13 -13
- package/fetch/src/lib/json.d.ts +12 -12
- package/fetch/src/lib/timeout.d.ts +2 -2
- package/fetch/src/lib/url.d.ts +11 -11
- package/index.cjs.js +2592 -2329
- package/index.esm.js +2590 -2327
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +20 -20
- package/src/lib/array/array.d.ts +73 -72
- package/src/lib/array/array.factory.d.ts +8 -5
- package/src/lib/array/array.filter.d.ts +23 -20
- package/src/lib/array/array.find.d.ts +9 -8
- package/src/lib/array/array.index.d.ts +15 -14
- package/src/lib/array/array.indexed.d.ts +22 -19
- package/src/lib/array/array.make.d.ts +3 -2
- package/src/lib/array/array.map.d.ts +5 -5
- package/src/lib/array/array.number.d.ts +27 -27
- package/src/lib/array/array.random.d.ts +11 -10
- package/src/lib/array/array.set.d.ts +14 -14
- package/src/lib/array/array.string.d.ts +31 -31
- package/src/lib/array/array.unique.d.ts +22 -20
- package/src/lib/array/array.value.d.ts +3 -2
- package/src/lib/assertion/assert.error.d.ts +8 -8
- package/src/lib/assertion/assertion.d.ts +5 -5
- package/src/lib/assertion/assertion.generic.d.ts +3 -3
- package/src/lib/assertion/assertion.number.d.ts +6 -6
- package/src/lib/auth/auth.role.claims.d.ts +12 -11
- package/src/lib/auth/auth.role.d.ts +3 -3
- package/src/lib/auth/pkce.d.ts +2 -2
- package/src/lib/boolean.d.ts +11 -11
- package/src/lib/cache/cache.memoize.d.ts +6 -6
- package/src/lib/contact/domain.d.ts +9 -9
- package/src/lib/contact/email.d.ts +11 -11
- package/src/lib/contact/phone.d.ts +12 -12
- package/src/lib/contact/random.d.ts +11 -9
- package/src/lib/date/date.d.ts +60 -59
- package/src/lib/date/date.time.d.ts +2 -2
- package/src/lib/date/date.unix.d.ts +8 -8
- package/src/lib/date/duration.d.ts +17 -17
- package/src/lib/date/expires.d.ts +29 -27
- package/src/lib/date/hour.d.ts +23 -23
- package/src/lib/date/minute.d.ts +6 -6
- package/src/lib/date/time.d.ts +10 -9
- package/src/lib/date/week.d.ts +32 -31
- package/src/lib/encryption/encryption.object.d.ts +3 -3
- package/src/lib/error/error.d.ts +13 -12
- package/src/lib/error/error.server.d.ts +4 -4
- package/src/lib/file/pdf.d.ts +4 -4
- package/src/lib/filter/filter.d.ts +3 -2
- package/src/lib/function/function.boolean.d.ts +4 -3
- package/src/lib/function/function.forward.d.ts +6 -4
- package/src/lib/getter/getter.d.ts +24 -19
- package/src/lib/getter/getter.map.d.ts +6 -5
- package/src/lib/getter/getter.util.d.ts +3 -2
- package/src/lib/grouping.d.ts +25 -24
- package/src/lib/hash.d.ts +11 -10
- package/src/lib/iterable/iterable.d.ts +39 -39
- package/src/lib/iterable/iterable.map.d.ts +3 -3
- package/src/lib/key.d.ts +16 -16
- package/src/lib/map/map.d.ts +12 -12
- package/src/lib/map/map.intersection.d.ts +3 -3
- package/src/lib/map/map.key.d.ts +16 -14
- package/src/lib/misc/host.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +4 -3
- package/src/lib/model/id.factory.d.ts +4 -3
- package/src/lib/model/model.conversion.d.ts +19 -14
- package/src/lib/model/model.conversion.field.d.ts +2 -2
- package/src/lib/model/model.copy.d.ts +5 -4
- package/src/lib/model/model.d.ts +48 -46
- package/src/lib/model/model.modify.d.ts +10 -8
- package/src/lib/nodejs/stream.d.ts +6 -5
- package/src/lib/number/bitwise.dencoder.d.ts +12 -12
- package/src/lib/number/bound.d.ts +16 -13
- package/src/lib/number/dollar.d.ts +6 -5
- package/src/lib/number/encoded.d.ts +7 -7
- package/src/lib/number/factory.d.ts +4 -3
- package/src/lib/number/number.d.ts +37 -37
- package/src/lib/number/random.d.ts +11 -10
- package/src/lib/number/round.d.ts +34 -30
- package/src/lib/number/sort.d.ts +3 -2
- package/src/lib/number/transform.d.ts +5 -4
- package/src/lib/object/object.array.d.ts +6 -6
- package/src/lib/object/object.array.delta.d.ts +3 -2
- package/src/lib/object/object.d.ts +12 -12
- package/src/lib/object/object.empty.d.ts +3 -3
- package/src/lib/object/object.equal.d.ts +11 -10
- package/src/lib/object/object.filter.pojo.d.ts +74 -74
- package/src/lib/object/object.filter.tuple.d.ts +26 -26
- package/src/lib/object/object.flatten.d.ts +4 -4
- package/src/lib/object/object.key.d.ts +6 -4
- package/src/lib/object/object.map.d.ts +15 -13
- package/src/lib/page/page.d.ts +5 -5
- package/src/lib/page/page.filter.d.ts +8 -8
- package/src/lib/path/path.d.ts +98 -88
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/is.d.ts +6 -6
- package/src/lib/promise/poll.d.ts +9 -9
- package/src/lib/promise/promise.d.ts +33 -30
- package/src/lib/promise/promise.factory.d.ts +4 -3
- package/src/lib/promise/promise.loop.d.ts +11 -11
- package/src/lib/promise/promise.task.d.ts +6 -5
- package/src/lib/promise/promise.type.d.ts +3 -3
- package/src/lib/promise/use.d.ts +3 -3
- package/src/lib/relation/relation.d.ts +15 -15
- package/src/lib/service/handler.config.d.ts +20 -16
- package/src/lib/service/handler.d.ts +3 -2
- package/src/lib/service/typed.service.d.ts +2 -2
- package/src/lib/set/set.d.ts +62 -59
- package/src/lib/set/set.delta.d.ts +5 -4
- package/src/lib/set/set.hashset.d.ts +5 -5
- package/src/lib/set/set.selection.d.ts +5 -4
- package/src/lib/sort.d.ts +11 -11
- package/src/lib/storage/storage.d.ts +2 -1
- package/src/lib/storage/storage.error.d.ts +4 -4
- package/src/lib/storage/storage.memory.d.ts +7 -7
- package/src/lib/storage/storage.object.d.ts +5 -5
- package/src/lib/string/case.d.ts +6 -6
- package/src/lib/string/char.d.ts +30 -29
- package/src/lib/string/dencoder.d.ts +25 -20
- package/src/lib/string/factory.d.ts +11 -8
- package/src/lib/string/html.d.ts +19 -19
- package/src/lib/string/mimetype.d.ts +9 -8
- package/src/lib/string/prefix.d.ts +8 -8
- package/src/lib/string/replace.d.ts +45 -39
- package/src/lib/string/search.d.ts +5 -4
- package/src/lib/string/sort.d.ts +13 -4
- package/src/lib/string/string.d.ts +44 -43
- package/src/lib/string/transform.d.ts +32 -23
- package/src/lib/string/tree.d.ts +5 -4
- package/src/lib/string/url.d.ts +5 -4
- package/src/lib/tree/tree.array.d.ts +5 -4
- package/src/lib/tree/tree.expand.d.ts +6 -6
- package/src/lib/tree/tree.explore.d.ts +13 -10
- package/src/lib/tree/tree.flatten.d.ts +10 -10
- package/src/lib/type.d.ts +42 -12
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +70 -66
- package/src/lib/value/build.d.ts +6 -6
- package/src/lib/value/comparator.d.ts +19 -17
- package/src/lib/value/cron.d.ts +2 -2
- package/src/lib/value/decision.d.ts +6 -5
- package/src/lib/value/equal.d.ts +11 -9
- package/src/lib/value/indexed.d.ts +101 -85
- package/src/lib/value/label.d.ts +2 -2
- package/src/lib/value/map.d.ts +20 -16
- package/src/lib/value/maybe.d.ts +36 -36
- package/src/lib/value/modifier.d.ts +24 -23
- package/src/lib/value/point.d.ts +85 -77
- package/src/lib/value/url.d.ts +2 -2
- package/src/lib/value/use.d.ts +36 -33
- package/src/lib/value/vector.d.ts +15 -14
- package/test/index.cjs.js +41 -36
- package/test/index.esm.js +41 -36
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +2 -2
- package/test/src/lib/shared/shared.d.ts +20 -20
- package/test/src/lib/shared/shared.fail.d.ts +21 -16
- package/test/src/lib/shared/shared.function.d.ts +4 -4
- package/test/src/lib/shared/shared.wrap.d.ts +10 -10
|
@@ -4,38 +4,38 @@ import { type DecisionFunction } from '../value/decision';
|
|
|
4
4
|
/**
|
|
5
5
|
* Concatenates multiple arrays and returns only unique values.
|
|
6
6
|
*
|
|
7
|
+
* @param arrays - Arrays to concatenate. Null/undefined arrays are ignored.
|
|
8
|
+
* @returns Array containing only unique values from all input arrays.
|
|
9
|
+
*
|
|
7
10
|
* @dbxUtil
|
|
8
11
|
* @dbxUtilCategory array
|
|
9
12
|
* @dbxUtilTags array, unique, concat, distinct, dedupe, deduplicate
|
|
10
13
|
* @dbxUtilRelated unique, flatten-array-unique, concat-arrays
|
|
11
|
-
*
|
|
12
|
-
* @param arrays - Arrays to concatenate. Null/undefined arrays are ignored.
|
|
13
|
-
* @returns Array containing only unique values from all input arrays.
|
|
14
14
|
*/
|
|
15
15
|
export declare function concatArraysUnique<T extends PrimativeKey = PrimativeKey>(...arrays: Maybe<T[]>[]): T[];
|
|
16
16
|
/**
|
|
17
17
|
* Flattens a 2D array and returns only unique values.
|
|
18
18
|
*
|
|
19
|
+
* @param array - Two-dimensional array to flatten and deduplicate.
|
|
20
|
+
* @returns Array containing only unique values from the flattened input.
|
|
21
|
+
*
|
|
19
22
|
* @dbxUtil
|
|
20
23
|
* @dbxUtilCategory array
|
|
21
24
|
* @dbxUtilTags array, flatten, unique, distinct, dedupe, nested
|
|
22
25
|
* @dbxUtilRelated unique, concat-arrays-unique, flatten-array
|
|
23
|
-
*
|
|
24
|
-
* @param array - Two-dimensional array to flatten and deduplicate.
|
|
25
|
-
* @returns Array containing only unique values from the flattened input.
|
|
26
26
|
*/
|
|
27
27
|
export declare function flattenArrayUnique<T extends PrimativeKey = PrimativeKey>(array: T[][]): T[];
|
|
28
28
|
/**
|
|
29
29
|
* Filters the input values and only returns unique values.
|
|
30
30
|
*
|
|
31
|
+
* @param values - Array of primitive-key values to deduplicate.
|
|
32
|
+
* @param excludeInput - Optional keys or values to exclude from the result.
|
|
33
|
+
* @returns Array containing only unique values with exclusions removed.
|
|
34
|
+
*
|
|
31
35
|
* @dbxUtil
|
|
32
36
|
* @dbxUtilCategory array
|
|
33
37
|
* @dbxUtilTags array, unique, distinct, dedupe, deduplicate, set
|
|
34
38
|
* @dbxUtilRelated filter-unique-values, filter-unique-function, concat-arrays-unique
|
|
35
|
-
*
|
|
36
|
-
* @param values - Array of primitive-key values to deduplicate.
|
|
37
|
-
* @param excludeInput - Optional keys or values to exclude from the result.
|
|
38
|
-
* @returns Array containing only unique values with exclusions removed.
|
|
39
39
|
*/
|
|
40
40
|
export declare function unique<T extends PrimativeKey = PrimativeKey>(values: T[], excludeInput?: FilterUniqueFunctionExcludeKeysInput<T, T>): T[];
|
|
41
41
|
/**
|
|
@@ -78,30 +78,31 @@ export declare function readKeysFromFilterUniqueFunctionAdditionalKeys<T, K exte
|
|
|
78
78
|
/**
|
|
79
79
|
* Creates a {@link FilterUniqueFunction} that deduplicates items by their computed key.
|
|
80
80
|
*
|
|
81
|
+
* @param readKey - Function to extract a unique key from each item.
|
|
82
|
+
* @param additionalKeysInput - Optional keys or values to pre-seed as already seen, causing them to be excluded.
|
|
83
|
+
* @returns A reusable filter function that removes duplicate items from arrays.
|
|
84
|
+
*
|
|
81
85
|
* @dbxUtil
|
|
82
86
|
* @dbxUtilCategory array
|
|
83
87
|
* @dbxUtilKind factory
|
|
84
88
|
* @dbxUtilTags array, unique, distinct, dedupe, factory, key, filter
|
|
85
89
|
* @dbxUtilRelated filter-unique-values, unique, allow-value-once-filter
|
|
86
90
|
*
|
|
87
|
-
* @param readKey - Function to extract a unique key from each item.
|
|
88
|
-
* @param additionalKeysInput - Optional keys or values to pre-seed as already seen, causing them to be excluded.
|
|
89
|
-
* @returns A reusable filter function that removes duplicate items from arrays.
|
|
90
91
|
* @__NO_SIDE_EFFECTS__
|
|
91
92
|
*/
|
|
92
93
|
export declare function filterUniqueFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K>, additionalKeysInput?: FilterUniqueFunctionAdditionalKeysInput<T, K>): FilterUniqueFunction<T, K>;
|
|
93
94
|
/**
|
|
94
95
|
* Filters an array to contain only items with unique keys.
|
|
95
96
|
*
|
|
96
|
-
* @dbxUtil
|
|
97
|
-
* @dbxUtilCategory array
|
|
98
|
-
* @dbxUtilTags array, unique, filter, dedupe, key, distinct
|
|
99
|
-
* @dbxUtilRelated filter-unique-function, unique, is-unique-keyed-function
|
|
100
|
-
*
|
|
101
97
|
* @param values - Array of items to deduplicate.
|
|
102
98
|
* @param readKey - Function to extract a unique key from each item.
|
|
103
99
|
* @param additionalKeys - Optional keys to pre-seed as already seen, excluding matching items.
|
|
104
100
|
* @returns Array containing only the first occurrence of each uniquely-keyed item.
|
|
101
|
+
*
|
|
102
|
+
* @dbxUtil
|
|
103
|
+
* @dbxUtilCategory array
|
|
104
|
+
* @dbxUtilTags array, unique, filter, dedupe, key, distinct
|
|
105
|
+
* @dbxUtilRelated filter-unique-function, unique, is-unique-keyed-function
|
|
105
106
|
*/
|
|
106
107
|
export declare function filterUniqueValues<T, K extends PrimativeKey = PrimativeKey>(values: T[], readKey: ReadKeyFunction<T, K>, additionalKeys?: K[]): T[];
|
|
107
108
|
/**
|
|
@@ -111,14 +112,15 @@ export type IsUniqueKeyedFunction<T> = DecisionFunction<T[]>;
|
|
|
111
112
|
/**
|
|
112
113
|
* Creates an {@link IsUniqueKeyedFunction} that checks whether all items in an array have unique keys.
|
|
113
114
|
*
|
|
115
|
+
* @param readKey - Function to extract a unique key from each item.
|
|
116
|
+
* @returns A decision function that returns true if all items have distinct keys.
|
|
117
|
+
*
|
|
114
118
|
* @dbxUtil
|
|
115
119
|
* @dbxUtilCategory array
|
|
116
120
|
* @dbxUtilKind factory
|
|
117
121
|
* @dbxUtilTags array, unique, validation, distinct, key, decision, factory
|
|
118
122
|
* @dbxUtilRelated filter-unique-function, unique
|
|
119
123
|
*
|
|
120
|
-
* @param readKey - Function to extract a unique key from each item.
|
|
121
|
-
* @returns A decision function that returns true if all items have distinct keys.
|
|
122
124
|
* @__NO_SIDE_EFFECTS__
|
|
123
125
|
*/
|
|
124
126
|
export declare function isUniqueKeyedFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K>): IsUniqueKeyedFunction<T>;
|
|
@@ -10,14 +10,15 @@ export type UniversalFilterMaybeArrayFunction = <T>(values: Maybe<Maybe<T>[]>) =
|
|
|
10
10
|
/**
|
|
11
11
|
* Creates a {@link FilterMaybeArrayFunction} that filters maybe values from an array using the provided filter function.
|
|
12
12
|
*
|
|
13
|
+
* @param filterFn - Filter predicate used to determine which values to keep.
|
|
14
|
+
* @returns Reusable filter operator that drops nullish entries and applies the predicate to the rest.
|
|
15
|
+
*
|
|
13
16
|
* @dbxUtil
|
|
14
17
|
* @dbxUtilCategory array
|
|
15
18
|
* @dbxUtilKind factory
|
|
16
19
|
* @dbxUtilTags array, filter, maybe, factory, predicate
|
|
17
20
|
* @dbxUtilRelated filter-maybe-array-values
|
|
18
21
|
*
|
|
19
|
-
* @param filterFn - Filter predicate used to determine which values to keep.
|
|
20
|
-
* @returns A function that filters maybe values from an optional input array.
|
|
21
22
|
* @__NO_SIDE_EFFECTS__
|
|
22
23
|
*/
|
|
23
24
|
export declare function filterMaybeArrayFunction<T>(filterFn: Parameters<Array<Maybe<T>>['filter']>[0]): FilterMaybeArrayFunction<T>;
|
|
@@ -37,13 +37,13 @@ export declare class AssertionError extends BaseError implements ReadableError {
|
|
|
37
37
|
/**
|
|
38
38
|
* Gets the target object that failed the assertion.
|
|
39
39
|
*
|
|
40
|
-
* @returns The target object
|
|
40
|
+
* @returns The target object.
|
|
41
41
|
*/
|
|
42
42
|
get target(): object;
|
|
43
43
|
/**
|
|
44
44
|
* Gets the property key that failed the assertion.
|
|
45
45
|
*
|
|
46
|
-
* @returns The property key as a string
|
|
46
|
+
* @returns The property key as a string.
|
|
47
47
|
*/
|
|
48
48
|
get propertyKey(): string;
|
|
49
49
|
}
|
|
@@ -54,23 +54,23 @@ export declare class AssertionIssueHandler {
|
|
|
54
54
|
/**
|
|
55
55
|
* Handles an assertion issue by throwing an appropriate exception.
|
|
56
56
|
*
|
|
57
|
-
* @param error - The assertion issue to handle
|
|
58
|
-
* @throws AssertionError
|
|
57
|
+
* @param error - The assertion issue to handle.
|
|
58
|
+
* @throws {AssertionError} Always — wraps the issue and rethrows it.
|
|
59
59
|
*/
|
|
60
60
|
handle(error: AssertionIssue): void;
|
|
61
61
|
/**
|
|
62
62
|
* Builds an AssertionError from an AssertionIssue.
|
|
63
63
|
*
|
|
64
|
-
* @param error - The assertion issue to build an exception from
|
|
65
|
-
* @returns A new AssertionError instance
|
|
64
|
+
* @param error - The assertion issue to build an exception from.
|
|
65
|
+
* @returns A new AssertionError instance.
|
|
66
66
|
*/
|
|
67
67
|
buildException(error: AssertionIssue): AssertionError;
|
|
68
68
|
/**
|
|
69
69
|
* Builds an error message string from an AssertionIssue.
|
|
70
70
|
* Uses the custom message if provided, otherwise creates a default message.
|
|
71
71
|
*
|
|
72
|
-
* @param error - The assertion issue to build a message for
|
|
73
|
-
* @returns The error message string
|
|
72
|
+
* @param error - The assertion issue to build a message for.
|
|
73
|
+
* @returns The error message string.
|
|
74
74
|
*/
|
|
75
75
|
protected buildExceptionString(error: AssertionIssue): string;
|
|
76
76
|
}
|
|
@@ -29,18 +29,18 @@ export declare class PropertyDescriptorUtility {
|
|
|
29
29
|
* Creates a property descriptor interceptor that validates values using an assertion function
|
|
30
30
|
* before allowing them to be set. Optionally maps the value after validation.
|
|
31
31
|
*
|
|
32
|
-
* @param assertValueFn - Function that returns true if the value is valid
|
|
32
|
+
* @param assertValueFn - Function that returns true if the value is valid.
|
|
33
33
|
* @param options - Custom assertion options (message, map function)
|
|
34
|
-
* @param defaultOptions - Default options merged under the custom options
|
|
35
|
-
* @returns A property descriptor interceptor function
|
|
34
|
+
* @param defaultOptions - Default options merged under the custom options.
|
|
35
|
+
* @returns A property descriptor interceptor function.
|
|
36
36
|
*/
|
|
37
37
|
static makePropertyDescriptorAssertion<T>(assertValueFn: AccessorValueAssertion<T>, options?: MapDescriptorAssertionOptions<T>, defaultOptions?: MapDescriptorAssertionOptions<T>): (target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a low-level property descriptor interceptor that replaces the setter
|
|
40
40
|
* of a property with a custom function produced by the given factory.
|
|
41
41
|
*
|
|
42
|
-
* @param makeSetValueInterceptorFn - Factory that produces the replacement setter function
|
|
43
|
-
* @returns A property descriptor interceptor function
|
|
42
|
+
* @param makeSetValueInterceptorFn - Factory that produces the replacement setter function.
|
|
43
|
+
* @returns A property descriptor interceptor function.
|
|
44
44
|
*/
|
|
45
45
|
static makeSetPropertyDescriptorInterceptor<T>(makeSetValueInterceptorFn: SetValueInterceptorFunctionFactory<T>): (target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
46
46
|
}
|
|
@@ -4,8 +4,8 @@ import { type AccessorValueAssertion } from './assertion';
|
|
|
4
4
|
* Creates a property decorator that validates values using a custom assertion function
|
|
5
5
|
* before allowing them to be set on the property.
|
|
6
6
|
*
|
|
7
|
-
* @param assertion - Function that returns true if the value is valid
|
|
8
|
-
* @param options - Optional assertion options including custom error message and value mapping
|
|
9
|
-
* @returns A property descriptor interceptor that enforces the assertion on the setter
|
|
7
|
+
* @param assertion - Function that returns true if the value is valid.
|
|
8
|
+
* @param options - Optional assertion options including custom error message and value mapping.
|
|
9
|
+
* @returns A property descriptor interceptor that enforces the assertion on the setter.
|
|
10
10
|
*/
|
|
11
11
|
export declare function Assert<T>(assertion: AccessorValueAssertion<T>, options?: MapDescriptorAssertionOptions<T>): (target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => void;
|
|
@@ -3,17 +3,17 @@ import { type DescriptorAssertionOptions } from './assert';
|
|
|
3
3
|
* Creates a property decorator that asserts the numeric value is greater than or equal to a minimum.
|
|
4
4
|
*
|
|
5
5
|
* @param min - The minimum allowed value (inclusive)
|
|
6
|
-
* @param options - Optional assertion options including custom error message
|
|
7
|
-
* @returns A property descriptor interceptor that enforces the minimum value constraint
|
|
8
|
-
* @throws {@link AssertionError}
|
|
6
|
+
* @param options - Optional assertion options including custom error message.
|
|
7
|
+
* @returns A property descriptor interceptor that enforces the minimum value constraint.
|
|
8
|
+
* @throws {@link AssertionError} When the assigned value is less than `min`
|
|
9
9
|
*/
|
|
10
10
|
export declare function AssertMin(min: number, options?: DescriptorAssertionOptions): (target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<number>) => void;
|
|
11
11
|
/**
|
|
12
12
|
* Creates a property decorator that asserts the numeric value is less than or equal to a maximum.
|
|
13
13
|
*
|
|
14
14
|
* @param max - The maximum allowed value (inclusive)
|
|
15
|
-
* @param options - Optional assertion options including custom error message
|
|
16
|
-
* @returns A property descriptor interceptor that enforces the maximum value constraint
|
|
17
|
-
* @throws {@link AssertionError}
|
|
15
|
+
* @param options - Optional assertion options including custom error message.
|
|
16
|
+
* @returns A property descriptor interceptor that enforces the maximum value constraint.
|
|
17
|
+
* @throws {@link AssertionError} When the assigned value is greater than `max`
|
|
18
18
|
*/
|
|
19
19
|
export declare function AssertMax(max: number, options?: DescriptorAssertionOptions): (target: object, propertyKey: string, descriptor: TypedPropertyDescriptor<number>) => void;
|
|
@@ -84,11 +84,11 @@ export interface AuthRoleClaimsFactoryConfigEntryEncodeOptions<V extends AuthCla
|
|
|
84
84
|
*
|
|
85
85
|
* If not defined, will defer to role for finding matches and pull from value.
|
|
86
86
|
*/
|
|
87
|
-
encodeValueFromRoles: (roles: AuthRoleSet) => V
|
|
87
|
+
encodeValueFromRoles: (roles: AuthRoleSet) => Maybe<V>;
|
|
88
88
|
/**
|
|
89
89
|
* (Optional) Auth roles associated with this claims. If not defined, the claims key is used.
|
|
90
90
|
*/
|
|
91
|
-
decodeRolesFromValue: (value: Maybe<V>) => AuthRole[]
|
|
91
|
+
decodeRolesFromValue: (value: Maybe<V>) => Maybe<AuthRole[]>;
|
|
92
92
|
}
|
|
93
93
|
export type IgnoreAuthRoleClaimsEntry = null;
|
|
94
94
|
export type AuthRoleClaimsFactoryConfig<T extends AuthClaimsObject = AuthClaimsObject> = {
|
|
@@ -98,13 +98,13 @@ export interface AuthRoleClaimsFactoryDefaults {
|
|
|
98
98
|
/**
|
|
99
99
|
* Default value to use for claims that have no value present.
|
|
100
100
|
*
|
|
101
|
-
* If undefined, defaults to
|
|
101
|
+
* If undefined, defaults to DEFAULT_AUTH_ROLE_CLAIMS_CLAIM_VALUE.
|
|
102
102
|
*/
|
|
103
103
|
claimValue?: AuthClaimValue;
|
|
104
104
|
/**
|
|
105
105
|
* Default value for claims that are not defined.
|
|
106
106
|
*
|
|
107
|
-
* If undefined, defaults to
|
|
107
|
+
* If undefined, defaults to DEFAULT_AUTH_ROLE_CLAIMS_EMPTY_VALUE.
|
|
108
108
|
*/
|
|
109
109
|
emptyValue?: AuthClaimValue | ClearAuthClaimValue;
|
|
110
110
|
}
|
|
@@ -142,23 +142,24 @@ export interface AuthRoleClaimsService<T extends AuthClaimsObject> {
|
|
|
142
142
|
readonly defaultClaimValue: unknown;
|
|
143
143
|
readonly defaultEmptyValue: unknown;
|
|
144
144
|
}
|
|
145
|
-
export declare const
|
|
146
|
-
export declare const
|
|
145
|
+
export declare const DEFAULT_AUTH_ROLE_CLAIMS_CLAIM_VALUE = 1;
|
|
146
|
+
export declare const DEFAULT_AUTH_ROLE_CLAIMS_EMPTY_VALUE: null;
|
|
147
147
|
/**
|
|
148
148
|
* Creates an {@link AuthRoleClaimsService} that converts between {@link AuthRoleSet} and JWT-style claims objects.
|
|
149
149
|
*
|
|
150
150
|
* Each key in the config maps a claim key to role(s). Simple entries map a claim value to one or more roles,
|
|
151
151
|
* while encode/decode entries allow custom bidirectional conversion logic.
|
|
152
152
|
*
|
|
153
|
+
* @param config - Mapping of claim keys to their role configuration entries (or null to ignore)
|
|
154
|
+
* @param defaults - Optional default values for claim presence and absence.
|
|
155
|
+
* @returns A service with `toClaims` and `toRoles` conversion functions.
|
|
156
|
+
*
|
|
153
157
|
* @dbxUtil
|
|
154
158
|
* @dbxUtilCategory auth
|
|
155
159
|
* @dbxUtilKind factory
|
|
156
160
|
* @dbxUtilTags auth, role, claims, jwt, factory, bidirectional
|
|
157
161
|
* @dbxUtilRelated auth-role
|
|
158
162
|
*
|
|
159
|
-
* @param config - Mapping of claim keys to their role configuration entries (or null to ignore)
|
|
160
|
-
* @param defaults - Optional default values for claim presence and absence
|
|
161
|
-
* @returns A service with `toClaims` and `toRoles` conversion functions
|
|
162
163
|
* @__NO_SIDE_EFFECTS__
|
|
163
164
|
*/
|
|
164
165
|
export declare function authRoleClaimsService<T extends AuthClaimsObject>(config: AuthRoleClaimsFactoryConfig<T>, defaults?: AuthRoleClaimsFactoryDefaults): AuthRoleClaimsService<T>;
|
|
@@ -168,7 +169,7 @@ export declare function authRoleClaimsService<T extends AuthClaimsObject>(config
|
|
|
168
169
|
* Useful for cleaning up a claims update before persisting or comparing, since update objects
|
|
169
170
|
* use `null` to indicate claim removal.
|
|
170
171
|
*
|
|
171
|
-
* @param authClaimsUpdate - The claims update object potentially containing null values
|
|
172
|
-
* @returns A clean claims object with all null entries removed
|
|
172
|
+
* @param authClaimsUpdate - The claims update object potentially containing null values.
|
|
173
|
+
* @returns A clean claims object with all null entries removed.
|
|
173
174
|
*/
|
|
174
175
|
export declare function authClaims<T extends AuthClaimsObject = AuthClaimsObject>(authClaimsUpdate: AuthClaimsUpdate<T>): AuthClaims<T>;
|
|
@@ -35,8 +35,8 @@ export declare const AUTH_USER_ROLE = "user";
|
|
|
35
35
|
/**
|
|
36
36
|
* Checks if an AuthRoleSet contains all of the specified roles.
|
|
37
37
|
*
|
|
38
|
-
* @param authRolesSet -
|
|
39
|
-
* @param roles -
|
|
40
|
-
* @returns True
|
|
38
|
+
* @param authRolesSet - Granted roles that must satisfy the required-roles check.
|
|
39
|
+
* @param roles - Roles that must all be present; nullish or empty is treated as vacuously true.
|
|
40
|
+
* @returns True when every required role appears in the granted set; otherwise false.
|
|
41
41
|
*/
|
|
42
42
|
export declare function authRolesSetHasRoles(authRolesSet: AuthRoleSet, roles: Maybe<Iterable<AuthRole>>): boolean;
|
package/src/lib/auth/pkce.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function generatePkceCodeVerifier(): string;
|
|
|
7
7
|
/**
|
|
8
8
|
* Generates a PKCE code challenge from a code verifier using SHA-256.
|
|
9
9
|
*
|
|
10
|
-
* @param verifier - The code verifier string to hash
|
|
11
|
-
* @returns A base64url-encoded SHA-256 hash of the verifier
|
|
10
|
+
* @param verifier - The code verifier string to hash.
|
|
11
|
+
* @returns A base64url-encoded SHA-256 hash of the verifier.
|
|
12
12
|
*/
|
|
13
13
|
export declare function generatePkceCodeChallenge(verifier: string): Promise<string>;
|
package/src/lib/boolean.d.ts
CHANGED
|
@@ -56,22 +56,22 @@ export declare function reduceBooleansWithAnd(array: boolean[], emptyArrayValue?
|
|
|
56
56
|
/**
|
|
57
57
|
* Reduces an array of booleans with the logical OR operation.
|
|
58
58
|
*
|
|
59
|
-
* @dbxUtil
|
|
60
|
-
* @dbxUtilCategory boolean
|
|
61
|
-
* @dbxUtilTags boolean, reduce, or, some, any, disjunction, aggregate
|
|
62
|
-
* @dbxUtilRelated reduce-booleans-with-and, reduce-booleans-with-or-fn
|
|
63
|
-
*
|
|
64
59
|
* @param array - Array of boolean values to reduce.
|
|
65
60
|
* @param emptyArrayValue - Value to return if the array is empty. If not provided and the array is empty, a TypeError will be thrown.
|
|
66
61
|
* @returns The result of ORing all boolean values in the array.
|
|
67
62
|
* @throws {TypeError} If the array is empty and no emptyArrayValue is provided.
|
|
63
|
+
*
|
|
64
|
+
* @dbxUtil
|
|
65
|
+
* @dbxUtilCategory boolean
|
|
66
|
+
* @dbxUtilTags boolean, reduce, or, some, any, disjunction, aggregate
|
|
67
|
+
* @dbxUtilRelated reduce-booleans-with-and, reduce-booleans-with-or-fn
|
|
68
68
|
*/
|
|
69
69
|
export declare function reduceBooleansWithOr(array: boolean[], emptyArrayValue?: boolean): boolean;
|
|
70
70
|
/**
|
|
71
71
|
* Creates a function that reduces an array of booleans with the logical AND operation.
|
|
72
72
|
*
|
|
73
73
|
* @param emptyArrayValue - Value to return if the array is empty. If not provided and the array is empty, the returned function will throw a TypeError.
|
|
74
|
-
* @returns
|
|
74
|
+
* @returns Reducer that yields true only when every entry is truthy (or the fallback for empty input).
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* ```ts
|
|
@@ -86,7 +86,7 @@ export declare function reduceBooleansWithAndFn(emptyArrayValue?: boolean): (arr
|
|
|
86
86
|
* Creates a function that reduces an array of booleans with the logical OR operation.
|
|
87
87
|
*
|
|
88
88
|
* @param emptyArrayValue - Value to return if the array is empty. If not provided and the array is empty, the returned function will throw a TypeError.
|
|
89
|
-
* @returns
|
|
89
|
+
* @returns Reducer that yields true when any entry is truthy (or the fallback for empty input).
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* ```ts
|
|
@@ -102,7 +102,7 @@ export declare function reduceBooleansWithOrFn(emptyArrayValue?: boolean): (arra
|
|
|
102
102
|
*
|
|
103
103
|
* @param reduceFn - Function that takes two boolean values and returns a single boolean.
|
|
104
104
|
* @param emptyArrayValue - Value to return if the array is empty. If not provided and the array is empty, the returned function will throw a TypeError because `Array.prototype.reduce` on an empty array without an initial value throws.
|
|
105
|
-
* @returns
|
|
105
|
+
* @returns Reducer that folds the array with `reduceFn`, falling back to `emptyArrayValue` when empty.
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* ```ts
|
|
@@ -160,13 +160,13 @@ export declare function booleanFactory(config: BooleanFactoryConfig): BooleanFac
|
|
|
160
160
|
/**
|
|
161
161
|
* Returns a random boolean based on the specified chance.
|
|
162
162
|
*
|
|
163
|
+
* @param chance - Number between 0.0 and 100.0 representing the percentage chance of returning true (default: 50, i.e., 50%).
|
|
164
|
+
* @returns A random boolean value with the specified probability of being true.
|
|
165
|
+
*
|
|
163
166
|
* @dbxUtil
|
|
164
167
|
* @dbxUtilCategory boolean
|
|
165
168
|
* @dbxUtilTags boolean, random, chance, probability, coin-flip
|
|
166
169
|
* @dbxUtilRelated boolean-factory
|
|
167
|
-
*
|
|
168
|
-
* @param chance - Number between 0.0 and 100.0 representing the percentage chance of returning true (default: 50, i.e., 50%).
|
|
169
|
-
* @returns A random boolean value with the specified probability of being true.
|
|
170
170
|
*/
|
|
171
171
|
export declare function randomBoolean(chance?: BooleanTrueChance): boolean;
|
|
172
172
|
/**
|
|
@@ -10,14 +10,14 @@ import { type AsyncKeyedValueCache, type AsyncValueCache } from './cache';
|
|
|
10
10
|
* Note: the memoized value is per-process. Long-running processes will not observe writes
|
|
11
11
|
* made by other processes to the inner backing once the memo is populated.
|
|
12
12
|
*
|
|
13
|
+
* @param inner - The backing cache to memoize. Reads are delegated once and cached; writes are forwarded through and refresh the memo.
|
|
14
|
+
* @returns An {@link AsyncValueCache} that proxies the inner cache with a single-load memoization layer.
|
|
15
|
+
*
|
|
13
16
|
* @dbxUtil
|
|
14
17
|
* @dbxUtilCategory cache
|
|
15
18
|
* @dbxUtilTags memoize, memo, cache, async, single-load, async-value
|
|
16
19
|
* @dbxUtilRelated memoize-async-keyed-value-cache
|
|
17
20
|
*
|
|
18
|
-
* @param inner - The backing cache to memoize. Reads are delegated once and cached; writes are forwarded through and refresh the memo.
|
|
19
|
-
* @returns An {@link AsyncValueCache} that proxies the inner cache with a single-load memoization layer.
|
|
20
|
-
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
23
|
* const memo = memoizeAsyncValueCache(inMemoryAsyncValueCache<string>('initial'));
|
|
@@ -40,14 +40,14 @@ export declare function memoizeAsyncValueCache<T>(inner: AsyncValueCache<T>): As
|
|
|
40
40
|
* Note: the memoized record is per-process. Long-running processes will not observe writes
|
|
41
41
|
* made by other processes to the inner backing once the memo is populated.
|
|
42
42
|
*
|
|
43
|
+
* @param inner - The backing keyed cache to memoize. The full record is loaded once and cached; writes are forwarded through and applied to the memo.
|
|
44
|
+
* @returns An {@link AsyncKeyedValueCache} that proxies the inner cache with a record-level memoization layer.
|
|
45
|
+
*
|
|
43
46
|
* @dbxUtil
|
|
44
47
|
* @dbxUtilCategory cache
|
|
45
48
|
* @dbxUtilTags memoize, memo, cache, async, keyed, record
|
|
46
49
|
* @dbxUtilRelated memoize-async-value-cache
|
|
47
50
|
*
|
|
48
|
-
* @param inner - The backing keyed cache to memoize. The full record is loaded once and cached; writes are forwarded through and applied to the memo.
|
|
49
|
-
* @returns An {@link AsyncKeyedValueCache} that proxies the inner cache with a record-level memoization layer.
|
|
50
|
-
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```ts
|
|
53
53
|
* const memo = memoizeAsyncKeyedValueCache(inMemoryAsyncKeyedValueCache<number>({ a: 1 }));
|
|
@@ -11,25 +11,25 @@ export type EmailAddressDomain = string;
|
|
|
11
11
|
/**
|
|
12
12
|
* Extracts unique domain names from a list of email addresses (case-insensitive).
|
|
13
13
|
*
|
|
14
|
+
* @param addresses - Array of email addresses to extract domains from.
|
|
15
|
+
* @returns Array of unique lowercase domain strings.
|
|
16
|
+
*
|
|
14
17
|
* @dbxUtil
|
|
15
18
|
* @dbxUtilCategory contact
|
|
16
19
|
* @dbxUtilTags email, domain, extract, unique, dedupe, case-insensitive
|
|
17
20
|
* @dbxUtilRelated read-domain-from-email-address, read-email-domain-from-url-or-email-address
|
|
18
|
-
*
|
|
19
|
-
* @param addresses - Array of email addresses to extract domains from
|
|
20
|
-
* @returns Array of unique lowercase domain strings
|
|
21
21
|
*/
|
|
22
22
|
export declare function readDomainsFromEmailAddresses(addresses: EmailAddress[]): EmailAddressDomain[];
|
|
23
23
|
/**
|
|
24
24
|
* Extracts the domain portion from a single email address.
|
|
25
25
|
*
|
|
26
|
+
* @param address - The email address to extract the domain from.
|
|
27
|
+
* @returns The lowercase domain string.
|
|
28
|
+
*
|
|
26
29
|
* @dbxUtil
|
|
27
30
|
* @dbxUtilCategory contact
|
|
28
31
|
* @dbxUtilTags email, domain, extract, parse, lowercase
|
|
29
32
|
* @dbxUtilRelated read-domains-from-email-addresses, read-email-domain-from-url-or-email-address
|
|
30
|
-
*
|
|
31
|
-
* @param address - The email address to extract the domain from
|
|
32
|
-
* @returns The lowercase domain string
|
|
33
33
|
*/
|
|
34
34
|
export declare function readDomainFromEmailAddress(address: EmailAddress): EmailAddressDomain;
|
|
35
35
|
/**
|
|
@@ -43,12 +43,12 @@ export declare function readDomainFromEmailAddress(address: EmailAddress): Email
|
|
|
43
43
|
*
|
|
44
44
|
* The "www." prefix is stripped from URL-style inputs since emails typically don't use it.
|
|
45
45
|
*
|
|
46
|
+
* @param urlLikeInput - A URL, email address, or domain string.
|
|
47
|
+
* @returns The extracted domain.
|
|
48
|
+
*
|
|
46
49
|
* @dbxUtil
|
|
47
50
|
* @dbxUtilCategory contact
|
|
48
51
|
* @dbxUtilTags email, domain, url, extract, normalize, parse, www
|
|
49
52
|
* @dbxUtilRelated read-domain-from-email-address, read-domains-from-email-addresses
|
|
50
|
-
*
|
|
51
|
-
* @param urlLikeInput - A URL, email address, or domain string
|
|
52
|
-
* @returns The extracted domain
|
|
53
53
|
*/
|
|
54
54
|
export declare function readEmailDomainFromUrlOrEmailAddress(urlLikeInput: string | EmailAddress | EmailAddressDomain): EmailAddressDomain;
|
|
@@ -32,41 +32,41 @@ export type EmailParticipantString = string;
|
|
|
32
32
|
* Converts an EmailParticipant object to a formatted string representation.
|
|
33
33
|
* The format is: "name<email>" or "<email>" if no name is provided.
|
|
34
34
|
*
|
|
35
|
+
* @param participant - The email participant to convert.
|
|
36
|
+
* @returns A formatted string representation of the participant.
|
|
37
|
+
*
|
|
35
38
|
* @dbxUtil
|
|
36
39
|
* @dbxUtilCategory contact
|
|
37
40
|
* @dbxUtilTags email, participant, convert, format, serialize, name
|
|
38
41
|
* @dbxUtilRelated convert-email-participant-string-to-participant, coerce-to-email-participants
|
|
39
|
-
*
|
|
40
|
-
* @param participant - The email participant to convert
|
|
41
|
-
* @returns A formatted string representation of the participant
|
|
42
42
|
*/
|
|
43
43
|
export declare function convertParticipantToEmailParticipantString(participant: EmailParticipant): EmailParticipantString;
|
|
44
44
|
/**
|
|
45
45
|
* Converts a formatted participant string into an EmailParticipant object.
|
|
46
46
|
* Parses strings in the format "name<email>" or "<email>".
|
|
47
47
|
*
|
|
48
|
+
* @param participantString - Serialized participant in `name<email>` or `<email>` form.
|
|
49
|
+
* @returns Parsed participant pairing the optional display name with the extracted address.
|
|
50
|
+
*
|
|
48
51
|
* @dbxUtil
|
|
49
52
|
* @dbxUtilCategory contact
|
|
50
53
|
* @dbxUtilTags email, participant, parse, deserialize, name, address
|
|
51
54
|
* @dbxUtilRelated convert-participant-to-email-participant-string, coerce-to-email-participants
|
|
52
|
-
*
|
|
53
|
-
* @param participantString - The string to parse
|
|
54
|
-
* @returns An EmailParticipant object with the extracted name and email
|
|
55
55
|
*/
|
|
56
56
|
export declare function convertEmailParticipantStringToParticipant(participantString: EmailParticipantString): EmailParticipant;
|
|
57
57
|
/**
|
|
58
58
|
* Combines an array of EmailParticipants with an array of email addresses.
|
|
59
59
|
* Email addresses that don't already exist in the participants array are converted to EmailParticipant objects.
|
|
60
60
|
*
|
|
61
|
+
* @param options - Object containing participants and/or emails arrays.
|
|
62
|
+
* @param options.participants - Array of existing EmailParticipant objects.
|
|
63
|
+
* @param options.emails - Array of email addresses to include.
|
|
64
|
+
* @returns A combined array of EmailParticipant objects.
|
|
65
|
+
*
|
|
61
66
|
* @dbxUtil
|
|
62
67
|
* @dbxUtilCategory contact
|
|
63
68
|
* @dbxUtilTags email, participant, merge, combine, dedupe, coerce, normalize
|
|
64
69
|
* @dbxUtilRelated convert-participant-to-email-participant-string, convert-email-participant-string-to-participant
|
|
65
|
-
*
|
|
66
|
-
* @param options - Object containing participants and/or emails arrays
|
|
67
|
-
* @param options.participants - Array of existing EmailParticipant objects
|
|
68
|
-
* @param options.emails - Array of email addresses to include
|
|
69
|
-
* @returns A combined array of EmailParticipant objects
|
|
70
70
|
*/
|
|
71
71
|
export declare function coerceToEmailParticipants({ participants, emails }: {
|
|
72
72
|
participants?: EmailParticipant[];
|
|
@@ -43,9 +43,9 @@ export declare const E164PHONE_NUMBER_REGEX: RegExp;
|
|
|
43
43
|
/**
|
|
44
44
|
* Validates if the input string is a valid E.164 phone number.
|
|
45
45
|
*
|
|
46
|
-
* @param input - The phone number string to validate
|
|
47
|
-
* @param allowExtension - If true, allows an extension in the format +number#extension
|
|
48
|
-
* @returns True if the input is a valid E.164 phone number
|
|
46
|
+
* @param input - The phone number string to validate.
|
|
47
|
+
* @param allowExtension - If true, allows an extension in the format +number#extension.
|
|
48
|
+
* @returns True if the input is a valid E.164 phone number.
|
|
49
49
|
*/
|
|
50
50
|
export declare function isE164PhoneNumber(input: string, allowExtension?: boolean): input is E164PhoneNumber;
|
|
51
51
|
/**
|
|
@@ -78,8 +78,8 @@ export declare const E164PHONE_NUMBER_WITH_EXTENSION_REGEX: RegExp;
|
|
|
78
78
|
* Validates if the input string is a valid E.164 phone number with an extension.
|
|
79
79
|
* The phone number must be in the format +number#extension.
|
|
80
80
|
*
|
|
81
|
-
* @param input - The phone number string to validate
|
|
82
|
-
* @returns True if the input is a valid E.164 phone number with extension
|
|
81
|
+
* @param input - The phone number string to validate.
|
|
82
|
+
* @returns True if the input is a valid E.164 phone number with extension.
|
|
83
83
|
*/
|
|
84
84
|
export declare function isE164PhoneNumberWithExtension(input: string): input is E164PhoneNumberWithExtension;
|
|
85
85
|
/**
|
|
@@ -91,8 +91,8 @@ export declare const PHONE_EXTENSION_NUMBER_REGEX: RegExp;
|
|
|
91
91
|
* Validates if the input string is a valid phone extension number.
|
|
92
92
|
* Valid extensions are 1-6 digits with no other characters.
|
|
93
93
|
*
|
|
94
|
-
* @param input - The extension string to validate
|
|
95
|
-
* @returns True if the input is a valid phone extension number
|
|
94
|
+
* @param input - The extension string to validate.
|
|
95
|
+
* @returns True if the input is a valid phone extension number.
|
|
96
96
|
*/
|
|
97
97
|
export declare function isValidPhoneExtensionNumber(input: string): input is PhoneExtensionNumber;
|
|
98
98
|
/**
|
|
@@ -114,16 +114,16 @@ export interface E164PhoneNumberExtensionPair {
|
|
|
114
114
|
* Splits a phone number into its main number and extension components.
|
|
115
115
|
* If the input contains a # character, everything before is the number and everything after is the extension.
|
|
116
116
|
*
|
|
117
|
-
* @param input - The phone number string to split
|
|
118
|
-
* @returns An object containing the number and optional extension
|
|
117
|
+
* @param input - The phone number string to split.
|
|
118
|
+
* @returns An object containing the number and optional extension.
|
|
119
119
|
*/
|
|
120
120
|
export declare function e164PhoneNumberExtensionPair(input: PhoneNumber | E164PhoneNumberWithOptionalExtension): E164PhoneNumberExtensionPair;
|
|
121
121
|
/**
|
|
122
122
|
* Combines a phone number and optional extension into a single string.
|
|
123
123
|
* If an extension is provided, it will be appended with a # separator.
|
|
124
124
|
*
|
|
125
|
-
* @param input - An object containing the phone number and optional extension
|
|
126
|
-
* @returns A formatted phone number string with optional extension
|
|
125
|
+
* @param input - An object containing the phone number and optional extension.
|
|
126
|
+
* @returns A formatted phone number string with optional extension.
|
|
127
127
|
*/
|
|
128
128
|
export declare function e164PhoneNumberFromE164PhoneNumberExtensionPair(input: E164PhoneNumberExtensionPair): E164PhoneNumberWithOptionalExtension;
|
|
129
129
|
/**
|
|
@@ -135,7 +135,7 @@ export declare function e164PhoneNumberFromE164PhoneNumberExtensionPair(input: E
|
|
|
135
135
|
*
|
|
136
136
|
* @param input - A raw phone number string, possibly with formatting (e.g. `'(720)6620850'`, `'720-662-0850'`)
|
|
137
137
|
* @param defaultCountryCode - The country calling code to prepend if the number lacks one (default: `'1'` for US/Canada)
|
|
138
|
-
* @returns The corrected {@link E164PhoneNumber}, or `undefined` if the input cannot be converted
|
|
138
|
+
* @returns The corrected {@link E164PhoneNumber}, or `undefined` if the input cannot be converted.
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
141
|
* ```typescript
|