@jbrowse/mobx-state-tree 5.10.7 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -1
- package/dist/mobx-state-tree.cjs +179 -132
- package/dist/mobx-state-tree.cjs.map +1 -1
- package/dist/mobx-state-tree.mjs +179 -133
- package/dist/mobx-state-tree.mjs.map +1 -1
- package/package.json +1 -1
package/dist/mobx-state-tree.mjs
CHANGED
|
@@ -978,7 +978,7 @@ class BaseNode {
|
|
|
978
978
|
if (this._escapedSubpath === undefined) {
|
|
979
979
|
this._escapedSubpath = !this._subpath ? "" : escapeJsonPath(this._subpath);
|
|
980
980
|
}
|
|
981
|
-
return
|
|
981
|
+
return `${this.parent.getEscapedPath(reportObserved)}/${this._escapedSubpath}`;
|
|
982
982
|
}
|
|
983
983
|
get isRoot() {
|
|
984
984
|
return this.parent === null;
|
|
@@ -1212,9 +1212,8 @@ class ObjectNode extends BaseNode {
|
|
|
1212
1212
|
// uninitialized parent
|
|
1213
1213
|
// this is done to avoid traversing the whole tree to the root when using
|
|
1214
1214
|
// the same reference again
|
|
1215
|
-
while (parent
|
|
1216
|
-
|
|
1217
|
-
0 /* ObservableInstanceLifecycle.UNINITIALIZED */) {
|
|
1215
|
+
while (parent?._observableInstanceState ===
|
|
1216
|
+
0 /* ObservableInstanceLifecycle.UNINITIALIZED */) {
|
|
1218
1217
|
parentChain.unshift(parent);
|
|
1219
1218
|
parent = parent.parent;
|
|
1220
1219
|
}
|
|
@@ -1402,12 +1401,9 @@ class ObjectNode extends BaseNode {
|
|
|
1402
1401
|
actionContext = actionContext.parentActionEvent;
|
|
1403
1402
|
}
|
|
1404
1403
|
let actionFullPath = "";
|
|
1405
|
-
if (actionContext
|
|
1404
|
+
if (actionContext?.name != null) {
|
|
1406
1405
|
// try to use the context, and if it not available use the node one
|
|
1407
|
-
const actionPath = (actionContext &&
|
|
1408
|
-
actionContext.context &&
|
|
1409
|
-
getPath(actionContext.context)) ||
|
|
1410
|
-
escapedPath;
|
|
1406
|
+
const actionPath = (actionContext.context && getPath(actionContext.context)) || escapedPath;
|
|
1411
1407
|
actionFullPath = `${actionPath}.${actionContext.name}()`;
|
|
1412
1408
|
}
|
|
1413
1409
|
return `You are trying to read or write to an object that is no longer part of a state tree. (Object type: '${this.type.name}', Path upon death: '${escapedPath}', Subpath: '${subpath}', Action: '${actionFullPath}'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.`;
|
|
@@ -1554,9 +1550,10 @@ class ObjectNode extends BaseNode {
|
|
|
1554
1550
|
}
|
|
1555
1551
|
emitPatch(basePatch, source) {
|
|
1556
1552
|
if (this._internalEventsHasSubscribers("patch" /* InternalEvents.Patch */)) {
|
|
1557
|
-
const localizedPatch =
|
|
1558
|
-
|
|
1559
|
-
|
|
1553
|
+
const localizedPatch = {
|
|
1554
|
+
...basePatch,
|
|
1555
|
+
path: `${source.path.substr(this.path.length)}/${basePatch.path}` // calculate the relative path of the patch
|
|
1556
|
+
};
|
|
1560
1557
|
const [patch, reversePatch] = splitPatch(localizedPatch);
|
|
1561
1558
|
this._internalEventsEmit("patch" /* InternalEvents.Patch */, patch, reversePatch);
|
|
1562
1559
|
}
|
|
@@ -1885,7 +1882,7 @@ class SimpleType extends BaseType {
|
|
|
1885
1882
|
* @returns `true` if the value is a type.
|
|
1886
1883
|
*/
|
|
1887
1884
|
function isType(value) {
|
|
1888
|
-
return typeof value === "object" && value
|
|
1885
|
+
return typeof value === "object" && value?.isType === true;
|
|
1889
1886
|
}
|
|
1890
1887
|
/**
|
|
1891
1888
|
* @internal
|
|
@@ -2037,8 +2034,8 @@ function createActionTrackingMiddleware2(middlewareHooks) {
|
|
|
2037
2034
|
const newCall = {
|
|
2038
2035
|
...call,
|
|
2039
2036
|
// make a shallow copy of the parent action env
|
|
2040
|
-
env: parentRunningAction
|
|
2041
|
-
parentCall: parentRunningAction
|
|
2037
|
+
env: parentRunningAction?.call.env,
|
|
2038
|
+
parentCall: parentRunningAction?.call
|
|
2042
2039
|
};
|
|
2043
2040
|
const passesFilter = !middlewareHooks.filter || middlewareHooks.filter(newCall);
|
|
2044
2041
|
const hooks = passesFilter ? middlewareHooks : undefined;
|
|
@@ -2119,8 +2116,7 @@ function serializeArgument(node, actionName, index, arg) {
|
|
|
2119
2116
|
return serializeTheUnserializable(`[function]`);
|
|
2120
2117
|
}
|
|
2121
2118
|
if (typeof arg === "object" && !isPlainObject(arg) && !isArray(arg)) {
|
|
2122
|
-
return serializeTheUnserializable(`[object ${
|
|
2123
|
-
"Complex Object"}]`);
|
|
2119
|
+
return serializeTheUnserializable(`[object ${arg?.constructor?.name || "Complex Object"}]`);
|
|
2124
2120
|
}
|
|
2125
2121
|
try {
|
|
2126
2122
|
// Check if serializable, cycle free etc...
|
|
@@ -2129,7 +2125,7 @@ function serializeArgument(node, actionName, index, arg) {
|
|
|
2129
2125
|
return arg;
|
|
2130
2126
|
}
|
|
2131
2127
|
catch (e) {
|
|
2132
|
-
return serializeTheUnserializable(
|
|
2128
|
+
return serializeTheUnserializable(`${e}`);
|
|
2133
2129
|
}
|
|
2134
2130
|
}
|
|
2135
2131
|
function deserializeArgument(adm, value) {
|
|
@@ -2489,7 +2485,7 @@ function runMiddleWares(node, baseCall, originalFn) {
|
|
|
2489
2485
|
let result = null;
|
|
2490
2486
|
function runNextMiddleware(call) {
|
|
2491
2487
|
const middleware = middlewares.getNextMiddleware();
|
|
2492
|
-
const handler = middleware
|
|
2488
|
+
const handler = middleware?.handler;
|
|
2493
2489
|
if (!handler) {
|
|
2494
2490
|
return action(originalFn)(...call.args);
|
|
2495
2491
|
}
|
|
@@ -2597,7 +2593,7 @@ function safeStringify(value) {
|
|
|
2597
2593
|
*/
|
|
2598
2594
|
function prettyPrintValue(value) {
|
|
2599
2595
|
return typeof value === "function"
|
|
2600
|
-
? `<function${value.name ?
|
|
2596
|
+
? `<function${value.name ? ` ${value.name}` : ""}>`
|
|
2601
2597
|
: isStateTreeNode(value)
|
|
2602
2598
|
? `<${value}>`
|
|
2603
2599
|
: `\`${safeStringify(value)}\``;
|
|
@@ -2621,16 +2617,13 @@ function toErrorString(error) {
|
|
|
2621
2617
|
? "value"
|
|
2622
2618
|
: "snapshot";
|
|
2623
2619
|
const isSnapshotCompatible = type && isStateTreeNode(value) && type.is(getStateTreeNode(value).snapshot);
|
|
2624
|
-
return
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
?
|
|
2629
|
-
:
|
|
2630
|
-
|
|
2631
|
-
? " (Note that a snapshot of the provided value is compatible with the targeted type)"
|
|
2632
|
-
: "")
|
|
2633
|
-
: `.`));
|
|
2620
|
+
return `${pathPrefix}${currentTypename} ${shortenPrintValue(prettyPrintValue(value))} is not assignable ${type ? `to type: \`${type.name}\`` : ``}${error.message ? ` (${error.message})` : ""}${type
|
|
2621
|
+
? isPrimitiveType(type) || isPrimitive(value)
|
|
2622
|
+
? `.`
|
|
2623
|
+
: `, expected an instance of \`${type.name}\` or a snapshot like \`${shortenPrintValue(type.describe())}\` instead.${isSnapshotCompatible
|
|
2624
|
+
? " (Note that a snapshot of the provided value is compatible with the targeted type)"
|
|
2625
|
+
: ""}`
|
|
2626
|
+
: `.`}`;
|
|
2634
2627
|
}
|
|
2635
2628
|
/**
|
|
2636
2629
|
* @internal
|
|
@@ -2719,7 +2712,7 @@ function validationErrorsToString(type, value, errors) {
|
|
|
2719
2712
|
if (errors.length === 0) {
|
|
2720
2713
|
return undefined;
|
|
2721
2714
|
}
|
|
2722
|
-
return
|
|
2715
|
+
return `Error while converting ${shortenPrintValue(prettyPrintValue(value))} to \`${type.name}\`:\n\n ${formatValidationErrorLines(errors).join("\n ")}`;
|
|
2723
2716
|
}
|
|
2724
2717
|
|
|
2725
2718
|
let identifierCacheId = 0;
|
|
@@ -2751,7 +2744,7 @@ class IdentifierCache {
|
|
|
2751
2744
|
this.cache.set(identifier, observable.array([], mobxShallow));
|
|
2752
2745
|
}
|
|
2753
2746
|
const set = this.cache.get(identifier);
|
|
2754
|
-
if (set.
|
|
2747
|
+
if (set.includes(node)) {
|
|
2755
2748
|
throw fail(`Already registered`);
|
|
2756
2749
|
}
|
|
2757
2750
|
set.push(node);
|
|
@@ -2784,12 +2777,12 @@ class IdentifierCache {
|
|
|
2784
2777
|
// The slash is added here so we only match children of the splitNode. In version 5.1.8 and
|
|
2785
2778
|
// earlier there was no trailing slash, so non children that started with the same path string
|
|
2786
2779
|
// were being matched incorrectly.
|
|
2787
|
-
const basePath = splitNode.path
|
|
2780
|
+
const basePath = `${splitNode.path}/`;
|
|
2788
2781
|
entries(this.cache).forEach(([id, nodes]) => {
|
|
2789
2782
|
let modified = false;
|
|
2790
2783
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
2791
2784
|
const node = nodes[i];
|
|
2792
|
-
if (node === splitNode || node.path.
|
|
2785
|
+
if (node === splitNode || node.path.startsWith(basePath)) {
|
|
2793
2786
|
newCache.addNodeToCache(node, false); // no need to update lastUpdated since it is a whole new cache
|
|
2794
2787
|
nodes.splice(i, 1);
|
|
2795
2788
|
// remove empty sets from cache
|
|
@@ -2887,7 +2880,7 @@ var NodeLifeCycle;
|
|
|
2887
2880
|
* @returns true if the value is a state tree node.
|
|
2888
2881
|
*/
|
|
2889
2882
|
function isStateTreeNode(value) {
|
|
2890
|
-
return !!
|
|
2883
|
+
return !!value?.$treenode;
|
|
2891
2884
|
}
|
|
2892
2885
|
/**
|
|
2893
2886
|
* @internal
|
|
@@ -2912,7 +2905,7 @@ function getStateTreeNode(value) {
|
|
|
2912
2905
|
* @hidden
|
|
2913
2906
|
*/
|
|
2914
2907
|
function getStateTreeNodeSafe(value) {
|
|
2915
|
-
return
|
|
2908
|
+
return value?.$treenode || null;
|
|
2916
2909
|
}
|
|
2917
2910
|
/**
|
|
2918
2911
|
* @internal
|
|
@@ -3039,7 +3032,7 @@ const DEPRECATION_MESSAGE = "See https://github.com/mobxjs/mobx-state-tree/issue
|
|
|
3039
3032
|
* @returns {Promise}
|
|
3040
3033
|
*/
|
|
3041
3034
|
function process$1(asyncAction) {
|
|
3042
|
-
deprecated("process",
|
|
3035
|
+
deprecated("process", `\`process()\` has been renamed to \`flow()\`. ${DEPRECATION_MESSAGE}`);
|
|
3043
3036
|
return flow(asyncAction);
|
|
3044
3037
|
}
|
|
3045
3038
|
|
|
@@ -3067,7 +3060,7 @@ Object.freeze(mobxShallow);
|
|
|
3067
3060
|
* @hidden
|
|
3068
3061
|
*/
|
|
3069
3062
|
function fail(message = "Illegal state") {
|
|
3070
|
-
return new Error(
|
|
3063
|
+
return new Error(`[mobx-state-tree] ${message}`);
|
|
3071
3064
|
}
|
|
3072
3065
|
/**
|
|
3073
3066
|
* @internal
|
|
@@ -3115,19 +3108,6 @@ function asArray(val) {
|
|
|
3115
3108
|
}
|
|
3116
3109
|
return [val];
|
|
3117
3110
|
}
|
|
3118
|
-
/**
|
|
3119
|
-
* @internal
|
|
3120
|
-
* @hidden
|
|
3121
|
-
*/
|
|
3122
|
-
function extend(a, ...b) {
|
|
3123
|
-
for (let i = 0; i < b.length; i++) {
|
|
3124
|
-
const current = b[i];
|
|
3125
|
-
for (const key in current) {
|
|
3126
|
-
a[key] = current[key];
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
return a;
|
|
3130
|
-
}
|
|
3131
3111
|
/**
|
|
3132
3112
|
* @internal
|
|
3133
3113
|
* @hidden
|
|
@@ -3261,7 +3241,7 @@ class EventHandler {
|
|
|
3261
3241
|
};
|
|
3262
3242
|
}
|
|
3263
3243
|
has(fn) {
|
|
3264
|
-
return this.handlers.
|
|
3244
|
+
return this.handlers.includes(fn);
|
|
3265
3245
|
}
|
|
3266
3246
|
unregister(fn) {
|
|
3267
3247
|
if (this.emitting) {
|
|
@@ -3310,8 +3290,7 @@ class EventHandler {
|
|
|
3310
3290
|
class EventHandlers {
|
|
3311
3291
|
eventHandlers;
|
|
3312
3292
|
hasSubscribers(event) {
|
|
3313
|
-
|
|
3314
|
-
return !!handler && handler.hasSubscribers;
|
|
3293
|
+
return this.eventHandlers?.[event]?.hasSubscribers ?? false;
|
|
3315
3294
|
}
|
|
3316
3295
|
register(event, fn, atTheBeginning = false) {
|
|
3317
3296
|
if (!this.eventHandlers) {
|
|
@@ -3324,11 +3303,10 @@ class EventHandlers {
|
|
|
3324
3303
|
return handler.register(fn, atTheBeginning);
|
|
3325
3304
|
}
|
|
3326
3305
|
has(event, fn) {
|
|
3327
|
-
|
|
3328
|
-
return !!handler && handler.has(fn);
|
|
3306
|
+
return this.eventHandlers?.[event]?.has(fn) ?? false;
|
|
3329
3307
|
}
|
|
3330
3308
|
unregister(event, fn) {
|
|
3331
|
-
const handler = this.eventHandlers
|
|
3309
|
+
const handler = this.eventHandlers?.[event];
|
|
3332
3310
|
if (handler) {
|
|
3333
3311
|
handler.unregister(fn);
|
|
3334
3312
|
}
|
|
@@ -3342,19 +3320,12 @@ class EventHandlers {
|
|
|
3342
3320
|
this.eventHandlers = undefined;
|
|
3343
3321
|
}
|
|
3344
3322
|
emit(event, ...args) {
|
|
3345
|
-
const handler = this.eventHandlers
|
|
3323
|
+
const handler = this.eventHandlers?.[event];
|
|
3346
3324
|
if (handler) {
|
|
3347
3325
|
handler.emit(...args);
|
|
3348
3326
|
}
|
|
3349
3327
|
}
|
|
3350
3328
|
}
|
|
3351
|
-
/**
|
|
3352
|
-
* @internal
|
|
3353
|
-
* @hidden
|
|
3354
|
-
*/
|
|
3355
|
-
function stringStartsWith(str, beginning) {
|
|
3356
|
-
return str.indexOf(beginning) === 0;
|
|
3357
|
-
}
|
|
3358
3329
|
/**
|
|
3359
3330
|
* @internal
|
|
3360
3331
|
* @hidden
|
|
@@ -3366,7 +3337,7 @@ const deprecated = function (id, message) {
|
|
|
3366
3337
|
}
|
|
3367
3338
|
// warn if hasn't been warned before
|
|
3368
3339
|
if (deprecated.ids && !deprecated.ids.hasOwnProperty(id)) {
|
|
3369
|
-
warnError(
|
|
3340
|
+
warnError(`Deprecation warning: ${message}`);
|
|
3370
3341
|
}
|
|
3371
3342
|
// mark as warned to avoid duplicate warn message
|
|
3372
3343
|
if (deprecated.ids) {
|
|
@@ -3381,15 +3352,27 @@ deprecated.ids = {};
|
|
|
3381
3352
|
function warnError(msg) {
|
|
3382
3353
|
console.warn(new Error(`[mobx-state-tree] ${msg}`));
|
|
3383
3354
|
}
|
|
3355
|
+
let _typeChecking;
|
|
3356
|
+
/**
|
|
3357
|
+
* Forces full run-time type-checking on or off, overriding the dev-mode and
|
|
3358
|
+
* `ENABLE_TYPE_CHECK` env-var defaults. Pass `true` to get better error messages
|
|
3359
|
+
* in production builds without relying on an environment variable, `false` to
|
|
3360
|
+
* force it off, or `undefined` to restore the default behavior.
|
|
3361
|
+
*/
|
|
3362
|
+
function setTypeChecking(enabled) {
|
|
3363
|
+
_typeChecking = enabled;
|
|
3364
|
+
}
|
|
3384
3365
|
/**
|
|
3385
3366
|
* @internal
|
|
3386
3367
|
* @hidden
|
|
3387
3368
|
*/
|
|
3388
3369
|
function isTypeCheckingEnabled() {
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3370
|
+
// an explicit setTypeChecking() override (incl. `false`) wins over the
|
|
3371
|
+
// dev-mode / env-var default, hence ?? rather than ||
|
|
3372
|
+
return (_typeChecking ??
|
|
3373
|
+
(devMode() ||
|
|
3374
|
+
(typeof process !== "undefined" &&
|
|
3375
|
+
process.env?.ENABLE_TYPE_CHECK === "true")));
|
|
3393
3376
|
}
|
|
3394
3377
|
let _devMode = process.env.NODE_ENV !== "production";
|
|
3395
3378
|
/**
|
|
@@ -3623,7 +3606,7 @@ function createFlowSpawner(name, generator) {
|
|
|
3623
3606
|
// TODO: support more type of values? See https://github.com/tj/co/blob/249bbdc72da24ae44076afd716349d2089b31c4c/index.js#L100
|
|
3624
3607
|
if (!ret.value || typeof ret.value.then !== "function") {
|
|
3625
3608
|
// istanbul ignore next
|
|
3626
|
-
throw fail(
|
|
3609
|
+
throw fail(`Only promises can be yielded to \`async\`, got: ${ret}`);
|
|
3627
3610
|
}
|
|
3628
3611
|
return ret.value.then(onFulfilled, onRejected);
|
|
3629
3612
|
}
|
|
@@ -3680,22 +3663,13 @@ function invertPatch(patch) {
|
|
|
3680
3663
|
};
|
|
3681
3664
|
}
|
|
3682
3665
|
}
|
|
3683
|
-
/**
|
|
3684
|
-
* Simple simple check to check it is a number.
|
|
3685
|
-
*/
|
|
3686
|
-
function isNumber(x) {
|
|
3687
|
-
return typeof x === "number";
|
|
3688
|
-
}
|
|
3689
3666
|
/**
|
|
3690
3667
|
* Escape slashes and backslashes.
|
|
3691
3668
|
*
|
|
3692
3669
|
* http://tools.ietf.org/html/rfc6901
|
|
3693
3670
|
*/
|
|
3694
3671
|
function escapeJsonPath(path) {
|
|
3695
|
-
if (
|
|
3696
|
-
return "" + path;
|
|
3697
|
-
}
|
|
3698
|
-
if (path.indexOf("/") === -1 && path.indexOf("~") === -1) {
|
|
3672
|
+
if (!path.includes("/") && !path.includes("~")) {
|
|
3699
3673
|
return path;
|
|
3700
3674
|
}
|
|
3701
3675
|
return path.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -3724,7 +3698,7 @@ function joinJsonPath(path) {
|
|
|
3724
3698
|
}
|
|
3725
3699
|
else {
|
|
3726
3700
|
// absolute
|
|
3727
|
-
return
|
|
3701
|
+
return `/${getPathStr(path)}`;
|
|
3728
3702
|
}
|
|
3729
3703
|
}
|
|
3730
3704
|
/**
|
|
@@ -3739,9 +3713,9 @@ function splitJsonPath(path) {
|
|
|
3739
3713
|
const valid = path === "" ||
|
|
3740
3714
|
path === "." ||
|
|
3741
3715
|
path === ".." ||
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3716
|
+
path.startsWith("/") ||
|
|
3717
|
+
path.startsWith("./") ||
|
|
3718
|
+
path.startsWith("../");
|
|
3745
3719
|
if (!valid) {
|
|
3746
3720
|
throw fail(`a json path must be either rooted, empty or relative, but got '${path}'`);
|
|
3747
3721
|
}
|
|
@@ -3949,16 +3923,16 @@ class MSTMap extends ObservableMap {
|
|
|
3949
3923
|
}
|
|
3950
3924
|
get(key) {
|
|
3951
3925
|
// maybe this is over-enthousiastic? normalize numeric keys to strings
|
|
3952
|
-
return super.get(
|
|
3926
|
+
return super.get(`${key}`);
|
|
3953
3927
|
}
|
|
3954
3928
|
has(key) {
|
|
3955
|
-
return super.has(
|
|
3929
|
+
return super.has(`${key}`);
|
|
3956
3930
|
}
|
|
3957
3931
|
delete(key) {
|
|
3958
|
-
return super.delete(
|
|
3932
|
+
return super.delete(`${key}`);
|
|
3959
3933
|
}
|
|
3960
3934
|
set(key, value) {
|
|
3961
|
-
return super.set(
|
|
3935
|
+
return super.set(`${key}`, value);
|
|
3962
3936
|
}
|
|
3963
3937
|
put(value) {
|
|
3964
3938
|
if (!value) {
|
|
@@ -4083,9 +4057,9 @@ class MapType extends ComplexType {
|
|
|
4083
4057
|
return values(node.storedValue);
|
|
4084
4058
|
}
|
|
4085
4059
|
getChildNode(node, key) {
|
|
4086
|
-
const childNode = node.storedValue.get(
|
|
4060
|
+
const childNode = node.storedValue.get(`${key}`);
|
|
4087
4061
|
if (!childNode) {
|
|
4088
|
-
throw fail(
|
|
4062
|
+
throw fail(`Not a child ${key}`);
|
|
4089
4063
|
}
|
|
4090
4064
|
return childNode;
|
|
4091
4065
|
}
|
|
@@ -4193,7 +4167,7 @@ class MapType extends ComplexType {
|
|
|
4193
4167
|
// Don't use target.replace, as it will throw away all existing items first
|
|
4194
4168
|
for (const key in snapshot) {
|
|
4195
4169
|
target.set(key, snapshot[key]);
|
|
4196
|
-
currentKeys[
|
|
4170
|
+
currentKeys[`${key}`] = true;
|
|
4197
4171
|
}
|
|
4198
4172
|
}
|
|
4199
4173
|
Object.keys(currentKeys).forEach(key => {
|
|
@@ -4293,7 +4267,7 @@ class ArrayType extends ComplexType {
|
|
|
4293
4267
|
const subType = objNode.type._subType;
|
|
4294
4268
|
const result = {};
|
|
4295
4269
|
snapshot.forEach((item, index) => {
|
|
4296
|
-
const subpath =
|
|
4270
|
+
const subpath = `${index}`;
|
|
4297
4271
|
result[subpath] = subType.instantiate(objNode, subpath, undefined, item);
|
|
4298
4272
|
});
|
|
4299
4273
|
return result;
|
|
@@ -4327,11 +4301,11 @@ class ArrayType extends ComplexType {
|
|
|
4327
4301
|
if (index < node.storedValue.length) {
|
|
4328
4302
|
return node.storedValue[index];
|
|
4329
4303
|
}
|
|
4330
|
-
throw fail(
|
|
4304
|
+
throw fail(`Not a child: ${key}`);
|
|
4331
4305
|
}
|
|
4332
4306
|
willChange(change) {
|
|
4333
4307
|
const node = getStateTreeNode(change.object);
|
|
4334
|
-
node.assertWritable({ subpath:
|
|
4308
|
+
node.assertWritable({ subpath: `${change.index}` });
|
|
4335
4309
|
const subType = node.type._subType;
|
|
4336
4310
|
const childNodes = node.getChildren();
|
|
4337
4311
|
switch (change.type) {
|
|
@@ -4357,7 +4331,7 @@ class ArrayType extends ComplexType {
|
|
|
4357
4331
|
change.added = addedNodes;
|
|
4358
4332
|
// update paths of remaining items
|
|
4359
4333
|
for (let i = index + removedCount; i < childNodes.length; i++) {
|
|
4360
|
-
childNodes[i].setParent(node,
|
|
4334
|
+
childNodes[i].setParent(node, `${i + added.length - removedCount}`);
|
|
4361
4335
|
}
|
|
4362
4336
|
}
|
|
4363
4337
|
break;
|
|
@@ -4380,7 +4354,7 @@ class ArrayType extends ComplexType {
|
|
|
4380
4354
|
case "update":
|
|
4381
4355
|
return void node.emitPatch({
|
|
4382
4356
|
op: "replace",
|
|
4383
|
-
path:
|
|
4357
|
+
path: `${change.index}`,
|
|
4384
4358
|
value: change.newValue.snapshot,
|
|
4385
4359
|
oldValue: change.oldValue ? change.oldValue.snapshot : undefined
|
|
4386
4360
|
}, node);
|
|
@@ -4388,15 +4362,15 @@ class ArrayType extends ComplexType {
|
|
|
4388
4362
|
for (let i = change.removedCount - 1; i >= 0; i--) {
|
|
4389
4363
|
node.emitPatch({
|
|
4390
4364
|
op: "remove",
|
|
4391
|
-
path:
|
|
4365
|
+
path: `${change.index + i}`,
|
|
4392
4366
|
oldValue: change.removed[i].snapshot
|
|
4393
4367
|
}, node);
|
|
4394
4368
|
}
|
|
4395
4369
|
for (let i = 0; i < change.addedCount; i++) {
|
|
4396
4370
|
node.emitPatch({
|
|
4397
4371
|
op: "add",
|
|
4398
|
-
path:
|
|
4399
|
-
value: node.getChildNode(
|
|
4372
|
+
path: `${change.index + i}`,
|
|
4373
|
+
value: node.getChildNode(`${change.index + i}`).snapshot,
|
|
4400
4374
|
oldValue: undefined
|
|
4401
4375
|
}, node);
|
|
4402
4376
|
}
|
|
@@ -4431,7 +4405,7 @@ class ArrayType extends ComplexType {
|
|
|
4431
4405
|
return typeCheckFailure(context, value, "Value is not an array");
|
|
4432
4406
|
}
|
|
4433
4407
|
for (let i = 0; i < value.length; i++) {
|
|
4434
|
-
getContextForPath(context,
|
|
4408
|
+
getContextForPath(context, `${i}`, this._subType);
|
|
4435
4409
|
const errors = this._subType.validate(value[i], context);
|
|
4436
4410
|
popContext(context);
|
|
4437
4411
|
if (errors.length > 0) {
|
|
@@ -4482,7 +4456,7 @@ function reconcileArrayChildren(parent, childType, oldNodes, newValues, newPaths
|
|
|
4482
4456
|
const hasNewNode = i <= newValues.length - 1;
|
|
4483
4457
|
const oldNode = oldNodes[i];
|
|
4484
4458
|
let newValue = hasNewNode ? newValues[i] : undefined;
|
|
4485
|
-
const newPath =
|
|
4459
|
+
const newPath = `${newPaths[i]}`;
|
|
4486
4460
|
// for some reason, instead of newValue we got a node, fallback to the storedValue
|
|
4487
4461
|
// TODO: https://github.com/mobxjs/mobx-state-tree/issues/340#issuecomment-325581681
|
|
4488
4462
|
if (isNode(newValue)) {
|
|
@@ -4918,18 +4892,18 @@ class ModelType extends ComplexType {
|
|
|
4918
4892
|
}
|
|
4919
4893
|
getChildNode(node, key) {
|
|
4920
4894
|
if (!(key in this.properties)) {
|
|
4921
|
-
throw fail(
|
|
4895
|
+
throw fail(`Not a value property: ${key}`);
|
|
4922
4896
|
}
|
|
4923
4897
|
const adm = _getAdministration(node.storedValue, key);
|
|
4924
4898
|
const childNode = adm.raw?.();
|
|
4925
4899
|
if (!childNode) {
|
|
4926
|
-
throw fail(
|
|
4900
|
+
throw fail(`Node not available for property ${key}`);
|
|
4927
4901
|
}
|
|
4928
4902
|
return childNode;
|
|
4929
4903
|
}
|
|
4930
4904
|
getSnapshot(node, applyPostProcess = true) {
|
|
4931
4905
|
const res = {};
|
|
4932
|
-
this.forAllProps((name,
|
|
4906
|
+
this.forAllProps((name, type) => {
|
|
4933
4907
|
try {
|
|
4934
4908
|
// TODO: FIXME, make sure the observable ref is used!
|
|
4935
4909
|
const atom = getAtom(node.storedValue, name);
|
|
@@ -4938,7 +4912,11 @@ class ModelType extends ComplexType {
|
|
|
4938
4912
|
catch (_e) {
|
|
4939
4913
|
throw fail(`${name} property is declared twice`);
|
|
4940
4914
|
}
|
|
4941
|
-
|
|
4915
|
+
const snapshot = this.getChildNode(node, name).snapshot;
|
|
4916
|
+
// strip-default optionals omit their key when equal to the default
|
|
4917
|
+
if (!shouldStripChildFromSnapshot(type, snapshot)) {
|
|
4918
|
+
res[name] = snapshot;
|
|
4919
|
+
}
|
|
4942
4920
|
});
|
|
4943
4921
|
if (applyPostProcess) {
|
|
4944
4922
|
return this.applySnapshotPostProcessor(res);
|
|
@@ -4948,7 +4926,13 @@ class ModelType extends ComplexType {
|
|
|
4948
4926
|
processInitialSnapshot(childNodes) {
|
|
4949
4927
|
const processed = {};
|
|
4950
4928
|
Object.keys(childNodes).forEach(key => {
|
|
4951
|
-
|
|
4929
|
+
const snapshot = childNodes[key].getSnapshot();
|
|
4930
|
+
// strip-default optionals omit their key when equal to the default; this
|
|
4931
|
+
// mirrors getSnapshot for nodes serialized before they become observable
|
|
4932
|
+
// instances (e.g. array/map children that were never accessed)
|
|
4933
|
+
if (!shouldStripChildFromSnapshot(this.properties[key], snapshot)) {
|
|
4934
|
+
processed[key] = snapshot;
|
|
4935
|
+
}
|
|
4952
4936
|
});
|
|
4953
4937
|
return this.applySnapshotPostProcessor(processed);
|
|
4954
4938
|
}
|
|
@@ -5001,11 +4985,9 @@ class ModelType extends ComplexType {
|
|
|
5001
4985
|
}
|
|
5002
4986
|
describe() {
|
|
5003
4987
|
// optimization: cache
|
|
5004
|
-
return
|
|
5005
|
-
this.
|
|
5006
|
-
|
|
5007
|
-
.join("; ") +
|
|
5008
|
-
" }");
|
|
4988
|
+
return `{ ${this.propertyNames
|
|
4989
|
+
.map(key => `${key}: ${this.properties[key].describe()}`)
|
|
4990
|
+
.join("; ")} }`;
|
|
5009
4991
|
}
|
|
5010
4992
|
getDefaultSnapshot() {
|
|
5011
4993
|
return EMPTY_OBJECT;
|
|
@@ -5050,7 +5032,7 @@ function compose(...args) {
|
|
|
5050
5032
|
}
|
|
5051
5033
|
return args
|
|
5052
5034
|
.reduce((prev, cur) => prev.cloneAndEnhance({
|
|
5053
|
-
name: prev.name
|
|
5035
|
+
name: `${prev.name}_${cur.name}`,
|
|
5054
5036
|
properties: cur.properties,
|
|
5055
5037
|
initializers: cur.initializers,
|
|
5056
5038
|
preProcessor: (snapshot) => cur.applySnapshotPreProcessor(prev.applySnapshotPreProcessor(snapshot)),
|
|
@@ -5217,7 +5199,7 @@ function getPrimitiveFactoryFromValue(value) {
|
|
|
5217
5199
|
return DatePrimitive;
|
|
5218
5200
|
}
|
|
5219
5201
|
}
|
|
5220
|
-
throw fail(
|
|
5202
|
+
throw fail(`Cannot determine primitive type from value ${value}`);
|
|
5221
5203
|
}
|
|
5222
5204
|
/**
|
|
5223
5205
|
* Returns if a given value represents a primitive type.
|
|
@@ -5393,7 +5375,7 @@ function enumeration(name, options) {
|
|
|
5393
5375
|
assertIsString(option, i + 1);
|
|
5394
5376
|
});
|
|
5395
5377
|
}
|
|
5396
|
-
const type = union(...realOptions.map(option => literal(
|
|
5378
|
+
const type = union(...realOptions.map(option => literal(`${option}`)));
|
|
5397
5379
|
if (typeof name === "string") {
|
|
5398
5380
|
type.name = name;
|
|
5399
5381
|
}
|
|
@@ -5451,7 +5433,7 @@ class Union extends BaseType {
|
|
|
5451
5433
|
return this._types.some(subType => subType.isAssignableFrom(type));
|
|
5452
5434
|
}
|
|
5453
5435
|
describe() {
|
|
5454
|
-
return (
|
|
5436
|
+
return `(${this._types.map(factory => factory.describe()).join(" | ")})`;
|
|
5455
5437
|
}
|
|
5456
5438
|
instantiate(parent, subpath, environment, initialValue) {
|
|
5457
5439
|
const type = this.determineType(initialValue, undefined);
|
|
@@ -5493,8 +5475,7 @@ class Union extends BaseType {
|
|
|
5493
5475
|
if (errors.length === 0) {
|
|
5494
5476
|
return baseWithDiscriminator;
|
|
5495
5477
|
}
|
|
5496
|
-
return
|
|
5497
|
-
formatValidationErrorLines(errors).join("\n "));
|
|
5478
|
+
return `${baseWithDiscriminator}:\n ${formatValidationErrorLines(errors).join("\n ")}`;
|
|
5498
5479
|
}
|
|
5499
5480
|
_findCandidateByTypeDiscriminator(discriminator) {
|
|
5500
5481
|
let found;
|
|
@@ -5724,7 +5705,7 @@ function union(optionsOrType, ...otherTypes) {
|
|
|
5724
5705
|
const types = isType(optionsOrType)
|
|
5725
5706
|
? [optionsOrType, ...otherTypes]
|
|
5726
5707
|
: otherTypes;
|
|
5727
|
-
const name =
|
|
5708
|
+
const name = `(${types.map(type => type.name).join(" | ")})`;
|
|
5728
5709
|
// check all options
|
|
5729
5710
|
if (devMode()) {
|
|
5730
5711
|
if (options) {
|
|
@@ -5791,17 +5772,17 @@ class OptionalValue extends BaseType {
|
|
|
5791
5772
|
this.optionalValues = optionalValues;
|
|
5792
5773
|
}
|
|
5793
5774
|
describe() {
|
|
5794
|
-
return this._subtype.describe()
|
|
5775
|
+
return `${this._subtype.describe()}?`;
|
|
5795
5776
|
}
|
|
5796
5777
|
instantiate(parent, subpath, environment, initialValue) {
|
|
5797
|
-
if (this.optionalValues.
|
|
5778
|
+
if (this.optionalValues.includes(initialValue)) {
|
|
5798
5779
|
const defaultInstanceOrSnapshot = this.getDefaultInstanceOrSnapshot();
|
|
5799
5780
|
return this._subtype.instantiate(parent, subpath, environment, defaultInstanceOrSnapshot);
|
|
5800
5781
|
}
|
|
5801
5782
|
return this._subtype.instantiate(parent, subpath, environment, initialValue);
|
|
5802
5783
|
}
|
|
5803
5784
|
reconcile(current, newValue, parent, subpath) {
|
|
5804
|
-
return this._subtype.reconcile(current, this.optionalValues.
|
|
5785
|
+
return this._subtype.reconcile(current, !this.optionalValues.includes(newValue) && this._subtype.is(newValue)
|
|
5805
5786
|
? newValue
|
|
5806
5787
|
: this.getDefaultInstanceOrSnapshot(), parent, subpath);
|
|
5807
5788
|
}
|
|
@@ -5818,7 +5799,7 @@ class OptionalValue extends BaseType {
|
|
|
5818
5799
|
}
|
|
5819
5800
|
isValidSnapshot(value, context) {
|
|
5820
5801
|
// defaulted values can be skipped
|
|
5821
|
-
if (this.optionalValues.
|
|
5802
|
+
if (this.optionalValues.includes(value)) {
|
|
5822
5803
|
return typeCheckSuccess();
|
|
5823
5804
|
}
|
|
5824
5805
|
// bounce validation to the sub-type
|
|
@@ -5905,6 +5886,72 @@ const undefinedAsOptionalValues = [undefined];
|
|
|
5905
5886
|
function isOptionalType(type) {
|
|
5906
5887
|
return isType(type) && (type.flags & TypeFlags.Optional) > 0;
|
|
5907
5888
|
}
|
|
5889
|
+
/**
|
|
5890
|
+
* Compare a child snapshot to a stripped-default's reference snapshot. Mirrors
|
|
5891
|
+
* the legacy hand-rolled comparison: identity for primitives, structural for
|
|
5892
|
+
* objects/arrays.
|
|
5893
|
+
*/
|
|
5894
|
+
function defaultSnapshotEquals(a, b) {
|
|
5895
|
+
if (a === b) {
|
|
5896
|
+
return true;
|
|
5897
|
+
}
|
|
5898
|
+
if (typeof a === "object" &&
|
|
5899
|
+
a !== null &&
|
|
5900
|
+
typeof b === "object" &&
|
|
5901
|
+
b !== null) {
|
|
5902
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
5903
|
+
}
|
|
5904
|
+
return false;
|
|
5905
|
+
}
|
|
5906
|
+
/**
|
|
5907
|
+
* An optional type that additionally omits its key from a parent model's
|
|
5908
|
+
* snapshot when the value equals the (snapshotted) default. The comparison is
|
|
5909
|
+
* against the default *snapshot* — i.e. the subtype is instantiated with the
|
|
5910
|
+
* default once and its post-processed snapshot is cached — so a default whose
|
|
5911
|
+
* normalized form gains fields (e.g. a fileLocation gaining `locationType`)
|
|
5912
|
+
* still strips correctly.
|
|
5913
|
+
*
|
|
5914
|
+
* @hidden
|
|
5915
|
+
* @internal
|
|
5916
|
+
*/
|
|
5917
|
+
class StripDefaultValue extends OptionalValue {
|
|
5918
|
+
_defaultSnapshot;
|
|
5919
|
+
shouldStripFromSnapshot(snapshot) {
|
|
5920
|
+
if (!this._defaultSnapshot) {
|
|
5921
|
+
// instantiate the subtype detached with the default and read the node's
|
|
5922
|
+
// snapshot, which normalizes (fills model defaults, applies the subtype's
|
|
5923
|
+
// own postProcess). Cached on the (singleton) type after first use.
|
|
5924
|
+
const node = this.getSubTypes().instantiate(null, "", undefined, this.getDefaultInstanceOrSnapshot());
|
|
5925
|
+
this._defaultSnapshot = { value: node.snapshot };
|
|
5926
|
+
}
|
|
5927
|
+
return defaultSnapshotEquals(snapshot, this._defaultSnapshot.value);
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
/**
|
|
5931
|
+
* Whether `type` is a strip-default optional whose current child `snapshot`
|
|
5932
|
+
* equals its default and should therefore be omitted from the parent model's
|
|
5933
|
+
* snapshot. Used by `ModelType.getSnapshot`.
|
|
5934
|
+
*
|
|
5935
|
+
* @hidden
|
|
5936
|
+
* @internal
|
|
5937
|
+
*/
|
|
5938
|
+
function shouldStripChildFromSnapshot(type, snapshot) {
|
|
5939
|
+
return (type instanceof StripDefaultValue && type.shouldStripFromSnapshot(snapshot));
|
|
5940
|
+
}
|
|
5941
|
+
/**
|
|
5942
|
+
* `types.stripDefault` - Like `types.optional`, but the property is omitted from
|
|
5943
|
+
* a parent model's snapshot entirely when its value equals the default (instead
|
|
5944
|
+
* of being serialized with the default value). Lets a model produce minimal
|
|
5945
|
+
* snapshots without a bespoke `postProcessSnapshot`.
|
|
5946
|
+
*
|
|
5947
|
+
* @param type
|
|
5948
|
+
* @param defaultValueOrFunction
|
|
5949
|
+
* @returns
|
|
5950
|
+
*/
|
|
5951
|
+
function stripDefault(type, defaultValueOrFunction) {
|
|
5952
|
+
checkOptionalPreconditions(type, defaultValueOrFunction);
|
|
5953
|
+
return new StripDefaultValue(type, defaultValueOrFunction, undefinedAsOptionalValues);
|
|
5954
|
+
}
|
|
5908
5955
|
|
|
5909
5956
|
const optionalUndefinedType = optional(undefinedType, undefined);
|
|
5910
5957
|
const optionalNullType = optional(nullType, null);
|
|
@@ -6019,8 +6066,7 @@ function late(nameOrType, maybeType) {
|
|
|
6019
6066
|
// checks that the type is actually a late type
|
|
6020
6067
|
if (devMode()) {
|
|
6021
6068
|
if (!(typeof type === "function" && type.length === 0)) {
|
|
6022
|
-
throw fail(
|
|
6023
|
-
type);
|
|
6069
|
+
throw fail(`Invalid late type, expected a function with zero arguments that returns a type, got: ${type}`);
|
|
6024
6070
|
}
|
|
6025
6071
|
}
|
|
6026
6072
|
return new Late(name, type);
|
|
@@ -6233,8 +6279,7 @@ class StoredReference {
|
|
|
6233
6279
|
const normalizedId = normalizeIdentifier(this.identifier);
|
|
6234
6280
|
const root = node.root;
|
|
6235
6281
|
const lastCacheModification = root.identifierCache.getLastCacheModificationPerId(normalizedId);
|
|
6236
|
-
if (
|
|
6237
|
-
this.resolvedReference.lastCacheModification !== lastCacheModification) {
|
|
6282
|
+
if (this.resolvedReference?.lastCacheModification !== lastCacheModification) {
|
|
6238
6283
|
const { targetType } = this;
|
|
6239
6284
|
// reference was initialized with the identifier of the target
|
|
6240
6285
|
const target = root.identifierCache.resolve(targetType, normalizedId);
|
|
@@ -6243,7 +6288,7 @@ class StoredReference {
|
|
|
6243
6288
|
}
|
|
6244
6289
|
this.resolvedReference = {
|
|
6245
6290
|
node: target,
|
|
6246
|
-
lastCacheModification
|
|
6291
|
+
lastCacheModification
|
|
6247
6292
|
};
|
|
6248
6293
|
}
|
|
6249
6294
|
}
|
|
@@ -6291,7 +6336,7 @@ class BaseReferenceType extends SimpleType {
|
|
|
6291
6336
|
// since it is a scalar value (immutable-ish) and we need to change it
|
|
6292
6337
|
// from the parent
|
|
6293
6338
|
const storedRefParentNode = storedRefNode.parent;
|
|
6294
|
-
if (!storedRefParentNode
|
|
6339
|
+
if (!storedRefParentNode?.isAlive) {
|
|
6295
6340
|
return;
|
|
6296
6341
|
}
|
|
6297
6342
|
const storedRefParentValue = storedRefParentNode.storedValue;
|
|
@@ -6363,7 +6408,7 @@ class BaseReferenceType extends SimpleType {
|
|
|
6363
6408
|
}
|
|
6364
6409
|
// make sure the target node is actually there and initialized
|
|
6365
6410
|
const storedRefParentNode = storedRefNode.parent;
|
|
6366
|
-
const storedRefParentValue = storedRefParentNode
|
|
6411
|
+
const storedRefParentValue = storedRefParentNode?.storedValue;
|
|
6367
6412
|
if (storedRefParentNode &&
|
|
6368
6413
|
storedRefParentNode.isAlive &&
|
|
6369
6414
|
storedRefParentValue) {
|
|
@@ -6677,7 +6722,7 @@ function isIdentifierType(type) {
|
|
|
6677
6722
|
* @hidden
|
|
6678
6723
|
*/
|
|
6679
6724
|
function normalizeIdentifier(id) {
|
|
6680
|
-
return
|
|
6725
|
+
return `${id}`;
|
|
6681
6726
|
}
|
|
6682
6727
|
/**
|
|
6683
6728
|
* @internal
|
|
@@ -6773,7 +6818,7 @@ class CustomType extends SimpleType {
|
|
|
6773
6818
|
instantiate(parent, subpath, environment, initialValue) {
|
|
6774
6819
|
const valueToStore = this.options.isTargetType(initialValue)
|
|
6775
6820
|
? initialValue
|
|
6776
|
-
: this.options.fromSnapshot(initialValue, parent
|
|
6821
|
+
: this.options.fromSnapshot(initialValue, parent?.root.environment);
|
|
6777
6822
|
return createScalarNode(this, parent, subpath, environment, valueToStore);
|
|
6778
6823
|
}
|
|
6779
6824
|
reconcile(current, value, parent, subpath) {
|
|
@@ -6924,6 +6969,7 @@ const types = {
|
|
|
6924
6969
|
safeReference,
|
|
6925
6970
|
union,
|
|
6926
6971
|
optional,
|
|
6972
|
+
stripDefault,
|
|
6927
6973
|
literal,
|
|
6928
6974
|
maybe,
|
|
6929
6975
|
maybeNull,
|
|
@@ -6948,5 +6994,5 @@ const types = {
|
|
|
6948
6994
|
resilient
|
|
6949
6995
|
};
|
|
6950
6996
|
|
|
6951
|
-
export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, getUnionSubtypes, hasParent, hasParentOfType, isActionContextChildOf, isActionContextThisOrChildOf, isAlive, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isProtected, isReferenceType, isRefinementType, isRoot, isStateTreeNode, isType, isUnionType, isValidReference, joinJsonPath, onAction, onPatch, onSnapshot, process$1 as process, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };
|
|
6997
|
+
export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, getUnionSubtypes, hasParent, hasParentOfType, isActionContextChildOf, isActionContextThisOrChildOf, isAlive, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isProtected, isReferenceType, isRefinementType, isRoot, isStateTreeNode, isType, isUnionType, isValidReference, joinJsonPath, onAction, onPatch, onSnapshot, process$1 as process, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, setTypeChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };
|
|
6952
6998
|
//# sourceMappingURL=mobx-state-tree.mjs.map
|