mobx-keystone 2.3.0 → 2.4.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/mobx-keystone.esm.js +3737 -2722
  3. package/dist/mobx-keystone.esm.mjs +3737 -2722
  4. package/dist/mobx-keystone.umd.js +3750 -2721
  5. package/dist/types/action/CallKind.d.ts +29 -0
  6. package/dist/types/action/applyAction.d.ts +8 -2
  7. package/dist/types/action/applyMethodCall.d.ts +1 -1
  8. package/dist/types/action/index.d.ts +13 -12
  9. package/dist/types/action/isModelAction.d.ts +1 -1
  10. package/dist/types/action/middleware.d.ts +1 -1
  11. package/dist/types/action/resolveCallName.d.ts +1 -0
  12. package/dist/types/actionMiddlewares/actionSerialization/actionSerialization.d.ts +17 -3
  13. package/dist/types/actionMiddlewares/actionSerialization/applySerializedAction.d.ts +8 -2
  14. package/dist/types/actionMiddlewares/actionSerialization/arraySerializer.d.ts +2 -2
  15. package/dist/types/actionMiddlewares/actionSerialization/core.d.ts +7 -0
  16. package/dist/types/actionMiddlewares/actionSerialization/dateSerializer.d.ts +1 -1
  17. package/dist/types/actionMiddlewares/actionSerialization/index.d.ts +3 -3
  18. package/dist/types/actionMiddlewares/actionSerialization/mapSerializer.d.ts +2 -2
  19. package/dist/types/actionMiddlewares/actionSerialization/objectPathSerializer.d.ts +2 -2
  20. package/dist/types/actionMiddlewares/actionSerialization/objectSnapshotSerializer.d.ts +1 -1
  21. package/dist/types/actionMiddlewares/actionSerialization/plainObjectSerializer.d.ts +1 -1
  22. package/dist/types/actionMiddlewares/actionSerialization/primitiveSerializer.d.ts +1 -1
  23. package/dist/types/actionMiddlewares/actionSerialization/setSerializer.d.ts +2 -2
  24. package/dist/types/actionMiddlewares/actionTrackingMiddleware.d.ts +3 -3
  25. package/dist/types/actionMiddlewares/index.d.ts +6 -6
  26. package/dist/types/actionMiddlewares/onActionMiddleware.d.ts +3 -3
  27. package/dist/types/actionMiddlewares/readonlyMiddleware.d.ts +1 -1
  28. package/dist/types/actionMiddlewares/transactionMiddleware.d.ts +2 -2
  29. package/dist/types/actionMiddlewares/undoMiddleware.d.ts +8 -8
  30. package/dist/types/computedTree/index.d.ts +1 -1
  31. package/dist/types/context/index.d.ts +1 -1
  32. package/dist/types/dataModel/BaseDataModel.d.ts +3 -3
  33. package/dist/types/dataModel/DataModel.d.ts +3 -3
  34. package/dist/types/dataModel/getDataModelMetadata.d.ts +3 -3
  35. package/dist/types/dataModel/index.d.ts +4 -4
  36. package/dist/types/dataModel/utils.d.ts +1 -1
  37. package/dist/types/deepChange/index.d.ts +1 -1
  38. package/dist/types/deepChange/onDeepChange.d.ts +1 -1
  39. package/dist/types/frozen/Frozen.d.ts +1 -1
  40. package/dist/types/frozen/index.d.ts +1 -1
  41. package/dist/types/globalConfig/index.d.ts +1 -1
  42. package/dist/types/index.d.ts +25 -24
  43. package/dist/types/model/BaseModel.d.ts +5 -5
  44. package/dist/types/model/Model.d.ts +3 -3
  45. package/dist/types/model/getModelMetadata.d.ts +3 -3
  46. package/dist/types/model/index.d.ts +6 -6
  47. package/dist/types/model/mixins.d.ts +4 -4
  48. package/dist/types/model/utils.d.ts +4 -4
  49. package/dist/types/modelShared/BaseModelShared.d.ts +5 -5
  50. package/dist/types/modelShared/index.d.ts +4 -4
  51. package/dist/types/modelShared/modelDecorator.d.ts +3 -3
  52. package/dist/types/modelShared/modelInfo.d.ts +3 -3
  53. package/dist/types/modelShared/newModel.d.ts +3 -3
  54. package/dist/types/modelShared/prop.d.ts +3 -3
  55. package/dist/types/modelShared/sharedInternalModel.d.ts +4 -4
  56. package/dist/types/parent/findParent.d.ts +1 -1
  57. package/dist/types/parent/index.d.ts +9 -9
  58. package/dist/types/parent/path.d.ts +1 -1
  59. package/dist/types/patch/Patch.d.ts +1 -1
  60. package/dist/types/patch/applyPatches.d.ts +1 -1
  61. package/dist/types/patch/emitPatch.d.ts +7 -1
  62. package/dist/types/patch/index.d.ts +5 -5
  63. package/dist/types/patch/jsonPatch.d.ts +2 -2
  64. package/dist/types/patch/patchRecorder.d.ts +2 -2
  65. package/dist/types/redux/index.d.ts +2 -2
  66. package/dist/types/redux/redux.d.ts +3 -3
  67. package/dist/types/ref/Ref.d.ts +3 -3
  68. package/dist/types/ref/core.d.ts +2 -2
  69. package/dist/types/ref/customRef.d.ts +2 -2
  70. package/dist/types/ref/index.d.ts +4 -4
  71. package/dist/types/ref/rootRef.d.ts +2 -2
  72. package/dist/types/rootStore/index.d.ts +1 -1
  73. package/dist/types/serialization/Call.d.ts +55 -0
  74. package/dist/types/serialization/CallError.d.ts +96 -0
  75. package/dist/types/serialization/JsonValue.d.ts +6 -0
  76. package/dist/types/serialization/Serializer.d.ts +84 -0
  77. package/dist/types/serialization/ValueSerializer.d.ts +88 -0
  78. package/dist/types/serialization/applyCall.d.ts +54 -0
  79. package/dist/types/serialization/builtinSerializers.d.ts +49 -0
  80. package/dist/types/serialization/codec.d.ts +1 -0
  81. package/dist/types/serialization/index.d.ts +8 -0
  82. package/dist/types/serialization/references.d.ts +74 -0
  83. package/dist/types/serialization/resolvedCall.d.ts +1 -0
  84. package/dist/types/snapshot/SnapshotOf.d.ts +5 -5
  85. package/dist/types/snapshot/SnapshotProcessingError.d.ts +2 -2
  86. package/dist/types/snapshot/applySnapshot.d.ts +1 -1
  87. package/dist/types/snapshot/cloneTreeValue.d.ts +1 -1
  88. package/dist/types/snapshot/fromSnapshot.d.ts +2 -2
  89. package/dist/types/snapshot/getSnapshot.d.ts +2 -2
  90. package/dist/types/snapshot/index.d.ts +8 -8
  91. package/dist/types/snapshot/onSnapshot.d.ts +1 -1
  92. package/dist/types/standardActions/index.d.ts +3 -3
  93. package/dist/types/standardActions/objectActions.d.ts +1 -1
  94. package/dist/types/transforms/asMap.d.ts +1 -1
  95. package/dist/types/transforms/asSet.d.ts +2 -2
  96. package/dist/types/transforms/bigint.d.ts +1 -1
  97. package/dist/types/transforms/date.d.ts +1 -1
  98. package/dist/types/transforms/index.d.ts +4 -4
  99. package/dist/types/treeUtils/draft.d.ts +1 -1
  100. package/dist/types/treeUtils/index.d.ts +3 -3
  101. package/dist/types/tweaker/index.d.ts +2 -2
  102. package/dist/types/tweaker/tweak.d.ts +1 -1
  103. package/dist/types/types/SnapshotTypeMismatchError.d.ts +2 -2
  104. package/dist/types/types/TypeCheckError.d.ts +2 -2
  105. package/dist/types/types/TypeChecker.d.ts +3 -3
  106. package/dist/types/types/arrayBased/typesArray.d.ts +2 -2
  107. package/dist/types/types/arrayBased/typesTuple.d.ts +2 -2
  108. package/dist/types/types/getTypeInfo.d.ts +2 -2
  109. package/dist/types/types/index.d.ts +7 -7
  110. package/dist/types/types/objectBased/typesArraySet.d.ts +3 -3
  111. package/dist/types/types/objectBased/typesDataModelData.d.ts +4 -4
  112. package/dist/types/types/objectBased/typesModel.d.ts +4 -4
  113. package/dist/types/types/objectBased/typesObject.d.ts +3 -3
  114. package/dist/types/types/objectBased/typesObjectMap.d.ts +3 -3
  115. package/dist/types/types/objectBased/typesRecord.d.ts +2 -2
  116. package/dist/types/types/objectBased/typesRef.d.ts +3 -3
  117. package/dist/types/types/primitiveBased/typesEnum.d.ts +1 -1
  118. package/dist/types/types/primitiveBased/typesPrimitive.d.ts +3 -3
  119. package/dist/types/types/primitiveBased/typesRefinedPrimitive.d.ts +2 -2
  120. package/dist/types/types/schemas.d.ts +5 -5
  121. package/dist/types/types/tProp.d.ts +4 -4
  122. package/dist/types/types/typeCheck.d.ts +2 -2
  123. package/dist/types/types/types.d.ts +39 -39
  124. package/dist/types/types/utility/typeToStoredData.d.ts +2 -2
  125. package/dist/types/types/utility/typesBigInt.d.ts +1 -1
  126. package/dist/types/types/utility/typesCodec.d.ts +6 -6
  127. package/dist/types/types/utility/typesCodecCore.d.ts +4 -4
  128. package/dist/types/types/utility/typesCodecSupport.d.ts +4 -4
  129. package/dist/types/types/utility/typesDate.d.ts +2 -2
  130. package/dist/types/types/utility/typesMap.d.ts +2 -2
  131. package/dist/types/types/utility/typesMaybe.d.ts +1 -1
  132. package/dist/types/types/utility/typesOr.d.ts +2 -2
  133. package/dist/types/types/utility/typesRefinement.d.ts +3 -3
  134. package/dist/types/types/utility/typesSet.d.ts +3 -3
  135. package/dist/types/types/utility/typesSkipCheck.d.ts +2 -2
  136. package/dist/types/types/utility/typesTag.d.ts +2 -2
  137. package/dist/types/types/utility/typesUnchecked.d.ts +2 -2
  138. package/dist/types/utils/ModelPool.d.ts +1 -1
  139. package/dist/types/wrappers/ArraySet.d.ts +1 -1
  140. package/dist/types/wrappers/ObjectMap.d.ts +1 -1
  141. package/dist/types/wrappers/asMap.d.ts +1 -1
  142. package/dist/types/wrappers/asSet.d.ts +1 -1
  143. package/dist/types/wrappers/index.d.ts +4 -4
  144. package/package.json +5 -18
  145. package/src/action/CallKind.ts +29 -0
  146. package/src/action/applyAction.ts +22 -49
  147. package/src/action/applySet.ts +21 -1
  148. package/src/action/index.ts +1 -0
  149. package/src/action/modelAction.ts +1 -1
  150. package/src/action/modelFlow.ts +1 -1
  151. package/src/action/resolveCallName.ts +207 -0
  152. package/src/actionMiddlewares/actionSerialization/actionSerialization.ts +14 -0
  153. package/src/actionMiddlewares/actionSerialization/applySerializedAction.ts +6 -0
  154. package/src/actionMiddlewares/actionSerialization/core.ts +7 -0
  155. package/src/actionMiddlewares/actionSerialization/index.ts +2 -0
  156. package/src/actionMiddlewares/actionSerialization/objectPathSerializer.ts +3 -2
  157. package/src/dataModel/BaseDataModel.ts +5 -5
  158. package/src/index.ts +1 -0
  159. package/src/model/BaseModel.ts +7 -6
  160. package/src/model/mixins.ts +1 -1
  161. package/src/model/newModel.ts +1 -1
  162. package/src/modelShared/modelDecorator.ts +4 -6
  163. package/src/modelShared/modelInfo.ts +2 -1
  164. package/src/modelShared/sharedInternalModel.ts +1 -1
  165. package/src/parent/path.ts +45 -12
  166. package/src/patch/emitPatch.ts +6 -0
  167. package/src/ref/Ref.ts +1 -1
  168. package/src/serialization/Call.ts +58 -0
  169. package/src/serialization/CallError.ts +153 -0
  170. package/src/serialization/JsonValue.ts +12 -0
  171. package/src/serialization/Serializer.ts +321 -0
  172. package/src/serialization/ValueSerializer.ts +98 -0
  173. package/src/serialization/applyCall.ts +190 -0
  174. package/src/serialization/builtinSerializers.ts +261 -0
  175. package/src/serialization/codec.ts +338 -0
  176. package/src/serialization/index.ts +15 -0
  177. package/src/serialization/references.ts +225 -0
  178. package/src/serialization/resolvedCall.ts +169 -0
  179. package/src/snapshot/SnapshotterAndReconcilerPriority.ts +2 -1
  180. package/src/snapshot/fromModelSnapshot.ts +1 -1
  181. package/src/snapshot/fromSnapshot.ts +1 -1
  182. package/src/standardActions/actions.ts +11 -3
  183. package/src/transforms/ImmutableDate.ts +19 -19
  184. package/src/tweaker/tweakArray.ts +1 -1
  185. package/src/tweaker/tweakFrozen.ts +1 -1
  186. package/src/tweaker/tweakModel.ts +1 -1
  187. package/src/tweaker/tweakPlainObject.ts +1 -1
  188. package/src/types/arrayBased/typesArray.ts +1 -1
  189. package/src/types/arrayBased/typesTuple.ts +1 -1
  190. package/src/types/objectBased/typesArraySet.ts +1 -1
  191. package/src/types/objectBased/typesModel.ts +2 -2
  192. package/src/types/objectBased/typesObject.ts +1 -1
  193. package/src/types/objectBased/typesObjectMap.ts +1 -1
  194. package/src/types/objectBased/typesRecord.ts +1 -1
  195. package/src/types/objectBased/typesRef.ts +2 -2
  196. package/src/types/primitiveBased/typesPrimitive.ts +1 -1
  197. package/src/types/schemas.ts +1 -1
  198. package/src/types/utility/typesCodecCore.ts +1 -1
  199. package/src/types/utility/typesCodecSupport.ts +2 -0
  200. package/src/types/utility/typesOr.ts +2 -2
  201. package/src/types/utility/typesRefinement.ts +1 -1
  202. package/src/utils/errorDiagnostics.ts +9 -4
  203. package/src/utils/index.ts +20 -13
  204. package/src/wrappers/ArraySet.ts +3 -5
  205. package/src/wrappers/ObjectMap.ts +3 -5
@@ -0,0 +1,49 @@
1
+ import type { AnyDataModel } from "../dataModel/BaseDataModel";
2
+ import type { JsonValue } from "./JsonValue";
3
+ import type { ValueSerializer } from "./ValueSerializer";
4
+ /**
5
+ * The built-in value serializers, appended in this order to every serializer's list (unless it is
6
+ * created with `builtins: false`). Pick some of them to build a list by hand, e.g.
7
+ * `createSerializer({ serializers: [builtinSerializers.date], builtins: false })`.
8
+ */
9
+ export declare const builtinSerializers: Readonly<{
10
+ /**
11
+ * Models and frozen data that aren't references, as their snapshots (unmarked, since snapshots
12
+ * mark themselves with `$modelType` / `$frozen`), decoded with `fromSnapshot` into new
13
+ * instances. Tree arrays and plain objects that aren't references are walked like any other.
14
+ */
15
+ snapshot: ValueSerializer<object, any>;
16
+ /**
17
+ * Data model instances, as their registered name and their data (encoded, so data of the tree
18
+ * goes as a reference), decoded as a new instance over the decoded data.
19
+ */
20
+ dataModel: ValueSerializer<AnyDataModel, {
21
+ type: string;
22
+ data: JsonValue;
23
+ }>;
24
+ /**
25
+ * Dates, as `toISOString()` (an invalid date as `null`); decodes an ISO string, a timestamp or
26
+ * `null`.
27
+ */
28
+ date: ValueSerializer<Date, string | number | null>;
29
+ /**
30
+ * Maps (plain or observable), as an array of `[key, value]` entries; decoded as plain maps.
31
+ */
32
+ map: ValueSerializer<Map<unknown, unknown>, [JsonValue, JsonValue][]>;
33
+ /**
34
+ * Sets (plain or observable), as an array of their values; decoded as plain sets.
35
+ */
36
+ set: ValueSerializer<Set<unknown>, JsonValue[]>;
37
+ /**
38
+ * The numbers JSON can't hold: `"NaN"`, `"Infinity"`, `"-Infinity"`.
39
+ */
40
+ number: ValueSerializer<number, string>;
41
+ /**
42
+ * Bigints, as a decimal string, with no loss of precision.
43
+ */
44
+ bigint: ValueSerializer<bigint, string>;
45
+ /**
46
+ * `undefined` (as an array item, an argument or an object property, which keeps its key).
47
+ */
48
+ undefined: ValueSerializer<undefined, undefined>;
49
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export * from "./applyCall";
2
+ export { builtinSerializers } from "./builtinSerializers";
3
+ export * from "./Call";
4
+ export { CallError, CallErrorCode, type CallErrorData, type CallErrorJson } from "./CallError";
5
+ export * from "./JsonValue";
6
+ export { type IdRefJson, idRefs, type PathRefJson, pathRefs, type ReferenceNodeInfo, type ReferenceSerializerOptions, } from "./references";
7
+ export * from "./Serializer";
8
+ export * from "./ValueSerializer";
@@ -0,0 +1,74 @@
1
+ import type { AnyModel } from "../model/BaseModel";
2
+ import type { PathElement } from "../parent/pathTypes";
3
+ import type { ValueSerializer } from "./ValueSerializer";
4
+ /**
5
+ * What a reference serializer's `when` option is told about a node.
6
+ */
7
+ export interface ReferenceNodeInfo {
8
+ /**
9
+ * Whether the node is a model.
10
+ */
11
+ readonly isModel: boolean;
12
+ /**
13
+ * Whether the node is a value-type model (`Model({...}, { valueType: true })`).
14
+ */
15
+ readonly isValueType: boolean;
16
+ }
17
+ /**
18
+ * Options of the built-in reference serializers.
19
+ */
20
+ export interface ReferenceSerializerOptions {
21
+ /**
22
+ * Decides, for every node the serializer could reference, whether it does. A node it declines
23
+ * falls through the list like any other value: a model ends up as its snapshot, a tree array
24
+ * or plain object is walked. The call's target ignores it: it is always a reference.
25
+ *
26
+ * Defaults to declining value-type models: `(node, { isValueType }) => !isValueType`.
27
+ */
28
+ when?(node: object, info: ReferenceNodeInfo): boolean;
29
+ }
30
+ /**
31
+ * A path reference, the payload of `{ "$mobxKeystone": "pathRef", "v": ... }`.
32
+ */
33
+ export type PathRefJson = {
34
+ /**
35
+ * Path from the root to the node, through data nodes (as in patches).
36
+ */
37
+ path: PathElement[];
38
+ /**
39
+ * Id of the model reached by each step of the path (`null` for non-models).
40
+ * Optional when decoding: without it, ids aren't checked.
41
+ */
42
+ ids?: (string | null)[];
43
+ };
44
+ /**
45
+ * An id reference, the payload of `{ "$mobxKeystone": "idRef", "v": ... }`.
46
+ */
47
+ export type IdRefJson = {
48
+ /**
49
+ * The model type (`$modelType`).
50
+ */
51
+ type: string;
52
+ /**
53
+ * The model id.
54
+ */
55
+ id: string;
56
+ };
57
+ /**
58
+ * References nodes of the tree by their path from the root, checking the ids of the models along
59
+ * it: `{ "$mobxKeystone": "pathRef", "v": { "path": ["cards", 2], "ids": [null, "c1"] } }`.
60
+ * It reaches any node, including tree arrays and plain objects.
61
+ *
62
+ * @param options Options.
63
+ * @returns The reference serializer.
64
+ */
65
+ export declare function pathRefs(options?: ReferenceSerializerOptions): ValueSerializer<object, PathRefJson>;
66
+ /**
67
+ * References models of the tree that have an id by their type and id:
68
+ * `{ "$mobxKeystone": "idRef", "v": { "type": "app/Card", "id": "c1" } }`. Ids are read and
69
+ * resolved as `getModelRefId` and `resolveId` do, and the type must match.
70
+ *
71
+ * @param options Options.
72
+ * @returns The reference serializer.
73
+ */
74
+ export declare function idRefs(options?: ReferenceSerializerOptions): ValueSerializer<AnyModel, IdRefJson>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,8 @@
1
- import { Frozen, frozenKey } from '../frozen/Frozen';
2
- import { AnyModel } from '../model/BaseModel';
3
- import { modelIdKey, modelTypeKey } from '../model/metadata';
4
- import { ModelFromSnapshot, ModelToSnapshot } from '../modelShared/BaseModelShared';
5
- import { ArraySet, ObjectMap } from '../wrappers';
1
+ import type { Frozen, frozenKey } from "../frozen/Frozen";
2
+ import type { AnyModel } from "../model/BaseModel";
3
+ import type { modelIdKey, modelTypeKey } from "../model/metadata";
4
+ import type { ModelFromSnapshot, ModelToSnapshot } from "../modelShared/BaseModelShared";
5
+ import type { ArraySet, ObjectMap } from "../wrappers";
6
6
  export type FrozenData<D> = {
7
7
  [frozenKey]: true;
8
8
  data: D;
@@ -1,5 +1,5 @@
1
- import { Path } from '../parent/pathTypes';
2
- import { MobxKeystoneError } from '../utils';
1
+ import type { Path } from "../parent/pathTypes";
2
+ import { MobxKeystoneError } from "../utils";
3
3
  export interface SnapshotProcessingErrorData {
4
4
  message: string;
5
5
  path?: Path;
@@ -1,4 +1,4 @@
1
- import { SnapshotInOf, SnapshotOutOf } from './SnapshotOf';
1
+ import type { SnapshotInOf, SnapshotOutOf } from "./SnapshotOf";
2
2
  /**
3
3
  * Applies a full snapshot over an object, reconciling it with the current contents of the object.
4
4
  * If it throws, the changes it made are rolled back (errors thrown by listeners do not roll them back).
@@ -1,4 +1,4 @@
1
- import { CloneOptions } from './clone';
1
+ import type { CloneOptions } from "./clone";
2
2
  /**
3
3
  * Clones non-primitive tree-compatible values.
4
4
  * Intended to be used with `withSetter(cloneTreeValue)`.
@@ -1,5 +1,5 @@
1
- import { AnyType, TypeToData, TypeToSnapshotIn, TypeToSnapshotOut } from '../types/schemas';
2
- import { SnapshotInOf, SnapshotOutOf } from './SnapshotOf';
1
+ import type { AnyType, TypeToData, TypeToSnapshotIn, TypeToSnapshotOut } from "../types/schemas";
2
+ import type { SnapshotInOf, SnapshotOutOf } from "./SnapshotOf";
3
3
  /**
4
4
  * From snapshot options.
5
5
  */
@@ -1,5 +1,5 @@
1
- import { AnyType, TypeToData, TypeToSnapshotOut } from '../types/schemas';
2
- import { SnapshotOutOf } from './SnapshotOf';
1
+ import type { AnyType, TypeToData, TypeToSnapshotOut } from "../types/schemas";
2
+ import type { SnapshotOutOf } from "./SnapshotOf";
3
3
  /**
4
4
  * Retrieves an immutable snapshot for a data structure.
5
5
  * Since returned snapshots are immutable they will respect shallow equality, this is,
@@ -1,8 +1,8 @@
1
- export * from './applySnapshot';
2
- export * from './clone';
3
- export * from './cloneTreeValue';
4
- export * from './fromSnapshot';
5
- export * from './getSnapshot';
6
- export * from './onSnapshot';
7
- export * from './SnapshotOf';
8
- export * from './SnapshotProcessingError';
1
+ export * from "./applySnapshot";
2
+ export * from "./clone";
3
+ export * from "./cloneTreeValue";
4
+ export * from "./fromSnapshot";
5
+ export * from "./getSnapshot";
6
+ export * from "./onSnapshot";
7
+ export * from "./SnapshotOf";
8
+ export * from "./SnapshotProcessingError";
@@ -1,4 +1,4 @@
1
- import { SnapshotOutOf } from './SnapshotOf';
1
+ import type { SnapshotOutOf } from "./SnapshotOf";
2
2
  /**
3
3
  * Listener function for onSnapshot.
4
4
  */
@@ -1,3 +1,3 @@
1
- export * from './arrayActions';
2
- export * from './objectActions';
3
- export * from './standaloneActions';
1
+ export * from "./arrayActions";
2
+ export * from "./objectActions";
3
+ export * from "./standaloneActions";
@@ -1,4 +1,4 @@
1
- import { AnyFunction } from '../utils/AnyFunction';
1
+ import type { AnyFunction } from "../utils/AnyFunction";
2
2
  export declare const objectActions: {
3
3
  set: <T extends object, K extends keyof T>(target: T, key: K, value: T[K]) => void;
4
4
  assign: <T extends object>(target: T, partialObject: Partial<T>) => void;
@@ -1,4 +1,4 @@
1
- import { ModelPropTransform } from '../modelShared/prop';
1
+ import type { ModelPropTransform } from "../modelShared/prop";
2
2
  /**
3
3
  * @deprecated Prefer the codec equivalent: `tProp(types.mapFromObject(valueType))`.
4
4
  * Use `tProp(types.skipCheck(types.mapFromObject(valueType)))` if you don't need runtime validation.
@@ -1,5 +1,5 @@
1
- import { ObservableSet } from 'mobx';
2
- import { ModelPropTransform } from '../modelShared/prop';
1
+ import type { ObservableSet } from "mobx";
2
+ import type { ModelPropTransform } from "../modelShared/prop";
3
3
  /**
4
4
  * @deprecated Prefer the codec equivalent: `tProp(types.setFromArray(valueType))`.
5
5
  * Use `tProp(types.skipCheck(types.setFromArray(valueType)))` if you don't need runtime validation.
@@ -1,4 +1,4 @@
1
- import { ModelPropTransform } from '../modelShared/prop';
1
+ import type { ModelPropTransform } from "../modelShared/prop";
2
2
  /**
3
3
  * @deprecated Prefer the codec equivalent: `tProp(types.bigint)`.
4
4
  * Use `tProp(types.skipCheck(types.bigint))` if you don't need runtime validation.
@@ -1,4 +1,4 @@
1
- import { ModelPropTransform } from '../modelShared/prop';
1
+ import type { ModelPropTransform } from "../modelShared/prop";
2
2
  /**
3
3
  * @deprecated Prefer the codec equivalent: `tProp(types.dateAsTimestamp)`.
4
4
  * Use `tProp(types.skipCheck(types.dateAsTimestamp))` if you don't need runtime validation.
@@ -1,4 +1,4 @@
1
- export * from './asMap';
2
- export * from './asSet';
3
- export * from './bigint';
4
- export * from './date';
1
+ export * from "./asMap";
2
+ export * from "./asSet";
3
+ export * from "./bigint";
4
+ export * from "./date";
@@ -1,4 +1,4 @@
1
- import { Path } from '../parent/pathTypes';
1
+ import type { Path } from "../parent/pathTypes";
2
2
  /**
3
3
  * A class with the implementationm of draft.
4
4
  * Use `draft` to create an instance of this class.
@@ -1,3 +1,3 @@
1
- export * from './deepEquals';
2
- export * from './draft';
3
- export * from './sandbox';
1
+ export * from "./deepEquals";
2
+ export * from "./draft";
3
+ export * from "./sandbox";
@@ -1,2 +1,2 @@
1
- export * from './core';
2
- export * from './tweak';
1
+ export * from "./core";
2
+ export * from "./tweak";
@@ -1,4 +1,4 @@
1
- import { AnyStandardType, TypeToData } from '../types/schemas';
1
+ import type { AnyStandardType, TypeToData } from "../types/schemas";
2
2
  /**
3
3
  * Turns an object (array, plain object) into a tree node,
4
4
  * which then can accept calls to `getParent`, `getSnapshot`, etc.
@@ -1,5 +1,5 @@
1
- import { Path } from '../parent/pathTypes';
2
- import { MobxKeystoneError } from '../utils';
1
+ import type { Path } from "../parent/pathTypes";
2
+ import { MobxKeystoneError } from "../utils";
3
3
  export interface SnapshotTypeMismatchErrorData {
4
4
  path?: Path;
5
5
  expectedTypeName: string;
@@ -1,5 +1,5 @@
1
- import { Path } from '../parent/pathTypes';
2
- import { MobxKeystoneError } from '../utils';
1
+ import type { Path } from "../parent/pathTypes";
2
+ import { MobxKeystoneError } from "../utils";
3
3
  export interface TypeCheckErrorData {
4
4
  /** Path relative to the value being type checked. */
5
5
  path: Path;
@@ -1,6 +1,6 @@
1
- import { Path } from '../parent/pathTypes';
2
- import { AnyStandardType } from './schemas';
3
- import { TypeCheckError } from './TypeCheckError';
1
+ import type { Path } from "../parent/pathTypes";
2
+ import type { AnyStandardType } from "./schemas";
3
+ import type { TypeCheckError } from "./TypeCheckError";
4
4
  type CheckFunction = (value: any, path: Path, typeCheckedValue: any) => TypeCheckError | null;
5
5
  /** @ignore */
6
6
  export type SnapshotProcessor = (snapshot: any) => unknown;
@@ -1,5 +1,5 @@
1
- import { AnyStandardType, AnyType, ArrayType } from '../schemas';
2
- import { TypeInfo } from '../TypeChecker';
1
+ import type { AnyStandardType, AnyType, ArrayType } from "../schemas";
2
+ import { TypeInfo } from "../TypeChecker";
3
3
  /**
4
4
  * A type that represents an array of values of a given type.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { AnyStandardType, AnyType, ArrayType } from '../schemas';
2
- import { TypeInfo } from '../TypeChecker';
1
+ import type { AnyStandardType, AnyType, ArrayType } from "../schemas";
2
+ import { TypeInfo } from "../TypeChecker";
3
3
  /**
4
4
  * A type that represents an tuple of values of a given type.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { AnyType } from './schemas';
2
- import { TypeInfo } from './TypeChecker';
1
+ import type { AnyType } from "./schemas";
2
+ import type { TypeInfo } from "./TypeChecker";
3
3
  /**
4
4
  * Gets the type info of a given type.
5
5
  *
@@ -1,7 +1,7 @@
1
- export * from './SnapshotTypeMismatchError';
2
- export * from './schemas';
3
- export * from './TypeCheckError';
4
- export * from './tProp';
5
- export { typeCheck } from './typeCheck';
6
- export * from './types';
7
- export type { CodecFromEncoded } from './utility/typesCodecCore';
1
+ export * from "./SnapshotTypeMismatchError";
2
+ export * from "./schemas";
3
+ export * from "./TypeCheckError";
4
+ export * from "./tProp";
5
+ export { typeCheck } from "./typeCheck";
6
+ export * from "./types";
7
+ export type { CodecFromEncoded } from "./utility/typesCodecCore";
@@ -1,6 +1,6 @@
1
- import { ArraySet } from '../../wrappers/ArraySet';
2
- import { AnyStandardType, AnyType, ModelType, TypeToData } from '../schemas';
3
- import { TypeInfo } from '../TypeChecker';
1
+ import { ArraySet } from "../../wrappers/ArraySet";
2
+ import type { AnyStandardType, AnyType, ModelType, TypeToData } from "../schemas";
3
+ import { TypeInfo } from "../TypeChecker";
4
4
  /**
5
5
  * A type that represents an array backed set ArraySet.
6
6
  *
@@ -1,7 +1,7 @@
1
- import { AnyDataModel } from '../../dataModel/BaseDataModel';
2
- import { ModelClass, ModelData, ModelUntransformedData } from '../../modelShared/BaseModelShared';
3
- import { AnyStandardType, IdentityType } from '../schemas';
4
- import { TypeInfo } from '../TypeChecker';
1
+ import type { AnyDataModel } from "../../dataModel/BaseDataModel";
2
+ import type { ModelClass, ModelData, ModelUntransformedData } from "../../modelShared/BaseModelShared";
3
+ import type { AnyStandardType, IdentityType } from "../schemas";
4
+ import { TypeInfo } from "../TypeChecker";
5
5
  type _Class<T> = abstract new (...args: any[]) => T;
6
6
  type _ClassOrObject<M, K> = K extends M ? object : _Class<K> | (() => _Class<K>);
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { AnyModel } from '../../model/BaseModel';
2
- import { ModelClass } from '../../modelShared/BaseModelShared';
3
- import { AnyStandardType, ModelType } from '../schemas';
4
- import { TypeInfo } from '../TypeChecker';
1
+ import type { AnyModel } from "../../model/BaseModel";
2
+ import type { ModelClass } from "../../modelShared/BaseModelShared";
3
+ import type { AnyStandardType, ModelType } from "../schemas";
4
+ import { TypeInfo } from "../TypeChecker";
5
5
  type _Class<T> = abstract new (...args: any[]) => T;
6
6
  type _ClassOrObject<M, K> = K extends M ? object : _Class<K> | (() => _Class<K>);
7
7
  /**
@@ -1,6 +1,6 @@
1
- import { Frozen } from '../../frozen/Frozen';
2
- import { AnyStandardType, AnyType, ModelType, ObjectTypeFunction, TypeToData } from '../schemas';
3
- import { TypeInfo } from '../TypeChecker';
1
+ import { Frozen } from "../../frozen/Frozen";
2
+ import type { AnyStandardType, AnyType, ModelType, ObjectTypeFunction, TypeToData } from "../schemas";
3
+ import { TypeInfo } from "../TypeChecker";
4
4
  /**
5
5
  * A type that represents a plain object.
6
6
  * Note that the parameter must be a function that returns an object. This is done so objects can support self / cross types.
@@ -1,6 +1,6 @@
1
- import { ObjectMap } from '../../wrappers/ObjectMap';
2
- import { AnyStandardType, AnyType, ModelType, TypeToData } from '../schemas';
3
- import { TypeInfo } from '../TypeChecker';
1
+ import { ObjectMap } from "../../wrappers/ObjectMap";
2
+ import type { AnyStandardType, AnyType, ModelType, TypeToData } from "../schemas";
3
+ import { TypeInfo } from "../TypeChecker";
4
4
  /**
5
5
  * A type that represents an object-like map ObjectMap.
6
6
  *
@@ -1,5 +1,5 @@
1
- import { AnyStandardType, AnyType, RecordType } from '../schemas';
2
- import { TypeInfo } from '../TypeChecker';
1
+ import type { AnyStandardType, AnyType, RecordType } from "../schemas";
2
+ import { TypeInfo } from "../TypeChecker";
3
3
  /**
4
4
  * A type that represents an object-like map, an object with string keys and values all of a same given type.
5
5
  *
@@ -1,6 +1,6 @@
1
- import { Ref, RefConstructor } from '../../ref/Ref';
2
- import { ModelType } from '../schemas';
3
- import { TypeInfo } from '../TypeChecker';
1
+ import type { Ref, RefConstructor } from "../../ref/Ref";
2
+ import type { ModelType } from "../schemas";
3
+ import { TypeInfo } from "../TypeChecker";
4
4
  /**
5
5
  * A type that represents a reference to an object or model.
6
6
  *
@@ -1,4 +1,4 @@
1
- import { IdentityType } from '../schemas';
1
+ import type { IdentityType } from "../schemas";
2
2
  /**
3
3
  * @ignore
4
4
  * Enum like object.
@@ -1,6 +1,6 @@
1
- import { PrimitiveValue } from '../../utils/types';
2
- import { AnyStandardType, IdentityType } from '../schemas';
3
- import { TypeInfo } from '../TypeChecker';
1
+ import type { PrimitiveValue } from "../../utils/types";
2
+ import type { AnyStandardType, IdentityType } from "../schemas";
3
+ import { TypeInfo } from "../TypeChecker";
4
4
  /**
5
5
  * A type that represents a certain value of a primitive (for example an *exact* number or string).
6
6
  *
@@ -6,7 +6,7 @@
6
6
  * types.integer
7
7
  * ```
8
8
  */
9
- export declare const typesInteger: import('..').IdentityType<number>;
9
+ export declare const typesInteger: import("..").IdentityType<number>;
10
10
  /**
11
11
  * A type that represents any string value other than "".
12
12
  * Syntactic sugar for `types.refinement(types.string, s => s !== "", "nonEmpty")`
@@ -15,4 +15,4 @@ export declare const typesInteger: import('..').IdentityType<number>;
15
15
  * types.nonEmptyString
16
16
  * ```
17
17
  */
18
- export declare const typesNonEmptyString: import('..').IdentityType<string>;
18
+ export declare const typesNonEmptyString: import("..").IdentityType<string>;
@@ -1,8 +1,8 @@
1
- import { AnyDataModel } from '../dataModel/BaseDataModel';
2
- import { AnyModel } from '../model/BaseModel';
3
- import { ModelClass } from '../modelShared/BaseModelShared';
4
- import { SnapshotInOf, SnapshotOutOf } from '../snapshot/SnapshotOf';
5
- import { IsOptionalValue, SimplifyObject } from '../utils/types';
1
+ import type { AnyDataModel } from "../dataModel/BaseDataModel";
2
+ import type { AnyModel } from "../model/BaseModel";
3
+ import type { ModelClass } from "../modelShared/BaseModelShared";
4
+ import type { SnapshotInOf, SnapshotOutOf } from "../snapshot/SnapshotOf";
5
+ import type { IsOptionalValue, SimplifyObject } from "../utils/types";
6
6
  export interface Type<Name, Data> {
7
7
  /** @ignore */
8
8
  $$type: Name;
@@ -1,7 +1,7 @@
1
- import { MaybeOptionalModelProp, OptionalModelProp } from '../modelShared/prop';
2
- import { typesBoolean, typesNumber, typesString } from './primitiveBased/typesPrimitive';
3
- import { AnyType, TypeToData, TypeToSnapshotIn } from './schemas';
4
- import { TypeToStoredData } from './utility/typeToStoredData';
1
+ import { type MaybeOptionalModelProp, type OptionalModelProp } from "../modelShared/prop";
2
+ import { typesBoolean, typesNumber, typesString } from "./primitiveBased/typesPrimitive";
3
+ import type { AnyType, TypeToData, TypeToSnapshotIn } from "./schemas";
4
+ import type { TypeToStoredData } from "./utility/typeToStoredData";
5
5
  type StoredRequiredPropMetadata<TType extends AnyType> = {
6
6
  $storedValueType: TypeToStoredData<TType>;
7
7
  $storedCreationValueType: TypeToStoredData<TType>;
@@ -1,5 +1,5 @@
1
- import { AnyType, TypeToData } from './schemas';
2
- import { TypeCheckError } from './TypeCheckError';
1
+ import type { AnyType, TypeToData } from "./schemas";
2
+ import type { TypeCheckError } from "./TypeCheckError";
3
3
  /**
4
4
  * Checks if a value conforms to a given type.
5
5
  *