mobx-state-tree 3.12.2 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -23
- package/dist/core/action.d.ts +50 -48
- package/dist/core/actionContext.d.ts +27 -0
- package/dist/core/flow.d.ts +14 -30
- package/dist/core/json-patch.d.ts +36 -36
- package/dist/core/mst-operations.d.ts +451 -444
- package/dist/core/node/BaseNode.d.ts +1 -1
- package/dist/core/node/Hook.d.ts +17 -1
- package/dist/core/node/create-node.d.ts +1 -1
- package/dist/core/node/identifier-cache.d.ts +1 -1
- package/dist/core/node/livelinessChecking.d.ts +37 -37
- package/dist/core/node/node-utils.d.ts +28 -28
- package/dist/core/node/object-node.d.ts +1 -1
- package/dist/core/node/scalar-node.d.ts +1 -1
- package/dist/core/process.d.ts +45 -45
- package/dist/core/type/type-checker.d.ts +30 -30
- package/dist/core/type/type.d.ts +162 -177
- package/dist/index.d.ts +3 -3
- package/dist/internal.d.ts +37 -35
- package/dist/middlewares/create-action-tracking-middleware.d.ts +24 -22
- package/dist/middlewares/createActionTrackingMiddleware2.d.ts +34 -0
- package/dist/middlewares/on-action.d.ts +87 -79
- package/dist/mobx-state-tree.js +6285 -5985
- package/dist/mobx-state-tree.min.js +16 -1
- package/dist/mobx-state-tree.module.js +6234 -5938
- package/dist/mobx-state-tree.umd.js +6263 -5985
- package/dist/mobx-state-tree.umd.min.js +16 -1
- package/dist/types/complex-types/array.d.ts +52 -51
- package/dist/types/complex-types/map.d.ts +80 -79
- package/dist/types/complex-types/model.d.ts +133 -125
- package/dist/types/index.d.ts +29 -29
- package/dist/types/primitives.d.ts +81 -81
- package/dist/types/utility-types/custom.d.ts +60 -60
- package/dist/types/utility-types/enumeration.d.ts +5 -5
- package/dist/types/utility-types/frozen.d.ts +11 -11
- package/dist/types/utility-types/identifier.d.ts +44 -44
- package/dist/types/utility-types/late.d.ts +10 -10
- package/dist/types/utility-types/literal.d.ts +25 -25
- package/dist/types/utility-types/maybe.d.ts +26 -26
- package/dist/types/utility-types/optional.d.ts +20 -20
- package/dist/types/utility-types/reference.d.ts +41 -47
- package/dist/types/utility-types/refinement.d.ts +10 -10
- package/dist/types/utility-types/snapshotProcessor.d.ts +61 -61
- package/dist/types/utility-types/union.d.ts +55 -55
- package/dist/utils.d.ts +4 -4
- package/package.json +16 -12
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
|
|
2
|
-
import { IAnyType, IType,
|
|
3
|
-
/** @hidden */
|
|
4
|
-
export interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* s
|
|
65
|
-
* s.todos.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
|
|
2
|
+
import { IAnyType, IType, ExtractCSTWithSTN, IHooksGetter } from "../../internal";
|
|
3
|
+
/** @hidden */
|
|
4
|
+
export interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<IT["CreationType"]> | undefined, IKeyValueMap<IT["SnapshotType"]>, IMSTMap<IT>> {
|
|
5
|
+
hooks(hooks: IHooksGetter<IMSTMap<IT>>): IMapType<IT>;
|
|
6
|
+
}
|
|
7
|
+
/** @hidden */
|
|
8
|
+
export interface IMSTMap<IT extends IAnyType> {
|
|
9
|
+
clear(): void;
|
|
10
|
+
delete(key: string): boolean;
|
|
11
|
+
forEach(callbackfn: (value: IT["Type"], key: string, map: this) => void, thisArg?: any): void;
|
|
12
|
+
get(key: string): IT["Type"] | undefined;
|
|
13
|
+
has(key: string): boolean;
|
|
14
|
+
set(key: string, value: ExtractCSTWithSTN<IT>): this;
|
|
15
|
+
readonly size: number;
|
|
16
|
+
put(value: ExtractCSTWithSTN<IT>): IT["Type"];
|
|
17
|
+
keys(): IterableIterator<string>;
|
|
18
|
+
values(): IterableIterator<IT["Type"]>;
|
|
19
|
+
entries(): IterableIterator<[string, IT["Type"]]>;
|
|
20
|
+
[Symbol.iterator](): IterableIterator<[string, IT["Type"]]>;
|
|
21
|
+
/** Merge another object into this map, returns self. */
|
|
22
|
+
merge(other: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
|
|
23
|
+
replace(values: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a plain object that represents this map.
|
|
26
|
+
* Note that all the keys being stringified.
|
|
27
|
+
* If there are duplicating keys after converting them to strings, behaviour is undetermined.
|
|
28
|
+
*/
|
|
29
|
+
toPOJO(): IKeyValueMap<IT["SnapshotType"]>;
|
|
30
|
+
toJSON(): IKeyValueMap<IT["SnapshotType"]>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns a shallow non observable object clone of this map.
|
|
33
|
+
* Note that the values might still be observable. For a deep clone use mobx.toJS.
|
|
34
|
+
*/
|
|
35
|
+
toJS(): Map<string, IT["Type"]>;
|
|
36
|
+
toString(): string;
|
|
37
|
+
[Symbol.toStringTag]: "Map";
|
|
38
|
+
/**
|
|
39
|
+
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
40
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
41
|
+
* for callback details
|
|
42
|
+
*/
|
|
43
|
+
observe(listener: (changes: IMapDidChange<string, IT["Type"]>) => void, fireImmediately?: boolean): Lambda;
|
|
44
|
+
intercept(handler: IInterceptor<IMapWillChange<string, IT["Type"]>>): Lambda;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* `types.map` - Creates a key based collection type who's children are all of a uniform declared type.
|
|
48
|
+
* If the type stored in a map has an identifier, it is mandatory to store the child under that identifier in the map.
|
|
49
|
+
*
|
|
50
|
+
* This type will always produce [observable maps](https://mobx.js.org/refguide/map.html)
|
|
51
|
+
*
|
|
52
|
+
* Example:
|
|
53
|
+
* ```ts
|
|
54
|
+
* const Todo = types.model({
|
|
55
|
+
* id: types.identifier,
|
|
56
|
+
* task: types.string
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* const TodoStore = types.model({
|
|
60
|
+
* todos: types.map(Todo)
|
|
61
|
+
* })
|
|
62
|
+
*
|
|
63
|
+
* const s = TodoStore.create({ todos: {} })
|
|
64
|
+
* unprotect(s)
|
|
65
|
+
* s.todos.set(17, { task: "Grab coffee", id: 17 })
|
|
66
|
+
* s.todos.put({ task: "Grab cookie", id: 18 }) // put will infer key from the identifier
|
|
67
|
+
* console.log(s.todos.get(17).task) // prints: "Grab coffee"
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param subtype
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export declare function map<IT extends IAnyType>(subtype: IT): IMapType<IT>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns if a given value represents a map type.
|
|
76
|
+
*
|
|
77
|
+
* @param type
|
|
78
|
+
* @returns `true` if it is a map type.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isMapType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IMapType<Items>;
|
|
@@ -1,125 +1,133 @@
|
|
|
1
|
-
import { IAnyType, IType,
|
|
2
|
-
/** @hidden */
|
|
3
|
-
export interface ModelProperties {
|
|
4
|
-
[key: string]: IAnyType;
|
|
5
|
-
}
|
|
6
|
-
/** @hidden */
|
|
7
|
-
export declare type ModelPrimitive = string | number | boolean | Date;
|
|
8
|
-
/** @hidden */
|
|
9
|
-
export interface ModelPropertiesDeclaration {
|
|
10
|
-
[key: string]: ModelPrimitive | IAnyType;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Unmaps syntax property declarations to a map of { propName: IType }
|
|
14
|
-
*
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = {
|
|
18
|
-
[
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @hidden
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
export declare type
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
export declare
|
|
104
|
-
|
|
105
|
-
export declare
|
|
106
|
-
export declare function
|
|
107
|
-
export declare function
|
|
108
|
-
|
|
109
|
-
export declare
|
|
110
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB
|
|
111
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB
|
|
112
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC
|
|
113
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC
|
|
114
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD
|
|
115
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD
|
|
116
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE
|
|
117
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE
|
|
118
|
-
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
export declare function
|
|
1
|
+
import { IAnyType, IType, _CustomOrOther, _NotCustomized, Instance } from "../../internal";
|
|
2
|
+
/** @hidden */
|
|
3
|
+
export interface ModelProperties {
|
|
4
|
+
[key: string]: IAnyType;
|
|
5
|
+
}
|
|
6
|
+
/** @hidden */
|
|
7
|
+
export declare type ModelPrimitive = string | number | boolean | Date;
|
|
8
|
+
/** @hidden */
|
|
9
|
+
export interface ModelPropertiesDeclaration {
|
|
10
|
+
[key: string]: ModelPrimitive | IAnyType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Unmaps syntax property declarations to a map of { propName: IType }
|
|
14
|
+
*
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = T extends {
|
|
18
|
+
[k: string]: IAnyType;
|
|
19
|
+
} ? T : {
|
|
20
|
+
[K in keyof T]: T[K] extends IAnyType ? T[K] : T[K] extends string ? IType<string | undefined, string, string> : T[K] extends number ? IType<number | undefined, number, number> : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> : T[K] extends Date ? IType<number | Date | undefined, number, Date> : never;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a value is optional (undefined, any or unknown).
|
|
24
|
+
* @hidden
|
|
25
|
+
*
|
|
26
|
+
* Examples:
|
|
27
|
+
* - string = false
|
|
28
|
+
* - undefined = true
|
|
29
|
+
* - string | undefined = true
|
|
30
|
+
* - string & undefined = false, but we don't care
|
|
31
|
+
* - any = true
|
|
32
|
+
* - unknown = true
|
|
33
|
+
*/
|
|
34
|
+
declare type IsOptionalValue<C, TV, FV> = undefined extends C ? TV : FV;
|
|
35
|
+
/**
|
|
36
|
+
* Name of the properties of an object that can't be set to undefined, any or unknown
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
declare type DefinablePropsNames<T> = {
|
|
40
|
+
[K in keyof T]: IsOptionalValue<T[K], never, K>;
|
|
41
|
+
}[keyof T];
|
|
42
|
+
/** @hidden */
|
|
43
|
+
export declare const $nonEmptyObject: unique symbol;
|
|
44
|
+
/** @hidden */
|
|
45
|
+
export interface NonEmptyObject {
|
|
46
|
+
[$nonEmptyObject]?: any;
|
|
47
|
+
}
|
|
48
|
+
/** @hidden */
|
|
49
|
+
export declare type ExtractCFromProps<P extends ModelProperties> = {
|
|
50
|
+
[k in keyof P]: P[k]["CreationType"];
|
|
51
|
+
};
|
|
52
|
+
/** @hidden */
|
|
53
|
+
export declare type ModelCreationType<PC> = {
|
|
54
|
+
[P in DefinablePropsNames<PC>]: PC[P];
|
|
55
|
+
} & Partial<PC> & NonEmptyObject;
|
|
56
|
+
/** @hidden */
|
|
57
|
+
export declare type ModelCreationType2<P extends ModelProperties, CustomC> = _CustomOrOther<CustomC, ModelCreationType<ExtractCFromProps<P>>>;
|
|
58
|
+
/** @hidden */
|
|
59
|
+
export declare type ModelSnapshotType<P extends ModelProperties> = {
|
|
60
|
+
[K in keyof P]: P[K]["SnapshotType"];
|
|
61
|
+
} & NonEmptyObject;
|
|
62
|
+
/** @hidden */
|
|
63
|
+
export declare type ModelSnapshotType2<P extends ModelProperties, CustomS> = _CustomOrOther<CustomS, ModelSnapshotType<P>>;
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
* we keep this separate from ModelInstanceType to shorten model instance types generated declarations
|
|
67
|
+
*/
|
|
68
|
+
export declare type ModelInstanceTypeProps<P extends ModelProperties> = {
|
|
69
|
+
[K in keyof P]: P[K]["Type"];
|
|
70
|
+
} & NonEmptyObject;
|
|
71
|
+
/**
|
|
72
|
+
* @hidden
|
|
73
|
+
* do not transform this to an interface or model instance type generated declarations will be longer
|
|
74
|
+
*/
|
|
75
|
+
export declare type ModelInstanceType<P extends ModelProperties, O> = ModelInstanceTypeProps<P> & O;
|
|
76
|
+
/** @hidden */
|
|
77
|
+
export interface ModelActions {
|
|
78
|
+
[key: string]: Function;
|
|
79
|
+
}
|
|
80
|
+
export interface IModelType<PROPS extends ModelProperties, OTHERS, CustomC = _NotCustomized, CustomS = _NotCustomized> extends IType<ModelCreationType2<PROPS, CustomC>, ModelSnapshotType2<PROPS, CustomS>, ModelInstanceType<PROPS, OTHERS>> {
|
|
81
|
+
readonly properties: PROPS;
|
|
82
|
+
named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>;
|
|
83
|
+
props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<PROPS & ModelPropertiesDeclarationToProperties<PROPS2>, OTHERS, CustomC, CustomS>;
|
|
84
|
+
views<V extends Object>(fn: (self: Instance<this>) => V): IModelType<PROPS, OTHERS & V, CustomC, CustomS>;
|
|
85
|
+
actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS, OTHERS & A, CustomC, CustomS>;
|
|
86
|
+
volatile<TP extends object>(fn: (self: Instance<this>) => TP): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>;
|
|
87
|
+
extend<A extends ModelActions = {}, V extends Object = {}, VS extends Object = {}>(fn: (self: Instance<this>) => {
|
|
88
|
+
actions?: A;
|
|
89
|
+
views?: V;
|
|
90
|
+
state?: VS;
|
|
91
|
+
}): IModelType<PROPS, OTHERS & A & V & VS, CustomC, CustomS>;
|
|
92
|
+
/** @deprecated See `types.snapshotProcessor` */
|
|
93
|
+
preProcessSnapshot<NewC = ModelCreationType2<PROPS, CustomC>>(fn: (snapshot: NewC) => ModelCreationType2<PROPS, CustomC>): IModelType<PROPS, OTHERS, NewC, CustomS>;
|
|
94
|
+
/** @deprecated See `types.snapshotProcessor` */
|
|
95
|
+
postProcessSnapshot<NewS = ModelSnapshotType2<PROPS, CustomS>>(fn: (snapshot: ModelSnapshotType2<PROPS, CustomS>) => NewS): IModelType<PROPS, OTHERS, CustomC, NewS>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Any model type.
|
|
99
|
+
*/
|
|
100
|
+
export interface IAnyModelType extends IModelType<any, any, any, any> {
|
|
101
|
+
}
|
|
102
|
+
/** @hidden */
|
|
103
|
+
export declare type ExtractProps<T extends IAnyModelType> = T extends IModelType<infer P, any, any, any> ? P : never;
|
|
104
|
+
/** @hidden */
|
|
105
|
+
export declare type ExtractOthers<T extends IAnyModelType> = T extends IModelType<any, infer O, any, any> ? O : never;
|
|
106
|
+
export declare function model<P extends ModelPropertiesDeclaration = {}>(name: string, properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
|
|
107
|
+
export declare function model<P extends ModelPropertiesDeclaration = {}>(properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
|
|
108
|
+
/** @hidden */
|
|
109
|
+
export declare type _CustomJoin<A, B> = A extends _NotCustomized ? B : A & B;
|
|
110
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
|
|
111
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
|
|
112
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
|
|
113
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
|
|
114
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
|
|
115
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
|
|
116
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
|
|
117
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
|
|
118
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
|
|
119
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
|
|
120
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
|
|
121
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
|
|
122
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
|
|
123
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
|
|
124
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
|
|
125
|
+
export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
|
|
126
|
+
/**
|
|
127
|
+
* Returns if a given value represents a model type.
|
|
128
|
+
*
|
|
129
|
+
* @param type
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
export declare function isModelType<IT extends IAnyModelType = IAnyModelType>(type: IAnyType): type is IT;
|
|
133
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { enumeration, model, compose, custom, reference, safeReference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late, snapshotProcessor } from "../internal";
|
|
2
|
-
export declare const types: {
|
|
3
|
-
enumeration: typeof enumeration;
|
|
4
|
-
model: typeof model;
|
|
5
|
-
compose: typeof compose;
|
|
6
|
-
custom: typeof custom;
|
|
7
|
-
reference: typeof reference;
|
|
8
|
-
safeReference: typeof safeReference;
|
|
9
|
-
union: typeof union;
|
|
10
|
-
optional: typeof optional;
|
|
11
|
-
literal: typeof literal;
|
|
12
|
-
maybe: typeof maybe;
|
|
13
|
-
maybeNull: typeof maybeNull;
|
|
14
|
-
refinement: typeof refinement;
|
|
15
|
-
string: import("../internal").ISimpleType<string>;
|
|
16
|
-
boolean: import("../internal").ISimpleType<boolean>;
|
|
17
|
-
number: import("../internal").ISimpleType<number>;
|
|
18
|
-
integer: import("../internal").ISimpleType<number>;
|
|
19
|
-
Date: import("../internal").IType<number | Date, number, Date>;
|
|
20
|
-
map: typeof map;
|
|
21
|
-
array: typeof array;
|
|
22
|
-
frozen: typeof frozen;
|
|
23
|
-
identifier: import("../internal").ISimpleType<string>;
|
|
24
|
-
identifierNumber: import("../internal").ISimpleType<number>;
|
|
25
|
-
late: typeof late;
|
|
26
|
-
undefined: import("../internal").ISimpleType<undefined>;
|
|
27
|
-
null: import("../internal").ISimpleType<null>;
|
|
28
|
-
snapshotProcessor: typeof snapshotProcessor;
|
|
29
|
-
};
|
|
1
|
+
import { enumeration, model, compose, custom, reference, safeReference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late, snapshotProcessor } from "../internal";
|
|
2
|
+
export declare const types: {
|
|
3
|
+
enumeration: typeof enumeration;
|
|
4
|
+
model: typeof model;
|
|
5
|
+
compose: typeof compose;
|
|
6
|
+
custom: typeof custom;
|
|
7
|
+
reference: typeof reference;
|
|
8
|
+
safeReference: typeof safeReference;
|
|
9
|
+
union: typeof union;
|
|
10
|
+
optional: typeof optional;
|
|
11
|
+
literal: typeof literal;
|
|
12
|
+
maybe: typeof maybe;
|
|
13
|
+
maybeNull: typeof maybeNull;
|
|
14
|
+
refinement: typeof refinement;
|
|
15
|
+
string: import("../internal").ISimpleType<string>;
|
|
16
|
+
boolean: import("../internal").ISimpleType<boolean>;
|
|
17
|
+
number: import("../internal").ISimpleType<number>;
|
|
18
|
+
integer: import("../internal").ISimpleType<number>;
|
|
19
|
+
Date: import("../internal").IType<number | Date, number, Date>;
|
|
20
|
+
map: typeof map;
|
|
21
|
+
array: typeof array;
|
|
22
|
+
frozen: typeof frozen;
|
|
23
|
+
identifier: import("../internal").ISimpleType<string>;
|
|
24
|
+
identifierNumber: import("../internal").ISimpleType<number>;
|
|
25
|
+
late: typeof late;
|
|
26
|
+
undefined: import("../internal").ISimpleType<undefined>;
|
|
27
|
+
null: import("../internal").ISimpleType<null>;
|
|
28
|
+
snapshotProcessor: typeof snapshotProcessor;
|
|
29
|
+
};
|