mobx-state-tree 7.0.2 → 7.2.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/mst-operations.d.ts +1 -1
- package/dist/core/type/type.d.ts +3 -1
- package/dist/mobx-state-tree.js +398 -36
- package/dist/mobx-state-tree.min.js +1 -1
- package/dist/mobx-state-tree.module.js +398 -36
- package/dist/mobx-state-tree.umd.js +398 -36
- package/dist/mobx-state-tree.umd.min.js +1 -1
- package/dist/types/complex-types/model.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/primitives.d.ts +15 -1
- package/dist/types/utility-types/identifier.d.ts +18 -4
- package/dist/types/utility-types/snapshotProcessor.d.ts +2 -0
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -18,12 +18,14 @@ export declare const types: {
|
|
|
18
18
|
integer: import("../internal").ISimpleType<number>;
|
|
19
19
|
float: import("../internal").ISimpleType<number>;
|
|
20
20
|
finite: import("../internal").ISimpleType<number>;
|
|
21
|
+
bigint: import("../internal").IType<string | number | bigint, string, bigint>;
|
|
21
22
|
Date: import("../internal").IType<number | Date, number, Date>;
|
|
22
23
|
map: typeof map;
|
|
23
24
|
array: typeof array;
|
|
24
25
|
frozen: typeof frozen;
|
|
25
26
|
identifier: import("../internal").ISimpleType<string>;
|
|
26
27
|
identifierNumber: import("../internal").ISimpleType<number>;
|
|
28
|
+
identifierBigint: import("../internal").IType<string | number | bigint, string, bigint>;
|
|
27
29
|
late: typeof late;
|
|
28
30
|
lazy: typeof lazy;
|
|
29
31
|
undefined: import("../internal").ISimpleType<undefined>;
|
|
@@ -61,6 +61,20 @@ export declare const float: ISimpleType<number>;
|
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
63
|
export declare const finite: ISimpleType<number>;
|
|
64
|
+
/**
|
|
65
|
+
* `types.bigint` - Creates a type that can only contain a bigint value.
|
|
66
|
+
* Snapshots serialize to string (JSON-safe) and deserialize from string, number or bigint.
|
|
67
|
+
*
|
|
68
|
+
* Example:
|
|
69
|
+
* ```ts
|
|
70
|
+
* const BigId = types.model({
|
|
71
|
+
* id: types.identifier,
|
|
72
|
+
* value: types.bigint
|
|
73
|
+
* })
|
|
74
|
+
* getSnapshot(store).value // "0" (string, JSON-safe)
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare const bigint: IType<bigint | string | number, string, bigint>;
|
|
64
78
|
/**
|
|
65
79
|
* `types.boolean` - Creates a type that can only contain a boolean value.
|
|
66
80
|
* This type is used for boolean values by default
|
|
@@ -101,4 +115,4 @@ export declare const DatePrimitive: IType<number | Date, number, Date>;
|
|
|
101
115
|
* @param type
|
|
102
116
|
* @returns
|
|
103
117
|
*/
|
|
104
|
-
export declare function isPrimitiveType(type: unknown): type is ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof DatePrimitive;
|
|
118
|
+
export declare function isPrimitiveType(type: unknown): type is ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof bigint | typeof DatePrimitive;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ISimpleType } from "../../internal";
|
|
1
|
+
import { ISimpleType, IType } from "../../internal";
|
|
2
2
|
/**
|
|
3
3
|
* `types.identifier` - Identifiers are used to make references, lifecycle events and reconciling works.
|
|
4
4
|
* Inside a state tree, for each type can exist only one instance for each given identifier.
|
|
5
5
|
* For example there couldn't be 2 instances of user with id 1. If you need more, consider using references.
|
|
6
6
|
* Identifier can be used only as type property of a model.
|
|
7
|
-
* This type accepts as parameter the value type of the identifier field that can be either string or
|
|
7
|
+
* This type accepts as parameter the value type of the identifier field that can be either string, number or bigint.
|
|
8
8
|
*
|
|
9
9
|
* Example:
|
|
10
10
|
* ```ts
|
|
@@ -31,14 +31,28 @@ export declare const identifier: ISimpleType<string>;
|
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
export declare const identifierNumber: ISimpleType<number>;
|
|
34
|
+
/**
|
|
35
|
+
* `types.identifierBigint` - Similar to `types.identifier`. Snapshots serialize to string (JSON-safe) and deserialize from string, number or bigint.
|
|
36
|
+
*
|
|
37
|
+
* Example:
|
|
38
|
+
* ```ts
|
|
39
|
+
* const Todo = types.model("Todo", {
|
|
40
|
+
* id: types.identifierBigint,
|
|
41
|
+
* title: types.string
|
|
42
|
+
* })
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export declare const identifierBigint: IType<bigint | string | number, string, bigint>;
|
|
34
48
|
/**
|
|
35
49
|
* Returns if a given value represents an identifier type.
|
|
36
50
|
*
|
|
37
51
|
* @param type
|
|
38
52
|
* @returns
|
|
39
53
|
*/
|
|
40
|
-
export declare function isIdentifierType(type: unknown): type is typeof identifier | typeof identifierNumber;
|
|
54
|
+
export declare function isIdentifierType(type: unknown): type is typeof identifier | typeof identifierNumber | typeof identifierBigint;
|
|
41
55
|
/**
|
|
42
56
|
* Valid types for identifiers.
|
|
43
57
|
*/
|
|
44
|
-
export type ReferenceIdentifier = string | number;
|
|
58
|
+
export type ReferenceIdentifier = string | number | bigint;
|
|
@@ -29,6 +29,8 @@ export interface ISnapshotProcessors<IT extends IAnyType, CustomC, CustomS> {
|
|
|
29
29
|
/**
|
|
30
30
|
* `types.snapshotProcessor` - Runs a pre/post snapshot processor before/after serializing a given type.
|
|
31
31
|
*
|
|
32
|
+
* [See known issue with `applySnapshot` and `preProcessSnapshot`](https://github.com/mobxjs/mobx-state-tree/issues/1317)
|
|
33
|
+
*
|
|
32
34
|
* Example:
|
|
33
35
|
* ```ts
|
|
34
36
|
* const Todo1 = types.model({ text: types.string })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-state-tree",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Opinionated, transactional, MobX powered state container",
|
|
5
5
|
"main": "dist/mobx-state-tree.js",
|
|
6
6
|
"umd:main": "dist/mobx-state-tree.umd.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"size": "size-limit",
|
|
27
27
|
"tag-new-version": "yarn version && git push --tags",
|
|
28
|
-
"build-docs": "bun run fix-typedoc && shx rm -rf ./docs/API && typedoc --options ./typedocconfig.js",
|
|
28
|
+
"build-docs": "bun run fix-typedoc && shx rm -rf ./docs/API && typedoc --options ./typedocconfig.js && node scripts/fix-docs-source-links.js",
|
|
29
29
|
"publish-docs": "bun run build-docs && cd ./website && GIT_USER=jamonholmgren USE_SSH=true bun run publish-gh-pages",
|
|
30
30
|
"start": "cd website && bun run start",
|
|
31
31
|
"prepare": "husky install",
|