tinybase 8.0.0-beta.1 → 8.0.0-beta.3
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/@types/_internal/store/with-schemas/index.d.ts +2 -2
- package/@types/common/index.d.ts +22 -0
- package/@types/common/with-schemas/index.d.ts +22 -0
- package/@types/middleware/index.d.ts +151 -29
- package/@types/middleware/with-schemas/index.d.ts +174 -29
- package/@types/store/index.d.ts +132 -79
- package/@types/store/with-schemas/index.d.ts +137 -81
- package/checkpoints/index.js +2 -8
- package/checkpoints/with-schemas/index.js +2 -8
- package/index.js +272 -143
- package/mergeable-store/index.js +271 -156
- package/mergeable-store/with-schemas/index.js +271 -156
- package/middleware/index.js +40 -1
- package/middleware/with-schemas/index.js +40 -1
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/middleware/index.js +1 -1
- package/min/middleware/index.js.gz +0 -0
- package/min/middleware/with-schemas/index.js +1 -1
- package/min/middleware/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/persisters/index.js +1 -1
- package/min/persisters/index.js.gz +0 -0
- package/min/persisters/persister-automerge/index.js +1 -1
- package/min/persisters/persister-automerge/index.js.gz +0 -0
- package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-browser/index.js +1 -1
- package/min/persisters/persister-browser/index.js.gz +0 -0
- package/min/persisters/persister-browser/with-schemas/index.js +1 -1
- package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-file/index.js +1 -1
- package/min/persisters/persister-file/index.js.gz +0 -0
- package/min/persisters/persister-file/with-schemas/index.js +1 -1
- package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/index.js +1 -1
- package/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/index.js +1 -1
- package/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/index.js +1 -1
- package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -1
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-remote/index.js +1 -1
- package/min/persisters/persister-remote/index.js.gz +0 -0
- package/min/persisters/persister-remote/with-schemas/index.js +1 -1
- package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-yjs/index.js +1 -1
- package/min/persisters/persister-yjs/index.js.gz +0 -0
- package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/min/persisters/with-schemas/index.js +1 -1
- package/min/persisters/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/schematizers/index.js +1 -1
- package/min/schematizers/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/index.js +1 -1
- package/min/schematizers/schematizer-arktype/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-arktype/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/index.js +1 -1
- package/min/schematizers/schematizer-effect/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-effect/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/index.js +1 -1
- package/min/schematizers/schematizer-typebox/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-typebox/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/index.js +1 -1
- package/min/schematizers/schematizer-valibot/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-valibot/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/index.js +1 -1
- package/min/schematizers/schematizer-yup/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-yup/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/index.js +1 -1
- package/min/schematizers/schematizer-zod/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-zod/with-schemas/index.js.gz +0 -0
- package/min/schematizers/with-schemas/index.js +1 -1
- package/min/schematizers/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +356 -154
- package/omni/with-schemas/index.js +356 -154
- package/package.json +7 -7
- package/persisters/index.js +5 -5
- package/persisters/persister-automerge/index.js +5 -5
- package/persisters/persister-automerge/with-schemas/index.js +5 -5
- package/persisters/persister-browser/index.js +5 -5
- package/persisters/persister-browser/with-schemas/index.js +5 -5
- package/persisters/persister-cr-sqlite-wasm/index.js +5 -5
- package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +5 -5
- package/persisters/persister-durable-object-sql-storage/index.js +5 -5
- package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +5 -5
- package/persisters/persister-durable-object-storage/index.js +5 -5
- package/persisters/persister-durable-object-storage/with-schemas/index.js +5 -5
- package/persisters/persister-electric-sql/index.js +5 -5
- package/persisters/persister-electric-sql/with-schemas/index.js +5 -5
- package/persisters/persister-expo-sqlite/index.js +5 -5
- package/persisters/persister-expo-sqlite/with-schemas/index.js +5 -5
- package/persisters/persister-file/index.js +5 -5
- package/persisters/persister-file/with-schemas/index.js +5 -5
- package/persisters/persister-indexed-db/index.js +5 -5
- package/persisters/persister-indexed-db/with-schemas/index.js +5 -5
- package/persisters/persister-libsql/index.js +5 -5
- package/persisters/persister-libsql/with-schemas/index.js +5 -5
- package/persisters/persister-partykit-client/index.js +5 -5
- package/persisters/persister-partykit-client/with-schemas/index.js +5 -5
- package/persisters/persister-pglite/index.js +5 -5
- package/persisters/persister-pglite/with-schemas/index.js +5 -5
- package/persisters/persister-postgres/index.js +5 -5
- package/persisters/persister-postgres/with-schemas/index.js +5 -5
- package/persisters/persister-powersync/index.js +5 -5
- package/persisters/persister-powersync/with-schemas/index.js +5 -5
- package/persisters/persister-react-native-mmkv/index.js +5 -5
- package/persisters/persister-react-native-mmkv/with-schemas/index.js +5 -5
- package/persisters/persister-react-native-sqlite/index.js +5 -5
- package/persisters/persister-react-native-sqlite/with-schemas/index.js +5 -5
- package/persisters/persister-remote/index.js +5 -5
- package/persisters/persister-remote/with-schemas/index.js +5 -5
- package/persisters/persister-sqlite-bun/index.js +5 -5
- package/persisters/persister-sqlite-bun/with-schemas/index.js +5 -5
- package/persisters/persister-sqlite-wasm/index.js +5 -5
- package/persisters/persister-sqlite-wasm/with-schemas/index.js +5 -5
- package/persisters/persister-sqlite3/index.js +5 -5
- package/persisters/persister-sqlite3/with-schemas/index.js +5 -5
- package/persisters/persister-yjs/index.js +5 -5
- package/persisters/persister-yjs/with-schemas/index.js +5 -5
- package/persisters/with-schemas/index.js +5 -5
- package/queries/index.js +11 -4
- package/queries/with-schemas/index.js +11 -4
- package/readme.md +3 -3
- package/releases.md +19 -3
- package/schematizers/index.js +9 -1
- package/schematizers/schematizer-arktype/index.js +16 -1
- package/schematizers/schematizer-arktype/with-schemas/index.js +16 -1
- package/schematizers/schematizer-effect/index.js +15 -2
- package/schematizers/schematizer-effect/with-schemas/index.js +15 -2
- package/schematizers/schematizer-typebox/index.js +9 -1
- package/schematizers/schematizer-typebox/with-schemas/index.js +9 -1
- package/schematizers/schematizer-valibot/index.js +17 -2
- package/schematizers/schematizer-valibot/with-schemas/index.js +17 -2
- package/schematizers/schematizer-yup/index.js +9 -1
- package/schematizers/schematizer-yup/with-schemas/index.js +9 -1
- package/schematizers/schematizer-zod/index.js +13 -2
- package/schematizers/schematizer-zod/with-schemas/index.js +13 -2
- package/schematizers/with-schemas/index.js +9 -1
- package/store/index.js +195 -104
- package/store/with-schemas/index.js +195 -104
- package/synchronizers/index.js +5 -5
- package/synchronizers/synchronizer-broadcast-channel/index.js +5 -5
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -5
- package/synchronizers/synchronizer-local/index.js +5 -5
- package/synchronizers/synchronizer-local/with-schemas/index.js +5 -5
- package/synchronizers/synchronizer-ws-client/index.js +5 -5
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -5
- package/synchronizers/synchronizer-ws-server/index.js +5 -5
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -5
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +5 -5
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +5 -5
- package/synchronizers/with-schemas/index.js +5 -5
- package/ui-react/index.js +6 -0
- package/ui-react/with-schemas/index.js +6 -0
- package/ui-react-dom/index.js +91 -6
- package/ui-react-dom/with-schemas/index.js +91 -6
- package/ui-react-inspector/index.js +248 -84
- package/ui-react-inspector/with-schemas/index.js +248 -84
- package/with-schemas/index.js +272 -143
|
@@ -23,6 +23,8 @@ import type {
|
|
|
23
23
|
ValueIdFromSchema,
|
|
24
24
|
} from '../../_internal/store/with-schemas/index.d.ts';
|
|
25
25
|
import type {
|
|
26
|
+
AnyArray,
|
|
27
|
+
AnyObject,
|
|
26
28
|
Id,
|
|
27
29
|
IdOrNull,
|
|
28
30
|
Ids,
|
|
@@ -60,9 +62,13 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
60
62
|
* The CellSchema type describes what values are allowed for each Cell in a
|
|
61
63
|
* Table.
|
|
62
64
|
*
|
|
63
|
-
* A CellSchema specifies the type of the Cell (`string`, `boolean`, `number
|
|
64
|
-
*
|
|
65
|
-
* value is not specified.
|
|
65
|
+
* A CellSchema specifies the type of the Cell (`string`, `boolean`, `number`,
|
|
66
|
+
* `null` since v7.0, or `object` or `array` since v8.0), and what the default
|
|
67
|
+
* value can be when an explicit value is not specified.
|
|
68
|
+
*
|
|
69
|
+
* For `object` and `array` types, TinyBase automatically serializes values to
|
|
70
|
+
* and from JSON when storing and retrieving them. This means you can set an
|
|
71
|
+
* object or array Cell directly, and get back the same structure.
|
|
66
72
|
*
|
|
67
73
|
* If a default value is provided (and its type is correct), you can be certain
|
|
68
74
|
* that that Cell will always be present in a Row.
|
|
@@ -82,13 +88,27 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
82
88
|
* default: false,
|
|
83
89
|
* };
|
|
84
90
|
* ```
|
|
91
|
+
* @example
|
|
92
|
+
* When applied to a Store, this CellSchema allows an object Cell containing
|
|
93
|
+
* arbitrary data, defaulting to an empty object.
|
|
94
|
+
*
|
|
95
|
+
* ```js
|
|
96
|
+
* import type {CellSchema} from 'tinybase';
|
|
97
|
+
*
|
|
98
|
+
* export const tagsCell: CellSchema = {
|
|
99
|
+
* type: 'object',
|
|
100
|
+
* default: {},
|
|
101
|
+
* };
|
|
102
|
+
* ```
|
|
85
103
|
* @category Schema
|
|
86
104
|
* @since v1.0.0
|
|
87
105
|
*/
|
|
88
106
|
export type CellSchema =
|
|
89
107
|
| {type: 'string'; default?: string}
|
|
90
108
|
| {type: 'number'; default?: number}
|
|
91
|
-
| {type: 'boolean'; default?: boolean}
|
|
109
|
+
| {type: 'boolean'; default?: boolean}
|
|
110
|
+
| {type: 'object'; default?: AnyObject}
|
|
111
|
+
| {type: 'array'; default?: AnyArray};
|
|
92
112
|
|
|
93
113
|
/**
|
|
94
114
|
* The ValuesSchema type describes the keyed Values that can be set in a Store
|
|
@@ -116,9 +136,12 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
116
136
|
* The ValueSchema type describes what values are allowed for keyed Values in a
|
|
117
137
|
* Store.
|
|
118
138
|
*
|
|
119
|
-
* A ValueSchema specifies the type of the Value (`string`, `boolean`, `number
|
|
120
|
-
*
|
|
121
|
-
* value is not specified.
|
|
139
|
+
* A ValueSchema specifies the type of the Value (`string`, `boolean`, `number`,
|
|
140
|
+
* `null` since v7.0, or `object` or `array` since v8.0), and what the default
|
|
141
|
+
* value can be when an explicit value is not specified.
|
|
142
|
+
*
|
|
143
|
+
* For `object` and `array` types, TinyBase automatically serializes values to
|
|
144
|
+
* and from JSON when storing and retrieving them.
|
|
122
145
|
*
|
|
123
146
|
* If a default value is provided (and its type is correct), you can be certain
|
|
124
147
|
* that the Value will always be present in a Store.
|
|
@@ -138,13 +161,27 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
138
161
|
* default: false,
|
|
139
162
|
* };
|
|
140
163
|
* ```
|
|
164
|
+
* @example
|
|
165
|
+
* When applied to a Store, this ValueSchema allows an array Value containing
|
|
166
|
+
* a list of items, defaulting to an empty array.
|
|
167
|
+
*
|
|
168
|
+
* ```js
|
|
169
|
+
* import type {ValueSchema} from 'tinybase';
|
|
170
|
+
*
|
|
171
|
+
* export const cartItems: ValueSchema = {
|
|
172
|
+
* type: 'array',
|
|
173
|
+
* default: [],
|
|
174
|
+
* };
|
|
175
|
+
* ```
|
|
141
176
|
* @category Schema
|
|
142
177
|
* @since v3.0.0
|
|
143
178
|
*/
|
|
144
179
|
export type ValueSchema =
|
|
145
180
|
| {type: 'string'; default?: string}
|
|
146
181
|
| {type: 'number'; default?: number}
|
|
147
|
-
| {type: 'boolean'; default?: boolean}
|
|
182
|
+
| {type: 'boolean'; default?: boolean}
|
|
183
|
+
| {type: 'object'; default?: AnyObject}
|
|
184
|
+
| {type: 'array'; default?: AnyArray};
|
|
148
185
|
|
|
149
186
|
/**
|
|
150
187
|
* The NoTablesSchema type is a TablesSchema-like type for when one has not been
|
|
@@ -361,12 +398,13 @@ export type Row<
|
|
|
361
398
|
* This has schema-based typing. The following is a simplified representation:
|
|
362
399
|
*
|
|
363
400
|
* ```ts override
|
|
364
|
-
* string | number | boolean | null;
|
|
401
|
+
* string | number | boolean | null | AnyObject | AnyArray;
|
|
365
402
|
* ```
|
|
366
403
|
*
|
|
367
404
|
* A Cell is used when setting a cell with the setCell method, and when getting
|
|
368
405
|
* it back out again with the getCell method. A Cell is a JavaScript string,
|
|
369
|
-
* number, boolean
|
|
406
|
+
* number, boolean, or null (since v7.0), or a plain JavaScript object or array
|
|
407
|
+
* (since v8.0).
|
|
370
408
|
* @example
|
|
371
409
|
* ```js
|
|
372
410
|
* import type {Cell} from 'tinybase';
|
|
@@ -387,7 +425,11 @@ export type Cell<
|
|
|
387
425
|
? number
|
|
388
426
|
: CellType extends 'boolean'
|
|
389
427
|
? boolean
|
|
390
|
-
:
|
|
428
|
+
: CellType extends 'object'
|
|
429
|
+
? AnyObject
|
|
430
|
+
: CellType extends 'array'
|
|
431
|
+
? AnyArray
|
|
432
|
+
: string | number | boolean | AnyObject | AnyArray;
|
|
391
433
|
|
|
392
434
|
/**
|
|
393
435
|
* The CellOrUndefined type is a data structure representing the data in a
|
|
@@ -463,12 +505,13 @@ export type Values<
|
|
|
463
505
|
* This has schema-based typing. The following is a simplified representation:
|
|
464
506
|
*
|
|
465
507
|
* ```ts override
|
|
466
|
-
* string | number | boolean | null;
|
|
508
|
+
* string | number | boolean | null | AnyObject | AnyArray;
|
|
467
509
|
* ```
|
|
468
510
|
*
|
|
469
511
|
* A Value is used when setting a value with the setValue method, and when
|
|
470
512
|
* getting it back out again with the getValue method. A Value is a JavaScript
|
|
471
|
-
* string, number, boolean
|
|
513
|
+
* string, number, boolean, or null (since v7.0), or a plain JavaScript object
|
|
514
|
+
* or array (since v8.0).
|
|
472
515
|
* @example
|
|
473
516
|
* ```js
|
|
474
517
|
* import type {Value} from 'tinybase';
|
|
@@ -488,7 +531,11 @@ export type Value<
|
|
|
488
531
|
? number
|
|
489
532
|
: ValueType extends 'boolean'
|
|
490
533
|
? boolean
|
|
491
|
-
:
|
|
534
|
+
: ValueType extends 'object'
|
|
535
|
+
? AnyObject
|
|
536
|
+
: ValueType extends 'array'
|
|
537
|
+
? AnyArray
|
|
538
|
+
: string | number | boolean | AnyObject | AnyArray;
|
|
492
539
|
|
|
493
540
|
/**
|
|
494
541
|
* The ValueOrUndefined type is a data structure representing the data in a
|
|
@@ -2315,8 +2362,8 @@ export type ChangedValues<Schema extends OptionalValuesSchema> = {
|
|
|
2315
2362
|
* ];
|
|
2316
2363
|
* ```
|
|
2317
2364
|
*
|
|
2318
|
-
* It provides both the old and new Values in a two-part array. These
|
|
2319
|
-
*
|
|
2365
|
+
* It provides both the old and new Values in a two-part array. These describe
|
|
2366
|
+
* the state of the changed Value in the Store at the _start_ of the
|
|
2320
2367
|
* transaction, and by the _end_ of the transaction.
|
|
2321
2368
|
*
|
|
2322
2369
|
* Hence, an `undefined` value for the first item in the array means that the
|
|
@@ -2675,14 +2722,17 @@ export type StoreListenerStats = {
|
|
|
2675
2722
|
*
|
|
2676
2723
|
* The keyed value support is best thought of as a flat JavaScript object. The
|
|
2677
2724
|
* Store contains a number of Value objects, each with a unique ID, and which is
|
|
2678
|
-
* a string, boolean, number
|
|
2725
|
+
* a string, boolean, number, null (since v7.0), or a plain JavaScript object or
|
|
2726
|
+
* array (since v8.0).
|
|
2679
2727
|
*
|
|
2680
2728
|
* ```json
|
|
2681
|
-
* {
|
|
2682
|
-
* "value1": "one",
|
|
2683
|
-
* "value2": true,
|
|
2684
|
-
* "value3": 3,
|
|
2685
|
-
* "value4": null,
|
|
2729
|
+
* { // Store
|
|
2730
|
+
* "value1": "one", // Value (string)
|
|
2731
|
+
* "value2": true, // Value (boolean)
|
|
2732
|
+
* "value3": 3, // Value (number)
|
|
2733
|
+
* "value4": null, // Value (null since v7.0)
|
|
2734
|
+
* "value5": {"x": 1}, // Value (object since v8.0)
|
|
2735
|
+
* "value6": [1, 2, 3], // Value (array since v8.0)
|
|
2686
2736
|
* ...
|
|
2687
2737
|
* }
|
|
2688
2738
|
* ```
|
|
@@ -2699,7 +2749,8 @@ export type StoreListenerStats = {
|
|
|
2699
2749
|
* - Each Table contains a number of Row objects.
|
|
2700
2750
|
* - Each Row contains a number of Cell objects.
|
|
2701
2751
|
*
|
|
2702
|
-
* A Cell is a string, boolean, number
|
|
2752
|
+
* A Cell is a string, boolean, number, null (since v7.0), or a plain JavaScript
|
|
2753
|
+
* object or array (since v8.0).
|
|
2703
2754
|
*
|
|
2704
2755
|
* The members of each level of this hierarchy are identified with a unique Id
|
|
2705
2756
|
* (which is a string). In other words you can naively think of a Store as a
|
|
@@ -2713,6 +2764,8 @@ export type StoreListenerStats = {
|
|
|
2713
2764
|
* "cell2": true, // Cell (boolean)
|
|
2714
2765
|
* "cell3": 3, // Cell (number)
|
|
2715
2766
|
* "cell4": null, // Cell (null since v7.0)
|
|
2767
|
+
* "cell5": {"x": 1}, // Cell (object since v8.0)
|
|
2768
|
+
* "cell6": [1, 2, 3], // Cell (array since v8.0)
|
|
2716
2769
|
* ...
|
|
2717
2770
|
* },
|
|
2718
2771
|
* ...
|
|
@@ -3468,7 +3521,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3468
3521
|
tableId: TableId,
|
|
3469
3522
|
rowId: Id,
|
|
3470
3523
|
cellId: CellId,
|
|
3471
|
-
):
|
|
3524
|
+
): DefaultedCellFromSchema<Schemas[0], TableId, CellId>;
|
|
3472
3525
|
|
|
3473
3526
|
/**
|
|
3474
3527
|
* The getValues method returns an object containing the entire set of keyed
|
|
@@ -4118,7 +4171,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4118
4171
|
* {open: true, employees: 3},
|
|
4119
4172
|
* ]);
|
|
4120
4173
|
*
|
|
4121
|
-
* store.setContent([
|
|
4174
|
+
* store.setContent([
|
|
4175
|
+
* {pets: {felix: {species: 'cat', bug: new Date(0)}}},
|
|
4176
|
+
* '',
|
|
4177
|
+
* ]);
|
|
4122
4178
|
* console.log(store.getTables());
|
|
4123
4179
|
* // -> {pets: {felix: {species: 'cat'}}}
|
|
4124
4180
|
* console.log(store.getValues());
|
|
@@ -4182,7 +4238,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4182
4238
|
*
|
|
4183
4239
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4184
4240
|
*
|
|
4185
|
-
* store.setTables({pets: {felix: {species: 'cat', bug:
|
|
4241
|
+
* store.setTables({pets: {felix: {species: 'cat', bug: new Date(0)}}});
|
|
4186
4242
|
* console.log(store.getTables());
|
|
4187
4243
|
* // -> {pets: {felix: {species: 'cat'}}}
|
|
4188
4244
|
*
|
|
@@ -4244,7 +4300,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4244
4300
|
*
|
|
4245
4301
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4246
4302
|
*
|
|
4247
|
-
* store.setTable('pets', {felix: {species: 'cat', bug:
|
|
4303
|
+
* store.setTable('pets', {felix: {species: 'cat', bug: new Date(0)}});
|
|
4248
4304
|
* console.log(store.getTables());
|
|
4249
4305
|
* // -> {pets: {felix: {species: 'cat'}}}
|
|
4250
4306
|
*
|
|
@@ -4307,7 +4363,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4307
4363
|
*
|
|
4308
4364
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4309
4365
|
*
|
|
4310
|
-
* store.setRow('pets', 'fido', {color: 'brown', bug:
|
|
4366
|
+
* store.setRow('pets', 'fido', {color: 'brown', bug: new Date(0)});
|
|
4311
4367
|
* console.log(store.getTables());
|
|
4312
4368
|
* // -> {pets: {fido: {color: 'brown'}}}
|
|
4313
4369
|
*
|
|
@@ -4382,7 +4438,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4382
4438
|
*
|
|
4383
4439
|
* const store = createStore().setTables({pets: {'0': {species: 'dog'}}});
|
|
4384
4440
|
*
|
|
4385
|
-
* console.log(store.addRow('pets', {species: 'cat', bug:
|
|
4441
|
+
* console.log(store.addRow('pets', {species: 'cat', bug: new Date(0)}));
|
|
4386
4442
|
* // -> '1'
|
|
4387
4443
|
* console.log(store.getTables());
|
|
4388
4444
|
* // -> {pets: {'0': {species: 'dog'}, '1': {species: 'cat'}}}
|
|
@@ -4451,7 +4507,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4451
4507
|
*
|
|
4452
4508
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4453
4509
|
*
|
|
4454
|
-
* store.setPartialRow('pets', 'fido', {color: 'brown', bug:
|
|
4510
|
+
* store.setPartialRow('pets', 'fido', {color: 'brown', bug: new Date(0)});
|
|
4455
4511
|
* console.log(store.getTables());
|
|
4456
4512
|
* // -> {pets: {fido: {species: 'dog', color: 'brown'}}}
|
|
4457
4513
|
*
|
|
@@ -4484,10 +4540,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4484
4540
|
* does not match a TablesSchema associated with the Store), will be ignored
|
|
4485
4541
|
* silently.
|
|
4486
4542
|
*
|
|
4487
|
-
* As well as string, number,
|
|
4488
|
-
* a MapCell function that takes the current Cell
|
|
4489
|
-
* maps it. This is useful if you want to efficiently
|
|
4490
|
-
* without fetching it first, for example.
|
|
4543
|
+
* As well as string, number, boolean, null, object, and array Cell types,
|
|
4544
|
+
* this method can also take a MapCell function that takes the current Cell
|
|
4545
|
+
* value as a parameter and maps it. This is useful if you want to efficiently
|
|
4546
|
+
* increment a value without fetching it first, for example.
|
|
4491
4547
|
*
|
|
4492
4548
|
* The method returns a reference to the Store so that subsequent operations
|
|
4493
4549
|
* can be chained in a fluent style.
|
|
@@ -4529,7 +4585,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4529
4585
|
*
|
|
4530
4586
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4531
4587
|
*
|
|
4532
|
-
* store.setCell('pets', 'fido', 'bug',
|
|
4588
|
+
* store.setCell('pets', 'fido', 'bug', new Date(0));
|
|
4533
4589
|
* console.log(store.getTables());
|
|
4534
4590
|
* // -> {pets: {fido: {species: 'dog'}}}
|
|
4535
4591
|
* ```
|
|
@@ -4593,7 +4649,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4593
4649
|
*
|
|
4594
4650
|
* const store = createStore().setValues({open: true});
|
|
4595
4651
|
*
|
|
4596
|
-
* store.setValues({employees: 3, bug:
|
|
4652
|
+
* store.setValues({employees: 3, bug: new Date(0)});
|
|
4597
4653
|
* console.log(store.getValues());
|
|
4598
4654
|
* // -> {employees: 3}
|
|
4599
4655
|
*
|
|
@@ -4652,7 +4708,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4652
4708
|
*
|
|
4653
4709
|
* const store = createStore().setValues({open: true});
|
|
4654
4710
|
*
|
|
4655
|
-
* store.setPartialValues({employees: 3, bug:
|
|
4711
|
+
* store.setPartialValues({employees: 3, bug: new Date(0)});
|
|
4656
4712
|
* console.log(store.getValues());
|
|
4657
4713
|
* // -> {open: true, employees: 3}
|
|
4658
4714
|
*
|
|
@@ -4680,10 +4736,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4680
4736
|
* If the Value is invalid (either because of its type, or because it does not
|
|
4681
4737
|
* match a ValuesSchema associated with the Store), will be ignored silently.
|
|
4682
4738
|
*
|
|
4683
|
-
* As well as string, number,
|
|
4684
|
-
* take a MapValue function that takes the current Value
|
|
4685
|
-
* maps it. This is useful if you want to efficiently
|
|
4686
|
-
* without fetching it first, for example.
|
|
4739
|
+
* As well as string, number, boolean, null, object, and array Value types,
|
|
4740
|
+
* this method can also take a MapValue function that takes the current Value
|
|
4741
|
+
* as a parameter and maps it. This is useful if you want to efficiently
|
|
4742
|
+
* increment a value without fetching it first, for example.
|
|
4687
4743
|
*
|
|
4688
4744
|
* The method returns a reference to the Store so that subsequent operations
|
|
4689
4745
|
* can be chained in a fluent style.
|
|
@@ -4721,7 +4777,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4721
4777
|
*
|
|
4722
4778
|
* const store = createStore().setValues({employees: 3});
|
|
4723
4779
|
*
|
|
4724
|
-
* store.setValue('bug',
|
|
4780
|
+
* store.setValue('bug', new Date(0));
|
|
4725
4781
|
* console.log(store.getValues());
|
|
4726
4782
|
* // -> {employees: 3}
|
|
4727
4783
|
* ```
|
|
@@ -5555,10 +5611,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5555
5611
|
* () =>
|
|
5556
5612
|
* store
|
|
5557
5613
|
* .setCell('pets', 'fido', 'color', 'black')
|
|
5558
|
-
* .setCell('pets', 'fido', '
|
|
5559
|
-
* .setCell('pets', 'fido', '
|
|
5614
|
+
* .setCell('pets', 'fido', 'date0', new Date(0))
|
|
5615
|
+
* .setCell('pets', 'fido', 'date1', new Date(1))
|
|
5560
5616
|
* .setValue('open', false)
|
|
5561
|
-
* .setValue('
|
|
5617
|
+
* .setValue('date2', new Date(2)),
|
|
5562
5618
|
* () => {
|
|
5563
5619
|
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5564
5620
|
* store.getTransactionLog();
|
|
@@ -5572,9 +5628,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5572
5628
|
* );
|
|
5573
5629
|
* // -> {pets: {fido: {species: 'dog', color: 'black'}}}
|
|
5574
5630
|
* // -> {pets: {fido: {color: ['brown', 'black']}}}
|
|
5575
|
-
* // -> {pets: {fido: {
|
|
5631
|
+
* // -> {pets: {fido: {date0: [new Date(0)], date1: [new Date(1)]}}}
|
|
5576
5632
|
* // -> {open: [true, false]}
|
|
5577
|
-
* // -> {
|
|
5633
|
+
* // -> {date2: [new Date(2)]}
|
|
5578
5634
|
*
|
|
5579
5635
|
* console.log(store.getTables());
|
|
5580
5636
|
* // -> {pets: {fido: {species: 'dog', color: 'brown'}}}
|
|
@@ -5713,10 +5769,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5713
5769
|
* store
|
|
5714
5770
|
* .startTransaction()
|
|
5715
5771
|
* .setCell('pets', 'fido', 'color', 'black')
|
|
5716
|
-
* .setCell('pets', 'fido', '
|
|
5717
|
-
* .setCell('pets', 'fido', '
|
|
5772
|
+
* .setCell('pets', 'fido', 'date0', new Date(0))
|
|
5773
|
+
* .setCell('pets', 'fido', 'date1', new Date(1))
|
|
5718
5774
|
* .setValue('open', false)
|
|
5719
|
-
* .setValue('
|
|
5775
|
+
* .setValue('date2', new Date(2))
|
|
5720
5776
|
* .finishTransaction(() => {
|
|
5721
5777
|
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5722
5778
|
* store.getTransactionLog();
|
|
@@ -5726,9 +5782,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5726
5782
|
* console.log(invalidValues);
|
|
5727
5783
|
* });
|
|
5728
5784
|
* // -> {pets: {fido: {color: ['brown', 'black']}}}
|
|
5729
|
-
* // -> {pets: {fido: {
|
|
5785
|
+
* // -> {pets: {fido: {date0: [new Date(0)], date1: [new Date(1)]}}}
|
|
5730
5786
|
* // -> {open: [true, false]}
|
|
5731
|
-
* // -> {
|
|
5787
|
+
* // -> {date2: [new Date(2)]}
|
|
5732
5788
|
* ```
|
|
5733
5789
|
* @category Transaction
|
|
5734
5790
|
* @since v5.0.0
|
|
@@ -5812,10 +5868,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5812
5868
|
* store
|
|
5813
5869
|
* .startTransaction()
|
|
5814
5870
|
* .setCell('pets', 'fido', 'color', 'black')
|
|
5815
|
-
* .setCell('pets', 'fido', '
|
|
5816
|
-
* .setCell('pets', 'fido', '
|
|
5871
|
+
* .setCell('pets', 'fido', 'date0', new Date(0))
|
|
5872
|
+
* .setCell('pets', 'fido', 'date1', new Date(1))
|
|
5817
5873
|
* .setValue('open', false)
|
|
5818
|
-
* .setValue('
|
|
5874
|
+
* .setValue('date2', new Date(2))
|
|
5819
5875
|
* .finishTransaction(() => {
|
|
5820
5876
|
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5821
5877
|
* store.getTransactionLog();
|
|
@@ -5828,9 +5884,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5828
5884
|
* });
|
|
5829
5885
|
* // -> {pets: {fido: {species: 'dog', color: 'black'}}}
|
|
5830
5886
|
* // -> {pets: {fido: {color: ['brown', 'black']}}}
|
|
5831
|
-
* // -> {pets: {fido: {
|
|
5887
|
+
* // -> {pets: {fido: {date0: [new Date(0)], date1: [new Date(1)]}}}
|
|
5832
5888
|
* // -> {open: [true, false]}
|
|
5833
|
-
* // -> {
|
|
5889
|
+
* // -> {date2: [new Date(2)]}
|
|
5834
5890
|
*
|
|
5835
5891
|
* console.log(store.getTables());
|
|
5836
5892
|
* // -> {pets: {fido: {species: 'dog', color: 'brown'}}}
|
|
@@ -8539,16 +8595,16 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8539
8595
|
* const listenerId = store.addInvalidCellListener(
|
|
8540
8596
|
* 'pets',
|
|
8541
8597
|
* 'fido',
|
|
8542
|
-
* '
|
|
8598
|
+
* 'birth',
|
|
8543
8599
|
* (store, tableId, rowId, cellId, invalidCells) => {
|
|
8544
|
-
* console.log('Invalid
|
|
8600
|
+
* console.log('Invalid birth cell in fido row in pets table');
|
|
8545
8601
|
* console.log(invalidCells);
|
|
8546
8602
|
* },
|
|
8547
8603
|
* );
|
|
8548
8604
|
*
|
|
8549
|
-
* store.setCell('pets', 'fido', '
|
|
8550
|
-
* // -> 'Invalid
|
|
8551
|
-
* // -> [
|
|
8605
|
+
* store.setCell('pets', 'fido', 'birth', new Date(0));
|
|
8606
|
+
* // -> 'Invalid birth cell in fido row in pets table'
|
|
8607
|
+
* // -> [new Date(0)]
|
|
8552
8608
|
*
|
|
8553
8609
|
* store.delListener(listenerId);
|
|
8554
8610
|
* ```
|
|
@@ -8575,10 +8631,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8575
8631
|
* },
|
|
8576
8632
|
* );
|
|
8577
8633
|
*
|
|
8578
|
-
* store.setCell('pets', 'fido', '
|
|
8579
|
-
* // -> 'Invalid
|
|
8580
|
-
* store.setTable('sales', {fido: {
|
|
8581
|
-
* // -> 'Invalid
|
|
8634
|
+
* store.setCell('pets', 'fido', 'birth', new Date(0));
|
|
8635
|
+
* // -> 'Invalid birth cell in fido row in pets table'
|
|
8636
|
+
* store.setTable('sales', {fido: {birth: new Date()}});
|
|
8637
|
+
* // -> 'Invalid birth cell in fido row in sales table'
|
|
8582
8638
|
*
|
|
8583
8639
|
* store.setRow('pets', 'felix', {});
|
|
8584
8640
|
* // -> 'Invalid undefined cell in felix row in pets table'
|
|
@@ -8682,7 +8738,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8682
8738
|
* const listenerId = store.addInvalidCellListener(
|
|
8683
8739
|
* 'pets',
|
|
8684
8740
|
* 'fido',
|
|
8685
|
-
* '
|
|
8741
|
+
* 'birth',
|
|
8686
8742
|
* (store, tableId, rowId, cellId, invalidCells) =>
|
|
8687
8743
|
* store.setCell(
|
|
8688
8744
|
* 'meta',
|
|
@@ -8693,9 +8749,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8693
8749
|
* true,
|
|
8694
8750
|
* );
|
|
8695
8751
|
*
|
|
8696
|
-
* store.setCell('pets', 'fido', '
|
|
8752
|
+
* store.setCell('pets', 'fido', 'birth', new Date(0));
|
|
8697
8753
|
* console.log(store.getRow('meta', 'invalid_updates'));
|
|
8698
|
-
* // -> {'
|
|
8754
|
+
* // -> {'pets_fido_birth': '"1970-01-01T00:00:00.000Z"'}
|
|
8699
8755
|
*
|
|
8700
8756
|
* store.delListener(listenerId);
|
|
8701
8757
|
* ```
|
|
@@ -8774,16 +8830,16 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8774
8830
|
*
|
|
8775
8831
|
* const store = createStore().setValues({open: true});
|
|
8776
8832
|
* const listenerId = store.addInvalidValueListener(
|
|
8777
|
-
* '
|
|
8833
|
+
* 'openDate',
|
|
8778
8834
|
* (store, valueId, invalidValues) => {
|
|
8779
|
-
* console.log('Invalid
|
|
8835
|
+
* console.log('Invalid openDate value');
|
|
8780
8836
|
* console.log(invalidValues);
|
|
8781
8837
|
* },
|
|
8782
8838
|
* );
|
|
8783
8839
|
*
|
|
8784
|
-
* store.setValue('
|
|
8785
|
-
* // -> 'Invalid
|
|
8786
|
-
* // -> [
|
|
8840
|
+
* store.setValue('openDate', new Date(0));
|
|
8841
|
+
* // -> 'Invalid openDate value'
|
|
8842
|
+
* // -> [new Date(0)]
|
|
8787
8843
|
*
|
|
8788
8844
|
* store.delListener(listenerId);
|
|
8789
8845
|
* ```
|
|
@@ -8803,10 +8859,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8803
8859
|
* },
|
|
8804
8860
|
* );
|
|
8805
8861
|
*
|
|
8806
|
-
* store.setValue('
|
|
8807
|
-
* // -> 'Invalid
|
|
8808
|
-
* store.setValue('
|
|
8809
|
-
* // -> 'Invalid
|
|
8862
|
+
* store.setValue('openDate', new Date(0));
|
|
8863
|
+
* // -> 'Invalid openDate value'
|
|
8864
|
+
* store.setValue('closeDate', new Date(1));
|
|
8865
|
+
* // -> 'Invalid closeDate value'
|
|
8810
8866
|
*
|
|
8811
8867
|
* store.setValues('pets', 'felix', {});
|
|
8812
8868
|
* // -> 'Invalid undefined value'
|
|
@@ -8882,15 +8938,15 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8882
8938
|
*
|
|
8883
8939
|
* const store = createStore().setValues({open: true});
|
|
8884
8940
|
* const listenerId = store.addInvalidValueListener(
|
|
8885
|
-
* '
|
|
8941
|
+
* 'openDate',
|
|
8886
8942
|
* (store, valueId, invalidValues) =>
|
|
8887
8943
|
* store.setValue('invalid_updates', JSON.stringify(invalidValues[0])),
|
|
8888
8944
|
* true,
|
|
8889
8945
|
* );
|
|
8890
8946
|
*
|
|
8891
|
-
* store.setValue('
|
|
8947
|
+
* store.setValue('openDate', new Date(0));
|
|
8892
8948
|
* console.log(store.getValue('invalid_updates'));
|
|
8893
|
-
* // -> '
|
|
8949
|
+
* // -> '"1970-01-01T00:00:00.000Z"'
|
|
8894
8950
|
*
|
|
8895
8951
|
* store.delListener(listenerId);
|
|
8896
8952
|
* ```
|
package/checkpoints/index.js
CHANGED
|
@@ -200,18 +200,12 @@ const createCheckpoints = getCreateFunction(
|
|
|
200
200
|
collForEach(cellsDelta2, (table, tableId) =>
|
|
201
201
|
collForEach(table, (row, rowId) =>
|
|
202
202
|
collForEach(row, (oldNew, cellId) =>
|
|
203
|
-
store.
|
|
204
|
-
tableId,
|
|
205
|
-
rowId,
|
|
206
|
-
cellId,
|
|
207
|
-
oldNew[oldOrNew],
|
|
208
|
-
true,
|
|
209
|
-
),
|
|
203
|
+
store._[5](tableId, rowId, cellId, oldNew[oldOrNew], true),
|
|
210
204
|
),
|
|
211
205
|
),
|
|
212
206
|
);
|
|
213
207
|
collForEach(valuesDelta2, (oldNew, valueId) =>
|
|
214
|
-
store.
|
|
208
|
+
store._[6](valueId, oldNew[oldOrNew], true),
|
|
215
209
|
);
|
|
216
210
|
});
|
|
217
211
|
listening = 1;
|
|
@@ -200,18 +200,12 @@ const createCheckpoints = getCreateFunction(
|
|
|
200
200
|
collForEach(cellsDelta2, (table, tableId) =>
|
|
201
201
|
collForEach(table, (row, rowId) =>
|
|
202
202
|
collForEach(row, (oldNew, cellId) =>
|
|
203
|
-
store.
|
|
204
|
-
tableId,
|
|
205
|
-
rowId,
|
|
206
|
-
cellId,
|
|
207
|
-
oldNew[oldOrNew],
|
|
208
|
-
true,
|
|
209
|
-
),
|
|
203
|
+
store._[5](tableId, rowId, cellId, oldNew[oldOrNew], true),
|
|
210
204
|
),
|
|
211
205
|
),
|
|
212
206
|
);
|
|
213
207
|
collForEach(valuesDelta2, (oldNew, valueId) =>
|
|
214
|
-
store.
|
|
208
|
+
store._[6](valueId, oldNew[oldOrNew], true),
|
|
215
209
|
);
|
|
216
210
|
});
|
|
217
211
|
listening = 1;
|