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.
- package/CHANGELOG.md +12 -0
- package/README.md +68 -68
- package/dist/action/modelFlow.d.ts +1 -1
- package/dist/action/pendingActions.d.ts +1 -8
- package/dist/action/wrapInAction.d.ts +1 -22
- package/dist/actionMiddlewares/utils.d.ts +1 -10
- package/dist/bench.d.ts +9 -0
- package/dist/computedTree/computedTree.d.ts +16 -0
- package/dist/computedTree/index.d.ts +1 -0
- package/dist/dataModel/utils.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/mobx-keystone.es.js +358 -255
- package/dist/mobx-keystone.es.mjs +358 -255
- package/dist/mobx-keystone.umd.js +359 -254
- package/dist/model/utils.d.ts +1 -1
- package/dist/modelShared/BaseModelShared.d.ts +4 -2
- package/dist/modelShared/modelInfo.d.ts +1 -24
- package/dist/modelShared/prop.d.ts +26 -24
- package/dist/parent/core.d.ts +1 -29
- package/dist/snapshot/internal.d.ts +0 -11
- package/dist/tweaker/tweakArray.d.ts +1 -5
- package/dist/tweaker/tweakFrozen.d.ts +1 -6
- package/dist/tweaker/tweakModel.d.ts +1 -5
- package/dist/tweaker/tweakPlainObject.d.ts +1 -5
- package/dist/types/TypeChecker.d.ts +0 -30
- package/package.json +19 -10
- package/src/action/actionDecoratorUtils.ts +35 -35
- package/src/action/applyAction.ts +113 -113
- package/src/action/applyDelete.ts +33 -34
- package/src/action/applyMethodCall.ts +38 -39
- package/src/action/applySet.ts +42 -42
- package/src/action/builtInActions.ts +44 -44
- package/src/action/context.ts +104 -105
- package/src/action/hookActions.ts +37 -37
- package/src/action/index.ts +12 -12
- package/src/action/isModelAction.ts +14 -15
- package/src/action/middleware.ts +158 -159
- package/src/action/modelAction.ts +52 -52
- package/src/action/modelFlow.ts +383 -385
- package/src/action/pendingActions.ts +2 -2
- package/src/action/protection.ts +37 -40
- package/src/action/runUnprotected.ts +49 -49
- package/src/action/wrapInAction.ts +144 -144
- package/src/actionMiddlewares/actionSerialization/actionSerialization.ts +224 -224
- package/src/actionMiddlewares/actionSerialization/applySerializedAction.ts +172 -172
- package/src/actionMiddlewares/actionSerialization/arraySerializer.ts +18 -18
- package/src/actionMiddlewares/actionSerialization/core.ts +39 -39
- package/src/actionMiddlewares/actionSerialization/dateSerializer.ts +15 -15
- package/src/actionMiddlewares/actionSerialization/index.ts +3 -3
- package/src/actionMiddlewares/actionSerialization/mapSerializer.ts +40 -40
- package/src/actionMiddlewares/actionSerialization/objectPathSerializer.ts +49 -49
- package/src/actionMiddlewares/actionSerialization/objectSnapshotSerializer.ts +20 -20
- package/src/actionMiddlewares/actionSerialization/plainObjectSerializer.ts +30 -30
- package/src/actionMiddlewares/actionSerialization/primitiveSerializer.ts +49 -49
- package/src/actionMiddlewares/actionSerialization/setSerializer.ts +35 -35
- package/src/actionMiddlewares/actionTrackingMiddleware.ts +431 -431
- package/src/actionMiddlewares/index.ts +6 -6
- package/src/actionMiddlewares/onActionMiddleware.ts +90 -90
- package/src/actionMiddlewares/readonlyMiddleware.ts +100 -100
- package/src/actionMiddlewares/transactionMiddleware.ts +100 -100
- package/src/actionMiddlewares/undoMiddleware.ts +743 -743
- package/src/actionMiddlewares/utils.ts +35 -35
- package/src/bench.ts +70 -0
- package/src/computedTree/computedTree.ts +98 -0
- package/src/computedTree/index.ts +1 -0
- package/src/context/context.ts +274 -285
- package/src/context/index.ts +1 -1
- package/src/dataModel/BaseDataModel.ts +186 -186
- package/src/dataModel/DataModel.ts +132 -132
- package/src/dataModel/DataModelConstructorOptions.ts +9 -10
- package/src/dataModel/_BaseDataModel.ts +15 -17
- package/src/dataModel/actions.ts +31 -33
- package/src/dataModel/getDataModelMetadata.ts +34 -34
- package/src/dataModel/index.ts +4 -4
- package/src/dataModel/newDataModel.ts +58 -59
- package/src/dataModel/utils.ts +63 -66
- package/src/frozen/Frozen.ts +130 -131
- package/src/frozen/index.ts +1 -1
- package/src/globalConfig/globalConfig.ts +107 -108
- package/src/globalConfig/index.ts +1 -1
- package/src/index.ts +23 -22
- package/src/model/BaseModel.ts +263 -263
- package/src/model/Model.ts +217 -217
- package/src/model/ModelConstructorOptions.ts +14 -15
- package/src/model/_BaseModel.ts +15 -17
- package/src/model/getModelMetadata.ts +58 -59
- package/src/model/index.ts +5 -5
- package/src/model/metadata.ts +22 -22
- package/src/model/newModel.ts +153 -151
- package/src/model/utils.ts +71 -75
- package/src/modelShared/BaseModelShared.ts +114 -113
- package/src/modelShared/Model.ts +367 -367
- package/src/modelShared/checkModelDecoratorArgs.ts +31 -32
- package/src/modelShared/index.ts +3 -3
- package/src/modelShared/modelClassInitializer.ts +34 -37
- package/src/modelShared/modelDecorator.ts +190 -187
- package/src/modelShared/modelInfo.ts +30 -30
- package/src/modelShared/modelPropsInfo.ts +33 -35
- package/src/modelShared/modelSymbols.ts +3 -3
- package/src/modelShared/newModel.ts +18 -18
- package/src/modelShared/prop.ts +473 -483
- package/src/modelShared/utils.ts +24 -25
- package/src/parent/core.ts +64 -64
- package/src/parent/coreObjectChildren.ts +165 -171
- package/src/parent/detach.ts +45 -45
- package/src/parent/findChildren.ts +34 -34
- package/src/parent/findParent.ts +83 -83
- package/src/parent/getChildrenObjects.ts +25 -25
- package/src/parent/index.ts +9 -9
- package/src/parent/onChildAttachedTo.ts +138 -138
- package/src/parent/path.ts +371 -371
- package/src/parent/path2.ts +27 -27
- package/src/parent/pathTypes.ts +14 -14
- package/src/parent/setParent.ts +0 -1
- package/src/parent/walkTree.ts +212 -214
- package/src/patch/Patch.ts +21 -21
- package/src/patch/applyPatches.ts +172 -173
- package/src/patch/emitPatch.ts +139 -140
- package/src/patch/index.ts +5 -5
- package/src/patch/jsonPatch.ts +108 -108
- package/src/patch/patchRecorder.ts +151 -152
- package/src/redux/connectReduxDevTools.ts +177 -177
- package/src/redux/index.ts +2 -2
- package/src/redux/redux.ts +114 -114
- package/src/ref/Ref.ts +89 -89
- package/src/ref/core.ts +310 -311
- package/src/ref/customRef.ts +56 -56
- package/src/ref/index.ts +4 -4
- package/src/ref/rootRef.ts +88 -88
- package/src/rootStore/attachDetach.ts +90 -92
- package/src/rootStore/index.ts +1 -1
- package/src/rootStore/rootStore.ts +104 -106
- package/src/snapshot/SnapshotOf.ts +101 -101
- package/src/snapshot/SnapshotterAndReconcilerPriority.ts +9 -10
- package/src/snapshot/applySnapshot.ts +136 -137
- package/src/snapshot/clone.ts +33 -33
- package/src/snapshot/fromArraySnapshot.ts +27 -27
- package/src/snapshot/fromFrozenSnapshot.ts +10 -10
- package/src/snapshot/fromModelSnapshot.ts +46 -46
- package/src/snapshot/fromPlainObjectSnapshot.ts +31 -31
- package/src/snapshot/fromSnapshot.ts +161 -165
- package/src/snapshot/getSnapshot.ts +64 -59
- package/src/snapshot/index.ts +16 -16
- package/src/snapshot/internal.ts +178 -144
- package/src/snapshot/onSnapshot.ts +43 -43
- package/src/snapshot/reconcileArraySnapshot.ts +56 -56
- package/src/snapshot/reconcileFrozenSnapshot.ts +20 -20
- package/src/snapshot/reconcileModelSnapshot.ts +106 -106
- package/src/snapshot/reconcilePlainObjectSnapshot.ts +63 -63
- package/src/snapshot/reconcileSnapshot.ts +68 -71
- package/src/standardActions/actions.ts +60 -62
- package/src/standardActions/arrayActions.ts +109 -109
- package/src/standardActions/index.ts +3 -3
- package/src/standardActions/objectActions.ts +57 -46
- package/src/standardActions/standaloneActions.ts +28 -28
- package/src/transforms/ImmutableDate.ts +93 -95
- package/src/transforms/asMap.ts +42 -42
- package/src/transforms/asSet.ts +17 -17
- package/src/transforms/bigint.ts +16 -16
- package/src/transforms/date.ts +32 -32
- package/src/transforms/index.ts +4 -4
- package/src/treeUtils/deepEquals.ts +55 -55
- package/src/treeUtils/draft.ts +176 -176
- package/src/treeUtils/index.ts +3 -3
- package/src/treeUtils/sandbox.ts +266 -266
- package/src/tweaker/TweakerPriority.ts +9 -10
- package/src/tweaker/core.ts +0 -5
- package/src/tweaker/index.ts +8 -8
- package/src/tweaker/tweak.ts +182 -186
- package/src/tweaker/tweakArray.ts +401 -363
- package/src/tweaker/tweakFrozen.ts +37 -37
- package/src/tweaker/tweakModel.ts +32 -32
- package/src/tweaker/tweakPlainObject.ts +283 -268
- package/src/tweaker/typeChecking.ts +71 -72
- package/src/tweaker/withoutTypeChecking.ts +16 -16
- package/src/types/TypeCheckError.ts +36 -36
- package/src/types/TypeChecker.ts +223 -230
- package/src/types/arrayBased/array.ts +106 -106
- package/src/types/arrayBased/tuple.ts +110 -110
- package/src/types/getTypeInfo.ts +19 -19
- package/src/types/index.ts +5 -5
- package/src/types/objectBased/arraySet.ts +108 -108
- package/src/types/objectBased/dataModelData.ts +170 -170
- package/src/types/objectBased/model.ts +191 -191
- package/src/types/objectBased/object.ts +221 -221
- package/src/types/objectBased/objectMap.ts +121 -121
- package/src/types/objectBased/record.ts +124 -124
- package/src/types/objectBased/ref.ts +82 -82
- package/src/types/primitiveBased/enum.ts +7 -2
- package/src/types/primitiveBased/primitives.ts +168 -168
- package/src/types/primitiveBased/refinedPrimitives.ts +22 -22
- package/src/types/resolveTypeChecker.ts +70 -74
- package/src/types/schemas.ts +110 -110
- package/src/types/tProp.ts +149 -149
- package/src/types/typeCheck.ts +21 -21
- package/src/types/types.ts +94 -94
- package/src/types/utility/maybe.ts +37 -37
- package/src/types/utility/or.ts +186 -186
- package/src/types/utility/refinement.ts +105 -105
- package/src/types/utility/unchecked.ts +39 -39
- package/src/utils/ModelPool.ts +59 -59
- package/src/utils/chainFns.ts +16 -16
- package/src/utils/index.ts +408 -445
- package/src/utils/mapUtils.ts +17 -17
- package/src/utils/tag.ts +29 -29
- package/src/utils/types.ts +48 -48
- package/src/wrappers/ArraySet.ts +106 -106
- package/src/wrappers/ObjectMap.ts +119 -119
- package/src/wrappers/asMap.ts +317 -308
- package/src/wrappers/asSet.ts +153 -145
- 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
|
-
[](https://www.npmjs.com/package/mobx-keystone)
|
|
6
|
-

|
|
7
|
-

|
|
8
|
-
|
|
9
|
-
[](https://github.com/xaviergonz/mobx-keystone/actions/workflows/main.yml)
|
|
10
|
-
[](https://codecov.io/gh/xaviergonz/mobx-keystone)
|
|
11
|
-
[](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
|
+
[](https://www.npmjs.com/package/mobx-keystone)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[](https://github.com/xaviergonz/mobx-keystone/actions/workflows/main.yml)
|
|
10
|
+
[](https://codecov.io/gh/xaviergonz/mobx-keystone)
|
|
11
|
+
[](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,22 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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 {};
|
package/dist/bench.d.ts
ADDED
|
@@ -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";
|