mobx-keystone 0.65.0 → 0.67.0-alpha.1

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 (211) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +68 -68
  3. package/dist/action/modelFlow.d.ts +1 -1
  4. package/dist/action/pendingActions.d.ts +1 -8
  5. package/dist/action/wrapInAction.d.ts +1 -22
  6. package/dist/actionMiddlewares/utils.d.ts +1 -10
  7. package/dist/bench.d.ts +9 -0
  8. package/dist/computedTree/computedTree.d.ts +16 -0
  9. package/dist/computedTree/index.d.ts +1 -0
  10. package/dist/dataModel/utils.d.ts +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/mobx-keystone.es.js +358 -255
  13. package/dist/mobx-keystone.es.mjs +358 -255
  14. package/dist/mobx-keystone.umd.js +359 -254
  15. package/dist/model/utils.d.ts +1 -1
  16. package/dist/modelShared/BaseModelShared.d.ts +4 -2
  17. package/dist/modelShared/modelInfo.d.ts +1 -24
  18. package/dist/modelShared/prop.d.ts +26 -24
  19. package/dist/parent/core.d.ts +1 -29
  20. package/dist/snapshot/internal.d.ts +0 -11
  21. package/dist/tweaker/tweakArray.d.ts +1 -5
  22. package/dist/tweaker/tweakFrozen.d.ts +1 -6
  23. package/dist/tweaker/tweakModel.d.ts +1 -5
  24. package/dist/tweaker/tweakPlainObject.d.ts +1 -5
  25. package/dist/types/TypeChecker.d.ts +0 -30
  26. package/package.json +19 -10
  27. package/src/action/actionDecoratorUtils.ts +35 -35
  28. package/src/action/applyAction.ts +113 -113
  29. package/src/action/applyDelete.ts +33 -34
  30. package/src/action/applyMethodCall.ts +38 -39
  31. package/src/action/applySet.ts +42 -42
  32. package/src/action/builtInActions.ts +44 -44
  33. package/src/action/context.ts +104 -105
  34. package/src/action/hookActions.ts +37 -37
  35. package/src/action/index.ts +12 -12
  36. package/src/action/isModelAction.ts +14 -15
  37. package/src/action/middleware.ts +158 -159
  38. package/src/action/modelAction.ts +52 -52
  39. package/src/action/modelFlow.ts +383 -385
  40. package/src/action/pendingActions.ts +2 -2
  41. package/src/action/protection.ts +37 -40
  42. package/src/action/runUnprotected.ts +49 -49
  43. package/src/action/wrapInAction.ts +144 -144
  44. package/src/actionMiddlewares/actionSerialization/actionSerialization.ts +224 -224
  45. package/src/actionMiddlewares/actionSerialization/applySerializedAction.ts +172 -172
  46. package/src/actionMiddlewares/actionSerialization/arraySerializer.ts +18 -18
  47. package/src/actionMiddlewares/actionSerialization/core.ts +39 -39
  48. package/src/actionMiddlewares/actionSerialization/dateSerializer.ts +15 -15
  49. package/src/actionMiddlewares/actionSerialization/index.ts +3 -3
  50. package/src/actionMiddlewares/actionSerialization/mapSerializer.ts +40 -40
  51. package/src/actionMiddlewares/actionSerialization/objectPathSerializer.ts +49 -49
  52. package/src/actionMiddlewares/actionSerialization/objectSnapshotSerializer.ts +20 -20
  53. package/src/actionMiddlewares/actionSerialization/plainObjectSerializer.ts +30 -30
  54. package/src/actionMiddlewares/actionSerialization/primitiveSerializer.ts +49 -49
  55. package/src/actionMiddlewares/actionSerialization/setSerializer.ts +35 -35
  56. package/src/actionMiddlewares/actionTrackingMiddleware.ts +431 -431
  57. package/src/actionMiddlewares/index.ts +6 -6
  58. package/src/actionMiddlewares/onActionMiddleware.ts +90 -90
  59. package/src/actionMiddlewares/readonlyMiddleware.ts +100 -100
  60. package/src/actionMiddlewares/transactionMiddleware.ts +100 -100
  61. package/src/actionMiddlewares/undoMiddleware.ts +743 -743
  62. package/src/actionMiddlewares/utils.ts +35 -35
  63. package/src/bench.ts +70 -0
  64. package/src/computedTree/computedTree.ts +98 -0
  65. package/src/computedTree/index.ts +1 -0
  66. package/src/context/context.ts +274 -285
  67. package/src/context/index.ts +1 -1
  68. package/src/dataModel/BaseDataModel.ts +186 -186
  69. package/src/dataModel/DataModel.ts +132 -132
  70. package/src/dataModel/DataModelConstructorOptions.ts +9 -10
  71. package/src/dataModel/_BaseDataModel.ts +15 -17
  72. package/src/dataModel/actions.ts +31 -33
  73. package/src/dataModel/getDataModelMetadata.ts +34 -34
  74. package/src/dataModel/index.ts +4 -4
  75. package/src/dataModel/newDataModel.ts +58 -59
  76. package/src/dataModel/utils.ts +63 -66
  77. package/src/frozen/Frozen.ts +130 -131
  78. package/src/frozen/index.ts +1 -1
  79. package/src/globalConfig/globalConfig.ts +107 -108
  80. package/src/globalConfig/index.ts +1 -1
  81. package/src/index.ts +23 -22
  82. package/src/model/BaseModel.ts +263 -263
  83. package/src/model/Model.ts +217 -217
  84. package/src/model/ModelConstructorOptions.ts +14 -15
  85. package/src/model/_BaseModel.ts +15 -17
  86. package/src/model/getModelMetadata.ts +58 -59
  87. package/src/model/index.ts +5 -5
  88. package/src/model/metadata.ts +22 -22
  89. package/src/model/newModel.ts +153 -151
  90. package/src/model/utils.ts +71 -75
  91. package/src/modelShared/BaseModelShared.ts +114 -113
  92. package/src/modelShared/Model.ts +367 -367
  93. package/src/modelShared/checkModelDecoratorArgs.ts +31 -32
  94. package/src/modelShared/index.ts +3 -3
  95. package/src/modelShared/modelClassInitializer.ts +34 -37
  96. package/src/modelShared/modelDecorator.ts +190 -187
  97. package/src/modelShared/modelInfo.ts +30 -30
  98. package/src/modelShared/modelPropsInfo.ts +33 -35
  99. package/src/modelShared/modelSymbols.ts +3 -3
  100. package/src/modelShared/newModel.ts +18 -18
  101. package/src/modelShared/prop.ts +473 -483
  102. package/src/modelShared/utils.ts +24 -25
  103. package/src/parent/core.ts +64 -64
  104. package/src/parent/coreObjectChildren.ts +165 -171
  105. package/src/parent/detach.ts +45 -45
  106. package/src/parent/findChildren.ts +34 -34
  107. package/src/parent/findParent.ts +83 -83
  108. package/src/parent/getChildrenObjects.ts +25 -25
  109. package/src/parent/index.ts +9 -9
  110. package/src/parent/onChildAttachedTo.ts +138 -138
  111. package/src/parent/path.ts +371 -371
  112. package/src/parent/path2.ts +27 -27
  113. package/src/parent/pathTypes.ts +14 -14
  114. package/src/parent/setParent.ts +0 -1
  115. package/src/parent/walkTree.ts +212 -214
  116. package/src/patch/Patch.ts +21 -21
  117. package/src/patch/applyPatches.ts +172 -173
  118. package/src/patch/emitPatch.ts +139 -140
  119. package/src/patch/index.ts +5 -5
  120. package/src/patch/jsonPatch.ts +108 -108
  121. package/src/patch/patchRecorder.ts +151 -152
  122. package/src/redux/connectReduxDevTools.ts +177 -177
  123. package/src/redux/index.ts +2 -2
  124. package/src/redux/redux.ts +114 -114
  125. package/src/ref/Ref.ts +89 -89
  126. package/src/ref/core.ts +310 -311
  127. package/src/ref/customRef.ts +56 -56
  128. package/src/ref/index.ts +4 -4
  129. package/src/ref/rootRef.ts +88 -88
  130. package/src/rootStore/attachDetach.ts +90 -92
  131. package/src/rootStore/index.ts +1 -1
  132. package/src/rootStore/rootStore.ts +104 -106
  133. package/src/snapshot/SnapshotOf.ts +101 -101
  134. package/src/snapshot/SnapshotterAndReconcilerPriority.ts +9 -10
  135. package/src/snapshot/applySnapshot.ts +136 -137
  136. package/src/snapshot/clone.ts +33 -33
  137. package/src/snapshot/fromArraySnapshot.ts +27 -27
  138. package/src/snapshot/fromFrozenSnapshot.ts +10 -10
  139. package/src/snapshot/fromModelSnapshot.ts +46 -46
  140. package/src/snapshot/fromPlainObjectSnapshot.ts +31 -31
  141. package/src/snapshot/fromSnapshot.ts +161 -165
  142. package/src/snapshot/getSnapshot.ts +64 -59
  143. package/src/snapshot/index.ts +16 -16
  144. package/src/snapshot/internal.ts +178 -144
  145. package/src/snapshot/onSnapshot.ts +43 -43
  146. package/src/snapshot/reconcileArraySnapshot.ts +56 -56
  147. package/src/snapshot/reconcileFrozenSnapshot.ts +20 -20
  148. package/src/snapshot/reconcileModelSnapshot.ts +106 -106
  149. package/src/snapshot/reconcilePlainObjectSnapshot.ts +63 -63
  150. package/src/snapshot/reconcileSnapshot.ts +68 -71
  151. package/src/standardActions/actions.ts +60 -62
  152. package/src/standardActions/arrayActions.ts +109 -109
  153. package/src/standardActions/index.ts +3 -3
  154. package/src/standardActions/objectActions.ts +57 -46
  155. package/src/standardActions/standaloneActions.ts +28 -28
  156. package/src/transforms/ImmutableDate.ts +93 -95
  157. package/src/transforms/asMap.ts +42 -42
  158. package/src/transforms/asSet.ts +17 -17
  159. package/src/transforms/bigint.ts +16 -16
  160. package/src/transforms/date.ts +32 -32
  161. package/src/transforms/index.ts +4 -4
  162. package/src/treeUtils/deepEquals.ts +55 -55
  163. package/src/treeUtils/draft.ts +176 -176
  164. package/src/treeUtils/index.ts +3 -3
  165. package/src/treeUtils/sandbox.ts +266 -266
  166. package/src/tweaker/TweakerPriority.ts +9 -10
  167. package/src/tweaker/core.ts +0 -5
  168. package/src/tweaker/index.ts +8 -8
  169. package/src/tweaker/tweak.ts +182 -186
  170. package/src/tweaker/tweakArray.ts +401 -363
  171. package/src/tweaker/tweakFrozen.ts +37 -37
  172. package/src/tweaker/tweakModel.ts +32 -32
  173. package/src/tweaker/tweakPlainObject.ts +283 -268
  174. package/src/tweaker/typeChecking.ts +71 -72
  175. package/src/tweaker/withoutTypeChecking.ts +16 -16
  176. package/src/types/TypeCheckError.ts +36 -36
  177. package/src/types/TypeChecker.ts +223 -230
  178. package/src/types/arrayBased/array.ts +106 -106
  179. package/src/types/arrayBased/tuple.ts +110 -110
  180. package/src/types/getTypeInfo.ts +19 -19
  181. package/src/types/index.ts +5 -5
  182. package/src/types/objectBased/arraySet.ts +108 -108
  183. package/src/types/objectBased/dataModelData.ts +170 -170
  184. package/src/types/objectBased/model.ts +191 -191
  185. package/src/types/objectBased/object.ts +221 -221
  186. package/src/types/objectBased/objectMap.ts +121 -121
  187. package/src/types/objectBased/record.ts +124 -124
  188. package/src/types/objectBased/ref.ts +82 -82
  189. package/src/types/primitiveBased/enum.ts +7 -2
  190. package/src/types/primitiveBased/primitives.ts +168 -168
  191. package/src/types/primitiveBased/refinedPrimitives.ts +22 -22
  192. package/src/types/resolveTypeChecker.ts +70 -74
  193. package/src/types/schemas.ts +110 -110
  194. package/src/types/tProp.ts +149 -149
  195. package/src/types/typeCheck.ts +21 -21
  196. package/src/types/types.ts +94 -94
  197. package/src/types/utility/maybe.ts +37 -37
  198. package/src/types/utility/or.ts +186 -186
  199. package/src/types/utility/refinement.ts +105 -105
  200. package/src/types/utility/unchecked.ts +39 -39
  201. package/src/utils/ModelPool.ts +59 -59
  202. package/src/utils/chainFns.ts +16 -16
  203. package/src/utils/index.ts +408 -445
  204. package/src/utils/mapUtils.ts +17 -17
  205. package/src/utils/tag.ts +29 -29
  206. package/src/utils/types.ts +48 -48
  207. package/src/wrappers/ArraySet.ts +106 -106
  208. package/src/wrappers/ObjectMap.ts +119 -119
  209. package/src/wrappers/asMap.ts +317 -308
  210. package/src/wrappers/asSet.ts +153 -145
  211. package/src/wrappers/index.ts +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ - Big speedup in certain cases (when many mutations are done between getSnapshot calls) by delaying the inmmutable object creation to the point when getSnapshot is called.
4
+ - Fixed typing issue related to generics with optional props.
5
+
6
+ ## 0.66.1
7
+
8
+ - Fixed typing issue related to generics.
9
+
10
+ ## 0.66.0
11
+
12
+ - Restored compatibility with mobx 4/5 and added CI tests to ensure it never gets broken again.
13
+ - Added `@computedTree` decorator for reactively deriving an alternative view of an original tree that is attached as a property to the original tree to support tree traversal functions, contexts, references, etc. (see "Computed Trees" section in the docs).
14
+
3
15
  ## 0.65.0
4
16
 
5
17
  - Fixed a `Maximum call stack size exceeded` getting triggered when `onAttachedToRootStore` was defined and many nodes were added at once.
package/README.md CHANGED
@@ -1,68 +1,68 @@
1
- # mobx-keystone
2
-
3
- _A MobX powered state management solution based on data trees with first-class support for TypeScript, snapshots, patches and much more_
4
-
5
- [![npm](https://img.shields.io/npm/v/mobx-keystone.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/mobx-keystone)
6
- ![license](https://img.shields.io/npm/l/mobx-keystone.svg?style=flat-square)
7
- ![types](https://img.shields.io/npm/types/mobx-keystone.svg?style=flat-square&logo=typescript)
8
-
9
- [![CI](https://img.shields.io/github/workflow/status/xaviergonz/mobx-keystone/CI?label=CI&logo=github&style=flat-square)](https://github.com/xaviergonz/mobx-keystone/actions/workflows/main.yml)
10
- [![codecov](https://codecov.io/gh/xaviergonz/mobx-keystone/branch/master/graph/badge.svg?token=6MLRFUBK8V)](https://codecov.io/gh/xaviergonz/mobx-keystone)
11
- [![Netlify Status](https://api.netlify.com/api/v1/badges/c5f60bcb-c1ff-4d04-ad14-1fc34ddbb429/deploy-status)](https://app.netlify.com/sites/mobx-keystone/deploys)
12
-
13
- > ### Full documentation can be found on the site:
14
- >
15
- > ## [mobx-keystone.js.org](https://mobx-keystone.js.org)
16
-
17
- ## Introduction
18
-
19
- `mobx-keystone` is a state container that combines the _simplicity and ease of mutable data_ with the _traceability of immutable data_ and the _reactiveness and performance of observable data_, all with a fully compatible TypeScript syntax.
20
-
21
- Simply put, it tries to combine the best features of both immutability (transactionality, traceability and composition) and mutability (discoverability, co-location and encapsulation) based approaches to state management; everything to provide the best developer experience possible.
22
- Unlike MobX itself, `mobx-keystone` is very opinionated about how data should be structured and updated.
23
- This makes it possible to solve many common problems out of the box.
24
-
25
- Central in `mobx-keystone` is the concept of a _living tree_. The tree consists of mutable, but strictly protected objects (models, arrays and plain objects).
26
- From this living tree, immutable, structurally shared snapshots are automatically generated.
27
-
28
- Another core design goal of `mobx-keystone` is to offer a great TypeScript syntax out of the box, be it for models (and other kinds of data such as plain objects and arrays) or for its generated snapshots.
29
-
30
- To see some code and get a glimpse of how it works check the [Todo List Example](https://mobx-keystone.js.org/examples/todo-list).
31
-
32
- Because state trees are living, mutable models, actions are straightforward to write; just modify local instance properties where appropriate. It is not necessary to produce a new state tree yourself, `mobx-keystone`'s snapshot functionality will derive one for you automatically.
33
-
34
- Although mutable sounds scary to some, fear not, actions have many interesting properties.
35
- By default trees can only be modified by using an action that belongs to the same subtree.
36
- Furthermore, actions are replayable and can be used to distribute changes.
37
-
38
- Moreover, because changes can be detected on a fine-grained level, JSON patches are supported out of the box.
39
- Simply subscribing to the patch stream of a tree is another way to sync diffs with, for example, back-end servers or other clients.
40
-
41
- Since `mobx-keystone` uses MobX behind the scenes, it integrates seamlessly with [`mobx`](https://mobx.js.org) and [`mobx-react`](https://github.com/mobxjs/mobx-react).
42
- Even cooler, because it supports snapshots, action middlewares and replayable actions out of the box, it is possible to replace a Redux store and reducer with a MobX data model.
43
- This makes it possible to connect the Redux devtools to `mobx-keystone`.
44
-
45
- Like React, `mobx-keystone` consists of composable components, called _models_, which capture small pieces of state. They are instantiated from props and after that manage and protect their own internal state (using actions). Moreover, when applying snapshots, tree nodes are reconciled as much as possible.
46
-
47
- ## Requirements
48
-
49
- This library requires a more or less modern JavaScript environment to work, namely one with support for:
50
-
51
- - MobX 6, 5, or 4 (with its gotchas)
52
- - Proxies (when using MobX 5, or MobX 6 with the proxies setting enabled)
53
- - Symbols
54
- - WeakMap/WeakSet
55
-
56
- In other words, it should work on mostly anything except _it won't work in Internet Explorer_.
57
-
58
- If you are using TypeScript, then version >= 4.2.0 is recommended, though it _might_ work with older versions.
59
-
60
- ## Installation
61
-
62
- > `npm install mobx-keystone`
63
-
64
- > `yarn add mobx-keystone`
65
-
66
- ## Full documentation
67
-
68
- Full documentation can be found on [mobx-keystone.js.org](https://mobx-keystone.js.org)
1
+ # mobx-keystone
2
+
3
+ _A MobX powered state management solution based on data trees with first-class support for TypeScript, snapshots, patches and much more_
4
+
5
+ [![npm](https://img.shields.io/npm/v/mobx-keystone.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/mobx-keystone)
6
+ ![license](https://img.shields.io/npm/l/mobx-keystone.svg?style=flat-square)
7
+ ![types](https://img.shields.io/npm/types/mobx-keystone.svg?style=flat-square&logo=typescript)
8
+
9
+ [![CI](https://img.shields.io/github/workflow/status/xaviergonz/mobx-keystone/CI?label=CI&logo=github&style=flat-square)](https://github.com/xaviergonz/mobx-keystone/actions/workflows/main.yml)
10
+ [![codecov](https://codecov.io/gh/xaviergonz/mobx-keystone/branch/master/graph/badge.svg?token=6MLRFUBK8V)](https://codecov.io/gh/xaviergonz/mobx-keystone)
11
+ [![Netlify Status](https://api.netlify.com/api/v1/badges/c5f60bcb-c1ff-4d04-ad14-1fc34ddbb429/deploy-status)](https://app.netlify.com/sites/mobx-keystone/deploys)
12
+
13
+ > ### Full documentation can be found on the site:
14
+ >
15
+ > ## [mobx-keystone.js.org](https://mobx-keystone.js.org)
16
+
17
+ ## Introduction
18
+
19
+ `mobx-keystone` is a state container that combines the _simplicity and ease of mutable data_ with the _traceability of immutable data_ and the _reactiveness and performance of observable data_, all with a fully compatible TypeScript syntax.
20
+
21
+ Simply put, it tries to combine the best features of both immutability (transactionality, traceability and composition) and mutability (discoverability, co-location and encapsulation) based approaches to state management; everything to provide the best developer experience possible.
22
+ Unlike MobX itself, `mobx-keystone` is very opinionated about how data should be structured and updated.
23
+ This makes it possible to solve many common problems out of the box.
24
+
25
+ Central in `mobx-keystone` is the concept of a _living tree_. The tree consists of mutable, but strictly protected objects (models, arrays and plain objects).
26
+ From this living tree, immutable, structurally shared snapshots are automatically generated.
27
+
28
+ Another core design goal of `mobx-keystone` is to offer a great TypeScript syntax out of the box, be it for models (and other kinds of data such as plain objects and arrays) or for its generated snapshots.
29
+
30
+ To see some code and get a glimpse of how it works check the [Todo List Example](https://mobx-keystone.js.org/examples/todo-list).
31
+
32
+ Because state trees are living, mutable models, actions are straightforward to write; just modify local instance properties where appropriate. It is not necessary to produce a new state tree yourself, `mobx-keystone`'s snapshot functionality will derive one for you automatically.
33
+
34
+ Although mutable sounds scary to some, fear not, actions have many interesting properties.
35
+ By default trees can only be modified by using an action that belongs to the same subtree.
36
+ Furthermore, actions are replayable and can be used to distribute changes.
37
+
38
+ Moreover, because changes can be detected on a fine-grained level, JSON patches are supported out of the box.
39
+ Simply subscribing to the patch stream of a tree is another way to sync diffs with, for example, back-end servers or other clients.
40
+
41
+ Since `mobx-keystone` uses MobX behind the scenes, it integrates seamlessly with [`mobx`](https://mobx.js.org) and [`mobx-react`](https://github.com/mobxjs/mobx-react).
42
+ Even cooler, because it supports snapshots, action middlewares and replayable actions out of the box, it is possible to replace a Redux store and reducer with a MobX data model.
43
+ This makes it possible to connect the Redux devtools to `mobx-keystone`.
44
+
45
+ Like React, `mobx-keystone` consists of composable components, called _models_, which capture small pieces of state. They are instantiated from props and after that manage and protect their own internal state (using actions). Moreover, when applying snapshots, tree nodes are reconciled as much as possible.
46
+
47
+ ## Requirements
48
+
49
+ This library requires a more or less modern JavaScript environment to work, namely one with support for:
50
+
51
+ - MobX 6, 5, or 4 (with its gotchas)
52
+ - Proxies (when using MobX 5, or MobX 6 with the proxies setting enabled)
53
+ - Symbols
54
+ - WeakMap/WeakSet
55
+
56
+ In other words, it should work on mostly anything except _it won't work in Internet Explorer_.
57
+
58
+ If you are using TypeScript, then version >= 4.2.0 is recommended, though it _might_ work with older versions.
59
+
60
+ ## Installation
61
+
62
+ > `npm install mobx-keystone`
63
+
64
+ > `yarn add mobx-keystone`
65
+
66
+ ## Full documentation
67
+
68
+ Full documentation can be found on [mobx-keystone.js.org](https://mobx-keystone.js.org)
@@ -4,7 +4,7 @@
4
4
  * @param fn Function to check.
5
5
  * @returns
6
6
  */
7
- export declare function isModelFlow(fn: any): any;
7
+ export declare function isModelFlow(fn: unknown): boolean;
8
8
  /**
9
9
  * Decorator that turns a function generator into a model flow.
10
10
  *
@@ -1,8 +1 @@
1
- /**
2
- * @ignore
3
- */
4
- export declare function enqueuePendingAction(action: () => void): void;
5
- /**
6
- * @ignore
7
- */
8
- export declare function tryRunPendingActions(): void;
1
+ export {};
@@ -1,22 +1 @@
1
- import type { O } from "ts-toolbelt";
2
- import type { AnyDataModel } from "../dataModel/BaseDataModel";
3
- import type { AnyModel } from "../model/BaseModel";
4
- import { ActionContext, ActionContextActionType } from "./context";
5
- /**
6
- * @ignore
7
- */
8
- export declare type WrapInActionOverrideContextFn = (ctx: O.Writable<ActionContext>, self: any) => void;
9
- /**
10
- * @ignore
11
- */
12
- export declare function wrapInAction<T extends Function>({ nameOrNameFn, fn, actionType, overrideContext, isFlowFinisher, }: {
13
- nameOrNameFn: string | (() => string);
14
- fn: T;
15
- actionType: ActionContextActionType;
16
- overrideContext?: WrapInActionOverrideContextFn;
17
- isFlowFinisher?: boolean;
18
- }): T;
19
- /**
20
- * @ignore
21
- */
22
- export declare function wrapModelMethodInActionIfNeeded<M extends AnyModel | AnyDataModel>(model: M, propertyKey: keyof M, name: string): void;
1
+ export {};
@@ -1,10 +1 @@
1
- import type { RootPath } from "../parent/path";
2
- import type { Path } from "../parent/pathTypes";
3
- /**
4
- * @ignore
5
- */
6
- export declare function rootPathToTargetPathIds(rootPath: RootPath<any>): (string | null)[];
7
- /**
8
- * @ignore
9
- */
10
- export declare function pathToTargetPathIds(root: any, path: Path): (string | null)[];
1
+ export {};
@@ -0,0 +1,9 @@
1
+ declare const Todo1_base: import(".")._Model<unknown, {
2
+ id: import(".").ModelIdProp;
3
+ }, never, never>;
4
+ export declare class Todo1 extends Todo1_base {
5
+ }
6
+ declare const Todo2_base: import(".")._Model<unknown, {}, never, never>;
7
+ export declare class Todo2 extends Todo2_base {
8
+ }
9
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns if a given node is a computed tree node.
3
+ *
4
+ * @param node Node to check.
5
+ * @returns `true` if it is a computed tree node, `false` otherwise.
6
+ */
7
+ export declare function isComputedTreeNode(node: object): boolean;
8
+ /**
9
+ * Decorator for turning a computed property into a computed tree which supports tree traversal
10
+ * functions, contexts, references, etc.
11
+ *
12
+ * @param target Prototype of the class.
13
+ * @param propertyKey Name of the member.
14
+ * @param descriptor Property descriptor for the member.
15
+ */
16
+ export declare function computedTree(target: any, propertyKey: string, descriptor: PropertyDescriptor): void;
@@ -0,0 +1 @@
1
+ export * from "./computedTree";
@@ -5,4 +5,4 @@ import type { AnyDataModel } from "./BaseDataModel";
5
5
  * @param model
6
6
  * @returns
7
7
  */
8
- export declare function isDataModel(model: any): model is AnyDataModel;
8
+ export declare function isDataModel(model: unknown): model is AnyDataModel;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./action";
2
2
  export * from "./actionMiddlewares";
3
+ export * from "./computedTree";
3
4
  export * from "./context";
4
5
  export * from "./dataModel";
5
6
  export * from "./frozen";