1 | export declare class Node {
|
2 | readonly nodeId: number;
|
3 | readonly type: IType<any, any>;
|
4 | readonly storedValue: any;
|
5 | protected _parent: Node | null;
|
6 | subpath: string;
|
7 | identifierCache: IdentifierCache | undefined;
|
8 | isProtectionEnabled: boolean;
|
9 | identifierAttribute: string | undefined;
|
10 | _environment: any;
|
11 | _isRunningAction: boolean;
|
12 | private _autoUnbox;
|
13 | private _isAlive;
|
14 | private _isDetaching;
|
15 | readonly middlewares: IMiddlewareHandler[];
|
16 | private readonly snapshotSubscribers;
|
17 | private readonly patchSubscribers;
|
18 | private readonly disposers;
|
19 | applyPatches: (patches: IJsonPatch[]) => void;
|
20 | applySnapshot: (snapshot: any) => void;
|
21 | constructor(type: IType<any, any>, parent: Node | null, subpath: string, environment: any, initialValue: any, createNewInstance?: (initialValue: any) => any, finalizeNewInstance?: (node: Node, initialValue: any) => void);
|
22 | readonly identifier: string | null;
|
23 | readonly path: string;
|
24 | readonly isRoot: boolean;
|
25 | readonly parent: Node | null;
|
26 | readonly root: Node;
|
27 | getRelativePathTo(target: Node): string;
|
28 | resolve(pathParts: string): Node;
|
29 | resolve(pathParts: string, failIfResolveFails: boolean): Node | undefined;
|
30 | resolvePath(pathParts: string[]): Node;
|
31 | resolvePath(pathParts: string[], failIfResolveFails: boolean): Node | undefined;
|
32 | readonly value: any;
|
33 | readonly isAlive: boolean;
|
34 | die(): void;
|
35 | aboutToDie(): void;
|
36 | finalizeDeath(): void;
|
37 | assertAlive(): void;
|
38 | readonly snapshot: any;
|
39 | onSnapshot(onChange: (snapshot: any) => void): IDisposer;
|
40 | emitSnapshot(snapshot: any): void;
|
41 | applyPatchLocally(subpath: string, patch: IJsonPatch): void;
|
42 | onPatch(handler: (patch: IJsonPatch, reversePatch: IJsonPatch) => void): IDisposer;
|
43 | emitPatch(basePatch: IReversibleJsonPatch, source: Node): void;
|
44 | setParent(newParent: Node | null, subpath?: string | null): void;
|
45 | addDisposer(disposer: () => void): void;
|
46 | isRunningAction(): boolean;
|
47 | addMiddleWare(handler: IMiddlewareHandler): IDisposer;
|
48 | getChildNode(subpath: string): Node;
|
49 | getChildren(): Node[];
|
50 | getChildType(key: string): IType<any, any>;
|
51 | readonly isProtected: boolean;
|
52 | assertWritable(): void;
|
53 | removeChild(subpath: string): void;
|
54 | detach(): void;
|
55 | unbox(childNode: Node): any;
|
56 | fireHook(name: string): void;
|
57 | toString(): string;
|
58 | }
|
59 | export declare type IStateTreeNode = {
|
60 | readonly $treenode?: any;
|
61 | };
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | export declare function isStateTreeNode(value: any): value is IStateTreeNode;
|
72 | export declare function getStateTreeNode(value: IStateTreeNode): Node;
|
73 | export declare function createNode<S, T>(type: IType<S, T>, parent: Node | null, subpath: string, environment: any, initialValue: any, createNewInstance?: (initialValue: any) => T, finalizeNewInstance?: (node: Node, initialValue: any) => void): Node;
|
74 | import { IType } from "../types/type";
|
75 | import { IReversibleJsonPatch, IJsonPatch } from "./json-patch";
|
76 | import { IMiddlewareHandler } from "./action";
|
77 | import { IDisposer } from "../utils";
|
78 | import { IdentifierCache } from "./identifier-cache";
|