@dereekb/util 13.4.0 → 13.4.1
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/index.cjs.js +191 -109
- package/fetch/index.esm.js +191 -109
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +6 -0
- package/fetch/src/lib/fetch.d.ts +37 -0
- package/fetch/src/lib/fetch.file.d.ts +7 -5
- package/fetch/src/lib/fetch.limit.d.ts +7 -0
- package/fetch/src/lib/fetch.url.d.ts +6 -3
- package/fetch/src/lib/json.d.ts +12 -1
- package/fetch/src/lib/timeout.d.ts +8 -0
- package/fetch/src/lib/url.d.ts +33 -0
- package/index.cjs.js +1440 -746
- package/index.esm.js +1440 -747
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +7 -0
- package/src/lib/array/array.filter.d.ts +4 -4
- package/src/lib/array/array.index.d.ts +3 -1
- package/src/lib/array/array.indexed.d.ts +9 -3
- package/src/lib/array/array.limit.d.ts +2 -0
- package/src/lib/assertion/assert.d.ts +3 -0
- package/src/lib/assertion/assert.error.d.ts +6 -0
- package/src/lib/boolean.d.ts +3 -0
- package/src/lib/date/expires.d.ts +3 -3
- package/src/lib/date/minute.d.ts +14 -8
- package/src/lib/date/time.d.ts +3 -0
- package/src/lib/error/error.server.d.ts +1 -0
- package/src/lib/file/pdf.d.ts +1 -1
- package/src/lib/getter/getter.cache.d.ts +1 -1
- package/src/lib/grouping.d.ts +11 -2
- package/src/lib/map/map.key.d.ts +1 -1
- package/src/lib/model/model.d.ts +14 -9
- package/src/lib/number/dollar.d.ts +8 -0
- package/src/lib/number/number.d.ts +4 -0
- package/src/lib/object/object.equal.d.ts +2 -2
- package/src/lib/object/object.filter.pojo.d.ts +7 -0
- package/src/lib/object/object.filter.tuple.d.ts +2 -0
- package/src/lib/object/object.map.d.ts +1 -1
- package/src/lib/path/path.d.ts +4 -2
- package/src/lib/promise/poll.d.ts +3 -0
- package/src/lib/promise/promise.d.ts +19 -7
- package/src/lib/promise/promise.loop.d.ts +27 -9
- package/src/lib/relation/relation.d.ts +12 -0
- package/src/lib/service/handler.config.d.ts +3 -1
- package/src/lib/service/handler.d.ts +6 -2
- package/src/lib/service/typed.service.d.ts +3 -1
- package/src/lib/set/set.d.ts +32 -19
- package/src/lib/set/set.hashset.d.ts +3 -1
- package/src/lib/sort.d.ts +11 -0
- package/src/lib/storage/storage.error.d.ts +3 -0
- package/src/lib/storage/storage.memory.d.ts +7 -0
- package/src/lib/storage/storage.object.d.ts +5 -0
- package/src/lib/string/dencoder.d.ts +4 -1
- package/src/lib/string/mimetype.d.ts +57 -19
- package/src/lib/string/transform.d.ts +10 -1
- package/src/lib/string/tree.d.ts +18 -6
- package/src/lib/string/url.d.ts +57 -19
- package/src/lib/tree/tree.d.ts +12 -4
- package/src/lib/tree/tree.flatten.d.ts +3 -1
- package/src/lib/value/address.d.ts +24 -7
- package/src/lib/value/bound.d.ts +3 -0
- package/src/lib/value/build.d.ts +3 -0
- package/src/lib/value/comparator.d.ts +4 -0
- package/src/lib/value/cron.d.ts +1 -0
- package/src/lib/value/decision.d.ts +3 -0
- package/src/lib/value/equal.d.ts +3 -0
- package/src/lib/value/indexed.d.ts +4 -0
- package/src/lib/value/label.d.ts +1 -0
- package/src/lib/value/map.d.ts +9 -0
- package/src/lib/value/maybe.d.ts +13 -0
- package/src/lib/value/modifier.d.ts +9 -0
- package/src/lib/value/point.d.ts +3 -0
- package/src/lib/value/url.d.ts +1 -0
- package/src/lib/value/vector.d.ts +5 -0
- package/test/index.cjs.js +29 -6
- package/test/index.esm.js +29 -6
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +3 -3
- package/test/src/lib/shared/shared.d.ts +7 -1
- package/test/src/lib/shared/shared.fail.d.ts +8 -2
- package/test/src/lib/shared/shared.wrap.d.ts +1 -0
|
@@ -125,6 +125,12 @@ export declare class ModelRelationUtility {
|
|
|
125
125
|
* The mask results are merged together.
|
|
126
126
|
*
|
|
127
127
|
* Order from the "current" is retained. Anything in currentRetain overrides modifiedResults.
|
|
128
|
+
*
|
|
129
|
+
* @param current - the original array whose ordering is preserved
|
|
130
|
+
* @param currentRetain - items from `current` that were excluded from modification and take precedence in the merge
|
|
131
|
+
* @param modifiedResults - items that were modified or added during the relation change
|
|
132
|
+
* @param readKey - function that extracts the relation key from each item for ordering
|
|
133
|
+
* @returns the merged array with original ordering restored
|
|
128
134
|
*/
|
|
129
135
|
private static _mergeMaskResults;
|
|
130
136
|
private static _modifyCollectionWithoutMask;
|
|
@@ -149,6 +155,12 @@ export declare class ModelRelationUtility {
|
|
|
149
155
|
static insertCollection<T extends RelationObject>(current: T[], update: T[], config: UpdateRelationConfig<T> | UpdateMiltiTypeRelationConfig<T>): T[];
|
|
150
156
|
/**
|
|
151
157
|
* Used to modify a collection which may be multi-type. If readType is provided, the collection is handled as a multi-type map.
|
|
158
|
+
*
|
|
159
|
+
* @param current - the current collection of relation objects
|
|
160
|
+
* @param mods - the modifications to apply to the collection
|
|
161
|
+
* @param modifyCollection - function that applies modifications to a single-type subset of the collection
|
|
162
|
+
* @param readType - optional function to read the type from each relation object, enabling multi-type handling
|
|
163
|
+
* @returns the modified collection with all changes applied
|
|
152
164
|
*/
|
|
153
165
|
private static _modifyCollection;
|
|
154
166
|
private static _modifyMultiTypeCollection;
|
|
@@ -73,7 +73,9 @@ export type HandlerConfigurerFactory<C extends HandlerBindAccessor<T, K, R>, T,
|
|
|
73
73
|
* Configuration for {@link handlerConfigurerFactory}.
|
|
74
74
|
*/
|
|
75
75
|
export interface HandlerConfigurerFactoryConfig<C extends HandlerBindAccessor<T, K, R>, T, K extends PrimativeKey = string, R = HandleResult> {
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Creates a typed configurer from a bind accessor.
|
|
78
|
+
*/
|
|
77
79
|
configurerForAccessor: (accessor: HandlerBindAccessor<T, K, R>) => C;
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
@@ -80,9 +80,13 @@ export type HandlerFactory<T, K extends PrimativeKey = string, R = HandleResult>
|
|
|
80
80
|
* Options for configuring default and negative results in a {@link HandlerFactory}.
|
|
81
81
|
*/
|
|
82
82
|
export interface HandlerFactoryOptions<R = HandleResult> {
|
|
83
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* The result returned when a handler function returns void.
|
|
85
|
+
*/
|
|
84
86
|
readonly defaultResult: R;
|
|
85
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* The result returned when no handler matches the input key.
|
|
89
|
+
*/
|
|
86
90
|
readonly negativeResult: R;
|
|
87
91
|
}
|
|
88
92
|
/**
|
|
@@ -35,7 +35,9 @@ export declare class TypedServiceRegistryInstance<S, T extends string = string>
|
|
|
35
35
|
* Configuration for initializing a {@link TypedServiceRegistryInstance} with a set of services.
|
|
36
36
|
*/
|
|
37
37
|
export interface TypedServiceRegistrySetupConfig<S, T extends string = string> {
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* A record mapping type keys to their service instances.
|
|
40
|
+
*/
|
|
39
41
|
services: {
|
|
40
42
|
[K in T]: S;
|
|
41
43
|
};
|
package/src/lib/set/set.d.ts
CHANGED
|
@@ -266,6 +266,11 @@ export declare function setIncludesFunction<T>(valuesSet: Set<T>, mode?: SetIncl
|
|
|
266
266
|
export declare function setIncludes<T>(valuesSet: Set<T>, valuesToFind: IterableOrValue<T>, mode?: SetIncludesMode): boolean;
|
|
267
267
|
/**
|
|
268
268
|
* Returns false if the input array contains any value from the second array.
|
|
269
|
+
*
|
|
270
|
+
* @param values - the values to check against
|
|
271
|
+
* @param valuesToFind - the values to look for
|
|
272
|
+
* @param emptyValuesToFindArrayResult - result when valuesToFind is empty
|
|
273
|
+
* @returns `true` if none of the valuesToFind are present in values
|
|
269
274
|
*/
|
|
270
275
|
export declare function containsNoneOfValue<T>(values: IterableOrValue<T>, valuesToFind: IterableOrValue<T>, emptyValuesToFindArrayResult?: boolean): boolean;
|
|
271
276
|
/**
|
|
@@ -290,6 +295,11 @@ export declare function setContainsNoneOfValue<T>(valuesSet: Set<T>, valuesToFin
|
|
|
290
295
|
* Returns true if the input array contains any value from the second array.
|
|
291
296
|
*
|
|
292
297
|
* If valuesToFind is empty, returns the emptyValuesToFindArrayResult value. Defaults to false.
|
|
298
|
+
*
|
|
299
|
+
* @param values - the values to build a set from and check against
|
|
300
|
+
* @param valuesToFind - the values to search for within the set
|
|
301
|
+
* @param emptyValuesToFindArrayResult - result when valuesToFind is empty; defaults to false
|
|
302
|
+
* @returns `true` if any of the valuesToFind exist in values
|
|
293
303
|
*/
|
|
294
304
|
export declare function containsAnyValue<T>(values: IterableOrValue<T>, valuesToFind: IterableOrValue<T>, emptyValuesToFindArrayResult?: boolean): boolean;
|
|
295
305
|
/**
|
|
@@ -297,9 +307,10 @@ export declare function containsAnyValue<T>(values: IterableOrValue<T>, valuesTo
|
|
|
297
307
|
*
|
|
298
308
|
* If values is empty, returns the emptyValuesToFindArrayResult value. Defaults to false.
|
|
299
309
|
*
|
|
300
|
-
* @param values
|
|
301
|
-
* @param valuesToFind
|
|
302
|
-
* @
|
|
310
|
+
* @param values - the values to check for membership in the set
|
|
311
|
+
* @param valuesToFind - the set to check against
|
|
312
|
+
* @param emptyValuesArrayResult - result when values is empty; defaults to false
|
|
313
|
+
* @returns `true` if any of the values are present in the set
|
|
303
314
|
*/
|
|
304
315
|
export declare function containsAnyValueFromSet<T>(values: IterableOrValue<T>, valuesToFind: Set<T>, emptyValuesArrayResult?: boolean): boolean;
|
|
305
316
|
/**
|
|
@@ -307,10 +318,10 @@ export declare function containsAnyValueFromSet<T>(values: IterableOrValue<T>, v
|
|
|
307
318
|
*
|
|
308
319
|
* If valuesToFind is empty, returns the emptyValuesToFindArrayResult value. Defaults to false.
|
|
309
320
|
*
|
|
310
|
-
* @param valuesSet
|
|
311
|
-
* @param valuesToFind
|
|
312
|
-
* @param emptyValuesToFindArrayResult
|
|
313
|
-
* @returns
|
|
321
|
+
* @param valuesSet - the set to check for membership
|
|
322
|
+
* @param valuesToFind - the values to search for in the set
|
|
323
|
+
* @param emptyValuesToFindArrayResult - result when valuesToFind is empty; defaults to false
|
|
324
|
+
* @returns `true` if any of the valuesToFind are present in the set
|
|
314
325
|
*/
|
|
315
326
|
export declare function setContainsAnyValue<T>(valuesSet: Set<T>, valuesToFind: IterableOrValue<T>, emptyValuesToFindArrayResult?: boolean): boolean;
|
|
316
327
|
/**
|
|
@@ -318,9 +329,10 @@ export declare function setContainsAnyValue<T>(valuesSet: Set<T>, valuesToFind:
|
|
|
318
329
|
*
|
|
319
330
|
* If valuesToFind is empty, returns the emptyValuesToFindArrayResult value. Defaults to true.
|
|
320
331
|
*
|
|
321
|
-
* @param values
|
|
322
|
-
* @param valuesToFind
|
|
323
|
-
* @
|
|
332
|
+
* @param values - the iterable of values to build a set from
|
|
333
|
+
* @param valuesToFind - the values that must all be present
|
|
334
|
+
* @param emptyValuesArrayResult - result when valuesToFind is empty; defaults to true
|
|
335
|
+
* @returns `true` if all valuesToFind are present in the values set
|
|
324
336
|
*/
|
|
325
337
|
export declare function containsAllValues<T>(values: Iterable<T>, valuesToFind: IterableOrValue<T>, emptyValuesArrayResult?: boolean): boolean;
|
|
326
338
|
/**
|
|
@@ -328,24 +340,25 @@ export declare function containsAllValues<T>(values: Iterable<T>, valuesToFind:
|
|
|
328
340
|
*
|
|
329
341
|
* If valuesToFind is empty, returns the emptyValuesToFindArrayResult value. Defaults to true.
|
|
330
342
|
*
|
|
331
|
-
* @param valuesSet
|
|
332
|
-
* @param valuesToFind
|
|
333
|
-
* @param emptyValuesToFindArrayResult
|
|
334
|
-
* @returns
|
|
343
|
+
* @param valuesSet - the set to check for full containment
|
|
344
|
+
* @param valuesToFind - the values that must all be present in the set
|
|
345
|
+
* @param emptyValuesToFindArrayResult - result when valuesToFind is empty; defaults to true
|
|
346
|
+
* @returns `true` if every value in valuesToFind is present in the set
|
|
335
347
|
*/
|
|
336
348
|
export declare function setContainsAllValues<T>(valuesSet: Set<T>, valuesToFind: IterableOrValue<T>, emptyValuesToFindArrayResult?: boolean): boolean;
|
|
337
349
|
/**
|
|
338
350
|
* Returns true if both iterables are defined (or are both null/undefined) and have the same values exactly.
|
|
339
351
|
*
|
|
340
|
-
* @param a
|
|
341
|
-
* @param b
|
|
342
|
-
* @returns
|
|
352
|
+
* @param a - first iterable to compare
|
|
353
|
+
* @param b - second iterable to compare
|
|
354
|
+
* @returns `true` if both iterables contain the same unique values, or both are nullish
|
|
343
355
|
*/
|
|
344
356
|
export declare function iterablesAreSetEquivalent<T>(a: Maybe<Iterable<T>>, b: Maybe<Iterable<T>>): boolean;
|
|
345
357
|
/**
|
|
346
358
|
* Returns true if both sets are defined (or are both null/undefined) and have the same values exactly.
|
|
347
359
|
*
|
|
348
|
-
* @param a
|
|
349
|
-
* @param b
|
|
360
|
+
* @param a - first set to compare
|
|
361
|
+
* @param b - second set to compare
|
|
362
|
+
* @returns `true` if both sets contain the same values, or both are nullish
|
|
350
363
|
*/
|
|
351
364
|
export declare function setsAreEquivalent<T>(a: Maybe<Set<T>>, b: Maybe<Set<T>>): boolean;
|
|
@@ -4,7 +4,9 @@ import { type Maybe } from '../value/maybe.type';
|
|
|
4
4
|
* Configuration for a {@link HashSet}, providing the key extraction function.
|
|
5
5
|
*/
|
|
6
6
|
export interface HashSetConfig<K extends PrimativeKey, T> {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the unique key used for equality comparison from each value.
|
|
9
|
+
*/
|
|
8
10
|
readKey: ReadKeyFunction<T, K>;
|
|
9
11
|
}
|
|
10
12
|
/**
|
package/src/lib/sort.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ export type AscendingSortCompareFunction<T> = SortCompareFunction<T>;
|
|
|
40
40
|
export type SortDescendingCompareFunction<T> = SortCompareFunction<T>;
|
|
41
41
|
/**
|
|
42
42
|
* Convenience function that reverses the order of the sorted values.
|
|
43
|
+
*
|
|
44
|
+
* @param compareFn - the comparison function whose order should be reversed
|
|
45
|
+
* @returns a new comparison function with the opposite sort direction
|
|
43
46
|
*/
|
|
44
47
|
export declare function reverseCompareFn<T>(compareFn: AscendingSortCompareFunction<T>): SortDescendingCompareFunction<T>;
|
|
45
48
|
export declare function reverseCompareFn<T>(compareFn: SortDescendingCompareFunction<T>): AscendingSortCompareFunction<T>;
|
|
@@ -47,6 +50,10 @@ export declare function reverseCompareFn<T>(compareFn: SortDescendingCompareFunc
|
|
|
47
50
|
* Convenience function that reverses the order of the sorted values if the order is specified descending.
|
|
48
51
|
*
|
|
49
52
|
* The input comparison function must be in ascending order.
|
|
53
|
+
*
|
|
54
|
+
* @param ascendingCompareFn - a comparison function that sorts in ascending order
|
|
55
|
+
* @param order - the desired sort direction; defaults to 'asc'
|
|
56
|
+
* @returns the original function if ascending, or a reversed version if descending
|
|
50
57
|
*/
|
|
51
58
|
export declare function compareFnOrder<T>(ascendingCompareFn: AscendingSortCompareFunction<T>, order?: SortingOrder): SortCompareFunction<T>;
|
|
52
59
|
/**
|
|
@@ -110,6 +117,10 @@ export declare function sortValues<T>(input: SortValuesInput<T>): T[];
|
|
|
110
117
|
export declare function sortValuesFunctionWithSortRef<T>(sortRef: Maybe<Partial<SortCompareFunctionRef<T>>>, sortOnCopyDefault?: boolean): SortValuesFunction<T>;
|
|
111
118
|
/**
|
|
112
119
|
* Creates a SortValuesFunction using the input. If the input is not defined, or it's sort function is not defined, then returns mapIdentityFunction().
|
|
120
|
+
*
|
|
121
|
+
* @param sortRef - optional reference containing the sort comparison function
|
|
122
|
+
* @param sortOnCopyDefault - whether to sort on a copy by default
|
|
123
|
+
* @returns a sort function that sorts arrays, or the identity function if no sort comparison is configured
|
|
113
124
|
*/
|
|
114
125
|
export declare function sortValuesFunctionOrMapIdentityWithSortRef<T>(sortRef: Maybe<Partial<SortCompareFunctionRef<T>>>, sortOnCopyDefault?: boolean): SortValuesFunction<T>;
|
|
115
126
|
/**
|
|
@@ -6,6 +6,7 @@ import { type ReadStoredData } from './storage';
|
|
|
6
6
|
export declare class StoredDataError extends BaseError {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of StoredDataError.
|
|
9
|
+
*
|
|
9
10
|
* @param message Optional error message.
|
|
10
11
|
*/
|
|
11
12
|
constructor(message?: string);
|
|
@@ -16,6 +17,7 @@ export declare class StoredDataError extends BaseError {
|
|
|
16
17
|
export declare class DataDoesNotExistError extends StoredDataError {
|
|
17
18
|
/**
|
|
18
19
|
* Creates an instance of DataDoesNotExistError.
|
|
20
|
+
*
|
|
19
21
|
* @param message Optional error message.
|
|
20
22
|
*/
|
|
21
23
|
constructor(message?: string);
|
|
@@ -29,6 +31,7 @@ export declare class DataIsExpiredError<T> extends StoredDataError {
|
|
|
29
31
|
readonly data: ReadStoredData<T>;
|
|
30
32
|
/**
|
|
31
33
|
* Creates an instance of DataIsExpiredError.
|
|
34
|
+
*
|
|
32
35
|
* @param data The expired data, including metadata.
|
|
33
36
|
* @param message Optional error message. If not provided, a default message will be used.
|
|
34
37
|
*/
|
|
@@ -9,22 +9,27 @@ export declare class MemoryStorageInstance implements StorageObject {
|
|
|
9
9
|
private _storage;
|
|
10
10
|
/**
|
|
11
11
|
* The number of items stored.
|
|
12
|
+
*
|
|
13
|
+
* @returns the current count of stored key-value pairs
|
|
12
14
|
*/
|
|
13
15
|
get length(): number;
|
|
14
16
|
/**
|
|
15
17
|
* Returns the key at the given index.
|
|
18
|
+
*
|
|
16
19
|
* @param index The index of the key to retrieve.
|
|
17
20
|
* @returns The key string if found, otherwise null.
|
|
18
21
|
*/
|
|
19
22
|
key(index: number): string;
|
|
20
23
|
/**
|
|
21
24
|
* Checks if a key exists in the storage.
|
|
25
|
+
*
|
|
22
26
|
* @param key The key to check.
|
|
23
27
|
* @returns True if the key exists, false otherwise.
|
|
24
28
|
*/
|
|
25
29
|
hasKey(key: string): boolean;
|
|
26
30
|
/**
|
|
27
31
|
* Retrieves an item from storage.
|
|
32
|
+
*
|
|
28
33
|
* @param key The key of the item to retrieve.
|
|
29
34
|
* @returns The item string if found, otherwise null or undefined.
|
|
30
35
|
*/
|
|
@@ -32,12 +37,14 @@ export declare class MemoryStorageInstance implements StorageObject {
|
|
|
32
37
|
/**
|
|
33
38
|
* Sets an item in storage.
|
|
34
39
|
* If the item is null or undefined, the key will be removed.
|
|
40
|
+
*
|
|
35
41
|
* @param key The key of the item to set.
|
|
36
42
|
* @param item The item string to store.
|
|
37
43
|
*/
|
|
38
44
|
setItem(key: string, item: Maybe<string>): void;
|
|
39
45
|
/**
|
|
40
46
|
* Removes an item from storage.
|
|
47
|
+
*
|
|
41
48
|
* @param key The key of the item to remove.
|
|
42
49
|
*/
|
|
43
50
|
removeItem(key: string): void;
|
|
@@ -6,18 +6,21 @@ import { type StoredDataStorageKey } from './storage';
|
|
|
6
6
|
export declare abstract class SimpleStorageObject {
|
|
7
7
|
/**
|
|
8
8
|
* Retrieves an item from storage.
|
|
9
|
+
*
|
|
9
10
|
* @param key The key of the item to retrieve.
|
|
10
11
|
* @returns The item string if found, otherwise null or undefined.
|
|
11
12
|
*/
|
|
12
13
|
abstract getItem(key: StoredDataStorageKey): Maybe<string>;
|
|
13
14
|
/**
|
|
14
15
|
* Sets an item in storage.
|
|
16
|
+
*
|
|
15
17
|
* @param key The key of the item to set.
|
|
16
18
|
* @param item The item string to store. If null or undefined, the item may be removed depending on implementation.
|
|
17
19
|
*/
|
|
18
20
|
abstract setItem(key: StoredDataStorageKey, item: Maybe<string>): void;
|
|
19
21
|
/**
|
|
20
22
|
* Removes an item from storage.
|
|
23
|
+
*
|
|
21
24
|
* @param key The key of the item to remove.
|
|
22
25
|
*/
|
|
23
26
|
abstract removeItem(key: StoredDataStorageKey): void;
|
|
@@ -36,6 +39,7 @@ export declare abstract class StorageObject extends SimpleStorageObject {
|
|
|
36
39
|
* Returns the string key for the index.
|
|
37
40
|
*
|
|
38
41
|
* Returns null if no key available.
|
|
42
|
+
*
|
|
39
43
|
* @param index The index of the key to retrieve.
|
|
40
44
|
* @returns The key string if found, otherwise null.
|
|
41
45
|
*/
|
|
@@ -55,6 +59,7 @@ export declare abstract class FullStorageObject extends StorageObject {
|
|
|
55
59
|
abstract readonly isAvailable: boolean;
|
|
56
60
|
/**
|
|
57
61
|
* Removes all items from storage.
|
|
62
|
+
*
|
|
58
63
|
* @returns An array of keys that were removed.
|
|
59
64
|
*/
|
|
60
65
|
abstract removeAll(): string[];
|
|
@@ -60,8 +60,11 @@ export type PrimativeKeyDencoderFunction<D extends PrimativeKey, E extends Prima
|
|
|
60
60
|
/**
|
|
61
61
|
* Default fallback factory for {@link PrimativeKeyDencoderFunction} that always returns null,
|
|
62
62
|
* causing an error to be thrown for unknown values.
|
|
63
|
+
*
|
|
64
|
+
* @param _input - the unknown value to look up (ignored; always returns null)
|
|
65
|
+
* @returns always returns null to signal an unknown value
|
|
63
66
|
*/
|
|
64
|
-
export declare const PRIMATIVE_KEY_DENCODER_VALUE: (
|
|
67
|
+
export declare const PRIMATIVE_KEY_DENCODER_VALUE: (_input: unknown) => null;
|
|
65
68
|
/**
|
|
66
69
|
* Creates a new {@link PrimativeKeyDencoderFunction} that can bidirectionally encode/decode
|
|
67
70
|
* primitive key values based on the configured value pairs.
|
|
@@ -28,21 +28,37 @@ export type ContentTypeMimeType = string;
|
|
|
28
28
|
* This is a non-exhaustive list of common image types.
|
|
29
29
|
*/
|
|
30
30
|
export type ImageFileExtension = 'jpeg' | 'jpg' | 'png' | 'webp' | 'gif' | 'svg' | 'raw' | 'heif' | 'tiff';
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* MIME type for JPEG images.
|
|
33
|
+
*/
|
|
32
34
|
export declare const JPEG_MIME_TYPE: MimeTypeWithoutParameters;
|
|
33
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* MIME type for PNG images.
|
|
37
|
+
*/
|
|
34
38
|
export declare const PNG_MIME_TYPE: MimeTypeWithoutParameters;
|
|
35
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* MIME type for WebP images.
|
|
41
|
+
*/
|
|
36
42
|
export declare const WEBP_MIME_TYPE: MimeTypeWithoutParameters;
|
|
37
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* MIME type for GIF images.
|
|
45
|
+
*/
|
|
38
46
|
export declare const GIF_MIME_TYPE: MimeTypeWithoutParameters;
|
|
39
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* MIME type for HEIF images.
|
|
49
|
+
*/
|
|
40
50
|
export declare const HEIF_MIME_TYPE: MimeTypeWithoutParameters;
|
|
41
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* MIME type for TIFF images.
|
|
53
|
+
*/
|
|
42
54
|
export declare const TIFF_MIME_TYPE: MimeTypeWithoutParameters;
|
|
43
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* MIME type for SVG images.
|
|
57
|
+
*/
|
|
44
58
|
export declare const SVG_MIME_TYPE: MimeTypeWithoutParameters;
|
|
45
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* MIME type for RAW images.
|
|
61
|
+
*/
|
|
46
62
|
export declare const RAW_MIME_TYPE: MimeTypeWithoutParameters;
|
|
47
63
|
/**
|
|
48
64
|
* Maps image file extensions to their corresponding MIME types.
|
|
@@ -72,25 +88,45 @@ export declare function imageFileExtensionForMimeType(mimeType: Maybe<MimeTypeWi
|
|
|
72
88
|
* Non-exhaustive list of common document file extensions.
|
|
73
89
|
*/
|
|
74
90
|
export type DocumentFileExtension = 'pdf' | 'docx' | 'xlsx' | 'txt' | 'csv' | 'html' | 'xml' | 'json' | 'yaml' | 'md';
|
|
75
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* MIME type for PDF documents.
|
|
93
|
+
*/
|
|
76
94
|
export declare const PDF_MIME_TYPE: MimeTypeWithoutParameters;
|
|
77
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* MIME type for DOCX (Word) documents.
|
|
97
|
+
*/
|
|
78
98
|
export declare const DOCX_MIME_TYPE: MimeTypeWithoutParameters;
|
|
79
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* MIME type for XLSX (Excel) spreadsheets.
|
|
101
|
+
*/
|
|
80
102
|
export declare const XLSX_MIME_TYPE: MimeTypeWithoutParameters;
|
|
81
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* MIME type for plain text files.
|
|
105
|
+
*/
|
|
82
106
|
export declare const TXT_MIME_TYPE: MimeTypeWithoutParameters;
|
|
83
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* MIME type for CSV files.
|
|
109
|
+
*/
|
|
84
110
|
export declare const CSV_MIME_TYPE: MimeTypeWithoutParameters;
|
|
85
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* MIME type for HTML files.
|
|
113
|
+
*/
|
|
86
114
|
export declare const HTML_MIME_TYPE: MimeTypeWithoutParameters;
|
|
87
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* MIME type for XML files.
|
|
117
|
+
*/
|
|
88
118
|
export declare const XML_MIME_TYPE: MimeTypeWithoutParameters;
|
|
89
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* MIME type for JSON files.
|
|
121
|
+
*/
|
|
90
122
|
export declare const JSON_MIME_TYPE: MimeTypeWithoutParameters;
|
|
91
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* MIME type for YAML files.
|
|
125
|
+
*/
|
|
92
126
|
export declare const YAML_MIME_TYPE: MimeTypeWithoutParameters;
|
|
93
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* MIME type for Markdown files.
|
|
129
|
+
*/
|
|
94
130
|
export declare const MARKDOWN_MIME_TYPE: MimeTypeWithoutParameters;
|
|
95
131
|
/**
|
|
96
132
|
* Maps document file extensions to their corresponding MIME types.
|
|
@@ -120,7 +156,9 @@ export declare function documentFileExtensionForMimeType(mimeType: Maybe<MimeTyp
|
|
|
120
156
|
* Non-exhaustive list of common application file extensions.
|
|
121
157
|
*/
|
|
122
158
|
export type ApplicationFileExtension = 'zip';
|
|
123
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* MIME type for ZIP archive files.
|
|
161
|
+
*/
|
|
124
162
|
export declare const ZIP_FILE_MIME_TYPE: MimeTypeWithoutParameters;
|
|
125
163
|
/**
|
|
126
164
|
* Maps application file extensions to their corresponding MIME types.
|
|
@@ -2,18 +2,21 @@ import { type MapFunction } from '../value/map';
|
|
|
2
2
|
import { type Maybe } from '../value/maybe.type';
|
|
3
3
|
/**
|
|
4
4
|
* Trims leading and trailing whitespace from a string.
|
|
5
|
+
*
|
|
5
6
|
* @param input The string to trim.
|
|
6
7
|
* @returns The trimmed string.
|
|
7
8
|
*/
|
|
8
9
|
export declare function stringTrimFunction(input: string): string;
|
|
9
10
|
/**
|
|
10
11
|
* Converts a string to uppercase.
|
|
12
|
+
*
|
|
11
13
|
* @param input The string to convert.
|
|
12
14
|
* @returns The uppercase string.
|
|
13
15
|
*/
|
|
14
16
|
export declare function stringToUppercaseFunction(input: string): string;
|
|
15
17
|
/**
|
|
16
18
|
* Converts a string to lowercase.
|
|
19
|
+
*
|
|
17
20
|
* @param input The string to convert.
|
|
18
21
|
* @returns The lowercase string.
|
|
19
22
|
*/
|
|
@@ -56,7 +59,9 @@ export type TransformStringFunctionConfig<S extends string = string> = {
|
|
|
56
59
|
* @template S The specific string type, defaults to `string`.
|
|
57
60
|
*/
|
|
58
61
|
export interface TransformStringFunctionConfigRef<S extends string = string> {
|
|
59
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* The string transformation configuration.
|
|
64
|
+
*/
|
|
60
65
|
readonly transform: TransformStringFunctionConfig<S>;
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
@@ -111,6 +116,7 @@ export declare function addPrefix(prefix: string, input: string): string;
|
|
|
111
116
|
export type AddPrefixFunction = (input: string) => string;
|
|
112
117
|
/**
|
|
113
118
|
* Creates a function that adds a configured prefix to the input string if it does not exist on that string.
|
|
119
|
+
*
|
|
114
120
|
* @param prefix The prefix to add.
|
|
115
121
|
* @returns A function that adds the prefix to a string.
|
|
116
122
|
*/
|
|
@@ -121,6 +127,7 @@ export declare function addPrefixFunction(prefix: string): AddPrefixFunction;
|
|
|
121
127
|
export type AddSuffixFunction = TransformStringFunction;
|
|
122
128
|
/**
|
|
123
129
|
* Adds a suffix to a string if it does not already end with that suffix.
|
|
130
|
+
*
|
|
124
131
|
* @param suffix The suffix to add.
|
|
125
132
|
* @param input The string to modify.
|
|
126
133
|
* @returns The modified string.
|
|
@@ -128,6 +135,7 @@ export type AddSuffixFunction = TransformStringFunction;
|
|
|
128
135
|
export declare function addSuffix(suffix: string, input: string): string;
|
|
129
136
|
/**
|
|
130
137
|
* Creates a function that adds a configured suffix to the input string if it does not exist on that string.
|
|
138
|
+
*
|
|
131
139
|
* @param suffix The suffix to add.
|
|
132
140
|
* @returns A function that adds the suffix to a string.
|
|
133
141
|
*/
|
|
@@ -138,6 +146,7 @@ export declare function addSuffixFunction(suffix: string): AddSuffixFunction;
|
|
|
138
146
|
export type PadStartFunction = TransformStringFunction;
|
|
139
147
|
/**
|
|
140
148
|
* Pads the start of a string to a minimum length.
|
|
149
|
+
*
|
|
141
150
|
* @param minLength The minimum length of the string.
|
|
142
151
|
* @param padCharacter The character to use for padding.
|
|
143
152
|
* @returns A function that pads the start of a string.
|
package/src/lib/string/tree.d.ts
CHANGED
|
@@ -65,7 +65,9 @@ export type SplitStringTreeRoot<M = unknown> = Pick<SplitStringTree<M>, 'childre
|
|
|
65
65
|
* @template M - The type of metadata attached to tree nodes.
|
|
66
66
|
*/
|
|
67
67
|
export interface SplitStringTreeFactoryInput<M = unknown> extends Pick<AddToSplitStringTreeInputValueWithMeta<M>, 'leafMeta' | 'nodeMeta'> {
|
|
68
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* One or more string values to split and add to the tree.
|
|
70
|
+
*/
|
|
69
71
|
readonly values: ArrayOrValue<SplitStringTreeNodeString>;
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
@@ -95,11 +97,17 @@ export declare function splitStringTreeFactory<M = unknown>(config: SplitStringT
|
|
|
95
97
|
* @template M - The type of metadata attached to tree nodes.
|
|
96
98
|
*/
|
|
97
99
|
export interface ApplySplitStringTreeWithMultipleValuesInput<M = unknown> {
|
|
98
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* The entries to add to the tree, each potentially with different metadata.
|
|
102
|
+
*/
|
|
99
103
|
readonly entries: SplitStringTreeFactoryInput<M>[];
|
|
100
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* The factory to use for building the tree.
|
|
106
|
+
*/
|
|
101
107
|
readonly factory: SplitStringTreeFactory<M>;
|
|
102
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* An optional existing tree to extend rather than creating a new one.
|
|
110
|
+
*/
|
|
103
111
|
readonly existing?: SplitStringTree<M>;
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
@@ -115,7 +123,9 @@ export declare function applySplitStringTreeWithMultipleValues<M = unknown>(inpu
|
|
|
115
123
|
* @template M - The type of metadata attached to tree nodes.
|
|
116
124
|
*/
|
|
117
125
|
export interface AddToSplitStringTreeInputValueWithMeta<M = unknown> {
|
|
118
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* The string value to split and insert into the tree.
|
|
128
|
+
*/
|
|
119
129
|
readonly value: SplitStringTreeNodeString;
|
|
120
130
|
/**
|
|
121
131
|
* The meta value to merge/attach to each node in the tree
|
|
@@ -132,7 +142,9 @@ export interface AddToSplitStringTreeInputValueWithMeta<M = unknown> {
|
|
|
132
142
|
* @template M - The type of metadata attached to tree nodes.
|
|
133
143
|
*/
|
|
134
144
|
export interface AddToSplitStringTreeInputConfig<M = unknown> {
|
|
135
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* The separator character used to split string values into tree path segments.
|
|
147
|
+
*/
|
|
136
148
|
readonly separator: string;
|
|
137
149
|
/**
|
|
138
150
|
* Used for merging the meta values of two nodes.
|