mobx-state-tree 5.4.1 → 5.4.2-pre.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/dist/core/action.d.ts +2 -2
- package/dist/core/flow.d.ts +1 -1
- package/dist/core/mst-operations.d.ts +1 -1
- package/dist/core/node/Hook.d.ts +1 -1
- package/dist/core/node/livelinessChecking.d.ts +2 -2
- package/dist/core/node/node-utils.d.ts +1 -1
- package/dist/core/type/type-checker.d.ts +2 -2
- package/dist/core/type/type.d.ts +8 -8
- package/dist/mobx-state-tree.js +116 -108
- package/dist/mobx-state-tree.min.js +1 -16
- package/dist/mobx-state-tree.module.js +116 -108
- package/dist/mobx-state-tree.umd.js +118 -110
- package/dist/mobx-state-tree.umd.min.js +1 -16
- package/dist/types/complex-types/model.d.ts +20 -25
- package/dist/types/utility-types/enumeration.d.ts +3 -3
- package/dist/types/utility-types/identifier.d.ts +1 -1
- package/dist/types/utility-types/optional.d.ts +3 -3
- package/dist/types/utility-types/reference.d.ts +4 -4
- package/dist/types/utility-types/snapshotProcessor.d.ts +1 -1
- package/dist/types/utility-types/union.d.ts +7 -37
- package/dist/utils.d.ts +1 -1
- package/package.json +14 -14
package/dist/core/action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDisposer, IAnyStateTreeNode, IActionContext } from "../internal";
|
|
2
|
-
export
|
|
2
|
+
export type IMiddlewareEventType = "action" | "flow_spawn" | "flow_resume" | "flow_resume_error" | "flow_return" | "flow_throw";
|
|
3
3
|
export interface IMiddlewareEvent extends IActionContext {
|
|
4
4
|
/** Event type */
|
|
5
5
|
readonly type: IMiddlewareEventType;
|
|
@@ -16,7 +16,7 @@ export interface FunctionWithFlag extends Function {
|
|
|
16
16
|
_isMSTAction?: boolean;
|
|
17
17
|
_isFlowAction?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type IMiddlewareHandler = (actionCall: IMiddlewareEvent, next: (actionCall: IMiddlewareEvent, callback?: (value: any) => any) => void, abort: (value: any) => void) => any;
|
|
20
20
|
/**
|
|
21
21
|
* Middleware can be used to intercept any action is invoked on the subtree where it is attached.
|
|
22
22
|
* If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.
|
package/dist/core/flow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAnyStateTreeNode, IType, IAnyModelType, IStateTreeNode, IJsonPatch, IDisposer, IAnyType, ReferenceIdentifier, TypeOfValue, IActionContext, IAnyComplexType } from "../internal";
|
|
2
2
|
/** @hidden */
|
|
3
|
-
export
|
|
3
|
+
export type TypeOrStateTreeNodeToStateTreeNode<T extends IAnyType | IAnyStateTreeNode> = T extends IType<any, any, infer TT> ? TT & IStateTreeNode<T> : T;
|
|
4
4
|
/**
|
|
5
5
|
* Returns the _actual_ type of the given tree node. (Or throws)
|
|
6
6
|
*
|
package/dist/core/node/Hook.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - `"error"`: Throw an exception.
|
|
5
5
|
* - "`ignore`": Do nothing.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type LivelinessMode = "warn" | "error" | "ignore";
|
|
8
8
|
/**
|
|
9
9
|
* Defines what MST should do when running into reads / writes to objects that have died.
|
|
10
10
|
* By default it will print a warning.
|
|
@@ -23,7 +23,7 @@ export declare function getLivelinessChecking(): LivelinessMode;
|
|
|
23
23
|
* @deprecated use LivelinessMode instead
|
|
24
24
|
* @hidden
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type LivelynessMode = LivelinessMode;
|
|
27
27
|
/**
|
|
28
28
|
* @deprecated use setLivelinessChecking instead
|
|
29
29
|
* @hidden
|
|
@@ -9,7 +9,7 @@ export interface IStateTreeNode<IT extends IAnyType = IAnyType> {
|
|
|
9
9
|
readonly [$stateTreeNodeType]?: [IT] | [any];
|
|
10
10
|
}
|
|
11
11
|
/** @hidden */
|
|
12
|
-
export
|
|
12
|
+
export type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never;
|
|
13
13
|
/**
|
|
14
14
|
* Represents any state tree node instance.
|
|
15
15
|
* @hidden
|
|
@@ -7,7 +7,7 @@ export interface IValidationContextEntry {
|
|
|
7
7
|
type: IAnyType;
|
|
8
8
|
}
|
|
9
9
|
/** Array of validation context entries */
|
|
10
|
-
export
|
|
10
|
+
export type IValidationContext = IValidationContextEntry[];
|
|
11
11
|
/** Type validation error */
|
|
12
12
|
export interface IValidationError {
|
|
13
13
|
/** Validation context */
|
|
@@ -18,7 +18,7 @@ export interface IValidationError {
|
|
|
18
18
|
message?: string;
|
|
19
19
|
}
|
|
20
20
|
/** Type validation result, which is an array of type validation errors */
|
|
21
|
-
export
|
|
21
|
+
export type IValidationResult = IValidationError[];
|
|
22
22
|
/**
|
|
23
23
|
* Run's the typechecker for the given type on the given value, which can be a snapshot or an instance.
|
|
24
24
|
* Throws if the given value is not according the provided type specification.
|
package/dist/core/type/type.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IValidationContext, IValidationResult, IStateTreeNode, ModelPrimitive }
|
|
|
3
3
|
* A state tree node value.
|
|
4
4
|
* @hidden
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type STNValue<T, IT extends IAnyType> = T extends object ? T & IStateTreeNode<IT> : T;
|
|
7
7
|
/** @hidden */
|
|
8
8
|
declare const $type: unique symbol;
|
|
9
9
|
/**
|
|
@@ -77,7 +77,7 @@ export interface IAnyType extends IType<any, any, any> {
|
|
|
77
77
|
export interface ISimpleType<T> extends IType<T, T, T> {
|
|
78
78
|
}
|
|
79
79
|
/** @hidden */
|
|
80
|
-
export
|
|
80
|
+
export type Primitives = ModelPrimitive | null | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* A complex type.
|
|
83
83
|
* @deprecated just for compatibility with old versions, could be deprecated on the next major version
|
|
@@ -91,14 +91,14 @@ export interface IComplexType<C, S, T> extends IType<C, S, T & object> {
|
|
|
91
91
|
export interface IAnyComplexType extends IType<any, any, object> {
|
|
92
92
|
}
|
|
93
93
|
/** @hidden */
|
|
94
|
-
export
|
|
94
|
+
export type ExtractCSTWithoutSTN<IT extends {
|
|
95
95
|
[$type]: undefined;
|
|
96
96
|
CreationType: any;
|
|
97
97
|
SnapshotType: any;
|
|
98
98
|
TypeWithoutSTN: any;
|
|
99
99
|
}> = IT["CreationType"] | IT["SnapshotType"] | IT["TypeWithoutSTN"];
|
|
100
100
|
/** @hidden */
|
|
101
|
-
export
|
|
101
|
+
export type ExtractCSTWithSTN<IT extends {
|
|
102
102
|
[$type]: undefined;
|
|
103
103
|
CreationType: any;
|
|
104
104
|
SnapshotType: any;
|
|
@@ -107,21 +107,21 @@ export declare type ExtractCSTWithSTN<IT extends {
|
|
|
107
107
|
/**
|
|
108
108
|
* The instance representation of a given type.
|
|
109
109
|
*/
|
|
110
|
-
export
|
|
110
|
+
export type Instance<T> = T extends {
|
|
111
111
|
[$type]: undefined;
|
|
112
112
|
Type: any;
|
|
113
113
|
} ? T["Type"] : T;
|
|
114
114
|
/**
|
|
115
115
|
* The input (creation) snapshot representation of a given type.
|
|
116
116
|
*/
|
|
117
|
-
export
|
|
117
|
+
export type SnapshotIn<T> = T extends {
|
|
118
118
|
[$type]: undefined;
|
|
119
119
|
CreationType: any;
|
|
120
120
|
} ? T["CreationType"] : T extends IStateTreeNode<infer IT> ? IT["CreationType"] : T;
|
|
121
121
|
/**
|
|
122
122
|
* The output snapshot representation of a given type.
|
|
123
123
|
*/
|
|
124
|
-
export
|
|
124
|
+
export type SnapshotOut<T> = T extends {
|
|
125
125
|
[$type]: undefined;
|
|
126
126
|
SnapshotType: any;
|
|
127
127
|
} ? T["SnapshotType"] : T extends IStateTreeNode<infer IT> ? IT["SnapshotType"] : T;
|
|
@@ -151,7 +151,7 @@ export declare type SnapshotOut<T> = T extends {
|
|
|
151
151
|
* }))
|
|
152
152
|
* ```
|
|
153
153
|
*/
|
|
154
|
-
export
|
|
154
|
+
export type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
|
|
155
155
|
/**
|
|
156
156
|
* Returns if a given value represents a type.
|
|
157
157
|
*
|