tinybase 4.0.0-beta.3 → 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/queries.cjs +1 -1
- package/lib/cjs/queries.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/queries.cjs +1 -1
- package/lib/cjs-es6/queries.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/queries.js +1 -1
- package/lib/debug/store.js +104 -40
- package/lib/debug/tinybase.js +148 -57
- package/lib/debug/tools.js +129 -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/queries.js +1 -1
- package/lib/es6/queries.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/queries.js +1 -1
- package/lib/queries.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 +397 -193
- 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 +544 -236
- 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/queries.js +1 -1
- package/lib/umd/queries.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/queries.js +1 -1
- package/lib/umd-es6/queries.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 +39 -22
- 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
package/lib/types/store.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -20,7 +19,6 @@ import {Id, IdOrNull, Ids, Json} from './common.d';
|
|
|
20
19
|
* A TablesSchema comprises a JavaScript object describing each Table, in turn a
|
|
21
20
|
* nested JavaScript object containing information about each Cell and its
|
|
22
21
|
* CellSchema. It is provided to the setTablesSchema method.
|
|
23
|
-
*
|
|
24
22
|
* @example
|
|
25
23
|
* When applied to a Store, this TablesSchema only allows one Table called
|
|
26
24
|
* `pets`, in which each Row may contain a string `species` Cell, and is
|
|
@@ -52,7 +50,6 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
52
50
|
* If the default value is _not_ provided (or its type is incorrect), the Cell
|
|
53
51
|
* may be missing from the Row, but when present you can be guaranteed it is of
|
|
54
52
|
* the correct type.
|
|
55
|
-
*
|
|
56
53
|
* @example
|
|
57
54
|
* When applied to a Store, this CellSchema ensures a boolean Cell is always
|
|
58
55
|
* present, and defaults it to `false`.
|
|
@@ -73,7 +70,6 @@ export type CellSchema =
|
|
|
73
70
|
*
|
|
74
71
|
* A ValuesSchema comprises a JavaScript object describing each Value and its
|
|
75
72
|
* ValueSchema. It is provided to the setValuesSchema method.
|
|
76
|
-
*
|
|
77
73
|
* @example
|
|
78
74
|
* When applied to a Store, this ValuesSchema only allows one boolean Value
|
|
79
75
|
* called `open`, that defaults to `false`.
|
|
@@ -84,7 +80,7 @@ export type CellSchema =
|
|
|
84
80
|
* };
|
|
85
81
|
* ```
|
|
86
82
|
* @category Schema
|
|
87
|
-
* @since v3.0
|
|
83
|
+
* @since v3.0.0
|
|
88
84
|
*/
|
|
89
85
|
export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
90
86
|
|
|
@@ -102,7 +98,6 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
102
98
|
* If the default value is _not_ provided (or its type is incorrect), the Value
|
|
103
99
|
* may not be present in the Store, but when present you can be guaranteed it is
|
|
104
100
|
* of the correct type.
|
|
105
|
-
*
|
|
106
101
|
* @example
|
|
107
102
|
* When applied to a Store, this ValueSchema ensures a boolean Value is always
|
|
108
103
|
* present, and defaults it to `false`.
|
|
@@ -111,7 +106,7 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
111
106
|
* const requiredBoolean: ValueSchema = {type: 'boolean', default: false};
|
|
112
107
|
* ```
|
|
113
108
|
* @category Schema
|
|
114
|
-
* @since v3.0
|
|
109
|
+
* @since v3.0.0
|
|
115
110
|
*/
|
|
116
111
|
export type ValueSchema =
|
|
117
112
|
| {type: 'string'; default?: string}
|
|
@@ -121,7 +116,6 @@ export type ValueSchema =
|
|
|
121
116
|
/**
|
|
122
117
|
* The NoTablesSchema type is a TablesSchema-like type for when one has not been
|
|
123
118
|
* provided.
|
|
124
|
-
*
|
|
125
119
|
* @category Schema
|
|
126
120
|
*/
|
|
127
121
|
export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
@@ -129,7 +123,6 @@ export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
|
129
123
|
/**
|
|
130
124
|
* The NoValuesSchema type is a ValuesSchema-like type for when one has not been
|
|
131
125
|
* provided.
|
|
132
|
-
*
|
|
133
126
|
* @category Schema
|
|
134
127
|
*/
|
|
135
128
|
export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
@@ -137,7 +130,6 @@ export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
|
137
130
|
/**
|
|
138
131
|
* The OptionalTablesSchema type is used by generic types that can optionally
|
|
139
132
|
* take a TablesSchema.
|
|
140
|
-
*
|
|
141
133
|
* @category Schema
|
|
142
134
|
*/
|
|
143
135
|
export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
@@ -145,7 +137,6 @@ export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
|
145
137
|
/**
|
|
146
138
|
* The OptionalValuesSchema type is used by generic types that can optionally
|
|
147
139
|
* take a ValuesSchema.
|
|
148
|
-
*
|
|
149
140
|
* @category Schema
|
|
150
141
|
*/
|
|
151
142
|
export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
@@ -153,7 +144,6 @@ export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
|
153
144
|
/**
|
|
154
145
|
* The OptionalSchemas type is used by generic types that can optionally take
|
|
155
146
|
* either or both of a TablesSchema and ValuesSchema.
|
|
156
|
-
*
|
|
157
147
|
* @category Schema
|
|
158
148
|
*/
|
|
159
149
|
export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
@@ -161,7 +151,6 @@ export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
|
161
151
|
/**
|
|
162
152
|
* The NoSchemas type is used as a default by generic types that can optionally
|
|
163
153
|
* take either or both of a TablesSchema and ValuesSchema.
|
|
164
|
-
*
|
|
165
154
|
* @category Schema
|
|
166
155
|
*/
|
|
167
156
|
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
@@ -174,7 +163,6 @@ export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
|
174
163
|
* setTables method, and when getting them back out again with the getTables
|
|
175
164
|
* method. A Tables object is a regular JavaScript object containing individual
|
|
176
165
|
* Table objects, keyed by their Id.
|
|
177
|
-
*
|
|
178
166
|
* @example
|
|
179
167
|
* ```js
|
|
180
168
|
* const tables: Tables = {
|
|
@@ -199,7 +187,6 @@ export type Tables = {[tableId: Id]: Table};
|
|
|
199
187
|
* getting it back out again with the getTable method. A Table object is a
|
|
200
188
|
* regular JavaScript object containing individual Row objects, keyed by their
|
|
201
189
|
* Id.
|
|
202
|
-
*
|
|
203
190
|
* @example
|
|
204
191
|
* ```js
|
|
205
192
|
* const table: Table = {
|
|
@@ -217,7 +204,6 @@ export type Table = {[rowId: Id]: Row};
|
|
|
217
204
|
* A Row is used when setting a row with the setRow method, and when getting it
|
|
218
205
|
* back out again with the getRow method. A Row object is a regular JavaScript
|
|
219
206
|
* object containing individual Cell objects, keyed by their Id.
|
|
220
|
-
*
|
|
221
207
|
* @example
|
|
222
208
|
* ```js
|
|
223
209
|
* const row: Row = {species: 'dog', color: 'brown'};
|
|
@@ -232,7 +218,6 @@ export type Row = {[cellId: Id]: Cell};
|
|
|
232
218
|
* A Cell is used when setting a cell with the setCell method, and when getting
|
|
233
219
|
* it back out again with the getCell method. A Cell is a JavaScript string,
|
|
234
220
|
* number, or boolean.
|
|
235
|
-
*
|
|
236
221
|
* @example
|
|
237
222
|
* ```js
|
|
238
223
|
* const cell: Cell = 'dog';
|
|
@@ -248,7 +233,6 @@ export type Cell = string | number | boolean;
|
|
|
248
233
|
* This is used when describing a Cell that is present _or_ that is not present,
|
|
249
234
|
* such as when it has been deleted, or when describing a previous state where
|
|
250
235
|
* the Cell value has since been added.
|
|
251
|
-
*
|
|
252
236
|
* @category Store
|
|
253
237
|
*/
|
|
254
238
|
export type CellOrUndefined = Cell | undefined;
|
|
@@ -261,13 +245,12 @@ export type CellOrUndefined = Cell | undefined;
|
|
|
261
245
|
* when getting them back out again with the getValues method. A Values object
|
|
262
246
|
* is a regular JavaScript object containing individual Value objects, keyed by
|
|
263
247
|
* their Id.
|
|
264
|
-
*
|
|
265
248
|
* @example
|
|
266
249
|
* ```js
|
|
267
250
|
* const values: Values = {open: true, employees: 4};
|
|
268
251
|
* ```
|
|
269
252
|
* @category Store
|
|
270
|
-
* @since v3.0
|
|
253
|
+
* @since v3.0.0
|
|
271
254
|
*/
|
|
272
255
|
export type Values = {[valueId: Id]: Value};
|
|
273
256
|
|
|
@@ -278,13 +261,12 @@ export type Values = {[valueId: Id]: Value};
|
|
|
278
261
|
* A Value is used when setting a value with the setValue method, and when
|
|
279
262
|
* getting it back out again with the getValue method. A Value is a JavaScript
|
|
280
263
|
* string, number, or boolean.
|
|
281
|
-
*
|
|
282
264
|
* @example
|
|
283
265
|
* ```js
|
|
284
266
|
* const value: Value = 'dog';
|
|
285
267
|
* ```
|
|
286
268
|
* @category Store
|
|
287
|
-
* @since v3.0
|
|
269
|
+
* @since v3.0.0
|
|
288
270
|
*/
|
|
289
271
|
export type Value = string | number | boolean;
|
|
290
272
|
|
|
@@ -295,9 +277,8 @@ export type Value = string | number | boolean;
|
|
|
295
277
|
* This is used when describing a Value that is present _or_ that is not
|
|
296
278
|
* present, such as when it has been deleted, or when describing a previous
|
|
297
279
|
* state where the Value has since been added.
|
|
298
|
-
*
|
|
299
280
|
* @category Store
|
|
300
|
-
* @since v3.0
|
|
281
|
+
* @since v3.0.0
|
|
301
282
|
*/
|
|
302
283
|
export type ValueOrUndefined = Value | undefined;
|
|
303
284
|
|
|
@@ -308,7 +289,6 @@ export type ValueOrUndefined = Value | undefined;
|
|
|
308
289
|
* A TableCallback is provided when using the forEachTable method, so that you
|
|
309
290
|
* can do something based on every Table in the Store. See that method for
|
|
310
291
|
* specific examples.
|
|
311
|
-
*
|
|
312
292
|
* @param tableId The Id of the Table that the callback can operate on.
|
|
313
293
|
* @param forEachRow A function that will let you iterate over the Row objects
|
|
314
294
|
* in this Table.
|
|
@@ -319,6 +299,19 @@ export type TableCallback = (
|
|
|
319
299
|
forEachRow: (rowCallback: RowCallback) => void,
|
|
320
300
|
) => void;
|
|
321
301
|
|
|
302
|
+
/**
|
|
303
|
+
* The TableCellCallback type describes a function that takes a Cell's Id and
|
|
304
|
+
* the count of times it appears across a whole Table.
|
|
305
|
+
*
|
|
306
|
+
* A TableCellCallback is provided when using the forEachTableCell method, so
|
|
307
|
+
* that you can do something based on every Cell used across a Table. See that
|
|
308
|
+
* method for specific examples.
|
|
309
|
+
* @param cellId The Id of the Cell that the callback can operate on.
|
|
310
|
+
* @param count The number of times this Cell is used across a whole Table.
|
|
311
|
+
* @category Callback
|
|
312
|
+
*/
|
|
313
|
+
export type TableCellCallback = (cellId: Id, count: number) => void;
|
|
314
|
+
|
|
322
315
|
/**
|
|
323
316
|
* The RowCallback type describes a function that takes a Row's Id and a
|
|
324
317
|
* callback to loop over each Cell within it.
|
|
@@ -326,7 +319,6 @@ export type TableCallback = (
|
|
|
326
319
|
* A RowCallback is provided when using the forEachRow method, so that you can
|
|
327
320
|
* do something based on every Row in a Table. See that method for specific
|
|
328
321
|
* examples.
|
|
329
|
-
*
|
|
330
322
|
* @param rowId The Id of the Row that the callback can operate on.
|
|
331
323
|
* @param forEachRow A function that will let you iterate over the Cell values
|
|
332
324
|
* in this Row.
|
|
@@ -344,7 +336,6 @@ export type RowCallback = (
|
|
|
344
336
|
* A CellCallback is provided when using the forEachCell method, so that you can
|
|
345
337
|
* do something based on every Cell in a Row. See that method for specific
|
|
346
338
|
* examples.
|
|
347
|
-
*
|
|
348
339
|
* @param cellId The Id of the Cell that the callback can operate on.
|
|
349
340
|
* @param cell The value of the Cell.
|
|
350
341
|
* @category Callback
|
|
@@ -358,11 +349,10 @@ export type CellCallback = (cellId: Id, cell: Cell) => void;
|
|
|
358
349
|
* A ValueCallback is provided when using the forEachValue method, so that you
|
|
359
350
|
* can do something based on every Value in a Store. See that method for
|
|
360
351
|
* specific examples.
|
|
361
|
-
*
|
|
362
352
|
* @param valueId The Id of the Value that the callback can operate on.
|
|
363
353
|
* @param value The Value itself.
|
|
364
354
|
* @category Callback
|
|
365
|
-
* @since v3.0
|
|
355
|
+
* @since v3.0.0
|
|
366
356
|
*/
|
|
367
357
|
export type ValueCallback = (valueId: Id, value: Value) => void;
|
|
368
358
|
|
|
@@ -373,7 +363,6 @@ export type ValueCallback = (valueId: Id, value: Value) => void;
|
|
|
373
363
|
* A MapCell can be provided in the setCell method to map an existing value to a
|
|
374
364
|
* new one, such as when incrementing a number. See that method for specific
|
|
375
365
|
* examples.
|
|
376
|
-
*
|
|
377
366
|
* @param cell The current value of the Cell to map to a new value.
|
|
378
367
|
* @category Callback
|
|
379
368
|
*/
|
|
@@ -386,10 +375,9 @@ export type MapCell = (cell: CellOrUndefined) => Cell;
|
|
|
386
375
|
* A MapValue can be provided in the setValue method to map an existing Value to
|
|
387
376
|
* a new one, such as when incrementing a number. See that method for specific
|
|
388
377
|
* examples.
|
|
389
|
-
*
|
|
390
378
|
* @param value The current Value to map to a new Value.
|
|
391
379
|
* @category Callback
|
|
392
|
-
* @since v3.0
|
|
380
|
+
* @since v3.0.0
|
|
393
381
|
*/
|
|
394
382
|
export type MapValue = (value: ValueOrUndefined) => Value;
|
|
395
383
|
|
|
@@ -400,7 +388,6 @@ export type MapValue = (value: ValueOrUndefined) => Value;
|
|
|
400
388
|
* A GetCell can be provided when setting definitions, as in the
|
|
401
389
|
* setMetricDefinition method of a Metrics object, or the setIndexDefinition
|
|
402
390
|
* method of an Indexes object. See those methods for specific examples.
|
|
403
|
-
*
|
|
404
391
|
* @param cellId The Id of the Cell to fetch the value for.
|
|
405
392
|
* @category Callback
|
|
406
393
|
*/
|
|
@@ -497,7 +484,6 @@ export type ChangedValueIds = {[valueId: Id]: IdAddedOrRemoved};
|
|
|
497
484
|
* call to get information about the changes made within the transaction (in
|
|
498
485
|
* order to decide whether to do the rollback). See the GetTransactionChanges
|
|
499
486
|
* and GetTransactionLog function types for more details.
|
|
500
|
-
*
|
|
501
487
|
* @param getTransactionChanges A function to be called to get the changes made
|
|
502
488
|
* to the Store during the transaction, since v4.0.
|
|
503
489
|
* @param getTransactionChanges A function to be called to get a more detailed
|
|
@@ -521,7 +507,6 @@ export type DoRollback = (
|
|
|
521
507
|
* and, since v4.0, two functions that you can call to get information about the
|
|
522
508
|
* changes made within the transaction. See the GetTransactionChanges and
|
|
523
509
|
* GetTransactionLog function types for more details.
|
|
524
|
-
*
|
|
525
510
|
* @param store A reference to the Store that is completing a transaction.
|
|
526
511
|
* @param getTransactionChanges A function to be called to get the changes made
|
|
527
512
|
* to the Store during the transaction, since v4.0.
|
|
@@ -549,7 +534,6 @@ export type TransactionListener = (
|
|
|
549
534
|
* Note that if the listener was manually forced to be called (with the
|
|
550
535
|
* callListener method rather than due to a real change in the Store), the
|
|
551
536
|
* GetCellChange function will not be present.
|
|
552
|
-
*
|
|
553
537
|
* @param store A reference to the Store that changed.
|
|
554
538
|
* @param getCellChange A function that returns information about any Cell's
|
|
555
539
|
* changes.
|
|
@@ -569,10 +553,17 @@ export type TablesListener = (
|
|
|
569
553
|
*
|
|
570
554
|
* When called, a TableIdsListener is given a reference to the Store.
|
|
571
555
|
*
|
|
556
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
557
|
+
* used to query which Ids changed during the transaction.
|
|
572
558
|
* @param store A reference to the Store that changed.
|
|
559
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
560
|
+
* since v3.3.
|
|
573
561
|
* @category Listener
|
|
574
562
|
*/
|
|
575
|
-
export type TableIdsListener = (
|
|
563
|
+
export type TableIdsListener = (
|
|
564
|
+
store: Store,
|
|
565
|
+
getIdChanges: GetIdChanges | undefined,
|
|
566
|
+
) => void;
|
|
576
567
|
|
|
577
568
|
/**
|
|
578
569
|
* The TableListener type describes a function that is used to listen to changes
|
|
@@ -588,7 +579,6 @@ export type TableIdsListener = (store: Store) => void;
|
|
|
588
579
|
* Note that if the listener was manually forced to be called (with the
|
|
589
580
|
* callListener method rather than due to a real change in the Store), the
|
|
590
581
|
* GetCellChange function will not be present.
|
|
591
|
-
*
|
|
592
582
|
* @param store A reference to the Store that changed.
|
|
593
583
|
* @param tableId The Id of the Table that changed.
|
|
594
584
|
* @param getCellChange A function that returns information about any Cell's
|
|
@@ -601,6 +591,28 @@ export type TableListener = (
|
|
|
601
591
|
getCellChange: GetCellChange | undefined,
|
|
602
592
|
) => void;
|
|
603
593
|
|
|
594
|
+
/**
|
|
595
|
+
* The TableCellIdsListener type describes a function that is used to listen to
|
|
596
|
+
* changes to the Cell Ids that appear anywhere in a Table.
|
|
597
|
+
*
|
|
598
|
+
* A TableCellIdsListener is provided when using the addTableCellIdsListener
|
|
599
|
+
* method. See that method for specific examples.
|
|
600
|
+
*
|
|
601
|
+
* When called, a TableCellIdsListener is given a reference to the Store, the Id
|
|
602
|
+
* of the Table whose Cell Ids changed, and a GetIdChanges function that can be
|
|
603
|
+
* used to query which Ids changed during the transaction.
|
|
604
|
+
* @param store A reference to the Store that changed.
|
|
605
|
+
* @param tableId The Id of the Table that changed.
|
|
606
|
+
* @param getIdChanges A function that returns information about the Id changes.
|
|
607
|
+
* @category Listener
|
|
608
|
+
* @since v3.3.0
|
|
609
|
+
*/
|
|
610
|
+
export type TableCellIdsListener = (
|
|
611
|
+
store: Store,
|
|
612
|
+
tableId: Id,
|
|
613
|
+
getIdChanges: GetIdChanges | undefined,
|
|
614
|
+
) => void;
|
|
615
|
+
|
|
604
616
|
/**
|
|
605
617
|
* The RowIdsListener type describes a function that is used to listen to
|
|
606
618
|
* changes to the Row Ids in a Table.
|
|
@@ -611,11 +623,19 @@ export type TableListener = (
|
|
|
611
623
|
* When called, a RowIdsListener is given a reference to the Store, and the Id
|
|
612
624
|
* of the Table whose Row Ids changed.
|
|
613
625
|
*
|
|
626
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
627
|
+
* used to query which Ids changed during the transaction.
|
|
614
628
|
* @param store A reference to the Store that changed.
|
|
615
629
|
* @param tableId The Id of the Table that changed.
|
|
630
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
631
|
+
* since v3.3.
|
|
616
632
|
* @category Listener
|
|
617
633
|
*/
|
|
618
|
-
export type RowIdsListener = (
|
|
634
|
+
export type RowIdsListener = (
|
|
635
|
+
store: Store,
|
|
636
|
+
tableId: Id,
|
|
637
|
+
getIdChanges: GetIdChanges | undefined,
|
|
638
|
+
) => void;
|
|
619
639
|
|
|
620
640
|
/**
|
|
621
641
|
* The SortedRowIdsListener type describes a function that is used to listen to
|
|
@@ -630,7 +650,6 @@ export type RowIdsListener = (store: Store, tableId: Id) => void;
|
|
|
630
650
|
* Ids returned, for pagination purposes. It also receives the sorted array of
|
|
631
651
|
* Ids itself, so that you can use them in the listener without the additional
|
|
632
652
|
* cost of an explicit call to getSortedRowIds.
|
|
633
|
-
*
|
|
634
653
|
* @param store A reference to the Store that changed.
|
|
635
654
|
* @param tableId The Id of the Table whose sorted Row Ids changed.
|
|
636
655
|
* @param cellId The Id of the Cell whose values were used for the sorting.
|
|
@@ -639,7 +658,7 @@ export type RowIdsListener = (store: Store, tableId: Id) => void;
|
|
|
639
658
|
* @param limit The maximum number of Row Ids returned.
|
|
640
659
|
* @param sortedRowIds The sorted Row Ids themselves.
|
|
641
660
|
* @category Listener
|
|
642
|
-
* @since v2.0
|
|
661
|
+
* @since v2.0.0
|
|
643
662
|
*/
|
|
644
663
|
export type SortedRowIdsListener = (
|
|
645
664
|
store: Store,
|
|
@@ -666,7 +685,6 @@ export type SortedRowIdsListener = (
|
|
|
666
685
|
* Note that if the listener was manually forced to be called (with the
|
|
667
686
|
* callListener method rather than due to a real change in the Store), the
|
|
668
687
|
* GetCellChange function will not be present.
|
|
669
|
-
*
|
|
670
688
|
* @param store A reference to the Store that changed.
|
|
671
689
|
* @param tableId The Id of the Table that changed.
|
|
672
690
|
* @param rowId The Id of the Row that changed.
|
|
@@ -691,12 +709,21 @@ export type RowListener = (
|
|
|
691
709
|
* When called, a CellIdsListener is given a reference to the Store, the Id of
|
|
692
710
|
* the Table that changed, and the Id of the Row whose Cell Ids changed.
|
|
693
711
|
*
|
|
712
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
713
|
+
* used to query which Ids changed during the transaction.
|
|
694
714
|
* @param store A reference to the Store that changed.
|
|
695
715
|
* @param tableId The Id of the Table that changed.
|
|
696
716
|
* @param rowId The Id of the Row that changed.
|
|
717
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
718
|
+
* since v3.3.
|
|
697
719
|
* @category Listener
|
|
698
720
|
*/
|
|
699
|
-
export type CellIdsListener = (
|
|
721
|
+
export type CellIdsListener = (
|
|
722
|
+
store: Store,
|
|
723
|
+
tableId: Id,
|
|
724
|
+
rowId: Id,
|
|
725
|
+
getIdChanges: GetIdChanges | undefined,
|
|
726
|
+
) => void;
|
|
700
727
|
|
|
701
728
|
/**
|
|
702
729
|
* The CellListener type describes a function that is used to listen to changes
|
|
@@ -715,7 +742,6 @@ export type CellIdsListener = (store: Store, tableId: Id, rowId: Id) => void;
|
|
|
715
742
|
* callListener method rather than due to a real change in the Store), the
|
|
716
743
|
* GetCellChange function will not be present and the new and old values of the
|
|
717
744
|
* Cell will be the same.
|
|
718
|
-
*
|
|
719
745
|
* @param store A reference to the Store that changed.
|
|
720
746
|
* @param tableId The Id of the Table that changed.
|
|
721
747
|
* @param rowId The Id of the Row that changed.
|
|
@@ -750,7 +776,6 @@ export type CellListener = (
|
|
|
750
776
|
* Note that if the listener was manually forced to be called (with the
|
|
751
777
|
* callListener method rather than due to a real change in the Store), the
|
|
752
778
|
* GetValueChange function will not be present.
|
|
753
|
-
*
|
|
754
779
|
* @param store A reference to the Store that changed.
|
|
755
780
|
* @param getValueChange A function that returns information about any Value's
|
|
756
781
|
* changes.
|
|
@@ -770,10 +795,17 @@ export type ValuesListener = (
|
|
|
770
795
|
*
|
|
771
796
|
* When called, a ValueIdsListener is given a reference to the Store.
|
|
772
797
|
*
|
|
798
|
+
* Since v3.3, the listener is also passed a GetIdChanges function that can be
|
|
799
|
+
* used to query which Ids changed during the transaction.
|
|
773
800
|
* @param store A reference to the Store that changed.
|
|
801
|
+
* @param getIdChanges A function that returns information about the Id changes,
|
|
802
|
+
* since v3.3.
|
|
774
803
|
* @category Listener
|
|
775
804
|
*/
|
|
776
|
-
export type ValueIdsListener = (
|
|
805
|
+
export type ValueIdsListener = (
|
|
806
|
+
store: Store,
|
|
807
|
+
getIdChanges: GetIdChanges | undefined,
|
|
808
|
+
) => void;
|
|
777
809
|
|
|
778
810
|
/**
|
|
779
811
|
* The ValueListener type describes a function that is used to listen to changes
|
|
@@ -791,7 +823,6 @@ export type ValueIdsListener = (store: Store) => void;
|
|
|
791
823
|
* callListener method rather than due to a real change in the Store), the
|
|
792
824
|
* GetValueChange function will not be present and the new and old values of the
|
|
793
825
|
* Value will be the same.
|
|
794
|
-
*
|
|
795
826
|
* @param store A reference to the Store that changed.
|
|
796
827
|
* @param valueId The Id of the Value that changed.
|
|
797
828
|
* @param newValue The new value of the Value that changed.
|
|
@@ -799,7 +830,7 @@ export type ValueIdsListener = (store: Store) => void;
|
|
|
799
830
|
* @param getValueChange A function that returns information about any Value's
|
|
800
831
|
* changes.
|
|
801
832
|
* @category Listener
|
|
802
|
-
* @since v3.0
|
|
833
|
+
* @since v3.0.0
|
|
803
834
|
*/
|
|
804
835
|
export type ValueListener = (
|
|
805
836
|
store: Store,
|
|
@@ -822,14 +853,13 @@ export type ValueListener = (
|
|
|
822
853
|
* have been of absolutely any type. Since there could have been multiple failed
|
|
823
854
|
* attempts to set the Cell within a single transaction, this is an array
|
|
824
855
|
* containing each attempt, chronologically.
|
|
825
|
-
*
|
|
826
856
|
* @param store A reference to the Store that was being changed.
|
|
827
857
|
* @param tableId The Id of the Table that was being changed.
|
|
828
858
|
* @param rowId The Id of the Row that was being changed.
|
|
829
859
|
* @param cellId The Id of the Cell that was being changed.
|
|
830
860
|
* @param invalidCells An array of the values of the Cell that were invalid.
|
|
831
861
|
* @category Listener
|
|
832
|
-
* @since v1.1
|
|
862
|
+
* @since v1.1.0
|
|
833
863
|
*/
|
|
834
864
|
export type InvalidCellListener = (
|
|
835
865
|
store: Store,
|
|
@@ -852,12 +882,11 @@ export type InvalidCellListener = (
|
|
|
852
882
|
* Since there could have been multiple failed attempts to set the Value within
|
|
853
883
|
* a single transaction, this is an array containing each attempt,
|
|
854
884
|
* chronologically.
|
|
855
|
-
*
|
|
856
885
|
* @param store A reference to the Store that was being changed.
|
|
857
886
|
* @param valueId The Id of the Value that was being changed.
|
|
858
887
|
* @param invalidValues An array of the Values that were invalid.
|
|
859
888
|
* @category Listener
|
|
860
|
-
* @since v3.0
|
|
889
|
+
* @since v3.0.0
|
|
861
890
|
*/
|
|
862
891
|
export type InvalidValueListener = (
|
|
863
892
|
store: Store,
|
|
@@ -865,6 +894,22 @@ export type InvalidValueListener = (
|
|
|
865
894
|
invalidValues: any[],
|
|
866
895
|
) => void;
|
|
867
896
|
|
|
897
|
+
/**
|
|
898
|
+
* The GetIdChanges type describes a function that returns information about the
|
|
899
|
+
* changes to a set of Ids during a transaction.
|
|
900
|
+
*
|
|
901
|
+
* A GetIdChanges function is provided to every listener when called due Ids in
|
|
902
|
+
* the Store changing. It returns an object where each key is an Id that
|
|
903
|
+
* changed. The listener can then easily identify which Ids have been added
|
|
904
|
+
* (those with the value `1`), and which have been removed (those with the value
|
|
905
|
+
* `-1`).
|
|
906
|
+
* @returns An object keyed by Id with a numerical value. 1 means the Id was
|
|
907
|
+
* added, and 1 means it was removed.
|
|
908
|
+
* @category Listener
|
|
909
|
+
* @since v3.3.0
|
|
910
|
+
*/
|
|
911
|
+
export type GetIdChanges = () => {[id: Id]: 1 | -1};
|
|
912
|
+
|
|
868
913
|
/**
|
|
869
914
|
* The GetCellChange type describes a function that returns information about
|
|
870
915
|
* any Cell's changes during a transaction.
|
|
@@ -873,7 +918,6 @@ export type InvalidValueListener = (
|
|
|
873
918
|
* Store changing. The listener can then fetch the previous value of a Cell
|
|
874
919
|
* before the current transaction, the new value after it, and a convenience
|
|
875
920
|
* flag that indicates that the value has changed.
|
|
876
|
-
*
|
|
877
921
|
* @param tableId The Id of the Table to inspect.
|
|
878
922
|
* @param rowId The Id of the Row to inspect.
|
|
879
923
|
* @param cellId The Id of the Cell to inspect.
|
|
@@ -889,7 +933,6 @@ export type GetCellChange = (tableId: Id, rowId: Id, cellId: Id) => CellChange;
|
|
|
889
933
|
* listener when called. This array contains the previous value of a Cell before
|
|
890
934
|
* the current transaction, the new value after it, and a convenience flag that
|
|
891
935
|
* indicates that the value has changed.
|
|
892
|
-
*
|
|
893
936
|
* @category Listener
|
|
894
937
|
*/
|
|
895
938
|
export type CellChange = [
|
|
@@ -906,7 +949,6 @@ export type CellChange = [
|
|
|
906
949
|
* Store changing. The listener can then fetch the previous value of a Value
|
|
907
950
|
* before the current transaction, the new value after it, and a convenience
|
|
908
951
|
* flag that indicates that the value has changed.
|
|
909
|
-
*
|
|
910
952
|
* @param valueId The Id of the Value to inspect.
|
|
911
953
|
* @returns A ValueChange array containing information about the Value's
|
|
912
954
|
* changes.
|
|
@@ -921,7 +963,6 @@ export type GetValueChange = (valueId: Id) => ValueChange;
|
|
|
921
963
|
* listener when called. This array contains the previous value of a Value
|
|
922
964
|
* before the current transaction, the new value after it, and a convenience
|
|
923
965
|
* flag that indicates that the value has changed.
|
|
924
|
-
*
|
|
925
966
|
* @category Listener
|
|
926
967
|
*/
|
|
927
968
|
export type ValueChange = [
|
|
@@ -951,9 +992,8 @@ export type ValueChange = [
|
|
|
951
992
|
* two-part array will never contain two items of the same value (including two
|
|
952
993
|
* `undefined` values), even if, during the transaction, a Cell was changed to a
|
|
953
994
|
* different value and then changed back.
|
|
954
|
-
*
|
|
955
995
|
* @category Transaction
|
|
956
|
-
* @since v1.2
|
|
996
|
+
* @since v1.2.0
|
|
957
997
|
*/
|
|
958
998
|
export type ChangedCells = {
|
|
959
999
|
[tableId: Id]: {[rowId: Id]: {[cellId: Id]: ChangedCell}};
|
|
@@ -975,9 +1015,8 @@ export type ChangedCells = {
|
|
|
975
1015
|
* two-part array will never contain two items of the same value (including two
|
|
976
1016
|
* `undefined` values), even if, during the transaction, a Cell was changed to a
|
|
977
1017
|
* different value and then changed back.
|
|
978
|
-
*
|
|
979
1018
|
* @category Transaction
|
|
980
|
-
* @since v1.2
|
|
1019
|
+
* @since v1.2.0
|
|
981
1020
|
*/
|
|
982
1021
|
export type ChangedCell = [CellOrUndefined, CellOrUndefined];
|
|
983
1022
|
|
|
@@ -994,9 +1033,8 @@ export type ChangedCell = [CellOrUndefined, CellOrUndefined];
|
|
|
994
1033
|
* the Tables object, but one for which Cell values are listed in array (much
|
|
995
1034
|
* like the InvalidCellListener type) so that multiple failed attempts to change
|
|
996
1035
|
* a Cell during the transaction are described.
|
|
997
|
-
*
|
|
998
1036
|
* @category Transaction
|
|
999
|
-
* @since v1.2
|
|
1037
|
+
* @since v1.2.0
|
|
1000
1038
|
*/
|
|
1001
1039
|
export type InvalidCells = {
|
|
1002
1040
|
[tableId: Id]: {[rowId: Id]: {[cellId: Id]: any[]}};
|
|
@@ -1022,9 +1060,8 @@ export type InvalidCells = {
|
|
|
1022
1060
|
* array will never contain two items of the same value (including two
|
|
1023
1061
|
* `undefined` values), even if, during the transaction, a Value was changed to
|
|
1024
1062
|
* a different value and then changed back.
|
|
1025
|
-
*
|
|
1026
1063
|
* @category Transaction
|
|
1027
|
-
* @since v3.0
|
|
1064
|
+
* @since v3.0.0
|
|
1028
1065
|
*/
|
|
1029
1066
|
export type ChangedValues = {
|
|
1030
1067
|
[valueId: Id]: ChangedValue;
|
|
@@ -1046,9 +1083,8 @@ export type ChangedValues = {
|
|
|
1046
1083
|
* array will never contain two items of the same value (including two
|
|
1047
1084
|
* `undefined` values), even if, during the transaction, a Value was changed to
|
|
1048
1085
|
* a different value and then changed back.
|
|
1049
|
-
*
|
|
1050
1086
|
* @category Transaction
|
|
1051
|
-
* @since v3.0
|
|
1087
|
+
* @since v3.0.0
|
|
1052
1088
|
*/
|
|
1053
1089
|
export type ChangedValue = [ValueOrUndefined, ValueOrUndefined];
|
|
1054
1090
|
|
|
@@ -1064,9 +1100,8 @@ export type ChangedValue = [ValueOrUndefined, ValueOrUndefined];
|
|
|
1064
1100
|
* This type is an object containing each invalid Value's attempt listed in
|
|
1065
1101
|
* array (much like the InvalidValueListener type) so that multiple failed
|
|
1066
1102
|
* attempts to change a Value during the transaction are described.
|
|
1067
|
-
*
|
|
1068
1103
|
* @category Transaction
|
|
1069
|
-
* @since v3.0
|
|
1104
|
+
* @since v3.0.0
|
|
1070
1105
|
*/
|
|
1071
1106
|
export type InvalidValues = {[valueId: Id]: any[]};
|
|
1072
1107
|
|
|
@@ -1095,7 +1130,6 @@ export type InvalidValues = {[valueId: Id]: any[]};
|
|
|
1095
1130
|
* If not empty, the second object has an entry for each Value in a Store that
|
|
1096
1131
|
* has had a change. If the entry is null, the Value was deleted, otherwise it
|
|
1097
1132
|
* will contain the new Value it was changed to during the transaction.
|
|
1098
|
-
*
|
|
1099
1133
|
* @example
|
|
1100
1134
|
* The following is a valid TransactionChanges array that conveys the following:
|
|
1101
1135
|
* ```json
|
|
@@ -1113,9 +1147,8 @@ export type InvalidValues = {[valueId: Id]: any[]};
|
|
|
1113
1147
|
* {}, // no changes to keyed value data in the Store
|
|
1114
1148
|
* ]
|
|
1115
1149
|
* ```
|
|
1116
|
-
*
|
|
1117
1150
|
* @category Transaction
|
|
1118
|
-
* @since v4.0
|
|
1151
|
+
* @since v4.0.0
|
|
1119
1152
|
*/
|
|
1120
1153
|
export type TransactionChanges = [
|
|
1121
1154
|
{[tableId: Id]: {[rowId: Id]: {[cellId: Id]: Cell | null} | null} | null},
|
|
@@ -1129,9 +1162,8 @@ export type TransactionChanges = [
|
|
|
1129
1162
|
* It is provided to the DoRollback callback and to a TransactionListener
|
|
1130
1163
|
* listener when a transaction completes. See the TransactionChanges type for
|
|
1131
1164
|
* more information and an example of the returned data structure.
|
|
1132
|
-
*
|
|
1133
1165
|
* @category Transaction
|
|
1134
|
-
* @since v4.0
|
|
1166
|
+
* @since v4.0.0
|
|
1135
1167
|
*/
|
|
1136
1168
|
export type GetTransactionChanges = () => TransactionChanges;
|
|
1137
1169
|
|
|
@@ -1156,9 +1188,8 @@ export type GetTransactionChanges = () => TransactionChanges;
|
|
|
1156
1188
|
* all changes have been reverted.
|
|
1157
1189
|
*
|
|
1158
1190
|
* See the documentation for the types of the inner objects for other details.
|
|
1159
|
-
*
|
|
1160
1191
|
* @category Transaction
|
|
1161
|
-
* @since v4.0
|
|
1192
|
+
* @since v4.0.0
|
|
1162
1193
|
*/
|
|
1163
1194
|
export type TransactionLog = {
|
|
1164
1195
|
cellsTouched: boolean;
|
|
@@ -1180,9 +1211,8 @@ export type TransactionLog = {
|
|
|
1180
1211
|
* It is provided to the DoRollback callback and to a TransactionListener
|
|
1181
1212
|
* listener when a transaction completes. See the TransactionLog type for more
|
|
1182
1213
|
* information.
|
|
1183
|
-
*
|
|
1184
1214
|
* @category Transaction
|
|
1185
|
-
* @since v4.0
|
|
1215
|
+
* @since v4.0.0
|
|
1186
1216
|
*/
|
|
1187
1217
|
export type GetTransactionLog = () => TransactionLog;
|
|
1188
1218
|
|
|
@@ -1194,7 +1224,6 @@ export type GetTransactionLog = () => TransactionLog;
|
|
|
1194
1224
|
* listener. Totals include both mutator and non-mutator listeners. A
|
|
1195
1225
|
* StoreListenerStats object is returned from the getListenerStats method, and
|
|
1196
1226
|
* is only populated in a debug build.
|
|
1197
|
-
*
|
|
1198
1227
|
* @category Development
|
|
1199
1228
|
*/
|
|
1200
1229
|
export type StoreListenerStats = {
|
|
@@ -1210,6 +1239,11 @@ export type StoreListenerStats = {
|
|
|
1210
1239
|
* The number of TableListener functions registered with the Store.
|
|
1211
1240
|
*/
|
|
1212
1241
|
table?: number;
|
|
1242
|
+
/**
|
|
1243
|
+
* The number of TableCellIdsListener functions registered with the Store,
|
|
1244
|
+
* since v3.3.
|
|
1245
|
+
*/
|
|
1246
|
+
tableCellIds?: number;
|
|
1213
1247
|
/**
|
|
1214
1248
|
* The number of RowIdsListener functions registered with the Store.
|
|
1215
1249
|
*/
|
|
@@ -1350,6 +1384,7 @@ export type StoreListenerStats = {
|
|
|
1350
1384
|
* |Tables|getTables|setTables|delTables|addTablesListener|
|
|
1351
1385
|
* |Table Ids|getTableIds|-|-|addTableIdsListener|
|
|
1352
1386
|
* |Table|getTable|setTable|delTable|addTableListener|
|
|
1387
|
+
* |Table Cell Ids|getTableCellIds|-|-|addTableCellIdsListener|
|
|
1353
1388
|
* |Row Ids|getRowIds|-|-|addRowIdsListener|
|
|
1354
1389
|
* |Row Ids (sorted)|getSortedRowIds|-|-|addSortedRowIdsListener|
|
|
1355
1390
|
* |Row|getRow|setRow|delRow|addRowListener|
|
|
@@ -1410,7 +1445,6 @@ export type StoreListenerStats = {
|
|
|
1410
1445
|
*
|
|
1411
1446
|
* Finally, the getListenerStats method describes the current state of the
|
|
1412
1447
|
* Store's listeners for debugging purposes.
|
|
1413
|
-
*
|
|
1414
1448
|
* @example
|
|
1415
1449
|
* This example shows a very simple lifecycle of a Store: from creation, to
|
|
1416
1450
|
* adding and getting some data, and then registering and removing a listener.
|
|
@@ -1448,7 +1482,6 @@ export interface Store {
|
|
|
1448
1482
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
1449
1483
|
* data, so changes made to the returned objects are not made to the Store
|
|
1450
1484
|
* itself.
|
|
1451
|
-
*
|
|
1452
1485
|
* @returns An array of a Tables object and a Values object.
|
|
1453
1486
|
* @example
|
|
1454
1487
|
* This example retrieves the content of a Store.
|
|
@@ -1470,7 +1503,7 @@ export interface Store {
|
|
|
1470
1503
|
* // -> [{}, {}]
|
|
1471
1504
|
* ```
|
|
1472
1505
|
* @category Getter
|
|
1473
|
-
* @since v4.0
|
|
1506
|
+
* @since v4.0.0
|
|
1474
1507
|
*/
|
|
1475
1508
|
getContent(): [Tables, Values];
|
|
1476
1509
|
|
|
@@ -1481,7 +1514,6 @@ export interface Store {
|
|
|
1481
1514
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
1482
1515
|
* data, so changes made to the returned object are not made to the Store
|
|
1483
1516
|
* itself.
|
|
1484
|
-
*
|
|
1485
1517
|
* @returns A Tables object containing the tabular data of the Store.
|
|
1486
1518
|
* @example
|
|
1487
1519
|
* This example retrieves the tabular data in a Store.
|
|
@@ -1512,7 +1544,6 @@ export interface Store {
|
|
|
1512
1544
|
*
|
|
1513
1545
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1514
1546
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
1515
|
-
*
|
|
1516
1547
|
* @returns An array of the Ids of every Table in the Store.
|
|
1517
1548
|
* @example
|
|
1518
1549
|
* This example retrieves the Table Ids in a Store.
|
|
@@ -1545,7 +1576,6 @@ export interface Store {
|
|
|
1545
1576
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
1546
1577
|
* data, so changes made to the returned object are not made to the Store
|
|
1547
1578
|
* itself.
|
|
1548
|
-
*
|
|
1549
1579
|
* @param tableId The Id of the Table in the Store.
|
|
1550
1580
|
* @returns An object containing the entire data of the Table.
|
|
1551
1581
|
* @example
|
|
@@ -1573,11 +1603,46 @@ export interface Store {
|
|
|
1573
1603
|
getTable(tableId: Id): Table;
|
|
1574
1604
|
|
|
1575
1605
|
/**
|
|
1576
|
-
* The
|
|
1606
|
+
* The getTableCellIds method returns the Ids of every Cell used across the
|
|
1607
|
+
* whole Table.
|
|
1577
1608
|
*
|
|
1578
1609
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1579
1610
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
1611
|
+
* @param tableId The Id of the Table in the Store.
|
|
1612
|
+
* @returns An array of the Ids of every Cell used across the whole Table.
|
|
1613
|
+
* @example
|
|
1614
|
+
* This example retrieves the Cell Ids used across a whole Table.
|
|
1615
|
+
*
|
|
1616
|
+
* ```js
|
|
1617
|
+
* const store = createStore().setTables({
|
|
1618
|
+
* pets: {
|
|
1619
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
1620
|
+
* felix: {species: 'cat', legs: 4},
|
|
1621
|
+
* cujo: {dangerous: true},
|
|
1622
|
+
* },
|
|
1623
|
+
* });
|
|
1624
|
+
* console.log(store.getTableCellIds('pets'));
|
|
1625
|
+
* // -> ['species', 'color', 'legs', 'dangerous']
|
|
1626
|
+
* ```
|
|
1627
|
+
* @example
|
|
1628
|
+
* This example retrieves the Cell Ids used across a Table that does not
|
|
1629
|
+
* exist, returning an empty array.
|
|
1630
|
+
*
|
|
1631
|
+
* ```js
|
|
1632
|
+
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
1633
|
+
* console.log(store.getTableCellIds('species'));
|
|
1634
|
+
* // -> []
|
|
1635
|
+
* ```
|
|
1636
|
+
* @category Getter
|
|
1637
|
+
* @since v3.3.0
|
|
1638
|
+
*/
|
|
1639
|
+
getTableCellIds(tableId: Id): Ids;
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* The getRowIds method returns the Ids of every Row in a given Table.
|
|
1580
1643
|
*
|
|
1644
|
+
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1645
|
+
* Ids, so changes made to the list are not made to the Store itself.
|
|
1581
1646
|
* @param tableId The Id of the Table in the Store.
|
|
1582
1647
|
* @returns An array of the Ids of every Row in the Table.
|
|
1583
1648
|
* @example
|
|
@@ -1622,7 +1687,6 @@ export interface Store {
|
|
|
1622
1687
|
* addSortedRowIdsListener method.
|
|
1623
1688
|
*
|
|
1624
1689
|
* If the Table does not exist, an empty array is returned.
|
|
1625
|
-
*
|
|
1626
1690
|
* @param tableId The Id of the Table in the Store.
|
|
1627
1691
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
1628
1692
|
* `undefined` to sort by the Row Id itself.
|
|
@@ -1703,7 +1767,7 @@ export interface Store {
|
|
|
1703
1767
|
* // -> []
|
|
1704
1768
|
* ```
|
|
1705
1769
|
* @category Getter
|
|
1706
|
-
* @since v2.0
|
|
1770
|
+
* @since v2.0.0
|
|
1707
1771
|
*/
|
|
1708
1772
|
getSortedRowIds(
|
|
1709
1773
|
tableId: Id,
|
|
@@ -1720,7 +1784,6 @@ export interface Store {
|
|
|
1720
1784
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
1721
1785
|
* data, so changes made to the returned object are not made to the Store
|
|
1722
1786
|
* itself.
|
|
1723
|
-
*
|
|
1724
1787
|
* @param tableId The Id of the Table in the Store.
|
|
1725
1788
|
* @param rowId The Id of the Row in the Table.
|
|
1726
1789
|
* @returns An object containing the entire data of the Row.
|
|
@@ -1751,12 +1814,11 @@ export interface Store {
|
|
|
1751
1814
|
getRow(tableId: Id, rowId: Id): Row;
|
|
1752
1815
|
|
|
1753
1816
|
/**
|
|
1754
|
-
* The getCellIds method returns the Ids of every Cell in a given Row
|
|
1817
|
+
* The getCellIds method returns the Ids of every Cell in a given Row in a
|
|
1755
1818
|
* given Table.
|
|
1756
1819
|
*
|
|
1757
1820
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1758
1821
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
1759
|
-
*
|
|
1760
1822
|
* @param tableId The Id of the Table in the Store.
|
|
1761
1823
|
* @param rowId The Id of the Row in the Table.
|
|
1762
1824
|
* @returns An array of the Ids of every Cell in the Row.
|
|
@@ -1773,8 +1835,8 @@ export interface Store {
|
|
|
1773
1835
|
* // -> ['species', 'color']
|
|
1774
1836
|
* ```
|
|
1775
1837
|
* @example
|
|
1776
|
-
* This example retrieves the Cell Ids of a
|
|
1777
|
-
*
|
|
1838
|
+
* This example retrieves the Cell Ids of a Row that does not exist, returning
|
|
1839
|
+
* an empty array.
|
|
1778
1840
|
*
|
|
1779
1841
|
* ```js
|
|
1780
1842
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -1788,7 +1850,6 @@ export interface Store {
|
|
|
1788
1850
|
/**
|
|
1789
1851
|
* The getCell method returns the value of a single Cell in a given Row, in a
|
|
1790
1852
|
* given Table.
|
|
1791
|
-
*
|
|
1792
1853
|
* @param tableId The Id of the Table in the Store.
|
|
1793
1854
|
* @param rowId The Id of the Row in the Table.
|
|
1794
1855
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -1822,7 +1883,6 @@ export interface Store {
|
|
|
1822
1883
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
1823
1884
|
* data, so changes made to the returned object are not made to the Store
|
|
1824
1885
|
* itself.
|
|
1825
|
-
*
|
|
1826
1886
|
* @returns An object containing the set of keyed Values in the Store.
|
|
1827
1887
|
* @example
|
|
1828
1888
|
* This example retrieves the set of keyed Values in the Store.
|
|
@@ -1842,7 +1902,7 @@ export interface Store {
|
|
|
1842
1902
|
* // -> {}
|
|
1843
1903
|
* ```
|
|
1844
1904
|
* @category Getter
|
|
1845
|
-
* @since v3.0
|
|
1905
|
+
* @since v3.0.0
|
|
1846
1906
|
*/
|
|
1847
1907
|
getValues(): Values;
|
|
1848
1908
|
|
|
@@ -1851,7 +1911,6 @@ export interface Store {
|
|
|
1851
1911
|
*
|
|
1852
1912
|
* Note that this returns a copy of, rather than a reference, to the list of
|
|
1853
1913
|
* Ids, so changes made to the list are not made to the Store itself.
|
|
1854
|
-
*
|
|
1855
1914
|
* @returns An array of the Ids of every Value in the Store.
|
|
1856
1915
|
* @example
|
|
1857
1916
|
* This example retrieves the Value Ids in a Store.
|
|
@@ -1871,13 +1930,12 @@ export interface Store {
|
|
|
1871
1930
|
* // -> []
|
|
1872
1931
|
* ```
|
|
1873
1932
|
* @category Getter
|
|
1874
|
-
* @since v3.0
|
|
1933
|
+
* @since v3.0.0
|
|
1875
1934
|
*/
|
|
1876
1935
|
getValueIds(): Ids;
|
|
1877
1936
|
|
|
1878
1937
|
/**
|
|
1879
1938
|
* The getValue method returns a single keyed Value in the Store.
|
|
1880
|
-
*
|
|
1881
1939
|
* @param valueId The Id of the Value in the Store.
|
|
1882
1940
|
* @returns The Value, or `undefined`.
|
|
1883
1941
|
* @example
|
|
@@ -1897,14 +1955,13 @@ export interface Store {
|
|
|
1897
1955
|
* // -> undefined
|
|
1898
1956
|
* ```
|
|
1899
1957
|
* @category Getter
|
|
1900
|
-
* @since v3.0
|
|
1958
|
+
* @since v3.0.0
|
|
1901
1959
|
*/
|
|
1902
1960
|
getValue(valueId: Id): ValueOrUndefined;
|
|
1903
1961
|
|
|
1904
1962
|
/**
|
|
1905
1963
|
* The hasTables method returns a boolean indicating whether any Table objects
|
|
1906
1964
|
* exist in the Store.
|
|
1907
|
-
*
|
|
1908
1965
|
* @returns Whether any Tables exist.
|
|
1909
1966
|
* @example
|
|
1910
1967
|
* This example shows simple existence checks.
|
|
@@ -1924,7 +1981,6 @@ export interface Store {
|
|
|
1924
1981
|
/**
|
|
1925
1982
|
* The hasTable method returns a boolean indicating whether a given Table
|
|
1926
1983
|
* exists in the Store.
|
|
1927
|
-
*
|
|
1928
1984
|
* @param tableId The Id of a possible Table in the Store.
|
|
1929
1985
|
* @returns Whether a Table with that Id exists.
|
|
1930
1986
|
* @example
|
|
@@ -1941,10 +1997,34 @@ export interface Store {
|
|
|
1941
1997
|
*/
|
|
1942
1998
|
hasTable(tableId: Id): boolean;
|
|
1943
1999
|
|
|
2000
|
+
/**
|
|
2001
|
+
* The hasTableCell method returns a boolean indicating whether a given Cell
|
|
2002
|
+
* exists anywhere in a Table, not just in a specific Row.
|
|
2003
|
+
* @param tableId The Id of a possible Table in the Store.
|
|
2004
|
+
* @param cellId The Id of a possible Cell in the Table.
|
|
2005
|
+
* @returns Whether a Cell with that Id exists anywhere in that Table.
|
|
2006
|
+
* @example
|
|
2007
|
+
* This example shows two simple Cell existence checks.
|
|
2008
|
+
*
|
|
2009
|
+
* ```js
|
|
2010
|
+
* const store = createStore().setTables({
|
|
2011
|
+
* pets: {fido: {species: 'dog'}, felix: {legs: 4}},
|
|
2012
|
+
* });
|
|
2013
|
+
* console.log(store.hasTableCell('pets', 'species'));
|
|
2014
|
+
* // -> true
|
|
2015
|
+
* console.log(store.hasTableCell('pets', 'legs'));
|
|
2016
|
+
* // -> true
|
|
2017
|
+
* console.log(store.hasTableCell('pets', 'color'));
|
|
2018
|
+
* // -> false
|
|
2019
|
+
* ```
|
|
2020
|
+
* @category Getter
|
|
2021
|
+
* @since v3.3.0
|
|
2022
|
+
*/
|
|
2023
|
+
hasTableCell(tableId: Id, cellId: Id): boolean;
|
|
2024
|
+
|
|
1944
2025
|
/**
|
|
1945
2026
|
* The hasRow method returns a boolean indicating whether a given Row exists
|
|
1946
2027
|
* in the Store.
|
|
1947
|
-
*
|
|
1948
2028
|
* @param tableId The Id of a possible Table in the Store.
|
|
1949
2029
|
* @param rowId The Id of a possible Row in the Table.
|
|
1950
2030
|
* @returns Whether a Row with that Id exists in that Table.
|
|
@@ -1964,8 +2044,7 @@ export interface Store {
|
|
|
1964
2044
|
|
|
1965
2045
|
/**
|
|
1966
2046
|
* The hasCell method returns a boolean indicating whether a given Cell exists
|
|
1967
|
-
* in
|
|
1968
|
-
*
|
|
2047
|
+
* in a given Row in a given Table.
|
|
1969
2048
|
* @param tableId The Id of a possible Table in the Store.
|
|
1970
2049
|
* @param rowId The Id of a possible Row in the Table.
|
|
1971
2050
|
* @param cellId The Id of a possible Cell in the Row.
|
|
@@ -1987,7 +2066,6 @@ export interface Store {
|
|
|
1987
2066
|
/**
|
|
1988
2067
|
* The hasTables method returns a boolean indicating whether any Values exist
|
|
1989
2068
|
* in the Store.
|
|
1990
|
-
*
|
|
1991
2069
|
* @returns Whether any Values exist.
|
|
1992
2070
|
* @example
|
|
1993
2071
|
* This example shows simple existence checks.
|
|
@@ -2001,14 +2079,13 @@ export interface Store {
|
|
|
2001
2079
|
* // -> true
|
|
2002
2080
|
* ```
|
|
2003
2081
|
* @category Getter
|
|
2004
|
-
* @since v3.0
|
|
2082
|
+
* @since v3.0.0
|
|
2005
2083
|
*/
|
|
2006
2084
|
hasValues(): boolean;
|
|
2007
2085
|
|
|
2008
2086
|
/**
|
|
2009
2087
|
* The hasValue method returns a boolean indicating whether a given Value
|
|
2010
2088
|
* exists in the Store.
|
|
2011
|
-
*
|
|
2012
2089
|
* @param valueId The Id of a possible Value in the Store.
|
|
2013
2090
|
* @returns Whether a Value with that Id exists in the Store.
|
|
2014
2091
|
* @example
|
|
@@ -2022,14 +2099,13 @@ export interface Store {
|
|
|
2022
2099
|
* // -> false
|
|
2023
2100
|
* ```
|
|
2024
2101
|
* @category Getter
|
|
2025
|
-
* @since v3.0
|
|
2102
|
+
* @since v3.0.0
|
|
2026
2103
|
*/
|
|
2027
2104
|
hasValue(valueId: Id): boolean;
|
|
2028
2105
|
|
|
2029
2106
|
/**
|
|
2030
2107
|
* The getTablesJson method returns a string serialization of all of the
|
|
2031
2108
|
* Tables in the Store.
|
|
2032
|
-
*
|
|
2033
2109
|
* @returns A string serialization of all of the Tables in the Store.
|
|
2034
2110
|
* @example
|
|
2035
2111
|
* This example serializes the contents of a Store.
|
|
@@ -2048,14 +2124,13 @@ export interface Store {
|
|
|
2048
2124
|
* // -> '{}'
|
|
2049
2125
|
* ```
|
|
2050
2126
|
* @category Getter
|
|
2051
|
-
* @since v3.0
|
|
2127
|
+
* @since v3.0.0
|
|
2052
2128
|
*/
|
|
2053
2129
|
getTablesJson(): Json;
|
|
2054
2130
|
|
|
2055
2131
|
/**
|
|
2056
2132
|
* The getValuesJson method returns a string serialization of all of the keyed
|
|
2057
2133
|
* Values in the Store.
|
|
2058
|
-
*
|
|
2059
2134
|
* @returns A string serialization of all of the Values in the Store.
|
|
2060
2135
|
* @example
|
|
2061
2136
|
* This example serializes the keyed value contents of a Store.
|
|
@@ -2074,7 +2149,7 @@ export interface Store {
|
|
|
2074
2149
|
* // -> '{}'
|
|
2075
2150
|
* ```
|
|
2076
2151
|
* @category Getter
|
|
2077
|
-
* @since v3.0
|
|
2152
|
+
* @since v3.0.0
|
|
2078
2153
|
*/
|
|
2079
2154
|
getValuesJson(): Json;
|
|
2080
2155
|
|
|
@@ -2086,7 +2161,6 @@ export interface Store {
|
|
|
2086
2161
|
* first is the Tables object, the second the Values. In previous versions
|
|
2087
2162
|
* (before the existence of the Values data structure), it was a sole object
|
|
2088
2163
|
* of Tables.
|
|
2089
|
-
*
|
|
2090
2164
|
* @returns A string serialization of the Tables and Values in the Store.
|
|
2091
2165
|
* @example
|
|
2092
2166
|
* This example serializes the tabular and keyed value contents of a Store.
|
|
@@ -2117,7 +2191,6 @@ export interface Store {
|
|
|
2117
2191
|
* If no TablesSchema has been set on the Store (or if it has been removed
|
|
2118
2192
|
* with the delTablesSchema method), then it will return the serialization of
|
|
2119
2193
|
* an empty object, `{}`.
|
|
2120
|
-
*
|
|
2121
2194
|
* @returns A string serialization of the TablesSchema of the Store.
|
|
2122
2195
|
* @example
|
|
2123
2196
|
* This example serializes the TablesSchema of a Store.
|
|
@@ -2141,7 +2214,7 @@ export interface Store {
|
|
|
2141
2214
|
* // -> '{}'
|
|
2142
2215
|
* ```
|
|
2143
2216
|
* @category Getter
|
|
2144
|
-
* @since v3.0
|
|
2217
|
+
* @since v3.0.0
|
|
2145
2218
|
*/
|
|
2146
2219
|
getTablesSchemaJson(): Json;
|
|
2147
2220
|
|
|
@@ -2152,7 +2225,6 @@ export interface Store {
|
|
|
2152
2225
|
* If no ValuesSchema has been set on the Store (or if it has been removed
|
|
2153
2226
|
* with the delValuesSchema method), then it will return the serialization of
|
|
2154
2227
|
* an empty object, `{}`.
|
|
2155
|
-
*
|
|
2156
2228
|
* @returns A string serialization of the ValuesSchema of the Store.
|
|
2157
2229
|
* @example
|
|
2158
2230
|
* This example serializes the ValuesSchema of a Store.
|
|
@@ -2173,7 +2245,7 @@ export interface Store {
|
|
|
2173
2245
|
* // -> '{}'
|
|
2174
2246
|
* ```
|
|
2175
2247
|
* @category Getter
|
|
2176
|
-
* @since v3.0
|
|
2248
|
+
* @since v3.0.0
|
|
2177
2249
|
*/
|
|
2178
2250
|
getValuesSchemaJson(): Json;
|
|
2179
2251
|
|
|
@@ -2185,7 +2257,6 @@ export interface Store {
|
|
|
2185
2257
|
* first is the TablesSchema object, the second the ValuesSchema. In previous
|
|
2186
2258
|
* versions (before the existence of the ValuesSchema data structure), it was
|
|
2187
2259
|
* a sole object of TablesSchema.
|
|
2188
|
-
*
|
|
2189
2260
|
* @returns A string serialization of the TablesSchema and ValuesSchema of the
|
|
2190
2261
|
* Store.
|
|
2191
2262
|
* @example
|
|
@@ -2235,7 +2306,6 @@ export interface Store {
|
|
|
2235
2306
|
*
|
|
2236
2307
|
* The method returns a reference to the Store so that subsequent operations
|
|
2237
2308
|
* can be chained in a fluent style.
|
|
2238
|
-
*
|
|
2239
2309
|
* @param content An array containing the tabular and keyed-value data of the
|
|
2240
2310
|
* Store to be set.
|
|
2241
2311
|
* @example
|
|
@@ -2272,7 +2342,7 @@ export interface Store {
|
|
|
2272
2342
|
* // -> {pets: {felix: {species: 'cat'}}}
|
|
2273
2343
|
* ```
|
|
2274
2344
|
* @category Setter
|
|
2275
|
-
* @since v4.0
|
|
2345
|
+
* @since v4.0.0
|
|
2276
2346
|
*/
|
|
2277
2347
|
setContent([tables, values]: [Tables, Values]): Store;
|
|
2278
2348
|
|
|
@@ -2293,7 +2363,6 @@ export interface Store {
|
|
|
2293
2363
|
*
|
|
2294
2364
|
* The method returns a reference to the Store so that subsequent operations
|
|
2295
2365
|
* can be chained in a fluent style.
|
|
2296
|
-
*
|
|
2297
2366
|
* @param tables The data of the Store to be set.
|
|
2298
2367
|
* @example
|
|
2299
2368
|
* This example sets the tabular data of a Store.
|
|
@@ -2343,7 +2412,6 @@ export interface Store {
|
|
|
2343
2412
|
*
|
|
2344
2413
|
* The method returns a reference to the Store so that subsequent operations
|
|
2345
2414
|
* can be chained in a fluent style.
|
|
2346
|
-
*
|
|
2347
2415
|
* @param tableId The Id of the Table in the Store.
|
|
2348
2416
|
* @param table The data of a single Table to be set.
|
|
2349
2417
|
* @example
|
|
@@ -2394,7 +2462,6 @@ export interface Store {
|
|
|
2394
2462
|
*
|
|
2395
2463
|
* The method returns a reference to the Store so that subsequent operations
|
|
2396
2464
|
* can be chained in a fluent style.
|
|
2397
|
-
*
|
|
2398
2465
|
* @param tableId The Id of the Table in the Store.
|
|
2399
2466
|
* @param rowId The Id of the Row in the Table.
|
|
2400
2467
|
* @param row The data of a single Row to be set.
|
|
@@ -2451,7 +2518,6 @@ export interface Store {
|
|
|
2451
2518
|
* if you specify `reuseRowIds` to be `false`, then the Id will be a
|
|
2452
2519
|
* monotonically increasing string representation of an increasing integer,
|
|
2453
2520
|
* regardless of any you may have previously deleted.
|
|
2454
|
-
*
|
|
2455
2521
|
* @param tableId The Id of the Table in the Store.
|
|
2456
2522
|
* @param row The data of a single Row to be added.
|
|
2457
2523
|
* @param reuseRowIds Whether Ids should be recycled from previously deleted
|
|
@@ -2505,7 +2571,6 @@ export interface Store {
|
|
|
2505
2571
|
*
|
|
2506
2572
|
* The method returns a reference to the Store so that subsequent operations
|
|
2507
2573
|
* can be chained in a fluent style.
|
|
2508
|
-
*
|
|
2509
2574
|
* @param tableId The Id of the Table in the Store.
|
|
2510
2575
|
* @param rowId The Id of the Row in the Table.
|
|
2511
2576
|
* @param partialRow The partial data of a single Row to be set.
|
|
@@ -2557,7 +2622,6 @@ export interface Store {
|
|
|
2557
2622
|
*
|
|
2558
2623
|
* The method returns a reference to the Store so that subsequent operations
|
|
2559
2624
|
* can be chained in a fluent style.
|
|
2560
|
-
*
|
|
2561
2625
|
* @param tableId The Id of the Table in the Store.
|
|
2562
2626
|
* @param rowId The Id of the Row in the Table.
|
|
2563
2627
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -2615,7 +2679,6 @@ export interface Store {
|
|
|
2615
2679
|
*
|
|
2616
2680
|
* The method returns a reference to the Store so that subsequent operations
|
|
2617
2681
|
* can be chained in a fluent style.
|
|
2618
|
-
*
|
|
2619
2682
|
* @param values The Values object to be set.
|
|
2620
2683
|
* @returns A reference to the Store.
|
|
2621
2684
|
* @example
|
|
@@ -2642,7 +2705,7 @@ export interface Store {
|
|
|
2642
2705
|
* // -> {employees: 3}
|
|
2643
2706
|
* ```
|
|
2644
2707
|
* @category Setter
|
|
2645
|
-
* @since v3.0
|
|
2708
|
+
* @since v3.0.0
|
|
2646
2709
|
*/
|
|
2647
2710
|
setValues(values: Values): Store;
|
|
2648
2711
|
|
|
@@ -2664,7 +2727,6 @@ export interface Store {
|
|
|
2664
2727
|
*
|
|
2665
2728
|
* The method returns a reference to the Store so that subsequent operations
|
|
2666
2729
|
* can be chained in a fluent style.
|
|
2667
|
-
*
|
|
2668
2730
|
* @param partialValues The Values to be set.
|
|
2669
2731
|
* @returns A reference to the Store.
|
|
2670
2732
|
* @example
|
|
@@ -2692,7 +2754,7 @@ export interface Store {
|
|
|
2692
2754
|
* // -> {open: true, employees: 3}
|
|
2693
2755
|
* ```
|
|
2694
2756
|
* @category Setter
|
|
2695
|
-
* @since v3.0
|
|
2757
|
+
* @since v3.0.0
|
|
2696
2758
|
*/
|
|
2697
2759
|
setPartialValues(partialValues: Values): Store;
|
|
2698
2760
|
|
|
@@ -2712,7 +2774,6 @@ export interface Store {
|
|
|
2712
2774
|
*
|
|
2713
2775
|
* The method returns a reference to the Store so that subsequent operations
|
|
2714
2776
|
* can be chained in a fluent style.
|
|
2715
|
-
*
|
|
2716
2777
|
* @param valueId The Id of the Value in the Store.
|
|
2717
2778
|
* @param value The Value to be set, or a MapValue function to update it.
|
|
2718
2779
|
* @returns A reference to the Store.
|
|
@@ -2746,7 +2807,7 @@ export interface Store {
|
|
|
2746
2807
|
* // -> {employees: 3}
|
|
2747
2808
|
* ```
|
|
2748
2809
|
* @category Setter
|
|
2749
|
-
* @since v3.0
|
|
2810
|
+
* @since v3.0.0
|
|
2750
2811
|
*/
|
|
2751
2812
|
setValue(valueId: Id, value: Value | MapValue): Store;
|
|
2752
2813
|
|
|
@@ -2766,7 +2827,6 @@ export interface Store {
|
|
|
2766
2827
|
*
|
|
2767
2828
|
* The method returns a reference to the Store so that subsequent operations
|
|
2768
2829
|
* can be chained in a fluent style.
|
|
2769
|
-
*
|
|
2770
2830
|
* @param transactionChanges The TransactionChanges to apply to the Store.
|
|
2771
2831
|
* @returns A reference to the Store.
|
|
2772
2832
|
* @example
|
|
@@ -2788,7 +2848,7 @@ export interface Store {
|
|
|
2788
2848
|
* // -> {}
|
|
2789
2849
|
* ```
|
|
2790
2850
|
* @category Setter
|
|
2791
|
-
* @since v4.0
|
|
2851
|
+
* @since v4.0.0
|
|
2792
2852
|
*/
|
|
2793
2853
|
setTransactionChanges(transactionChanges: TransactionChanges): Store;
|
|
2794
2854
|
|
|
@@ -2800,7 +2860,6 @@ export interface Store {
|
|
|
2800
2860
|
* it will then be subject to the same validation rules as the setTables
|
|
2801
2861
|
* method (according to the Tables type, and matching any TablesSchema
|
|
2802
2862
|
* associated with the Store).
|
|
2803
|
-
*
|
|
2804
2863
|
* @param tablesJson A string serialization of all of the Tables in the Store.
|
|
2805
2864
|
* @returns A reference to the Store.
|
|
2806
2865
|
* @example
|
|
@@ -2823,7 +2882,7 @@ export interface Store {
|
|
|
2823
2882
|
* // -> {}
|
|
2824
2883
|
* ```
|
|
2825
2884
|
* @category Setter
|
|
2826
|
-
* @since v3.0
|
|
2885
|
+
* @since v3.0.0
|
|
2827
2886
|
*/
|
|
2828
2887
|
setTablesJson(tablesJson: Json): Store;
|
|
2829
2888
|
|
|
@@ -2835,7 +2894,6 @@ export interface Store {
|
|
|
2835
2894
|
* it will then be subject to the same validation rules as the setValues
|
|
2836
2895
|
* method (according to the Values type, and matching any ValuesSchema
|
|
2837
2896
|
* associated with the Store).
|
|
2838
|
-
*
|
|
2839
2897
|
* @param valuesJson A string serialization of all of the Values in the Store.
|
|
2840
2898
|
* @returns A reference to the Store.
|
|
2841
2899
|
* @example
|
|
@@ -2858,7 +2916,7 @@ export interface Store {
|
|
|
2858
2916
|
* // -> {}
|
|
2859
2917
|
* ```
|
|
2860
2918
|
* @category Setter
|
|
2861
|
-
* @since v3.0
|
|
2919
|
+
* @since v3.0.0
|
|
2862
2920
|
*/
|
|
2863
2921
|
setValuesJson(valuesJson: Json): Store;
|
|
2864
2922
|
|
|
@@ -2877,7 +2935,6 @@ export interface Store {
|
|
|
2877
2935
|
* method (according to the Tables type, and matching any TablesSchema
|
|
2878
2936
|
* associated with the Store), and the setValues method (according to the
|
|
2879
2937
|
* Values type, and matching any ValuesSchema associated with the Store).
|
|
2880
|
-
*
|
|
2881
2938
|
* @param tablesAndValuesJson A string serialization of all of the Tables and
|
|
2882
2939
|
* Values in the Store.
|
|
2883
2940
|
* @returns A reference to the Store.
|
|
@@ -2931,7 +2988,6 @@ export interface Store {
|
|
|
2931
2988
|
*
|
|
2932
2989
|
* When no longer needed, you can also completely remove an existing
|
|
2933
2990
|
* TablesSchema with the delTablesSchema method.
|
|
2934
|
-
*
|
|
2935
2991
|
* @param tablesSchema The TablesSchema to be set for the Store.
|
|
2936
2992
|
* @returns A reference to the Store.
|
|
2937
2993
|
* @example
|
|
@@ -2950,7 +3006,7 @@ export interface Store {
|
|
|
2950
3006
|
* // -> {pets: {0: {species: 'dog', sold: false}}}
|
|
2951
3007
|
* ```
|
|
2952
3008
|
* @category Setter
|
|
2953
|
-
* @since v3.0
|
|
3009
|
+
* @since v3.0.0
|
|
2954
3010
|
*/
|
|
2955
3011
|
setTablesSchema(tablesSchema: TablesSchema): Store;
|
|
2956
3012
|
|
|
@@ -2964,7 +3020,6 @@ export interface Store {
|
|
|
2964
3020
|
*
|
|
2965
3021
|
* When no longer needed, you can also completely remove an existing
|
|
2966
3022
|
* ValuesSchema with the delValuesSchema method.
|
|
2967
|
-
*
|
|
2968
3023
|
* @param valuesSchema The ValuesSchema to be set for the Store.
|
|
2969
3024
|
* @returns A reference to the Store.
|
|
2970
3025
|
* @example
|
|
@@ -2980,7 +3035,7 @@ export interface Store {
|
|
|
2980
3035
|
* // -> {open: false}
|
|
2981
3036
|
* ```
|
|
2982
3037
|
* @category Setter
|
|
2983
|
-
* @since v3.0
|
|
3038
|
+
* @since v3.0.0
|
|
2984
3039
|
*/
|
|
2985
3040
|
setValuesSchema(valuesSchema: ValuesSchema): Store;
|
|
2986
3041
|
|
|
@@ -2997,7 +3052,6 @@ export interface Store {
|
|
|
2997
3052
|
* (before the existence of the ValuesSchema data structure), only the first
|
|
2998
3053
|
* was present. For backwards compatibility the new second parameter is
|
|
2999
3054
|
* optional.
|
|
3000
|
-
*
|
|
3001
3055
|
* @param tablesSchema The TablesSchema to be set for the Store.
|
|
3002
3056
|
* @param valuesSchema The ValuesSchema to be set for the Store.
|
|
3003
3057
|
* @returns A reference to the Store.
|
|
@@ -3045,7 +3099,6 @@ export interface Store {
|
|
|
3045
3099
|
|
|
3046
3100
|
/**
|
|
3047
3101
|
* The delTables method lets you remove all of the data in a Store.
|
|
3048
|
-
*
|
|
3049
3102
|
* @returns A reference to the Store.
|
|
3050
3103
|
* @example
|
|
3051
3104
|
* This example removes the data of a Store.
|
|
@@ -3063,7 +3116,6 @@ export interface Store {
|
|
|
3063
3116
|
|
|
3064
3117
|
/**
|
|
3065
3118
|
* The delTable method lets you remove a single Table from the Store.
|
|
3066
|
-
*
|
|
3067
3119
|
* @param tableId The Id of the Table in the Store.
|
|
3068
3120
|
* @returns A reference to the Store.
|
|
3069
3121
|
* @example
|
|
@@ -3087,7 +3139,6 @@ export interface Store {
|
|
|
3087
3139
|
* The delRow method lets you remove a single Row from a Table.
|
|
3088
3140
|
*
|
|
3089
3141
|
* If this is the last Row in its Table, then that Table will be removed.
|
|
3090
|
-
*
|
|
3091
3142
|
* @param tableId The Id of the Table in the Store.
|
|
3092
3143
|
* @param rowId The Id of the Row in the Table.
|
|
3093
3144
|
* @returns A reference to the Store.
|
|
@@ -3127,7 +3178,6 @@ export interface Store {
|
|
|
3127
3178
|
* invalid Row (according to the TablesSchema), in fact the whole Row is
|
|
3128
3179
|
* deleted to retain the integrity of the Table. Therefore, this flag should
|
|
3129
3180
|
* be used with caution.
|
|
3130
|
-
*
|
|
3131
3181
|
* @param tableId The Id of the Table in the Store.
|
|
3132
3182
|
* @param rowId The Id of the Row in the Table.
|
|
3133
3183
|
* @param cellId The Id of the Cell in the Row.
|
|
@@ -3197,7 +3247,6 @@ export interface Store {
|
|
|
3197
3247
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
3198
3248
|
* value for any Value Id, then deletion will result in it being set back to
|
|
3199
3249
|
* its default value.
|
|
3200
|
-
*
|
|
3201
3250
|
* @returns A reference to the Store.
|
|
3202
3251
|
* @example
|
|
3203
3252
|
* This example removes all Values from a Store without a ValuesSchema.
|
|
@@ -3226,7 +3275,7 @@ export interface Store {
|
|
|
3226
3275
|
* // -> {open: false}
|
|
3227
3276
|
* ```
|
|
3228
3277
|
* @category Deleter
|
|
3229
|
-
* @since v3.0
|
|
3278
|
+
* @since v3.0.0
|
|
3230
3279
|
*/
|
|
3231
3280
|
delValues(): Store;
|
|
3232
3281
|
|
|
@@ -3236,7 +3285,6 @@ export interface Store {
|
|
|
3236
3285
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
3237
3286
|
* value for this Value Id, then deletion will result in it being set back to
|
|
3238
3287
|
* its default value.
|
|
3239
|
-
*
|
|
3240
3288
|
* @param valueId The Id of the Value in the Row.
|
|
3241
3289
|
* @returns A reference to the Store.
|
|
3242
3290
|
* @example
|
|
@@ -3266,13 +3314,12 @@ export interface Store {
|
|
|
3266
3314
|
* // -> {open: false, employees: 3}
|
|
3267
3315
|
* ```
|
|
3268
3316
|
* @category Deleter
|
|
3269
|
-
* @since v3.0
|
|
3317
|
+
* @since v3.0.0
|
|
3270
3318
|
*/
|
|
3271
3319
|
delValue(valueId: Id): Store;
|
|
3272
3320
|
|
|
3273
3321
|
/**
|
|
3274
3322
|
* The delTablesSchema method lets you remove the TablesSchema of the Store.
|
|
3275
|
-
*
|
|
3276
3323
|
* @returns A reference to the Store.
|
|
3277
3324
|
* @example
|
|
3278
3325
|
* This example removes the TablesSchema of a Store.
|
|
@@ -3291,7 +3338,6 @@ export interface Store {
|
|
|
3291
3338
|
|
|
3292
3339
|
/**
|
|
3293
3340
|
* The delValuesSchema method lets you remove the ValuesSchema of the Store.
|
|
3294
|
-
*
|
|
3295
3341
|
* @returns A reference to the Store.
|
|
3296
3342
|
* @example
|
|
3297
3343
|
* This example removes the ValuesSchema of a Store.
|
|
@@ -3305,7 +3351,7 @@ export interface Store {
|
|
|
3305
3351
|
* // -> '{}'
|
|
3306
3352
|
* ```
|
|
3307
3353
|
* @category Deleter
|
|
3308
|
-
* @since v3.0
|
|
3354
|
+
* @since v3.0.0
|
|
3309
3355
|
*/
|
|
3310
3356
|
delValuesSchema(): Store;
|
|
3311
3357
|
|
|
@@ -3314,7 +3360,6 @@ export interface Store {
|
|
|
3314
3360
|
* of the Store.
|
|
3315
3361
|
*
|
|
3316
3362
|
* Prior to v3.0, this method removed the TablesSchema only.
|
|
3317
|
-
*
|
|
3318
3363
|
* @returns A reference to the Store.
|
|
3319
3364
|
* @example
|
|
3320
3365
|
* This example removes the TablesSchema and ValuesSchema of a Store.
|
|
@@ -3332,7 +3377,7 @@ export interface Store {
|
|
|
3332
3377
|
* // -> '[{},{}]'
|
|
3333
3378
|
* ```
|
|
3334
3379
|
* @category Deleter
|
|
3335
|
-
* @since v3.0
|
|
3380
|
+
* @since v3.0.0
|
|
3336
3381
|
*/
|
|
3337
3382
|
delSchema(): Store;
|
|
3338
3383
|
|
|
@@ -3364,7 +3409,6 @@ export interface Store {
|
|
|
3364
3409
|
* `getTransactionLog` parameters, which inform you of the net changes that
|
|
3365
3410
|
* have been made during the transaction, at different levels of detail. See
|
|
3366
3411
|
* the DoRollback documentation for more details.
|
|
3367
|
-
*
|
|
3368
3412
|
* @param actions The function to be executed as a transaction.
|
|
3369
3413
|
* @param doRollback An optional callback that should return `true` if you
|
|
3370
3414
|
* want to rollback the transaction at the end. Since v1.2.
|
|
@@ -3488,7 +3532,6 @@ export interface Store {
|
|
|
3488
3532
|
* that are asynchronous or not occurring inline to your code. You must
|
|
3489
3533
|
* remember to also call the finishTransaction method explicitly when it is
|
|
3490
3534
|
* done, of course.
|
|
3491
|
-
*
|
|
3492
3535
|
* @returns A reference to the Store.
|
|
3493
3536
|
* @example
|
|
3494
3537
|
* This example makes changes to two Cells, first outside, and secondly
|
|
@@ -3513,7 +3556,7 @@ export interface Store {
|
|
|
3513
3556
|
* // -> 'Fido changed'
|
|
3514
3557
|
* ```
|
|
3515
3558
|
* @category Transaction
|
|
3516
|
-
* @since v1.3
|
|
3559
|
+
* @since v1.3.0
|
|
3517
3560
|
*/
|
|
3518
3561
|
startTransaction(): Store;
|
|
3519
3562
|
|
|
@@ -3545,7 +3588,6 @@ export interface Store {
|
|
|
3545
3588
|
* `getTransactionLog` parameters, which inform you of the net changes that
|
|
3546
3589
|
* have been made during the transaction, at different levels of detail. See
|
|
3547
3590
|
* the DoRollback documentation for more details.
|
|
3548
|
-
*
|
|
3549
3591
|
* @param doRollback An optional callback that should return `true` if you
|
|
3550
3592
|
* want to rollback the transaction at the end.
|
|
3551
3593
|
* @returns A reference to the Store.
|
|
@@ -3611,7 +3653,7 @@ export interface Store {
|
|
|
3611
3653
|
* // -> {open: true}
|
|
3612
3654
|
* ```
|
|
3613
3655
|
* @category Transaction
|
|
3614
|
-
* @since v1.3
|
|
3656
|
+
* @since v1.3.0
|
|
3615
3657
|
*/
|
|
3616
3658
|
finishTransaction(doRollback?: DoRollback): Store;
|
|
3617
3659
|
|
|
@@ -3624,7 +3666,6 @@ export interface Store {
|
|
|
3624
3666
|
* function that will be called with the Id of each Table, and with a function
|
|
3625
3667
|
* that can then be used to iterate over each Row of the Table, should you
|
|
3626
3668
|
* wish.
|
|
3627
|
-
*
|
|
3628
3669
|
* @param tableCallback The function that should be called for every Table.
|
|
3629
3670
|
* @example
|
|
3630
3671
|
* This example iterates over each Table in a Store, and lists each Row Id
|
|
@@ -3648,6 +3689,35 @@ export interface Store {
|
|
|
3648
3689
|
*/
|
|
3649
3690
|
forEachTable(tableCallback: TableCallback): void;
|
|
3650
3691
|
|
|
3692
|
+
/**
|
|
3693
|
+
* The forEachTableCell method takes a function that it will then call for
|
|
3694
|
+
* each Cell used across the whole Table.
|
|
3695
|
+
*
|
|
3696
|
+
* This method is useful for iterating over the Cell structure of the Table in
|
|
3697
|
+
* a functional style. The `tableCellCallback` parameter is a
|
|
3698
|
+
* TableCellCallback function that will be called with the Id of each Cell and
|
|
3699
|
+
* the count of Rows in the Table in which it appears.
|
|
3700
|
+
* @param tableId The Id of the Table containing the Cells to iterate over.
|
|
3701
|
+
* @param tableCellCallback The function that should be called for every Cell
|
|
3702
|
+
* Id used across the whole Table.
|
|
3703
|
+
* @example
|
|
3704
|
+
* This example iterates over each Cell Id used across the whole Table.
|
|
3705
|
+
*
|
|
3706
|
+
* ```js
|
|
3707
|
+
* const store = createStore().setTables({
|
|
3708
|
+
* pets: {fido: {species: 'dog'}, felix: {species: 'cat', legs: 4}},
|
|
3709
|
+
* });
|
|
3710
|
+
* store.forEachTableCell('pets', (cellId, count) => {
|
|
3711
|
+
* console.log(`${cellId}: ${count}`);
|
|
3712
|
+
* });
|
|
3713
|
+
* // -> 'species: 2'
|
|
3714
|
+
* // -> 'legs: 1'
|
|
3715
|
+
* ```
|
|
3716
|
+
* @category Iterator
|
|
3717
|
+
* @since v3.3.0
|
|
3718
|
+
*/
|
|
3719
|
+
forEachTableCell(tableId: Id, tableCellCallback: TableCellCallback): void;
|
|
3720
|
+
|
|
3651
3721
|
/**
|
|
3652
3722
|
* The forEachRow method takes a function that it will then call for each Row
|
|
3653
3723
|
* in a specified Table.
|
|
@@ -3656,7 +3726,6 @@ export interface Store {
|
|
|
3656
3726
|
* a functional style. The `rowCallback` parameter is a RowCallback function
|
|
3657
3727
|
* that will be called with the Id of each Row, and with a function that can
|
|
3658
3728
|
* then be used to iterate over each Cell of the Row, should you wish.
|
|
3659
|
-
*
|
|
3660
3729
|
* @param tableId The Id of the Table to iterate over.
|
|
3661
3730
|
* @param rowCallback The function that should be called for every Row.
|
|
3662
3731
|
* @example
|
|
@@ -3690,7 +3759,6 @@ export interface Store {
|
|
|
3690
3759
|
* This method is useful for iterating over the Cell structure of the Row in a
|
|
3691
3760
|
* functional style. The `cellCallback` parameter is a CellCallback function
|
|
3692
3761
|
* that will be called with the Id and value of each Cell.
|
|
3693
|
-
*
|
|
3694
3762
|
* @param tableId The Id of the Table containing the Row to iterate over.
|
|
3695
3763
|
* @param rowId The Id of the Row to iterate over.
|
|
3696
3764
|
* @param cellCallback The function that should be called for every Cell.
|
|
@@ -3718,7 +3786,6 @@ export interface Store {
|
|
|
3718
3786
|
* This method is useful for iterating over the Value structure of the Store
|
|
3719
3787
|
* in a functional style. The `valueCallback` parameter is a ValueCallback
|
|
3720
3788
|
* function that will be called with the Id and value of each Value.
|
|
3721
|
-
*
|
|
3722
3789
|
* @param valueCallback The function that should be called for every Value.
|
|
3723
3790
|
* @example
|
|
3724
3791
|
* This example iterates over each Value in a Store, and lists its value.
|
|
@@ -3732,7 +3799,7 @@ export interface Store {
|
|
|
3732
3799
|
* // -> 'employees: 3'
|
|
3733
3800
|
* ```
|
|
3734
3801
|
* @category Iterator
|
|
3735
|
-
* @since v3.0
|
|
3802
|
+
* @since v3.0.0
|
|
3736
3803
|
*/
|
|
3737
3804
|
forEachValue(valueCallback: ValueCallback): void;
|
|
3738
3805
|
|
|
@@ -3751,7 +3818,6 @@ export interface Store {
|
|
|
3751
3818
|
* (since the latter may become relevant due to changes made in the former).
|
|
3752
3819
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
3753
3820
|
* though they will fire non-mutator listeners.
|
|
3754
|
-
*
|
|
3755
3821
|
* @param listener The function that will be called whenever data in the Store
|
|
3756
3822
|
* changes.
|
|
3757
3823
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -3818,7 +3884,6 @@ export interface Store {
|
|
|
3818
3884
|
* (since the latter may become relevant due to changes made in the former).
|
|
3819
3885
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
3820
3886
|
* though they will fire non-mutator listeners.
|
|
3821
|
-
*
|
|
3822
3887
|
* @param listener The function that will be called whenever the Table Ids in
|
|
3823
3888
|
* the Store change.
|
|
3824
3889
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -3883,7 +3948,6 @@ export interface Store {
|
|
|
3883
3948
|
* (since the latter may become relevant due to changes made in the former).
|
|
3884
3949
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
3885
3950
|
* though they will fire non-mutator listeners.
|
|
3886
|
-
*
|
|
3887
3951
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
3888
3952
|
* @param listener The function that will be called whenever data in the
|
|
3889
3953
|
* matching Table changes.
|
|
@@ -3960,6 +4024,110 @@ export interface Store {
|
|
|
3960
4024
|
mutator?: boolean,
|
|
3961
4025
|
): Id;
|
|
3962
4026
|
|
|
4027
|
+
/**
|
|
4028
|
+
* The addTableCellIdsListener method registers a listener function with the
|
|
4029
|
+
* Store that will be called whenever the Cell Ids that appear anywhere in a
|
|
4030
|
+
* Table change.
|
|
4031
|
+
*
|
|
4032
|
+
* The provided listener is a TableCellIdsListener function, and will be
|
|
4033
|
+
* called with a reference to the Store and the Id of the Table that changed.
|
|
4034
|
+
*
|
|
4035
|
+
* By default, such a listener is only called when a Cell Id is added or
|
|
4036
|
+
* removed from the whole of the Table. To listen to all changes in the Table,
|
|
4037
|
+
* use the addTableListener method.
|
|
4038
|
+
*
|
|
4039
|
+
* You can either listen to a single Table (by specifying its Id as the
|
|
4040
|
+
* method's first parameter) or changes to any Table (by providing a `null`
|
|
4041
|
+
* wildcard).
|
|
4042
|
+
*
|
|
4043
|
+
* Use the optional mutator parameter to indicate that there is code in the
|
|
4044
|
+
* listener that will mutate Store data. If set to `false` (or omitted), such
|
|
4045
|
+
* mutations will be silently ignored. All relevant mutator listeners (with
|
|
4046
|
+
* this flag set to `true`) are called _before_ any non-mutator listeners
|
|
4047
|
+
* (since the latter may become relevant due to changes made in the former).
|
|
4048
|
+
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4049
|
+
* though they will fire non-mutator listeners.
|
|
4050
|
+
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4051
|
+
* @param listener The function that will be called whenever the Cell Ids that
|
|
4052
|
+
* appear anywhere in a Table change.
|
|
4053
|
+
* @param mutator An optional boolean that indicates that the listener mutates
|
|
4054
|
+
* Store data.
|
|
4055
|
+
* @returns A unique Id for the listener that can later be used to call it
|
|
4056
|
+
* explicitly, or to remove it.
|
|
4057
|
+
* @example
|
|
4058
|
+
* This example registers a listener that responds to any change to the Cell
|
|
4059
|
+
* Ids that appear anywhere in a Table.
|
|
4060
|
+
*
|
|
4061
|
+
* ```js
|
|
4062
|
+
* const store = createStore().setTables({
|
|
4063
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
4064
|
+
* });
|
|
4065
|
+
* const listenerId = store.addTableCellIdsListener('pets', (store) => {
|
|
4066
|
+
* console.log('Cell Ids in pets table changed');
|
|
4067
|
+
* console.log(store.getTableCellIds('pets'));
|
|
4068
|
+
* });
|
|
4069
|
+
*
|
|
4070
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
4071
|
+
* // -> 'Cell Ids in pets table changed'
|
|
4072
|
+
* // -> ['species', 'color', 'legs']
|
|
4073
|
+
*
|
|
4074
|
+
* store.delListener(listenerId);
|
|
4075
|
+
* ```
|
|
4076
|
+
* @example
|
|
4077
|
+
* This example registers a listener that responds to any change to the Cell
|
|
4078
|
+
* Ids that appear anywhere in any Table.
|
|
4079
|
+
*
|
|
4080
|
+
* ```js
|
|
4081
|
+
* const store = createStore().setTables({
|
|
4082
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
4083
|
+
* species: {dog: {price: 5}},
|
|
4084
|
+
* });
|
|
4085
|
+
* const listenerId = store.addTableCellIdsListener(
|
|
4086
|
+
* null,
|
|
4087
|
+
* (store, tableId) => {
|
|
4088
|
+
* console.log(`Cell Ids in ${tableId} table changed`);
|
|
4089
|
+
* console.log(store.getTableCellIds(tableId));
|
|
4090
|
+
* },
|
|
4091
|
+
* );
|
|
4092
|
+
*
|
|
4093
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
4094
|
+
* // -> 'Cell Ids in pets table changed'
|
|
4095
|
+
* // -> ['species', 'color', 'legs']
|
|
4096
|
+
*
|
|
4097
|
+
* store.setRow('species', 'cat', {price: 4, friendly: true});
|
|
4098
|
+
* // -> 'Cell Ids in species table changed'
|
|
4099
|
+
* // -> ['price', 'friendly']
|
|
4100
|
+
*
|
|
4101
|
+
* store.delListener(listenerId);
|
|
4102
|
+
* ```
|
|
4103
|
+
* @example
|
|
4104
|
+
* This example registers a listener that responds to the Cell Ids that appear
|
|
4105
|
+
* anywhere in a Table, and which also mutates the Store itself.
|
|
4106
|
+
*
|
|
4107
|
+
* ```js
|
|
4108
|
+
* const store = createStore().setTables({
|
|
4109
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
4110
|
+
* });
|
|
4111
|
+
* const listenerId = store.addTableCellIdsListener(
|
|
4112
|
+
* 'pets',
|
|
4113
|
+
* (store, tableId) => store.setCell('meta', 'update', tableId, true),
|
|
4114
|
+
* true, // mutator
|
|
4115
|
+
* );
|
|
4116
|
+
*
|
|
4117
|
+
* store.setRow('pets', 'felix', {species: 'cat', legs: 4});
|
|
4118
|
+
* console.log(store.getTable('meta'));
|
|
4119
|
+
* // -> {update: {pets: true}}
|
|
4120
|
+
*
|
|
4121
|
+
* store.delListener(listenerId);
|
|
4122
|
+
* ```
|
|
4123
|
+
* @category Listener
|
|
4124
|
+
*/
|
|
4125
|
+
addTableCellIdsListener(
|
|
4126
|
+
tableId: IdOrNull,
|
|
4127
|
+
listener: TableCellIdsListener,
|
|
4128
|
+
mutator?: boolean,
|
|
4129
|
+
): Id;
|
|
4130
|
+
|
|
3963
4131
|
/**
|
|
3964
4132
|
* The addRowIdsListener method registers a listener function with the Store
|
|
3965
4133
|
* that will be called whenever the Row Ids in a Table change.
|
|
@@ -3981,7 +4149,6 @@ export interface Store {
|
|
|
3981
4149
|
* (since the latter may become relevant due to changes made in the former).
|
|
3982
4150
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
3983
4151
|
* though they will fire non-mutator listeners.
|
|
3984
|
-
*
|
|
3985
4152
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
3986
4153
|
* @param listener The function that will be called whenever the Row Ids in
|
|
3987
4154
|
* the Table change.
|
|
@@ -4085,7 +4252,6 @@ export interface Store {
|
|
|
4085
4252
|
* (since the latter may become relevant due to changes made in the former).
|
|
4086
4253
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4087
4254
|
* though they will fire non-mutator listeners.
|
|
4088
|
-
*
|
|
4089
4255
|
* @param tableId The Id of the Table to listen to.
|
|
4090
4256
|
* @param cellId The Id of the Cell whose values are used for the sorting, or
|
|
4091
4257
|
* `undefined` to sort by the Row Id itself.
|
|
@@ -4134,7 +4300,7 @@ export interface Store {
|
|
|
4134
4300
|
* store.delListener(listenerId);
|
|
4135
4301
|
* ```
|
|
4136
4302
|
* @example
|
|
4137
|
-
* This
|
|
4303
|
+
* This example registers a listener that responds to any change to a
|
|
4138
4304
|
* paginated section of the sorted Row Ids of a specific Table.
|
|
4139
4305
|
*
|
|
4140
4306
|
* ```js
|
|
@@ -4266,7 +4432,7 @@ export interface Store {
|
|
|
4266
4432
|
* store.delListener(listenerId);
|
|
4267
4433
|
* ```
|
|
4268
4434
|
* @category Listener
|
|
4269
|
-
* @since v2.0
|
|
4435
|
+
* @since v2.0.0
|
|
4270
4436
|
*/
|
|
4271
4437
|
addSortedRowIdsListener(
|
|
4272
4438
|
tableId: Id,
|
|
@@ -4303,7 +4469,6 @@ export interface Store {
|
|
|
4303
4469
|
* (since the latter may become relevant due to changes made in the former).
|
|
4304
4470
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4305
4471
|
* though they will fire non-mutator listeners.
|
|
4306
|
-
*
|
|
4307
4472
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4308
4473
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
4309
4474
|
* @param listener The function that will be called whenever data in the
|
|
@@ -4415,7 +4580,6 @@ export interface Store {
|
|
|
4415
4580
|
* (since the latter may become relevant due to changes made in the former).
|
|
4416
4581
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4417
4582
|
* though they will fire non-mutator listeners.
|
|
4418
|
-
*
|
|
4419
4583
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4420
4584
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
4421
4585
|
* @param listener The function that will be called whenever the Cell Ids in
|
|
@@ -4520,7 +4684,6 @@ export interface Store {
|
|
|
4520
4684
|
* (since the latter may become relevant due to changes made in the former).
|
|
4521
4685
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4522
4686
|
* though they will fire non-mutator listeners.
|
|
4523
|
-
*
|
|
4524
4687
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4525
4688
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
4526
4689
|
* @param cellId The Id of the Cell to listen to, or `null` as a wildcard.
|
|
@@ -4629,7 +4792,6 @@ export interface Store {
|
|
|
4629
4792
|
* (since the latter may become relevant due to changes made in the former).
|
|
4630
4793
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4631
4794
|
* though they will fire non-mutator listeners.
|
|
4632
|
-
*
|
|
4633
4795
|
* @param listener The function that will be called whenever data in the
|
|
4634
4796
|
* Values changes.
|
|
4635
4797
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -4671,7 +4833,7 @@ export interface Store {
|
|
|
4671
4833
|
* store.delListener(listenerId);
|
|
4672
4834
|
* ```
|
|
4673
4835
|
* @category Listener
|
|
4674
|
-
* @since v3.0
|
|
4836
|
+
* @since v3.0.0
|
|
4675
4837
|
*/
|
|
4676
4838
|
addValuesListener(listener: ValuesListener, mutator?: boolean): Id;
|
|
4677
4839
|
|
|
@@ -4693,7 +4855,6 @@ export interface Store {
|
|
|
4693
4855
|
* (since the latter may become relevant due to changes made in the former).
|
|
4694
4856
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4695
4857
|
* though they will fire non-mutator listeners.
|
|
4696
|
-
*
|
|
4697
4858
|
* @param listener The function that will be called whenever the Value Ids in
|
|
4698
4859
|
* the Store change.
|
|
4699
4860
|
* @param mutator An optional boolean that indicates that the listener mutates
|
|
@@ -4735,7 +4896,7 @@ export interface Store {
|
|
|
4735
4896
|
* store.delListener(listenerId);
|
|
4736
4897
|
* ```
|
|
4737
4898
|
* @category Listener
|
|
4738
|
-
* @since v3.0
|
|
4899
|
+
* @since v3.0.0
|
|
4739
4900
|
*/
|
|
4740
4901
|
addValueIdsListener(listener: ValueIdsListener, mutator?: boolean): Id;
|
|
4741
4902
|
|
|
@@ -4758,7 +4919,6 @@ export interface Store {
|
|
|
4758
4919
|
* (since the latter may become relevant due to changes made in the former).
|
|
4759
4920
|
* The changes made by mutator listeners do not fire other mutating listeners,
|
|
4760
4921
|
* though they will fire non-mutator listeners.
|
|
4761
|
-
*
|
|
4762
4922
|
* @param valueId The Id of the Value to listen to, or `null` as a wildcard.
|
|
4763
4923
|
* @param listener The function that will be called whenever data in the
|
|
4764
4924
|
* matching Value changes.
|
|
@@ -4824,7 +4984,7 @@ export interface Store {
|
|
|
4824
4984
|
* store.delListener(listenerId);
|
|
4825
4985
|
* ```
|
|
4826
4986
|
* @category Listener
|
|
4827
|
-
* @since v3.0
|
|
4987
|
+
* @since v3.0.0
|
|
4828
4988
|
*/
|
|
4829
4989
|
addValueListener(
|
|
4830
4990
|
valueId: IdOrNull,
|
|
@@ -4877,7 +5037,6 @@ export interface Store {
|
|
|
4877
5037
|
*
|
|
4878
5038
|
* To help understand all of these schema-based conditions, please see the
|
|
4879
5039
|
* TablesSchema example below.
|
|
4880
|
-
*
|
|
4881
5040
|
* @param tableId The Id of the Table to listen to, or `null` as a wildcard.
|
|
4882
5041
|
* @param rowId The Id of the Row to listen to, or `null` as a wildcard.
|
|
4883
5042
|
* @param cellId The Id of the Cell to listen to, or `null` as a wildcard.
|
|
@@ -5053,7 +5212,7 @@ export interface Store {
|
|
|
5053
5212
|
* store.delListener(listenerId);
|
|
5054
5213
|
* ```
|
|
5055
5214
|
* @category Listener
|
|
5056
|
-
* @since v1.1
|
|
5215
|
+
* @since v1.1.0
|
|
5057
5216
|
*/
|
|
5058
5217
|
addInvalidCellListener(
|
|
5059
5218
|
tableId: IdOrNull,
|
|
@@ -5101,7 +5260,6 @@ export interface Store {
|
|
|
5101
5260
|
*
|
|
5102
5261
|
* To help understand all of these schema-based conditions, please see the
|
|
5103
5262
|
* ValuesSchema example below.
|
|
5104
|
-
*
|
|
5105
5263
|
* @param valueId The Id of the Value to listen to, or `null` as a wildcard.
|
|
5106
5264
|
* @param listener The function that will be called whenever an attempt to
|
|
5107
5265
|
* write invalid data to the matching Value was made.
|
|
@@ -5231,7 +5389,7 @@ export interface Store {
|
|
|
5231
5389
|
* store.delListener(listenerId);
|
|
5232
5390
|
* ```
|
|
5233
5391
|
* @category Listener
|
|
5234
|
-
* @since v3.0
|
|
5392
|
+
* @since v3.0.0
|
|
5235
5393
|
*/
|
|
5236
5394
|
addInvalidValueListener(
|
|
5237
5395
|
valueId: IdOrNull,
|
|
@@ -5239,6 +5397,50 @@ export interface Store {
|
|
|
5239
5397
|
mutator?: boolean,
|
|
5240
5398
|
): Id;
|
|
5241
5399
|
|
|
5400
|
+
/**
|
|
5401
|
+
* The addStartTransactionListener method registers a listener function with
|
|
5402
|
+
* the Store that will be called at the start of a transaction.
|
|
5403
|
+
*
|
|
5404
|
+
* The provided TransactionListener will receive a reference to the Store and
|
|
5405
|
+
* two booleans to indicate whether Cell or Value data has been touched during
|
|
5406
|
+
* the transaction. Since this is called at the start, they will both be
|
|
5407
|
+
* `false`!
|
|
5408
|
+
*
|
|
5409
|
+
* Note that a TransactionListener added to the Store with this method can
|
|
5410
|
+
* mutate the Store, and its changes will be treated as part of the
|
|
5411
|
+
* transaction that is starting.
|
|
5412
|
+
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5413
|
+
* @example
|
|
5414
|
+
* This example registers a listener that is called at start end of the
|
|
5415
|
+
* transaction, just before its listeners will be called.
|
|
5416
|
+
*
|
|
5417
|
+
* ```js
|
|
5418
|
+
* const store = createStore()
|
|
5419
|
+
* .setTables({
|
|
5420
|
+
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
5421
|
+
* })
|
|
5422
|
+
* .setValues({open: true, employees: 3});
|
|
5423
|
+
* const listenerId = store.addStartTransactionListener(
|
|
5424
|
+
* (store, cellsTouched, valuesTouched) => {
|
|
5425
|
+
* console.log('Transaction started');
|
|
5426
|
+
* },
|
|
5427
|
+
* );
|
|
5428
|
+
*
|
|
5429
|
+
* store.transaction(() =>
|
|
5430
|
+
* store.setCell('pets', 'fido', 'color', 'brown').setValue('employees', 3),
|
|
5431
|
+
* );
|
|
5432
|
+
* // -> 'Transaction started'
|
|
5433
|
+
*
|
|
5434
|
+
* store.callListener(listenerId);
|
|
5435
|
+
* // -> 'Transaction started'
|
|
5436
|
+
*
|
|
5437
|
+
* store.delListener(listenerId);
|
|
5438
|
+
* ```
|
|
5439
|
+
* @category Listener
|
|
5440
|
+
* @since v3.2.0
|
|
5441
|
+
*/
|
|
5442
|
+
addStartTransactionListener(listener: TransactionListener): Id;
|
|
5443
|
+
|
|
5242
5444
|
/**
|
|
5243
5445
|
* The addWillFinishTransactionListener method registers a listener function
|
|
5244
5446
|
* with the Store that will be called just before other non-mutating listeners
|
|
@@ -5259,6 +5461,10 @@ export interface Store {
|
|
|
5259
5461
|
* value of `cellsTouched` and `valuesTouched` in the listener will be `false`
|
|
5260
5462
|
* because all changes have been reverted.
|
|
5261
5463
|
*
|
|
5464
|
+
* Note that a TransactionListener added to the Store with this method can
|
|
5465
|
+
* mutate the Store itself, and its changes will be treated as part of the
|
|
5466
|
+
* transaction that is starting (and may fire non-mutating listeners after
|
|
5467
|
+
* this).
|
|
5262
5468
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5263
5469
|
* @example
|
|
5264
5470
|
* This example registers a listener that is called at the end of the
|
|
@@ -5328,7 +5534,7 @@ export interface Store {
|
|
|
5328
5534
|
* .delListener(listenerId3);
|
|
5329
5535
|
* ```
|
|
5330
5536
|
* @category Listener
|
|
5331
|
-
* @since v1.3
|
|
5537
|
+
* @since v1.3.0
|
|
5332
5538
|
*/
|
|
5333
5539
|
addWillFinishTransactionListener(listener: TransactionListener): Id;
|
|
5334
5540
|
|
|
@@ -5353,6 +5559,8 @@ export interface Store {
|
|
|
5353
5559
|
* value of `cellsTouched` and `valuesTouched` in the listener will be `false`
|
|
5354
5560
|
* because all changes have been reverted.
|
|
5355
5561
|
*
|
|
5562
|
+
* Note that a TransactionListener added to the Store with this method
|
|
5563
|
+
* _cannot_ mutate the Store itself, and attempts to do so will fail silently.
|
|
5356
5564
|
* @returns A unique Id for the listener that can later be used to remove it.
|
|
5357
5565
|
* @example
|
|
5358
5566
|
* This example registers a listener that is called at the end of the
|
|
@@ -5422,7 +5630,7 @@ export interface Store {
|
|
|
5422
5630
|
* .delListener(listenerId3);
|
|
5423
5631
|
* ```
|
|
5424
5632
|
* @category Listener
|
|
5425
|
-
* @since v1.3
|
|
5633
|
+
* @since v1.3.0
|
|
5426
5634
|
*/
|
|
5427
5635
|
addDidFinishTransactionListener(listener: TransactionListener): Id;
|
|
5428
5636
|
|
|
@@ -5433,7 +5641,6 @@ export interface Store {
|
|
|
5433
5641
|
* This is useful when you are using mutator listeners to guarantee that data
|
|
5434
5642
|
* conforms to programmatic conditions, and those conditions change such that
|
|
5435
5643
|
* you need to update the Store in bulk.
|
|
5436
|
-
*
|
|
5437
5644
|
* @param listenerId The Id of the listener to call.
|
|
5438
5645
|
* @returns A reference to the Store.
|
|
5439
5646
|
* @example
|
|
@@ -5549,7 +5756,6 @@ export interface Store {
|
|
|
5549
5756
|
*
|
|
5550
5757
|
* Use the Id returned by whichever method was used to add the listener. Note
|
|
5551
5758
|
* that the Store may re-use this Id for future listeners added to it.
|
|
5552
|
-
*
|
|
5553
5759
|
* @param listenerId The Id of the listener to remove.
|
|
5554
5760
|
* @returns A reference to the Store.
|
|
5555
5761
|
* @example
|
|
@@ -5587,7 +5793,6 @@ export interface Store {
|
|
|
5587
5793
|
* return an empty object. The method is intended to be used during
|
|
5588
5794
|
* development to ensure your application is not leaking listener
|
|
5589
5795
|
* registrations, for example.
|
|
5590
|
-
*
|
|
5591
5796
|
* @returns A StoreListenerStats object containing Store listener statistics.
|
|
5592
5797
|
* @example
|
|
5593
5798
|
* This example gets the listener statistics of a small and simple Store.
|
|
@@ -5615,7 +5820,6 @@ export interface Store {
|
|
|
5615
5820
|
*
|
|
5616
5821
|
* Since (or perhaps _because_) it is the most important function in the whole
|
|
5617
5822
|
* module, it is trivially simple.
|
|
5618
|
-
*
|
|
5619
5823
|
* @returns A reference to the new Store.
|
|
5620
5824
|
* @example
|
|
5621
5825
|
* This example creates a Store.
|