@jbrowse/mobx-state-tree 5.7.1 → 5.8.7
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 +0 -10
- package/dist/index.d.ts +2135 -2
- package/dist/mobx-state-tree.cjs +6894 -0
- package/dist/mobx-state-tree.cjs.map +1 -0
- package/dist/mobx-state-tree.mjs +6814 -0
- package/dist/mobx-state-tree.mjs.map +1 -0
- package/package.json +30 -26
- package/dist/core/action.d.ts +0 -87
- package/dist/core/action.js +0 -228
- package/dist/core/action.js.map +0 -1
- package/dist/core/actionContext.d.ts +0 -27
- package/dist/core/actionContext.js +0 -42
- package/dist/core/actionContext.js.map +0 -1
- package/dist/core/flow.d.ts +0 -69
- package/dist/core/flow.js +0 -180
- package/dist/core/flow.js.map +0 -1
- package/dist/core/json-patch.d.ts +0 -46
- package/dist/core/json-patch.js +0 -133
- package/dist/core/json-patch.js.map +0 -1
- package/dist/core/mst-operations.d.ts +0 -459
- package/dist/core/mst-operations.js +0 -885
- package/dist/core/mst-operations.js.map +0 -1
- package/dist/core/node/BaseNode.d.ts +0 -62
- package/dist/core/node/BaseNode.js +0 -152
- package/dist/core/node/BaseNode.js.map +0 -1
- package/dist/core/node/Hook.d.ts +0 -17
- package/dist/core/node/Hook.js +0 -15
- package/dist/core/node/Hook.js.map +0 -1
- package/dist/core/node/create-node.d.ts +0 -16
- package/dist/core/node/create-node.js +0 -41
- package/dist/core/node/create-node.js.map +0 -1
- package/dist/core/node/identifier-cache.d.ts +0 -19
- package/dist/core/node/identifier-cache.js +0 -115
- package/dist/core/node/identifier-cache.js.map +0 -1
- package/dist/core/node/livelinessChecking.d.ts +0 -37
- package/dist/core/node/livelinessChecking.js +0 -38
- package/dist/core/node/livelinessChecking.js.map +0 -1
- package/dist/core/node/node-utils.d.ts +0 -83
- package/dist/core/node/node-utils.js +0 -165
- package/dist/core/node/node-utils.js.map +0 -1
- package/dist/core/node/object-node.d.ts +0 -101
- package/dist/core/node/object-node.js +0 -546
- package/dist/core/node/object-node.js.map +0 -1
- package/dist/core/node/scalar-node.d.ts +0 -21
- package/dist/core/node/scalar-node.js +0 -90
- package/dist/core/node/scalar-node.js.map +0 -1
- package/dist/core/process.d.ts +0 -50
- package/dist/core/process.js +0 -39
- package/dist/core/process.js.map +0 -1
- package/dist/core/type/type-checker.d.ts +0 -69
- package/dist/core/type/type-checker.js +0 -154
- package/dist/core/type/type-checker.js.map +0 -1
- package/dist/core/type/type.d.ts +0 -317
- package/dist/core/type/type.js +0 -251
- package/dist/core/type/type.js.map +0 -1
- package/dist/index.js +0 -85
- package/dist/index.js.map +0 -1
- package/dist/internal.d.ts +0 -39
- package/dist/internal.js +0 -60
- package/dist/internal.js.map +0 -1
- package/dist/middlewares/create-action-tracking-middleware.d.ts +0 -24
- package/dist/middlewares/create-action-tracking-middleware.js +0 -81
- package/dist/middlewares/create-action-tracking-middleware.js.map +0 -1
- package/dist/middlewares/createActionTrackingMiddleware2.d.ts +0 -34
- package/dist/middlewares/createActionTrackingMiddleware2.js +0 -133
- package/dist/middlewares/createActionTrackingMiddleware2.js.map +0 -1
- package/dist/middlewares/on-action.d.ts +0 -87
- package/dist/middlewares/on-action.js +0 -215
- package/dist/middlewares/on-action.js.map +0 -1
- package/dist/package.json +0 -1
- package/dist/types/complex-types/array.d.ts +0 -81
- package/dist/types/complex-types/array.js +0 -353
- package/dist/types/complex-types/array.js.map +0 -1
- package/dist/types/complex-types/map.d.ts +0 -111
- package/dist/types/complex-types/map.js +0 -362
- package/dist/types/complex-types/map.js.map +0 -1
- package/dist/types/complex-types/model.d.ts +0 -193
- package/dist/types/complex-types/model.js +0 -478
- package/dist/types/complex-types/model.js.map +0 -1
- package/dist/types/index.d.ts +0 -33
- package/dist/types/index.js +0 -38
- package/dist/types/index.js.map +0 -1
- package/dist/types/primitives.d.ts +0 -125
- package/dist/types/primitives.js +0 -183
- package/dist/types/primitives.js.map +0 -1
- package/dist/types/utility-types/custom.d.ts +0 -75
- package/dist/types/utility-types/custom.js +0 -111
- package/dist/types/utility-types/custom.js.map +0 -1
- package/dist/types/utility-types/enumeration.d.ts +0 -5
- package/dist/types/utility-types/enumeration.js +0 -34
- package/dist/types/utility-types/enumeration.js.map +0 -1
- package/dist/types/utility-types/frozen.d.ts +0 -24
- package/dist/types/utility-types/frozen.js +0 -98
- package/dist/types/utility-types/frozen.js.map +0 -1
- package/dist/types/utility-types/identifier.d.ts +0 -87
- package/dist/types/utility-types/identifier.js +0 -130
- package/dist/types/utility-types/identifier.js.map +0 -1
- package/dist/types/utility-types/late.d.ts +0 -10
- package/dist/types/utility-types/late.js +0 -110
- package/dist/types/utility-types/late.js.map +0 -1
- package/dist/types/utility-types/lazy.d.ts +0 -23
- package/dist/types/utility-types/lazy.js +0 -77
- package/dist/types/utility-types/lazy.js.map +0 -1
- package/dist/types/utility-types/literal.d.ts +0 -38
- package/dist/types/utility-types/literal.js +0 -64
- package/dist/types/utility-types/literal.js.map +0 -1
- package/dist/types/utility-types/maybe.d.ts +0 -26
- package/dist/types/utility-types/maybe.js +0 -30
- package/dist/types/utility-types/maybe.js.map +0 -1
- package/dist/types/utility-types/optional.d.ts +0 -42
- package/dist/types/utility-types/optional.js +0 -141
- package/dist/types/utility-types/optional.js.map +0 -1
- package/dist/types/utility-types/reference.d.ts +0 -90
- package/dist/types/utility-types/reference.js +0 -393
- package/dist/types/utility-types/reference.js.map +0 -1
- package/dist/types/utility-types/refinement.d.ts +0 -10
- package/dist/types/utility-types/refinement.js +0 -86
- package/dist/types/utility-types/refinement.js.map +0 -1
- package/dist/types/utility-types/resilient.d.ts +0 -18
- package/dist/types/utility-types/resilient.js +0 -121
- package/dist/types/utility-types/resilient.js.map +0 -1
- package/dist/types/utility-types/snapshotProcessor.d.ts +0 -63
- package/dist/types/utility-types/snapshotProcessor.js +0 -162
- package/dist/types/utility-types/snapshotProcessor.js.map +0 -1
- package/dist/types/utility-types/union.d.ts +0 -78
- package/dist/types/utility-types/union.js +0 -246
- package/dist/types/utility-types/union.js.map +0 -1
- package/dist/utils.d.ts +0 -230
- package/dist/utils.js +0 -483
- package/dist/utils.js.map +0 -1
- package/esm/core/action.d.ts +0 -87
- package/esm/core/action.js +0 -219
- package/esm/core/action.js.map +0 -1
- package/esm/core/actionContext.d.ts +0 -27
- package/esm/core/actionContext.js +0 -37
- package/esm/core/actionContext.js.map +0 -1
- package/esm/core/flow.d.ts +0 -69
- package/esm/core/flow.js +0 -173
- package/esm/core/flow.js.map +0 -1
- package/esm/core/json-patch.d.ts +0 -46
- package/esm/core/json-patch.js +0 -125
- package/esm/core/json-patch.js.map +0 -1
- package/esm/core/mst-operations.d.ts +0 -459
- package/esm/core/mst-operations.js +0 -844
- package/esm/core/mst-operations.js.map +0 -1
- package/esm/core/node/BaseNode.d.ts +0 -62
- package/esm/core/node/BaseNode.js +0 -148
- package/esm/core/node/BaseNode.js.map +0 -1
- package/esm/core/node/Hook.d.ts +0 -17
- package/esm/core/node/Hook.js +0 -12
- package/esm/core/node/Hook.js.map +0 -1
- package/esm/core/node/create-node.d.ts +0 -16
- package/esm/core/node/create-node.js +0 -36
- package/esm/core/node/create-node.js.map +0 -1
- package/esm/core/node/identifier-cache.d.ts +0 -19
- package/esm/core/node/identifier-cache.js +0 -111
- package/esm/core/node/identifier-cache.js.map +0 -1
- package/esm/core/node/livelinessChecking.d.ts +0 -37
- package/esm/core/node/livelinessChecking.js +0 -33
- package/esm/core/node/livelinessChecking.js.map +0 -1
- package/esm/core/node/node-utils.d.ts +0 -83
- package/esm/core/node/node-utils.js +0 -153
- package/esm/core/node/node-utils.js.map +0 -1
- package/esm/core/node/object-node.d.ts +0 -101
- package/esm/core/node/object-node.js +0 -542
- package/esm/core/node/object-node.js.map +0 -1
- package/esm/core/node/scalar-node.d.ts +0 -21
- package/esm/core/node/scalar-node.js +0 -86
- package/esm/core/node/scalar-node.js.map +0 -1
- package/esm/core/process.d.ts +0 -50
- package/esm/core/process.js +0 -35
- package/esm/core/process.js.map +0 -1
- package/esm/core/type/type-checker.d.ts +0 -69
- package/esm/core/type/type-checker.js +0 -144
- package/esm/core/type/type-checker.js.map +0 -1
- package/esm/core/type/type.d.ts +0 -317
- package/esm/core/type/type.js +0 -243
- package/esm/core/type/type.js.map +0 -1
- package/esm/index.d.ts +0 -2
- package/esm/index.js +0 -2
- package/esm/index.js.map +0 -1
- package/esm/internal.d.ts +0 -39
- package/esm/internal.js +0 -44
- package/esm/internal.js.map +0 -1
- package/esm/middlewares/create-action-tracking-middleware.d.ts +0 -24
- package/esm/middlewares/create-action-tracking-middleware.js +0 -78
- package/esm/middlewares/create-action-tracking-middleware.js.map +0 -1
- package/esm/middlewares/createActionTrackingMiddleware2.d.ts +0 -34
- package/esm/middlewares/createActionTrackingMiddleware2.js +0 -130
- package/esm/middlewares/createActionTrackingMiddleware2.js.map +0 -1
- package/esm/middlewares/on-action.d.ts +0 -87
- package/esm/middlewares/on-action.js +0 -210
- package/esm/middlewares/on-action.js.map +0 -1
- package/esm/types/complex-types/array.d.ts +0 -81
- package/esm/types/complex-types/array.js +0 -347
- package/esm/types/complex-types/array.js.map +0 -1
- package/esm/types/complex-types/map.d.ts +0 -111
- package/esm/types/complex-types/map.js +0 -356
- package/esm/types/complex-types/map.js.map +0 -1
- package/esm/types/complex-types/model.d.ts +0 -193
- package/esm/types/complex-types/model.js +0 -471
- package/esm/types/complex-types/model.js.map +0 -1
- package/esm/types/index.d.ts +0 -33
- package/esm/types/index.js +0 -35
- package/esm/types/index.js.map +0 -1
- package/esm/types/primitives.d.ts +0 -125
- package/esm/types/primitives.js +0 -177
- package/esm/types/primitives.js.map +0 -1
- package/esm/types/utility-types/custom.d.ts +0 -75
- package/esm/types/utility-types/custom.js +0 -106
- package/esm/types/utility-types/custom.js.map +0 -1
- package/esm/types/utility-types/enumeration.d.ts +0 -5
- package/esm/types/utility-types/enumeration.js +0 -31
- package/esm/types/utility-types/enumeration.js.map +0 -1
- package/esm/types/utility-types/frozen.d.ts +0 -24
- package/esm/types/utility-types/frozen.js +0 -92
- package/esm/types/utility-types/frozen.js.map +0 -1
- package/esm/types/utility-types/identifier.d.ts +0 -87
- package/esm/types/utility-types/identifier.js +0 -121
- package/esm/types/utility-types/identifier.js.map +0 -1
- package/esm/types/utility-types/late.d.ts +0 -10
- package/esm/types/utility-types/late.js +0 -106
- package/esm/types/utility-types/late.js.map +0 -1
- package/esm/types/utility-types/lazy.d.ts +0 -23
- package/esm/types/utility-types/lazy.js +0 -72
- package/esm/types/utility-types/lazy.js.map +0 -1
- package/esm/types/utility-types/literal.d.ts +0 -38
- package/esm/types/utility-types/literal.js +0 -58
- package/esm/types/utility-types/literal.js.map +0 -1
- package/esm/types/utility-types/maybe.d.ts +0 -26
- package/esm/types/utility-types/maybe.js +0 -26
- package/esm/types/utility-types/maybe.js.map +0 -1
- package/esm/types/utility-types/optional.d.ts +0 -42
- package/esm/types/utility-types/optional.js +0 -135
- package/esm/types/utility-types/optional.js.map +0 -1
- package/esm/types/utility-types/reference.d.ts +0 -90
- package/esm/types/utility-types/reference.js +0 -383
- package/esm/types/utility-types/reference.js.map +0 -1
- package/esm/types/utility-types/refinement.d.ts +0 -10
- package/esm/types/utility-types/refinement.js +0 -82
- package/esm/types/utility-types/refinement.js.map +0 -1
- package/esm/types/utility-types/resilient.d.ts +0 -18
- package/esm/types/utility-types/resilient.js +0 -118
- package/esm/types/utility-types/resilient.js.map +0 -1
- package/esm/types/utility-types/snapshotProcessor.d.ts +0 -63
- package/esm/types/utility-types/snapshotProcessor.js +0 -159
- package/esm/types/utility-types/snapshotProcessor.js.map +0 -1
- package/esm/types/utility-types/union.d.ts +0 -78
- package/esm/types/utility-types/union.js +0 -240
- package/esm/types/utility-types/union.js.map +0 -1
- package/esm/utils.d.ts +0 -230
- package/esm/utils.js +0 -449
- package/esm/utils.js.map +0 -1
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
let livelinessChecking = "warn";
|
|
2
|
-
/**
|
|
3
|
-
* Defines what MST should do when running into reads / writes to objects that have died.
|
|
4
|
-
* By default it will print a warning.
|
|
5
|
-
* Use the `"error"` option to easy debugging to see where the error was thrown and when the offending read / write took place
|
|
6
|
-
*
|
|
7
|
-
* @param mode `"warn"`, `"error"` or `"ignore"`
|
|
8
|
-
*/
|
|
9
|
-
export function setLivelinessChecking(mode) {
|
|
10
|
-
livelinessChecking = mode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns the current liveliness checking mode.
|
|
14
|
-
*
|
|
15
|
-
* @returns `"warn"`, `"error"` or `"ignore"`
|
|
16
|
-
*/
|
|
17
|
-
export function getLivelinessChecking() {
|
|
18
|
-
return livelinessChecking;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated use setLivelinessChecking instead
|
|
22
|
-
* @hidden
|
|
23
|
-
*
|
|
24
|
-
* Defines what MST should do when running into reads / writes to objects that have died.
|
|
25
|
-
* By default it will print a warning.
|
|
26
|
-
* Use the `"error"` option to easy debugging to see where the error was thrown and when the offending read / write took place
|
|
27
|
-
*
|
|
28
|
-
* @param mode `"warn"`, `"error"` or `"ignore"`
|
|
29
|
-
*/
|
|
30
|
-
export function setLivelynessChecking(mode) {
|
|
31
|
-
setLivelinessChecking(mode);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=livelinessChecking.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"livelinessChecking.js","sourceRoot":"","sources":["../../../src/core/node/livelinessChecking.ts"],"names":[],"mappings":"AAQA,IAAI,kBAAkB,GAAmB,MAAM,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAoB;IACxD,kBAAkB,GAAG,IAAI,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AAQD;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAoB;IACxD,qBAAqB,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAC","sourcesContent":["/**\n * Defines what MST should do when running into reads / writes to objects that have died.\n * - `\"warn\"`: Print a warning (default).\n * - `\"error\"`: Throw an exception.\n * - \"`ignore`\": Do nothing.\n */\nexport type LivelinessMode = \"warn\" | \"error\" | \"ignore\"\n\nlet livelinessChecking: LivelinessMode = \"warn\"\n\n/**\n * Defines what MST should do when running into reads / writes to objects that have died.\n * By default it will print a warning.\n * Use the `\"error\"` option to easy debugging to see where the error was thrown and when the offending read / write took place\n *\n * @param mode `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nexport function setLivelinessChecking(mode: LivelinessMode) {\n livelinessChecking = mode\n}\n\n/**\n * Returns the current liveliness checking mode.\n *\n * @returns `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nexport function getLivelinessChecking(): LivelinessMode {\n return livelinessChecking\n}\n\n/**\n * @deprecated use LivelinessMode instead\n * @hidden\n */\nexport type LivelynessMode = LivelinessMode\n\n/**\n * @deprecated use setLivelinessChecking instead\n * @hidden\n *\n * Defines what MST should do when running into reads / writes to objects that have died.\n * By default it will print a warning.\n * Use the `\"error\"` option to easy debugging to see where the error was thrown and when the offending read / write took place\n *\n * @param mode `\"warn\"`, `\"error\"` or `\"ignore\"`\n */\nexport function setLivelynessChecking(mode: LivelinessMode) {\n setLivelinessChecking(mode)\n}\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { AnyNode, AnyObjectNode, IAnyComplexType, IAnyType, IChildNodesMap, IType, Instance, STNValue } from "../../internal.ts";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export declare enum NodeLifeCycle {
|
|
7
|
-
INITIALIZING = 0,// setting up
|
|
8
|
-
CREATED = 1,// afterCreate has run
|
|
9
|
-
FINALIZED = 2,// afterAttach has run
|
|
10
|
-
DETACHING = 3,// being detached from the tree
|
|
11
|
-
DEAD = 4
|
|
12
|
-
}
|
|
13
|
-
/** @hidden */
|
|
14
|
-
declare const $stateTreeNodeType: unique symbol;
|
|
15
|
-
/**
|
|
16
|
-
* Common interface that represents a node instance.
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
export interface IStateTreeNode<IT extends IAnyType = IAnyType> {
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
readonly $treenode?: any;
|
|
24
|
-
readonly [$stateTreeNodeType]?: [IT] | [any];
|
|
25
|
-
}
|
|
26
|
-
/** @hidden */
|
|
27
|
-
export type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never;
|
|
28
|
-
/**
|
|
29
|
-
* Represents any state tree node instance.
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
export interface IAnyStateTreeNode extends STNValue<any, IAnyType> {
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns true if the given value is a node in a state tree.
|
|
36
|
-
* More precisely, that is, if the value is an instance of a
|
|
37
|
-
* `types.model`, `types.array` or `types.map`.
|
|
38
|
-
*
|
|
39
|
-
* @param value
|
|
40
|
-
* @returns true if the value is a state tree node.
|
|
41
|
-
*/
|
|
42
|
-
export declare function isStateTreeNode<IT extends IAnyComplexType = IAnyComplexType>(value: any): value is STNValue<Instance<IT>, IT>;
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
47
|
-
export declare function assertIsStateTreeNode(value: IAnyStateTreeNode, argNumber: number | number[]): void;
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
* @hidden
|
|
51
|
-
*/
|
|
52
|
-
export declare function getStateTreeNode(value: IAnyStateTreeNode): AnyObjectNode;
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
* @hidden
|
|
56
|
-
*/
|
|
57
|
-
export declare function getStateTreeNodeSafe(value: IAnyStateTreeNode): AnyObjectNode | null;
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
export declare function toJSON<S>(this: IStateTreeNode<IType<any, S, any>>): S;
|
|
63
|
-
/**
|
|
64
|
-
* @internal
|
|
65
|
-
* @hidden
|
|
66
|
-
*/
|
|
67
|
-
export declare function getRelativePathBetweenNodes(base: AnyObjectNode, target: AnyObjectNode): string;
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
* @hidden
|
|
71
|
-
*/
|
|
72
|
-
export declare function resolveNodeByPath(base: AnyObjectNode, path: string, failIfResolveFails?: boolean): AnyNode | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* @internal
|
|
75
|
-
* @hidden
|
|
76
|
-
*/
|
|
77
|
-
export declare function resolveNodeByPathParts(base: AnyObjectNode, pathParts: string[], failIfResolveFails?: boolean): AnyNode | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
* @hidden
|
|
81
|
-
*/
|
|
82
|
-
export declare function convertChildNodesToArray(childNodes: IChildNodesMap | null): AnyNode[];
|
|
83
|
-
export {};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { EMPTY_ARRAY, ObjectNode, ScalarNode, assertArg, fail, joinJsonPath, splitJsonPath } from "../../internal.js";
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
export var NodeLifeCycle;
|
|
7
|
-
(function (NodeLifeCycle) {
|
|
8
|
-
NodeLifeCycle[NodeLifeCycle["INITIALIZING"] = 0] = "INITIALIZING";
|
|
9
|
-
NodeLifeCycle[NodeLifeCycle["CREATED"] = 1] = "CREATED";
|
|
10
|
-
NodeLifeCycle[NodeLifeCycle["FINALIZED"] = 2] = "FINALIZED";
|
|
11
|
-
NodeLifeCycle[NodeLifeCycle["DETACHING"] = 3] = "DETACHING";
|
|
12
|
-
NodeLifeCycle[NodeLifeCycle["DEAD"] = 4] = "DEAD"; // no coming back from this one
|
|
13
|
-
})(NodeLifeCycle || (NodeLifeCycle = {}));
|
|
14
|
-
/**
|
|
15
|
-
* Returns true if the given value is a node in a state tree.
|
|
16
|
-
* More precisely, that is, if the value is an instance of a
|
|
17
|
-
* `types.model`, `types.array` or `types.map`.
|
|
18
|
-
*
|
|
19
|
-
* @param value
|
|
20
|
-
* @returns true if the value is a state tree node.
|
|
21
|
-
*/
|
|
22
|
-
export function isStateTreeNode(value) {
|
|
23
|
-
return !!(value && value.$treenode);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @internal
|
|
27
|
-
* @hidden
|
|
28
|
-
*/
|
|
29
|
-
export function assertIsStateTreeNode(value, argNumber) {
|
|
30
|
-
assertArg(value, isStateTreeNode, "mobx-state-tree node", argNumber);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* @hidden
|
|
35
|
-
*/
|
|
36
|
-
export function getStateTreeNode(value) {
|
|
37
|
-
if (!isStateTreeNode(value)) {
|
|
38
|
-
// istanbul ignore next
|
|
39
|
-
throw fail(`Value ${value} is no MST Node`);
|
|
40
|
-
}
|
|
41
|
-
return value.$treenode;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
47
|
-
export function getStateTreeNodeSafe(value) {
|
|
48
|
-
return (value && value.$treenode) || null;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @internal
|
|
52
|
-
* @hidden
|
|
53
|
-
*/
|
|
54
|
-
export function toJSON() {
|
|
55
|
-
return getStateTreeNode(this).snapshot;
|
|
56
|
-
}
|
|
57
|
-
const doubleDot = (_) => "..";
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
export function getRelativePathBetweenNodes(base, target) {
|
|
63
|
-
// PRE condition target is (a child of) base!
|
|
64
|
-
if (base.root !== target.root) {
|
|
65
|
-
throw fail(`Cannot calculate relative path: objects '${base}' and '${target}' are not part of the same object tree`);
|
|
66
|
-
}
|
|
67
|
-
const baseParts = splitJsonPath(base.path);
|
|
68
|
-
const targetParts = splitJsonPath(target.path);
|
|
69
|
-
let common = 0;
|
|
70
|
-
for (; common < baseParts.length; common++) {
|
|
71
|
-
if (baseParts[common] !== targetParts[common]) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// TODO: assert that no targetParts paths are "..", "." or ""!
|
|
76
|
-
return (baseParts.slice(common).map(doubleDot).join("/") +
|
|
77
|
-
joinJsonPath(targetParts.slice(common)));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @internal
|
|
81
|
-
* @hidden
|
|
82
|
-
*/
|
|
83
|
-
export function resolveNodeByPath(base, path, failIfResolveFails = true) {
|
|
84
|
-
return resolveNodeByPathParts(base, splitJsonPath(path), failIfResolveFails);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @internal
|
|
88
|
-
* @hidden
|
|
89
|
-
*/
|
|
90
|
-
export function resolveNodeByPathParts(base, pathParts, failIfResolveFails = true) {
|
|
91
|
-
let current = base;
|
|
92
|
-
try {
|
|
93
|
-
for (let i = 0; i < pathParts.length; i++) {
|
|
94
|
-
const part = pathParts[i];
|
|
95
|
-
if (part === "..") {
|
|
96
|
-
current = current.parent;
|
|
97
|
-
if (current) {
|
|
98
|
-
continue;
|
|
99
|
-
} // not everything has a parent
|
|
100
|
-
}
|
|
101
|
-
else if (part === ".") {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
else if (current) {
|
|
105
|
-
if (current instanceof ScalarNode) {
|
|
106
|
-
// check if the value of a scalar resolves to a state tree node (e.g. references)
|
|
107
|
-
// then we can continue resolving...
|
|
108
|
-
const value = current.value;
|
|
109
|
-
if (isStateTreeNode(value)) {
|
|
110
|
-
current = getStateTreeNode(value);
|
|
111
|
-
// fall through
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (current instanceof ObjectNode) {
|
|
115
|
-
const subType = current.getChildType(part);
|
|
116
|
-
if (subType) {
|
|
117
|
-
current = current.getChildNode(part);
|
|
118
|
-
if (current) {
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
throw fail(`Could not resolve '${part}' in path '${joinJsonPath(pathParts.slice(0, i)) || "/"}' while resolving '${joinJsonPath(pathParts)}'`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
if (!failIfResolveFails) {
|
|
129
|
-
return undefined;
|
|
130
|
-
}
|
|
131
|
-
throw e;
|
|
132
|
-
}
|
|
133
|
-
return current;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @internal
|
|
137
|
-
* @hidden
|
|
138
|
-
*/
|
|
139
|
-
export function convertChildNodesToArray(childNodes) {
|
|
140
|
-
if (!childNodes) {
|
|
141
|
-
return EMPTY_ARRAY;
|
|
142
|
-
}
|
|
143
|
-
const keys = Object.keys(childNodes);
|
|
144
|
-
if (!keys.length) {
|
|
145
|
-
return EMPTY_ARRAY;
|
|
146
|
-
}
|
|
147
|
-
const result = new Array(keys.length);
|
|
148
|
-
keys.forEach((key, index) => {
|
|
149
|
-
result[index] = childNodes[key];
|
|
150
|
-
});
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=node-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-utils.js","sourceRoot":"","sources":["../../../src/core/node/node-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,aAAa,EACd,MAAM,mBAAmB,CAAA;AAa1B;;;GAGG;AACH,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,i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AC;QACjB,OAAO,WAAwB,CAAA;IACjC,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAc,CAAA;IAClD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,UAAW,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import {\n EMPTY_ARRAY,\n ObjectNode,\n ScalarNode,\n assertArg,\n fail,\n joinJsonPath,\n splitJsonPath\n} from \"../../internal.ts\"\n\nimport type {\n AnyNode,\n AnyObjectNode,\n IAnyComplexType,\n IAnyType,\n IChildNodesMap,\n IType,\n Instance,\n STNValue\n} from \"../../internal.ts\"\n\n/**\n * @internal\n * @hidden\n */\nexport enum NodeLifeCycle {\n INITIALIZING, // setting up\n CREATED, // afterCreate has run\n FINALIZED, // afterAttach has run\n DETACHING, // being detached from the tree\n DEAD // no coming back from this one\n}\n\n/** @hidden */\ndeclare const $stateTreeNodeType: unique symbol\n\n/**\n * Common interface that represents a node instance.\n * @hidden\n */\nexport interface IStateTreeNode<IT extends IAnyType = IAnyType> {\n /**\n * @internal\n */\n readonly $treenode?: any\n\n // fake, will never be present, just for typing\n // we use this weird trick to solve an issue with reference types\n readonly [$stateTreeNodeType]?: [IT] | [any]\n}\n\n/** @hidden */\nexport type TypeOfValue<T extends IAnyStateTreeNode> =\n T extends IStateTreeNode<infer IT> ? IT : never\n\n/**\n * Represents any state tree node instance.\n * @hidden\n */\nexport interface IAnyStateTreeNode extends STNValue<any, IAnyType> {}\n\n/**\n * Returns true if the given value is a node in a state tree.\n * More precisely, that is, if the value is an instance of a\n * `types.model`, `types.array` or `types.map`.\n *\n * @param value\n * @returns true if the value is a state tree node.\n */\nexport function isStateTreeNode<IT extends IAnyComplexType = IAnyComplexType>(\n value: any\n): value is STNValue<Instance<IT>, IT> {\n return !!(value && value.$treenode)\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function assertIsStateTreeNode(\n value: IAnyStateTreeNode,\n argNumber: number | number[]\n): void {\n assertArg(value, isStateTreeNode, \"mobx-state-tree node\", argNumber)\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function getStateTreeNode(value: IAnyStateTreeNode): AnyObjectNode {\n if (!isStateTreeNode(value)) {\n // istanbul ignore next\n throw fail(`Value ${value} is no MST Node`)\n }\n return value.$treenode!\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function getStateTreeNodeSafe(\n value: IAnyStateTreeNode\n): AnyObjectNode | null {\n return (value && value.$treenode) || null\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function toJSON<S>(this: IStateTreeNode<IType<any, S, any>>): S {\n return getStateTreeNode(this).snapshot\n}\n\nconst doubleDot = (_: any) => \"..\"\n\n/**\n * @internal\n * @hidden\n */\nexport function getRelativePathBetweenNodes(\n base: AnyObjectNode,\n target: AnyObjectNode\n): string {\n // PRE condition target is (a child of) base!\n if (base.root !== target.root) {\n throw fail(\n `Cannot calculate relative path: objects '${base}' and '${target}' are not part of the same object tree`\n )\n }\n\n const baseParts = splitJsonPath(base.path)\n const targetParts = splitJsonPath(target.path)\n let common = 0\n for (; common < baseParts.length; common++) {\n if (baseParts[common] !== targetParts[common]) {\n break\n }\n }\n // TODO: assert that no targetParts paths are \"..\", \".\" or \"\"!\n return (\n baseParts.slice(common).map(doubleDot).join(\"/\") +\n joinJsonPath(targetParts.slice(common))\n )\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function resolveNodeByPath(\n base: AnyObjectNode,\n path: string,\n failIfResolveFails: boolean = true\n): AnyNode | undefined {\n return resolveNodeByPathParts(base, splitJsonPath(path), failIfResolveFails)\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function resolveNodeByPathParts(\n base: AnyObjectNode,\n pathParts: string[],\n failIfResolveFails: boolean = true\n): AnyNode | undefined {\n let current: AnyNode | null = base\n try {\n for (let i = 0; i < pathParts.length; i++) {\n const part = pathParts[i]\n if (part === \"..\") {\n current = current!.parent\n if (current) {\n continue\n } // not everything has a parent\n } else if (part === \".\") {\n continue\n } else if (current) {\n if (current instanceof ScalarNode) {\n // check if the value of a scalar resolves to a state tree node (e.g. references)\n // then we can continue resolving...\n const value: any = current.value\n if (isStateTreeNode(value)) {\n current = getStateTreeNode(value)\n // fall through\n }\n }\n if (current instanceof ObjectNode) {\n const subType = current.getChildType(part)\n if (subType) {\n current = current.getChildNode(part)\n if (current) {\n continue\n }\n }\n }\n }\n throw fail(\n `Could not resolve '${part}' in path '${\n joinJsonPath(pathParts.slice(0, i)) || \"/\"\n }' while resolving '${joinJsonPath(pathParts)}'`\n )\n }\n } catch (e) {\n if (!failIfResolveFails) {\n return undefined\n }\n throw e\n }\n return current!\n}\n\n/**\n * @internal\n * @hidden\n */\nexport function convertChildNodesToArray(\n childNodes: IChildNodesMap | null\n): AnyNode[] {\n if (!childNodes) {\n return EMPTY_ARRAY as AnyNode[]\n }\n\n const keys = Object.keys(childNodes)\n if (!keys.length) {\n return EMPTY_ARRAY as AnyNode[]\n }\n\n const result = new Array(keys.length) as AnyNode[]\n keys.forEach((key, index) => {\n result[index] = childNodes![key]\n })\n return result\n}\n"]}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { BaseNode } from "./BaseNode.ts";
|
|
2
|
-
import { ComplexType } from "../type/type.ts";
|
|
3
|
-
import { Hook, IdentifierCache } from "../../internal.ts";
|
|
4
|
-
import type { AnyNode, IAnyType, IDisposer, IJsonPatch, IMiddleware, IMiddlewareEvent, IMiddlewareHandler, IReversibleJsonPatch, IStateTreeNode, IType, ReferenceIdentifier } from "../../internal.ts";
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
export interface IChildNodesMap {
|
|
10
|
-
[key: string]: AnyNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
export declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
|
|
17
|
-
readonly type: ComplexType<C, S, T>;
|
|
18
|
-
storedValue: T & IStateTreeNode<IType<C, S, T>>;
|
|
19
|
-
readonly nodeId: number;
|
|
20
|
-
readonly identifierAttribute?: string;
|
|
21
|
-
readonly identifier: string | null;
|
|
22
|
-
readonly unnormalizedIdentifier: ReferenceIdentifier | null;
|
|
23
|
-
identifierCache?: IdentifierCache;
|
|
24
|
-
isProtectionEnabled: boolean;
|
|
25
|
-
middlewares?: IMiddleware[];
|
|
26
|
-
hasSnapshotPostProcessor: boolean;
|
|
27
|
-
private _applyPatches?;
|
|
28
|
-
applyPatches(patches: IJsonPatch[]): void;
|
|
29
|
-
private _applySnapshot?;
|
|
30
|
-
applySnapshot(snapshot: C): void;
|
|
31
|
-
private _autoUnbox;
|
|
32
|
-
_isRunningAction: boolean;
|
|
33
|
-
private _hasSnapshotReaction;
|
|
34
|
-
private _observableInstanceState;
|
|
35
|
-
private _childNodes;
|
|
36
|
-
private _initialSnapshot;
|
|
37
|
-
private _cachedInitialSnapshot?;
|
|
38
|
-
private _cachedInitialSnapshotCreated;
|
|
39
|
-
private _snapshotComputed;
|
|
40
|
-
constructor(complexType: ComplexType<C, S, T>, parent: AnyObjectNode | null, subpath: string, environment: any, initialValue: C);
|
|
41
|
-
createObservableInstanceIfNeeded(fireHooks?: boolean): void;
|
|
42
|
-
createObservableInstance(fireHooks?: boolean): void;
|
|
43
|
-
get root(): AnyObjectNode;
|
|
44
|
-
clearParent(): void;
|
|
45
|
-
setParent(newParent: AnyObjectNode, subpath: string): void;
|
|
46
|
-
protected fireHook(name: Hook): void;
|
|
47
|
-
private _snapshotUponDeath?;
|
|
48
|
-
get snapshot(): S;
|
|
49
|
-
getSnapshot(): S;
|
|
50
|
-
private _getActualSnapshot;
|
|
51
|
-
private _getCachedInitialSnapshot;
|
|
52
|
-
private isRunningAction;
|
|
53
|
-
assertAlive(context: AssertAliveContext): void;
|
|
54
|
-
private _getAssertAliveError;
|
|
55
|
-
getChildNode(subpath: string): AnyNode;
|
|
56
|
-
getChildren(): ReadonlyArray<AnyNode>;
|
|
57
|
-
getChildType(propertyName?: string): IAnyType;
|
|
58
|
-
get isProtected(): boolean;
|
|
59
|
-
assertWritable(context: AssertAliveContext): void;
|
|
60
|
-
removeChild(subpath: string): void;
|
|
61
|
-
unbox(childNode: AnyNode | undefined): AnyNode | undefined;
|
|
62
|
-
toString(): string;
|
|
63
|
-
finalizeCreation(): void;
|
|
64
|
-
detach(): void;
|
|
65
|
-
private preboot;
|
|
66
|
-
die(): void;
|
|
67
|
-
aboutToDie(): void;
|
|
68
|
-
finalizeDeath(): void;
|
|
69
|
-
onSnapshot(onChange: (snapshot: S) => void): IDisposer;
|
|
70
|
-
protected emitSnapshot(snapshot: S): void;
|
|
71
|
-
onPatch(handler: (patch: IJsonPatch, reversePatch: IJsonPatch) => void): IDisposer;
|
|
72
|
-
emitPatch(basePatch: IReversibleJsonPatch, source: AnyNode): void;
|
|
73
|
-
hasDisposer(disposer: () => void): boolean;
|
|
74
|
-
addDisposer(disposer: () => void): void;
|
|
75
|
-
removeDisposer(disposer: () => void): void;
|
|
76
|
-
private removeMiddleware;
|
|
77
|
-
addMiddleWare(handler: IMiddlewareHandler, includeHooks?: boolean): IDisposer;
|
|
78
|
-
applyPatchLocally(subpath: string, patch: IJsonPatch): void;
|
|
79
|
-
private _addSnapshotReaction;
|
|
80
|
-
private _internalEvents?;
|
|
81
|
-
private _internalEventsHasSubscribers;
|
|
82
|
-
private _internalEventsRegister;
|
|
83
|
-
private _internalEventsHas;
|
|
84
|
-
private _internalEventsUnregister;
|
|
85
|
-
private _internalEventsEmit;
|
|
86
|
-
private _internalEventsClear;
|
|
87
|
-
private _internalEventsClearAll;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @internal
|
|
91
|
-
* @hidden
|
|
92
|
-
*/
|
|
93
|
-
export type AnyObjectNode = ObjectNode<any, any, any>;
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
* @hidden
|
|
97
|
-
*/
|
|
98
|
-
export interface AssertAliveContext {
|
|
99
|
-
subpath?: string;
|
|
100
|
-
actionContext?: IMiddlewareEvent;
|
|
101
|
-
}
|