@dereekb/util 9.25.16 → 10.0.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/CHANGELOG.md +12 -0
- package/fetch/CHANGELOG.md +12 -0
- package/fetch/package.json +2 -14
- package/fetch/src/lib/fetch.d.ts +5 -5
- package/fetch/src/lib/fetch.type.d.ts +3 -3
- package/fetch/src/lib/json.d.ts +8 -8
- package/fetch/src/lib/timeout.js +3 -2
- package/fetch/src/lib/timeout.js.map +1 -1
- package/fetch/src/lib/url.d.ts +10 -10
- package/package.json +5 -8
- package/src/lib/array/array.boolean.d.ts +3 -3
- package/src/lib/array/array.d.ts +25 -6
- package/src/lib/array/array.factory.d.ts +4 -4
- package/src/lib/array/array.filter.d.ts +1 -1
- package/src/lib/array/array.find.d.ts +2 -2
- package/src/lib/array/array.index.d.ts +3 -3
- package/src/lib/array/array.indexed.d.ts +6 -6
- package/src/lib/array/array.js +31 -11
- package/src/lib/array/array.js.map +1 -1
- package/src/lib/array/array.make.d.ts +1 -1
- package/src/lib/array/array.number.d.ts +2 -2
- package/src/lib/array/array.random.d.ts +1 -1
- package/src/lib/array/array.string.d.ts +8 -5
- package/src/lib/array/array.string.js +6 -6
- package/src/lib/array/array.string.js.map +1 -1
- package/src/lib/array/array.unique.d.ts +3 -11
- package/src/lib/array/array.unique.js +1 -10
- package/src/lib/array/array.unique.js.map +1 -1
- package/src/lib/assertion/assertion.d.ts +2 -2
- package/src/lib/auth/auth.role.claims.d.ts +12 -12
- package/src/lib/auth/auth.role.d.ts +2 -2
- package/src/lib/boolean.d.ts +2 -2
- package/src/lib/contact/domain.d.ts +1 -1
- package/src/lib/contact/email.d.ts +3 -3
- package/src/lib/contact/phone.d.ts +5 -5
- package/src/lib/contact/random.d.ts +2 -2
- package/src/lib/date/date.d.ts +22 -22
- package/src/lib/date/date.time.d.ts +4 -4
- package/src/lib/date/date.time.js +1 -1
- package/src/lib/date/date.time.js.map +1 -1
- package/src/lib/date/hour.d.ts +1 -1
- package/src/lib/date/week.d.ts +10 -10
- package/src/lib/date/week.js +1 -1
- package/src/lib/date/week.js.map +1 -1
- package/src/lib/error/error.d.ts +5 -5
- package/src/lib/error/error.server.d.ts +1 -1
- package/src/lib/file/xml.d.ts +1 -1
- package/src/lib/filter/filter.d.ts +2 -2
- package/src/lib/function/function.boolean.d.ts +1 -1
- package/src/lib/function/function.forward.d.ts +2 -2
- package/src/lib/getter/getter.cache.d.ts +2 -2
- package/src/lib/getter/getter.d.ts +12 -12
- package/src/lib/getter/getter.map.d.ts +1 -1
- package/src/lib/getter/getter.util.d.ts +1 -1
- package/src/lib/getter/type.d.ts +1 -1
- package/src/lib/grouping.d.ts +2 -2
- package/src/lib/hash.d.ts +2 -2
- package/src/lib/iterable/iterable.d.ts +1 -1
- package/src/lib/iterate.d.ts +2 -2
- package/src/lib/key.d.ts +6 -6
- package/src/lib/key.js +1 -1
- package/src/lib/key.js.map +1 -1
- package/src/lib/lifecycle.d.ts +1 -1
- package/src/lib/map/map.intersection.js +1 -1
- package/src/lib/map/map.intersection.js.map +1 -1
- package/src/lib/map/map.key.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +3 -9
- package/src/lib/model/id.batch.js +2 -2
- package/src/lib/model/id.batch.js.map +1 -1
- package/src/lib/model/model.conversion.d.ts +32 -32
- package/src/lib/model/model.copy.d.ts +3 -3
- package/src/lib/model/model.d.ts +11 -11
- package/src/lib/model/model.modify.d.ts +4 -4
- package/src/lib/nodejs/stream.d.ts +1 -1
- package/src/lib/number/bitwise.dencoder.d.ts +10 -10
- package/src/lib/number/bitwise.dencoder.js +1 -1
- package/src/lib/number/bitwise.dencoder.js.map +1 -1
- package/src/lib/number/bound.d.ts +3 -3
- package/src/lib/number/dollar.d.ts +4 -4
- package/src/lib/number/factory.d.ts +1 -1
- package/src/lib/number/number.d.ts +5 -5
- package/src/lib/number/pay.d.ts +2 -2
- package/src/lib/number/random.d.ts +2 -2
- package/src/lib/number/round.d.ts +11 -11
- package/src/lib/number/sort.d.ts +1 -1
- package/src/lib/number/transform.d.ts +2 -2
- package/src/lib/object/object.array.delta.d.ts +4 -4
- package/src/lib/object/object.d.ts +2 -2
- package/src/lib/object/object.equal.d.ts +1 -1
- package/src/lib/object/object.filter.pojo.d.ts +16 -16
- package/src/lib/object/object.filter.tuple.d.ts +5 -5
- package/src/lib/object/object.filter.tuple.js +1 -1
- package/src/lib/object/object.filter.tuple.js.map +1 -1
- package/src/lib/object/object.map.d.ts +5 -5
- package/src/lib/page/page.d.ts +1 -1
- package/src/lib/path/path.d.ts +13 -13
- package/src/lib/path/path.js +1 -1
- package/src/lib/path/path.js.map +1 -1
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/promise.d.ts +4 -33
- package/src/lib/promise/promise.js +2 -31
- package/src/lib/promise/promise.js.map +1 -1
- package/src/lib/promise/promise.loop.d.ts +2 -2
- package/src/lib/promise/promise.ref.d.ts +2 -2
- package/src/lib/promise/promise.type.d.ts +1 -1
- package/src/lib/promise/use.d.ts +1 -1
- package/src/lib/relation/relation.d.ts +8 -8
- package/src/lib/relation/relation.js +1 -1
- package/src/lib/relation/relation.js.map +1 -1
- package/src/lib/service/handler.config.d.ts +6 -6
- package/src/lib/service/handler.d.ts +6 -6
- package/src/lib/set/set.d.ts +6 -18
- package/src/lib/set/set.decision.d.ts +1 -1
- package/src/lib/set/set.delta.d.ts +2 -2
- package/src/lib/set/set.delta.js +1 -1
- package/src/lib/set/set.delta.js.map +1 -1
- package/src/lib/set/set.js +5 -18
- package/src/lib/set/set.js.map +1 -1
- package/src/lib/set/set.mode.d.ts +1 -1
- package/src/lib/set/set.selection.d.ts +1 -1
- package/src/lib/sort.d.ts +9 -9
- package/src/lib/sort.js.map +1 -1
- package/src/lib/storage/storage.d.ts +2 -2
- package/src/lib/string/char.d.ts +1 -1
- package/src/lib/string/dencoder.d.ts +7 -7
- package/src/lib/string/html.d.ts +2 -2
- package/src/lib/string/password.d.ts +1 -1
- package/src/lib/string/replace.d.ts +5 -5
- package/src/lib/string/search.d.ts +3 -3
- package/src/lib/string/sort.d.ts +1 -1
- package/src/lib/string/string.d.ts +4 -4
- package/src/lib/string/transform.d.ts +4 -4
- package/src/lib/string/url.d.ts +14 -14
- package/src/lib/string/url.js.map +1 -1
- package/src/lib/tree/tree.array.d.ts +1 -1
- package/src/lib/tree/tree.d.ts +1 -1
- package/src/lib/tree/tree.expand.d.ts +1 -1
- package/src/lib/tree/tree.flatten.d.ts +1 -1
- package/src/lib/type.d.ts +51 -51
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +13 -13
- package/src/lib/value/build.d.ts +2 -2
- package/src/lib/value/comparator.d.ts +47 -1
- package/src/lib/value/comparator.js +35 -1
- package/src/lib/value/comparator.js.map +1 -1
- package/src/lib/value/cron.d.ts +1 -1
- package/src/lib/value/decision.d.ts +3 -3
- package/src/lib/value/equal.d.ts +2 -8
- package/src/lib/value/indexed.d.ts +21 -21
- package/src/lib/value/indexed.js.map +1 -1
- package/src/lib/value/map.d.ts +14 -8
- package/src/lib/value/map.js.map +1 -1
- package/src/lib/value/maybe.type.d.ts +4 -4
- package/src/lib/value/modifier.d.ts +3 -3
- package/src/lib/value/pixel.d.ts +2 -2
- package/src/lib/value/point.d.ts +22 -26
- package/src/lib/value/sync.d.ts +2 -2
- package/src/lib/value/sync.js +1 -1
- package/src/lib/value/sync.js.map +1 -1
- package/src/lib/value/use.d.ts +7 -7
- package/src/lib/value/vector.d.ts +5 -5
- package/src/lib/value/zoom.d.ts +1 -1
- package/test/CHANGELOG.md +12 -0
- package/test/package.json +2 -14
- package/test/src/lib/jest.d.ts +5 -5
- package/test/src/lib/jest.fail.d.ts +5 -5
- package/test/src/lib/jest.function.d.ts +7 -7
- package/test/src/lib/jest.wrap.d.ts +1 -1
package/src/lib/file/xml.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import { Maybe } from '../value/maybe.type';
|
|
|
5
5
|
export interface Filter<F> {
|
|
6
6
|
filter?: F;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type OptionalFilter<F> = Partial<Filter<F>>;
|
|
9
9
|
/**
|
|
10
10
|
* Function used for filtering items that takes in a value and index.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type FilterFunction<T = unknown> = (value: T, index: number) => boolean;
|
|
13
13
|
/**
|
|
14
14
|
* Merges the input FilterFunction values into a single FilterFunction.
|
|
15
15
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Getter } from '../getter/getter';
|
|
2
2
|
import { Maybe } from '../value/maybe.type';
|
|
3
|
-
export
|
|
3
|
+
export type ForwardFunction<I extends (...args: any[]) => O, O = unknown> = I;
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a Getter that returns a function. When the function is invoked, the getter retrieves the function then calls it with the input arguments.
|
|
6
6
|
*
|
|
@@ -8,5 +8,5 @@ export declare type ForwardFunction<I extends (...args: any[]) => O, O = unknown
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export declare function forwardFunction<I extends (...args: any[]) => O, O = unknown>(getter: Getter<I>): ForwardFunction<I>;
|
|
11
|
-
export
|
|
11
|
+
export type DefaultForwardFunctionFactory<I extends (...args: any[]) => O, O = unknown> = (fn: Maybe<I>) => ForwardFunction<I, O>;
|
|
12
12
|
export declare function defaultForwardFunctionFactory<I extends (...args: any[]) => O, O = unknown>(defaultFn: I): DefaultForwardFunctionFactory<I, O>;
|
|
@@ -2,7 +2,7 @@ import { FactoryWithInput, Getter } from './getter';
|
|
|
2
2
|
/**
|
|
3
3
|
* Getter that returns a cached value.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type CachedGetter<T> = Getter<T> & {
|
|
6
6
|
/**
|
|
7
7
|
* Sets the value in the cache.
|
|
8
8
|
*
|
|
@@ -18,7 +18,7 @@ export declare type CachedGetter<T> = Getter<T> & {
|
|
|
18
18
|
*/
|
|
19
19
|
init(): void;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type CachedFactoryWithInput<T, A = unknown> = CachedGetter<T> & FactoryWithInput<T, A> & {
|
|
22
22
|
/**
|
|
23
23
|
* Re-initializes the cache using the factory function.
|
|
24
24
|
*
|
|
@@ -6,40 +6,40 @@ import { Maybe } from '../value/maybe.type';
|
|
|
6
6
|
/**
|
|
7
7
|
* Function that returns a value.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type Getter<T> = () => T;
|
|
10
10
|
/**
|
|
11
11
|
* Getter with the design of returning a new value each time.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type Factory<T> = Getter<T>;
|
|
14
14
|
/**
|
|
15
15
|
* Function that returns a value with an optional single argument.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type FactoryWithInput<O, I> = (args?: I) => O;
|
|
18
18
|
/**
|
|
19
19
|
* Function that returns a value with a single argument.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type FactoryWithRequiredInput<T, A> = MapFunction<A, T>;
|
|
22
22
|
/**
|
|
23
23
|
* Either a Getter, or an instance of the item.
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type GetterOrValue<T> = T | Getter<T>;
|
|
26
26
|
/**
|
|
27
27
|
* A GetterOrValue returned from a Promise.
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export type AsyncGetterOrValue<T> = GetterOrValue<PromiseOrValue<T>>;
|
|
30
30
|
/**
|
|
31
31
|
* Either a GetterWithInput, or a Getter.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type GetterOrFactoryWithInput<T, A> = Getter<T> | FactoryWithInput<T, A>;
|
|
34
34
|
/**
|
|
35
35
|
* Types of values that can safely be retrieved via getValueFromGetter() or asGetter().
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
37
|
+
export type GetterDistinctValue = boolean | string | number | object | symbol | ClassType;
|
|
38
38
|
/**
|
|
39
39
|
* Either a GetterOrValue, or a FactoryWithInput.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
42
|
-
export
|
|
41
|
+
export type GetterOrValueWithInput<T extends GetterDistinctValue, A> = GetterOrValue<T> | FactoryWithInput<T, A>;
|
|
42
|
+
export type StringOrGetter = GetterOrValue<string>;
|
|
43
43
|
/**
|
|
44
44
|
* Returns true if the input object looks like a Getter (is a function).
|
|
45
45
|
*
|
|
@@ -68,7 +68,7 @@ export declare function asGetter<T>(input: GetterOrValue<T>): Getter<T>;
|
|
|
68
68
|
/**
|
|
69
69
|
* A factory that returns a copy of a value.
|
|
70
70
|
*/
|
|
71
|
-
export
|
|
71
|
+
export type ObjectCopyFactory<T> = Factory<T>;
|
|
72
72
|
/**
|
|
73
73
|
* Creates a getter from the input value that returns a copy of that value.
|
|
74
74
|
*
|
|
@@ -94,7 +94,7 @@ export declare function makeGetter<T>(input: T): Getter<T>;
|
|
|
94
94
|
/**
|
|
95
95
|
* A factory that can take in an index input optionally.
|
|
96
96
|
*/
|
|
97
|
-
export
|
|
97
|
+
export type FactoryWithIndex<T> = FactoryWithInput<T, number> | FactoryWithRequiredInput<T, number>;
|
|
98
98
|
export declare function makeWithFactory<T>(factory: Factory<T> | FactoryWithIndex<T>, count: number): T[];
|
|
99
99
|
export declare function makeWithFactoryInput<T, A>(factory: FactoryWithInput<T, A>, input: Maybe<A>[]): T[];
|
|
100
100
|
export declare function makeWithFactoryInput<T, A>(factory: FactoryWithRequiredInput<T, A>, input: A[]): T[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MapFunction } from '../value/map';
|
|
2
2
|
import { Getter } from './getter';
|
|
3
|
-
export
|
|
3
|
+
export type MapGetterFactory<I, O> = (input: Getter<I>) => Getter<O>;
|
|
4
4
|
/**
|
|
5
5
|
* Maps the input getter.
|
|
6
6
|
*
|
package/src/lib/getter/type.d.ts
CHANGED
package/src/lib/grouping.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface SeparateResult<T> {
|
|
|
10
10
|
export interface GroupingResult<T> {
|
|
11
11
|
[key: string]: T[];
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type KeyedGroupingResult<T, O> = {
|
|
14
14
|
[K in keyof O]: T[];
|
|
15
15
|
};
|
|
16
16
|
export interface PairsGroupingResult<T> {
|
|
@@ -37,7 +37,7 @@ export interface RestoreOrderParams<T, K extends number | string = number | stri
|
|
|
37
37
|
*/
|
|
38
38
|
excludeNewItems?: boolean;
|
|
39
39
|
}
|
|
40
|
-
export
|
|
40
|
+
export type IndexedBatch<T> = T[] & Readonly<IndexRef>;
|
|
41
41
|
/**
|
|
42
42
|
* Batches items from the input array into several batches of a maximum size.
|
|
43
43
|
*
|
package/src/lib/hash.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type HashSalt = string;
|
|
2
|
+
export type HashDecodeMap<H extends string = string, V extends string = string> = Map<H, V>;
|
|
3
3
|
export declare function decodeHashedValues(hashedValues: string[], decodeValues: string[], hashFn: (value: string) => string): string[];
|
|
4
4
|
export declare function makeHashDecodeMap(decodeValues: string[], hashFn: (value: string) => string): HashDecodeMap;
|
|
5
5
|
export declare function decodeHashedValuesWithDecodeMap(hashedValues: string[], decodeMap: HashDecodeMap): string[];
|
|
@@ -6,7 +6,7 @@ import { Maybe } from '../value/maybe.type';
|
|
|
6
6
|
*
|
|
7
7
|
* Note that strings are a valid Iterable, allowing iteration over characters.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type IterableOrValue<T> = T | Iterable<T>;
|
|
10
10
|
export declare function asIterable<T = unknown>(values: IterableOrValue<T>, treatStringAsIterable?: boolean): Iterable<T>;
|
|
11
11
|
export declare function iterableToArray<T = unknown>(values: IterableOrValue<T>, treatStringAsIterable?: boolean): T[];
|
|
12
12
|
export declare function iterableToMap<T, K extends PrimativeKey = PrimativeKey>(values: IterableOrValue<T>, readKey: ReadKeyFunction<T, K>): Map<Maybe<K>, T>;
|
package/src/lib/iterate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type IterateFn<T> = (value: T) => void | Promise<void>;
|
|
2
|
+
export type IteratePageFn<T> = (values: T[]) => void | Promise<void>;
|
|
3
3
|
/**
|
|
4
4
|
* Async iteration over the input values in-order.
|
|
5
5
|
*/
|
package/src/lib/key.d.ts
CHANGED
|
@@ -5,23 +5,23 @@ import { Maybe } from './value/maybe.type';
|
|
|
5
5
|
/**
|
|
6
6
|
* A key made up of either a string or number value.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type PrimativeKey = string | number;
|
|
9
9
|
/**
|
|
10
10
|
* A key of a type.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type FieldOfType<T> = keyof T;
|
|
13
13
|
/**
|
|
14
14
|
* Reads a key from the input object.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ReadKeyFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, Maybe<K>>;
|
|
17
17
|
/**
|
|
18
18
|
* Reads multiple keys from the input object.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type ReadMultipleKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T, K[]>;
|
|
21
21
|
/**
|
|
22
22
|
* Reads multiple keys from the input object or objects
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type ReadKeysFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<ArrayOrValue<T>, K[]>;
|
|
25
25
|
/**
|
|
26
26
|
* Creates a ReadKeysFromFunction using a ReadKeyFunction.
|
|
27
27
|
*
|
|
@@ -38,7 +38,7 @@ export declare function readKeysFrom<T, K extends PrimativeKey = PrimativeKey>(r
|
|
|
38
38
|
/**
|
|
39
39
|
* Reads all defined keys from the input objects to a Set.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type ReadKeysSetFunction<T, K extends PrimativeKey = PrimativeKey> = MapFunction<T[], Set<K>>;
|
|
42
42
|
export declare function readKeysSetFunction<T, K extends PrimativeKey = PrimativeKey>(readKey: ReadKeyFunction<T, K> | ReadMultipleKeysFunction<T, K>): ReadKeysSetFunction<T, K>;
|
|
43
43
|
/**
|
|
44
44
|
* Convenience function for reading all the keys for the input values.
|
package/src/lib/key.js
CHANGED
package/src/lib/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../../../packages/util/src/lib/key.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../../../packages/util/src/lib/key.ts"],"names":[],"mappings":"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"}
|
package/src/lib/lifecycle.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Destroyable {
|
|
|
14
14
|
/**
|
|
15
15
|
* Used for cleaning up/destroying content.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type DestroyFunction = () => void;
|
|
18
18
|
/**
|
|
19
19
|
* Retains a reference to a single destroy function. When replaced, the previous destroy function is removed.
|
|
20
20
|
*/
|
|
@@ -15,7 +15,7 @@ function mapKeysIntersectionObjectToArray(object, keys) {
|
|
|
15
15
|
keysToApply.forEach((key) => {
|
|
16
16
|
const values = object[key];
|
|
17
17
|
if (values != null) {
|
|
18
|
-
(0, array_1.
|
|
18
|
+
(0, array_1.pushItemOrArrayItemsIntoArray)(applyArray, values);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
return applyArray;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.intersection.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/map/map.intersection.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"map.intersection.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/map/map.intersection.ts"],"names":[],"mappings":";;;AAAA,0CAA6E;AAS7E;;;;;;GAMG;AACH,SAAgB,gCAAgC,CAAI,MAAoC,EAAE,IAAsB;IAC9G,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,UAAU,GAAQ,EAAE,CAAC;IAE3B,WAAW,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE3B,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,IAAA,qCAA6B,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAbD,4EAaC"}
|
package/src/lib/map/map.key.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Maybe } from '../value/maybe.type';
|
|
|
4
4
|
/**
|
|
5
5
|
* Creates a map by reading keys from the input values. Values without a key are ignored.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type KeyValueMapFactory<T, K extends PrimativeKey = PrimativeKey> = (values: T[]) => Map<K, T>;
|
|
8
8
|
/**
|
|
9
9
|
* Creates a KeyValueMapFactory with the input ReadKeyFunction.
|
|
10
10
|
*
|
|
@@ -38,7 +38,7 @@ export declare function readMultipleKeysToMap<T, K extends PrimativeKey = Primat
|
|
|
38
38
|
/**
|
|
39
39
|
* Map with an array of values for a key.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type MultiValueMap<T, K extends PrimativeKey = PrimativeKey> = Map<Maybe<K>, T[]>;
|
|
42
42
|
/**
|
|
43
43
|
* Interface for adding key/value pairs to a map that contains an array of values.
|
|
44
44
|
*/
|
|
@@ -5,17 +5,11 @@ import { AsyncMapFunction, MapFunction } from '../value/map';
|
|
|
5
5
|
/**
|
|
6
6
|
* Used to verify each id valid and available for use.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type IdBatchVerifierFunction<T> = AsyncMapFunction<MapFunction<T[], T[]>>;
|
|
9
9
|
/**
|
|
10
10
|
* Used by to verify tags have not already been taken.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
13
|
-
/**
|
|
14
|
-
* Optional function to ensure uniqueness.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated use filterUnique instead
|
|
17
|
-
*/
|
|
18
|
-
findUnique?: FilterUniqueFunction<T, K>;
|
|
12
|
+
export type IdBatchVerifier<T, K extends PrimativeKey = PrimativeKey> = {
|
|
19
13
|
/**
|
|
20
14
|
* (Optional) Use to filter unique key values.
|
|
21
15
|
*/
|
|
@@ -33,7 +27,7 @@ export interface IdBatchFactoryConfig<T, K extends PrimativeKey = PrimativeKey>
|
|
|
33
27
|
/**
|
|
34
28
|
* Used to generate valid, unused identifiers.
|
|
35
29
|
*/
|
|
36
|
-
export
|
|
30
|
+
export type IdBatchFactory<T> = AsyncArrayFactory<T>;
|
|
37
31
|
/**
|
|
38
32
|
* Creates an IdBatchFactory
|
|
39
33
|
*
|
|
@@ -12,7 +12,7 @@ const promise_loop_1 = require("../promise/promise.loop");
|
|
|
12
12
|
*/
|
|
13
13
|
function idBatchFactory(config) {
|
|
14
14
|
const { factory, verifier } = config;
|
|
15
|
-
const { maxBatchSize: tagsToGeneratePerBatch,
|
|
15
|
+
const { maxBatchSize: tagsToGeneratePerBatch, filterUnique = (x) => x, verify: verifyTags } = verifier;
|
|
16
16
|
const maxUniquenessFailures = 20; // arbitrary failure point, but generally shouldn't occur with proper input.
|
|
17
17
|
return (totalTagIdentifiersToGenerate) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const uniquenessAccumulator = []; // used for uniqueness checks
|
|
@@ -34,7 +34,7 @@ function idBatchFactory(config) {
|
|
|
34
34
|
newIds = newIds.slice(0, countToGenerate); // ignore any extra values the generator may return.
|
|
35
35
|
}
|
|
36
36
|
// add to the uniqueness acumulator to prevent further usage
|
|
37
|
-
(0, array_1.
|
|
37
|
+
(0, array_1.mergeArraysIntoArray)(uniquenessAccumulator, newIds);
|
|
38
38
|
const verifiedIds = yield verifyTags(newIds);
|
|
39
39
|
// concat identifiers
|
|
40
40
|
ids = ids.concat(verifiedIds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.batch.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/model/id.batch.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"id.batch.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/model/id.batch.ts"],"names":[],"mappings":";;;;AAAA,0CAAsD;AAItD,0DAA2D;AAiC3D;;;;;GAKG;AACH,SAAgB,cAAc,CAA2C,MAAkC;IACzG,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,EAAE,YAAY,EAAE,sBAAsB,EAAE,YAAY,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IACvG,MAAM,qBAAqB,GAAG,EAAE,CAAC,CAAC,4EAA4E;IAE9G,OAAO,CAAO,6BAAqC,EAAE,EAAE;QACrD,MAAM,qBAAqB,GAAQ,EAAE,CAAC,CAAC,6BAA6B;QAEpE,SAAe,wBAAwB,CAAC,SAAiB;;gBACvD,IAAI,GAAG,GAAQ,EAAE,CAAC;gBAElB,IAAI,iBAAiB,GAAG,CAAC,CAAC;gBAC1B,OAAO,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE;oBAC7B,MAAM,eAAe,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;oBAC/C,IAAI,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,qBAAqB,CAAC,CAAC;oBAE3E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;wBACvB,iBAAiB,IAAI,CAAC,CAAC;wBAEvB,IAAI,iBAAiB,KAAK,qBAAqB,EAAE;4BAC/C,MAAM,IAAI,KAAK,CAAC,mDAAmD,qBAAqB,oEAAoE,CAAC,CAAC;yBAC/J;wBACD,SAAS;qBACV;yBAAM,IAAI,MAAM,CAAC,MAAM,GAAG,eAAe,EAAE;wBAC1C,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,oDAAoD;qBAChG;oBAED,4DAA4D;oBAC5D,IAAA,4BAAoB,EAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;oBAEpD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;oBAE7C,qBAAqB;oBACrB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;oBAE9B,yDAAyD;iBAC1D;gBAED,OAAO,GAAG,CAAC;YACb,CAAC;SAAA;QAED,MAAM,UAAU,GAAU,MAAM,IAAA,+BAAgB,EAAI;YAClD,UAAU,EAAE,6BAA6B;YACzC,aAAa,EAAE,sBAAsB;YACrC,IAAI,EAAE,CAAO,SAAiB,EAAE,EAAE;gBAChC,MAAM,MAAM,GAAQ,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;gBAC9D,OAAO,MAAM,CAAC;YAChB,CAAC,CAAA;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAA,CAAC;AACJ,CAAC;AApDD,wCAoDC"}
|
|
@@ -6,18 +6,18 @@ import { XOR } from 'ts-essentials';
|
|
|
6
6
|
/**
|
|
7
7
|
* Type used to declare a sister-type to the generic object.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
9
|
+
export type MappedModelData<I extends object, R extends object> = MergeReplace<I, R>;
|
|
10
|
+
export type TypedMappedModelData<I extends object, O extends object, X = any> = ReplaceType<I, O, X>;
|
|
11
|
+
export type ModelMapFunction<I extends object, O extends object> = ApplyMapFunctionWithOptions<Maybe<I>, O, ModelConversionOptions<I>>;
|
|
12
|
+
export type ModelMapFromFunction<V extends object, D extends object> = ModelMapFunction<D, V>;
|
|
13
|
+
export type ModelMapToFunction<V extends object, D extends object> = ModelMapFunction<V, D>;
|
|
14
14
|
export interface ModelMapFunctions<V extends object, D extends object> {
|
|
15
15
|
from: ModelMapFromFunction<V, D>;
|
|
16
16
|
to: ModelMapToFunction<V, D>;
|
|
17
17
|
}
|
|
18
18
|
export declare function makeModelMapFunctions<V extends object, D extends object>(fields: ModelFieldConversions<V, D>): ModelMapFunctions<V, D>;
|
|
19
|
-
export
|
|
20
|
-
export
|
|
19
|
+
export type ModelConversionFieldTuple<I extends object> = [keyof I, ModelFieldMapFunction<unknown, unknown>];
|
|
20
|
+
export type ModelConversionFieldValuesConfig<I extends object> = ModelConversionFieldTuple<I>[];
|
|
21
21
|
export interface ModelConversionOptions<I extends object> {
|
|
22
22
|
/**
|
|
23
23
|
* Fields to include.
|
|
@@ -31,30 +31,30 @@ export interface ModelConversionOptions<I extends object> {
|
|
|
31
31
|
/**
|
|
32
32
|
* A model conversion function. Performs a conversion on all non-null values.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type ModelConversionFieldValuesFunction<I extends object, O extends object> = ApplyMapFunctionWithOptions<Maybe<I>, O, ModelConversionOptions<I>>;
|
|
35
35
|
export declare function makeModelConversionFieldValuesFunction<I extends object, O extends object>(fields: ModelConversionFieldValuesConfig<I>): ModelConversionFieldValuesFunction<I, O>;
|
|
36
36
|
/**
|
|
37
37
|
* An object map containing a ModelFieldMapFunctions entry for each key (required and optional) from the generic object.
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export type ModelFieldConversions<V extends object, D extends object> = Required<{
|
|
40
40
|
[K in keyof V]: ModelFieldMapFunctions<V[K], TypedMappedModelData<V, D>[K]>;
|
|
41
41
|
}>;
|
|
42
42
|
/**
|
|
43
43
|
* An object map containing a ModelFieldMapFunctionsConfig for each key (required and optional) from the generic object.
|
|
44
44
|
*/
|
|
45
|
-
export
|
|
45
|
+
export type ModelFieldConversionsConfig<V extends object, D extends object> = Required<{
|
|
46
46
|
[K in keyof V]: ModelFieldMapFunctionsConfig<V[K], TypedMappedModelData<V, D>[K]>;
|
|
47
47
|
}>;
|
|
48
48
|
export declare function modelFieldConversions<V extends object, D extends object>(config: ModelFieldConversionsConfig<V, D>): ModelFieldConversions<V, D>;
|
|
49
|
-
export
|
|
49
|
+
export type ModelFieldMapFunctions<I = unknown, O = unknown> = {
|
|
50
50
|
readonly from: ModelFieldMapFromFunction<I, O>;
|
|
51
51
|
readonly to: ModelFieldMapToFunction<I, O>;
|
|
52
52
|
};
|
|
53
|
-
export
|
|
53
|
+
export type ModelFieldMapFunctionsConfig<I = unknown, O = unknown> = {
|
|
54
54
|
readonly from: ModelFieldMapFromConfig<I, O>;
|
|
55
55
|
readonly to: ModelFieldMapToConfig<I, O>;
|
|
56
56
|
};
|
|
57
|
-
export
|
|
57
|
+
export type ModelFieldMapFunctionsWithDefaultsConfig<I = unknown, O = unknown> = {
|
|
58
58
|
readonly from: ModelFieldMapFromWithDefaultConfig<I, O>;
|
|
59
59
|
readonly to: ModelFieldMapToWithDefaultConfig<I, O>;
|
|
60
60
|
};
|
|
@@ -62,34 +62,34 @@ export declare function modelFieldMapFunctions<I = unknown, O = unknown>(config:
|
|
|
62
62
|
/**
|
|
63
63
|
* ModelFieldMapFunction configuration that can convert a MaybeValue to the target value.
|
|
64
64
|
*/
|
|
65
|
-
export
|
|
65
|
+
export type ModelFieldMapMaybeTooConfig<I, O> = {
|
|
66
66
|
convertMaybe: ModelFieldMapConvertMaybeFunction<I, O>;
|
|
67
67
|
};
|
|
68
|
-
export
|
|
68
|
+
export type ModelFieldMapMaybeWithDefaultValueConfig<I, O> = {
|
|
69
69
|
defaultInput: GetterOrValue<I>;
|
|
70
70
|
convert: ModelFieldMapConvertFunction<I, O>;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
72
|
+
export type ModelFieldMapMaybeWithDefaultDataConfig<I, O> = {
|
|
73
73
|
convert: ModelFieldMapConvertFunction<I, O>;
|
|
74
74
|
default: GetterOrValue<O>;
|
|
75
75
|
};
|
|
76
|
-
export
|
|
77
|
-
export
|
|
76
|
+
export type ModelFieldMapConvertMaybeFunction<I, O> = MapFunction<Maybe<I>, O>;
|
|
77
|
+
export type ModelFieldMapConvertFunction<I, O> = MapFunction<MaybeSo<I>, O>;
|
|
78
78
|
/**
|
|
79
79
|
* ModelFieldMapFunction configuration that handles the MaybeNot case with undefined.
|
|
80
80
|
*/
|
|
81
|
-
export
|
|
81
|
+
export type ModelFieldMapMaybeWithDefaultConfig<I, O> = ModelFieldMapMaybeWithDefaultValueConfig<I, O> | ModelFieldMapMaybeWithDefaultDataConfig<I, O>;
|
|
82
82
|
/**
|
|
83
83
|
* Configuration is either a ModelFieldMapMaybeTooConfig or a ModelFieldMapMaybeWithDefaultConfig
|
|
84
84
|
*/
|
|
85
|
-
export
|
|
86
|
-
export
|
|
87
|
-
export
|
|
88
|
-
export
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
export
|
|
85
|
+
export type ModelFieldMapConfig<I, O> = XOR<ModelFieldMapMaybeTooConfig<I, O>, ModelFieldMapMaybeWithDefaultConfig<I, O>>;
|
|
86
|
+
export type ModelFieldMapFromConfig<I = unknown, O = unknown> = ModelFieldMapConfig<O, I>;
|
|
87
|
+
export type ModelFieldMapToConfig<I = unknown, O = unknown> = ModelFieldMapConfig<I, O>;
|
|
88
|
+
export type ModelFieldMapFromWithDefaultConfig<I = unknown, O = unknown> = ModelFieldMapMaybeWithDefaultConfig<O, I>;
|
|
89
|
+
export type ModelFieldMapToWithDefaultConfig<I = unknown, O = unknown> = ModelFieldMapMaybeWithDefaultConfig<I, O>;
|
|
90
|
+
export type ModelFieldMapFunction<I = unknown, O = unknown> = MapFunction<Maybe<I>, O>;
|
|
91
|
+
export type ModelFieldMapFromFunction<I, O> = ModelFieldMapFunction<O, I>;
|
|
92
|
+
export type ModelFieldMapToFunction<I, O> = ModelFieldMapFunction<I, O>;
|
|
93
93
|
/**
|
|
94
94
|
* Creates a ModelFieldMapFunction.
|
|
95
95
|
*
|
|
@@ -97,13 +97,13 @@ export declare type ModelFieldMapToFunction<I, O> = ModelFieldMapFunction<I, O>;
|
|
|
97
97
|
* @returns
|
|
98
98
|
*/
|
|
99
99
|
export declare function modelFieldMapFunction<I, O>(config: ModelFieldMapConfig<I, O>): ModelFieldMapFunction<I, O>;
|
|
100
|
-
export
|
|
100
|
+
export type ModelFieldConversionsConfigRef<T extends object, O extends object> = {
|
|
101
101
|
readonly fields: ModelFieldConversionsConfig<T, O>;
|
|
102
102
|
};
|
|
103
|
-
export
|
|
103
|
+
export type ModelFieldConversionsRef<T extends object, O extends object> = {
|
|
104
104
|
readonly fieldConversions: ModelFieldConversions<T, O>;
|
|
105
105
|
};
|
|
106
|
-
export
|
|
106
|
+
export type ToModelFieldConversionsInput<T extends object, O extends object> = ModelFieldConversionsConfigRef<T, O> | ModelFieldConversionsRef<T, O>;
|
|
107
107
|
/**
|
|
108
108
|
* Converts the input to a ModelFieldConversions value.
|
|
109
109
|
*
|
|
@@ -111,8 +111,8 @@ export declare type ToModelFieldConversionsInput<T extends object, O extends obj
|
|
|
111
111
|
* @returns
|
|
112
112
|
*/
|
|
113
113
|
export declare function toModelFieldConversions<T extends object, O extends object>(input: ToModelFieldConversionsInput<T, O>): Required<{ [K in keyof T]: ModelFieldMapFunctions<T[K], ReplaceType<T, O, any>[K]>; }>;
|
|
114
|
-
export
|
|
114
|
+
export type ModelMapFunctionsRef<T extends object, O extends object> = {
|
|
115
115
|
readonly mapFunctions: ModelMapFunctions<T, O>;
|
|
116
116
|
};
|
|
117
|
-
export
|
|
117
|
+
export type ToModelMapFunctionsInput<T extends object, O extends object> = ToModelFieldConversionsInput<T, O> | ModelMapFunctionsRef<T, O>;
|
|
118
118
|
export declare function toModelMapFunctions<T extends object, O extends object>(input: ToModelMapFunctionsInput<T, O>): ModelMapFunctions<T, O>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Maybe } from '../value/maybe.type';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type CopySelectModelFieldsConfig<T = unknown> = Partial<CopyModelFieldsConfig<T>>;
|
|
3
|
+
export type CopyModelFieldsConfig<T = unknown> = {
|
|
4
4
|
[K in keyof T]: Maybe<CopyModelFieldConfig>;
|
|
5
5
|
};
|
|
6
6
|
export interface CopyModelFieldConfig<V = unknown> {
|
|
@@ -12,5 +12,5 @@ export interface CopyModelFieldConfig<V = unknown> {
|
|
|
12
12
|
/**
|
|
13
13
|
* Used for copying one field from one partial object to a target object.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type CopyModelFieldFunction<T> = (from: Partial<T>, target: Partial<T>) => void;
|
|
16
16
|
export declare function makeCopyModelFieldFunction<T extends object>(key: keyof T, inputConfig?: Maybe<CopyModelFieldConfig>): CopyModelFieldFunction<T>;
|
package/src/lib/model/model.d.ts
CHANGED
|
@@ -4,15 +4,15 @@ import { MapFunction } from '../value/map';
|
|
|
4
4
|
/**
|
|
5
5
|
* A string model key
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type ModelKey = string;
|
|
8
8
|
/**
|
|
9
9
|
* Arbitrary model type.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type ModelTypeString = string;
|
|
12
12
|
/**
|
|
13
13
|
* String model key from which the model's type can be inferred from.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type TypedModelKey = string;
|
|
16
16
|
export declare const DEFAULT_UNKNOWN_MODEL_TYPE_STRING: ModelTypeString;
|
|
17
17
|
/**
|
|
18
18
|
* A model with an identifier on the "id" key.
|
|
@@ -29,17 +29,17 @@ export interface NamedUniqueModel extends UniqueModel {
|
|
|
29
29
|
export interface ModelKeyRef {
|
|
30
30
|
key: ModelKey;
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export type ModelOrKey<T> = T | ModelKey;
|
|
33
33
|
/**
|
|
34
34
|
* ModelOrKey where the model extends UniqueModel
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type UniqueModelOrKey<T extends UniqueModel> = ModelOrKey<T>;
|
|
37
37
|
export interface ModelKeyTypePair<M extends ModelTypeString = ModelTypeString> extends TypedModel<M>, ModelKeyRef {
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* An encoded ModelKeyTypePair.
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type ModelKeyTypePairString = string;
|
|
43
43
|
export interface ModelKeyNamePair extends Pick<ModelKeyTypePair, 'key'> {
|
|
44
44
|
name?: string;
|
|
45
45
|
}
|
|
@@ -49,10 +49,10 @@ export interface ReadModelKeyParams<T> {
|
|
|
49
49
|
required?: boolean;
|
|
50
50
|
read: ReadModelKeyFunction<T>;
|
|
51
51
|
}
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
52
|
+
export type ReadModelKeyFunction<T> = ReadKeyFunction<T, ModelKey>;
|
|
53
|
+
export type ReadModelTypeFunction<T, M extends ModelTypeString = ModelTypeString> = ReadKeyFunction<T, M>;
|
|
54
|
+
export type ReadRelationKeysFunction<T> = ReadMultipleKeysFunction<T, ModelKey>;
|
|
55
|
+
export type MultiModelKeyMap<T> = Map<string, T>;
|
|
56
56
|
export declare const readUniqueModelKey: (model: UniqueModel) => string | undefined;
|
|
57
57
|
export declare abstract class AbstractUniqueModel {
|
|
58
58
|
id?: ModelKey;
|
|
@@ -96,5 +96,5 @@ export interface ModelTypeDataPair<T = unknown, M extends ModelTypeString = Mode
|
|
|
96
96
|
/**
|
|
97
97
|
* Used for converting the input data into a ModelTypeDataPair value.
|
|
98
98
|
*/
|
|
99
|
-
export
|
|
99
|
+
export type ModelTypeDataPairFactory<T, M extends ModelTypeString = ModelTypeString> = MapFunction<T, ModelTypeDataPair<T, M>>;
|
|
100
100
|
export declare function modelTypeDataPairFactory<T, M extends ModelTypeString = ModelTypeString>(typeReader: ReadModelTypeFunction<T, M>, defaultType?: string): ModelTypeDataPairFactory<T, M>;
|
|
@@ -2,14 +2,14 @@ import { ArrayOrValue } from '../array/array';
|
|
|
2
2
|
import { Maybe, MaybeMap } from '../value/maybe.type';
|
|
3
3
|
import { ModifierFunction } from '../value/modifier';
|
|
4
4
|
import { ModelMapFunction, ModelMapFunctions } from './model.conversion';
|
|
5
|
-
export
|
|
5
|
+
export type ModelInputDataModifier<D extends object> = {
|
|
6
6
|
modifyData: ModifierFunction<D>;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ModelInputModelModifier<V extends object> = {
|
|
9
9
|
modifyModel: ModifierFunction<V>;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type ModelModifier<V extends object, D extends object> = ModelInputModelModifier<V> & ModelInputDataModifier<D>;
|
|
12
|
+
export type PartialModelModifier<V extends object, D extends object> = Partial<MaybeMap<ModelModifier<V, D>>>;
|
|
13
13
|
export declare function maybeMergeModelModifiers<V extends object, D extends object>(input: ArrayOrValue<PartialModelModifier<V, D>>): PartialModelModifier<V, D>;
|
|
14
14
|
export interface ModifyModelMapFunctionsConfig<V extends object, D extends object> {
|
|
15
15
|
readonly mapFunctions: ModelMapFunctions<V, D>;
|