tinybase 4.0.0-beta.4 → 4.0.0-beta.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/persisters/persister-automerge.cjs +1 -0
- package/lib/cjs/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-browser.cjs +1 -0
- package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-file.cjs +1 -0
- package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-remote.cjs +1 -0
- package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs +1 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-yjs.cjs +1 -0
- package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs/persisters.cjs +1 -1
- package/lib/cjs/persisters.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-file.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs-es6/persisters.cjs +1 -1
- package/lib/cjs-es6/persisters.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/{persister-automerge.js → persisters/persister-automerge.js} +58 -31
- package/lib/debug/{persister-browser.js → persisters/persister-browser.js} +49 -20
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +665 -0
- package/lib/debug/{persister-file.js → persisters/persister-file.js} +51 -25
- package/lib/debug/{persister-remote.js → persisters/persister-remote.js} +48 -19
- 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} +49 -20
- package/lib/debug/persisters.js +47 -18
- package/lib/debug/store.js +79 -29
- package/lib/debug/tinybase.js +123 -46
- package/lib/debug/tools.js +121 -27
- package/lib/debug/ui-react.js +24 -0
- package/lib/es6/persisters/persister-automerge.js +1 -0
- package/lib/es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/es6/persisters/persister-browser.js +1 -0
- package/lib/es6/persisters/persister-browser.js.gz +0 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-file.js +1 -0
- package/lib/es6/persisters/persister-file.js.gz +0 -0
- package/lib/es6/persisters/persister-remote.js +1 -0
- package/lib/es6/persisters/persister-remote.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite3.js +1 -0
- package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/es6/persisters/persister-yjs.js +1 -0
- package/lib/es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/es6/persisters.js +1 -1
- package/lib/es6/persisters.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/persisters/persister-automerge.js +1 -0
- package/lib/persisters/persister-automerge.js.gz +0 -0
- package/lib/persisters/persister-browser.js +1 -0
- package/lib/persisters/persister-browser.js.gz +0 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-file.js +1 -0
- package/lib/persisters/persister-file.js.gz +0 -0
- package/lib/persisters/persister-remote.js +1 -0
- package/lib/persisters/persister-remote.js.gz +0 -0
- package/lib/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-sqlite3.js +1 -0
- package/lib/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/persisters/persister-yjs.js +1 -0
- package/lib/persisters/persister-yjs.js.gz +0 -0
- package/lib/persisters.js +1 -1
- package/lib/persisters.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/checkpoints.d.ts +0 -27
- package/lib/types/common.d.ts +0 -9
- package/lib/types/indexes.d.ts +0 -26
- package/lib/types/metrics.d.ts +0 -23
- package/lib/types/{persister-automerge.d.ts → persisters/persister-automerge.d.ts} +4 -6
- package/lib/types/{persister-browser.d.ts → persisters/persister-browser.d.ts} +2 -5
- package/lib/types/persisters/persister-cr-sqlite-wasm.d.ts +95 -0
- package/lib/types/{persister-file.d.ts → persisters/persister-file.d.ts} +3 -5
- package/lib/types/{persister-remote.d.ts → persisters/persister-remote.d.ts} +2 -4
- package/lib/types/persisters/persister-sqlite-wasm.d.ts +102 -0
- package/lib/types/persisters/persister-sqlite3.d.ts +109 -0
- package/lib/types/{persister-yjs.d.ts → persisters/persister-yjs.d.ts} +4 -6
- package/lib/types/persisters.d.ts +517 -27
- package/lib/types/queries.d.ts +52 -127
- package/lib/types/relationships.d.ts +0 -26
- package/lib/types/store.d.ts +347 -196
- package/lib/types/tinybase.d.ts +0 -1
- package/lib/types/tools.d.ts +15 -28
- package/lib/types/ui-react.d.ts +196 -181
- package/lib/types/with-schemas/checkpoints.d.ts +5 -32
- package/lib/types/with-schemas/common.d.ts +0 -9
- package/lib/types/with-schemas/indexes.d.ts +9 -35
- package/lib/types/with-schemas/metrics.d.ts +9 -32
- package/lib/types/with-schemas/{persister-automerge.d.ts → persisters/persister-automerge.d.ts} +4 -6
- package/lib/types/with-schemas/{persister-browser.d.ts → persisters/persister-browser.d.ts} +2 -5
- package/lib/types/with-schemas/persisters/persister-cr-sqlite-wasm.d.ts +105 -0
- package/lib/types/with-schemas/{persister-file.d.ts → persisters/persister-file.d.ts} +3 -5
- package/lib/types/with-schemas/{persister-remote.d.ts → persisters/persister-remote.d.ts} +2 -4
- package/lib/types/with-schemas/persisters/persister-sqlite-wasm.d.ts +113 -0
- package/lib/types/with-schemas/persisters/persister-sqlite3.d.ts +119 -0
- package/lib/types/with-schemas/{persister-yjs.d.ts → persisters/persister-yjs.d.ts} +4 -6
- package/lib/types/with-schemas/persisters.d.ts +534 -29
- package/lib/types/with-schemas/queries.d.ts +61 -224
- package/lib/types/with-schemas/relationships.d.ts +9 -35
- package/lib/types/with-schemas/store.d.ts +488 -239
- package/lib/types/with-schemas/tinybase.d.ts +0 -1
- package/lib/types/with-schemas/tools.d.ts +19 -32
- package/lib/types/with-schemas/ui-react.d.ts +221 -186
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/persisters/persister-automerge.js +1 -0
- package/lib/umd/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd/persisters/persister-browser.js +1 -0
- package/lib/umd/persisters/persister-browser.js.gz +0 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-file.js +1 -0
- package/lib/umd/persisters/persister-file.js.gz +0 -0
- package/lib/umd/persisters/persister-remote.js +1 -0
- package/lib/umd/persisters/persister-remote.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite3.js +1 -0
- package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd/persisters/persister-yjs.js +1 -0
- package/lib/umd/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd/persisters.js +1 -1
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-automerge.js +1 -0
- package/lib/umd-es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-browser.js +1 -0
- package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-file.js +1 -0
- package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-remote.js +1 -0
- package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js +1 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-yjs.js +1 -0
- package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd-es6/persisters.js +1 -1
- package/lib/umd-es6/persisters.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +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
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
* function, which returns a new Queries object. That object in turn has methods
|
|
7
7
|
* that let you create new query definitions, access their results directly, and
|
|
8
8
|
* register listeners for when those results change.
|
|
9
|
-
*
|
|
10
9
|
* @packageDocumentation
|
|
11
10
|
* @module queries
|
|
12
|
-
* @since v2.0
|
|
11
|
+
* @since v2.0.0
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import {
|
|
@@ -33,7 +32,6 @@ import {Id, IdOrNull, Ids} from './common.d';
|
|
|
33
32
|
* addResultTableListener method. It is similar to the Table type in the store
|
|
34
33
|
* module, but without schema-specific typing, and is a regular JavaScript
|
|
35
34
|
* object containing individual ResultRow objects, keyed by their Id.
|
|
36
|
-
*
|
|
37
35
|
* @example
|
|
38
36
|
* ```js
|
|
39
37
|
* const resultTable: ResultTable = {
|
|
@@ -53,7 +51,6 @@ export type ResultTable = {[rowId: Id]: ResultRow};
|
|
|
53
51
|
* addResultRowListener method. It is similar to the Row type in the store
|
|
54
52
|
* module, but without schema-specific typing, and is a regular JavaScript
|
|
55
53
|
* object containing individual ResultCell objects, keyed by their Id.
|
|
56
|
-
*
|
|
57
54
|
* @example
|
|
58
55
|
* ```js
|
|
59
56
|
* const resultRow: ResultRow = {species: 'dog', color: 'brown'};
|
|
@@ -70,7 +67,6 @@ export type ResultRow = {[cellId: Id]: ResultCell};
|
|
|
70
67
|
* addResultCellListener method. It is similar to the Cell type in the store
|
|
71
68
|
* module, but without schema-specific typing, and is a JavaScript string,
|
|
72
69
|
* number, or boolean.
|
|
73
|
-
*
|
|
74
70
|
* @example
|
|
75
71
|
* ```js
|
|
76
72
|
* const resultCell: ResultCell = 'dog';
|
|
@@ -82,7 +78,6 @@ export type ResultCell = string | number | boolean;
|
|
|
82
78
|
/**
|
|
83
79
|
* The ResultCellOrUndefined type is the data structure representing a single
|
|
84
80
|
* cell in the results of a query, or the value `undefined`.
|
|
85
|
-
*
|
|
86
81
|
* @category Result
|
|
87
82
|
*/
|
|
88
83
|
export type ResultCellOrUndefined = ResultCell | undefined;
|
|
@@ -94,12 +89,11 @@ export type ResultCellOrUndefined = ResultCell | undefined;
|
|
|
94
89
|
* There are a number of common predefined aggregators, such as for counting,
|
|
95
90
|
* summing, and averaging values. This type is instead used for when you wish to
|
|
96
91
|
* use a more complex aggregation of your own devising.
|
|
97
|
-
*
|
|
98
92
|
* @param cells The array of Cell values to be aggregated.
|
|
99
93
|
* @param length The length of the array of Cell values to be aggregated.
|
|
100
94
|
* @returns The value of the aggregation.
|
|
101
95
|
* @category Aggregators
|
|
102
|
-
* @since v2.0
|
|
96
|
+
* @since v2.0.0
|
|
103
97
|
*/
|
|
104
98
|
export type Aggregate = (cells: ResultCell[], length: number) => ResultCell;
|
|
105
99
|
|
|
@@ -119,13 +113,12 @@ export type Aggregate = (cells: ResultCell[], length: number) => ResultCell;
|
|
|
119
113
|
* Where possible, if you are providing a custom Aggregate, seek an
|
|
120
114
|
* implementation of an AggregateAdd function that can reduce the complexity
|
|
121
115
|
* cost of growing the input data set.
|
|
122
|
-
*
|
|
123
116
|
* @param current The current value of the aggregation.
|
|
124
117
|
* @param add The Cell value being added to the aggregation.
|
|
125
118
|
* @param length The length of the array of Cell values in the aggregation.
|
|
126
119
|
* @returns The new value of the aggregation.
|
|
127
120
|
* @category Aggregators
|
|
128
|
-
* @since v2.0
|
|
121
|
+
* @since v2.0.0
|
|
129
122
|
*/
|
|
130
123
|
export type AggregateAdd = (
|
|
131
124
|
current: ResultCell,
|
|
@@ -152,13 +145,12 @@ export type AggregateAdd = (
|
|
|
152
145
|
* Where possible, if you are providing a custom Aggregate, seek an
|
|
153
146
|
* implementation of an AggregateRemove function that can reduce the complexity
|
|
154
147
|
* cost of shrinking the input data set.
|
|
155
|
-
*
|
|
156
148
|
* @param current The current value of the aggregation.
|
|
157
149
|
* @param remove The Cell value being removed from the aggregation.
|
|
158
150
|
* @param length The length of the array of Cell values in the aggregation.
|
|
159
151
|
* @returns The new value of the aggregation.
|
|
160
152
|
* @category Aggregators
|
|
161
|
-
* @since v2.0
|
|
153
|
+
* @since v2.0.0
|
|
162
154
|
*/
|
|
163
155
|
export type AggregateRemove = (
|
|
164
156
|
current: ResultCell,
|
|
@@ -183,14 +175,13 @@ export type AggregateRemove = (
|
|
|
183
175
|
* Where possible, if you are providing a custom Aggregate, seek an
|
|
184
176
|
* implementation of an AggregateReplace function that can reduce the complexity
|
|
185
177
|
* cost of changing the input data set in place.
|
|
186
|
-
*
|
|
187
178
|
* @param current The current value of the aggregation.
|
|
188
179
|
* @param add The Cell value being added to the aggregation.
|
|
189
180
|
* @param remove The Cell value being removed from the aggregation.
|
|
190
181
|
* @param length The length of the array of Cell values in the aggregation.
|
|
191
182
|
* @returns The new value of the aggregation.
|
|
192
183
|
* @category Aggregators
|
|
193
|
-
* @since v2.0
|
|
184
|
+
* @since v2.0.0
|
|
194
185
|
*/
|
|
195
186
|
export type AggregateReplace = (
|
|
196
187
|
current: ResultCell,
|
|
@@ -205,10 +196,9 @@ export type AggregateReplace = (
|
|
|
205
196
|
* A QueryCallback is provided when using the forEachQuery method, so that you
|
|
206
197
|
* can do something based on every query in the Queries object. See that method
|
|
207
198
|
* for specific examples.
|
|
208
|
-
*
|
|
209
199
|
* @param queryId The Id of the query that the callback can operate on.
|
|
210
200
|
* @category Callback
|
|
211
|
-
* @since v2.0
|
|
201
|
+
* @since v2.0.0
|
|
212
202
|
*/
|
|
213
203
|
export type QueryCallback = (queryId: Id) => void;
|
|
214
204
|
|
|
@@ -219,7 +209,6 @@ export type QueryCallback = (queryId: Id) => void;
|
|
|
219
209
|
* A ResultTableCallback is provided when using the forEachResultTable method,
|
|
220
210
|
* so that you can do something based on every ResultTable in the Queries
|
|
221
211
|
* object. See that method for specific examples.
|
|
222
|
-
*
|
|
223
212
|
* @param tableId The Id of the ResultTable that the callback can operate on.
|
|
224
213
|
* @param forEachRow A function that will let you iterate over the ResultRow
|
|
225
214
|
* objects in this ResultTable.
|
|
@@ -237,7 +226,6 @@ export type ResultTableCallback = (
|
|
|
237
226
|
* A ResultRowCallback is provided when using the forEachResultRow method, so
|
|
238
227
|
* that you can do something based on every ResultRow in a ResultTable. See that
|
|
239
228
|
* method for specific examples.
|
|
240
|
-
*
|
|
241
229
|
* @param rowId The Id of the ResultRow that the callback can operate on.
|
|
242
230
|
* @param forEachRow A function that will let you iterate over the ResultCell
|
|
243
231
|
* values in this ResultRow.
|
|
@@ -255,7 +243,6 @@ export type ResultRowCallback = (
|
|
|
255
243
|
* A ResultCellCallback is provided when using the forEachResultCell method, so
|
|
256
244
|
* that you can do something based on every ResultCell in a ResultRow. See that
|
|
257
245
|
* method for specific examples.
|
|
258
|
-
*
|
|
259
246
|
* @param cellId The Id of the ResultCell that the callback can operate on.
|
|
260
247
|
* @param cell The value of the ResultCell.
|
|
261
248
|
* @category Callback
|
|
@@ -283,14 +270,13 @@ export type ResultCellCallback = (cellId: Id, cell: ResultCell) => void;
|
|
|
283
270
|
* object, the Id of the ResultTable that changed (which is the same as the
|
|
284
271
|
* query Id), and a GetCellResultChange function that can be used to query
|
|
285
272
|
* ResultCell values before and after the change.
|
|
286
|
-
*
|
|
287
273
|
* @param queries A reference to the Queries object that changed.
|
|
288
274
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
289
275
|
* query Id.
|
|
290
276
|
* @param getCellChange A function that returns information about any
|
|
291
277
|
* ResultCell's changes.
|
|
292
278
|
* @category Listener
|
|
293
|
-
* @since v2.0
|
|
279
|
+
* @since v2.0.0
|
|
294
280
|
*/
|
|
295
281
|
export type ResultTableListener<Schemas extends OptionalSchemas> = (
|
|
296
282
|
queries: Queries<Schemas>,
|
|
@@ -314,12 +300,11 @@ export type ResultTableListener<Schemas extends OptionalSchemas> = (
|
|
|
314
300
|
* When called, a ResultRowIdsListener is given a reference to the Queries
|
|
315
301
|
* object, and the Id of the ResultTable whose ResultRow Ids changed (which is
|
|
316
302
|
* the same as the query Id).
|
|
317
|
-
*
|
|
318
303
|
* @param queries A reference to the Queries object that changed.
|
|
319
304
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
320
305
|
* query Id.
|
|
321
306
|
* @category Listener
|
|
322
|
-
* @since v2.0
|
|
307
|
+
* @since v2.0.0
|
|
323
308
|
*/
|
|
324
309
|
export type ResultRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
325
310
|
queries: Queries<Schemas>,
|
|
@@ -354,7 +339,6 @@ export type ResultRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
354
339
|
* for pagination purposes. It also receives the sorted array of Ids itself, so
|
|
355
340
|
* that you can use them in the listener without the additional cost of an
|
|
356
341
|
* explicit call to getResultSortedRowIds.
|
|
357
|
-
*
|
|
358
342
|
* @param queries A reference to the Queries object that changed.
|
|
359
343
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
360
344
|
* query Id.
|
|
@@ -365,7 +349,7 @@ export type ResultRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
365
349
|
* @param limit The maximum number of ResultRow Ids returned.
|
|
366
350
|
* @param sortedRowIds The sorted ResultRow Ids themselves.
|
|
367
351
|
* @category Listener
|
|
368
|
-
* @since v2.0
|
|
352
|
+
* @since v2.0.0
|
|
369
353
|
*/
|
|
370
354
|
export type ResultSortedRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
371
355
|
queries: Queries<Schemas>,
|
|
@@ -399,7 +383,6 @@ export type ResultSortedRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
399
383
|
* the Id of the ResultTable that changed (which is the same as the query Id),
|
|
400
384
|
* the Id of the ResultRow that changed, and a GetCellResultChange function that
|
|
401
385
|
* can be used to query ResultCell values before and after the change.
|
|
402
|
-
*
|
|
403
386
|
* @param queries A reference to the Queries object that changed.
|
|
404
387
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
405
388
|
* query Id.
|
|
@@ -407,7 +390,7 @@ export type ResultSortedRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
407
390
|
* @param getCellChange A function that returns information about any
|
|
408
391
|
* ResultCell's changes.
|
|
409
392
|
* @category Listener
|
|
410
|
-
* @since v2.0
|
|
393
|
+
* @since v2.0.0
|
|
411
394
|
*/
|
|
412
395
|
export type ResultRowListener<Schemas extends OptionalSchemas> = (
|
|
413
396
|
queries: Queries<Schemas>,
|
|
@@ -436,13 +419,12 @@ export type ResultRowListener<Schemas extends OptionalSchemas> = (
|
|
|
436
419
|
* When called, a ResultCellIdsListener is given a reference to the Queries
|
|
437
420
|
* object, the Id of the ResultTable that changed (which is the same as the
|
|
438
421
|
* query Id), and the Id of the ResultRow whose ResultCell Ids changed.
|
|
439
|
-
*
|
|
440
422
|
* @param queries A reference to the Queries object that changed.
|
|
441
423
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
442
424
|
* query Id.
|
|
443
425
|
* @param rowId The Id of the ResultRow that changed.
|
|
444
426
|
* @category Listener
|
|
445
|
-
* @since v2.0
|
|
427
|
+
* @since v2.0.0
|
|
446
428
|
*/
|
|
447
429
|
export type ResultCellIdsListener<Schemas extends OptionalSchemas> = (
|
|
448
430
|
queries: Queries<Schemas>,
|
|
@@ -477,7 +459,6 @@ export type ResultCellIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
477
459
|
* It is also given the new value of the ResultCell, the old value of the
|
|
478
460
|
* ResultCell, and a GetCellResultChange function that can be used to query
|
|
479
461
|
* ResultCell values before and after the change.
|
|
480
|
-
*
|
|
481
462
|
* @param queries A reference to the Queries object that changed.
|
|
482
463
|
* @param tableId The Id of the ResultTable that changed, which is also the
|
|
483
464
|
* query Id.
|
|
@@ -488,7 +469,7 @@ export type ResultCellIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
488
469
|
* @param getCellChange A function that returns information about any
|
|
489
470
|
* ResultCell's changes.
|
|
490
471
|
* @category Listener
|
|
491
|
-
* @since v2.0
|
|
472
|
+
* @since v2.0.0
|
|
492
473
|
*/
|
|
493
474
|
export type ResultCellListener<Schemas extends OptionalSchemas> = (
|
|
494
475
|
queries: Queries<Schemas>,
|
|
@@ -508,7 +489,6 @@ export type ResultCellListener<Schemas extends OptionalSchemas> = (
|
|
|
508
489
|
* the Store changing. The listener can then fetch the previous value of a
|
|
509
490
|
* ResultCell before the current transaction, the new value after it, and a
|
|
510
491
|
* convenience flag that indicates that the value has changed.
|
|
511
|
-
*
|
|
512
492
|
* @param tableId The Id of the ResultTable to inspect.
|
|
513
493
|
* @param rowId The Id of the ResultRow to inspect.
|
|
514
494
|
* @param cellId The Id of the ResultCell to inspect.
|
|
@@ -530,7 +510,6 @@ export type GetCellResultChange = (
|
|
|
530
510
|
* every listener when called. This array contains the previous value of a
|
|
531
511
|
* ResultCell before the current transaction, the new value after it, and a
|
|
532
512
|
* convenience flag that indicates that the value has changed.
|
|
533
|
-
*
|
|
534
513
|
* @category Listener
|
|
535
514
|
*/
|
|
536
515
|
export type ResultCellChange = [
|
|
@@ -545,9 +524,8 @@ export type ResultCellChange = [
|
|
|
545
524
|
*
|
|
546
525
|
* A QueriesListenerStats object is returned from the getListenerStats method,
|
|
547
526
|
* and is only populated in a debug build.
|
|
548
|
-
*
|
|
549
527
|
* @category Development
|
|
550
|
-
* @since v2.0
|
|
528
|
+
* @since v2.0.0
|
|
551
529
|
*/
|
|
552
530
|
export type QueriesListenerStats = {
|
|
553
531
|
/**
|
|
@@ -579,9 +557,8 @@ export type QueriesListenerStats = {
|
|
|
579
557
|
* A GetTableCell can be provided when setting query definitions, specifically
|
|
580
558
|
* in the Select and Where clauses when you want to create or filter on
|
|
581
559
|
* calculated values. See those methods for specific examples.
|
|
582
|
-
*
|
|
583
560
|
* @category Callback
|
|
584
|
-
* @since v2.0
|
|
561
|
+
* @since v2.0.0
|
|
585
562
|
*/
|
|
586
563
|
export type GetTableCell<
|
|
587
564
|
Schema extends OptionalTablesSchema,
|
|
@@ -591,13 +568,6 @@ export type GetTableCell<
|
|
|
591
568
|
* When called with one parameter, this function will return the value of
|
|
592
569
|
* the specified Cell from the query's root Table for the Row being selected
|
|
593
570
|
* or filtered.
|
|
594
|
-
*
|
|
595
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
596
|
-
*
|
|
597
|
-
* ```ts override
|
|
598
|
-
* (cellId: Id): CellOrUndefined;
|
|
599
|
-
* ```
|
|
600
|
-
*
|
|
601
571
|
* @param cellId The Id of the Cell to fetch the value for.
|
|
602
572
|
* @returns A Cell value or `undefined`.
|
|
603
573
|
*/
|
|
@@ -608,14 +578,6 @@ export type GetTableCell<
|
|
|
608
578
|
* When called with two parameters, this function will return the value of
|
|
609
579
|
* the specified Cell from a Table that has been joined in the query, for
|
|
610
580
|
* the Row being selected or filtered.
|
|
611
|
-
*
|
|
612
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
613
|
-
*
|
|
614
|
-
* ```ts override
|
|
615
|
-
* (joinedTableId: Id, joinedCellId: Id): CellOrUndefined;
|
|
616
|
-
};
|
|
617
|
-
* ```
|
|
618
|
-
*
|
|
619
581
|
* @param joinedTableId The Id of the Table to fetch the value from. If the
|
|
620
582
|
* underlying Table was joined 'as' a different Id, that should instead be
|
|
621
583
|
* used.
|
|
@@ -645,7 +607,6 @@ export type GetTableCell<
|
|
|
645
607
|
* The Select function is provided to the third `query` parameter of the
|
|
646
608
|
* setQueryDefinition method. A query definition must call the Select function
|
|
647
609
|
* at least once, otherwise it will be meaningless and return no data.
|
|
648
|
-
*
|
|
649
610
|
* @example
|
|
650
611
|
* This example shows a query that selects two Cells from the main query Table.
|
|
651
612
|
*
|
|
@@ -733,7 +694,7 @@ export type GetTableCell<
|
|
|
733
694
|
* // -> {cujo: {description: 'dog for Carol'}}
|
|
734
695
|
* ```
|
|
735
696
|
* @category Definition
|
|
736
|
-
* @since v2.0
|
|
697
|
+
* @since v2.0.0
|
|
737
698
|
*/
|
|
738
699
|
export type Select<
|
|
739
700
|
Schema extends OptionalTablesSchema,
|
|
@@ -742,13 +703,6 @@ export type Select<
|
|
|
742
703
|
/**
|
|
743
704
|
* Calling this function with one Id parameter will indicate that the query
|
|
744
705
|
* should select the value of the specified Cell from the query's root Table.
|
|
745
|
-
*
|
|
746
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
747
|
-
*
|
|
748
|
-
* ```ts override
|
|
749
|
-
* (cellId: Id): SelectedAs;
|
|
750
|
-
* ```
|
|
751
|
-
*
|
|
752
706
|
* @param cellId The Id of the Cell to fetch the value for.
|
|
753
707
|
* @returns A SelectedAs object so that the selected Cell Id can be optionally
|
|
754
708
|
* aliased.
|
|
@@ -760,13 +714,6 @@ export type Select<
|
|
|
760
714
|
* Calling this function with two parameters will indicate that the query
|
|
761
715
|
* should select the value of the specified Cell from a Table that has been
|
|
762
716
|
* joined in the query.
|
|
763
|
-
*
|
|
764
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
765
|
-
*
|
|
766
|
-
* ```ts override
|
|
767
|
-
* (joinedTableId: Id, joinedCellId: Id): SelectedAs;
|
|
768
|
-
* ```
|
|
769
|
-
*
|
|
770
717
|
* @param joinedTableId The Id of the Table to fetch the value from. If the
|
|
771
718
|
* underlying Table was joined 'as' a different Id, that should instead be
|
|
772
719
|
* used.
|
|
@@ -782,16 +729,6 @@ export type Select<
|
|
|
782
729
|
* Calling this function with one callback parameter will indicate that the
|
|
783
730
|
* query should select a calculated value, based on one or more Cell values in
|
|
784
731
|
* the root Table or a joined Table, or on the root Table's Row Id.
|
|
785
|
-
*
|
|
786
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
787
|
-
*
|
|
788
|
-
* ```ts override
|
|
789
|
-
* (
|
|
790
|
-
* getCell: (getTableCell: GetTableCell, rowId: Id) => ResultCellOrUndefined,
|
|
791
|
-
* ): SelectedAs;
|
|
792
|
-
};
|
|
793
|
-
* ```
|
|
794
|
-
*
|
|
795
732
|
* @param getCell A callback that takes a GetTableCell function and the main
|
|
796
733
|
* Table's Row Id. These can be used to programmatically create a calculated
|
|
797
734
|
* value from multiple Cell values and the Row Id.
|
|
@@ -817,7 +754,6 @@ export type Select<
|
|
|
817
754
|
* Note that if two Select clauses are both aliased to the same name (or if two
|
|
818
755
|
* columns with the same underlying name are selected, both _without_ aliases),
|
|
819
756
|
* only the latter of two will be used in the query.
|
|
820
|
-
*
|
|
821
757
|
* @example
|
|
822
758
|
* This example shows a query that selects two Cells, one from a joined Table.
|
|
823
759
|
* Both are aliased with the 'as' function:
|
|
@@ -851,7 +787,7 @@ export type Select<
|
|
|
851
787
|
* // -> {cujo: {petSpecies: 'dog', ownerName: 'Carol'}}
|
|
852
788
|
* ```
|
|
853
789
|
* @category Definition
|
|
854
|
-
* @since v2.0
|
|
790
|
+
* @since v2.0.0
|
|
855
791
|
*/
|
|
856
792
|
export type SelectedAs = {
|
|
857
793
|
/**
|
|
@@ -881,7 +817,6 @@ export type SelectedAs = {
|
|
|
881
817
|
* unfiltered query will only ever return the same number of Rows as the main
|
|
882
818
|
* Table being queried, and indeed the resulting table (assuming it has not been
|
|
883
819
|
* aggregated) will even preserve the root Table's original Row Ids.
|
|
884
|
-
*
|
|
885
820
|
* @example
|
|
886
821
|
* This example shows a query that joins a single Table by using an Id present
|
|
887
822
|
* in the main query Table.
|
|
@@ -1024,7 +959,7 @@ export type SelectedAs = {
|
|
|
1024
959
|
* // -> {cujo: {description: 'dog in Washington'}}
|
|
1025
960
|
* ```
|
|
1026
961
|
* @category Definition
|
|
1027
|
-
* @since v2.0
|
|
962
|
+
* @since v2.0.0
|
|
1028
963
|
*/
|
|
1029
964
|
export type Join<
|
|
1030
965
|
Schema extends OptionalTablesSchema,
|
|
@@ -1034,13 +969,6 @@ export type Join<
|
|
|
1034
969
|
* Calling this function with two Id parameters will indicate that the join to
|
|
1035
970
|
* a Row in an adjacent Table is made by finding its Id in a Cell of the
|
|
1036
971
|
* query's root Table.
|
|
1037
|
-
*
|
|
1038
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1039
|
-
*
|
|
1040
|
-
* ```ts override
|
|
1041
|
-
* (joinedTableId: Id, on: Id): JoinedAs;
|
|
1042
|
-
* ```
|
|
1043
|
-
*
|
|
1044
972
|
* @param joinedTableId The Id of the Table to join to.
|
|
1045
973
|
* @param on The Id of the Cell in the root Table that contains the joined
|
|
1046
974
|
* Table's Row Id.
|
|
@@ -1055,16 +983,6 @@ export type Join<
|
|
|
1055
983
|
* Calling this function with two parameters (where the second is a function)
|
|
1056
984
|
* will indicate that the join to a Row in an adjacent Table is made by
|
|
1057
985
|
* calculating its Id from the Cells and the Row Id of the query's root Table.
|
|
1058
|
-
*
|
|
1059
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1060
|
-
*
|
|
1061
|
-
* ```ts override
|
|
1062
|
-
* (
|
|
1063
|
-
* joinedTableId: Id,
|
|
1064
|
-
* on: (getCell: GetCell, rowId: Id) => Id | undefined,
|
|
1065
|
-
* ): JoinedAs;
|
|
1066
|
-
* ```
|
|
1067
|
-
*
|
|
1068
986
|
* @param joinedTableId The Id of the Table to join to.
|
|
1069
987
|
* @param on A callback that takes a GetCell function and the root Table's Row
|
|
1070
988
|
* Id. These can be used to programmatically calculate the joined Table's Row
|
|
@@ -1080,13 +998,6 @@ export type Join<
|
|
|
1080
998
|
* Calling this function with three Id parameters will indicate that the join
|
|
1081
999
|
* to a Row in distant Table is made by finding its Id in a Cell of an
|
|
1082
1000
|
* intermediately joined Table.
|
|
1083
|
-
*
|
|
1084
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1085
|
-
*
|
|
1086
|
-
* ```ts override
|
|
1087
|
-
* (joinedTableId: Id, fromIntermediateJoinedTableId: Id, on: Id): JoinedAs;
|
|
1088
|
-
* ```
|
|
1089
|
-
*
|
|
1090
1001
|
* @param joinedTableId The Id of the distant Table to join to.
|
|
1091
1002
|
* @param fromIntermediateJoinedTableId The Id of an intermediate Table (which
|
|
1092
1003
|
* should have been in turn joined to the main query table via other Join
|
|
@@ -1114,21 +1025,6 @@ export type Join<
|
|
|
1114
1025
|
* will indicate that the join to a Row in distant Table is made by
|
|
1115
1026
|
* calculating its Id from the Cells and the Row Id of an intermediately
|
|
1116
1027
|
* joined Table.
|
|
1117
|
-
*
|
|
1118
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1119
|
-
*
|
|
1120
|
-
* ```ts override
|
|
1121
|
-
* (
|
|
1122
|
-
* joinedTableId: Id,
|
|
1123
|
-
* fromIntermediateJoinedTableId: Id,
|
|
1124
|
-
* on: (
|
|
1125
|
-
* getIntermediateJoinedCell: GetCell,
|
|
1126
|
-
* intermediateJoinedRowId: Id,
|
|
1127
|
-
* ) => Id | undefined,
|
|
1128
|
-
* ): JoinedAs;
|
|
1129
|
-
};
|
|
1130
|
-
* ```
|
|
1131
|
-
*
|
|
1132
1028
|
* @param joinedTableId The Id of the Table to join to.
|
|
1133
1029
|
* @param fromIntermediateJoinedTableId The Id of an intermediate Table (which
|
|
1134
1030
|
* should have been in turn joined to the main query table via other Join
|
|
@@ -1167,7 +1063,6 @@ export type Join<
|
|
|
1167
1063
|
*
|
|
1168
1064
|
* For the purposes of clarity, it's recommended to use an alias that does not
|
|
1169
1065
|
* collide with a real underlying Table (whether included in the query or not).
|
|
1170
|
-
*
|
|
1171
1066
|
* @example
|
|
1172
1067
|
* This example shows a query that joins the same underlying Table twice, for
|
|
1173
1068
|
* different purposes. Both joins are aliased with the 'as' function to
|
|
@@ -1203,7 +1098,7 @@ export type Join<
|
|
|
1203
1098
|
* // -> {cujo: {buyer: 'Carol', seller: 'Alice'}}
|
|
1204
1099
|
* ```
|
|
1205
1100
|
* @category Definition
|
|
1206
|
-
* @since v2.0
|
|
1101
|
+
* @since v2.0.0
|
|
1207
1102
|
*/
|
|
1208
1103
|
export type JoinedAs = {
|
|
1209
1104
|
/**
|
|
@@ -1231,7 +1126,6 @@ export type JoinedAs = {
|
|
|
1231
1126
|
* describes conditions that should be met by underlying Cell values (whether
|
|
1232
1127
|
* selected or not), and the latter describes conditions based on calculated and
|
|
1233
1128
|
* aggregated values - after Group clauses have been applied.
|
|
1234
|
-
*
|
|
1235
1129
|
* @example
|
|
1236
1130
|
* This example shows a query that filters the results from a single Table by
|
|
1237
1131
|
* comparing an underlying Cell from it with a value.
|
|
@@ -1326,7 +1220,7 @@ export type JoinedAs = {
|
|
|
1326
1220
|
* // -> {cujo: {species: 'dog', state: 'WA'}}
|
|
1327
1221
|
* ```
|
|
1328
1222
|
* @category Definition
|
|
1329
|
-
* @since v2.0
|
|
1223
|
+
* @since v2.0.0
|
|
1330
1224
|
*/
|
|
1331
1225
|
export type Where<
|
|
1332
1226
|
Schema extends OptionalTablesSchema,
|
|
@@ -1336,13 +1230,6 @@ export type Where<
|
|
|
1336
1230
|
* Calling this function with two parameters is used to include only those
|
|
1337
1231
|
* Rows for which a specified Cell in the query's root Table has a specified
|
|
1338
1232
|
* value.
|
|
1339
|
-
*
|
|
1340
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1341
|
-
*
|
|
1342
|
-
* ```ts override
|
|
1343
|
-
* (cellId: Id, equals: Cell): void;
|
|
1344
|
-
* ```
|
|
1345
|
-
*
|
|
1346
1233
|
* @param cellId The Id of the Cell in the query's root Table to test.
|
|
1347
1234
|
* @param equals The value that the Cell has to have for the Row to be
|
|
1348
1235
|
* included in the result.
|
|
@@ -1354,13 +1241,6 @@ export type Where<
|
|
|
1354
1241
|
/**
|
|
1355
1242
|
* Calling this function with three parameters is used to include only those
|
|
1356
1243
|
* Rows for which a specified Cell in a joined Table has a specified value.
|
|
1357
|
-
*
|
|
1358
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1359
|
-
*
|
|
1360
|
-
* ```ts override
|
|
1361
|
-
* (joinedTableId: Id, joinedCellId: Id, equals: Cell): void;
|
|
1362
|
-
* ```
|
|
1363
|
-
*
|
|
1364
1244
|
* @param joinedTableId The Id of the joined Table to test a value in. If the
|
|
1365
1245
|
* underlying Table was joined 'as' a different Id, that should instead be
|
|
1366
1246
|
* used.
|
|
@@ -1388,14 +1268,6 @@ export type Where<
|
|
|
1388
1268
|
* Calling this function with one callback parameter is used to include only
|
|
1389
1269
|
* those Rows which meet a calculated boolean condition, based on values in
|
|
1390
1270
|
* the main and (optionally) joined Tables.
|
|
1391
|
-
*
|
|
1392
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
1393
|
-
*
|
|
1394
|
-
* ```ts override
|
|
1395
|
-
* (condition: (getTableCell: GetTableCell) => boolean): void;
|
|
1396
|
-
};
|
|
1397
|
-
* ```
|
|
1398
|
-
*
|
|
1399
1271
|
* @param condition A callback that takes a GetTableCell function and that
|
|
1400
1272
|
* should return `true` for the Row to be included in the result.
|
|
1401
1273
|
*/
|
|
@@ -1434,7 +1306,6 @@ export type Where<
|
|
|
1434
1306
|
* function's algorithmic complexity by providing shortcuts that can nudge an
|
|
1435
1307
|
* aggregation result when a single value is added, removed, or replaced in the
|
|
1436
1308
|
* input values.
|
|
1437
|
-
*
|
|
1438
1309
|
* @param selectedCellId The Id of the Cell to aggregate. If the underlying Cell
|
|
1439
1310
|
* was selected 'as' a different Id, that should instead be used.
|
|
1440
1311
|
* @param aggregate Either a string representing one of a set of common
|
|
@@ -1574,7 +1445,7 @@ export type Where<
|
|
|
1574
1445
|
* // Both have a parrot at 3. Alice's worm at 1 is excluded from aggregation.
|
|
1575
1446
|
* ```
|
|
1576
1447
|
* @category Definition
|
|
1577
|
-
* @since v2.0
|
|
1448
|
+
* @since v2.0.0
|
|
1578
1449
|
*/
|
|
1579
1450
|
export type Group = (
|
|
1580
1451
|
selectedCellId: Id,
|
|
@@ -1591,7 +1462,6 @@ export type Group = (
|
|
|
1591
1462
|
* Note that if two Group clauses are both aliased to the same name (or if you
|
|
1592
1463
|
* create two groups of the same underlying Cell, both _without_ aliases), only
|
|
1593
1464
|
* the latter of two will be used in the query.
|
|
1594
|
-
*
|
|
1595
1465
|
* @example
|
|
1596
1466
|
* This example shows a query that groups the same underlying Cell twice, for
|
|
1597
1467
|
* different purposes. Both groups are aliased with the 'as' function to
|
|
@@ -1620,7 +1490,7 @@ export type Group = (
|
|
|
1620
1490
|
* // -> {1: {species: 'cat', minPrice: 3, maxPrice: 4}}
|
|
1621
1491
|
* ```
|
|
1622
1492
|
* @category Definition
|
|
1623
|
-
* @since v2.0
|
|
1493
|
+
* @since v2.0.0
|
|
1624
1494
|
*/
|
|
1625
1495
|
export type GroupedAs = {
|
|
1626
1496
|
/**
|
|
@@ -1650,7 +1520,6 @@ export type GroupedAs = {
|
|
|
1650
1520
|
* have not been grouped with a Group clause, you should expect it to be less
|
|
1651
1521
|
* performant than using a Where clause, due to that being applied earlier in
|
|
1652
1522
|
* the query process.
|
|
1653
|
-
*
|
|
1654
1523
|
* @example
|
|
1655
1524
|
* This example shows a query that filters the results from a grouped Table by
|
|
1656
1525
|
* comparing a Cell from it with a value.
|
|
@@ -1715,14 +1584,13 @@ export type GroupedAs = {
|
|
|
1715
1584
|
* // Parrots are filtered out because they have zero range in price.
|
|
1716
1585
|
* ```
|
|
1717
1586
|
* @category Definition
|
|
1718
|
-
* @since v2.0
|
|
1587
|
+
* @since v2.0.0
|
|
1719
1588
|
*/
|
|
1720
1589
|
export type Having = {
|
|
1721
1590
|
/**
|
|
1722
1591
|
* Calling this function with two parameters is used to include only those
|
|
1723
1592
|
* Rows for which a specified Cell in the query's root Table has a specified
|
|
1724
1593
|
* value.
|
|
1725
|
-
*
|
|
1726
1594
|
* @param selectedOrGroupedCellId The Id of the Cell in the query to test.
|
|
1727
1595
|
* @param equals The value that the Cell has to have for the Row to be
|
|
1728
1596
|
* included in the result.
|
|
@@ -1731,7 +1599,6 @@ export type Having = {
|
|
|
1731
1599
|
/**
|
|
1732
1600
|
* Calling this function with one callback parameter is used to include only
|
|
1733
1601
|
* those Rows which meet a calculated boolean condition.
|
|
1734
|
-
*
|
|
1735
1602
|
* @param condition A callback that takes a GetCell function and that should
|
|
1736
1603
|
* return `true` for the Row to be included in the result.
|
|
1737
1604
|
*/
|
|
@@ -1757,7 +1624,6 @@ export type Having = {
|
|
|
1757
1624
|
* getResultCell method, and so on), and add listeners for when they change
|
|
1758
1625
|
* (with the addResultTableListener method, the addResultRowListener method, the
|
|
1759
1626
|
* addResultCellListener method, and so on).
|
|
1760
|
-
*
|
|
1761
1627
|
* @example
|
|
1762
1628
|
* This example shows a very simple lifecycle of a Queries object: from
|
|
1763
1629
|
* creation, to adding definitions, getting their contents, and then registering
|
|
@@ -1833,7 +1699,7 @@ export type Having = {
|
|
|
1833
1699
|
* @see Car Analysis demo
|
|
1834
1700
|
* @see Movie Database demo
|
|
1835
1701
|
* @category Queries
|
|
1836
|
-
* @since v2.0
|
|
1702
|
+
* @since v2.0.0
|
|
1837
1703
|
*/
|
|
1838
1704
|
export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
1839
1705
|
/**
|
|
@@ -1885,7 +1751,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1885
1751
|
*
|
|
1886
1752
|
* Additionally, you can use the getResultSortedRowIds method and
|
|
1887
1753
|
* addResultSortedRowIdsListener method to sort and paginate the results.
|
|
1888
|
-
*
|
|
1889
1754
|
* @param queryId The Id of the query to define.
|
|
1890
1755
|
* @param tableId The Id of the root Table the query will be based on.
|
|
1891
1756
|
* @param query A callback which can take a `keywords` object and which uses
|
|
@@ -1913,7 +1778,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1913
1778
|
* // -> {fido: {color: 'brown'}, cujo: {color: 'black'}}
|
|
1914
1779
|
* ```
|
|
1915
1780
|
* @category Configuration
|
|
1916
|
-
* @since v2.0
|
|
1781
|
+
* @since v2.0.0
|
|
1917
1782
|
*/
|
|
1918
1783
|
setQueryDefinition<RootTableId extends TableIdFromSchema<Schemas[0]>>(
|
|
1919
1784
|
queryId: Id,
|
|
@@ -1929,6 +1794,11 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1929
1794
|
|
|
1930
1795
|
/**
|
|
1931
1796
|
* The delQueryDefinition method removes an existing query definition.
|
|
1797
|
+
* @param queryId The Id of the query to remove.
|
|
1798
|
+
* @returns A reference to the Queries object.
|
|
1799
|
+
* @example
|
|
1800
|
+
* This example creates a Store, creates a Queries object, defines a simple
|
|
1801
|
+
* query, and then removes it.
|
|
1932
1802
|
*
|
|
1933
1803
|
* This has schema-based typing. The following is a simplified representation:
|
|
1934
1804
|
*
|
|
@@ -1936,12 +1806,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1936
1806
|
* delQueryDefinition(queryId: Id): Queries;
|
|
1937
1807
|
* ```
|
|
1938
1808
|
*
|
|
1939
|
-
* @param queryId The Id of the query to remove.
|
|
1940
|
-
* @returns A reference to the Queries object.
|
|
1941
|
-
* @example
|
|
1942
|
-
* This example creates a Store, creates a Queries object, defines a simple
|
|
1943
|
-
* query, and then removes it.
|
|
1944
|
-
*
|
|
1945
1809
|
* ```js
|
|
1946
1810
|
* const store = createStore().setTable('pets', {
|
|
1947
1811
|
* fido: {species: 'dog', color: 'brown'},
|
|
@@ -1962,13 +1826,17 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1962
1826
|
* // -> []
|
|
1963
1827
|
* ```
|
|
1964
1828
|
* @category Configuration
|
|
1965
|
-
* @since v2.0
|
|
1829
|
+
* @since v2.0.0
|
|
1966
1830
|
*/
|
|
1967
1831
|
delQueryDefinition(queryId: Id): Queries<Schemas>;
|
|
1968
1832
|
|
|
1969
1833
|
/**
|
|
1970
1834
|
* The getStore method returns a reference to the underlying Store that is
|
|
1971
1835
|
* backing this Queries object.
|
|
1836
|
+
* @returns A reference to the Store.
|
|
1837
|
+
* @example
|
|
1838
|
+
* This example creates a Queries object against a newly-created Store and
|
|
1839
|
+
* then gets its reference in order to update its data.
|
|
1972
1840
|
*
|
|
1973
1841
|
* This has schema-based typing. The following is a simplified representation:
|
|
1974
1842
|
*
|
|
@@ -1976,11 +1844,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1976
1844
|
* getStore(): Store;
|
|
1977
1845
|
* ```
|
|
1978
1846
|
*
|
|
1979
|
-
* @returns A reference to the Store.
|
|
1980
|
-
* @example
|
|
1981
|
-
* This example creates a Queries object against a newly-created Store and
|
|
1982
|
-
* then gets its reference in order to update its data.
|
|
1983
|
-
*
|
|
1984
1847
|
* ```js
|
|
1985
1848
|
* const queries = createQueries(createStore());
|
|
1986
1849
|
* queries.setQueryDefinition('dogColors', 'pets', ({select, where}) => {
|
|
@@ -1994,14 +1857,13 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
1994
1857
|
* // -> {fido: {color: 'brown'}}
|
|
1995
1858
|
* ```
|
|
1996
1859
|
* @category Getter
|
|
1997
|
-
* @since v2.0
|
|
1860
|
+
* @since v2.0.0
|
|
1998
1861
|
*/
|
|
1999
1862
|
getStore(): Store<Schemas>;
|
|
2000
1863
|
|
|
2001
1864
|
/**
|
|
2002
1865
|
* The getQueryIds method returns an array of the query Ids registered with
|
|
2003
1866
|
* this Queries object.
|
|
2004
|
-
*
|
|
2005
1867
|
* @returns An array of Ids.
|
|
2006
1868
|
* @example
|
|
2007
1869
|
* This example creates a Queries object with two definitions, and then gets
|
|
@@ -2022,7 +1884,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2022
1884
|
* // -> ['dogColors', 'catColors']
|
|
2023
1885
|
* ```
|
|
2024
1886
|
* @category Getter
|
|
2025
|
-
* @since v2.0
|
|
1887
|
+
* @since v2.0.0
|
|
2026
1888
|
*/
|
|
2027
1889
|
getQueryIds(): Ids;
|
|
2028
1890
|
|
|
@@ -2033,7 +1895,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2033
1895
|
* This method is useful for iterating over all the queries in a functional
|
|
2034
1896
|
* style. The `queryCallback` parameter is a QueryCallback function that will
|
|
2035
1897
|
* be called with the Id of each query.
|
|
2036
|
-
*
|
|
2037
1898
|
* @param queryCallback The function that should be called for every query.
|
|
2038
1899
|
* @example
|
|
2039
1900
|
* This example iterates over each query in a Queries object.
|
|
@@ -2056,14 +1917,13 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2056
1917
|
* // -> 'catColors'
|
|
2057
1918
|
* ```
|
|
2058
1919
|
* @category Iterator
|
|
2059
|
-
* @since v2.0
|
|
1920
|
+
* @since v2.0.0
|
|
2060
1921
|
*/
|
|
2061
1922
|
forEachQuery(queryCallback: QueryCallback): void;
|
|
2062
1923
|
|
|
2063
1924
|
/**
|
|
2064
1925
|
* The hasQuery method returns a boolean indicating whether a given query
|
|
2065
1926
|
* exists in the Queries object.
|
|
2066
|
-
*
|
|
2067
1927
|
* @param queryId The Id of a possible query in the Queries object.
|
|
2068
1928
|
* @returns Whether a query with that Id exists.
|
|
2069
1929
|
* @example
|
|
@@ -2085,7 +1945,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2085
1945
|
* // -> false
|
|
2086
1946
|
* ```
|
|
2087
1947
|
* @category Getter
|
|
2088
|
-
* @since v2.0
|
|
1948
|
+
* @since v2.0.0
|
|
2089
1949
|
*/
|
|
2090
1950
|
hasQuery(queryId: Id): boolean;
|
|
2091
1951
|
|
|
@@ -2100,7 +1960,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2100
1960
|
* ```
|
|
2101
1961
|
*
|
|
2102
1962
|
* If the query Id is invalid, the method returns `undefined`.
|
|
2103
|
-
*
|
|
2104
1963
|
* @param queryId The Id of a query.
|
|
2105
1964
|
* @returns The Id of the Table backing the query, or `undefined`.
|
|
2106
1965
|
* @example
|
|
@@ -2124,7 +1983,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2124
1983
|
* // -> undefined
|
|
2125
1984
|
* ```
|
|
2126
1985
|
* @category Getter
|
|
2127
|
-
* @since v2.0
|
|
1986
|
+
* @since v2.0.0
|
|
2128
1987
|
*/
|
|
2129
1988
|
getTableId<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
2130
1989
|
queryId: Id,
|
|
@@ -2139,7 +1998,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2139
1998
|
* returns a copy of, rather than a reference to the underlying data, so
|
|
2140
1999
|
* changes made to the returned object are not made to the query results
|
|
2141
2000
|
* themselves.
|
|
2142
|
-
*
|
|
2143
2001
|
* @param queryId The Id of a query.
|
|
2144
2002
|
* @returns An object containing the entire data of the ResultTable of the
|
|
2145
2003
|
* query.
|
|
@@ -2172,7 +2030,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2172
2030
|
* // -> {}
|
|
2173
2031
|
* ```
|
|
2174
2032
|
* @category Result
|
|
2175
|
-
* @since v2.0
|
|
2033
|
+
* @since v2.0.0
|
|
2176
2034
|
*/
|
|
2177
2035
|
getResultTable(queryId: Id): ResultTable;
|
|
2178
2036
|
|
|
@@ -2184,7 +2042,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2184
2042
|
* the query Id is invalid, the method returns an empty array. Similarly, it
|
|
2185
2043
|
* returns a copy of, rather than a reference to the list of Ids, so changes
|
|
2186
2044
|
* made to the list object are not made to the query results themselves.
|
|
2187
|
-
*
|
|
2188
2045
|
* @param queryId The Id of a query.
|
|
2189
2046
|
* @returns An array of the Ids of every ResultRow in the result of the query.
|
|
2190
2047
|
* @example
|
|
@@ -2215,7 +2072,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2215
2072
|
* // -> []
|
|
2216
2073
|
* ```
|
|
2217
2074
|
* @category Result
|
|
2218
|
-
* @since v2.0
|
|
2075
|
+
* @since v2.0.0
|
|
2219
2076
|
*/
|
|
2220
2077
|
getResultRowIds(queryId: Id): Ids;
|
|
2221
2078
|
|
|
@@ -2236,7 +2093,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2236
2093
|
* results yourself, especially when the ResultTable is large. For a
|
|
2237
2094
|
* performant approach to tracking the sorted ResultRow Ids when they change,
|
|
2238
2095
|
* use the addResultSortedRowIdsListener method.
|
|
2239
|
-
*
|
|
2240
2096
|
* @param queryId The Id of a query.
|
|
2241
2097
|
* @param cellId The Id of the ResultCell whose values are used for the
|
|
2242
2098
|
* sorting, or `undefined` to by sort the ResultRow Id itself.
|
|
@@ -2275,7 +2131,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2275
2131
|
* // -> []
|
|
2276
2132
|
* ```
|
|
2277
2133
|
* @category Result
|
|
2278
|
-
* @since v2.0
|
|
2134
|
+
* @since v2.0.0
|
|
2279
2135
|
*/
|
|
2280
2136
|
getResultSortedRowIds(
|
|
2281
2137
|
queryId: Id,
|
|
@@ -2294,7 +2150,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2294
2150
|
* Similarly, it returns a copy of, rather than a reference to the underlying
|
|
2295
2151
|
* data, so changes made to the returned object are not made to the query
|
|
2296
2152
|
* results themselves.
|
|
2297
|
-
*
|
|
2298
2153
|
* @param queryId The Id of a query.
|
|
2299
2154
|
* @param rowId The Id of the ResultRow in the ResultTable.
|
|
2300
2155
|
* @returns An object containing the entire data of the ResultRow in the
|
|
@@ -2327,7 +2182,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2327
2182
|
* // -> {}
|
|
2328
2183
|
* ```
|
|
2329
2184
|
* @category Result
|
|
2330
|
-
* @since v2.0
|
|
2185
|
+
* @since v2.0.0
|
|
2331
2186
|
*/
|
|
2332
2187
|
getResultRow(queryId: Id, rowId: Id): ResultRow;
|
|
2333
2188
|
|
|
@@ -2340,7 +2195,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2340
2195
|
* Similarly, it returns a copy of, rather than a reference to the list of
|
|
2341
2196
|
* Ids, so changes made to the list object are not made to the query results
|
|
2342
2197
|
* themselves.
|
|
2343
|
-
*
|
|
2344
2198
|
* @param queryId The Id of a query.
|
|
2345
2199
|
* @param rowId The Id of the ResultRow in the ResultTable.
|
|
2346
2200
|
* @returns An array of the Ids of every ResultCell in the ResultRow in the
|
|
@@ -2373,7 +2227,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2373
2227
|
* // -> []
|
|
2374
2228
|
* ```
|
|
2375
2229
|
* @category Result
|
|
2376
|
-
* @since v2.0
|
|
2230
|
+
* @since v2.0.0
|
|
2377
2231
|
*/
|
|
2378
2232
|
getResultCellIds(queryId: Id, rowId: Id): Ids;
|
|
2379
2233
|
|
|
@@ -2384,7 +2238,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2384
2238
|
* This has the same behavior as a Store's getCell method. For example, if the
|
|
2385
2239
|
* query, or ResultRow, or ResultCell Id is invalid, the method returns
|
|
2386
2240
|
* `undefined`.
|
|
2387
|
-
*
|
|
2388
2241
|
* @param queryId The Id of a query.
|
|
2389
2242
|
* @param rowId The Id of the ResultRow in the ResultTable.
|
|
2390
2243
|
* @param cellId The Id of the ResultCell in the ResultRow.
|
|
@@ -2417,14 +2270,13 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2417
2270
|
* // -> undefined
|
|
2418
2271
|
* ```
|
|
2419
2272
|
* @category Result
|
|
2420
|
-
* @since v2.0
|
|
2273
|
+
* @since v2.0.0
|
|
2421
2274
|
*/
|
|
2422
2275
|
getResultCell(queryId: Id, rowId: Id, cellId: Id): ResultCellOrUndefined;
|
|
2423
2276
|
|
|
2424
2277
|
/**
|
|
2425
2278
|
* The hasResultTable method returns a boolean indicating whether a given
|
|
2426
2279
|
* ResultTable exists.
|
|
2427
|
-
*
|
|
2428
2280
|
* @param queryId The Id of a possible query.
|
|
2429
2281
|
* @returns Whether a ResultTable for that query Id exists.
|
|
2430
2282
|
* @example
|
|
@@ -2452,14 +2304,13 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2452
2304
|
* // -> false
|
|
2453
2305
|
* ```
|
|
2454
2306
|
* @category Result
|
|
2455
|
-
* @since v2.0
|
|
2307
|
+
* @since v2.0.0
|
|
2456
2308
|
*/
|
|
2457
2309
|
hasResultTable(queryId: Id): boolean;
|
|
2458
2310
|
|
|
2459
2311
|
/**
|
|
2460
2312
|
* The hasResultRow method returns a boolean indicating whether a given
|
|
2461
2313
|
* ResultRow exists.
|
|
2462
|
-
*
|
|
2463
2314
|
* @param queryId The Id of a possible query.
|
|
2464
2315
|
* @param rowId The Id of a possible ResultRow.
|
|
2465
2316
|
* @returns Whether a ResultRow for that Id exists.
|
|
@@ -2488,14 +2339,13 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2488
2339
|
* // -> false
|
|
2489
2340
|
* ```
|
|
2490
2341
|
* @category Result
|
|
2491
|
-
* @since v2.0
|
|
2342
|
+
* @since v2.0.0
|
|
2492
2343
|
*/
|
|
2493
2344
|
hasResultRow(queryId: Id, rowId: Id): boolean;
|
|
2494
2345
|
|
|
2495
2346
|
/**
|
|
2496
2347
|
* The hasResultCell method returns a boolean indicating whether a given
|
|
2497
2348
|
* ResultCell exists.
|
|
2498
|
-
*
|
|
2499
2349
|
* @param queryId The Id of a possible query.
|
|
2500
2350
|
* @param rowId The Id of a possible ResultRow.
|
|
2501
2351
|
* @param cellId The Id of a possible ResultCell.
|
|
@@ -2525,7 +2375,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2525
2375
|
* // -> false
|
|
2526
2376
|
* ```
|
|
2527
2377
|
* @category Result
|
|
2528
|
-
* @since v2.0
|
|
2378
|
+
* @since v2.0.0
|
|
2529
2379
|
*/
|
|
2530
2380
|
hasResultCell(queryId: Id, rowId: Id, cellId: Id): boolean;
|
|
2531
2381
|
|
|
@@ -2538,7 +2388,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2538
2388
|
* ResultTableCallback function that will be called with the Id of each
|
|
2539
2389
|
* ResultTable, and with a function that can then be used to iterate over each
|
|
2540
2390
|
* ResultRow of the ResultTable, should you wish.
|
|
2541
|
-
*
|
|
2542
2391
|
* @param tableCallback The function that should be called for every query's
|
|
2543
2392
|
* ResultTable.
|
|
2544
2393
|
* @example
|
|
@@ -2572,7 +2421,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2572
2421
|
* // -> '- felix'
|
|
2573
2422
|
* ```
|
|
2574
2423
|
* @category Iterator
|
|
2575
|
-
* @since v2.0
|
|
2424
|
+
* @since v2.0.0
|
|
2576
2425
|
*/
|
|
2577
2426
|
forEachResultTable(tableCallback: ResultTableCallback): void;
|
|
2578
2427
|
|
|
@@ -2585,7 +2434,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2585
2434
|
* ResultRowCallback function that will be called with the Id of each
|
|
2586
2435
|
* ResultRow, and with a function that can then be used to iterate over each
|
|
2587
2436
|
* ResultCell of the ResultRow, should you wish.
|
|
2588
|
-
*
|
|
2589
2437
|
* @param queryId The Id of a query.
|
|
2590
2438
|
* @param rowCallback The function that should be called for every ResultRow
|
|
2591
2439
|
* of the query's ResultTable.
|
|
@@ -2618,7 +2466,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2618
2466
|
* // -> '- color'
|
|
2619
2467
|
* ```
|
|
2620
2468
|
* @category Iterator
|
|
2621
|
-
* @since v2.0
|
|
2469
|
+
* @since v2.0.0
|
|
2622
2470
|
*/
|
|
2623
2471
|
forEachResultRow(queryId: Id, rowCallback: ResultRowCallback): void;
|
|
2624
2472
|
|
|
@@ -2630,7 +2478,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2630
2478
|
* of the query in a functional style. The `cellCallback` parameter is a
|
|
2631
2479
|
* ResultCellCallback function that will be called with the Id and value of
|
|
2632
2480
|
* each ResultCell.
|
|
2633
|
-
*
|
|
2634
2481
|
* @param queryId The Id of a query.
|
|
2635
2482
|
* @param rowId The Id of a ResultRow in the query's ResultTable.
|
|
2636
2483
|
* @param cellCallback The function that should be called for every ResultCell
|
|
@@ -2662,7 +2509,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2662
2509
|
* // -> 'color: brown'
|
|
2663
2510
|
* ```
|
|
2664
2511
|
* @category Iterator
|
|
2665
|
-
* @since v2.0
|
|
2512
|
+
* @since v2.0.0
|
|
2666
2513
|
*/
|
|
2667
2514
|
forEachResultCell(
|
|
2668
2515
|
queryId: Id,
|
|
@@ -2688,7 +2535,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2688
2535
|
* You can either listen to a single ResultTable (by specifying a query Id as
|
|
2689
2536
|
* the method's first parameter) or changes to any ResultTable (by providing a
|
|
2690
2537
|
* `null` wildcard).
|
|
2691
|
-
*
|
|
2692
2538
|
* @param queryId The Id of the query to listen to, or `null` as a wildcard.
|
|
2693
2539
|
* @param listener The function that will be called whenever data in the
|
|
2694
2540
|
* matching ResultTable changes.
|
|
@@ -2763,7 +2609,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2763
2609
|
* store.delListener(listenerId);
|
|
2764
2610
|
* ```
|
|
2765
2611
|
* @category Listener
|
|
2766
|
-
* @since v2.0
|
|
2612
|
+
* @since v2.0.0
|
|
2767
2613
|
*/
|
|
2768
2614
|
addResultTableListener(
|
|
2769
2615
|
queryId: IdOrNull,
|
|
@@ -2795,7 +2641,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2795
2641
|
* You can either listen to a single ResultTable (by specifying a query Id as
|
|
2796
2642
|
* the method's first parameter) or changes to any ResultTable (by providing a
|
|
2797
2643
|
* `null` wildcard).
|
|
2798
|
-
*
|
|
2799
2644
|
* @param queryId The Id of the query to listen to, or `null` as a wildcard.
|
|
2800
2645
|
* @param listener The function that will be called whenever the ResultRow Ids
|
|
2801
2646
|
* in the ResultTable change.
|
|
@@ -2870,7 +2715,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2870
2715
|
* store.delListener(listenerId);
|
|
2871
2716
|
* ```
|
|
2872
2717
|
* @category Listener
|
|
2873
|
-
* @since v2.0
|
|
2718
|
+
* @since v2.0.0
|
|
2874
2719
|
*/
|
|
2875
2720
|
addResultRowIdsListener(
|
|
2876
2721
|
queryId: IdOrNull,
|
|
@@ -2916,7 +2761,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
2916
2761
|
* should be in descending order. The `offset` and `limit` parameters are used
|
|
2917
2762
|
* to paginate results, but default to `0` and `undefined` to return all
|
|
2918
2763
|
* available ResultRow Ids if not specified.
|
|
2919
|
-
*
|
|
2920
2764
|
* @param queryId The Id of the query to listen to.
|
|
2921
2765
|
* @param cellId The Id of the ResultCell whose values are used for the
|
|
2922
2766
|
* sorting, or `undefined` to by sort the ResultRow Id itself.
|
|
@@ -3010,7 +2854,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3010
2854
|
* store.delListener(listenerId);
|
|
3011
2855
|
* ```
|
|
3012
2856
|
* @category Listener
|
|
3013
|
-
* @since v2.0
|
|
2857
|
+
* @since v2.0.0
|
|
3014
2858
|
*/
|
|
3015
2859
|
addResultSortedRowIdsListener(
|
|
3016
2860
|
queryId: Id,
|
|
@@ -3048,7 +2892,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3048
2892
|
* wildcarded with `null`. You can listen to a specific ResultRow in a
|
|
3049
2893
|
* specific query, any ResultRow in a specific query, a specific ResultRow in
|
|
3050
2894
|
* any query, or any ResultRow in any query.
|
|
3051
|
-
*
|
|
3052
2895
|
* @param queryId The Id of the query to listen to, or `null` as a wildcard.
|
|
3053
2896
|
* @param rowId The Id of the ResultRow to listen to, or `null` as a wildcard.
|
|
3054
2897
|
* @param listener The function that will be called whenever data in the
|
|
@@ -3126,7 +2969,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3126
2969
|
* store.delListener(listenerId);
|
|
3127
2970
|
* ```
|
|
3128
2971
|
* @category Listener
|
|
3129
|
-
* @since v2.0
|
|
2972
|
+
* @since v2.0.0
|
|
3130
2973
|
*/
|
|
3131
2974
|
addResultRowListener(
|
|
3132
2975
|
queryId: IdOrNull,
|
|
@@ -3165,7 +3008,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3165
3008
|
* wildcarded with `null`. You can listen to a specific ResultRow in a
|
|
3166
3009
|
* specific query, any ResultRow in a specific query, a specific ResultRow in
|
|
3167
3010
|
* any query, or any ResultRow in any query.
|
|
3168
|
-
*
|
|
3169
3011
|
* @param queryId The Id of the query to listen to, or `null` as a wildcard.
|
|
3170
3012
|
* @param rowId The Id of the ResultRow to listen to, or `null` as a wildcard.
|
|
3171
3013
|
* @param listener The function that will be called whenever the ResultCell
|
|
@@ -3248,7 +3090,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3248
3090
|
* store.delListener(listenerId);
|
|
3249
3091
|
* ```
|
|
3250
3092
|
* @category Listener
|
|
3251
|
-
* @since v2.0
|
|
3093
|
+
* @since v2.0.0
|
|
3252
3094
|
*/
|
|
3253
3095
|
addResultCellIdsListener(
|
|
3254
3096
|
queryId: IdOrNull,
|
|
@@ -3286,7 +3128,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3286
3128
|
* be wildcarded with `null`. You can listen to a specific ResultCell in a
|
|
3287
3129
|
* specific ResultRow in a specific query, any ResultCell in any ResultRow in
|
|
3288
3130
|
* any query, for example - or every other combination of wildcards.
|
|
3289
|
-
*
|
|
3290
3131
|
* @param queryId The Id of the query to listen to, or `null` as a wildcard.
|
|
3291
3132
|
* @param rowId The Id of the ResultRow to listen to, or `null` as a wildcard.
|
|
3292
3133
|
* @param cellId The Id of the ResultCell to listen to, or `null` as a
|
|
@@ -3375,7 +3216,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3375
3216
|
* store.delListener(listenerId);
|
|
3376
3217
|
* ```
|
|
3377
3218
|
* @category Listener
|
|
3378
|
-
* @since v2.0
|
|
3219
|
+
* @since v2.0.0
|
|
3379
3220
|
*/
|
|
3380
3221
|
addResultCellListener(
|
|
3381
3222
|
queryId: IdOrNull,
|
|
@@ -3396,7 +3237,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3396
3237
|
*
|
|
3397
3238
|
* Use the Id returned by the addMetricListener method. Note that the Queries
|
|
3398
3239
|
* object may re-use this Id for future listeners added to it.
|
|
3399
|
-
*
|
|
3400
3240
|
* @param listenerId The Id of the listener to remove.
|
|
3401
3241
|
* @returns A reference to the Queries object.
|
|
3402
3242
|
* @example
|
|
@@ -3432,7 +3272,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3432
3272
|
* // The listener is not called.
|
|
3433
3273
|
* ```
|
|
3434
3274
|
* @category Listener
|
|
3435
|
-
* @since v2.0
|
|
3275
|
+
* @since v2.0.0
|
|
3436
3276
|
*/
|
|
3437
3277
|
delListener(listenerId: Id): Queries<Schemas>;
|
|
3438
3278
|
|
|
@@ -3442,7 +3282,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3442
3282
|
*
|
|
3443
3283
|
* This guarantees that all of the listeners that the object registered with
|
|
3444
3284
|
* the underlying Store are removed and it can be correctly garbage collected.
|
|
3445
|
-
*
|
|
3446
3285
|
* @example
|
|
3447
3286
|
* This example creates a Store, adds a Queries object with a definition (that
|
|
3448
3287
|
* registers a RowListener with the underlying Store), and then destroys it
|
|
@@ -3468,7 +3307,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3468
3307
|
* // -> 0
|
|
3469
3308
|
* ```
|
|
3470
3309
|
* @category Lifecycle
|
|
3471
|
-
* @since v2.0
|
|
3310
|
+
* @since v2.0.0
|
|
3472
3311
|
*/
|
|
3473
3312
|
destroy(): void;
|
|
3474
3313
|
|
|
@@ -3481,7 +3320,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3481
3320
|
* return an empty object. The method is intended to be used during
|
|
3482
3321
|
* development to ensure your application is not leaking listener
|
|
3483
3322
|
* registrations, for example.
|
|
3484
|
-
*
|
|
3485
3323
|
* @returns A QueriesListenerStats object containing Queries listener
|
|
3486
3324
|
* statistics.
|
|
3487
3325
|
* @example
|
|
@@ -3498,7 +3336,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3498
3336
|
* // -> 0
|
|
3499
3337
|
* ```
|
|
3500
3338
|
* @category Development
|
|
3501
|
-
* @since v2.0
|
|
3339
|
+
* @since v2.0.0
|
|
3502
3340
|
*/
|
|
3503
3341
|
getListenerStats(): QueriesListenerStats;
|
|
3504
3342
|
}
|
|
@@ -3516,7 +3354,6 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3516
3354
|
* A given Store can only have one Queries object associated with it. If you
|
|
3517
3355
|
* call this function twice on the same Store, your second call will return a
|
|
3518
3356
|
* reference to the Queries object created by the first.
|
|
3519
|
-
*
|
|
3520
3357
|
* @param store The Store for which to register query definitions.
|
|
3521
3358
|
* @returns A reference to the new Queries object.
|
|
3522
3359
|
* @example
|
|
@@ -3540,7 +3377,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
|
|
|
3540
3377
|
* // -> true
|
|
3541
3378
|
* ```
|
|
3542
3379
|
* @category Creation
|
|
3543
|
-
* @since v2.0
|
|
3380
|
+
* @since v2.0.0
|
|
3544
3381
|
*/
|
|
3545
3382
|
export function createQueries<Schemas extends OptionalSchemas>(
|
|
3546
3383
|
store: Store<Schemas>,
|