@jbrowse/mobx-state-tree 5.6.10 → 5.7.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/core/action.js.map +1 -1
- package/dist/core/actionContext.js.map +1 -1
- package/dist/core/flow.js.map +1 -1
- package/dist/core/json-patch.js.map +1 -1
- package/dist/core/mst-operations.js.map +1 -1
- package/dist/core/node/BaseNode.js.map +1 -1
- package/dist/core/node/Hook.js.map +1 -1
- package/dist/core/node/create-node.js.map +1 -1
- package/dist/core/node/identifier-cache.js.map +1 -1
- package/dist/core/node/livelinessChecking.js.map +1 -1
- package/dist/core/node/node-utils.js.map +1 -1
- package/dist/core/node/object-node.d.ts +3 -1
- package/dist/core/node/object-node.js +2 -1
- package/dist/core/node/object-node.js.map +1 -1
- package/dist/core/node/scalar-node.d.ts +3 -1
- package/dist/core/node/scalar-node.js +2 -1
- package/dist/core/node/scalar-node.js.map +1 -1
- package/dist/core/process.js.map +1 -1
- package/dist/core/type/type-checker.js.map +1 -1
- package/dist/core/type/type.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/middlewares/create-action-tracking-middleware.js.map +1 -1
- package/dist/middlewares/createActionTrackingMiddleware2.js.map +1 -1
- package/dist/middlewares/on-action.js.map +1 -1
- package/dist/package.json +1 -0
- package/dist/types/complex-types/array.d.ts +2 -1
- package/dist/types/complex-types/array.js +2 -1
- package/dist/types/complex-types/array.js.map +1 -1
- package/dist/types/complex-types/map.d.ts +2 -1
- package/dist/types/complex-types/map.js +2 -1
- package/dist/types/complex-types/map.js.map +1 -1
- package/dist/types/complex-types/model.d.ts +2 -1
- package/dist/types/complex-types/model.js +2 -1
- package/dist/types/complex-types/model.js.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/primitives.d.ts +2 -1
- package/dist/types/primitives.js +2 -1
- package/dist/types/primitives.js.map +1 -1
- package/dist/types/utility-types/custom.d.ts +2 -1
- package/dist/types/utility-types/custom.js +2 -1
- package/dist/types/utility-types/custom.js.map +1 -1
- package/dist/types/utility-types/enumeration.js.map +1 -1
- package/dist/types/utility-types/frozen.d.ts +2 -1
- package/dist/types/utility-types/frozen.js +2 -1
- package/dist/types/utility-types/frozen.js.map +1 -1
- package/dist/types/utility-types/identifier.d.ts +2 -1
- package/dist/types/utility-types/identifier.js +2 -1
- package/dist/types/utility-types/identifier.js.map +1 -1
- package/dist/types/utility-types/late.js +2 -1
- package/dist/types/utility-types/late.js.map +1 -1
- package/dist/types/utility-types/lazy.d.ts +2 -1
- package/dist/types/utility-types/lazy.js +2 -1
- package/dist/types/utility-types/lazy.js.map +1 -1
- package/dist/types/utility-types/literal.d.ts +2 -1
- package/dist/types/utility-types/literal.js +2 -1
- package/dist/types/utility-types/literal.js.map +1 -1
- package/dist/types/utility-types/maybe.js.map +1 -1
- package/dist/types/utility-types/optional.d.ts +2 -1
- package/dist/types/utility-types/optional.js +2 -1
- package/dist/types/utility-types/optional.js.map +1 -1
- package/dist/types/utility-types/reference.d.ts +2 -1
- package/dist/types/utility-types/reference.js +2 -1
- package/dist/types/utility-types/reference.js.map +1 -1
- package/dist/types/utility-types/refinement.js +2 -1
- package/dist/types/utility-types/refinement.js.map +1 -1
- package/dist/types/utility-types/resilient.js +2 -1
- package/dist/types/utility-types/resilient.js.map +1 -1
- package/dist/types/utility-types/snapshotProcessor.js +3 -2
- package/dist/types/utility-types/snapshotProcessor.js.map +1 -1
- package/dist/types/utility-types/union.d.ts +2 -1
- package/dist/types/utility-types/union.js +2 -1
- package/dist/types/utility-types/union.js.map +1 -1
- package/dist/utils.js.map +1 -1
- package/esm/core/action.d.ts +87 -0
- package/esm/core/action.js +219 -0
- package/esm/core/action.js.map +1 -0
- package/esm/core/actionContext.d.ts +27 -0
- package/esm/core/actionContext.js +37 -0
- package/esm/core/actionContext.js.map +1 -0
- package/esm/core/flow.d.ts +69 -0
- package/esm/core/flow.js +173 -0
- package/esm/core/flow.js.map +1 -0
- package/esm/core/json-patch.d.ts +46 -0
- package/esm/core/json-patch.js +125 -0
- package/esm/core/json-patch.js.map +1 -0
- package/esm/core/mst-operations.d.ts +459 -0
- package/esm/core/mst-operations.js +844 -0
- package/esm/core/mst-operations.js.map +1 -0
- package/esm/core/node/BaseNode.d.ts +62 -0
- package/esm/core/node/BaseNode.js +148 -0
- package/esm/core/node/BaseNode.js.map +1 -0
- package/esm/core/node/Hook.d.ts +17 -0
- package/esm/core/node/Hook.js +12 -0
- package/esm/core/node/Hook.js.map +1 -0
- package/esm/core/node/create-node.d.ts +16 -0
- package/esm/core/node/create-node.js +36 -0
- package/esm/core/node/create-node.js.map +1 -0
- package/esm/core/node/identifier-cache.d.ts +19 -0
- package/esm/core/node/identifier-cache.js +111 -0
- package/esm/core/node/identifier-cache.js.map +1 -0
- package/esm/core/node/livelinessChecking.d.ts +37 -0
- package/esm/core/node/livelinessChecking.js +33 -0
- package/esm/core/node/livelinessChecking.js.map +1 -0
- package/esm/core/node/node-utils.d.ts +83 -0
- package/esm/core/node/node-utils.js +153 -0
- package/esm/core/node/node-utils.js.map +1 -0
- package/esm/core/node/object-node.d.ts +101 -0
- package/esm/core/node/object-node.js +542 -0
- package/esm/core/node/object-node.js.map +1 -0
- package/esm/core/node/scalar-node.d.ts +21 -0
- package/esm/core/node/scalar-node.js +86 -0
- package/esm/core/node/scalar-node.js.map +1 -0
- package/esm/core/process.d.ts +50 -0
- package/esm/core/process.js +35 -0
- package/esm/core/process.js.map +1 -0
- package/esm/core/type/type-checker.d.ts +69 -0
- package/esm/core/type/type-checker.js +144 -0
- package/esm/core/type/type-checker.js.map +1 -0
- package/esm/core/type/type.d.ts +317 -0
- package/esm/core/type/type.js +243 -0
- package/esm/core/type/type.js.map +1 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -0
- package/esm/internal.d.ts +39 -0
- package/esm/internal.js +44 -0
- package/esm/internal.js.map +1 -0
- package/esm/middlewares/create-action-tracking-middleware.d.ts +24 -0
- package/esm/middlewares/create-action-tracking-middleware.js +78 -0
- package/esm/middlewares/create-action-tracking-middleware.js.map +1 -0
- package/esm/middlewares/createActionTrackingMiddleware2.d.ts +34 -0
- package/esm/middlewares/createActionTrackingMiddleware2.js +130 -0
- package/esm/middlewares/createActionTrackingMiddleware2.js.map +1 -0
- package/esm/middlewares/on-action.d.ts +87 -0
- package/esm/middlewares/on-action.js +210 -0
- package/esm/middlewares/on-action.js.map +1 -0
- package/esm/types/complex-types/array.d.ts +81 -0
- package/esm/types/complex-types/array.js +347 -0
- package/esm/types/complex-types/array.js.map +1 -0
- package/esm/types/complex-types/map.d.ts +111 -0
- package/esm/types/complex-types/map.js +356 -0
- package/esm/types/complex-types/map.js.map +1 -0
- package/esm/types/complex-types/model.d.ts +193 -0
- package/esm/types/complex-types/model.js +471 -0
- package/esm/types/complex-types/model.js.map +1 -0
- package/esm/types/index.d.ts +33 -0
- package/esm/types/index.js +35 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/primitives.d.ts +125 -0
- package/esm/types/primitives.js +177 -0
- package/esm/types/primitives.js.map +1 -0
- package/esm/types/utility-types/custom.d.ts +75 -0
- package/esm/types/utility-types/custom.js +106 -0
- package/esm/types/utility-types/custom.js.map +1 -0
- package/esm/types/utility-types/enumeration.d.ts +5 -0
- package/esm/types/utility-types/enumeration.js +31 -0
- package/esm/types/utility-types/enumeration.js.map +1 -0
- package/esm/types/utility-types/frozen.d.ts +24 -0
- package/esm/types/utility-types/frozen.js +92 -0
- package/esm/types/utility-types/frozen.js.map +1 -0
- package/esm/types/utility-types/identifier.d.ts +87 -0
- package/esm/types/utility-types/identifier.js +121 -0
- package/esm/types/utility-types/identifier.js.map +1 -0
- package/esm/types/utility-types/late.d.ts +10 -0
- package/esm/types/utility-types/late.js +106 -0
- package/esm/types/utility-types/late.js.map +1 -0
- package/esm/types/utility-types/lazy.d.ts +23 -0
- package/esm/types/utility-types/lazy.js +72 -0
- package/esm/types/utility-types/lazy.js.map +1 -0
- package/esm/types/utility-types/literal.d.ts +38 -0
- package/esm/types/utility-types/literal.js +58 -0
- package/esm/types/utility-types/literal.js.map +1 -0
- package/esm/types/utility-types/maybe.d.ts +26 -0
- package/esm/types/utility-types/maybe.js +26 -0
- package/esm/types/utility-types/maybe.js.map +1 -0
- package/esm/types/utility-types/optional.d.ts +42 -0
- package/esm/types/utility-types/optional.js +135 -0
- package/esm/types/utility-types/optional.js.map +1 -0
- package/esm/types/utility-types/reference.d.ts +90 -0
- package/esm/types/utility-types/reference.js +383 -0
- package/esm/types/utility-types/reference.js.map +1 -0
- package/esm/types/utility-types/refinement.d.ts +10 -0
- package/esm/types/utility-types/refinement.js +82 -0
- package/esm/types/utility-types/refinement.js.map +1 -0
- package/esm/types/utility-types/resilient.d.ts +18 -0
- package/esm/types/utility-types/resilient.js +118 -0
- package/esm/types/utility-types/resilient.js.map +1 -0
- package/esm/types/utility-types/snapshotProcessor.d.ts +63 -0
- package/esm/types/utility-types/snapshotProcessor.js +159 -0
- package/esm/types/utility-types/snapshotProcessor.js.map +1 -0
- package/esm/types/utility-types/union.d.ts +78 -0
- package/esm/types/utility-types/union.js +240 -0
- package/esm/types/utility-types/union.js.map +1 -0
- package/esm/utils.d.ts +230 -0
- package/esm/utils.js +449 -0
- package/esm/utils.js.map +1 -0
- package/package.json +23 -22
- package/dist/mobx-state-tree.js +0 -86
- package/dist/mobx-state-tree.js.map +0 -1
- package/dist/mobx-state-tree.module.js +0 -84
- package/dist/mobx-state-tree.module.js.map +0 -1
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { _getAdministration, _interceptReads, action, computed, defineProperty, getAtom, intercept, makeObservable, observable, observe, set } from "mobx";
|
|
2
|
+
import { ComplexType } from "../../core/type/type.js";
|
|
3
|
+
import { ArrayType, EMPTY_ARRAY, EMPTY_OBJECT, Hook, MapType, TypeFlags, addHiddenFinalProp, addHiddenWritableProp, assertArg, assertIsString, createActionInvoker, createObjectNode, devMode, escapeJsonPath, fail, freeze, getContextForPath, getPrimitiveFactoryFromValue, getStateTreeNode, isPlainObject, isPrimitive, isStateTreeNode, isType, mobxShallow, optional, popContext, typeCheckFailure, typeCheckSuccess, typecheckInternal } from "../../internal.js";
|
|
4
|
+
const PRE_PROCESS_SNAPSHOT = "preProcessSnapshot";
|
|
5
|
+
const POST_PROCESS_SNAPSHOT = "postProcessSnapshot";
|
|
6
|
+
function objectTypeToString() {
|
|
7
|
+
return getStateTreeNode(this).toString();
|
|
8
|
+
}
|
|
9
|
+
const defaultObjectOptions = {
|
|
10
|
+
name: "AnonymousModel",
|
|
11
|
+
properties: {},
|
|
12
|
+
initializers: EMPTY_ARRAY
|
|
13
|
+
};
|
|
14
|
+
function toPropertiesObject(declaredProps) {
|
|
15
|
+
const keysList = Object.keys(declaredProps);
|
|
16
|
+
const alreadySeenKeys = new Set();
|
|
17
|
+
keysList.forEach(key => {
|
|
18
|
+
if (alreadySeenKeys.has(key)) {
|
|
19
|
+
throw fail(`${key} is declared twice in the model. Model should not contain the same keys`);
|
|
20
|
+
}
|
|
21
|
+
alreadySeenKeys.add(key);
|
|
22
|
+
});
|
|
23
|
+
// loop through properties and ensures that all items are types
|
|
24
|
+
return keysList.reduce((props, key) => {
|
|
25
|
+
// warn if user intended a HOOK
|
|
26
|
+
if (key in Hook) {
|
|
27
|
+
throw fail(`Hook '${key}' was defined as property. Hooks should be defined as part of the actions`);
|
|
28
|
+
}
|
|
29
|
+
// the user intended to use a view
|
|
30
|
+
const descriptor = Object.getOwnPropertyDescriptor(declaredProps, key);
|
|
31
|
+
if ("get" in descriptor) {
|
|
32
|
+
throw fail("Getters are not supported as properties. Please use views instead");
|
|
33
|
+
}
|
|
34
|
+
// undefined and null are not valid
|
|
35
|
+
const value = descriptor.value;
|
|
36
|
+
if (value === null || value === undefined) {
|
|
37
|
+
throw fail("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");
|
|
38
|
+
}
|
|
39
|
+
// its a primitive, convert to its type
|
|
40
|
+
else if (isPrimitive(value)) {
|
|
41
|
+
props[key] = optional(getPrimitiveFactoryFromValue(value), value);
|
|
42
|
+
}
|
|
43
|
+
// map defaults to empty object automatically for models
|
|
44
|
+
else if (value instanceof MapType) {
|
|
45
|
+
props[key] = optional(value, {});
|
|
46
|
+
}
|
|
47
|
+
else if (value instanceof ArrayType) {
|
|
48
|
+
props[key] = optional(value, []);
|
|
49
|
+
}
|
|
50
|
+
// its already a type
|
|
51
|
+
else if (isType(value)) {
|
|
52
|
+
// do nothing, it's already a type
|
|
53
|
+
}
|
|
54
|
+
// its a function, maybe the user wanted a view?
|
|
55
|
+
else if (devMode() && typeof value === "function") {
|
|
56
|
+
throw fail(`Invalid type definition for property '${key}', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?`);
|
|
57
|
+
}
|
|
58
|
+
// no other complex values
|
|
59
|
+
else if (devMode() && typeof value === "object") {
|
|
60
|
+
throw fail(`Invalid type definition for property '${key}', it looks like you passed an object. Try passing another model type or a types.frozen.`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw fail(`Invalid type definition for property '${key}', cannot infer a type from a value like '${value}' (${typeof value})`);
|
|
64
|
+
}
|
|
65
|
+
return props;
|
|
66
|
+
}, { ...declaredProps });
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @hidden
|
|
71
|
+
*/
|
|
72
|
+
export class ModelType extends ComplexType {
|
|
73
|
+
flags = TypeFlags.Object;
|
|
74
|
+
/*
|
|
75
|
+
* The original object definition
|
|
76
|
+
*/
|
|
77
|
+
initializers;
|
|
78
|
+
properties;
|
|
79
|
+
preProcessor;
|
|
80
|
+
postProcessor;
|
|
81
|
+
propertyNames;
|
|
82
|
+
constructor(opts) {
|
|
83
|
+
super(opts.name || defaultObjectOptions.name);
|
|
84
|
+
Object.assign(this, defaultObjectOptions, opts);
|
|
85
|
+
// ensures that any default value gets converted to its related type
|
|
86
|
+
this.properties = toPropertiesObject(this.properties);
|
|
87
|
+
freeze(this.properties); // make sure nobody messes with it
|
|
88
|
+
this.propertyNames = Object.keys(this.properties);
|
|
89
|
+
this.identifierAttribute = this._getIdentifierAttribute();
|
|
90
|
+
}
|
|
91
|
+
_getIdentifierAttribute() {
|
|
92
|
+
let identifierAttribute = undefined;
|
|
93
|
+
this.forAllProps((propName, propType) => {
|
|
94
|
+
if (propType.flags & TypeFlags.Identifier) {
|
|
95
|
+
if (identifierAttribute) {
|
|
96
|
+
throw fail(`Cannot define property '${propName}' as object identifier, property '${identifierAttribute}' is already defined as identifier property`);
|
|
97
|
+
}
|
|
98
|
+
identifierAttribute = propName;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return identifierAttribute;
|
|
102
|
+
}
|
|
103
|
+
cloneAndEnhance(opts) {
|
|
104
|
+
return new ModelType({
|
|
105
|
+
name: opts.name || this.name,
|
|
106
|
+
properties: Object.assign({}, this.properties, opts.properties),
|
|
107
|
+
initializers: this.initializers.concat(opts.initializers || []),
|
|
108
|
+
preProcessor: opts.preProcessor || this.preProcessor,
|
|
109
|
+
postProcessor: opts.postProcessor || this.postProcessor
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
actions(fn) {
|
|
113
|
+
const actionInitializer = (self) => {
|
|
114
|
+
this.instantiateActions(self, fn(self));
|
|
115
|
+
return self;
|
|
116
|
+
};
|
|
117
|
+
return this.cloneAndEnhance({ initializers: [actionInitializer] });
|
|
118
|
+
}
|
|
119
|
+
instantiateActions(self, actions) {
|
|
120
|
+
// check if return is correct
|
|
121
|
+
if (!isPlainObject(actions)) {
|
|
122
|
+
throw fail(`actions initializer should return a plain object containing actions`);
|
|
123
|
+
}
|
|
124
|
+
// bind actions to the object created
|
|
125
|
+
Object.keys(actions).forEach(name => {
|
|
126
|
+
// warn if preprocessor was given
|
|
127
|
+
if (name === PRE_PROCESS_SNAPSHOT) {
|
|
128
|
+
throw fail(`Cannot define action '${PRE_PROCESS_SNAPSHOT}', it should be defined using 'type.preProcessSnapshot(fn)' instead`);
|
|
129
|
+
}
|
|
130
|
+
// warn if postprocessor was given
|
|
131
|
+
if (name === POST_PROCESS_SNAPSHOT) {
|
|
132
|
+
throw fail(`Cannot define action '${POST_PROCESS_SNAPSHOT}', it should be defined using 'type.postProcessSnapshot(fn)' instead`);
|
|
133
|
+
}
|
|
134
|
+
let action2 = actions[name];
|
|
135
|
+
// apply hook composition
|
|
136
|
+
const baseAction = self[name];
|
|
137
|
+
if (name in Hook && baseAction) {
|
|
138
|
+
const specializedAction = action2;
|
|
139
|
+
action2 = function (...args) {
|
|
140
|
+
baseAction(...args);
|
|
141
|
+
specializedAction(...args);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// the goal of this is to make sure actions using "this" can call themselves,
|
|
145
|
+
// while still allowing the middlewares to register them
|
|
146
|
+
const middlewares = action2.$mst_middleware; // make sure middlewares are not lost
|
|
147
|
+
const boundAction = action2.bind(actions);
|
|
148
|
+
boundAction._isFlowAction =
|
|
149
|
+
action2._isFlowAction || false;
|
|
150
|
+
boundAction.$mst_middleware = middlewares;
|
|
151
|
+
const actionInvoker = createActionInvoker(self, name, boundAction);
|
|
152
|
+
actions[name] = actionInvoker;
|
|
153
|
+
(!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(self, name, actionInvoker);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
named = name => {
|
|
157
|
+
return this.cloneAndEnhance({ name });
|
|
158
|
+
};
|
|
159
|
+
props = properties => {
|
|
160
|
+
return this.cloneAndEnhance({ properties });
|
|
161
|
+
};
|
|
162
|
+
volatile(fn) {
|
|
163
|
+
if (typeof fn !== "function") {
|
|
164
|
+
throw fail(`You passed an ${typeof fn} to volatile state as an argument, when function is expected`);
|
|
165
|
+
}
|
|
166
|
+
const stateInitializer = (self) => {
|
|
167
|
+
this.instantiateVolatileState(self, fn(self));
|
|
168
|
+
return self;
|
|
169
|
+
};
|
|
170
|
+
return this.cloneAndEnhance({ initializers: [stateInitializer] });
|
|
171
|
+
}
|
|
172
|
+
instantiateVolatileState(self, state) {
|
|
173
|
+
// check views return
|
|
174
|
+
if (!isPlainObject(state)) {
|
|
175
|
+
throw fail(`volatile state initializer should return a plain object containing state`);
|
|
176
|
+
}
|
|
177
|
+
set(self, state);
|
|
178
|
+
}
|
|
179
|
+
extend(fn) {
|
|
180
|
+
const initializer = (self) => {
|
|
181
|
+
const { actions, views, state, ...rest } = fn(self);
|
|
182
|
+
for (const key in rest) {
|
|
183
|
+
throw fail(`The \`extend\` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '${key}'`);
|
|
184
|
+
}
|
|
185
|
+
if (state) {
|
|
186
|
+
this.instantiateVolatileState(self, state);
|
|
187
|
+
}
|
|
188
|
+
if (views) {
|
|
189
|
+
this.instantiateViews(self, views);
|
|
190
|
+
}
|
|
191
|
+
if (actions) {
|
|
192
|
+
this.instantiateActions(self, actions);
|
|
193
|
+
}
|
|
194
|
+
return self;
|
|
195
|
+
};
|
|
196
|
+
return this.cloneAndEnhance({ initializers: [initializer] });
|
|
197
|
+
}
|
|
198
|
+
views(fn) {
|
|
199
|
+
const viewInitializer = (self) => {
|
|
200
|
+
this.instantiateViews(self, fn(self));
|
|
201
|
+
return self;
|
|
202
|
+
};
|
|
203
|
+
return this.cloneAndEnhance({ initializers: [viewInitializer] });
|
|
204
|
+
}
|
|
205
|
+
instantiateViews(self, views) {
|
|
206
|
+
// check views return
|
|
207
|
+
if (!isPlainObject(views)) {
|
|
208
|
+
throw fail(`views initializer should return a plain object containing views`);
|
|
209
|
+
}
|
|
210
|
+
Object.getOwnPropertyNames(views).forEach(key => {
|
|
211
|
+
// is this a computed property?
|
|
212
|
+
const descriptor = Object.getOwnPropertyDescriptor(views, key);
|
|
213
|
+
if ("get" in descriptor) {
|
|
214
|
+
defineProperty(self, key, descriptor);
|
|
215
|
+
makeObservable(self, { [key]: computed });
|
|
216
|
+
}
|
|
217
|
+
else if (typeof descriptor.value === "function") {
|
|
218
|
+
// this is a view function, merge as is!
|
|
219
|
+
// See #646, allow models to be mocked
|
|
220
|
+
;
|
|
221
|
+
(!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(self, key, descriptor.value);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
throw fail(`A view member should either be a function or getter based property`);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
preProcessSnapshot = preProcessor => {
|
|
229
|
+
const currentPreprocessor = this.preProcessor;
|
|
230
|
+
if (!currentPreprocessor) {
|
|
231
|
+
return this.cloneAndEnhance({ preProcessor });
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
return this.cloneAndEnhance({
|
|
235
|
+
preProcessor: snapshot => currentPreprocessor(preProcessor(snapshot))
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
postProcessSnapshot = postProcessor => {
|
|
240
|
+
const currentPostprocessor = this.postProcessor;
|
|
241
|
+
if (!currentPostprocessor) {
|
|
242
|
+
return this.cloneAndEnhance({ postProcessor });
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
return this.cloneAndEnhance({
|
|
246
|
+
postProcessor: snapshot => postProcessor(currentPostprocessor(snapshot))
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
instantiate(parent, subpath, environment, initialValue) {
|
|
251
|
+
const value = isStateTreeNode(initialValue)
|
|
252
|
+
? initialValue
|
|
253
|
+
: this.applySnapshotPreProcessor(initialValue);
|
|
254
|
+
return createObjectNode(this, parent, subpath, environment, value);
|
|
255
|
+
// Optimization: record all prop- view- and action names after first construction, and generate an optimal base class
|
|
256
|
+
// that pre-reserves all these fields for fast object-member lookups
|
|
257
|
+
}
|
|
258
|
+
initializeChildNodes(objNode, initialSnapshot = {}) {
|
|
259
|
+
const type = objNode.type;
|
|
260
|
+
const result = {};
|
|
261
|
+
type.forAllProps((name, childType) => {
|
|
262
|
+
result[name] = childType.instantiate(objNode, name, undefined, initialSnapshot[name]);
|
|
263
|
+
});
|
|
264
|
+
return result;
|
|
265
|
+
}
|
|
266
|
+
createNewInstance(childNodes) {
|
|
267
|
+
const options = { ...mobxShallow, name: this.name };
|
|
268
|
+
return observable.object(childNodes, EMPTY_OBJECT, options);
|
|
269
|
+
}
|
|
270
|
+
finalizeNewInstance(node, instance) {
|
|
271
|
+
addHiddenFinalProp(instance, "toString", objectTypeToString);
|
|
272
|
+
this.forAllProps(name => {
|
|
273
|
+
_interceptReads(instance, name, node.unbox);
|
|
274
|
+
});
|
|
275
|
+
this.initializers.reduce((self, fn) => fn(self), instance);
|
|
276
|
+
intercept(instance, this.willChange);
|
|
277
|
+
observe(instance, this.didChange);
|
|
278
|
+
}
|
|
279
|
+
willChange(chg) {
|
|
280
|
+
// TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop
|
|
281
|
+
const change = chg;
|
|
282
|
+
const node = getStateTreeNode(change.object);
|
|
283
|
+
const subpath = change.name;
|
|
284
|
+
node.assertWritable({ subpath });
|
|
285
|
+
const childType = node.type.properties[subpath];
|
|
286
|
+
// only properties are typed, state are stored as-is references
|
|
287
|
+
if (childType) {
|
|
288
|
+
typecheckInternal(childType, change.newValue);
|
|
289
|
+
change.newValue = childType.reconcile(node.getChildNode(subpath), change.newValue, node, subpath);
|
|
290
|
+
}
|
|
291
|
+
return change;
|
|
292
|
+
}
|
|
293
|
+
didChange(chg) {
|
|
294
|
+
// TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop
|
|
295
|
+
const change = chg;
|
|
296
|
+
const childNode = getStateTreeNode(change.object);
|
|
297
|
+
const childType = childNode.type.properties[change.name];
|
|
298
|
+
if (!childType) {
|
|
299
|
+
// don't emit patches for volatile state
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const oldChildValue = change.oldValue ? change.oldValue.snapshot : undefined;
|
|
303
|
+
childNode.emitPatch({
|
|
304
|
+
op: "replace",
|
|
305
|
+
path: escapeJsonPath(change.name),
|
|
306
|
+
value: change.newValue.snapshot,
|
|
307
|
+
oldValue: oldChildValue
|
|
308
|
+
}, childNode);
|
|
309
|
+
}
|
|
310
|
+
getChildren(node) {
|
|
311
|
+
const res = [];
|
|
312
|
+
this.forAllProps(name => {
|
|
313
|
+
res.push(this.getChildNode(node, name));
|
|
314
|
+
});
|
|
315
|
+
return res;
|
|
316
|
+
}
|
|
317
|
+
getChildNode(node, key) {
|
|
318
|
+
if (!(key in this.properties)) {
|
|
319
|
+
throw fail("Not a value property: " + key);
|
|
320
|
+
}
|
|
321
|
+
const adm = _getAdministration(node.storedValue, key);
|
|
322
|
+
const childNode = adm.raw?.();
|
|
323
|
+
if (!childNode) {
|
|
324
|
+
throw fail("Node not available for property " + key);
|
|
325
|
+
}
|
|
326
|
+
return childNode;
|
|
327
|
+
}
|
|
328
|
+
getSnapshot(node, applyPostProcess = true) {
|
|
329
|
+
const res = {};
|
|
330
|
+
this.forAllProps((name, _type) => {
|
|
331
|
+
try {
|
|
332
|
+
// TODO: FIXME, make sure the observable ref is used!
|
|
333
|
+
const atom = getAtom(node.storedValue, name);
|
|
334
|
+
atom.reportObserved();
|
|
335
|
+
}
|
|
336
|
+
catch (_e) {
|
|
337
|
+
throw fail(`${name} property is declared twice`);
|
|
338
|
+
}
|
|
339
|
+
res[name] = this.getChildNode(node, name).snapshot;
|
|
340
|
+
});
|
|
341
|
+
if (applyPostProcess) {
|
|
342
|
+
return this.applySnapshotPostProcessor(res);
|
|
343
|
+
}
|
|
344
|
+
return res;
|
|
345
|
+
}
|
|
346
|
+
processInitialSnapshot(childNodes) {
|
|
347
|
+
const processed = {};
|
|
348
|
+
Object.keys(childNodes).forEach(key => {
|
|
349
|
+
processed[key] = childNodes[key].getSnapshot();
|
|
350
|
+
});
|
|
351
|
+
return this.applySnapshotPostProcessor(processed);
|
|
352
|
+
}
|
|
353
|
+
applyPatchLocally(node, subpath, patch) {
|
|
354
|
+
if (!(patch.op === "replace" || patch.op === "add")) {
|
|
355
|
+
throw fail(`object does not support operation ${patch.op}`);
|
|
356
|
+
}
|
|
357
|
+
;
|
|
358
|
+
node.storedValue[subpath] = patch.value;
|
|
359
|
+
}
|
|
360
|
+
applySnapshot(node, snapshot) {
|
|
361
|
+
typecheckInternal(this, snapshot);
|
|
362
|
+
const preProcessedSnapshot = this.applySnapshotPreProcessor(snapshot);
|
|
363
|
+
this.forAllProps(name => {
|
|
364
|
+
;
|
|
365
|
+
node.storedValue[name] = preProcessedSnapshot[name];
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
applySnapshotPreProcessor(snapshot) {
|
|
369
|
+
const processor = this.preProcessor;
|
|
370
|
+
return processor ? processor.call(null, snapshot) : snapshot;
|
|
371
|
+
}
|
|
372
|
+
applySnapshotPostProcessor(snapshot) {
|
|
373
|
+
const postProcessor = this.postProcessor;
|
|
374
|
+
if (postProcessor) {
|
|
375
|
+
return postProcessor.call(null, snapshot);
|
|
376
|
+
}
|
|
377
|
+
return snapshot;
|
|
378
|
+
}
|
|
379
|
+
getChildType(propertyName) {
|
|
380
|
+
assertIsString(propertyName, 1);
|
|
381
|
+
return this.properties[propertyName];
|
|
382
|
+
}
|
|
383
|
+
isValidSnapshot(value, context) {
|
|
384
|
+
const snapshot = this.applySnapshotPreProcessor(value);
|
|
385
|
+
if (!isPlainObject(snapshot)) {
|
|
386
|
+
return typeCheckFailure(context, snapshot, "Value is not a plain object");
|
|
387
|
+
}
|
|
388
|
+
for (const key of this.propertyNames) {
|
|
389
|
+
const propType = this.properties[key];
|
|
390
|
+
getContextForPath(context, key, propType);
|
|
391
|
+
const errors = propType.validate(snapshot[key], context);
|
|
392
|
+
popContext(context);
|
|
393
|
+
if (errors.length > 0) {
|
|
394
|
+
return errors;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return typeCheckSuccess();
|
|
398
|
+
}
|
|
399
|
+
forAllProps(fn) {
|
|
400
|
+
this.propertyNames.forEach(key => fn(key, this.properties[key]));
|
|
401
|
+
}
|
|
402
|
+
describe() {
|
|
403
|
+
// optimization: cache
|
|
404
|
+
return ("{ " +
|
|
405
|
+
this.propertyNames
|
|
406
|
+
.map(key => key + ": " + this.properties[key].describe())
|
|
407
|
+
.join("; ") +
|
|
408
|
+
" }");
|
|
409
|
+
}
|
|
410
|
+
getDefaultSnapshot() {
|
|
411
|
+
return EMPTY_OBJECT;
|
|
412
|
+
}
|
|
413
|
+
removeChild(node, subpath) {
|
|
414
|
+
;
|
|
415
|
+
node.storedValue[subpath] = undefined;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
ModelType.prototype.applySnapshot = action(ModelType.prototype.applySnapshot);
|
|
419
|
+
/**
|
|
420
|
+
* `types.model` - Creates a new model type by providing a name, properties, volatile state and actions.
|
|
421
|
+
*
|
|
422
|
+
* See the [model type](/concepts/trees#creating-models) description or the [getting started](intro/getting-started.md#getting-started-1) tutorial.
|
|
423
|
+
*/
|
|
424
|
+
export function model(...args) {
|
|
425
|
+
if (devMode() && typeof args[0] !== "string" && args[1]) {
|
|
426
|
+
throw fail("Model creation failed. First argument must be a string when two arguments are provided");
|
|
427
|
+
}
|
|
428
|
+
const name = typeof args[0] === "string" ? args.shift() : "AnonymousModel";
|
|
429
|
+
const properties = args.shift() || {};
|
|
430
|
+
return new ModelType({ name, properties });
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* `types.compose` - Composes a new model from one or more existing model types.
|
|
434
|
+
* This method can be invoked in two forms:
|
|
435
|
+
* Given 2 or more model types, the types are composed into a new Type.
|
|
436
|
+
* Given first parameter as a string and 2 or more model types,
|
|
437
|
+
* the types are composed into a new Type with the given name
|
|
438
|
+
*/
|
|
439
|
+
export function compose(...args) {
|
|
440
|
+
// TODO: just join the base type names if no name is provided
|
|
441
|
+
const hasTypename = typeof args[0] === "string";
|
|
442
|
+
const typeName = hasTypename ? args[0] : "AnonymousModel";
|
|
443
|
+
if (hasTypename) {
|
|
444
|
+
args.shift();
|
|
445
|
+
}
|
|
446
|
+
// check all parameters
|
|
447
|
+
if (devMode()) {
|
|
448
|
+
args.forEach((type, i) => {
|
|
449
|
+
assertArg(type, isModelType, "mobx-state-tree model type", hasTypename ? i + 2 : i + 1);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
return args
|
|
453
|
+
.reduce((prev, cur) => prev.cloneAndEnhance({
|
|
454
|
+
name: prev.name + "_" + cur.name,
|
|
455
|
+
properties: cur.properties,
|
|
456
|
+
initializers: cur.initializers,
|
|
457
|
+
preProcessor: (snapshot) => cur.applySnapshotPreProcessor(prev.applySnapshotPreProcessor(snapshot)),
|
|
458
|
+
postProcessor: (snapshot) => cur.applySnapshotPostProcessor(prev.applySnapshotPostProcessor(snapshot))
|
|
459
|
+
}))
|
|
460
|
+
.named(typeName);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Returns if a given value represents a model type.
|
|
464
|
+
*
|
|
465
|
+
* @param type
|
|
466
|
+
* @returns
|
|
467
|
+
*/
|
|
468
|
+
export function isModelType(type) {
|
|
469
|
+
return isType(type) && (type.flags & TypeFlags.Object) > 0;
|
|
470
|
+
}
|
|
471
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/types/complex-types/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,QAAQ,EACR,cAAc,EACd,OAAO,EACP,SAAS,EACT,cAAc,EACd,UAAU,EACV,OAAO,EACP,GAAG,EACJ,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAGL,SAAS,EACT,WAAW,EACX,YAAY,EAEZ,IAAI,EASJ,OAAO,EACP,SAAS,EAGT,kBAAkB,EAClB,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,OA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AAI,CAAC,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5D,CAAC","sourcesContent":["import {\n type IObjectDidChange,\n type IObjectWillChange,\n _getAdministration,\n _interceptReads,\n action,\n computed,\n defineProperty,\n getAtom,\n intercept,\n makeObservable,\n observable,\n observe,\n set\n} from \"mobx\"\n\nimport { ComplexType } from \"../../core/type/type.ts\"\nimport {\n type AnyNode,\n type AnyObjectNode,\n ArrayType,\n EMPTY_ARRAY,\n EMPTY_OBJECT,\n type FunctionWithFlag,\n Hook,\n type IAnyType,\n type IChildNodesMap,\n type IJsonPatch,\n type IStateTreeNode,\n type IType,\n type IValidationContext,\n type IValidationResult,\n type Instance,\n MapType,\n TypeFlags,\n type _CustomOrOther,\n type _NotCustomized,\n addHiddenFinalProp,\n addHiddenWritableProp,\n assertArg,\n assertIsString,\n createActionInvoker,\n createObjectNode,\n devMode,\n escapeJsonPath,\n fail,\n freeze,\n getContextForPath,\n getPrimitiveFactoryFromValue,\n getStateTreeNode,\n isPlainObject,\n isPrimitive,\n isStateTreeNode,\n isType,\n mobxShallow,\n optional,\n popContext,\n typeCheckFailure,\n typeCheckSuccess,\n typecheckInternal\n} from \"../../internal.ts\"\n\nconst PRE_PROCESS_SNAPSHOT = \"preProcessSnapshot\"\nconst POST_PROCESS_SNAPSHOT = \"postProcessSnapshot\"\n\n/** @hidden */\nexport interface ModelProperties {\n [key: string]: IAnyType\n}\n\n/** @hidden */\nexport type ModelPrimitive = string | number | boolean | Date\n\n/** @hidden */\nexport interface ModelPropertiesDeclaration {\n [key: string]: ModelPrimitive | IAnyType\n}\n\n/**\n * Unmaps syntax property declarations to a map of { propName: IType }\n *\n * @hidden\n */\nexport type ModelPropertiesDeclarationToProperties<\n T extends ModelPropertiesDeclaration\n> = T extends { [k: string]: IAnyType } // optimization to reduce nesting\n ? T\n : {\n [K in keyof T]: T[K] extends IAnyType // keep IAnyType check on the top to reduce nesting\n ? T[K]\n : T[K] extends string\n ? IType<string | undefined, string, string>\n : T[K] extends number\n ? IType<number | undefined, number, number>\n : T[K] extends boolean\n ? IType<boolean | undefined, boolean, boolean>\n : T[K] extends Date\n ? IType<number | Date | undefined, number, Date>\n : never\n }\n\n/**\n * Checks if a value is optional (undefined, any or unknown).\n * @hidden\n *\n * Examples:\n * - string = false\n * - undefined = true\n * - string | undefined = true\n * - string & undefined = false, but we don't care\n * - any = true\n * - unknown = true\n */\ntype IsOptionalValue<C, TV, FV> = undefined extends C ? TV : FV\n\n// type _A = IsOptionalValue<string, true, false> // false\n// type _B = IsOptionalValue<undefined, true, false> // true\n// type _C = IsOptionalValue<string | undefined, true, false> // true\n// type _D = IsOptionalValue<string & undefined, true, false> // false, but we don't care\n// type _E = IsOptionalValue<any, true, false> // true\n// type _F = IsOptionalValue<unknown, true, false> // true\n\n/**\n * Name of the properties of an object that can't be set to undefined, any or unknown\n * @hidden\n */\ntype DefinablePropsNames<T> = {\n [K in keyof T]: IsOptionalValue<T[K], never, K>\n}[keyof T]\n\n/** @hidden */\nexport declare const $nonEmptyObject: unique symbol\n\n/** @hidden */\nexport interface NonEmptyObject {\n [$nonEmptyObject]?: any\n}\n\n/** @hidden */\nexport type ExtractCFromProps<P extends ModelProperties> = {\n [k in keyof P]: P[k][\"CreationType\"]\n}\n\n/** @hidden */\nexport type ModelCreationType<PC> = {\n [P in DefinablePropsNames<PC>]: PC[P]\n} & Partial<PC> &\n NonEmptyObject\n\n/** @hidden */\nexport type ModelCreationType2<\n P extends ModelProperties,\n CustomC\n> = keyof P extends never\n ? // When there are no props, we want to prevent passing in any object. We have two objects we want to allow:\n // 1. The empty object\n // 2. An instance of this model\n //\n // The `IStateTreeNode` interface allows both. For (1), these props are optional so an empty object is allowed.\n // For (2), an instance will contain these two props, including the \"secret\" `$stateTreeNodeType` prop. TypeScript's\n // excess property checking will then ensure no other props are passed in.\n IStateTreeNode\n : _CustomOrOther<CustomC, ModelCreationType<ExtractCFromProps<P>>>\n\n/** @hidden */\nexport type ModelSnapshotType<P extends ModelProperties> = {\n [K in keyof P]: P[K][\"SnapshotType\"]\n} & NonEmptyObject\n\n/** @hidden */\nexport type ModelSnapshotType2<\n P extends ModelProperties,\n CustomS\n> = _CustomOrOther<CustomS, ModelSnapshotType<P>>\n\n/**\n * @hidden\n * we keep this separate from ModelInstanceType to shorten model instance types generated declarations\n */\nexport type ModelInstanceTypeProps<P extends ModelProperties> = {\n [K in keyof P]: P[K][\"Type\"]\n} & NonEmptyObject\n\n/**\n * @hidden\n * do not transform this to an interface or model instance type generated declarations will be longer\n */\nexport type ModelInstanceType<\n P extends ModelProperties,\n O\n> = ModelInstanceTypeProps<P> & O\n\n/** @hidden */\nexport interface ModelActions {\n [key: string]: FunctionWithFlag\n}\n\nexport interface IModelType<\n PROPS extends ModelProperties,\n OTHERS,\n CustomC = _NotCustomized,\n CustomS = _NotCustomized\n> extends IType<\n ModelCreationType2<PROPS, CustomC>,\n ModelSnapshotType2<PROPS, CustomS>,\n ModelInstanceType<PROPS, OTHERS>\n> {\n readonly properties: PROPS\n\n named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>\n\n // warning: redefining props after a process snapshot is used ends up on the fixed (custom) C, S typings being overridden\n // so it is recommended to use pre/post process snapshot after all props have been defined\n props<PROPS2 extends ModelPropertiesDeclaration>(\n props: PROPS2\n ): IModelType<\n PROPS & ModelPropertiesDeclarationToProperties<PROPS2>,\n OTHERS,\n CustomC,\n CustomS\n >\n\n views<V extends object>(\n fn: (self: Instance<this>) => V\n ): IModelType<PROPS, OTHERS & V, CustomC, CustomS>\n\n actions<A extends ModelActions>(\n fn: (self: Instance<this>) => A\n ): IModelType<PROPS, OTHERS & A, CustomC, CustomS>\n\n volatile<TP extends object>(\n fn: (self: Instance<this>) => TP\n ): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>\n\n extend<\n A extends ModelActions = {},\n V extends object = {},\n VS extends object = {}\n >(\n fn: (self: Instance<this>) => { actions?: A; views?: V; state?: VS }\n ): IModelType<PROPS, OTHERS & A & V & VS, CustomC, CustomS>\n\n preProcessSnapshot<NewC = ModelCreationType2<PROPS, CustomC>>(\n fn: (snapshot: NewC) => ModelCreationType2<PROPS, CustomC>\n ): IModelType<PROPS, OTHERS, NewC, CustomS>\n\n postProcessSnapshot<NewS = ModelSnapshotType2<PROPS, CustomS>>(\n fn: (snapshot: ModelSnapshotType2<PROPS, CustomS>) => NewS\n ): IModelType<PROPS, OTHERS, CustomC, NewS>\n}\n\n/**\n * Any model type.\n */\nexport interface IAnyModelType extends IModelType<any, any, any, any> {}\n\n/** @hidden */\nexport type ExtractProps<T extends IAnyModelType> =\n T extends IModelType<infer P, any, any, any> ? P : never\n/** @hidden */\nexport type ExtractOthers<T extends IAnyModelType> =\n T extends IModelType<any, infer O, any, any> ? O : never\n\nfunction objectTypeToString(this: any) {\n return getStateTreeNode(this).toString()\n}\n\n/**\n * @internal\n * @hidden\n */\nexport interface ModelTypeConfig {\n name?: string\n properties?: ModelPropertiesDeclaration\n initializers?: ReadonlyArray<(instance: any) => any>\n preProcessor?: (snapshot: any) => any\n postProcessor?: (snapshot: any) => any\n}\n\nconst defaultObjectOptions = {\n name: \"AnonymousModel\",\n properties: {},\n initializers: EMPTY_ARRAY\n}\n\nfunction toPropertiesObject(\n declaredProps: ModelPropertiesDeclaration\n): ModelProperties {\n const keysList = Object.keys(declaredProps)\n const alreadySeenKeys = new Set<string>()\n\n keysList.forEach(key => {\n if (alreadySeenKeys.has(key)) {\n throw fail(\n `${key} is declared twice in the model. Model should not contain the same keys`\n )\n }\n alreadySeenKeys.add(key)\n })\n\n // loop through properties and ensures that all items are types\n return keysList.reduce(\n (props, key) => {\n // warn if user intended a HOOK\n if (key in Hook) {\n throw fail(\n `Hook '${key}' was defined as property. Hooks should be defined as part of the actions`\n )\n }\n\n // the user intended to use a view\n const descriptor = Object.getOwnPropertyDescriptor(declaredProps, key)!\n if (\"get\" in descriptor) {\n throw fail(\n \"Getters are not supported as properties. Please use views instead\"\n )\n }\n // undefined and null are not valid\n const value = descriptor.value\n if (value === null || value === undefined) {\n throw fail(\n \"The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?\"\n )\n }\n // its a primitive, convert to its type\n else if (isPrimitive(value)) {\n props[key] = optional(getPrimitiveFactoryFromValue(value), value)\n }\n // map defaults to empty object automatically for models\n else if (value instanceof MapType) {\n props[key] = optional(value, {})\n } else if (value instanceof ArrayType) {\n props[key] = optional(value, [])\n }\n // its already a type\n else if (isType(value)) {\n // do nothing, it's already a type\n }\n // its a function, maybe the user wanted a view?\n else if (devMode() && typeof value === \"function\") {\n throw fail(\n `Invalid type definition for property '${key}', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?`\n )\n }\n // no other complex values\n else if (devMode() && typeof value === \"object\") {\n throw fail(\n `Invalid type definition for property '${key}', it looks like you passed an object. Try passing another model type or a types.frozen.`\n )\n } else {\n throw fail(\n `Invalid type definition for property '${key}', cannot infer a type from a value like '${value}' (${typeof value})`\n )\n }\n\n return props\n },\n { ...declaredProps } as any\n )\n}\n\n/**\n * @internal\n * @hidden\n */\nexport class ModelType<\n PROPS extends ModelProperties,\n OTHERS,\n CustomC,\n CustomS,\n MT extends IModelType<PROPS, OTHERS, CustomC, CustomS>\n>\n extends ComplexType<\n ModelCreationType2<PROPS, CustomC>,\n ModelSnapshotType2<PROPS, CustomS>,\n ModelInstanceType<PROPS, OTHERS>\n >\n implements IModelType<PROPS, OTHERS, CustomC, CustomS>\n{\n readonly flags = TypeFlags.Object\n\n /*\n * The original object definition\n */\n public readonly initializers!: ((instance: any) => any)[]\n public readonly properties!: PROPS\n\n private preProcessor!: (snapshot: any) => any | undefined\n private postProcessor!: (snapshot: any) => any | undefined\n readonly propertyNames: string[]\n\n constructor(opts: ModelTypeConfig) {\n super(opts.name || defaultObjectOptions.name)\n Object.assign(this, defaultObjectOptions, opts)\n // ensures that any default value gets converted to its related type\n this.properties = toPropertiesObject(this.properties) as PROPS\n freeze(this.properties) // make sure nobody messes with it\n this.propertyNames = Object.keys(this.properties)\n this.identifierAttribute = this._getIdentifierAttribute()\n }\n\n private _getIdentifierAttribute(): string | undefined {\n let identifierAttribute: string | undefined = undefined\n this.forAllProps((propName, propType) => {\n if (propType.flags & TypeFlags.Identifier) {\n if (identifierAttribute) {\n throw fail(\n `Cannot define property '${propName}' as object identifier, property '${identifierAttribute}' is already defined as identifier property`\n )\n }\n identifierAttribute = propName\n }\n })\n return identifierAttribute\n }\n\n cloneAndEnhance(opts: ModelTypeConfig): IAnyModelType {\n return new ModelType({\n name: opts.name || this.name,\n properties: Object.assign({}, this.properties, opts.properties),\n initializers: this.initializers.concat(opts.initializers || []),\n preProcessor: opts.preProcessor || this.preProcessor,\n postProcessor: opts.postProcessor || this.postProcessor\n })\n }\n\n actions<A extends ModelActions>(fn: (self: Instance<this>) => A) {\n const actionInitializer = (self: Instance<this>) => {\n this.instantiateActions(self, fn(self))\n return self\n }\n return this.cloneAndEnhance({ initializers: [actionInitializer] })\n }\n\n private instantiateActions(self: this[\"T\"], actions: ModelActions): void {\n // check if return is correct\n if (!isPlainObject(actions)) {\n throw fail(\n `actions initializer should return a plain object containing actions`\n )\n }\n\n // bind actions to the object created\n Object.keys(actions).forEach(name => {\n // warn if preprocessor was given\n if (name === PRE_PROCESS_SNAPSHOT) {\n throw fail(\n `Cannot define action '${PRE_PROCESS_SNAPSHOT}', it should be defined using 'type.preProcessSnapshot(fn)' instead`\n )\n }\n // warn if postprocessor was given\n if (name === POST_PROCESS_SNAPSHOT) {\n throw fail(\n `Cannot define action '${POST_PROCESS_SNAPSHOT}', it should be defined using 'type.postProcessSnapshot(fn)' instead`\n )\n }\n\n let action2 = actions[name]\n\n // apply hook composition\n const baseAction = (self as any)[name]\n if (name in Hook && baseAction) {\n const specializedAction = action2\n action2 = function (...args: any[]) {\n baseAction(...args)\n specializedAction(...args)\n }\n }\n\n // the goal of this is to make sure actions using \"this\" can call themselves,\n // while still allowing the middlewares to register them\n const middlewares = (action2 as any).$mst_middleware // make sure middlewares are not lost\n const boundAction = action2.bind(actions)\n boundAction._isFlowAction =\n (action2 as FunctionWithFlag)._isFlowAction || false\n boundAction.$mst_middleware = middlewares\n const actionInvoker = createActionInvoker(self as any, name, boundAction)\n actions[name] = actionInvoker\n\n // See #646, allow models to be mocked\n ;(!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(\n self,\n name,\n actionInvoker\n )\n })\n }\n\n named: MT[\"named\"] = name => {\n return this.cloneAndEnhance({ name })\n }\n\n props: MT[\"props\"] = properties => {\n return this.cloneAndEnhance({ properties })\n }\n\n volatile<TP extends object>(fn: (self: Instance<this>) => TP) {\n if (typeof fn !== \"function\") {\n throw fail(\n `You passed an ${typeof fn} to volatile state as an argument, when function is expected`\n )\n }\n const stateInitializer = (self: Instance<this>) => {\n this.instantiateVolatileState(self, fn(self))\n return self\n }\n return this.cloneAndEnhance({ initializers: [stateInitializer] })\n }\n\n private instantiateVolatileState(\n self: this[\"T\"],\n state: {\n [key: string]: any\n }\n ): void {\n // check views return\n if (!isPlainObject(state)) {\n throw fail(\n `volatile state initializer should return a plain object containing state`\n )\n }\n set(self, state)\n }\n\n extend<\n A extends ModelActions = {},\n V extends object = {},\n VS extends object = {}\n >(fn: (self: Instance<this>) => { actions?: A; views?: V; state?: VS }) {\n const initializer = (self: Instance<this>) => {\n const { actions, views, state, ...rest } = fn(self)\n for (const key in rest) {\n throw fail(\n `The \\`extend\\` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '${key}'`\n )\n }\n if (state) {\n this.instantiateVolatileState(self, state)\n }\n if (views) {\n this.instantiateViews(self, views)\n }\n if (actions) {\n this.instantiateActions(self, actions)\n }\n return self\n }\n return this.cloneAndEnhance({ initializers: [initializer] })\n }\n\n views<V extends object>(fn: (self: Instance<this>) => V) {\n const viewInitializer = (self: Instance<this>) => {\n this.instantiateViews(self, fn(self))\n return self\n }\n return this.cloneAndEnhance({ initializers: [viewInitializer] })\n }\n\n private instantiateViews(self: this[\"T\"], views: object): void {\n // check views return\n if (!isPlainObject(views)) {\n throw fail(\n `views initializer should return a plain object containing views`\n )\n }\n Object.getOwnPropertyNames(views).forEach(key => {\n // is this a computed property?\n const descriptor = Object.getOwnPropertyDescriptor(views, key)!\n if (\"get\" in descriptor) {\n defineProperty(self, key, descriptor)\n makeObservable(self, { [key]: computed } as any)\n } else if (typeof descriptor.value === \"function\") {\n // this is a view function, merge as is!\n // See #646, allow models to be mocked\n ;(!devMode() ? addHiddenFinalProp : addHiddenWritableProp)(\n self,\n key,\n descriptor.value\n )\n } else {\n throw fail(\n `A view member should either be a function or getter based property`\n )\n }\n })\n }\n\n preProcessSnapshot: MT[\"preProcessSnapshot\"] = preProcessor => {\n const currentPreprocessor = this.preProcessor\n if (!currentPreprocessor) {\n return this.cloneAndEnhance({ preProcessor })\n } else {\n return this.cloneAndEnhance({\n preProcessor: snapshot => currentPreprocessor(preProcessor(snapshot))\n })\n }\n }\n\n postProcessSnapshot: MT[\"postProcessSnapshot\"] = postProcessor => {\n const currentPostprocessor = this.postProcessor\n if (!currentPostprocessor) {\n return this.cloneAndEnhance({ postProcessor })\n } else {\n return this.cloneAndEnhance({\n postProcessor: snapshot => postProcessor(currentPostprocessor(snapshot))\n })\n }\n }\n\n instantiate(\n parent: AnyObjectNode | null,\n subpath: string,\n environment: any,\n initialValue: this[\"C\"] | this[\"T\"]\n ): this[\"N\"] {\n const value = isStateTreeNode(initialValue)\n ? initialValue\n : this.applySnapshotPreProcessor(initialValue)\n return createObjectNode(this, parent, subpath, environment, value)\n // Optimization: record all prop- view- and action names after first construction, and generate an optimal base class\n // that pre-reserves all these fields for fast object-member lookups\n }\n\n initializeChildNodes(\n objNode: this[\"N\"],\n initialSnapshot: any = {}\n ): IChildNodesMap {\n const type = objNode.type as this\n const result: IChildNodesMap = {}\n type.forAllProps((name, childType) => {\n result[name] = childType.instantiate(\n objNode,\n name,\n undefined,\n (initialSnapshot as any)[name]\n )\n })\n return result\n }\n\n createNewInstance(childNodes: IChildNodesMap): this[\"T\"] {\n const options = { ...mobxShallow, name: this.name }\n return observable.object(childNodes, EMPTY_OBJECT, options) as any\n }\n\n finalizeNewInstance(node: this[\"N\"], instance: this[\"T\"]): void {\n addHiddenFinalProp(instance, \"toString\", objectTypeToString)\n\n this.forAllProps(name => {\n _interceptReads(instance, name, node.unbox)\n })\n\n this.initializers.reduce((self, fn) => fn(self), instance)\n intercept(instance, this.willChange)\n observe(instance, this.didChange)\n }\n\n private willChange(chg: IObjectWillChange): IObjectWillChange | null {\n // TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop\n const change = chg as IObjectWillChange & { newValue?: any }\n\n const node = getStateTreeNode(change.object)\n const subpath = change.name as string\n node.assertWritable({ subpath })\n const childType = (node.type as this).properties[subpath]\n // only properties are typed, state are stored as-is references\n if (childType) {\n typecheckInternal(childType, change.newValue)\n change.newValue = childType.reconcile(\n node.getChildNode(subpath),\n change.newValue,\n node,\n subpath\n )\n }\n return change\n }\n\n private didChange(chg: IObjectDidChange) {\n // TODO: mobx typings don't seem to take into account that newValue can be set even when removing a prop\n const change = chg as IObjectWillChange & { newValue?: any; oldValue?: any }\n\n const childNode = getStateTreeNode(change.object)\n const childType = (childNode.type as this).properties[change.name as string]\n if (!childType) {\n // don't emit patches for volatile state\n return\n }\n const oldChildValue = change.oldValue ? change.oldValue.snapshot : undefined\n childNode.emitPatch(\n {\n op: \"replace\",\n path: escapeJsonPath(change.name as string),\n value: change.newValue.snapshot,\n oldValue: oldChildValue\n },\n childNode\n )\n }\n\n getChildren(node: this[\"N\"]): ReadonlyArray<AnyNode> {\n const res: AnyNode[] = []\n this.forAllProps(name => {\n res.push(this.getChildNode(node, name))\n })\n return res\n }\n\n getChildNode(node: this[\"N\"], key: string): AnyNode {\n if (!(key in this.properties)) {\n throw fail(\"Not a value property: \" + key)\n }\n const adm = _getAdministration(node.storedValue, key)\n const childNode = adm.raw?.()\n if (!childNode) {\n throw fail(\"Node not available for property \" + key)\n }\n return childNode\n }\n\n getSnapshot(node: this[\"N\"], applyPostProcess = true): this[\"S\"] {\n const res = {} as any\n this.forAllProps((name, _type) => {\n try {\n // TODO: FIXME, make sure the observable ref is used!\n const atom = getAtom(node.storedValue, name)\n ;(atom as any).reportObserved()\n } catch (_e) {\n throw fail(`${name} property is declared twice`)\n }\n res[name] = this.getChildNode(node, name).snapshot\n })\n if (applyPostProcess) {\n return this.applySnapshotPostProcessor(res)\n }\n return res\n }\n\n processInitialSnapshot(childNodes: IChildNodesMap): this[\"S\"] {\n const processed = {} as any\n Object.keys(childNodes).forEach(key => {\n processed[key] = childNodes[key].getSnapshot()\n })\n return this.applySnapshotPostProcessor(processed)\n }\n\n applyPatchLocally(node: this[\"N\"], subpath: string, patch: IJsonPatch): void {\n if (!(patch.op === \"replace\" || patch.op === \"add\")) {\n throw fail(`object does not support operation ${patch.op}`)\n }\n ;(node.storedValue as any)[subpath] = patch.value\n }\n\n applySnapshot(node: this[\"N\"], snapshot: this[\"C\"]): void {\n typecheckInternal(this, snapshot)\n const preProcessedSnapshot = this.applySnapshotPreProcessor(snapshot)\n this.forAllProps(name => {\n ;(node.storedValue as any)[name] = preProcessedSnapshot[name]\n })\n }\n\n applySnapshotPreProcessor(snapshot: any) {\n const processor = this.preProcessor\n return processor ? processor.call(null, snapshot) : snapshot\n }\n\n applySnapshotPostProcessor(snapshot: any) {\n const postProcessor = this.postProcessor\n if (postProcessor) {\n return postProcessor.call(null, snapshot)\n }\n return snapshot\n }\n\n getChildType(propertyName: string): IAnyType {\n assertIsString(propertyName, 1)\n\n return this.properties[propertyName]\n }\n\n isValidSnapshot(\n value: this[\"C\"],\n context: IValidationContext\n ): IValidationResult {\n const snapshot = this.applySnapshotPreProcessor(value)\n\n if (!isPlainObject(snapshot)) {\n return typeCheckFailure(context, snapshot, \"Value is not a plain object\")\n }\n\n for (const key of this.propertyNames) {\n const propType = this.properties[key]!\n getContextForPath(context, key, propType)\n const errors = propType.validate(snapshot[key], context)\n popContext(context)\n if (errors.length > 0) {\n return errors\n }\n }\n return typeCheckSuccess()\n }\n\n private forAllProps(fn: (name: string, type: IAnyType) => void) {\n this.propertyNames.forEach(key => fn(key, this.properties[key]))\n }\n\n describe() {\n // optimization: cache\n return (\n \"{ \" +\n this.propertyNames\n .map(key => key + \": \" + this.properties[key].describe())\n .join(\"; \") +\n \" }\"\n )\n }\n\n getDefaultSnapshot(): this[\"C\"] {\n return EMPTY_OBJECT as this[\"C\"]\n }\n\n removeChild(node: this[\"N\"], subpath: string) {\n ;(node.storedValue as any)[subpath] = undefined\n }\n}\nModelType.prototype.applySnapshot = action(ModelType.prototype.applySnapshot)\n\nexport function model<P extends ModelPropertiesDeclaration = {}>(\n name: string,\n properties?: P\n): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>\nexport function model<P extends ModelPropertiesDeclaration = {}>(\n properties?: P\n): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>\n/**\n * `types.model` - Creates a new model type by providing a name, properties, volatile state and actions.\n *\n * See the [model type](/concepts/trees#creating-models) description or the [getting started](intro/getting-started.md#getting-started-1) tutorial.\n */\nexport function model(...args: any[]): any {\n if (devMode() && typeof args[0] !== \"string\" && args[1]) {\n throw fail(\n \"Model creation failed. First argument must be a string when two arguments are provided\"\n )\n }\n\n const name = typeof args[0] === \"string\" ? args.shift() : \"AnonymousModel\"\n const properties = args.shift() || {}\n return new ModelType({ name, properties })\n}\n\n// TODO: this can be simplified in TS3, since we can transform _NotCustomized to unknown, since unkonwn & X = X\n// and then back unknown to _NotCustomized if needed\n/** @hidden */\nexport type _CustomJoin<A, B> = A extends _NotCustomized ? B : A & B\n\n// generated with C:\\VSProjects\\github\\mobx-state-tree-upstream\\packages\\mobx-state-tree\\scripts\\generate-compose-type.js\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(A:\n IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA,\n _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>\n// prettier-ignore\nexport function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF\n extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>\n\n/**\n * `types.compose` - Composes a new model from one or more existing model types.\n * This method can be invoked in two forms:\n * Given 2 or more model types, the types are composed into a new Type.\n * Given first parameter as a string and 2 or more model types,\n * the types are composed into a new Type with the given name\n */\nexport function compose(...args: any[]): any {\n // TODO: just join the base type names if no name is provided\n const hasTypename = typeof args[0] === \"string\"\n const typeName: string = hasTypename ? args[0] : \"AnonymousModel\"\n if (hasTypename) {\n args.shift()\n }\n\n // check all parameters\n if (devMode()) {\n args.forEach((type, i) => {\n assertArg(\n type,\n isModelType,\n \"mobx-state-tree model type\",\n hasTypename ? i + 2 : i + 1\n )\n })\n }\n\n return args\n .reduce((prev, cur) =>\n prev.cloneAndEnhance({\n name: prev.name + \"_\" + cur.name,\n properties: cur.properties,\n initializers: cur.initializers,\n preProcessor: (snapshot: any) =>\n cur.applySnapshotPreProcessor(\n prev.applySnapshotPreProcessor(snapshot)\n ),\n postProcessor: (snapshot: any) =>\n cur.applySnapshotPostProcessor(\n prev.applySnapshotPostProcessor(snapshot)\n )\n })\n )\n .named(typeName)\n}\n\n/**\n * Returns if a given value represents a model type.\n *\n * @param type\n * @returns\n */\nexport function isModelType<IT extends IAnyModelType = IAnyModelType>(\n type: IAnyType\n): type is IT {\n return isType(type) && (type.flags & TypeFlags.Object) > 0\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { array, compose, custom, enumeration, frozen, late, lazy, literal, map, maybe, maybeNull, model, optional, reference, refinement, safeReference, resilient, snapshotProcessor, union } from "../internal.ts";
|
|
2
|
+
export declare const types: {
|
|
3
|
+
enumeration: typeof enumeration;
|
|
4
|
+
model: typeof model;
|
|
5
|
+
compose: typeof compose;
|
|
6
|
+
custom: typeof custom;
|
|
7
|
+
reference: typeof reference;
|
|
8
|
+
safeReference: typeof safeReference;
|
|
9
|
+
union: typeof union;
|
|
10
|
+
optional: typeof optional;
|
|
11
|
+
literal: typeof literal;
|
|
12
|
+
maybe: typeof maybe;
|
|
13
|
+
maybeNull: typeof maybeNull;
|
|
14
|
+
refinement: typeof refinement;
|
|
15
|
+
string: import("../internal.ts").ISimpleType<string>;
|
|
16
|
+
boolean: import("../internal.ts").ISimpleType<boolean>;
|
|
17
|
+
number: import("../internal.ts").ISimpleType<number>;
|
|
18
|
+
integer: import("../internal.ts").ISimpleType<number>;
|
|
19
|
+
float: import("../internal.ts").ISimpleType<number>;
|
|
20
|
+
finite: import("../internal.ts").ISimpleType<number>;
|
|
21
|
+
Date: import("../internal.ts").IType<number | Date, number, Date>;
|
|
22
|
+
map: typeof map;
|
|
23
|
+
array: typeof array;
|
|
24
|
+
frozen: typeof frozen;
|
|
25
|
+
identifier: import("../internal.ts").ISimpleType<string>;
|
|
26
|
+
identifierNumber: import("../internal.ts").ISimpleType<number>;
|
|
27
|
+
late: typeof late;
|
|
28
|
+
lazy: typeof lazy;
|
|
29
|
+
undefined: import("../internal.ts").ISimpleType<undefined>;
|
|
30
|
+
null: import("../internal.ts").ISimpleType<null>;
|
|
31
|
+
snapshotProcessor: typeof snapshotProcessor;
|
|
32
|
+
resilient: typeof resilient;
|
|
33
|
+
};
|