tinybase 4.0.0-beta.4 → 4.0.0-beta.5
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/lib/cjs/persisters/persister-automerge.cjs +1 -0
- package/lib/cjs/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-browser.cjs +1 -0
- package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-file.cjs +1 -0
- package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-remote.cjs +1 -0
- package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs +1 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-yjs.cjs +1 -0
- package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs/persisters.cjs +1 -1
- package/lib/cjs/persisters.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-file.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs-es6/persisters.cjs +1 -1
- package/lib/cjs-es6/persisters.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/{persister-automerge.js → persisters/persister-automerge.js} +57 -30
- package/lib/debug/{persister-browser.js → persisters/persister-browser.js} +48 -19
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +665 -0
- package/lib/debug/{persister-file.js → persisters/persister-file.js} +50 -24
- package/lib/debug/{persister-remote.js → persisters/persister-remote.js} +47 -18
- package/lib/debug/persisters/persister-sqlite-wasm.js +673 -0
- package/lib/debug/persisters/persister-sqlite3.js +676 -0
- package/lib/debug/{persister-yjs.js → persisters/persister-yjs.js} +48 -19
- package/lib/debug/persisters.js +46 -17
- package/lib/debug/store.js +77 -27
- package/lib/debug/tinybase.js +120 -43
- package/lib/debug/tools.js +121 -27
- package/lib/debug/ui-react.js +24 -0
- package/lib/es6/persisters/persister-automerge.js +1 -0
- package/lib/es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/es6/persisters/persister-browser.js +1 -0
- package/lib/es6/persisters/persister-browser.js.gz +0 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-file.js +1 -0
- package/lib/es6/persisters/persister-file.js.gz +0 -0
- package/lib/es6/persisters/persister-remote.js +1 -0
- package/lib/es6/persisters/persister-remote.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite3.js +1 -0
- package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/es6/persisters/persister-yjs.js +1 -0
- package/lib/es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/es6/persisters.js +1 -1
- package/lib/es6/persisters.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/persisters/persister-automerge.js +1 -0
- package/lib/persisters/persister-automerge.js.gz +0 -0
- package/lib/persisters/persister-browser.js +1 -0
- package/lib/persisters/persister-browser.js.gz +0 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-file.js +1 -0
- package/lib/persisters/persister-file.js.gz +0 -0
- package/lib/persisters/persister-remote.js +1 -0
- package/lib/persisters/persister-remote.js.gz +0 -0
- package/lib/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-sqlite3.js +1 -0
- package/lib/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/persisters/persister-yjs.js +1 -0
- package/lib/persisters/persister-yjs.js.gz +0 -0
- package/lib/persisters.js +1 -1
- package/lib/persisters.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/checkpoints.d.ts +0 -27
- package/lib/types/common.d.ts +0 -9
- package/lib/types/indexes.d.ts +0 -26
- package/lib/types/metrics.d.ts +0 -23
- package/lib/types/{persister-automerge.d.ts → persisters/persister-automerge.d.ts} +4 -6
- package/lib/types/{persister-browser.d.ts → persisters/persister-browser.d.ts} +2 -5
- package/lib/types/persisters/persister-cr-sqlite-wasm.d.ts +95 -0
- package/lib/types/{persister-file.d.ts → persisters/persister-file.d.ts} +3 -5
- package/lib/types/{persister-remote.d.ts → persisters/persister-remote.d.ts} +2 -4
- package/lib/types/persisters/persister-sqlite-wasm.d.ts +102 -0
- package/lib/types/persisters/persister-sqlite3.d.ts +109 -0
- package/lib/types/{persister-yjs.d.ts → persisters/persister-yjs.d.ts} +4 -6
- package/lib/types/persisters.d.ts +517 -27
- package/lib/types/queries.d.ts +52 -127
- package/lib/types/relationships.d.ts +0 -26
- package/lib/types/store.d.ts +347 -196
- package/lib/types/tinybase.d.ts +0 -1
- package/lib/types/tools.d.ts +15 -28
- package/lib/types/ui-react.d.ts +196 -181
- package/lib/types/with-schemas/checkpoints.d.ts +5 -32
- package/lib/types/with-schemas/common.d.ts +0 -9
- package/lib/types/with-schemas/indexes.d.ts +9 -35
- package/lib/types/with-schemas/metrics.d.ts +9 -32
- package/lib/types/with-schemas/{persister-automerge.d.ts → persisters/persister-automerge.d.ts} +4 -6
- package/lib/types/with-schemas/{persister-browser.d.ts → persisters/persister-browser.d.ts} +2 -5
- package/lib/types/with-schemas/persisters/persister-cr-sqlite-wasm.d.ts +105 -0
- package/lib/types/with-schemas/{persister-file.d.ts → persisters/persister-file.d.ts} +3 -5
- package/lib/types/with-schemas/{persister-remote.d.ts → persisters/persister-remote.d.ts} +2 -4
- package/lib/types/with-schemas/persisters/persister-sqlite-wasm.d.ts +113 -0
- package/lib/types/with-schemas/persisters/persister-sqlite3.d.ts +119 -0
- package/lib/types/with-schemas/{persister-yjs.d.ts → persisters/persister-yjs.d.ts} +4 -6
- package/lib/types/with-schemas/persisters.d.ts +534 -29
- package/lib/types/with-schemas/queries.d.ts +61 -224
- package/lib/types/with-schemas/relationships.d.ts +9 -35
- package/lib/types/with-schemas/store.d.ts +488 -239
- package/lib/types/with-schemas/tinybase.d.ts +0 -1
- package/lib/types/with-schemas/tools.d.ts +19 -32
- package/lib/types/with-schemas/ui-react.d.ts +221 -186
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/persisters/persister-automerge.js +1 -0
- package/lib/umd/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd/persisters/persister-browser.js +1 -0
- package/lib/umd/persisters/persister-browser.js.gz +0 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-file.js +1 -0
- package/lib/umd/persisters/persister-file.js.gz +0 -0
- package/lib/umd/persisters/persister-remote.js +1 -0
- package/lib/umd/persisters/persister-remote.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite3.js +1 -0
- package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd/persisters/persister-yjs.js +1 -0
- package/lib/umd/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd/persisters.js +1 -1
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-automerge.js +1 -0
- package/lib/umd-es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-browser.js +1 -0
- package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-file.js +1 -0
- package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-remote.js +1 -0
- package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js +1 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-yjs.js +1 -0
- package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd-es6/persisters.js +1 -1
- package/lib/umd-es6/persisters.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +38 -21
- package/readme.md +3 -3
- package/lib/cjs/persister-automerge.cjs +0 -1
- package/lib/cjs/persister-automerge.cjs.gz +0 -0
- package/lib/cjs/persister-browser.cjs +0 -1
- package/lib/cjs/persister-browser.cjs.gz +0 -0
- package/lib/cjs/persister-file.cjs +0 -1
- package/lib/cjs/persister-file.cjs.gz +0 -0
- package/lib/cjs/persister-remote.cjs +0 -1
- package/lib/cjs/persister-remote.cjs.gz +0 -0
- package/lib/cjs/persister-yjs.cjs +0 -1
- package/lib/cjs/persister-yjs.cjs.gz +0 -0
- package/lib/cjs-es6/persister-automerge.cjs +0 -1
- package/lib/cjs-es6/persister-automerge.cjs.gz +0 -0
- package/lib/cjs-es6/persister-browser.cjs +0 -1
- package/lib/cjs-es6/persister-browser.cjs.gz +0 -0
- package/lib/cjs-es6/persister-file.cjs +0 -1
- package/lib/cjs-es6/persister-file.cjs.gz +0 -0
- package/lib/cjs-es6/persister-remote.cjs +0 -1
- package/lib/cjs-es6/persister-remote.cjs.gz +0 -0
- package/lib/cjs-es6/persister-yjs.cjs +0 -1
- package/lib/cjs-es6/persister-yjs.cjs.gz +0 -0
- package/lib/es6/persister-automerge.js +0 -1
- package/lib/es6/persister-automerge.js.gz +0 -0
- package/lib/es6/persister-browser.js +0 -1
- package/lib/es6/persister-browser.js.gz +0 -0
- package/lib/es6/persister-file.js +0 -1
- package/lib/es6/persister-file.js.gz +0 -0
- package/lib/es6/persister-remote.js +0 -1
- package/lib/es6/persister-remote.js.gz +0 -0
- package/lib/es6/persister-yjs.js +0 -1
- package/lib/es6/persister-yjs.js.gz +0 -0
- package/lib/persister-automerge.js +0 -1
- package/lib/persister-automerge.js.gz +0 -0
- package/lib/persister-browser.js +0 -1
- package/lib/persister-browser.js.gz +0 -0
- package/lib/persister-file.js +0 -1
- package/lib/persister-file.js.gz +0 -0
- package/lib/persister-remote.js +0 -1
- package/lib/persister-remote.js.gz +0 -0
- package/lib/persister-yjs.js +0 -1
- package/lib/persister-yjs.js.gz +0 -0
- package/lib/umd/persister-automerge.js +0 -1
- package/lib/umd/persister-automerge.js.gz +0 -0
- package/lib/umd/persister-browser.js +0 -1
- package/lib/umd/persister-browser.js.gz +0 -0
- package/lib/umd/persister-file.js +0 -1
- package/lib/umd/persister-file.js.gz +0 -0
- package/lib/umd/persister-remote.js +0 -1
- package/lib/umd/persister-remote.js.gz +0 -0
- package/lib/umd/persister-yjs.js +0 -1
- package/lib/umd/persister-yjs.js.gz +0 -0
- package/lib/umd-es6/persister-automerge.js +0 -1
- package/lib/umd-es6/persister-automerge.js.gz +0 -0
- package/lib/umd-es6/persister-browser.js +0 -1
- package/lib/umd-es6/persister-browser.js.gz +0 -0
- package/lib/umd-es6/persister-file.js +0 -1
- package/lib/umd-es6/persister-file.js.gz +0 -0
- package/lib/umd-es6/persister-remote.js +0 -1
- package/lib/umd-es6/persister-remote.js.gz +0 -0
- package/lib/umd-es6/persister-yjs.js +0 -1
- package/lib/umd-es6/persister-yjs.js.gz +0 -0
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* returns a new Store. From there, you can set and get data, register
|
|
7
7
|
* listeners, and use other modules to build an entire app around the state and
|
|
8
8
|
* tabular data within.
|
|
9
|
-
*
|
|
10
9
|
* @packageDocumentation
|
|
11
10
|
* @module store
|
|
12
11
|
*/
|
|
@@ -31,7 +30,6 @@ import {Id, IdOrNull, Ids, Json} from './common.d';
|
|
|
31
30
|
* A TablesSchema comprises a JavaScript object describing each Table, in turn a
|
|
32
31
|
* nested JavaScript object containing information about each Cell and its
|
|
33
32
|
* CellSchema. It is provided to the setTablesSchema method.
|
|
34
|
-
*
|
|
35
33
|
* @example
|
|
36
34
|
* When applied to a Store, this TablesSchema only allows one Table called
|
|
37
35
|
* `pets`, in which each Row may contain a string `species` Cell, and is
|
|
@@ -63,7 +61,6 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
63
61
|
* If the default value is _not_ provided (or its type is incorrect), the Cell
|
|
64
62
|
* may be missing from the Row, but when present you can be guaranteed it is of
|
|
65
63
|
* the correct type.
|
|
66
|
-
*
|
|
67
64
|
* @example
|
|
68
65
|
* When applied to a Store, this CellSchema ensures a boolean Cell is always
|
|
69
66
|
* present, and defaults it to `false`.
|
|
@@ -84,7 +81,6 @@ export type CellSchema =
|
|
|
84
81
|
*
|
|
85
82
|
* A ValuesSchema comprises a JavaScript object describing each Value and its
|
|
86
83
|
* ValueSchema. It is provided to the setValuesSchema method.
|
|
87
|
-
*
|
|
88
84
|
* @example
|
|
89
85
|
* When applied to a Store, this ValuesSchema only allows one boolean Value
|
|
90
86
|
* called `open`, that defaults to `false`.
|
|
@@ -95,7 +91,7 @@ export type CellSchema =
|
|
|
95
91
|
* };
|
|
96
92
|
* ```
|
|
97
93
|
* @category Schema
|
|
98
|
-
* @since v3.0
|
|
94
|
+
* @since v3.0.0
|
|
99
95
|
*/
|
|
100
96
|
export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
101
97
|
|
|
@@ -113,7 +109,6 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
113
109
|
* If the default value is _not_ provided (or its type is incorrect), the Value
|
|
114
110
|
* may not be present in the Store, but when present you can be guaranteed it is
|
|
115
111
|
* of the correct type.
|
|
116
|
-
*
|
|
117
112
|
* @example
|
|
118
113
|
* When applied to a Store, this ValueSchema ensures a boolean Value is always
|
|
119
114
|
* present, and defaults it to `false`.
|
|
@@ -122,7 +117,7 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
122
117
|
* const requiredBoolean: ValueSchema = {type: 'boolean', default: false};
|
|
123
118
|
* ```
|
|
124
119
|
* @category Schema
|
|
125
|
-
* @since v3.0
|
|
120
|
+
* @since v3.0.0
|
|
126
121
|
*/
|
|
127
122
|
export type ValueSchema =
|
|
128
123
|
| {type: 'string'; default?: string}
|
|
@@ -132,7 +127,6 @@ export type ValueSchema =
|
|
|
132
127
|
/**
|
|
133
128
|
* The NoTablesSchema type is a TablesSchema-like type for when one has not been
|
|
134
129
|
* provided.
|
|
135
|
-
*
|
|
136
130
|
* @category Schema
|
|
137
131
|
*/
|
|
138
132
|
export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
@@ -140,7 +134,6 @@ export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
|
140
134
|
/**
|
|
141
135
|
* The NoValuesSchema type is a ValuesSchema-like type for when one has not been
|
|
142
136
|
* provided.
|
|
143
|
-
*
|
|
144
137
|
* @category Schema
|
|
145
138
|
*/
|
|
146
139
|
export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
@@ -148,7 +141,6 @@ export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
|
148
141
|
/**
|
|
149
142
|
* The OptionalTablesSchema type is used by generic types that can optionally
|
|
150
143
|
* take a TablesSchema.
|
|
151
|
-
*
|
|
152
144
|
* @category Schema
|
|
153
145
|
*/
|
|
154
146
|
export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
@@ -156,7 +148,6 @@ export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
|
156
148
|
/**
|
|
157
149
|
* The OptionalValuesSchema type is used by generic types that can optionally
|
|
158
150
|
* take a ValuesSchema.
|
|
159
|
-
*
|
|
160
151
|
* @category Schema
|
|
161
152
|
*/
|
|
162
153
|
export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
@@ -164,7 +155,6 @@ export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
|
164
155
|
/**
|
|
165
156
|
* The OptionalSchemas type is used by generic types that can optionally take
|
|
166
157
|
* either or both of a TablesSchema and ValuesSchema.
|
|
167
|
-
*
|
|
168
158
|
* @category Schema
|
|
169
159
|
*/
|
|
170
160
|
export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
@@ -172,7 +162,6 @@ export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
|
172
162
|
/**
|
|
173
163
|
* The NoSchemas type is used as a default by generic types that can optionally
|
|
174
164
|
* take either or both of a TablesSchema and ValuesSchema.
|
|
175
|
-
*
|
|
176
165
|
* @category Schema
|
|
177
166
|
*/
|
|
178
167
|
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
@@ -191,7 +180,6 @@ export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
|
191
180
|
* setTables method, and when getting them back out again with the getTables
|
|
192
181
|
* method. A Tables object is a regular JavaScript object containing individual
|
|
193
182
|
* Table objects, keyed by their Id.
|
|
194
|
-
*
|
|
195
183
|
* @example
|
|
196
184
|
* ```js
|
|
197
185
|
* const tables: Tables = {
|
|
@@ -231,7 +219,6 @@ export type Tables<
|
|
|
231
219
|
* getting it back out again with the getTable method. A Table object is a
|
|
232
220
|
* regular JavaScript object containing individual Row objects, keyed by their
|
|
233
221
|
* Id.
|
|
234
|
-
*
|
|
235
222
|
* @example
|
|
236
223
|
* ```js
|
|
237
224
|
* const table: Table = {
|
|
@@ -259,7 +246,6 @@ export type Table<
|
|
|
259
246
|
* A Row is used when setting a row with the setRow method, and when getting it
|
|
260
247
|
* back out again with the getRow method. A Row object is a regular JavaScript
|
|
261
248
|
* object containing individual Cell objects, keyed by their Id.
|
|
262
|
-
*
|
|
263
249
|
* @example
|
|
264
250
|
* ```js
|
|
265
251
|
* const row: Row = {species: 'dog', color: 'brown'};
|
|
@@ -304,7 +290,6 @@ export type Row<
|
|
|
304
290
|
* A Cell is used when setting a cell with the setCell method, and when getting
|
|
305
291
|
* it back out again with the getCell method. A Cell is a JavaScript string,
|
|
306
292
|
* number, or boolean.
|
|
307
|
-
*
|
|
308
293
|
* @example
|
|
309
294
|
* ```js
|
|
310
295
|
* const cell: Cell = 'dog';
|
|
@@ -337,7 +322,6 @@ export type Cell<
|
|
|
337
322
|
* This is used when describing a Cell that is present _or_ that is not present,
|
|
338
323
|
* such as when it has been deleted, or when describing a previous state where
|
|
339
324
|
* the Cell value has since been added.
|
|
340
|
-
*
|
|
341
325
|
* @category Store
|
|
342
326
|
*/
|
|
343
327
|
export type CellOrUndefined<
|
|
@@ -360,13 +344,12 @@ export type CellOrUndefined<
|
|
|
360
344
|
* when getting them back out again with the getValues method. A Values object
|
|
361
345
|
* is a regular JavaScript object containing individual Value objects, keyed by
|
|
362
346
|
* their Id.
|
|
363
|
-
*
|
|
364
347
|
* @example
|
|
365
348
|
* ```js
|
|
366
349
|
* const values: Values = {open: true, employees: 4};
|
|
367
350
|
* ```
|
|
368
351
|
* @category Store
|
|
369
|
-
* @since v3.0
|
|
352
|
+
* @since v3.0.0
|
|
370
353
|
*/
|
|
371
354
|
export type Values<
|
|
372
355
|
Schema extends OptionalValuesSchema,
|
|
@@ -403,13 +386,12 @@ export type Values<
|
|
|
403
386
|
* A Value is used when setting a value with the setValue method, and when
|
|
404
387
|
* getting it back out again with the getValue method. A Value is a JavaScript
|
|
405
388
|
* string, number, or boolean.
|
|
406
|
-
*
|
|
407
389
|
* @example
|
|
408
390
|
* ```js
|
|
409
391
|
* const value: Value = 'dog';
|
|
410
392
|
* ```
|
|
411
393
|
* @category Store
|
|
412
|
-
* @since v3.0
|
|
394
|
+
* @since v3.0.0
|
|
413
395
|
*/
|
|
414
396
|
export type Value<
|
|
415
397
|
Schema extends OptionalValuesSchema,
|
|
@@ -436,9 +418,8 @@ export type Value<
|
|
|
436
418
|
* This is used when describing a Value that is present _or_ that is not
|
|
437
419
|
* present, such as when it has been deleted, or when describing a previous
|
|
438
420
|
* state where the Value has since been added.
|
|
439
|
-
*
|
|
440
421
|
* @category Store
|
|
441
|
-
* @since v3.0
|
|
422
|
+
* @since v3.0.0
|
|
442
423
|
*/
|
|
443
424
|
export type ValueOrUndefined<
|
|
444
425
|
Schema extends OptionalValuesSchema,
|
|
@@ -461,7 +442,6 @@ export type ValueOrUndefined<
|
|
|
461
442
|
* A TableCallback is provided when using the forEachTable method, so that you
|
|
462
443
|
* can do something based on every Table in the Store. See that method for
|
|
463
444
|
* specific examples.
|
|
464
|
-
*
|
|
465
445
|
* @param tableId The Id of the Table that the callback can operate on.
|
|
466
446
|
* @param forEachRow A function that will let you iterate over the Row objects
|
|
467
447
|
* in this Table.
|
|
@@ -481,6 +461,28 @@ export type TableCallback<
|
|
|
481
461
|
Params1 extends any[] = Truncate<Params2>,
|
|
482
462
|
> = ((...params: Params2) => void) | ((...params: Params1) => void);
|
|
483
463
|
|
|
464
|
+
/**
|
|
465
|
+
* The TableCellCallback type describes a function that takes a Cell's Id and
|
|
466
|
+
* the count of times it appears across a whole Table.
|
|
467
|
+
*
|
|
468
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
469
|
+
*
|
|
470
|
+
* ```ts override
|
|
471
|
+
* (cellId: Id, count: number) => void;
|
|
472
|
+
* ```
|
|
473
|
+
*
|
|
474
|
+
* A TableCellCallback is provided when using the forEachTableCell method, so
|
|
475
|
+
* that you can do something based on every Cell used across a Table. See that
|
|
476
|
+
* method for specific examples.
|
|
477
|
+
* @param cellId The Id of the Cell that the callback can operate on.
|
|
478
|
+
* @param count The number of times this Cell is used across a whole Table.
|
|
479
|
+
* @category Callback
|
|
480
|
+
*/
|
|
481
|
+
export type TableCellCallback<
|
|
482
|
+
Schema extends OptionalTablesSchema,
|
|
483
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
484
|
+
> = (cellId: CellIdFromSchema<Schema, TableId>, count: number) => void;
|
|
485
|
+
|
|
484
486
|
/**
|
|
485
487
|
* The RowCallback type describes a function that takes a Row's Id and a
|
|
486
488
|
* callback to loop over each Cell within it.
|
|
@@ -497,7 +499,6 @@ export type TableCallback<
|
|
|
497
499
|
* A RowCallback is provided when using the forEachRow method, so that you can
|
|
498
500
|
* do something based on every Row in a Table. See that method for specific
|
|
499
501
|
* examples.
|
|
500
|
-
*
|
|
501
502
|
* @param rowId The Id of the Row that the callback can operate on.
|
|
502
503
|
* @param forEachRow A function that will let you iterate over the Cell values
|
|
503
504
|
* in this Row.
|
|
@@ -528,7 +529,6 @@ export type RowCallback<
|
|
|
528
529
|
* A CellCallback is provided when using the forEachCell method, so that you can
|
|
529
530
|
* do something based on every Cell in a Row. See that method for specific
|
|
530
531
|
* examples.
|
|
531
|
-
*
|
|
532
532
|
* @param cellId The Id of the Cell that the callback can operate on.
|
|
533
533
|
* @param cell The value of the Cell.
|
|
534
534
|
* @category Callback
|
|
@@ -566,11 +566,10 @@ export type CellCallback<
|
|
|
566
566
|
* A ValueCallback is provided when using the forEachValue method, so that you
|
|
567
567
|
* can do something based on every Value in a Store. See that method for
|
|
568
568
|
* specific examples.
|
|
569
|
-
*
|
|
570
569
|
* @param valueId The Id of the Value that the callback can operate on.
|
|
571
570
|
* @param value The Value itself.
|
|
572
571
|
* @category Callback
|
|
573
|
-
* @since v3.0
|
|
572
|
+
* @since v3.0.0
|
|
574
573
|
*/
|
|
575
574
|
export type ValueCallback<
|
|
576
575
|
Schema extends OptionalValuesSchema,
|
|
@@ -600,7 +599,6 @@ export type ValueCallback<
|
|
|
600
599
|
* A MapCell can be provided in the setCell method to map an existing value to a
|
|
601
600
|
* new one, such as when incrementing a number. See that method for specific
|
|
602
601
|
* examples.
|
|
603
|
-
*
|
|
604
602
|
* @param cell The current value of the Cell to map to a new value.
|
|
605
603
|
* @category Callback
|
|
606
604
|
*/
|
|
@@ -625,10 +623,9 @@ export type MapCell<
|
|
|
625
623
|
* A MapValue can be provided in the setValue method to map an existing Value to
|
|
626
624
|
* a new one, such as when incrementing a number. See that method for specific
|
|
627
625
|
* examples.
|
|
628
|
-
*
|
|
629
626
|
* @param value The current Value to map to a new Value.
|
|
630
627
|
* @category Callback
|
|
631
|
-
* @since v3.0
|
|
628
|
+
* @since v3.0.0
|
|
632
629
|
*/
|
|
633
630
|
export type MapValue<
|
|
634
631
|
Schema extends OptionalValuesSchema,
|
|
@@ -648,7 +645,6 @@ export type MapValue<
|
|
|
648
645
|
* A GetCell can be provided when setting definitions, as in the
|
|
649
646
|
* setMetricDefinition method of a Metrics object, or the setIndexDefinition
|
|
650
647
|
* method of an Indexes object. See those methods for specific examples.
|
|
651
|
-
*
|
|
652
648
|
* @param cellId The Id of the Cell to fetch the value for.
|
|
653
649
|
* @category Callback
|
|
654
650
|
*/
|
|
@@ -795,7 +791,6 @@ export type ChangedValueIds<Schema extends OptionalValuesSchema> = {
|
|
|
795
791
|
* call to get information about the changes made within the transaction (in
|
|
796
792
|
* order to decide whether to do the rollback). See the GetTransactionChanges
|
|
797
793
|
* and GetTransactionLog function types for more details.
|
|
798
|
-
*
|
|
799
794
|
* @param getTransactionChanges A function to be called to get the changes made
|
|
800
795
|
* to the Store during the transaction, since v4.0.
|
|
801
796
|
* @param getTransactionChanges A function to be called to get a more detailed
|
|
@@ -829,7 +824,6 @@ export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
|
829
824
|
* and, since v4.0, two functions that you can call to get information about the
|
|
830
825
|
* changes made within the transaction. See the GetTransactionChanges and
|
|
831
826
|
* GetTransactionLog function types for more details.
|
|
832
|
-
*
|
|
833
827
|
* @param store A reference to the Store that is completing a transaction.
|
|
834
828
|
* @param getTransactionChanges A function to be called to get the changes made
|
|
835
829
|
* to the Store during the transaction, since v4.0.
|
|
@@ -866,7 +860,6 @@ export type TransactionListener<Schemas extends OptionalSchemas> = (
|
|
|
866
860
|
* Note that if the listener was manually forced to be called (with the
|
|
867
861
|
* callListener method rather than due to a real change in the Store), the
|
|
868
862
|
* GetCellChange function will not be present.
|
|
869
|
-
*
|
|
870
863
|
* @param store A reference to the Store that changed.
|
|
871
864
|
* @param getCellChange A function that returns information about any Cell's
|
|
872
865
|
* changes.
|
|
@@ -884,7 +877,10 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
884
877
|
* This has schema-based typing. The following is a simplified representation:
|
|
885
878
|
*
|
|
886
879
|
* ```ts override
|
|
887
|
-
* (
|
|
880
|
+
* (
|
|
881
|
+
* store: Store,
|
|
882
|
+
* getIdChanges: GetIdChanges | undefined,
|
|
883
|
+
* ) => void;
|
|
888
884
|
* ```
|
|
889
885
|
*
|
|
890
886
|
* A TableIdsListener is provided when using the addTableIdsListener method. See
|
|
@@ -892,11 +888,16 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
892
888
|
*
|
|
893
889
|
* When called, a TableIdsListener is given a reference to the Store.
|
|
894
890
|
*
|
|
891
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
892
|
+
* used to query which Ids changed during the transaction.
|
|
895
893
|
* @param store A reference to the Store that changed.
|
|
894
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
895
|
+
* since v3.3.
|
|
896
896
|
* @category Listener
|
|
897
897
|
*/
|
|
898
898
|
export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
899
899
|
store: Store<Schemas>,
|
|
900
|
+
getIdChanges: GetIdChanges<TableIdFromSchema<Schemas[0]>> | undefined,
|
|
900
901
|
) => void;
|
|
901
902
|
|
|
902
903
|
/**
|
|
@@ -923,7 +924,6 @@ export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
923
924
|
* Note that if the listener was manually forced to be called (with the
|
|
924
925
|
* callListener method rather than due to a real change in the Store), the
|
|
925
926
|
* GetCellChange function will not be present.
|
|
926
|
-
*
|
|
927
927
|
* @param store A reference to the Store that changed.
|
|
928
928
|
* @param tableId The Id of the Table that changed.
|
|
929
929
|
* @param getCellChange A function that returns information about any Cell's
|
|
@@ -941,6 +941,56 @@ export type TableListener<
|
|
|
941
941
|
getCellChange: GetCellChange<Schemas[0]> | undefined,
|
|
942
942
|
) => void;
|
|
943
943
|
|
|
944
|
+
/**
|
|
945
|
+
* The TableCellIdsListener type describes a function that is used to listen to
|
|
946
|
+
* changes to the Cell Ids that appear anywhere in a Table.
|
|
947
|
+
*
|
|
948
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
949
|
+
*
|
|
950
|
+
* ```ts override
|
|
951
|
+
* (
|
|
952
|
+
* store: Store,
|
|
953
|
+
* tableId: Id,
|
|
954
|
+
* getIdChanges: GetIdChanges | undefined,
|
|
955
|
+
* ) => void;
|
|
956
|
+
* ```
|
|
957
|
+
*
|
|
958
|
+
* A TableCellIdsListener is provided when using the addTableCellIdsListener
|
|
959
|
+
* method. See that method for specific examples.
|
|
960
|
+
*
|
|
961
|
+
* When called, a TableCellIdsListener is given a reference to the Store, the Id
|
|
962
|
+
* of the Table whose Cell Ids changed, and a GetIdChanges function that can be
|
|
963
|
+
* used to query which Ids changed during the transaction.
|
|
964
|
+
* @param store A reference to the Store that changed.
|
|
965
|
+
* @param tableId The Id of the Table that changed.
|
|
966
|
+
* @param getIdChanges A function that returns information about the Id changes.
|
|
967
|
+
* @category Listener
|
|
968
|
+
* @since v3.3.0
|
|
969
|
+
*/
|
|
970
|
+
export type TableCellIdsListener<
|
|
971
|
+
Schemas extends OptionalSchemas,
|
|
972
|
+
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
973
|
+
Params extends any[] = (
|
|
974
|
+
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
975
|
+
) extends infer TableId
|
|
976
|
+
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
977
|
+
? [
|
|
978
|
+
store: Store<Schemas>,
|
|
979
|
+
tableId: TableId,
|
|
980
|
+
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
981
|
+
]
|
|
982
|
+
: never
|
|
983
|
+
: never,
|
|
984
|
+
Params3 extends any[] =
|
|
985
|
+
| Params
|
|
986
|
+
| [store: never, tableId: never, getIdChanges: never],
|
|
987
|
+
Params2 extends any[] = Truncate<Params3>,
|
|
988
|
+
// Params1 extends any[] = Truncate<Params2>,
|
|
989
|
+
> = Params extends any
|
|
990
|
+
? ((...params: Params3) => void) | ((...params: Params2) => void)
|
|
991
|
+
: // | ((...params: Params1) => void)
|
|
992
|
+
never;
|
|
993
|
+
|
|
944
994
|
/**
|
|
945
995
|
* The RowIdsListener type describes a function that is used to listen to
|
|
946
996
|
* changes to the Row Ids in a Table.
|
|
@@ -948,7 +998,11 @@ export type TableListener<
|
|
|
948
998
|
* This has schema-based typing. The following is a simplified representation:
|
|
949
999
|
*
|
|
950
1000
|
* ```ts override
|
|
951
|
-
* (
|
|
1001
|
+
* (
|
|
1002
|
+
* store: Store,
|
|
1003
|
+
* tableId: Id,
|
|
1004
|
+
* getIdChanges: GetIdChanges | undefined,
|
|
1005
|
+
* ) => void;
|
|
952
1006
|
* ```
|
|
953
1007
|
*
|
|
954
1008
|
* A RowIdsListener is provided when using the addRowIdsListener method. See
|
|
@@ -957,8 +1011,12 @@ export type TableListener<
|
|
|
957
1011
|
* When called, a RowIdsListener is given a reference to the Store, and the Id
|
|
958
1012
|
* of the Table whose Row Ids changed.
|
|
959
1013
|
*
|
|
1014
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
1015
|
+
* used to query which Ids changed during the transaction.
|
|
960
1016
|
* @param store A reference to the Store that changed.
|
|
961
1017
|
* @param tableId The Id of the Table that changed.
|
|
1018
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
1019
|
+
* since v3.3.
|
|
962
1020
|
* @category Listener
|
|
963
1021
|
*/
|
|
964
1022
|
export type RowIdsListener<
|
|
@@ -969,6 +1027,7 @@ export type RowIdsListener<
|
|
|
969
1027
|
tableId: TableIdOrNull extends null
|
|
970
1028
|
? TableIdFromSchema<Schemas[0]>
|
|
971
1029
|
: TableIdOrNull,
|
|
1030
|
+
getIdChanges: GetIdChanges<Id> | undefined,
|
|
972
1031
|
) => void;
|
|
973
1032
|
|
|
974
1033
|
/**
|
|
@@ -998,7 +1057,6 @@ export type RowIdsListener<
|
|
|
998
1057
|
* Ids returned, for pagination purposes. It also receives the sorted array of
|
|
999
1058
|
* Ids itself, so that you can use them in the listener without the additional
|
|
1000
1059
|
* cost of an explicit call to getSortedRowIds.
|
|
1001
|
-
*
|
|
1002
1060
|
* @param store A reference to the Store that changed.
|
|
1003
1061
|
* @param tableId The Id of the Table whose sorted Row Ids changed.
|
|
1004
1062
|
* @param cellId The Id of the Cell whose values were used for the sorting.
|
|
@@ -1007,7 +1065,7 @@ export type RowIdsListener<
|
|
|
1007
1065
|
* @param limit The maximum number of Row Ids returned.
|
|
1008
1066
|
* @param sortedRowIds The sorted Row Ids themselves.
|
|
1009
1067
|
* @category Listener
|
|
1010
|
-
* @since v2.0
|
|
1068
|
+
* @since v2.0.0
|
|
1011
1069
|
*/
|
|
1012
1070
|
export type SortedRowIdsListener<
|
|
1013
1071
|
Schemas extends OptionalSchemas,
|
|
@@ -1052,7 +1110,6 @@ export type SortedRowIdsListener<
|
|
|
1052
1110
|
* Note that if the listener was manually forced to be called (with the
|
|
1053
1111
|
* callListener method rather than due to a real change in the Store), the
|
|
1054
1112
|
* GetCellChange function will not be present.
|
|
1055
|
-
*
|
|
1056
1113
|
* @param store A reference to the Store that changed.
|
|
1057
1114
|
* @param tableId The Id of the Table that changed.
|
|
1058
1115
|
* @param rowId The Id of the Row that changed.
|
|
@@ -1080,7 +1137,12 @@ export type RowListener<
|
|
|
1080
1137
|
* This has schema-based typing. The following is a simplified representation:
|
|
1081
1138
|
*
|
|
1082
1139
|
* ```ts override
|
|
1083
|
-
* (
|
|
1140
|
+
* (
|
|
1141
|
+
* store: Store,
|
|
1142
|
+
* tableId: Id,
|
|
1143
|
+
* rowId: Id,
|
|
1144
|
+
* getIdChanges: GetIdChanges | undefined,
|
|
1145
|
+
* ) => void;
|
|
1084
1146
|
* ```
|
|
1085
1147
|
*
|
|
1086
1148
|
* A CellIdsListener is provided when using the addCellIdsListener method. See
|
|
@@ -1089,22 +1151,42 @@ export type RowListener<
|
|
|
1089
1151
|
* When called, a CellIdsListener is given a reference to the Store, the Id of
|
|
1090
1152
|
* the Table that changed, and the Id of the Row whose Cell Ids changed.
|
|
1091
1153
|
*
|
|
1154
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
1155
|
+
* used to query which Ids changed during the transaction.
|
|
1092
1156
|
* @param store A reference to the Store that changed.
|
|
1093
1157
|
* @param tableId The Id of the Table that changed.
|
|
1094
1158
|
* @param rowId The Id of the Row that changed.
|
|
1159
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
1160
|
+
* since v3.3.
|
|
1095
1161
|
* @category Listener
|
|
1096
1162
|
*/
|
|
1097
1163
|
export type CellIdsListener<
|
|
1098
1164
|
Schemas extends OptionalSchemas,
|
|
1099
1165
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1100
1166
|
RowIdOrNull extends IdOrNull,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
? TableIdFromSchema<Schemas[0]>
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1167
|
+
Params extends any[] = (
|
|
1168
|
+
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1169
|
+
) extends infer TableId
|
|
1170
|
+
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
1171
|
+
? [
|
|
1172
|
+
store: Store<Schemas>,
|
|
1173
|
+
tableId: TableId,
|
|
1174
|
+
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1175
|
+
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
1176
|
+
]
|
|
1177
|
+
: never
|
|
1178
|
+
: never,
|
|
1179
|
+
Params4 extends any[] =
|
|
1180
|
+
| Params
|
|
1181
|
+
| [store: never, tableId: never, rowId: never, getIdChanges: never],
|
|
1182
|
+
Params3 extends any[] = Truncate<Params4>,
|
|
1183
|
+
// Params2 extends any[] = Truncate<Params3>,
|
|
1184
|
+
// Params1 extends any[] = Truncate<Params2>,
|
|
1185
|
+
> = Params extends any
|
|
1186
|
+
? ((...params: Params4) => void) | ((...params: Params3) => void)
|
|
1187
|
+
: // | ((...params: Params2) => void)
|
|
1188
|
+
// | ((...params: Params1) => void)
|
|
1189
|
+
never;
|
|
1108
1190
|
|
|
1109
1191
|
/**
|
|
1110
1192
|
* The CellListener type describes a function that is used to listen to changes
|
|
@@ -1137,7 +1219,6 @@ export type CellIdsListener<
|
|
|
1137
1219
|
* callListener method rather than due to a real change in the Store), the
|
|
1138
1220
|
* GetCellChange function will not be present and the new and old values of the
|
|
1139
1221
|
* Cell will be the same.
|
|
1140
|
-
*
|
|
1141
1222
|
* @param store A reference to the Store that changed.
|
|
1142
1223
|
* @param tableId The Id of the Table that changed.
|
|
1143
1224
|
* @param rowId The Id of the Row that changed.
|
|
@@ -1233,7 +1314,6 @@ export type CellListener<
|
|
|
1233
1314
|
* Note that if the listener was manually forced to be called (with the
|
|
1234
1315
|
* callListener method rather than due to a real change in the Store), the
|
|
1235
1316
|
* GetValueChange function will not be present.
|
|
1236
|
-
*
|
|
1237
1317
|
* @param store A reference to the Store that changed.
|
|
1238
1318
|
* @param getValueChange A function that returns information about any Value's
|
|
1239
1319
|
* changes.
|
|
@@ -1251,7 +1331,10 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1251
1331
|
* This has schema-based typing. The following is a simplified representation:
|
|
1252
1332
|
*
|
|
1253
1333
|
* ```ts override
|
|
1254
|
-
* (
|
|
1334
|
+
* (
|
|
1335
|
+
* store: Store,
|
|
1336
|
+
* getIdChanges: GetIdChanges | undefined,
|
|
1337
|
+
* ) => void;
|
|
1255
1338
|
* ```
|
|
1256
1339
|
*
|
|
1257
1340
|
* A ValueIdsListener is provided when using the addValueIdsListener method. See
|
|
@@ -1259,11 +1342,16 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1259
1342
|
*
|
|
1260
1343
|
* When called, a ValueIdsListener is given a reference to the Store.
|
|
1261
1344
|
*
|
|
1345
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
1346
|
+
* used to query which Ids changed during the transaction.
|
|
1262
1347
|
* @param store A reference to the Store that changed.
|
|
1348
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
1349
|
+
* since v3.3.
|
|
1263
1350
|
* @category Listener
|
|
1264
1351
|
*/
|
|
1265
1352
|
export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
1266
1353
|
store: Store<Schemas>,
|
|
1354
|
+
getIdChanges: GetIdChanges<ValueIdFromSchema<Schemas[1]>> | undefined,
|
|
1267
1355
|
) => void;
|
|
1268
1356
|
|
|
1269
1357
|
/**
|
|
@@ -1294,7 +1382,6 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1294
1382
|
* callListener method rather than due to a real change in the Store), the
|
|
1295
1383
|
* GetValueChange function will not be present and the new and old values of the
|
|
1296
1384
|
* Value will be the same.
|
|
1297
|
-
*
|
|
1298
1385
|
* @param store A reference to the Store that changed.
|
|
1299
1386
|
* @param valueId The Id of the Value that changed.
|
|
1300
1387
|
* @param newValue The new value of the Value that changed.
|
|
@@ -1302,7 +1389,7 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1302
1389
|
* @param getValueChange A function that returns information about any Value's
|
|
1303
1390
|
* changes.
|
|
1304
1391
|
* @category Listener
|
|
1305
|
-
* @since v3.0
|
|
1392
|
+
* @since v3.0.0
|
|
1306
1393
|
*/
|
|
1307
1394
|
export type ValueListener<
|
|
1308
1395
|
Schemas extends OptionalSchemas,
|
|
@@ -1367,14 +1454,13 @@ export type ValueListener<
|
|
|
1367
1454
|
* have been of absolutely any type. Since there could have been multiple failed
|
|
1368
1455
|
* attempts to set the Cell within a single transaction, this is an array
|
|
1369
1456
|
* containing each attempt, chronologically.
|
|
1370
|
-
*
|
|
1371
1457
|
* @param store A reference to the Store that was being changed.
|
|
1372
1458
|
* @param tableId The Id of the Table that was being changed.
|
|
1373
1459
|
* @param rowId The Id of the Row that was being changed.
|
|
1374
1460
|
* @param cellId The Id of the Cell that was being changed.
|
|
1375
1461
|
* @param invalidCells An array of the values of the Cell that were invalid.
|
|
1376
1462
|
* @category Listener
|
|
1377
|
-
* @since v1.1
|
|
1463
|
+
* @since v1.1.0
|
|
1378
1464
|
*/
|
|
1379
1465
|
export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
1380
1466
|
store: Store<Schemas>,
|
|
@@ -1407,12 +1493,11 @@ export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
|
1407
1493
|
* Since there could have been multiple failed attempts to set the Value within
|
|
1408
1494
|
* a single transaction, this is an array containing each attempt,
|
|
1409
1495
|
* chronologically.
|
|
1410
|
-
*
|
|
1411
1496
|
* @param store A reference to the Store that was being changed.
|
|
1412
1497
|
* @param valueId The Id of the Value that was being changed.
|
|
1413
1498
|
* @param invalidValues An array of the Values that were invalid.
|
|
1414
1499
|
* @category Listener
|
|
1415
|
-
* @since v3.0
|
|
1500
|
+
* @since v3.0.0
|
|
1416
1501
|
*/
|
|
1417
1502
|
export type InvalidValueListener<Schemas extends OptionalSchemas> = (
|
|
1418
1503
|
store: Store<Schemas>,
|
|
@@ -1420,6 +1505,24 @@ export type InvalidValueListener<Schemas extends OptionalSchemas> = (
|
|
|
1420
1505
|
invalidValues: any[],
|
|
1421
1506
|
) => void;
|
|
1422
1507
|
|
|
1508
|
+
/**
|
|
1509
|
+
* The GetIdChanges type describes a function that returns information about the
|
|
1510
|
+
* changes to a set of Ids during a transaction.
|
|
1511
|
+
*
|
|
1512
|
+
* A GetIdChanges function is provided to every listener when called due Ids in
|
|
1513
|
+
* the Store changing. It returns an object where each key is an Id that
|
|
1514
|
+
* changed. The listener can then easily identify which Ids have been added
|
|
1515
|
+
* (those with the value `1`), and which have been removed (those with the value
|
|
1516
|
+
* `-1`).
|
|
1517
|
+
* @returns An object keyed by Id with a numerical value. 1 means the Id was
|
|
1518
|
+
* added, and 1 means it was removed.
|
|
1519
|
+
* @category Listener
|
|
1520
|
+
* @since v3.3.0
|
|
1521
|
+
*/
|
|
1522
|
+
export type GetIdChanges<ValidId extends Id> = () => {
|
|
1523
|
+
[Id in ValidId]?: 1 | -1;
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1423
1526
|
/**
|
|
1424
1527
|
* The GetCellChange type describes a function that returns information about
|
|
1425
1528
|
* any Cell's changes during a transaction.
|
|
@@ -1434,7 +1537,6 @@ export type InvalidValueListener<Schemas extends OptionalSchemas> = (
|
|
|
1434
1537
|
* Store changing. The listener can then fetch the previous value of a Cell
|
|
1435
1538
|
* before the current transaction, the new value after it, and a convenience
|
|
1436
1539
|
* flag that indicates that the value has changed.
|
|
1437
|
-
*
|
|
1438
1540
|
* @param tableId The Id of the Table to inspect.
|
|
1439
1541
|
* @param rowId The Id of the Row to inspect.
|
|
1440
1542
|
* @param cellId The Id of the Cell to inspect.
|
|
@@ -1467,7 +1569,6 @@ export type GetCellChange<Schema extends OptionalTablesSchema> = <
|
|
|
1467
1569
|
* listener when called. This array contains the previous value of a Cell before
|
|
1468
1570
|
* the current transaction, the new value after it, and a convenience flag that
|
|
1469
1571
|
* indicates that the value has changed.
|
|
1470
|
-
*
|
|
1471
1572
|
* @category Listener
|
|
1472
1573
|
*/
|
|
1473
1574
|
export type CellChange<
|
|
@@ -1491,7 +1592,6 @@ export type CellChange<
|
|
|
1491
1592
|
* Store changing. The listener can then fetch the previous value of a Value
|
|
1492
1593
|
* before the current transaction, the new value after it, and a convenience
|
|
1493
1594
|
* flag that indicates that the value has changed.
|
|
1494
|
-
*
|
|
1495
1595
|
* @param valueId The Id of the Value to inspect.
|
|
1496
1596
|
* @returns A ValueChange array containing information about the Value's
|
|
1497
1597
|
* changes.
|
|
@@ -1520,7 +1620,6 @@ export type GetValueChange<Schema extends OptionalValuesSchema> = <
|
|
|
1520
1620
|
* listener when called. This array contains the previous value of a Value
|
|
1521
1621
|
* before the current transaction, the new value after it, and a convenience
|
|
1522
1622
|
* flag that indicates that the value has changed.
|
|
1523
|
-
*
|
|
1524
1623
|
* @category Listener
|
|
1525
1624
|
*/
|
|
1526
1625
|
export type ValueChange<
|
|
@@ -1558,9 +1657,8 @@ export type ValueChange<
|
|
|
1558
1657
|
* two-part array will never contain two items of the same value (including two
|
|
1559
1658
|
* `undefined` values), even if, during the transaction, a Cell was changed to a
|
|
1560
1659
|
* different value and then changed back.
|
|
1561
|
-
*
|
|
1562
1660
|
* @category Transaction
|
|
1563
|
-
* @since v1.2
|
|
1661
|
+
* @since v1.2.0
|
|
1564
1662
|
*/
|
|
1565
1663
|
export type ChangedCells<Schema extends OptionalTablesSchema> = {
|
|
1566
1664
|
[TableId in TableIdFromSchema<Schema>]?: {
|
|
@@ -1596,9 +1694,8 @@ export type ChangedCells<Schema extends OptionalTablesSchema> = {
|
|
|
1596
1694
|
* two-part array will never contain two items of the same value (including two
|
|
1597
1695
|
* `undefined` values), even if, during the transaction, a Cell was changed to a
|
|
1598
1696
|
* different value and then changed back.
|
|
1599
|
-
*
|
|
1600
1697
|
* @category Transaction
|
|
1601
|
-
* @since v1.2
|
|
1698
|
+
* @since v1.2.0
|
|
1602
1699
|
*/
|
|
1603
1700
|
export type ChangedCell<
|
|
1604
1701
|
Schema extends OptionalTablesSchema,
|
|
@@ -1622,9 +1719,8 @@ export type ChangedCell<
|
|
|
1622
1719
|
* the Tables object, but one for which Cell values are listed in array (much
|
|
1623
1720
|
* like the InvalidCellListener type) so that multiple failed attempts to change
|
|
1624
1721
|
* a Cell during the transaction are described.
|
|
1625
|
-
*
|
|
1626
1722
|
* @category Transaction
|
|
1627
|
-
* @since v1.2
|
|
1723
|
+
* @since v1.2.0
|
|
1628
1724
|
*/
|
|
1629
1725
|
export type InvalidCells = {
|
|
1630
1726
|
[tableId: Id]: {[rowId: Id]: {[cellId: Id]: any[]}};
|
|
@@ -1658,9 +1754,8 @@ export type InvalidCells = {
|
|
|
1658
1754
|
* array will never contain two items of the same value (including two
|
|
1659
1755
|
* `undefined` values), even if, during the transaction, a Value was changed to
|
|
1660
1756
|
* a different value and then changed back.
|
|
1661
|
-
*
|
|
1662
1757
|
* @category Transaction
|
|
1663
|
-
* @since v3.0
|
|
1758
|
+
* @since v3.0.0
|
|
1664
1759
|
*/
|
|
1665
1760
|
export type ChangedValues<Schema extends OptionalValuesSchema> = {
|
|
1666
1761
|
[ValueId in ValueIdFromSchema<Schema>]?: ChangedValue<Schema, ValueId>;
|
|
@@ -1688,9 +1783,8 @@ export type ChangedValues<Schema extends OptionalValuesSchema> = {
|
|
|
1688
1783
|
* array will never contain two items of the same value (including two
|
|
1689
1784
|
* `undefined` values), even if, during the transaction, a Value was changed to
|
|
1690
1785
|
* a different value and then changed back.
|
|
1691
|
-
*
|
|
1692
1786
|
* @category Transaction
|
|
1693
|
-
* @since v3.0
|
|
1787
|
+
* @since v3.0.0
|
|
1694
1788
|
*/
|
|
1695
1789
|
export type ChangedValue<
|
|
1696
1790
|
Schema extends OptionalValuesSchema,
|
|
@@ -1712,9 +1806,8 @@ export type ChangedValue<
|
|
|
1712
1806
|
* This type is an object containing each invalid Value's attempt listed in
|
|
1713
1807
|
* array (much like the InvalidValueListener type) so that multiple failed
|
|
1714
1808
|
* attempts to change a Value during the transaction are described.
|
|
1715
|
-
*
|
|
1716
1809
|
* @category Transaction
|
|
1717
|
-
* @since v3.0
|
|
1810
|
+
* @since v3.0.0
|
|
1718
1811
|
*/
|
|
1719
1812
|
export type InvalidValues = {[valueId: Id]: any[]};
|
|
1720
1813
|
|
|
@@ -1754,9 +1847,8 @@ export type TransactionChanges<Schemas extends OptionalSchemas> = [
|
|
|
1754
1847
|
* It is provided to the DoRollback callback and to a TransactionListener
|
|
1755
1848
|
* listener when a transaction completes. See the TransactionChanges type for
|
|
1756
1849
|
* more information and an example of the returned data structure.
|
|
1757
|
-
*
|
|
1758
1850
|
* @category Transaction
|
|
1759
|
-
* @since v4.0
|
|
1851
|
+
* @since v4.0.0
|
|
1760
1852
|
*/
|
|
1761
1853
|
export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
1762
1854
|
() => TransactionChanges<Schemas>;
|
|
@@ -1799,9 +1891,8 @@ export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
|
1799
1891
|
* all changes have been reverted.
|
|
1800
1892
|
*
|
|
1801
1893
|
* See the documentation for the types of the inner objects for other details.
|
|
1802
|
-
*
|
|
1803
1894
|
* @category Transaction
|
|
1804
|
-
* @since v4.0
|
|
1895
|
+
* @since v4.0.0
|
|
1805
1896
|
*/
|
|
1806
1897
|
export type TransactionLog<Schemas extends OptionalSchemas> = {
|
|
1807
1898
|
cellsTouched: boolean;
|
|
@@ -1829,9 +1920,8 @@ export type TransactionLog<Schemas extends OptionalSchemas> = {
|
|
|
1829
1920
|
* It is provided to the DoRollback callback and to a TransactionListener
|
|
1830
1921
|
* listener when a transaction completes. See the TransactionLog type for more
|
|
1831
1922
|
* information.
|
|
1832
|
-
*
|
|
1833
1923
|
* @category Transaction
|
|
1834
|
-
* @since v4.0
|
|
1924
|
+
* @since v4.0.0
|
|
1835
1925
|
*/
|
|
1836
1926
|
export type GetTransactionLog<Schemas extends OptionalSchemas> =
|
|
1837
1927
|
() => TransactionLog<Schemas>;
|
|
@@ -1844,7 +1934,6 @@ export type GetTransactionLog<Schemas extends OptionalSchemas> =
|
|
|
1844
1934
|
* listener. Totals include both mutator and non-mutator listeners. A
|
|
1845
1935
|
* StoreListenerStats object is returned from the getListenerStats method, and
|
|
1846
1936
|
* is only populated in a debug build.
|
|
1847
|
-
*
|
|
1848
1937
|
* @category Development
|
|
1849
1938
|
*/
|
|
1850
1939
|
export type StoreListenerStats = {
|
|
@@ -1860,6 +1949,11 @@ export type StoreListenerStats = {
|
|
|
1860
1949
|
* The number of TableListener functions registered with the Store.
|
|
1861
1950
|
*/
|
|
1862
1951
|
table?: number;
|
|
1952
|
+
/**
|
|
1953
|
+
* The number of TableCellIdsListener functions registered with the Store,
|
|
1954
|
+
* since v3.3.
|
|
1955
|
+
*/
|
|
1956
|
+
tableCellIds?: number;
|
|
1863
1957
|
/**
|
|
1864
1958
|
* The number of RowIdsListener functions registered with the Store.
|
|
1865
1959
|
*/
|
|
@@ -2000,6 +2094,7 @@ export type StoreListenerStats = {
|
|
|
2000
2094
|
* |Tables|getTables|setTables|delTables|addTablesListener|
|
|
2001
2095
|
* |Table Ids|getTableIds|-|-|addTableIdsListener|
|
|
2002
2096
|
* |Table|getTable|setTable|delTable|addTableListener|
|
|
2097
|
+
* |Table Cell Ids|getTableCellIds|-|-|addTableCellIdsListener|
|
|
2003
2098
|
* |Row Ids|getRowIds|-|-|addRowIdsListener|
|
|
2004
2099
|
* |Row Ids (sorted)|getSortedRowIds|-|-|addSortedRowIdsListener|
|
|
2005
2100
|
* |Row|getRow|setRow|delRow|addRowListener|
|
|
@@ -2060,7 +2155,6 @@ export type StoreListenerStats = {
|
|
|
2060
2155
|
*
|
|
2061
2156
|
* Finally, the getListenerStats method describes the current state of the
|
|
2062
2157
|
* Store's listeners for debugging purposes.
|
|
2063
|
-
*
|
|
2064
2158
|
* @example
|
|
2065
2159
|
* This example shows a very simple lifecycle of a Store: from creation, to
|
|
2066
2160
|
* adding and getting some data, and then registering and removing a listener.
|
|
@@ -2103,7 +2197,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2103
2197
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
2104
2198
|
* data, so changes made to the returned objects are not made to the Store
|
|
2105
2199
|
* itself.
|
|
2106
|
-
*
|
|
2107
2200
|
* @returns An array of a Tables object and a Values object.
|
|
2108
2201
|
* @example
|
|
2109
2202
|
* This example retrieves the content of a Store.
|
|
@@ -2125,7 +2218,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2125
2218
|
* // -> [{}, {}]
|
|
2126
2219
|
* ```
|
|
2127
2220
|
* @category Getter
|
|
2128
|
-
* @since v4.0
|
|
2221
|
+
* @since v4.0.0
|
|
2129
2222
|
*/
|
|
2130
2223
|
getContent(): [Tables<Schemas[0]>, Values<Schemas[1]>];
|
|
2131
2224
|
|
|
@@ -2142,7 +2235,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2142
2235
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
2143
2236
|
* data, so changes made to the returned object are not made to the Store
|
|
2144
2237
|
* itself.
|
|
2145
|
-
*
|
|
2146
2238
|
* @returns A Tables object containing the tabular data of the Store.
|
|
2147
2239
|
* @example
|
|
2148
2240
|
* This example retrieves the tabular data in a Store.
|
|
@@ -2179,7 +2271,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2179
2271
|
*
|
|
2180
2272
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
2181
2273
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
2182
|
-
*
|
|
2183
2274
|
* @returns An array of the Ids of every Table in the Store.
|
|
2184
2275
|
* @example
|
|
2185
2276
|
* This example retrieves the Table Ids in a Store.
|
|
@@ -2218,7 +2309,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2218
2309
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
2219
2310
|
* data, so changes made to the returned object are not made to the Store
|
|
2220
2311
|
* itself.
|
|
2221
|
-
*
|
|
2222
2312
|
* @param tableId The Id of the Table in the Store.
|
|
2223
2313
|
* @returns An object containing the entire data of the Table.
|
|
2224
2314
|
* @example
|
|
@@ -2247,6 +2337,50 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2247
2337
|
tableId: TableId,
|
|
2248
2338
|
): Table<Schemas[0], TableId>;
|
|
2249
2339
|
|
|
2340
|
+
/**
|
|
2341
|
+
* The getTableCellIds method returns the Ids of every Cell used across the
|
|
2342
|
+
* whole Table.
|
|
2343
|
+
*
|
|
2344
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
2345
|
+
*
|
|
2346
|
+
* ```ts override
|
|
2347
|
+
* getTableCellIds(tableId: Id): Ids;
|
|
2348
|
+
* ```
|
|
2349
|
+
*
|
|
2350
|
+
* Note that this returns a copy of, rather than a reference, to the list of
|
|
2351
|
+
* Ids, so changes made to the list are not made to the Store itself.
|
|
2352
|
+
* @param tableId The Id of the Table in the Store.
|
|
2353
|
+
* @returns An array of the Ids of every Cell used across the whole Table.
|
|
2354
|
+
* @example
|
|
2355
|
+
* This example retrieves the Cell Ids used across a whole Table.
|
|
2356
|
+
*
|
|
2357
|
+
* ```js
|
|
2358
|
+
* const store = createStore().setTables({
|
|
2359
|
+
* pets: {
|
|
2360
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
2361
|
+
* felix: {species: 'cat', legs: 4},
|
|
2362
|
+
* cujo: {dangerous: true},
|
|
2363
|
+
* },
|
|
2364
|
+
* });
|
|
2365
|
+
* console.log(store.getTableCellIds('pets'));
|
|
2366
|
+
* // -> ['species', 'color', 'legs', 'dangerous']
|
|
2367
|
+
* ```
|
|
2368
|
+
* @example
|
|
2369
|
+
* This example retrieves the Cell Ids used across a Table that does not
|
|
2370
|
+
* exist, returning an empty array.
|
|
2371
|
+
*
|
|
2372
|
+
* ```js
|
|
2373
|
+
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
2374
|
+
* console.log(store.getTableCellIds('species'));
|
|
2375
|
+
* // -> []
|
|
2376
|
+
* ```
|
|
2377
|
+
* @category Getter
|
|
2378
|
+
* @since v3.3.0
|
|
2379
|
+
*/
|
|
2380
|
+
getTableCellIds<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
2381
|
+
tableId: TableId,
|
|
2382
|
+
): CellIdFromSchema<Schemas[0], TableId>[];
|
|
2383
|
+
|
|
2250
2384
|
/**
|
|
2251
2385
|
* The getRowIds method returns the Ids of every Row in a given Table.
|
|
2252
2386
|
*
|
|
@@ -2258,7 +2392,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2258
2392
|
*
|
|
2259
2393
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
2260
2394
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
2261
|
-
*
|
|
2262
2395
|
* @param tableId The Id of the Table in the Store.
|
|
2263
2396
|
* @returns An array of the Ids of every Row in the Table.
|
|
2264
2397
|
* @example
|
|
@@ -2315,7 +2448,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2315
2448
|
* addSortedRowIdsListener method.
|
|
2316
2449
|
*
|
|
2317
2450
|
* If the Table does not exist, an empty array is returned.
|
|
2318
|
-
*
|
|
2319
2451
|
* @param tableId The Id of the Table in the Store.
|
|
2320
2452
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
2321
2453
|
* `undefined` to sort by the Row Id itself.
|
|
@@ -2396,7 +2528,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2396
2528
|
* // -> []
|
|
2397
2529
|
* ```
|
|
2398
2530
|
* @category Getter
|
|
2399
|
-
* @since v2.0
|
|
2531
|
+
* @since v2.0.0
|
|
2400
2532
|
*/
|
|
2401
2533
|
getSortedRowIds<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
2402
2534
|
tableId: TableId,
|
|
@@ -2419,7 +2551,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2419
2551
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
2420
2552
|
* data, so changes made to the returned object are not made to the Store
|
|
2421
2553
|
* itself.
|
|
2422
|
-
*
|
|
2423
2554
|
* @param tableId The Id of the Table in the Store.
|
|
2424
2555
|
* @param rowId The Id of the Row in the Table.
|
|
2425
2556
|
* @returns An object containing the entire data of the Row.
|
|
@@ -2453,7 +2584,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2453
2584
|
): Row<Schemas[0], TableId>;
|
|
2454
2585
|
|
|
2455
2586
|
/**
|
|
2456
|
-
* The getCellIds method returns the Ids of every Cell in a given Row
|
|
2587
|
+
* The getCellIds method returns the Ids of every Cell in a given Row in a
|
|
2457
2588
|
* given Table.
|
|
2458
2589
|
*
|
|
2459
2590
|
* This has schema-based typing. The following is a simplified representation:
|
|
@@ -2464,7 +2595,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2464
2595
|
*
|
|
2465
2596
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
2466
2597
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
2467
|
-
*
|
|
2468
2598
|
* @param tableId The Id of the Table in the Store.
|
|
2469
2599
|
* @param rowId The Id of the Row in the Table.
|
|
2470
2600
|
* @returns An array of the Ids of every Cell in the Row.
|
|
@@ -2481,8 +2611,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2481
2611
|
* // -> ['species', 'color']
|
|
2482
2612
|
* ```
|
|
2483
2613
|
* @example
|
|
2484
|
-
* This example retrieves the Cell Ids of a
|
|
2485
|
-
*
|
|
2614
|
+
* This example retrieves the Cell Ids of a Row that does not exist, returning
|
|
2615
|
+
* an empty array.
|
|
2486
2616
|
*
|
|
2487
2617
|
* ```js
|
|
2488
2618
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -2499,13 +2629,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2499
2629
|
/**
|
|
2500
2630
|
* The getCell method returns the value of a single Cell in a given Row, in a
|
|
2501
2631
|
* given Table.
|
|
2502
|
-
*
|
|
2503
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
2504
|
-
*
|
|
2505
|
-
* ```ts override
|
|
2506
|
-
* getCell(tableId: Id, rowId: Id, cellId: Id): CellOrUndefined;
|
|
2507
|
-
* ```
|
|
2508
|
-
*
|
|
2509
2632
|
* @param tableId The Id of the Table in the Store.
|
|
2510
2633
|
* @param rowId The Id of the Row in the Table.
|
|
2511
2634
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -2513,6 +2636,12 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2513
2636
|
* @example
|
|
2514
2637
|
* This example retrieves a single Cell.
|
|
2515
2638
|
*
|
|
2639
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
2640
|
+
*
|
|
2641
|
+
* ```ts override
|
|
2642
|
+
* getCell(tableId: Id, rowId: Id, cellId: Id): CellOrUndefined;
|
|
2643
|
+
* ```
|
|
2644
|
+
*
|
|
2516
2645
|
* ```js
|
|
2517
2646
|
* const store = createStore().setTables({
|
|
2518
2647
|
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
@@ -2552,7 +2681,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2552
2681
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
2553
2682
|
* data, so changes made to the returned object are not made to the Store
|
|
2554
2683
|
* itself.
|
|
2555
|
-
*
|
|
2556
2684
|
* @returns An object containing the set of keyed Values in the Store.
|
|
2557
2685
|
* @example
|
|
2558
2686
|
* This example retrieves the set of keyed Values in the Store.
|
|
@@ -2572,7 +2700,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2572
2700
|
* // -> {}
|
|
2573
2701
|
* ```
|
|
2574
2702
|
* @category Getter
|
|
2575
|
-
* @since v3.0
|
|
2703
|
+
* @since v3.0.0
|
|
2576
2704
|
*/
|
|
2577
2705
|
getValues(): Values<Schemas[1]>;
|
|
2578
2706
|
|
|
@@ -2587,7 +2715,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2587
2715
|
*
|
|
2588
2716
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
2589
2717
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
2590
|
-
*
|
|
2591
2718
|
* @returns An array of the Ids of every Value in the Store.
|
|
2592
2719
|
* @example
|
|
2593
2720
|
* This example retrieves the Value Ids in a Store.
|
|
@@ -2607,12 +2734,16 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2607
2734
|
* // -> []
|
|
2608
2735
|
* ```
|
|
2609
2736
|
* @category Getter
|
|
2610
|
-
* @since v3.0
|
|
2737
|
+
* @since v3.0.0
|
|
2611
2738
|
*/
|
|
2612
2739
|
getValueIds(): ValueIdFromSchema<Schemas[1]>[];
|
|
2613
2740
|
|
|
2614
2741
|
/**
|
|
2615
2742
|
* The getValue method returns a single keyed Value in the Store.
|
|
2743
|
+
* @param valueId The Id of the Value in the Store.
|
|
2744
|
+
* @returns The Value, or `undefined`.
|
|
2745
|
+
* @example
|
|
2746
|
+
* This example retrieves a single Value.
|
|
2616
2747
|
*
|
|
2617
2748
|
* This has schema-based typing. The following is a simplified representation:
|
|
2618
2749
|
*
|
|
@@ -2620,11 +2751,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2620
2751
|
* getValue(valueId: Id): ValueOrUndefined;
|
|
2621
2752
|
* ```
|
|
2622
2753
|
*
|
|
2623
|
-
* @param valueId The Id of the Value in the Store.
|
|
2624
|
-
* @returns The Value, or `undefined`.
|
|
2625
|
-
* @example
|
|
2626
|
-
* This example retrieves a single Value.
|
|
2627
|
-
*
|
|
2628
2754
|
* ```js
|
|
2629
2755
|
* const store = createStore().setValues({open: true, employees: 3});
|
|
2630
2756
|
* console.log(store.getValue('employees'));
|
|
@@ -2639,7 +2765,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2639
2765
|
* // -> undefined
|
|
2640
2766
|
* ```
|
|
2641
2767
|
* @category Getter
|
|
2642
|
-
* @since v3.0
|
|
2768
|
+
* @since v3.0.0
|
|
2643
2769
|
*/
|
|
2644
2770
|
getValue<ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
2645
2771
|
valueId: ValueId,
|
|
@@ -2648,7 +2774,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2648
2774
|
/**
|
|
2649
2775
|
* The hasTables method returns a boolean indicating whether any Table objects
|
|
2650
2776
|
* exist in the Store.
|
|
2651
|
-
*
|
|
2652
2777
|
* @returns Whether any Tables exist.
|
|
2653
2778
|
* @example
|
|
2654
2779
|
* This example shows simple existence checks.
|
|
@@ -2668,6 +2793,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2668
2793
|
/**
|
|
2669
2794
|
* The hasTable method returns a boolean indicating whether a given Table
|
|
2670
2795
|
* exists in the Store.
|
|
2796
|
+
* @param tableId The Id of a possible Table in the Store.
|
|
2797
|
+
* @returns Whether a Table with that Id exists.
|
|
2798
|
+
* @example
|
|
2799
|
+
* This example shows two simple Table existence checks.
|
|
2671
2800
|
*
|
|
2672
2801
|
* This has schema-based typing. The following is a simplified representation:
|
|
2673
2802
|
*
|
|
@@ -2675,11 +2804,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2675
2804
|
* hasTable(tableId: Id): boolean;
|
|
2676
2805
|
* ```
|
|
2677
2806
|
*
|
|
2678
|
-
* @param tableId The Id of a possible Table in the Store.
|
|
2679
|
-
* @returns Whether a Table with that Id exists.
|
|
2680
|
-
* @example
|
|
2681
|
-
* This example shows two simple Table existence checks.
|
|
2682
|
-
*
|
|
2683
2807
|
* ```js
|
|
2684
2808
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
2685
2809
|
* console.log(store.hasTable('pets'));
|
|
@@ -2692,21 +2816,54 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2692
2816
|
hasTable(tableId: TableIdFromSchema<Schemas[0]>): boolean;
|
|
2693
2817
|
|
|
2694
2818
|
/**
|
|
2695
|
-
* The
|
|
2696
|
-
* in
|
|
2819
|
+
* The hasTableCell method returns a boolean indicating whether a given Cell
|
|
2820
|
+
* exists anywhere in a Table, not just in a specific Row.
|
|
2821
|
+
* @param tableId The Id of a possible Table in the Store.
|
|
2822
|
+
* @param cellId The Id of a possible Cell in the Table.
|
|
2823
|
+
* @returns Whether a Cell with that Id exists anywhere in that Table.
|
|
2824
|
+
* @example
|
|
2825
|
+
* This example shows two simple Cell existence checks.
|
|
2697
2826
|
*
|
|
2698
2827
|
* This has schema-based typing. The following is a simplified representation:
|
|
2699
2828
|
*
|
|
2700
2829
|
* ```ts override
|
|
2701
|
-
*
|
|
2830
|
+
* hasTableCell(tableId: Id, cellId: Id): boolean;
|
|
2702
2831
|
* ```
|
|
2703
2832
|
*
|
|
2833
|
+
* ```js
|
|
2834
|
+
* const store = createStore().setTables({
|
|
2835
|
+
* pets: {fido: {species: 'dog'}, felix: {legs: 4}},
|
|
2836
|
+
* });
|
|
2837
|
+
* console.log(store.hasTableCell('pets', 'species'));
|
|
2838
|
+
* // -> true
|
|
2839
|
+
* console.log(store.hasTableCell('pets', 'legs'));
|
|
2840
|
+
* // -> true
|
|
2841
|
+
* console.log(store.hasTableCell('pets', 'color'));
|
|
2842
|
+
* // -> false
|
|
2843
|
+
* ```
|
|
2844
|
+
* @category Getter
|
|
2845
|
+
* @since v3.3.0
|
|
2846
|
+
*/
|
|
2847
|
+
hasTableCell<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
2848
|
+
tableId: TableId,
|
|
2849
|
+
cellId: CellIdFromSchema<Schemas[0], TableId>,
|
|
2850
|
+
): boolean;
|
|
2851
|
+
|
|
2852
|
+
/**
|
|
2853
|
+
* The hasRow method returns a boolean indicating whether a given Row exists
|
|
2854
|
+
* in the Store.
|
|
2704
2855
|
* @param tableId The Id of a possible Table in the Store.
|
|
2705
2856
|
* @param rowId The Id of a possible Row in the Table.
|
|
2706
2857
|
* @returns Whether a Row with that Id exists in that Table.
|
|
2707
2858
|
* @example
|
|
2708
2859
|
* This example shows two simple Row existence checks.
|
|
2709
2860
|
*
|
|
2861
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
2862
|
+
*
|
|
2863
|
+
* ```ts override
|
|
2864
|
+
* hasRow(tableId: Id, rowId: Id): boolean;
|
|
2865
|
+
* ```
|
|
2866
|
+
*
|
|
2710
2867
|
* ```js
|
|
2711
2868
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
2712
2869
|
* console.log(store.hasRow('pets', 'fido'));
|
|
@@ -2720,14 +2877,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2720
2877
|
|
|
2721
2878
|
/**
|
|
2722
2879
|
* The hasCell method returns a boolean indicating whether a given Cell exists
|
|
2723
|
-
* in
|
|
2724
|
-
*
|
|
2725
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
2726
|
-
*
|
|
2727
|
-
* ```ts override
|
|
2728
|
-
* hasCell(tableId: Id, rowId: Id, cellId: Id): boolean;
|
|
2729
|
-
* ```
|
|
2730
|
-
*
|
|
2880
|
+
* in a given Row in a given Table.
|
|
2731
2881
|
* @param tableId The Id of a possible Table in the Store.
|
|
2732
2882
|
* @param rowId The Id of a possible Row in the Table.
|
|
2733
2883
|
* @param cellId The Id of a possible Cell in the Row.
|
|
@@ -2735,6 +2885,12 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2735
2885
|
* @example
|
|
2736
2886
|
* This example shows two simple Cell existence checks.
|
|
2737
2887
|
*
|
|
2888
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
2889
|
+
*
|
|
2890
|
+
* ```ts override
|
|
2891
|
+
* hasCell(tableId: Id, rowId: Id, cellId: Id): boolean;
|
|
2892
|
+
* ```
|
|
2893
|
+
*
|
|
2738
2894
|
* ```js
|
|
2739
2895
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
2740
2896
|
* console.log(store.hasCell('pets', 'fido', 'species'));
|
|
@@ -2753,7 +2909,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2753
2909
|
/**
|
|
2754
2910
|
* The hasTables method returns a boolean indicating whether any Values exist
|
|
2755
2911
|
* in the Store.
|
|
2756
|
-
*
|
|
2757
2912
|
* @returns Whether any Values exist.
|
|
2758
2913
|
* @example
|
|
2759
2914
|
* This example shows simple existence checks.
|
|
@@ -2767,13 +2922,17 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2767
2922
|
* // -> true
|
|
2768
2923
|
* ```
|
|
2769
2924
|
* @category Getter
|
|
2770
|
-
* @since v3.0
|
|
2925
|
+
* @since v3.0.0
|
|
2771
2926
|
*/
|
|
2772
2927
|
hasValues(): boolean;
|
|
2773
2928
|
|
|
2774
2929
|
/**
|
|
2775
2930
|
* The hasValue method returns a boolean indicating whether a given Value
|
|
2776
2931
|
* exists in the Store.
|
|
2932
|
+
* @param valueId The Id of a possible Value in the Store.
|
|
2933
|
+
* @returns Whether a Value with that Id exists in the Store.
|
|
2934
|
+
* @example
|
|
2935
|
+
* This example shows two simple Value existence checks.
|
|
2777
2936
|
*
|
|
2778
2937
|
* This has schema-based typing. The following is a simplified representation:
|
|
2779
2938
|
*
|
|
@@ -2781,11 +2940,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2781
2940
|
* hasValue(valueId: Id): boolean;
|
|
2782
2941
|
* ```
|
|
2783
2942
|
*
|
|
2784
|
-
* @param valueId The Id of a possible Value in the Store.
|
|
2785
|
-
* @returns Whether a Value with that Id exists in the Store.
|
|
2786
|
-
* @example
|
|
2787
|
-
* This example shows two simple Value existence checks.
|
|
2788
|
-
*
|
|
2789
2943
|
* ```js
|
|
2790
2944
|
* const store = createStore().setValues({open: true});
|
|
2791
2945
|
* console.log(store.hasValue('open'));
|
|
@@ -2794,14 +2948,13 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2794
2948
|
* // -> false
|
|
2795
2949
|
* ```
|
|
2796
2950
|
* @category Getter
|
|
2797
|
-
* @since v3.0
|
|
2951
|
+
* @since v3.0.0
|
|
2798
2952
|
*/
|
|
2799
2953
|
hasValue(valueId: ValueIdFromSchema<Schemas[1]>): boolean;
|
|
2800
2954
|
|
|
2801
2955
|
/**
|
|
2802
2956
|
* The getTablesJson method returns a string serialization of all of the
|
|
2803
2957
|
* Tables in the Store.
|
|
2804
|
-
*
|
|
2805
2958
|
* @returns A string serialization of all of the Tables in the Store.
|
|
2806
2959
|
* @example
|
|
2807
2960
|
* This example serializes the contents of a Store.
|
|
@@ -2820,14 +2973,13 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2820
2973
|
* // -> '{}'
|
|
2821
2974
|
* ```
|
|
2822
2975
|
* @category Getter
|
|
2823
|
-
* @since v3.0
|
|
2976
|
+
* @since v3.0.0
|
|
2824
2977
|
*/
|
|
2825
2978
|
getTablesJson(): Json;
|
|
2826
2979
|
|
|
2827
2980
|
/**
|
|
2828
2981
|
* The getValuesJson method returns a string serialization of all of the keyed
|
|
2829
2982
|
* Values in the Store.
|
|
2830
|
-
*
|
|
2831
2983
|
* @returns A string serialization of all of the Values in the Store.
|
|
2832
2984
|
* @example
|
|
2833
2985
|
* This example serializes the keyed value contents of a Store.
|
|
@@ -2846,7 +2998,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2846
2998
|
* // -> '{}'
|
|
2847
2999
|
* ```
|
|
2848
3000
|
* @category Getter
|
|
2849
|
-
* @since v3.0
|
|
3001
|
+
* @since v3.0.0
|
|
2850
3002
|
*/
|
|
2851
3003
|
getValuesJson(): Json;
|
|
2852
3004
|
|
|
@@ -2858,7 +3010,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2858
3010
|
* first is the Tables object, the second the Values. In previous versions
|
|
2859
3011
|
* (before the existence of the Values data structure), it was a sole object
|
|
2860
3012
|
* of Tables.
|
|
2861
|
-
*
|
|
2862
3013
|
* @returns A string serialization of the Tables and Values in the Store.
|
|
2863
3014
|
* @example
|
|
2864
3015
|
* This example serializes the tabular and keyed value contents of a Store.
|
|
@@ -2889,7 +3040,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2889
3040
|
* If no TablesSchema has been set on the Store (or if it has been removed
|
|
2890
3041
|
* with the delTablesSchema method), then it will return the serialization of
|
|
2891
3042
|
* an empty object, `{}`.
|
|
2892
|
-
*
|
|
2893
3043
|
* @returns A string serialization of the TablesSchema of the Store.
|
|
2894
3044
|
* @example
|
|
2895
3045
|
* This example serializes the TablesSchema of a Store.
|
|
@@ -2913,7 +3063,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2913
3063
|
* // -> '{}'
|
|
2914
3064
|
* ```
|
|
2915
3065
|
* @category Getter
|
|
2916
|
-
* @since v3.0
|
|
3066
|
+
* @since v3.0.0
|
|
2917
3067
|
*/
|
|
2918
3068
|
getTablesSchemaJson(): Json;
|
|
2919
3069
|
|
|
@@ -2924,7 +3074,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2924
3074
|
* If no ValuesSchema has been set on the Store (or if it has been removed
|
|
2925
3075
|
* with the delValuesSchema method), then it will return the serialization of
|
|
2926
3076
|
* an empty object, `{}`.
|
|
2927
|
-
*
|
|
2928
3077
|
* @returns A string serialization of the ValuesSchema of the Store.
|
|
2929
3078
|
* @example
|
|
2930
3079
|
* This example serializes the ValuesSchema of a Store.
|
|
@@ -2945,7 +3094,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2945
3094
|
* // -> '{}'
|
|
2946
3095
|
* ```
|
|
2947
3096
|
* @category Getter
|
|
2948
|
-
* @since v3.0
|
|
3097
|
+
* @since v3.0.0
|
|
2949
3098
|
*/
|
|
2950
3099
|
getValuesSchemaJson(): Json;
|
|
2951
3100
|
|
|
@@ -2957,7 +3106,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2957
3106
|
* first is the TablesSchema object, the second the ValuesSchema. In previous
|
|
2958
3107
|
* versions (before the existence of the ValuesSchema data structure), it was
|
|
2959
3108
|
* a sole object of TablesSchema.
|
|
2960
|
-
*
|
|
2961
3109
|
* @returns A string serialization of the TablesSchema and ValuesSchema of the
|
|
2962
3110
|
* Store.
|
|
2963
3111
|
* @example
|
|
@@ -3013,7 +3161,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3013
3161
|
*
|
|
3014
3162
|
* The method returns a reference to the Store so that subsequent operations
|
|
3015
3163
|
* can be chained in a fluent style.
|
|
3016
|
-
*
|
|
3017
3164
|
* @param content An array containing the tabular and keyed-value data of the
|
|
3018
3165
|
* Store to be set.
|
|
3019
3166
|
* @example
|
|
@@ -3050,7 +3197,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3050
3197
|
* // -> {pets: {felix: {species: 'cat'}}}
|
|
3051
3198
|
* ```
|
|
3052
3199
|
* @category Setter
|
|
3053
|
-
* @since v4.0
|
|
3200
|
+
* @since v4.0.0
|
|
3054
3201
|
*/
|
|
3055
3202
|
setContent([tables, values]: [
|
|
3056
3203
|
Tables<Schemas[0], true>,
|
|
@@ -3080,7 +3227,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3080
3227
|
*
|
|
3081
3228
|
* The method returns a reference to the Store so that subsequent operations
|
|
3082
3229
|
* can be chained in a fluent style.
|
|
3083
|
-
*
|
|
3084
3230
|
* @param tables The data of the Store to be set.
|
|
3085
3231
|
* @example
|
|
3086
3232
|
* This example sets the tabular data of a Store.
|
|
@@ -3136,7 +3282,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3136
3282
|
*
|
|
3137
3283
|
* The method returns a reference to the Store so that subsequent operations
|
|
3138
3284
|
* can be chained in a fluent style.
|
|
3139
|
-
*
|
|
3140
3285
|
* @param tableId The Id of the Table in the Store.
|
|
3141
3286
|
* @param table The data of a single Table to be set.
|
|
3142
3287
|
* @example
|
|
@@ -3196,7 +3341,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3196
3341
|
*
|
|
3197
3342
|
* The method returns a reference to the Store so that subsequent operations
|
|
3198
3343
|
* can be chained in a fluent style.
|
|
3199
|
-
*
|
|
3200
3344
|
* @param tableId The Id of the Table in the Store.
|
|
3201
3345
|
* @param rowId The Id of the Row in the Table.
|
|
3202
3346
|
* @param row The data of a single Row to be set.
|
|
@@ -3263,7 +3407,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3263
3407
|
* if you specify `reuseRowIds` to be `false`, then the Id will be a
|
|
3264
3408
|
* monotonically increasing string representation of an increasing integer,
|
|
3265
3409
|
* regardless of any you may have previously deleted.
|
|
3266
|
-
*
|
|
3267
3410
|
* @param tableId The Id of the Table in the Store.
|
|
3268
3411
|
* @param row The data of a single Row to be added.
|
|
3269
3412
|
* @param reuseRowIds Whether Ids should be recycled from previously deleted
|
|
@@ -3327,7 +3470,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3327
3470
|
*
|
|
3328
3471
|
* The method returns a reference to the Store so that subsequent operations
|
|
3329
3472
|
* can be chained in a fluent style.
|
|
3330
|
-
*
|
|
3331
3473
|
* @param tableId The Id of the Table in the Store.
|
|
3332
3474
|
* @param rowId The Id of the Row in the Table.
|
|
3333
3475
|
* @param partialRow The partial data of a single Row to be set.
|
|
@@ -3389,7 +3531,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3389
3531
|
*
|
|
3390
3532
|
* The method returns a reference to the Store so that subsequent operations
|
|
3391
3533
|
* can be chained in a fluent style.
|
|
3392
|
-
*
|
|
3393
3534
|
* @param tableId The Id of the Table in the Store.
|
|
3394
3535
|
* @param rowId The Id of the Row in the Table.
|
|
3395
3536
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -3463,7 +3604,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3463
3604
|
*
|
|
3464
3605
|
* The method returns a reference to the Store so that subsequent operations
|
|
3465
3606
|
* can be chained in a fluent style.
|
|
3466
|
-
*
|
|
3467
3607
|
* @param values The Values object to be set.
|
|
3468
3608
|
* @returns A reference to the Store.
|
|
3469
3609
|
* @example
|
|
@@ -3490,7 +3630,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3490
3630
|
* // -> {employees: 3}
|
|
3491
3631
|
* ```
|
|
3492
3632
|
* @category Setter
|
|
3493
|
-
* @since v3.0
|
|
3633
|
+
* @since v3.0.0
|
|
3494
3634
|
*/
|
|
3495
3635
|
setValues(values: Values<Schemas[1], true>): Store<Schemas>;
|
|
3496
3636
|
|
|
@@ -3518,7 +3658,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3518
3658
|
*
|
|
3519
3659
|
* The method returns a reference to the Store so that subsequent operations
|
|
3520
3660
|
* can be chained in a fluent style.
|
|
3521
|
-
*
|
|
3522
3661
|
* @param partialValues The Values to be set.
|
|
3523
3662
|
* @returns A reference to the Store.
|
|
3524
3663
|
* @example
|
|
@@ -3546,7 +3685,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3546
3685
|
* // -> {open: true, employees: 3}
|
|
3547
3686
|
* ```
|
|
3548
3687
|
* @category Setter
|
|
3549
|
-
* @since v3.0
|
|
3688
|
+
* @since v3.0.0
|
|
3550
3689
|
*/
|
|
3551
3690
|
setPartialValues(partialValues: Values<Schemas[1], true>): Store<Schemas>;
|
|
3552
3691
|
|
|
@@ -3572,7 +3711,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3572
3711
|
*
|
|
3573
3712
|
* The method returns a reference to the Store so that subsequent operations
|
|
3574
3713
|
* can be chained in a fluent style.
|
|
3575
|
-
*
|
|
3576
3714
|
* @param valueId The Id of the Value in the Store.
|
|
3577
3715
|
* @param value The Value to be set, or a MapValue function to update it.
|
|
3578
3716
|
* @returns A reference to the Store.
|
|
@@ -3606,7 +3744,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3606
3744
|
* // -> {employees: 3}
|
|
3607
3745
|
* ```
|
|
3608
3746
|
* @category Setter
|
|
3609
|
-
* @since v3.0
|
|
3747
|
+
* @since v3.0.0
|
|
3610
3748
|
*/
|
|
3611
3749
|
setValue<ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
3612
3750
|
valueId: ValueId,
|
|
@@ -3635,7 +3773,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3635
3773
|
*
|
|
3636
3774
|
* The method returns a reference to the Store so that subsequent operations
|
|
3637
3775
|
* can be chained in a fluent style.
|
|
3638
|
-
*
|
|
3639
3776
|
* @param transactionChanges The TransactionChanges to apply to the Store.
|
|
3640
3777
|
* @returns A reference to the Store.
|
|
3641
3778
|
* @example
|
|
@@ -3657,7 +3794,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3657
3794
|
* // -> {}
|
|
3658
3795
|
* ```
|
|
3659
3796
|
* @category Setter
|
|
3660
|
-
* @since v4.0
|
|
3797
|
+
* @since v4.0.0
|
|
3661
3798
|
*/
|
|
3662
3799
|
setTransactionChanges(
|
|
3663
3800
|
transactionChanges: TransactionChanges<Schemas>,
|
|
@@ -3677,7 +3814,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3677
3814
|
* it will then be subject to the same validation rules as the setTables
|
|
3678
3815
|
* method (according to the Tables type, and matching any TablesSchema
|
|
3679
3816
|
* associated with the Store).
|
|
3680
|
-
*
|
|
3681
3817
|
* @param tablesJson A string serialization of all of the Tables in the Store.
|
|
3682
3818
|
* @returns A reference to the Store.
|
|
3683
3819
|
* @example
|
|
@@ -3700,7 +3836,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3700
3836
|
* // -> {}
|
|
3701
3837
|
* ```
|
|
3702
3838
|
* @category Setter
|
|
3703
|
-
* @since v3.0
|
|
3839
|
+
* @since v3.0.0
|
|
3704
3840
|
*/
|
|
3705
3841
|
setTablesJson(tablesJson: Json): Store<Schemas>;
|
|
3706
3842
|
|
|
@@ -3718,7 +3854,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3718
3854
|
* it will then be subject to the same validation rules as the setValues
|
|
3719
3855
|
* method (according to the Values type, and matching any ValuesSchema
|
|
3720
3856
|
* associated with the Store).
|
|
3721
|
-
*
|
|
3722
3857
|
* @param valuesJson A string serialization of all of the Values in the Store.
|
|
3723
3858
|
* @returns A reference to the Store.
|
|
3724
3859
|
* @example
|
|
@@ -3741,7 +3876,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3741
3876
|
* // -> {}
|
|
3742
3877
|
* ```
|
|
3743
3878
|
* @category Setter
|
|
3744
|
-
* @since v3.0
|
|
3879
|
+
* @since v3.0.0
|
|
3745
3880
|
*/
|
|
3746
3881
|
setValuesJson(valuesJson: Json): Store<Schemas>;
|
|
3747
3882
|
|
|
@@ -3766,7 +3901,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3766
3901
|
* method (according to the Tables type, and matching any TablesSchema
|
|
3767
3902
|
* associated with the Store), and the setValues method (according to the
|
|
3768
3903
|
* Values type, and matching any ValuesSchema associated with the Store).
|
|
3769
|
-
*
|
|
3770
3904
|
* @param tablesAndValuesJson A string serialization of all of the Tables and
|
|
3771
3905
|
* Values in the Store.
|
|
3772
3906
|
* @returns A reference to the Store.
|
|
@@ -3826,7 +3960,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3826
3960
|
*
|
|
3827
3961
|
* When no longer needed, you can also completely remove an existing
|
|
3828
3962
|
* TablesSchema with the delTablesSchema method.
|
|
3829
|
-
*
|
|
3830
3963
|
* @param tablesSchema The TablesSchema to be set for the Store.
|
|
3831
3964
|
* @returns A reference to the Store.
|
|
3832
3965
|
* @example
|
|
@@ -3845,7 +3978,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3845
3978
|
* // -> {pets: {0: {species: 'dog', sold: false}}}
|
|
3846
3979
|
* ```
|
|
3847
3980
|
* @category Setter
|
|
3848
|
-
* @since v3.0
|
|
3981
|
+
* @since v3.0.0
|
|
3849
3982
|
*/
|
|
3850
3983
|
setTablesSchema<TS extends TablesSchema>(
|
|
3851
3984
|
tablesSchema: TS,
|
|
@@ -3867,7 +4000,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3867
4000
|
*
|
|
3868
4001
|
* When no longer needed, you can also completely remove an existing
|
|
3869
4002
|
* ValuesSchema with the delValuesSchema method.
|
|
3870
|
-
*
|
|
3871
4003
|
* @param valuesSchema The ValuesSchema to be set for the Store.
|
|
3872
4004
|
* @returns A reference to the Store.
|
|
3873
4005
|
* @example
|
|
@@ -3883,7 +4015,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3883
4015
|
* // -> {open: false}
|
|
3884
4016
|
* ```
|
|
3885
4017
|
* @category Setter
|
|
3886
|
-
* @since v3.0
|
|
4018
|
+
* @since v3.0.0
|
|
3887
4019
|
*/
|
|
3888
4020
|
setValuesSchema<VS extends ValuesSchema>(
|
|
3889
4021
|
valuesSchema: VS,
|
|
@@ -3908,7 +4040,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3908
4040
|
* (before the existence of the ValuesSchema data structure), only the first
|
|
3909
4041
|
* was present. For backwards compatibility the new second parameter is
|
|
3910
4042
|
* optional.
|
|
3911
|
-
*
|
|
3912
4043
|
* @param tablesSchema The TablesSchema to be set for the Store.
|
|
3913
4044
|
* @param valuesSchema The ValuesSchema to be set for the Store.
|
|
3914
4045
|
* @returns A reference to the Store.
|
|
@@ -3966,6 +4097,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3966
4097
|
|
|
3967
4098
|
/**
|
|
3968
4099
|
* The delTables method lets you remove all of the data in a Store.
|
|
4100
|
+
* @returns A reference to the Store.
|
|
4101
|
+
* @example
|
|
4102
|
+
* This example removes the data of a Store.
|
|
3969
4103
|
*
|
|
3970
4104
|
* This has schema-based typing. The following is a simplified representation:
|
|
3971
4105
|
*
|
|
@@ -3973,10 +4107,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3973
4107
|
* delTables(): Store;
|
|
3974
4108
|
* ```
|
|
3975
4109
|
*
|
|
3976
|
-
* @returns A reference to the Store.
|
|
3977
|
-
* @example
|
|
3978
|
-
* This example removes the data of a Store.
|
|
3979
|
-
*
|
|
3980
4110
|
* ```js
|
|
3981
4111
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
3982
4112
|
*
|
|
@@ -3990,6 +4120,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3990
4120
|
|
|
3991
4121
|
/**
|
|
3992
4122
|
* The delTable method lets you remove a single Table from the Store.
|
|
4123
|
+
* @param tableId The Id of the Table in the Store.
|
|
4124
|
+
* @returns A reference to the Store.
|
|
4125
|
+
* @example
|
|
4126
|
+
* This example removes a Table from a Store.
|
|
3993
4127
|
*
|
|
3994
4128
|
* This has schema-based typing. The following is a simplified representation:
|
|
3995
4129
|
*
|
|
@@ -3997,11 +4131,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3997
4131
|
* delTable(tableId: Id): Store;
|
|
3998
4132
|
* ```
|
|
3999
4133
|
*
|
|
4000
|
-
* @param tableId The Id of the Table in the Store.
|
|
4001
|
-
* @returns A reference to the Store.
|
|
4002
|
-
* @example
|
|
4003
|
-
* This example removes a Table from a Store.
|
|
4004
|
-
*
|
|
4005
4134
|
* ```js
|
|
4006
4135
|
* const store = createStore().setTables({
|
|
4007
4136
|
* pets: {fido: {species: 'dog'}},
|
|
@@ -4026,7 +4155,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4026
4155
|
* ```
|
|
4027
4156
|
*
|
|
4028
4157
|
* If this is the last Row in its Table, then that Table will be removed.
|
|
4029
|
-
*
|
|
4030
4158
|
* @param tableId The Id of the Table in the Store.
|
|
4031
4159
|
* @param rowId The Id of the Row in the Table.
|
|
4032
4160
|
* @returns A reference to the Store.
|
|
@@ -4072,7 +4200,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4072
4200
|
* invalid Row (according to the TablesSchema), in fact the whole Row is
|
|
4073
4201
|
* deleted to retain the integrity of the Table. Therefore, this flag should
|
|
4074
4202
|
* be used with caution.
|
|
4075
|
-
*
|
|
4076
4203
|
* @param tableId The Id of the Table in the Store.
|
|
4077
4204
|
* @param rowId The Id of the Row in the Table.
|
|
4078
4205
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -4153,7 +4280,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4153
4280
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
4154
4281
|
* value for any Value Id, then deletion will result in it being set back to
|
|
4155
4282
|
* its default value.
|
|
4156
|
-
*
|
|
4157
4283
|
* @returns A reference to the Store.
|
|
4158
4284
|
* @example
|
|
4159
4285
|
* This example removes all Values from a Store without a ValuesSchema.
|
|
@@ -4182,7 +4308,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4182
4308
|
* // -> {open: false}
|
|
4183
4309
|
* ```
|
|
4184
4310
|
* @category Deleter
|
|
4185
|
-
* @since v3.0
|
|
4311
|
+
* @since v3.0.0
|
|
4186
4312
|
*/
|
|
4187
4313
|
delValues(): Store<Schemas>;
|
|
4188
4314
|
|
|
@@ -4198,7 +4324,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4198
4324
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
4199
4325
|
* value for this Value Id, then deletion will result in it being set back to
|
|
4200
4326
|
* its default value.
|
|
4201
|
-
*
|
|
4202
4327
|
* @param valueId The Id of the Value in the Row.
|
|
4203
4328
|
* @returns A reference to the Store.
|
|
4204
4329
|
* @example
|
|
@@ -4228,12 +4353,15 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4228
4353
|
* // -> {open: false, employees: 3}
|
|
4229
4354
|
* ```
|
|
4230
4355
|
* @category Deleter
|
|
4231
|
-
* @since v3.0
|
|
4356
|
+
* @since v3.0.0
|
|
4232
4357
|
*/
|
|
4233
4358
|
delValue(valueId: ValueIdFromSchema<Schemas[1]>): Store<Schemas>;
|
|
4234
4359
|
|
|
4235
4360
|
/**
|
|
4236
4361
|
* The delTablesSchema method lets you remove the TablesSchema of the Store.
|
|
4362
|
+
* @returns A reference to the Store.
|
|
4363
|
+
* @example
|
|
4364
|
+
* This example removes the TablesSchema of a Store.
|
|
4237
4365
|
*
|
|
4238
4366
|
* This has schema-based typing. The following is a simplified representation:
|
|
4239
4367
|
*
|
|
@@ -4241,10 +4369,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4241
4369
|
* delTablesSchema(): Store;
|
|
4242
4370
|
* ```
|
|
4243
4371
|
*
|
|
4244
|
-
* @returns A reference to the Store.
|
|
4245
|
-
* @example
|
|
4246
|
-
* This example removes the TablesSchema of a Store.
|
|
4247
|
-
*
|
|
4248
4372
|
* ```js
|
|
4249
4373
|
* const store = createStore().setTablesSchema({
|
|
4250
4374
|
* pets: {species: {type: 'string'}},
|
|
@@ -4261,6 +4385,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4261
4385
|
|
|
4262
4386
|
/**
|
|
4263
4387
|
* The delValuesSchema method lets you remove the ValuesSchema of the Store.
|
|
4388
|
+
* @returns A reference to the Store.
|
|
4389
|
+
* @example
|
|
4390
|
+
* This example removes the ValuesSchema of a Store.
|
|
4264
4391
|
*
|
|
4265
4392
|
* This has schema-based typing. The following is a simplified representation:
|
|
4266
4393
|
*
|
|
@@ -4268,10 +4395,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4268
4395
|
* delValuesSchema(): Store;
|
|
4269
4396
|
* ```
|
|
4270
4397
|
*
|
|
4271
|
-
* @returns A reference to the Store.
|
|
4272
|
-
* @example
|
|
4273
|
-
* This example removes the ValuesSchema of a Store.
|
|
4274
|
-
*
|
|
4275
4398
|
* ```js
|
|
4276
4399
|
* const store = createStore().setValuesSchema({
|
|
4277
4400
|
* sold: {type: 'boolean', default: false},
|
|
@@ -4281,7 +4404,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4281
4404
|
* // -> '{}'
|
|
4282
4405
|
* ```
|
|
4283
4406
|
* @category Deleter
|
|
4284
|
-
* @since v3.0
|
|
4407
|
+
* @since v3.0.0
|
|
4285
4408
|
*/
|
|
4286
4409
|
delValuesSchema<
|
|
4287
4410
|
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
@@ -4298,7 +4421,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4298
4421
|
* ```
|
|
4299
4422
|
*
|
|
4300
4423
|
* Prior to v3.0, this method removed the TablesSchema only.
|
|
4301
|
-
*
|
|
4302
4424
|
* @returns A reference to the Store.
|
|
4303
4425
|
* @example
|
|
4304
4426
|
* This example removes the TablesSchema and ValuesSchema of a Store.
|
|
@@ -4316,7 +4438,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4316
4438
|
* // -> '[{},{}]'
|
|
4317
4439
|
* ```
|
|
4318
4440
|
* @category Deleter
|
|
4319
|
-
* @since v3.0
|
|
4441
|
+
* @since v3.0.0
|
|
4320
4442
|
*/
|
|
4321
4443
|
delSchema(): Store<NoSchemas>;
|
|
4322
4444
|
|
|
@@ -4354,7 +4476,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4354
4476
|
* `getTransactionLog` parameters, which inform you of the net changes that
|
|
4355
4477
|
* have been made during the transaction, at different levels of detail. See
|
|
4356
4478
|
* the DoRollback documentation for more details.
|
|
4357
|
-
*
|
|
4358
4479
|
* @param actions The function to be executed as a transaction.
|
|
4359
4480
|
* @param doRollback An optional callback that should return `true` if you
|
|
4360
4481
|
* want to rollback the transaction at the end. Since v1.2.
|
|
@@ -4487,7 +4608,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4487
4608
|
* that are asynchronous or not occurring inline to your code. You must
|
|
4488
4609
|
* remember to also call the finishTransaction method explicitly when it is
|
|
4489
4610
|
* done, of course.
|
|
4490
|
-
*
|
|
4491
4611
|
* @returns A reference to the Store.
|
|
4492
4612
|
* @example
|
|
4493
4613
|
* This example makes changes to two Cells, first outside, and secondly
|
|
@@ -4512,7 +4632,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4512
4632
|
* // -> 'Fido changed'
|
|
4513
4633
|
* ```
|
|
4514
4634
|
* @category Transaction
|
|
4515
|
-
* @since v1.3
|
|
4635
|
+
* @since v1.3.0
|
|
4516
4636
|
*/
|
|
4517
4637
|
startTransaction(): Store<Schemas>;
|
|
4518
4638
|
|
|
@@ -4550,7 +4670,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4550
4670
|
* `getTransactionLog` parameters, which inform you of the net changes that
|
|
4551
4671
|
* have been made during the transaction, at different levels of detail. See
|
|
4552
4672
|
* the DoRollback documentation for more details.
|
|
4553
|
-
*
|
|
4554
4673
|
* @param doRollback An optional callback that should return `true` if you
|
|
4555
4674
|
* want to rollback the transaction at the end.
|
|
4556
4675
|
* @returns A reference to the Store.
|
|
@@ -4616,7 +4735,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4616
4735
|
* // -> {open: true}
|
|
4617
4736
|
* ```
|
|
4618
4737
|
* @category Transaction
|
|
4619
|
-
* @since v1.3
|
|
4738
|
+
* @since v1.3.0
|
|
4620
4739
|
*/
|
|
4621
4740
|
finishTransaction(doRollback?: DoRollback<Schemas>): Store<Schemas>;
|
|
4622
4741
|
|
|
@@ -4635,7 +4754,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4635
4754
|
* function that will be called with the Id of each Table, and with a function
|
|
4636
4755
|
* that can then be used to iterate over each Row of the Table, should you
|
|
4637
4756
|
* wish.
|
|
4638
|
-
*
|
|
4639
4757
|
* @param tableCallback The function that should be called for every Table.
|
|
4640
4758
|
* @example
|
|
4641
4759
|
* This example iterates over each Table in a Store, and lists each Row Id
|
|
@@ -4659,6 +4777,44 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4659
4777
|
*/
|
|
4660
4778
|
forEachTable(tableCallback: TableCallback<Schemas[0]>): void;
|
|
4661
4779
|
|
|
4780
|
+
/**
|
|
4781
|
+
* The forEachTableCell method takes a function that it will then call for
|
|
4782
|
+
* each Cell used across the whole Table.
|
|
4783
|
+
*
|
|
4784
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
4785
|
+
*
|
|
4786
|
+
* ```ts override
|
|
4787
|
+
* forEachTableCell(tableId: Id, tableCellCallback: TableCellCallback): void;
|
|
4788
|
+
* ```
|
|
4789
|
+
*
|
|
4790
|
+
* This method is useful for iterating over the Cell structure of the Table in
|
|
4791
|
+
* a functional style. The `tableCellCallback` parameter is a
|
|
4792
|
+
* TableCellCallback function that will be called with the Id of each Cell and
|
|
4793
|
+
* the count of Rows in the Table in which it appears.
|
|
4794
|
+
* @param tableId The Id of the Table containing the Cells to iterate over.
|
|
4795
|
+
* @param tableCellCallback The function that should be called for every Cell
|
|
4796
|
+
* Id used across the whole Table.
|
|
4797
|
+
* @example
|
|
4798
|
+
* This example iterates over each Cell Id used across the whole Table.
|
|
4799
|
+
*
|
|
4800
|
+
* ```js
|
|
4801
|
+
* const store = createStore().setTables({
|
|
4802
|
+
* pets: {fido: {species: 'dog'}, felix: {species: 'cat', legs: 4}},
|
|
4803
|
+
* });
|
|
4804
|
+
* store.forEachTableCell('pets', (cellId, count) => {
|
|
4805
|
+
* console.log(`${cellId}: ${count}`);
|
|
4806
|
+
* });
|
|
4807
|
+
* // -> 'species: 2'
|
|
4808
|
+
* // -> 'legs: 1'
|
|
4809
|
+
* ```
|
|
4810
|
+
* @category Iterator
|
|
4811
|
+
* @since v3.3.0
|
|
4812
|
+
*/
|
|
4813
|
+
forEachTableCell<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
4814
|
+
tableId: TableId,
|
|
4815
|
+
tableCellCallback: TableCellCallback<Schemas[0], TableId>,
|
|
4816
|
+
): void;
|
|
4817
|
+
|
|
4662
4818
|
/**
|
|
4663
4819
|
* The forEachRow method takes a function that it will then call for each Row
|
|
4664
4820
|
* in a specified Table.
|
|
@@ -4673,7 +4829,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4673
4829
|
* a functional style. The `rowCallback` parameter is a RowCallback function
|
|
4674
4830
|
* that will be called with the Id of each Row, and with a function that can
|
|
4675
4831
|
* then be used to iterate over each Cell of the Row, should you wish.
|
|
4676
|
-
*
|
|
4677
4832
|
* @param tableId The Id of the Table to iterate over.
|
|
4678
4833
|
* @param rowCallback The function that should be called for every Row.
|
|
4679
4834
|
* @example
|
|
@@ -4716,7 +4871,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4716
4871
|
* This method is useful for iterating over the Cell structure of the Row in a
|
|
4717
4872
|
* functional style. The `cellCallback` parameter is a CellCallback function
|
|
4718
4873
|
* that will be called with the Id and value of each Cell.
|
|
4719
|
-
*
|
|
4720
4874
|
* @param tableId The Id of the Table containing the Row to iterate over.
|
|
4721
4875
|
* @param rowId The Id of the Row to iterate over.
|
|
4722
4876
|
* @param cellCallback The function that should be called for every Cell.
|
|
@@ -4754,7 +4908,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4754
4908
|
* This method is useful for iterating over the Value structure of the Store
|
|
4755
4909
|
* in a functional style. The `valueCallback` parameter is a ValueCallback
|
|
4756
4910
|
* function that will be called with the Id and value of each Value.
|
|
4757
|
-
*
|
|
4758
4911
|
* @param valueCallback The function that should be called for every Value.
|
|
4759
4912
|
* @example
|
|
4760
4913
|
* This example iterates over each Value in a Store, and lists its value.
|
|
@@ -4768,7 +4921,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4768
4921
|
* // -> 'employees: 3'
|
|
4769
4922
|
* ```
|
|
4770
4923
|
* @category Iterator
|
|
4771
|
-
* @since v3.0
|
|
4924
|
+
* @since v3.0.0
|
|
4772
4925
|
*/
|
|
4773
4926
|
forEachValue(valueCallback: ValueCallback<Schemas[1]>): void;
|
|
4774
4927
|
|
|
@@ -4793,7 +4946,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4793
4946
|
* (since the latter may become relevant due to changes made in the former).
|
|
4794
4947
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4795
4948
|
* though they will fire non-mutator listeners.
|
|
4796
|
-
*
|
|
4797
4949
|
* @param listener The function that will be called whenever data in the Store
|
|
4798
4950
|
* changes.
|
|
4799
4951
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -4866,7 +5018,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4866
5018
|
* (since the latter may become relevant due to changes made in the former).
|
|
4867
5019
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4868
5020
|
* though they will fire non-mutator listeners.
|
|
4869
|
-
*
|
|
4870
5021
|
* @param listener The function that will be called whenever the Table Ids in
|
|
4871
5022
|
* the Store change.
|
|
4872
5023
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -4944,7 +5095,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4944
5095
|
* (since the latter may become relevant due to changes made in the former).
|
|
4945
5096
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4946
5097
|
* though they will fire non-mutator listeners.
|
|
4947
|
-
*
|
|
4948
5098
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4949
5099
|
* @param listener The function that will be called whenever data in the
|
|
4950
5100
|
* matching Table changes.
|
|
@@ -5021,6 +5171,122 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5021
5171
|
mutator?: boolean,
|
|
5022
5172
|
): Id;
|
|
5023
5173
|
|
|
5174
|
+
/**
|
|
5175
|
+
* The addTableCellIdsListener method registers a listener function with the
|
|
5176
|
+
* Store that will be called whenever the Cell Ids that appear anywhere in a
|
|
5177
|
+
* Table change.
|
|
5178
|
+
*
|
|
5179
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
5180
|
+
*
|
|
5181
|
+
* ```ts override
|
|
5182
|
+
* addTableCellIdsListener(
|
|
5183
|
+
* tableId: IdOrNull,
|
|
5184
|
+
* listener: TableCellIdsListener,
|
|
5185
|
+
* mutator?: boolean,
|
|
5186
|
+
* ): Id;
|
|
5187
|
+
* ```
|
|
5188
|
+
*
|
|
5189
|
+
* The provided listener is a TableCellIdsListener function, and will be
|
|
5190
|
+
* called with a reference to the Store and the Id of the Table that changed.
|
|
5191
|
+
*
|
|
5192
|
+
* By default, such a listener is only called when a Cell Id is added or
|
|
5193
|
+
* removed from the whole of the Table. To listen to all changes in the Table,
|
|
5194
|
+
* use the addTableListener method.
|
|
5195
|
+
*
|
|
5196
|
+
* You can either listen to a single Table (by specifying its Id as the
|
|
5197
|
+
* method's first parameter) or changes to any Table (by providing a `null`
|
|
5198
|
+
* wildcard).
|
|
5199
|
+
*
|
|
5200
|
+
* Use the optional mutator parameter to indicate that there is code in the
|
|
5201
|
+
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
5202
|
+
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
5203
|
+
* this flag set to `true`) are called _before_ any non-mutator listeners
|
|
5204
|
+
* (since the latter may become relevant due to changes made in the former).
|
|
5205
|
+
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5206
|
+
* though they will fire non-mutator listeners.
|
|
5207
|
+
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
5208
|
+
* @param listener The function that will be called whenever the Cell Ids that
|
|
5209
|
+
* appear anywhere in a Table change.
|
|
5210
|
+
* @param mutator An optional boolean that indicates that the listener mutates
|
|
5211
|
+
* Store data.
|
|
5212
|
+
* @returns A unique Id for the listener that can later be used to call it
|
|
5213
|
+
* explicitly, or to remove it.
|
|
5214
|
+
* @example
|
|
5215
|
+
* This example registers a listener that responds to any change to the Cell
|
|
5216
|
+
* Ids that appear anywhere in a Table.
|
|
5217
|
+
*
|
|
5218
|
+
* ```js
|
|
5219
|
+
* const store = createStore().setTables({
|
|
5220
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
5221
|
+
* });
|
|
5222
|
+
* const listenerId = store.addTableCellIdsListener('pets', (store) => {
|
|
5223
|
+
* console.log('Cell Ids in pets table changed');
|
|
5224
|
+
* console.log(store.getTableCellIds('pets'));
|
|
5225
|
+
* });
|
|
5226
|
+
*
|
|
5227
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
5228
|
+
* // -> 'Cell Ids in pets table changed'
|
|
5229
|
+
* // -> ['species', 'color', 'legs']
|
|
5230
|
+
*
|
|
5231
|
+
* store.delListener(listenerId);
|
|
5232
|
+
* ```
|
|
5233
|
+
* @example
|
|
5234
|
+
* This example registers a listener that responds to any change to the Cell
|
|
5235
|
+
* Ids that appear anywhere in any Table.
|
|
5236
|
+
*
|
|
5237
|
+
* ```js
|
|
5238
|
+
* const store = createStore().setTables({
|
|
5239
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
5240
|
+
* species: {dog: {price: 5}},
|
|
5241
|
+
* });
|
|
5242
|
+
* const listenerId = store.addTableCellIdsListener(
|
|
5243
|
+
* null,
|
|
5244
|
+
* (store, tableId) => {
|
|
5245
|
+
* console.log(`Cell Ids in ${tableId} table changed`);
|
|
5246
|
+
* console.log(store.getTableCellIds(tableId));
|
|
5247
|
+
* },
|
|
5248
|
+
* );
|
|
5249
|
+
*
|
|
5250
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
5251
|
+
* // -> 'Cell Ids in pets table changed'
|
|
5252
|
+
* // -> ['species', 'color', 'legs']
|
|
5253
|
+
*
|
|
5254
|
+
* store.setRow('species', 'cat', {price: 4, friendly: true});
|
|
5255
|
+
* // -> 'Cell Ids in species table changed'
|
|
5256
|
+
* // -> ['price', 'friendly']
|
|
5257
|
+
*
|
|
5258
|
+
* store.delListener(listenerId);
|
|
5259
|
+
* ```
|
|
5260
|
+
* @example
|
|
5261
|
+
* This example registers a listener that responds to the Cell Ids that appear
|
|
5262
|
+
* anywhere in a Table, and which also mutates the Store itself.
|
|
5263
|
+
*
|
|
5264
|
+
* ```js
|
|
5265
|
+
* const store = createStore().setTables({
|
|
5266
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
5267
|
+
* });
|
|
5268
|
+
* const listenerId = store.addTableCellIdsListener(
|
|
5269
|
+
* 'pets',
|
|
5270
|
+
* (store, tableId) => store.setCell('meta', 'update', tableId, true),
|
|
5271
|
+
* true, // mutator
|
|
5272
|
+
* );
|
|
5273
|
+
*
|
|
5274
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
5275
|
+
* console.log(store.getTable('meta'));
|
|
5276
|
+
* // -> {update: {pets: true}}
|
|
5277
|
+
*
|
|
5278
|
+
* store.delListener(listenerId);
|
|
5279
|
+
* ```
|
|
5280
|
+
* @category Listener
|
|
5281
|
+
*/
|
|
5282
|
+
addTableCellIdsListener<
|
|
5283
|
+
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
5284
|
+
>(
|
|
5285
|
+
tableId: TableIdOrNull,
|
|
5286
|
+
listener: TableCellIdsListener<Schemas, TableIdOrNull>,
|
|
5287
|
+
mutator?: boolean,
|
|
5288
|
+
): Id;
|
|
5289
|
+
|
|
5024
5290
|
/**
|
|
5025
5291
|
* The addRowIdsListener method registers a listener function with the Store
|
|
5026
5292
|
* that will be called whenever the Row Ids in a Table change.
|
|
@@ -5052,7 +5318,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5052
5318
|
* (since the latter may become relevant due to changes made in the former).
|
|
5053
5319
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5054
5320
|
* though they will fire non-mutator listeners.
|
|
5055
|
-
*
|
|
5056
5321
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
5057
5322
|
* @param listener The function that will be called whenever the Row Ids in
|
|
5058
5323
|
* the Table change.
|
|
@@ -5170,7 +5435,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5170
5435
|
* (since the latter may become relevant due to changes made in the former).
|
|
5171
5436
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5172
5437
|
* though they will fire non-mutator listeners.
|
|
5173
|
-
*
|
|
5174
5438
|
* @param tableId The Id of the Table to listen to.
|
|
5175
5439
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
5176
5440
|
* `undefined` to sort by the Row Id itself.
|
|
@@ -5219,7 +5483,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5219
5483
|
* store.delListener(listenerId);
|
|
5220
5484
|
* ```
|
|
5221
5485
|
* @example
|
|
5222
|
-
* This
|
|
5486
|
+
* This example registers a listener that responds to any change to a
|
|
5223
5487
|
* paginated section of the sorted Row Ids of a specific Table.
|
|
5224
5488
|
*
|
|
5225
5489
|
* ```js
|
|
@@ -5351,7 +5615,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5351
5615
|
* store.delListener(listenerId);
|
|
5352
5616
|
* ```
|
|
5353
5617
|
* @category Listener
|
|
5354
|
-
* @since v2.0
|
|
5618
|
+
* @since v2.0.0
|
|
5355
5619
|
*/
|
|
5356
5620
|
addSortedRowIdsListener<
|
|
5357
5621
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
@@ -5412,7 +5676,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5412
5676
|
* (since the latter may become relevant due to changes made in the former).
|
|
5413
5677
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5414
5678
|
* though they will fire non-mutator listeners.
|
|
5415
|
-
*
|
|
5416
5679
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
5417
5680
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
5418
5681
|
* @param listener The function that will be called whenever data in the
|
|
@@ -5538,7 +5801,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5538
5801
|
* (since the latter may become relevant due to changes made in the former).
|
|
5539
5802
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5540
5803
|
* though they will fire non-mutator listeners.
|
|
5541
|
-
*
|
|
5542
5804
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
5543
5805
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
5544
5806
|
* @param listener The function that will be called whenever the Cell Ids in
|
|
@@ -5658,7 +5920,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5658
5920
|
* (since the latter may become relevant due to changes made in the former).
|
|
5659
5921
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5660
5922
|
* though they will fire non-mutator listeners.
|
|
5661
|
-
*
|
|
5662
5923
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
5663
5924
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
5664
5925
|
* @param cellId The Id of the Cell to listen to, or `null` as a wildcard.
|
|
@@ -5781,7 +6042,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5781
6042
|
* (since the latter may become relevant due to changes made in the former).
|
|
5782
6043
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5783
6044
|
* though they will fire non-mutator listeners.
|
|
5784
|
-
*
|
|
5785
6045
|
* @param listener The function that will be called whenever data in the
|
|
5786
6046
|
* Values changes.
|
|
5787
6047
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -5823,7 +6083,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5823
6083
|
* store.delListener(listenerId);
|
|
5824
6084
|
* ```
|
|
5825
6085
|
* @category Listener
|
|
5826
|
-
* @since v3.0
|
|
6086
|
+
* @since v3.0.0
|
|
5827
6087
|
*/
|
|
5828
6088
|
addValuesListener(listener: ValuesListener<Schemas>, mutator?: boolean): Id;
|
|
5829
6089
|
|
|
@@ -5851,7 +6111,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5851
6111
|
* (since the latter may become relevant due to changes made in the former).
|
|
5852
6112
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5853
6113
|
* though they will fire non-mutator listeners.
|
|
5854
|
-
*
|
|
5855
6114
|
* @param listener The function that will be called whenever the Value Ids in
|
|
5856
6115
|
* the Store change.
|
|
5857
6116
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -5893,7 +6152,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5893
6152
|
* store.delListener(listenerId);
|
|
5894
6153
|
* ```
|
|
5895
6154
|
* @category Listener
|
|
5896
|
-
* @since v3.0
|
|
6155
|
+
* @since v3.0.0
|
|
5897
6156
|
*/
|
|
5898
6157
|
addValueIdsListener(
|
|
5899
6158
|
listener: ValueIdsListener<Schemas>,
|
|
@@ -5929,7 +6188,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5929
6188
|
* (since the latter may become relevant due to changes made in the former).
|
|
5930
6189
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
5931
6190
|
* though they will fire non-mutator listeners.
|
|
5932
|
-
*
|
|
5933
6191
|
* @param valueId The Id of the Value to listen to, or `null` as a wildcard.
|
|
5934
6192
|
* @param listener The function that will be called whenever data in the
|
|
5935
6193
|
* matching Value changes.
|
|
@@ -5995,7 +6253,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5995
6253
|
* store.delListener(listenerId);
|
|
5996
6254
|
* ```
|
|
5997
6255
|
* @category Listener
|
|
5998
|
-
* @since v3.0
|
|
6256
|
+
* @since v3.0.0
|
|
5999
6257
|
*/
|
|
6000
6258
|
addValueListener<ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null>(
|
|
6001
6259
|
valueId: ValueIdOrNull,
|
|
@@ -6060,7 +6318,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6060
6318
|
*
|
|
6061
6319
|
* To help understand all of these schema-based conditions, please see the
|
|
6062
6320
|
* TablesSchema example below.
|
|
6063
|
-
*
|
|
6064
6321
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
6065
6322
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
6066
6323
|
* @param cellId The Id of the Cell to listen to, or `null` as a wildcard.
|
|
@@ -6236,7 +6493,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6236
6493
|
* store.delListener(listenerId);
|
|
6237
6494
|
* ```
|
|
6238
6495
|
* @category Listener
|
|
6239
|
-
* @since v1.1
|
|
6496
|
+
* @since v1.1.0
|
|
6240
6497
|
*/
|
|
6241
6498
|
addInvalidCellListener(
|
|
6242
6499
|
tableId: IdOrNull,
|
|
@@ -6294,7 +6551,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6294
6551
|
*
|
|
6295
6552
|
* To help understand all of these schema-based conditions, please see the
|
|
6296
6553
|
* ValuesSchema example below.
|
|
6297
|
-
*
|
|
6298
6554
|
* @param valueId The Id of the Value to listen to, or `null` as a wildcard.
|
|
6299
6555
|
* @param listener The function that will be called whenever an attempt to
|
|
6300
6556
|
* write invalid data to the matching Value was made.
|
|
@@ -6424,7 +6680,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6424
6680
|
* store.delListener(listenerId);
|
|
6425
6681
|
* ```
|
|
6426
6682
|
* @category Listener
|
|
6427
|
-
* @since v3.0
|
|
6683
|
+
* @since v3.0.0
|
|
6428
6684
|
*/
|
|
6429
6685
|
addInvalidValueListener(
|
|
6430
6686
|
valueId: IdOrNull,
|
|
@@ -6450,7 +6706,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6450
6706
|
* Note that a TransactionListener added to the Store with this method can
|
|
6451
6707
|
* mutate the Store, and its changes will be treated as part of the
|
|
6452
6708
|
* transaction that is starting.
|
|
6453
|
-
*
|
|
6454
6709
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
6455
6710
|
* @example
|
|
6456
6711
|
* This example registers a listener that is called at start end of the
|
|
@@ -6513,7 +6768,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6513
6768
|
* mutate the Store itself, and its changes will be treated as part of the
|
|
6514
6769
|
* transaction that is starting (and may fire non-mutating listeners after
|
|
6515
6770
|
* this).
|
|
6516
|
-
*
|
|
6517
6771
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
6518
6772
|
* @example
|
|
6519
6773
|
* This example registers a listener that is called at the end of the
|
|
@@ -6583,7 +6837,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6583
6837
|
* .delListener(listenerId3);
|
|
6584
6838
|
* ```
|
|
6585
6839
|
* @category Listener
|
|
6586
|
-
* @since v1.3
|
|
6840
|
+
* @since v1.3.0
|
|
6587
6841
|
*/
|
|
6588
6842
|
addWillFinishTransactionListener(listener: TransactionListener<Schemas>): Id;
|
|
6589
6843
|
|
|
@@ -6616,7 +6870,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6616
6870
|
*
|
|
6617
6871
|
* Note that a TransactionListener added to the Store with this method
|
|
6618
6872
|
* _cannot_ mutate the Store itself, and attempts to do so will fail silently.
|
|
6619
|
-
*
|
|
6620
6873
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
6621
6874
|
* @example
|
|
6622
6875
|
* This example registers a listener that is called at the end of the
|
|
@@ -6686,7 +6939,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6686
6939
|
* .delListener(listenerId3);
|
|
6687
6940
|
* ```
|
|
6688
6941
|
* @category Listener
|
|
6689
|
-
* @since v1.3
|
|
6942
|
+
* @since v1.3.0
|
|
6690
6943
|
*/
|
|
6691
6944
|
addDidFinishTransactionListener(listener: TransactionListener<Schemas>): Id;
|
|
6692
6945
|
|
|
@@ -6703,7 +6956,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6703
6956
|
* This is useful when you are using mutator listeners to guarantee that data
|
|
6704
6957
|
* conforms to programmatic conditions, and those conditions change such that
|
|
6705
6958
|
* you need to update the Store in bulk.
|
|
6706
|
-
*
|
|
6707
6959
|
* @param listenerId The Id of the listener to call.
|
|
6708
6960
|
* @returns A reference to the Store.
|
|
6709
6961
|
* @example
|
|
@@ -6825,7 +7077,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6825
7077
|
*
|
|
6826
7078
|
* Use the Id returned by whichever method was used to add the listener. Note
|
|
6827
7079
|
* that the Store may re-use this Id for future listeners added to it.
|
|
6828
|
-
*
|
|
6829
7080
|
* @param listenerId The Id of the listener to remove.
|
|
6830
7081
|
* @returns A reference to the Store.
|
|
6831
7082
|
* @example
|
|
@@ -6863,7 +7114,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6863
7114
|
* return an empty object. The method is intended to be used during
|
|
6864
7115
|
* development to ensure your application is not leaking listener
|
|
6865
7116
|
* registrations, for example.
|
|
6866
|
-
*
|
|
6867
7117
|
* @returns A StoreListenerStats object containing Store listener statistics.
|
|
6868
7118
|
* @example
|
|
6869
7119
|
* This example gets the listener statistics of a small and simple Store.
|
|
@@ -6896,7 +7146,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6896
7146
|
*
|
|
6897
7147
|
* Since (or perhaps _because_) it is the most important function in the whole
|
|
6898
7148
|
* module, it is trivially simple.
|
|
6899
|
-
*
|
|
6900
7149
|
* @returns A reference to the new Store.
|
|
6901
7150
|
* @example
|
|
6902
7151
|
* This example creates a Store.
|