@jbrowse/mobx-state-tree 5.6.3 → 5.6.9

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.
Files changed (126) hide show
  1. package/dist/core/action.d.ts +87 -0
  2. package/dist/core/action.js +228 -0
  3. package/dist/core/action.js.map +1 -0
  4. package/dist/core/actionContext.d.ts +27 -0
  5. package/dist/core/actionContext.js +42 -0
  6. package/dist/core/actionContext.js.map +1 -0
  7. package/dist/core/flow.d.ts +69 -0
  8. package/dist/core/flow.js +180 -0
  9. package/dist/core/flow.js.map +1 -0
  10. package/dist/core/json-patch.d.ts +46 -0
  11. package/dist/core/json-patch.js +133 -0
  12. package/dist/core/json-patch.js.map +1 -0
  13. package/dist/core/mst-operations.d.ts +459 -0
  14. package/dist/core/mst-operations.js +885 -0
  15. package/dist/core/mst-operations.js.map +1 -0
  16. package/dist/core/node/BaseNode.d.ts +62 -0
  17. package/dist/core/node/BaseNode.js +152 -0
  18. package/dist/core/node/BaseNode.js.map +1 -0
  19. package/dist/core/node/Hook.d.ts +17 -0
  20. package/dist/core/node/Hook.js +15 -0
  21. package/dist/core/node/Hook.js.map +1 -0
  22. package/dist/core/node/create-node.d.ts +16 -0
  23. package/dist/core/node/create-node.js +41 -0
  24. package/dist/core/node/create-node.js.map +1 -0
  25. package/dist/core/node/identifier-cache.d.ts +19 -0
  26. package/dist/core/node/identifier-cache.js +115 -0
  27. package/dist/core/node/identifier-cache.js.map +1 -0
  28. package/dist/core/node/livelinessChecking.d.ts +37 -0
  29. package/dist/core/node/livelinessChecking.js +38 -0
  30. package/dist/core/node/livelinessChecking.js.map +1 -0
  31. package/dist/core/node/node-utils.d.ts +83 -0
  32. package/dist/core/node/node-utils.js +165 -0
  33. package/dist/core/node/node-utils.js.map +1 -0
  34. package/dist/core/node/object-node.d.ts +99 -0
  35. package/dist/core/node/object-node.js +545 -0
  36. package/dist/core/node/object-node.js.map +1 -0
  37. package/dist/core/node/scalar-node.d.ts +19 -0
  38. package/dist/core/node/scalar-node.js +89 -0
  39. package/dist/core/node/scalar-node.js.map +1 -0
  40. package/dist/core/process.d.ts +50 -0
  41. package/dist/core/process.js +39 -0
  42. package/dist/core/process.js.map +1 -0
  43. package/dist/core/type/type-checker.d.ts +69 -0
  44. package/dist/core/type/type-checker.js +154 -0
  45. package/dist/core/type/type-checker.js.map +1 -0
  46. package/dist/core/type/type.d.ts +317 -0
  47. package/dist/core/type/type.js +251 -0
  48. package/dist/core/type/type.js.map +1 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.js +85 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/internal.d.ts +39 -0
  53. package/dist/internal.js +60 -0
  54. package/dist/internal.js.map +1 -0
  55. package/dist/middlewares/create-action-tracking-middleware.d.ts +24 -0
  56. package/dist/middlewares/create-action-tracking-middleware.js +81 -0
  57. package/dist/middlewares/create-action-tracking-middleware.js.map +1 -0
  58. package/dist/middlewares/createActionTrackingMiddleware2.d.ts +34 -0
  59. package/dist/middlewares/createActionTrackingMiddleware2.js +133 -0
  60. package/dist/middlewares/createActionTrackingMiddleware2.js.map +1 -0
  61. package/dist/middlewares/on-action.d.ts +87 -0
  62. package/dist/middlewares/on-action.js +215 -0
  63. package/dist/middlewares/on-action.js.map +1 -0
  64. package/dist/mobx-state-tree.js +85 -0
  65. package/dist/mobx-state-tree.module.js +83 -0
  66. package/dist/types/complex-types/array.d.ts +80 -0
  67. package/dist/types/complex-types/array.js +352 -0
  68. package/dist/types/complex-types/array.js.map +1 -0
  69. package/dist/types/complex-types/map.d.ts +110 -0
  70. package/dist/types/complex-types/map.js +361 -0
  71. package/dist/types/complex-types/map.js.map +1 -0
  72. package/dist/types/complex-types/model.d.ts +192 -0
  73. package/dist/types/complex-types/model.js +477 -0
  74. package/dist/types/complex-types/model.js.map +1 -0
  75. package/dist/types/index.d.ts +33 -0
  76. package/dist/types/index.js +38 -0
  77. package/dist/types/index.js.map +1 -0
  78. package/dist/types/primitives.d.ts +124 -0
  79. package/dist/types/primitives.js +182 -0
  80. package/dist/types/primitives.js.map +1 -0
  81. package/dist/types/utility-types/custom.d.ts +74 -0
  82. package/dist/types/utility-types/custom.js +110 -0
  83. package/dist/types/utility-types/custom.js.map +1 -0
  84. package/dist/types/utility-types/enumeration.d.ts +5 -0
  85. package/dist/types/utility-types/enumeration.js +34 -0
  86. package/dist/types/utility-types/enumeration.js.map +1 -0
  87. package/dist/types/utility-types/frozen.d.ts +23 -0
  88. package/dist/types/utility-types/frozen.js +97 -0
  89. package/dist/types/utility-types/frozen.js.map +1 -0
  90. package/dist/types/utility-types/identifier.d.ts +86 -0
  91. package/dist/types/utility-types/identifier.js +129 -0
  92. package/dist/types/utility-types/identifier.js.map +1 -0
  93. package/dist/types/utility-types/late.d.ts +10 -0
  94. package/dist/types/utility-types/late.js +109 -0
  95. package/dist/types/utility-types/late.js.map +1 -0
  96. package/dist/types/utility-types/lazy.d.ts +22 -0
  97. package/dist/types/utility-types/lazy.js +76 -0
  98. package/dist/types/utility-types/lazy.js.map +1 -0
  99. package/dist/types/utility-types/literal.d.ts +37 -0
  100. package/dist/types/utility-types/literal.js +63 -0
  101. package/dist/types/utility-types/literal.js.map +1 -0
  102. package/dist/types/utility-types/maybe.d.ts +26 -0
  103. package/dist/types/utility-types/maybe.js +30 -0
  104. package/dist/types/utility-types/maybe.js.map +1 -0
  105. package/dist/types/utility-types/optional.d.ts +41 -0
  106. package/dist/types/utility-types/optional.js +140 -0
  107. package/dist/types/utility-types/optional.js.map +1 -0
  108. package/dist/types/utility-types/reference.d.ts +89 -0
  109. package/dist/types/utility-types/reference.js +392 -0
  110. package/dist/types/utility-types/reference.js.map +1 -0
  111. package/dist/types/utility-types/refinement.d.ts +10 -0
  112. package/dist/types/utility-types/refinement.js +85 -0
  113. package/dist/types/utility-types/refinement.js.map +1 -0
  114. package/dist/types/utility-types/resilient.d.ts +18 -0
  115. package/dist/types/utility-types/resilient.js +120 -0
  116. package/dist/types/utility-types/resilient.js.map +1 -0
  117. package/dist/types/utility-types/snapshotProcessor.d.ts +63 -0
  118. package/dist/types/utility-types/snapshotProcessor.js +161 -0
  119. package/dist/types/utility-types/snapshotProcessor.js.map +1 -0
  120. package/dist/types/utility-types/union.d.ts +77 -0
  121. package/dist/types/utility-types/union.js +245 -0
  122. package/dist/types/utility-types/union.js.map +1 -0
  123. package/dist/utils.d.ts +230 -0
  124. package/dist/utils.js +483 -0
  125. package/dist/utils.js.map +1 -0
  126. package/package.json +2 -2
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyAction = applyAction;
4
+ exports.recordActions = recordActions;
5
+ exports.onAction = onAction;
6
+ const mobx_1 = require("mobx");
7
+ const internal_ts_1 = require("../internal.js");
8
+ function serializeArgument(node, actionName, index, arg) {
9
+ if (arg instanceof Date) {
10
+ return { $MST_DATE: arg.getTime() };
11
+ }
12
+ if ((0, internal_ts_1.isPrimitive)(arg)) {
13
+ return arg;
14
+ }
15
+ // We should not serialize MST nodes, even if we can, because we don't know if the receiving party can handle a raw snapshot instead of an
16
+ // MST type instance. So if one wants to serialize a MST node that was pass in, either explitly pass: 1: an id, 2: a (relative) path, 3: a snapshot
17
+ if ((0, internal_ts_1.isStateTreeNode)(arg)) {
18
+ return serializeTheUnserializable(`[MSTNode: ${(0, internal_ts_1.getType)(arg).name}]`);
19
+ }
20
+ if (typeof arg === "function") {
21
+ return serializeTheUnserializable(`[function]`);
22
+ }
23
+ if (typeof arg === "object" && !(0, internal_ts_1.isPlainObject)(arg) && !(0, internal_ts_1.isArray)(arg)) {
24
+ return serializeTheUnserializable(`[object ${(arg && arg.constructor && arg.constructor.name) ||
25
+ "Complex Object"}]`);
26
+ }
27
+ try {
28
+ // Check if serializable, cycle free etc...
29
+ // MWE: there must be a better way....
30
+ JSON.stringify(arg); // or throws
31
+ return arg;
32
+ }
33
+ catch (e) {
34
+ return serializeTheUnserializable("" + e);
35
+ }
36
+ }
37
+ function deserializeArgument(adm, value) {
38
+ if (value && typeof value === "object" && "$MST_DATE" in value) {
39
+ return new Date(value["$MST_DATE"]);
40
+ }
41
+ return value;
42
+ }
43
+ function serializeTheUnserializable(baseType) {
44
+ return {
45
+ $MST_UNSERIALIZABLE: true,
46
+ type: baseType
47
+ };
48
+ }
49
+ /**
50
+ * Applies an action or a series of actions in a single MobX transaction.
51
+ * Does not return any value
52
+ * Takes an action description as produced by the `onAction` middleware.
53
+ *
54
+ * @param target
55
+ * @param actions
56
+ */
57
+ function applyAction(target, actions) {
58
+ // check all arguments
59
+ (0, internal_ts_1.assertIsStateTreeNode)(target, 1);
60
+ (0, internal_ts_1.assertArg)(actions, a => typeof a === "object", "object or array", 2);
61
+ (0, mobx_1.runInAction)(() => {
62
+ (0, internal_ts_1.asArray)(actions).forEach(action => baseApplyAction(target, action));
63
+ });
64
+ }
65
+ function baseApplyAction(target, action) {
66
+ const resolvedTarget = (0, internal_ts_1.tryResolve)(target, action.path || "");
67
+ if (!resolvedTarget) {
68
+ throw (0, internal_ts_1.fail)(`Invalid action path: ${action.path || ""}`);
69
+ }
70
+ const node = (0, internal_ts_1.getStateTreeNode)(resolvedTarget);
71
+ // Reserved functions
72
+ if (action.name === "@APPLY_PATCHES") {
73
+ return internal_ts_1.applyPatch.call(null, resolvedTarget, action.args[0]);
74
+ }
75
+ if (action.name === "@APPLY_SNAPSHOT") {
76
+ return internal_ts_1.applySnapshot.call(null, resolvedTarget, action.args[0]);
77
+ }
78
+ if (!(typeof resolvedTarget[action.name] === "function")) {
79
+ throw (0, internal_ts_1.fail)(`Action '${action.name}' does not exist in '${node.path}'`);
80
+ }
81
+ return resolvedTarget[action.name](...(action.args ? action.args.map(v => deserializeArgument(node, v)) : []));
82
+ }
83
+ /**
84
+ * Small abstraction around `onAction` and `applyAction`, attaches an action listener to a tree and records all the actions emitted.
85
+ * Returns an recorder object with the following signature:
86
+ *
87
+ * Example:
88
+ * ```ts
89
+ * export interface IActionRecorder {
90
+ * // the recorded actions
91
+ * actions: ISerializedActionCall[]
92
+ * // true if currently recording
93
+ * recording: boolean
94
+ * // stop recording actions
95
+ * stop(): void
96
+ * // resume recording actions
97
+ * resume(): void
98
+ * // apply all the recorded actions on the given object
99
+ * replay(target: IAnyStateTreeNode): void
100
+ * }
101
+ * ```
102
+ *
103
+ * The optional filter function allows to skip recording certain actions.
104
+ *
105
+ * @param subject
106
+ * @returns
107
+ */
108
+ function recordActions(subject, filter) {
109
+ // check all arguments
110
+ (0, internal_ts_1.assertIsStateTreeNode)(subject, 1);
111
+ const actions = [];
112
+ const listener = (call) => {
113
+ const recordThis = filter ? filter(call, (0, internal_ts_1.getRunningActionContext)()) : true;
114
+ if (recordThis) {
115
+ actions.push(call);
116
+ }
117
+ };
118
+ let disposer;
119
+ const recorder = {
120
+ actions,
121
+ get recording() {
122
+ return !!disposer;
123
+ },
124
+ stop() {
125
+ if (disposer) {
126
+ disposer();
127
+ disposer = undefined;
128
+ }
129
+ },
130
+ resume() {
131
+ if (disposer) {
132
+ return;
133
+ }
134
+ disposer = onAction(subject, listener);
135
+ },
136
+ replay(target) {
137
+ applyAction(target, actions);
138
+ }
139
+ };
140
+ recorder.resume();
141
+ return recorder;
142
+ }
143
+ /**
144
+ * Registers a function that will be invoked for each action that is called on the provided model instance, or to any of its children.
145
+ * See [actions](https://github.com/mobxjs/mobx-state-tree#actions) for more details. onAction events are emitted only for the outermost called action in the stack.
146
+ * Action can also be intercepted by middleware using addMiddleware to change the function call before it will be run.
147
+ *
148
+ * Not all action arguments might be serializable. For unserializable arguments, a struct like `{ $MST_UNSERIALIZABLE: true, type: "someType" }` will be generated.
149
+ * MST Nodes are considered non-serializable as well (they could be serialized as there snapshot, but it is uncertain whether an replaying party will be able to handle such a non-instantiated snapshot).
150
+ * Rather, when using `onAction` middleware, one should consider in passing arguments which are 1: an id, 2: a (relative) path, or 3: a snapshot. Instead of a real MST node.
151
+ *
152
+ * Example:
153
+ * ```ts
154
+ * const Todo = types.model({
155
+ * task: types.string
156
+ * })
157
+ *
158
+ * const TodoStore = types.model({
159
+ * todos: types.array(Todo)
160
+ * }).actions(self => ({
161
+ * add(todo) {
162
+ * self.todos.push(todo);
163
+ * }
164
+ * }))
165
+ *
166
+ * const s = TodoStore.create({ todos: [] })
167
+ *
168
+ * let disposer = onAction(s, (call) => {
169
+ * console.log(call);
170
+ * })
171
+ *
172
+ * s.add({ task: "Grab a coffee" })
173
+ * // Logs: { name: "add", path: "", args: [{ task: "Grab a coffee" }] }
174
+ * ```
175
+ *
176
+ * @param target
177
+ * @param listener
178
+ * @param attachAfter (default false) fires the listener *after* the action has executed instead of before.
179
+ * @returns
180
+ */
181
+ function onAction(target, listener, attachAfter = false) {
182
+ // check all arguments
183
+ (0, internal_ts_1.assertIsStateTreeNode)(target, 1);
184
+ if ((0, internal_ts_1.devMode)()) {
185
+ if (!(0, internal_ts_1.isRoot)(target)) {
186
+ (0, internal_ts_1.warnError)("Warning: Attaching onAction listeners to non root nodes is dangerous: No events will be emitted for actions initiated higher up in the tree.");
187
+ }
188
+ if (!(0, internal_ts_1.isProtected)(target)) {
189
+ (0, internal_ts_1.warnError)("Warning: Attaching onAction listeners to non protected nodes is dangerous: No events will be emitted for direct modifications without action.");
190
+ }
191
+ }
192
+ return (0, internal_ts_1.addMiddleware)(target, function handler(rawCall, next) {
193
+ if (rawCall.type === "action" && rawCall.id === rawCall.rootId) {
194
+ const sourceNode = (0, internal_ts_1.getStateTreeNode)(rawCall.context);
195
+ const info = {
196
+ name: rawCall.name,
197
+ path: (0, internal_ts_1.getRelativePathBetweenNodes)((0, internal_ts_1.getStateTreeNode)(target), sourceNode),
198
+ args: rawCall.args.map((arg, index) => serializeArgument(sourceNode, rawCall.name, index, arg))
199
+ };
200
+ if (attachAfter) {
201
+ const res = next(rawCall);
202
+ listener(info);
203
+ return res;
204
+ }
205
+ else {
206
+ listener(info);
207
+ return next(rawCall);
208
+ }
209
+ }
210
+ else {
211
+ return next(rawCall);
212
+ }
213
+ });
214
+ }
215
+ //# sourceMappingURL=on-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"on-action.js","sourceRoot":"","sources":["../../src/middlewares/on-action.ts"],"names":[],"mappings":";;AAuGA,kCAWC;AAqDD,sCA2CC;AAwCD,4BA0CC;AApSD,+BAAkC;AAElC,gDAyBuB;AAgBvB,SAAS,iBAAiB,CACxB,IAAa,EACb,UAAkB,EAClB,KAAa,EACb,GAAQ;IAER,IAAI,GAAG,YAAY,IAAI,EAAE,CAAC;QACxB,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,EAAE,CAAA;IACrC,CAAC;IACD,IAAI,IAAA,yBAAW,EAAC,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,0IAA0I;IAC1I,mJAAmJ;IACnJ,IAAI,IAAA,6BAAe,EAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,0BAA0B,CAAC,aAAa,IAAA,qBAAO,EAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;IACtE,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,0BAA0B,CAAC,YAAY,CAAC,CAAA;IACjD,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAA,2BAAa,EAAC,GAAG,CAAC,IAAI,CAAC,IAAA,qBAAO,EAAC,GAAG,CAAC,EAAE,CAAC;QACpE,OAAO,0BAA0B,CAC/B,WACE,CAAC,GAAG,IAAK,GAAW,CAAC,WAAW,IAAK,GAAW,CAAC,WAAW,CAAC,IAAI,CAAC;YAClE,gBACF,GAAG,CACJ,CAAA;IACH,CAAC;IACD,IAAI,CAAC;QACH,2CAA2C;QAC3C,sCAAsC;QACtC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA,CAAC,YAAY;QAChC,OAAO,GAAG,CAAA;IACZ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC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AO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;YAC/D,MAAM,UAAU,GAAG,IAAA,8BAAgB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACpD,MAAM,IAAI,GAAG;gBACX,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,IAAA,yCAA2B,EAAC,IAAA,8BAAgB,EAAC,MAAM,CAAC,EAAE,UAAU,CAAC;gBACvE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,KAAa,EAAE,EAAE,CACjD,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CACxD;aACF,CAAA;YACD,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAA;gBACzB,QAAQ,CAAC,IAAI,CAAC,CAAA;gBACd,OAAO,GAAG,CAAA;YACZ,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,CAAA;gBACd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;QACtB,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.isRefinementType = exports.isReferenceType = exports.isProtected = exports.isPrimitiveType = exports.isOptionalType = exports.isModelType = exports.isMapType = exports.isLiteralType = exports.isLateType = exports.isIdentifierType = exports.isFrozenType = exports.isArrayType = exports.isAlive = exports.isActionContextThisOrChildOf = exports.isActionContextChildOf = exports.hasParentOfType = exports.hasParent = exports.getType = exports.getSnapshot = exports.getRunningActionContext = exports.getRoot = exports.getRelativePath = exports.getPropertyMembers = exports.getPathParts = exports.getPath = exports.getParentOfType = exports.getParent = exports.getNodeId = exports.getMembers = exports.getLivelinessChecking = exports.getIdentifier = exports.getEnv = exports.getChildType = exports.flow = exports.escapeJsonPath = exports.detach = exports.destroy = exports.decorate = exports.createActionTrackingMiddleware = exports.createActionTrackingMiddleware2 = exports.clone = exports.castToSnapshot = exports.castToReferenceSnapshot = exports.castFlowReturn = exports.cast = exports.applySnapshot = exports.applyPatch = exports.applyAction = exports.addMiddleware = exports.addDisposer = void 0;
5
+ exports.setDevMode = exports.walk = exports.unprotect = exports.unescapeJsonPath = exports.t = exports.types = exports.typecheck = exports.tryResolve = exports.tryReference = exports.toGeneratorFunction = exports.toGenerator = exports.splitJsonPath = exports.setLivelynessChecking = exports.setLivelinessChecking = exports.resolvePath = exports.resolveIdentifier = exports.recordPatches = exports.recordActions = exports.protect = exports.process = exports.onSnapshot = exports.onPatch = exports.onAction = exports.joinJsonPath = exports.isValidReference = exports.isUnionType = exports.isType = exports.isStateTreeNode = exports.isRoot = void 0;
6
+ var internal_ts_1 = require("./internal.js");
7
+ Object.defineProperty(exports, "addDisposer", { enumerable: true, get: function () { return internal_ts_1.addDisposer; } });
8
+ Object.defineProperty(exports, "addMiddleware", { enumerable: true, get: function () { return internal_ts_1.addMiddleware; } });
9
+ Object.defineProperty(exports, "applyAction", { enumerable: true, get: function () { return internal_ts_1.applyAction; } });
10
+ Object.defineProperty(exports, "applyPatch", { enumerable: true, get: function () { return internal_ts_1.applyPatch; } });
11
+ Object.defineProperty(exports, "applySnapshot", { enumerable: true, get: function () { return internal_ts_1.applySnapshot; } });
12
+ Object.defineProperty(exports, "cast", { enumerable: true, get: function () { return internal_ts_1.cast; } });
13
+ Object.defineProperty(exports, "castFlowReturn", { enumerable: true, get: function () { return internal_ts_1.castFlowReturn; } });
14
+ Object.defineProperty(exports, "castToReferenceSnapshot", { enumerable: true, get: function () { return internal_ts_1.castToReferenceSnapshot; } });
15
+ Object.defineProperty(exports, "castToSnapshot", { enumerable: true, get: function () { return internal_ts_1.castToSnapshot; } });
16
+ Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return internal_ts_1.clone; } });
17
+ Object.defineProperty(exports, "createActionTrackingMiddleware2", { enumerable: true, get: function () { return internal_ts_1.createActionTrackingMiddleware2; } });
18
+ Object.defineProperty(exports, "createActionTrackingMiddleware", { enumerable: true, get: function () { return internal_ts_1.createActionTrackingMiddleware; } });
19
+ Object.defineProperty(exports, "decorate", { enumerable: true, get: function () { return internal_ts_1.decorate; } });
20
+ Object.defineProperty(exports, "destroy", { enumerable: true, get: function () { return internal_ts_1.destroy; } });
21
+ Object.defineProperty(exports, "detach", { enumerable: true, get: function () { return internal_ts_1.detach; } });
22
+ Object.defineProperty(exports, "escapeJsonPath", { enumerable: true, get: function () { return internal_ts_1.escapeJsonPath; } });
23
+ Object.defineProperty(exports, "flow", { enumerable: true, get: function () { return internal_ts_1.flow; } });
24
+ Object.defineProperty(exports, "getChildType", { enumerable: true, get: function () { return internal_ts_1.getChildType; } });
25
+ Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return internal_ts_1.getEnv; } });
26
+ Object.defineProperty(exports, "getIdentifier", { enumerable: true, get: function () { return internal_ts_1.getIdentifier; } });
27
+ Object.defineProperty(exports, "getLivelinessChecking", { enumerable: true, get: function () { return internal_ts_1.getLivelinessChecking; } });
28
+ Object.defineProperty(exports, "getMembers", { enumerable: true, get: function () { return internal_ts_1.getMembers; } });
29
+ Object.defineProperty(exports, "getNodeId", { enumerable: true, get: function () { return internal_ts_1.getNodeId; } });
30
+ Object.defineProperty(exports, "getParent", { enumerable: true, get: function () { return internal_ts_1.getParent; } });
31
+ Object.defineProperty(exports, "getParentOfType", { enumerable: true, get: function () { return internal_ts_1.getParentOfType; } });
32
+ Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return internal_ts_1.getPath; } });
33
+ Object.defineProperty(exports, "getPathParts", { enumerable: true, get: function () { return internal_ts_1.getPathParts; } });
34
+ Object.defineProperty(exports, "getPropertyMembers", { enumerable: true, get: function () { return internal_ts_1.getPropertyMembers; } });
35
+ Object.defineProperty(exports, "getRelativePath", { enumerable: true, get: function () { return internal_ts_1.getRelativePath; } });
36
+ Object.defineProperty(exports, "getRoot", { enumerable: true, get: function () { return internal_ts_1.getRoot; } });
37
+ Object.defineProperty(exports, "getRunningActionContext", { enumerable: true, get: function () { return internal_ts_1.getRunningActionContext; } });
38
+ Object.defineProperty(exports, "getSnapshot", { enumerable: true, get: function () { return internal_ts_1.getSnapshot; } });
39
+ Object.defineProperty(exports, "getType", { enumerable: true, get: function () { return internal_ts_1.getType; } });
40
+ Object.defineProperty(exports, "hasParent", { enumerable: true, get: function () { return internal_ts_1.hasParent; } });
41
+ Object.defineProperty(exports, "hasParentOfType", { enumerable: true, get: function () { return internal_ts_1.hasParentOfType; } });
42
+ Object.defineProperty(exports, "isActionContextChildOf", { enumerable: true, get: function () { return internal_ts_1.isActionContextChildOf; } });
43
+ Object.defineProperty(exports, "isActionContextThisOrChildOf", { enumerable: true, get: function () { return internal_ts_1.isActionContextThisOrChildOf; } });
44
+ Object.defineProperty(exports, "isAlive", { enumerable: true, get: function () { return internal_ts_1.isAlive; } });
45
+ Object.defineProperty(exports, "isArrayType", { enumerable: true, get: function () { return internal_ts_1.isArrayType; } });
46
+ Object.defineProperty(exports, "isFrozenType", { enumerable: true, get: function () { return internal_ts_1.isFrozenType; } });
47
+ Object.defineProperty(exports, "isIdentifierType", { enumerable: true, get: function () { return internal_ts_1.isIdentifierType; } });
48
+ Object.defineProperty(exports, "isLateType", { enumerable: true, get: function () { return internal_ts_1.isLateType; } });
49
+ Object.defineProperty(exports, "isLiteralType", { enumerable: true, get: function () { return internal_ts_1.isLiteralType; } });
50
+ Object.defineProperty(exports, "isMapType", { enumerable: true, get: function () { return internal_ts_1.isMapType; } });
51
+ Object.defineProperty(exports, "isModelType", { enumerable: true, get: function () { return internal_ts_1.isModelType; } });
52
+ Object.defineProperty(exports, "isOptionalType", { enumerable: true, get: function () { return internal_ts_1.isOptionalType; } });
53
+ Object.defineProperty(exports, "isPrimitiveType", { enumerable: true, get: function () { return internal_ts_1.isPrimitiveType; } });
54
+ Object.defineProperty(exports, "isProtected", { enumerable: true, get: function () { return internal_ts_1.isProtected; } });
55
+ Object.defineProperty(exports, "isReferenceType", { enumerable: true, get: function () { return internal_ts_1.isReferenceType; } });
56
+ Object.defineProperty(exports, "isRefinementType", { enumerable: true, get: function () { return internal_ts_1.isRefinementType; } });
57
+ Object.defineProperty(exports, "isRoot", { enumerable: true, get: function () { return internal_ts_1.isRoot; } });
58
+ Object.defineProperty(exports, "isStateTreeNode", { enumerable: true, get: function () { return internal_ts_1.isStateTreeNode; } });
59
+ Object.defineProperty(exports, "isType", { enumerable: true, get: function () { return internal_ts_1.isType; } });
60
+ Object.defineProperty(exports, "isUnionType", { enumerable: true, get: function () { return internal_ts_1.isUnionType; } });
61
+ Object.defineProperty(exports, "isValidReference", { enumerable: true, get: function () { return internal_ts_1.isValidReference; } });
62
+ Object.defineProperty(exports, "joinJsonPath", { enumerable: true, get: function () { return internal_ts_1.joinJsonPath; } });
63
+ Object.defineProperty(exports, "onAction", { enumerable: true, get: function () { return internal_ts_1.onAction; } });
64
+ Object.defineProperty(exports, "onPatch", { enumerable: true, get: function () { return internal_ts_1.onPatch; } });
65
+ Object.defineProperty(exports, "onSnapshot", { enumerable: true, get: function () { return internal_ts_1.onSnapshot; } });
66
+ Object.defineProperty(exports, "process", { enumerable: true, get: function () { return internal_ts_1.process; } });
67
+ Object.defineProperty(exports, "protect", { enumerable: true, get: function () { return internal_ts_1.protect; } });
68
+ Object.defineProperty(exports, "recordActions", { enumerable: true, get: function () { return internal_ts_1.recordActions; } });
69
+ Object.defineProperty(exports, "recordPatches", { enumerable: true, get: function () { return internal_ts_1.recordPatches; } });
70
+ Object.defineProperty(exports, "resolveIdentifier", { enumerable: true, get: function () { return internal_ts_1.resolveIdentifier; } });
71
+ Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return internal_ts_1.resolvePath; } });
72
+ Object.defineProperty(exports, "setLivelinessChecking", { enumerable: true, get: function () { return internal_ts_1.setLivelinessChecking; } });
73
+ Object.defineProperty(exports, "setLivelynessChecking", { enumerable: true, get: function () { return internal_ts_1.setLivelynessChecking; } });
74
+ Object.defineProperty(exports, "splitJsonPath", { enumerable: true, get: function () { return internal_ts_1.splitJsonPath; } });
75
+ Object.defineProperty(exports, "toGenerator", { enumerable: true, get: function () { return internal_ts_1.toGenerator; } });
76
+ Object.defineProperty(exports, "toGeneratorFunction", { enumerable: true, get: function () { return internal_ts_1.toGeneratorFunction; } });
77
+ Object.defineProperty(exports, "tryReference", { enumerable: true, get: function () { return internal_ts_1.tryReference; } });
78
+ Object.defineProperty(exports, "tryResolve", { enumerable: true, get: function () { return internal_ts_1.tryResolve; } });
79
+ Object.defineProperty(exports, "typecheck", { enumerable: true, get: function () { return internal_ts_1.typecheck; } });
80
+ Object.defineProperty(exports, "types", { enumerable: true, get: function () { return internal_ts_1.types; } });
81
+ Object.defineProperty(exports, "t", { enumerable: true, get: function () { return internal_ts_1.types; } });
82
+ Object.defineProperty(exports, "unescapeJsonPath", { enumerable: true, get: function () { return internal_ts_1.unescapeJsonPath; } });
83
+ Object.defineProperty(exports, "unprotect", { enumerable: true, get: function () { return internal_ts_1.unprotect; } });
84
+ Object.defineProperty(exports, "walk", { enumerable: true, get: function () { return internal_ts_1.walk; } });
85
+ Object.defineProperty(exports, "setDevMode", { enumerable: true, get: function () { return internal_ts_1.setDevMode; } });
@@ -0,0 +1,83 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.isRefinementType = exports.isReferenceType = exports.isProtected = exports.isPrimitiveType = exports.isOptionalType = exports.isModelType = exports.isMapType = exports.isLiteralType = exports.isLateType = exports.isIdentifierType = exports.isFrozenType = exports.isArrayType = exports.isAlive = exports.isActionContextThisOrChildOf = exports.isActionContextChildOf = exports.hasParentOfType = exports.hasParent = exports.getType = exports.getSnapshot = exports.getRunningActionContext = exports.getRoot = exports.getRelativePath = exports.getPropertyMembers = exports.getPathParts = exports.getPath = exports.getParentOfType = exports.getParent = exports.getNodeId = exports.getMembers = exports.getLivelinessChecking = exports.getIdentifier = exports.getEnv = exports.getChildType = exports.flow = exports.escapeJsonPath = exports.detach = exports.destroy = exports.decorate = exports.createActionTrackingMiddleware = exports.createActionTrackingMiddleware2 = exports.clone = exports.castToSnapshot = exports.castToReferenceSnapshot = exports.castFlowReturn = exports.cast = exports.applySnapshot = exports.applyPatch = exports.applyAction = exports.addMiddleware = exports.addDisposer = void 0;
3
+ exports.setDevMode = exports.walk = exports.unprotect = exports.unescapeJsonPath = exports.t = exports.types = exports.typecheck = exports.tryResolve = exports.tryReference = exports.toGeneratorFunction = exports.toGenerator = exports.splitJsonPath = exports.setLivelynessChecking = exports.setLivelinessChecking = exports.resolvePath = exports.resolveIdentifier = exports.recordPatches = exports.recordActions = exports.protect = exports.process = exports.onSnapshot = exports.onPatch = exports.onAction = exports.joinJsonPath = exports.isValidReference = exports.isUnionType = exports.isType = exports.isStateTreeNode = exports.isRoot = void 0;
4
+ var internal_ts_1 = require("./internal.js");
5
+ Object.defineProperty(exports, "addDisposer", { enumerable: true, get: function () { return internal_ts_1.addDisposer; } });
6
+ Object.defineProperty(exports, "addMiddleware", { enumerable: true, get: function () { return internal_ts_1.addMiddleware; } });
7
+ Object.defineProperty(exports, "applyAction", { enumerable: true, get: function () { return internal_ts_1.applyAction; } });
8
+ Object.defineProperty(exports, "applyPatch", { enumerable: true, get: function () { return internal_ts_1.applyPatch; } });
9
+ Object.defineProperty(exports, "applySnapshot", { enumerable: true, get: function () { return internal_ts_1.applySnapshot; } });
10
+ Object.defineProperty(exports, "cast", { enumerable: true, get: function () { return internal_ts_1.cast; } });
11
+ Object.defineProperty(exports, "castFlowReturn", { enumerable: true, get: function () { return internal_ts_1.castFlowReturn; } });
12
+ Object.defineProperty(exports, "castToReferenceSnapshot", { enumerable: true, get: function () { return internal_ts_1.castToReferenceSnapshot; } });
13
+ Object.defineProperty(exports, "castToSnapshot", { enumerable: true, get: function () { return internal_ts_1.castToSnapshot; } });
14
+ Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return internal_ts_1.clone; } });
15
+ Object.defineProperty(exports, "createActionTrackingMiddleware2", { enumerable: true, get: function () { return internal_ts_1.createActionTrackingMiddleware2; } });
16
+ Object.defineProperty(exports, "createActionTrackingMiddleware", { enumerable: true, get: function () { return internal_ts_1.createActionTrackingMiddleware; } });
17
+ Object.defineProperty(exports, "decorate", { enumerable: true, get: function () { return internal_ts_1.decorate; } });
18
+ Object.defineProperty(exports, "destroy", { enumerable: true, get: function () { return internal_ts_1.destroy; } });
19
+ Object.defineProperty(exports, "detach", { enumerable: true, get: function () { return internal_ts_1.detach; } });
20
+ Object.defineProperty(exports, "escapeJsonPath", { enumerable: true, get: function () { return internal_ts_1.escapeJsonPath; } });
21
+ Object.defineProperty(exports, "flow", { enumerable: true, get: function () { return internal_ts_1.flow; } });
22
+ Object.defineProperty(exports, "getChildType", { enumerable: true, get: function () { return internal_ts_1.getChildType; } });
23
+ Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return internal_ts_1.getEnv; } });
24
+ Object.defineProperty(exports, "getIdentifier", { enumerable: true, get: function () { return internal_ts_1.getIdentifier; } });
25
+ Object.defineProperty(exports, "getLivelinessChecking", { enumerable: true, get: function () { return internal_ts_1.getLivelinessChecking; } });
26
+ Object.defineProperty(exports, "getMembers", { enumerable: true, get: function () { return internal_ts_1.getMembers; } });
27
+ Object.defineProperty(exports, "getNodeId", { enumerable: true, get: function () { return internal_ts_1.getNodeId; } });
28
+ Object.defineProperty(exports, "getParent", { enumerable: true, get: function () { return internal_ts_1.getParent; } });
29
+ Object.defineProperty(exports, "getParentOfType", { enumerable: true, get: function () { return internal_ts_1.getParentOfType; } });
30
+ Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return internal_ts_1.getPath; } });
31
+ Object.defineProperty(exports, "getPathParts", { enumerable: true, get: function () { return internal_ts_1.getPathParts; } });
32
+ Object.defineProperty(exports, "getPropertyMembers", { enumerable: true, get: function () { return internal_ts_1.getPropertyMembers; } });
33
+ Object.defineProperty(exports, "getRelativePath", { enumerable: true, get: function () { return internal_ts_1.getRelativePath; } });
34
+ Object.defineProperty(exports, "getRoot", { enumerable: true, get: function () { return internal_ts_1.getRoot; } });
35
+ Object.defineProperty(exports, "getRunningActionContext", { enumerable: true, get: function () { return internal_ts_1.getRunningActionContext; } });
36
+ Object.defineProperty(exports, "getSnapshot", { enumerable: true, get: function () { return internal_ts_1.getSnapshot; } });
37
+ Object.defineProperty(exports, "getType", { enumerable: true, get: function () { return internal_ts_1.getType; } });
38
+ Object.defineProperty(exports, "hasParent", { enumerable: true, get: function () { return internal_ts_1.hasParent; } });
39
+ Object.defineProperty(exports, "hasParentOfType", { enumerable: true, get: function () { return internal_ts_1.hasParentOfType; } });
40
+ Object.defineProperty(exports, "isActionContextChildOf", { enumerable: true, get: function () { return internal_ts_1.isActionContextChildOf; } });
41
+ Object.defineProperty(exports, "isActionContextThisOrChildOf", { enumerable: true, get: function () { return internal_ts_1.isActionContextThisOrChildOf; } });
42
+ Object.defineProperty(exports, "isAlive", { enumerable: true, get: function () { return internal_ts_1.isAlive; } });
43
+ Object.defineProperty(exports, "isArrayType", { enumerable: true, get: function () { return internal_ts_1.isArrayType; } });
44
+ Object.defineProperty(exports, "isFrozenType", { enumerable: true, get: function () { return internal_ts_1.isFrozenType; } });
45
+ Object.defineProperty(exports, "isIdentifierType", { enumerable: true, get: function () { return internal_ts_1.isIdentifierType; } });
46
+ Object.defineProperty(exports, "isLateType", { enumerable: true, get: function () { return internal_ts_1.isLateType; } });
47
+ Object.defineProperty(exports, "isLiteralType", { enumerable: true, get: function () { return internal_ts_1.isLiteralType; } });
48
+ Object.defineProperty(exports, "isMapType", { enumerable: true, get: function () { return internal_ts_1.isMapType; } });
49
+ Object.defineProperty(exports, "isModelType", { enumerable: true, get: function () { return internal_ts_1.isModelType; } });
50
+ Object.defineProperty(exports, "isOptionalType", { enumerable: true, get: function () { return internal_ts_1.isOptionalType; } });
51
+ Object.defineProperty(exports, "isPrimitiveType", { enumerable: true, get: function () { return internal_ts_1.isPrimitiveType; } });
52
+ Object.defineProperty(exports, "isProtected", { enumerable: true, get: function () { return internal_ts_1.isProtected; } });
53
+ Object.defineProperty(exports, "isReferenceType", { enumerable: true, get: function () { return internal_ts_1.isReferenceType; } });
54
+ Object.defineProperty(exports, "isRefinementType", { enumerable: true, get: function () { return internal_ts_1.isRefinementType; } });
55
+ Object.defineProperty(exports, "isRoot", { enumerable: true, get: function () { return internal_ts_1.isRoot; } });
56
+ Object.defineProperty(exports, "isStateTreeNode", { enumerable: true, get: function () { return internal_ts_1.isStateTreeNode; } });
57
+ Object.defineProperty(exports, "isType", { enumerable: true, get: function () { return internal_ts_1.isType; } });
58
+ Object.defineProperty(exports, "isUnionType", { enumerable: true, get: function () { return internal_ts_1.isUnionType; } });
59
+ Object.defineProperty(exports, "isValidReference", { enumerable: true, get: function () { return internal_ts_1.isValidReference; } });
60
+ Object.defineProperty(exports, "joinJsonPath", { enumerable: true, get: function () { return internal_ts_1.joinJsonPath; } });
61
+ Object.defineProperty(exports, "onAction", { enumerable: true, get: function () { return internal_ts_1.onAction; } });
62
+ Object.defineProperty(exports, "onPatch", { enumerable: true, get: function () { return internal_ts_1.onPatch; } });
63
+ Object.defineProperty(exports, "onSnapshot", { enumerable: true, get: function () { return internal_ts_1.onSnapshot; } });
64
+ Object.defineProperty(exports, "process", { enumerable: true, get: function () { return internal_ts_1.process; } });
65
+ Object.defineProperty(exports, "protect", { enumerable: true, get: function () { return internal_ts_1.protect; } });
66
+ Object.defineProperty(exports, "recordActions", { enumerable: true, get: function () { return internal_ts_1.recordActions; } });
67
+ Object.defineProperty(exports, "recordPatches", { enumerable: true, get: function () { return internal_ts_1.recordPatches; } });
68
+ Object.defineProperty(exports, "resolveIdentifier", { enumerable: true, get: function () { return internal_ts_1.resolveIdentifier; } });
69
+ Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return internal_ts_1.resolvePath; } });
70
+ Object.defineProperty(exports, "setLivelinessChecking", { enumerable: true, get: function () { return internal_ts_1.setLivelinessChecking; } });
71
+ Object.defineProperty(exports, "setLivelynessChecking", { enumerable: true, get: function () { return internal_ts_1.setLivelynessChecking; } });
72
+ Object.defineProperty(exports, "splitJsonPath", { enumerable: true, get: function () { return internal_ts_1.splitJsonPath; } });
73
+ Object.defineProperty(exports, "toGenerator", { enumerable: true, get: function () { return internal_ts_1.toGenerator; } });
74
+ Object.defineProperty(exports, "toGeneratorFunction", { enumerable: true, get: function () { return internal_ts_1.toGeneratorFunction; } });
75
+ Object.defineProperty(exports, "tryReference", { enumerable: true, get: function () { return internal_ts_1.tryReference; } });
76
+ Object.defineProperty(exports, "tryResolve", { enumerable: true, get: function () { return internal_ts_1.tryResolve; } });
77
+ Object.defineProperty(exports, "typecheck", { enumerable: true, get: function () { return internal_ts_1.typecheck; } });
78
+ Object.defineProperty(exports, "types", { enumerable: true, get: function () { return internal_ts_1.types; } });
79
+ Object.defineProperty(exports, "t", { enumerable: true, get: function () { return internal_ts_1.types; } });
80
+ Object.defineProperty(exports, "unescapeJsonPath", { enumerable: true, get: function () { return internal_ts_1.unescapeJsonPath; } });
81
+ Object.defineProperty(exports, "unprotect", { enumerable: true, get: function () { return internal_ts_1.unprotect; } });
82
+ Object.defineProperty(exports, "walk", { enumerable: true, get: function () { return internal_ts_1.walk; } });
83
+ Object.defineProperty(exports, "setDevMode", { enumerable: true, get: function () { return internal_ts_1.setDevMode; } });
@@ -0,0 +1,80 @@
1
+ import { type IArrayDidChange, type IArraySplice, type IArrayWillChange, type IArrayWillSplice, type IObservableArray } from "mobx";
2
+ import { type AnyNode, type AnyObjectNode, ComplexType, type ExtractCSTWithSTN, type IAnyType, type IChildNodesMap, type IHooksGetter, type IJsonPatch, type IType, type IValidationContext, type IValidationResult, TypeFlags } from "../../internal.ts";
3
+ /** @hidden */
4
+ export interface IMSTArray<IT extends IAnyType> extends IObservableArray<IT["Type"]> {
5
+ push(...items: IT["Type"][]): number;
6
+ push(...items: ExtractCSTWithSTN<IT>[]): number;
7
+ concat(...items: ConcatArray<IT["Type"]>[]): IT["Type"][];
8
+ concat(...items: ConcatArray<ExtractCSTWithSTN<IT>>[]): IT["Type"][];
9
+ concat(...items: (IT["Type"] | ConcatArray<IT["Type"]>)[]): IT["Type"][];
10
+ concat(...items: (ExtractCSTWithSTN<IT> | ConcatArray<ExtractCSTWithSTN<IT>>)[]): IT["Type"][];
11
+ splice(start: number, deleteCount?: number): IT["Type"][];
12
+ splice(start: number, deleteCount: number, ...items: IT["Type"][]): IT["Type"][];
13
+ splice(start: number, deleteCount: number, ...items: ExtractCSTWithSTN<IT>[]): IT["Type"][];
14
+ unshift(...items: IT["Type"][]): number;
15
+ unshift(...items: ExtractCSTWithSTN<IT>[]): number;
16
+ }
17
+ /** @hidden */
18
+ export interface IArrayType<IT extends IAnyType> extends IType<readonly IT["CreationType"][] | undefined, IT["SnapshotType"][], IMSTArray<IT>> {
19
+ hooks(hooks: IHooksGetter<IMSTArray<IAnyType>>): IArrayType<IT>;
20
+ }
21
+ /**
22
+ * @internal
23
+ * @hidden
24
+ */
25
+ export declare class ArrayType<IT extends IAnyType> extends ComplexType<readonly IT["CreationType"][] | undefined, IT["SnapshotType"][], IMSTArray<IT>> {
26
+ private readonly _subType;
27
+ readonly flags = TypeFlags.Array;
28
+ private readonly hookInitializers;
29
+ constructor(name: string, _subType: IT, hookInitializers?: Array<IHooksGetter<IMSTArray<IT>>>);
30
+ hooks(hooks: IHooksGetter<IMSTArray<IT>>): ArrayType<IT>;
31
+ instantiate(parent: AnyObjectNode | null, subpath: string, environment: any, initialValue: this["C"] | this["T"]): this["N"];
32
+ initializeChildNodes(objNode: this["N"], snapshot?: this["C"]): IChildNodesMap;
33
+ createNewInstance(childNodes: IChildNodesMap): this["T"];
34
+ finalizeNewInstance(node: this["N"], instance: this["T"]): void;
35
+ describe(): string;
36
+ getChildren(node: this["N"]): AnyNode[];
37
+ getChildNode(node: this["N"], key: string): AnyNode;
38
+ willChange(change: IArrayWillChange<AnyNode> | IArrayWillSplice<AnyNode>): IArrayWillChange<AnyNode> | IArrayWillSplice<AnyNode> | null;
39
+ getSnapshot(node: this["N"]): this["S"];
40
+ processInitialSnapshot(childNodes: IChildNodesMap): this["S"];
41
+ didChange(change: IArrayDidChange<AnyNode> | IArraySplice<AnyNode>): void;
42
+ applyPatchLocally(node: this["N"], subpath: string, patch: IJsonPatch): void;
43
+ applySnapshot(node: this["N"], snapshot: this["C"]): void;
44
+ getChildType(): IAnyType;
45
+ isValidSnapshot(value: this["C"], context: IValidationContext): IValidationResult;
46
+ getDefaultSnapshot(): this["C"];
47
+ removeChild(node: this["N"], subpath: string): void;
48
+ }
49
+ /**
50
+ * `types.array` - Creates an index based collection type who's children are all of a uniform declared type.
51
+ *
52
+ * This type will always produce [observable arrays](https://mobx.js.org/api.html#observablearray)
53
+ *
54
+ * Example:
55
+ * ```ts
56
+ * const Todo = types.model({
57
+ * task: types.string
58
+ * })
59
+ *
60
+ * const TodoStore = types.model({
61
+ * todos: types.array(Todo)
62
+ * })
63
+ *
64
+ * const s = TodoStore.create({ todos: [] })
65
+ * unprotect(s) // needed to allow modifying outside of an action
66
+ * s.todos.push({ task: "Grab coffee" })
67
+ * console.log(s.todos[0]) // prints: "Grab coffee"
68
+ * ```
69
+ *
70
+ * @param subtype
71
+ * @returns
72
+ */
73
+ export declare function array<IT extends IAnyType>(subtype: IT): IArrayType<IT>;
74
+ /**
75
+ * Returns if a given value represents an array type.
76
+ *
77
+ * @param type
78
+ * @returns `true` if the type is an array type.
79
+ */
80
+ export declare function isArrayType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IArrayType<Items>;