tinybase 3.1.0-beta.4 → 3.1.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/debug/ui-react.js +2 -2
- package/lib/{cjs-es6 → types}/checkpoints.d.ts +11 -13
- package/lib/{debug → types}/indexes.d.ts +8 -16
- package/lib/{debug → types}/metrics.d.ts +47 -50
- package/lib/{cjs → types}/persisters.d.ts +24 -30
- package/lib/{cjs-es6 → types}/queries.d.ts +472 -309
- package/lib/{debug → types}/relationships.d.ts +9 -17
- package/lib/{cjs-es6 → types}/store.d.ts +176 -1084
- package/lib/types/tinybase.d.ts +14 -0
- package/lib/{cjs-es6 → types}/tools.d.ts +7 -12
- package/lib/{debug → types}/ui-react.d.ts +11 -5
- package/lib/{checkpoints.d.ts → types/with-schemas/checkpoints.d.ts} +9 -7
- package/lib/{cjs → types/with-schemas}/indexes.d.ts +31 -18
- package/lib/types/with-schemas/internal/queries.d.ts +15 -0
- package/lib/types/with-schemas/internal/store.d.ts +101 -0
- package/lib/types/with-schemas/internal/ui-react.d.ts +776 -0
- package/lib/{cjs → types/with-schemas}/metrics.d.ts +54 -50
- package/lib/{debug → types/with-schemas}/persisters.d.ts +4 -4
- package/lib/{debug → types/with-schemas}/queries.d.ts +607 -346
- package/lib/{cjs → types/with-schemas}/relationships.d.ts +29 -20
- package/lib/{debug → types/with-schemas}/store.d.ts +386 -829
- package/lib/types/with-schemas/tinybase.d.ts +14 -0
- package/lib/{debug → types/with-schemas}/tools.d.ts +7 -10
- package/lib/{cjs-es6 → types/with-schemas}/ui-react.d.ts +817 -1314
- package/package.json +145 -29
- package/readme.md +3 -3
- package/lib/cjs/checkpoints.d.ts +0 -961
- package/lib/cjs/queries.d.ts +0 -3028
- package/lib/cjs/store.d.ts +0 -6143
- package/lib/cjs/tinybase.d.ts +0 -14
- package/lib/cjs/tools.d.ts +0 -536
- package/lib/cjs/ui-react.d.ts +0 -10921
- package/lib/cjs-es6/indexes.d.ts +0 -974
- package/lib/cjs-es6/metrics.d.ts +0 -829
- package/lib/cjs-es6/persisters.d.ts +0 -733
- package/lib/cjs-es6/relationships.d.ts +0 -1209
- package/lib/cjs-es6/tinybase.d.ts +0 -14
- package/lib/common.d.ts +0 -115
- package/lib/debug/checkpoints.d.ts +0 -961
- package/lib/debug/common.d.ts +0 -115
- package/lib/debug/tinybase.d.ts +0 -14
- package/lib/es6/checkpoints.d.ts +0 -961
- package/lib/es6/common.d.ts +0 -115
- package/lib/es6/indexes.d.ts +0 -974
- package/lib/es6/metrics.d.ts +0 -829
- package/lib/es6/persisters.d.ts +0 -733
- package/lib/es6/queries.d.ts +0 -3028
- package/lib/es6/relationships.d.ts +0 -1209
- package/lib/es6/store.d.ts +0 -6143
- package/lib/es6/tinybase.d.ts +0 -14
- package/lib/es6/tools.d.ts +0 -536
- package/lib/es6/ui-react.d.ts +0 -10921
- package/lib/indexes.d.ts +0 -974
- package/lib/metrics.d.ts +0 -829
- package/lib/persisters.d.ts +0 -733
- package/lib/queries.d.ts +0 -3028
- package/lib/relationships.d.ts +0 -1209
- package/lib/store.d.ts +0 -6143
- package/lib/tinybase.d.ts +0 -14
- package/lib/tools.d.ts +0 -536
- package/lib/ui-react.d.ts +0 -10921
- package/lib/umd/checkpoints.d.ts +0 -961
- package/lib/umd/common.d.ts +0 -115
- package/lib/umd/indexes.d.ts +0 -974
- package/lib/umd/metrics.d.ts +0 -829
- package/lib/umd/persisters.d.ts +0 -733
- package/lib/umd/queries.d.ts +0 -3028
- package/lib/umd/relationships.d.ts +0 -1209
- package/lib/umd/store.d.ts +0 -6143
- package/lib/umd/tinybase.d.ts +0 -14
- package/lib/umd/tools.d.ts +0 -536
- package/lib/umd/ui-react.d.ts +0 -10921
- package/lib/umd-es6/checkpoints.d.ts +0 -961
- package/lib/umd-es6/common.d.ts +0 -115
- package/lib/umd-es6/indexes.d.ts +0 -974
- package/lib/umd-es6/metrics.d.ts +0 -829
- package/lib/umd-es6/persisters.d.ts +0 -733
- package/lib/umd-es6/queries.d.ts +0 -3028
- package/lib/umd-es6/relationships.d.ts +0 -1209
- package/lib/umd-es6/store.d.ts +0 -6143
- package/lib/umd-es6/tinybase.d.ts +0 -14
- package/lib/umd-es6/tools.d.ts +0 -536
- package/lib/umd-es6/ui-react.d.ts +0 -10921
- /package/lib/{cjs-es6 → types}/common.d.ts +0 -0
- /package/lib/{cjs → types/with-schemas}/common.d.ts +0 -0
|
@@ -26,7 +26,7 @@ import {Id, IdOrNull, Ids, Json} from './common.d';
|
|
|
26
26
|
* `pets`, in which each Row may contain a string `species` Cell, and is
|
|
27
27
|
* guaranteed to contain a boolean `sold` Cell that defaults to `false`.
|
|
28
28
|
*
|
|
29
|
-
|
|
29
|
+
* ```js
|
|
30
30
|
* const tableSchema: TablesSchema = {
|
|
31
31
|
* pets: {
|
|
32
32
|
* species: {type: 'string'},
|
|
@@ -57,7 +57,7 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
|
|
|
57
57
|
* When applied to a Store, this CellSchema ensures a boolean Cell is always
|
|
58
58
|
* present, and defaults it to `false`.
|
|
59
59
|
*
|
|
60
|
-
|
|
60
|
+
* ```js
|
|
61
61
|
* const requiredBoolean: CellSchema = {type: 'boolean', default: false};
|
|
62
62
|
* ```
|
|
63
63
|
* @category Schema
|
|
@@ -78,7 +78,7 @@ export type CellSchema =
|
|
|
78
78
|
* When applied to a Store, this ValuesSchema only allows one boolean Value
|
|
79
79
|
* called `open`, that defaults to `false`.
|
|
80
80
|
*
|
|
81
|
-
|
|
81
|
+
* ```js
|
|
82
82
|
* const valuesSchema: ValuesSchema = {
|
|
83
83
|
* open: {type: 'boolean', default: false},
|
|
84
84
|
* };
|
|
@@ -107,7 +107,7 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
|
|
|
107
107
|
* When applied to a Store, this ValueSchema ensures a boolean Value is always
|
|
108
108
|
* present, and defaults it to `false`.
|
|
109
109
|
*
|
|
110
|
-
|
|
110
|
+
* ```js
|
|
111
111
|
* const requiredBoolean: ValueSchema = {type: 'boolean', default: false};
|
|
112
112
|
* ```
|
|
113
113
|
* @category Schema
|
|
@@ -118,68 +118,10 @@ export type ValueSchema =
|
|
|
118
118
|
| {type: 'number'; default?: number}
|
|
119
119
|
| {type: 'boolean'; default?: boolean};
|
|
120
120
|
|
|
121
|
-
/**
|
|
122
|
-
* The NoTablesSchema type is a TablesSchema-like type for when one has not been
|
|
123
|
-
* provided.
|
|
124
|
-
*
|
|
125
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
126
|
-
* expected to need to use it directly.
|
|
127
|
-
*
|
|
128
|
-
* @category Internal
|
|
129
|
-
*/
|
|
130
|
-
export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* The NoValuesSchema type is a ValuesSchema-like type for when one has not been
|
|
134
|
-
* provided.
|
|
135
|
-
*
|
|
136
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
137
|
-
* expected to need to use it directly.
|
|
138
|
-
*
|
|
139
|
-
* @category Internal
|
|
140
|
-
*/
|
|
141
|
-
export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The OptionalTablesSchema type is used by generic types that can optionally
|
|
145
|
-
* take a TablesSchema.
|
|
146
|
-
*
|
|
147
|
-
* @category Schema
|
|
148
|
-
*/
|
|
149
|
-
export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* The OptionalValuesSchema type is used by generic types that can optionally
|
|
153
|
-
* take a ValuesSchema.
|
|
154
|
-
*
|
|
155
|
-
* @category Schema
|
|
156
|
-
*/
|
|
157
|
-
export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* The OptionalSchemas type is used by generic types that can optionally take
|
|
161
|
-
* either or both of a TablesSchema and ValuesSchema.
|
|
162
|
-
*
|
|
163
|
-
* @category Schema
|
|
164
|
-
*/
|
|
165
|
-
export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* The NoSchemas type is used as a default by generic types that can optionally
|
|
169
|
-
* take either or both of a TablesSchema and ValuesSchema.
|
|
170
|
-
*
|
|
171
|
-
* @category Schema
|
|
172
|
-
*/
|
|
173
|
-
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
174
|
-
|
|
175
121
|
/**
|
|
176
122
|
* The Tables type is the data structure representing all of the data in a
|
|
177
123
|
* Store.
|
|
178
124
|
*
|
|
179
|
-
* ```ts override
|
|
180
|
-
* {[tableId: Id]: Table}
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
125
|
* A Tables object is used when setting all of the tables together with the
|
|
184
126
|
* setTables method, and when getting them back out again with the getTables
|
|
185
127
|
* method. A Tables object is a regular JavaScript object containing individual
|
|
@@ -200,18 +142,11 @@ export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
|
200
142
|
* ```
|
|
201
143
|
* @category Store
|
|
202
144
|
*/
|
|
203
|
-
export type Tables
|
|
204
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
205
|
-
WhenSet extends boolean = false,
|
|
206
|
-
> = TablesFromSchema<Schema, WhenSet>;
|
|
145
|
+
export type Tables = {[tableId: Id]: Table};
|
|
207
146
|
|
|
208
147
|
/**
|
|
209
148
|
* The Table type is the data structure representing the data in a single table.
|
|
210
149
|
*
|
|
211
|
-
* ```ts override
|
|
212
|
-
* {[rowId: Id]: Row}
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
150
|
* A Table is used when setting a table with the setTable method, and when
|
|
216
151
|
* getting it back out again with the getTable method. A Table object is a
|
|
217
152
|
* regular JavaScript object containing individual Row objects, keyed by their
|
|
@@ -226,19 +161,11 @@ export type Tables<
|
|
|
226
161
|
* ```
|
|
227
162
|
* @category Store
|
|
228
163
|
*/
|
|
229
|
-
export type Table
|
|
230
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
231
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
232
|
-
WhenSet extends boolean = false,
|
|
233
|
-
> = TableFromSchema<Schema, TableId, WhenSet>;
|
|
164
|
+
export type Table = {[rowId: Id]: Row};
|
|
234
165
|
|
|
235
166
|
/**
|
|
236
167
|
* The Row type is the data structure representing the data in a single row.
|
|
237
168
|
*
|
|
238
|
-
* ```ts override
|
|
239
|
-
* {[cellId: Id]: Cell}
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
169
|
* A Row is used when setting a row with the setRow method, and when getting it
|
|
243
170
|
* back out again with the getRow method. A Row object is a regular JavaScript
|
|
244
171
|
* object containing individual Cell objects, keyed by their Id.
|
|
@@ -249,19 +176,11 @@ export type Table<
|
|
|
249
176
|
* ```
|
|
250
177
|
* @category Store
|
|
251
178
|
*/
|
|
252
|
-
export type Row
|
|
253
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
254
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
255
|
-
WhenSet extends boolean = false,
|
|
256
|
-
> = RowFromSchema<Schema, TableId, WhenSet>;
|
|
179
|
+
export type Row = {[cellId: Id]: Cell};
|
|
257
180
|
|
|
258
181
|
/**
|
|
259
182
|
* The Cell type is the data structure representing the data in a single cell.
|
|
260
183
|
*
|
|
261
|
-
* ```ts override
|
|
262
|
-
* string | number | boolean
|
|
263
|
-
* ```
|
|
264
|
-
*
|
|
265
184
|
* A Cell is used when setting a cell with the setCell method, and when getting
|
|
266
185
|
* it back out again with the getCell method. A Cell is a JavaScript string,
|
|
267
186
|
* number, or boolean.
|
|
@@ -272,14 +191,7 @@ export type Row<
|
|
|
272
191
|
* ```
|
|
273
192
|
* @category Store
|
|
274
193
|
*/
|
|
275
|
-
export type Cell
|
|
276
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
277
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
278
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
279
|
-
Schema,
|
|
280
|
-
TableId
|
|
281
|
-
>,
|
|
282
|
-
> = CellFromSchema<Schema, TableId, CellId>;
|
|
194
|
+
export type Cell = string | number | boolean;
|
|
283
195
|
|
|
284
196
|
/**
|
|
285
197
|
* The CellOrUndefined type is a data structure representing the data in a
|
|
@@ -291,24 +203,12 @@ export type Cell<
|
|
|
291
203
|
*
|
|
292
204
|
* @category Store
|
|
293
205
|
*/
|
|
294
|
-
export type CellOrUndefined
|
|
295
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
296
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
297
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
298
|
-
Schema,
|
|
299
|
-
TableId
|
|
300
|
-
>,
|
|
301
|
-
Cell = CellFromSchema<Schema, TableId, CellId>,
|
|
302
|
-
> = Cell | undefined;
|
|
206
|
+
export type CellOrUndefined = Cell | undefined;
|
|
303
207
|
|
|
304
208
|
/**
|
|
305
209
|
* The Values type is the data structure representing all the keyed values in a
|
|
306
210
|
* Store.
|
|
307
211
|
*
|
|
308
|
-
* ```ts override
|
|
309
|
-
* {[valueId: Id]: Value}
|
|
310
|
-
* ```
|
|
311
|
-
*
|
|
312
212
|
* A Values object is used when setting values with the setValues method, and
|
|
313
213
|
* when getting them back out again with the getValues method. A Values object
|
|
314
214
|
* is a regular JavaScript object containing individual Value objects, keyed by
|
|
@@ -321,19 +221,12 @@ export type CellOrUndefined<
|
|
|
321
221
|
* @category Store
|
|
322
222
|
* @since v3.0.0
|
|
323
223
|
*/
|
|
324
|
-
export type Values
|
|
325
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
326
|
-
WhenSet extends boolean = false,
|
|
327
|
-
> = ValuesFromSchema<Schema, WhenSet>;
|
|
224
|
+
export type Values = {[valueId: Id]: Value};
|
|
328
225
|
|
|
329
226
|
/**
|
|
330
227
|
* The Value type is the data structure representing the data in a single keyed
|
|
331
228
|
* value.
|
|
332
229
|
*
|
|
333
|
-
* ```ts override
|
|
334
|
-
* string | number | boolean
|
|
335
|
-
* ```
|
|
336
|
-
*
|
|
337
230
|
* A Value is used when setting a value with the setValue method, and when
|
|
338
231
|
* getting it back out again with the getValue method. A Value is a JavaScript
|
|
339
232
|
* string, number, or boolean.
|
|
@@ -345,10 +238,7 @@ export type Values<
|
|
|
345
238
|
* @category Store
|
|
346
239
|
* @since v3.0.0
|
|
347
240
|
*/
|
|
348
|
-
export type Value
|
|
349
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
350
|
-
ValueId extends ValueIdFromSchema<Schema> = ValueIdFromSchema<Schema>,
|
|
351
|
-
> = ValueFromSchema<Schema, ValueId>;
|
|
241
|
+
export type Value = string | number | boolean;
|
|
352
242
|
|
|
353
243
|
/**
|
|
354
244
|
* The ValueOrUndefined type is a data structure representing the data in a
|
|
@@ -361,11 +251,7 @@ export type Value<
|
|
|
361
251
|
* @category Store
|
|
362
252
|
* @since v3.0.0
|
|
363
253
|
*/
|
|
364
|
-
export type ValueOrUndefined
|
|
365
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
366
|
-
ValueId extends ValueIdFromSchema<Schema> = ValueIdFromSchema<Schema>,
|
|
367
|
-
Value = ValueFromSchema<Schema, ValueId>,
|
|
368
|
-
> = Value | undefined;
|
|
254
|
+
export type ValueOrUndefined = Value | undefined;
|
|
369
255
|
|
|
370
256
|
/**
|
|
371
257
|
* The TableCallback type describes a function that takes a Table's Id and a
|
|
@@ -380,12 +266,9 @@ export type ValueOrUndefined<
|
|
|
380
266
|
* in this Table.
|
|
381
267
|
* @category Callback
|
|
382
268
|
*/
|
|
383
|
-
export type TableCallback
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
> = (
|
|
387
|
-
tableId: TableId,
|
|
388
|
-
forEachRow: (rowCallback: RowCallback<Schema, TableId>) => void,
|
|
269
|
+
export type TableCallback = (
|
|
270
|
+
tableId: Id,
|
|
271
|
+
forEachRow: (rowCallback: RowCallback) => void,
|
|
389
272
|
) => void;
|
|
390
273
|
|
|
391
274
|
/**
|
|
@@ -401,12 +284,9 @@ export type TableCallback<
|
|
|
401
284
|
* in this Row.
|
|
402
285
|
* @category Callback
|
|
403
286
|
*/
|
|
404
|
-
export type RowCallback
|
|
405
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
406
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
407
|
-
> = (
|
|
287
|
+
export type RowCallback = (
|
|
408
288
|
rowId: Id,
|
|
409
|
-
forEachCell: (cellCallback: CellCallback
|
|
289
|
+
forEachCell: (cellCallback: CellCallback) => void,
|
|
410
290
|
) => void;
|
|
411
291
|
|
|
412
292
|
/**
|
|
@@ -421,14 +301,7 @@ export type RowCallback<
|
|
|
421
301
|
* @param cell The value of the Cell.
|
|
422
302
|
* @category Callback
|
|
423
303
|
*/
|
|
424
|
-
export type CellCallback
|
|
425
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
426
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
427
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
428
|
-
Schema,
|
|
429
|
-
TableId
|
|
430
|
-
>,
|
|
431
|
-
> = (cellId: CellId, cell: Cell<Schema, TableId, CellId>) => void;
|
|
304
|
+
export type CellCallback = (cellId: Id, cell: Cell) => void;
|
|
432
305
|
|
|
433
306
|
/**
|
|
434
307
|
* The ValueCallback type describes a function that takes a Value's Id and its
|
|
@@ -443,10 +316,7 @@ export type CellCallback<
|
|
|
443
316
|
* @category Callback
|
|
444
317
|
* @since v3.0.0
|
|
445
318
|
*/
|
|
446
|
-
export type ValueCallback
|
|
447
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
448
|
-
ValueId extends ValueIdFromSchema<Schema> = ValueIdFromSchema<Schema>,
|
|
449
|
-
> = (valueId: ValueId, value: Value<Schema, ValueId>) => void;
|
|
319
|
+
export type ValueCallback = (valueId: Id, value: Value) => void;
|
|
450
320
|
|
|
451
321
|
/**
|
|
452
322
|
* The MapCell type describes a function that takes an existing Cell value and
|
|
@@ -459,16 +329,7 @@ export type ValueCallback<
|
|
|
459
329
|
* @param cell The current value of the Cell to map to a new value.
|
|
460
330
|
* @category Callback
|
|
461
331
|
*/
|
|
462
|
-
export type MapCell
|
|
463
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
464
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
465
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
466
|
-
Schema,
|
|
467
|
-
TableId
|
|
468
|
-
>,
|
|
469
|
-
> = (
|
|
470
|
-
cell: CellOrUndefined<Schema, TableId, CellId>,
|
|
471
|
-
) => Cell<Schema, TableId, CellId>;
|
|
332
|
+
export type MapCell = (cell: CellOrUndefined) => Cell;
|
|
472
333
|
|
|
473
334
|
/**
|
|
474
335
|
* The MapValue type describes a function that takes an existing Value and
|
|
@@ -482,10 +343,7 @@ export type MapCell<
|
|
|
482
343
|
* @category Callback
|
|
483
344
|
* @since v3.0.0
|
|
484
345
|
*/
|
|
485
|
-
export type MapValue
|
|
486
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
487
|
-
ValueId extends ValueIdFromSchema<Schema> = ValueIdFromSchema<Schema>,
|
|
488
|
-
> = (value: ValueOrUndefined<Schema, ValueId>) => Value<Schema, ValueId>;
|
|
346
|
+
export type MapValue = (value: ValueOrUndefined) => Value;
|
|
489
347
|
|
|
490
348
|
/**
|
|
491
349
|
* The GetCell type describes a function that takes a Id and returns the Cell
|
|
@@ -498,14 +356,7 @@ export type MapValue<
|
|
|
498
356
|
* @param cellId The Id of the Cell to fetch the value for.
|
|
499
357
|
* @category Callback
|
|
500
358
|
*/
|
|
501
|
-
export type GetCell
|
|
502
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
503
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
504
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
505
|
-
Schema,
|
|
506
|
-
TableId
|
|
507
|
-
>,
|
|
508
|
-
> = (cellId: CellId) => CellOrUndefined<Schema, TableId, CellId>;
|
|
359
|
+
export type GetCell = (cellId: Id) => CellOrUndefined;
|
|
509
360
|
|
|
510
361
|
/**
|
|
511
362
|
* The DoRollback type describes a function that you can use to rollback the
|
|
@@ -526,14 +377,10 @@ export type GetCell<
|
|
|
526
377
|
* @param invalidValues Any invalid attempts to change Values, since v3.0.0.
|
|
527
378
|
* @category Callback
|
|
528
379
|
*/
|
|
529
|
-
export type DoRollback
|
|
530
|
-
|
|
531
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
532
|
-
ValuesSchema extends OptionalValuesSchema = Schemas[1],
|
|
533
|
-
> = (
|
|
534
|
-
changedCells: ChangedCells<TablesSchema>,
|
|
380
|
+
export type DoRollback = (
|
|
381
|
+
changedCells: ChangedCells,
|
|
535
382
|
invalidCells: InvalidCells,
|
|
536
|
-
changedValues: ChangedValues
|
|
383
|
+
changedValues: ChangedValues,
|
|
537
384
|
invalidValues: InvalidValues,
|
|
538
385
|
) => boolean;
|
|
539
386
|
|
|
@@ -563,8 +410,8 @@ export type DoRollback<
|
|
|
563
410
|
* since v3.0.0.
|
|
564
411
|
* @category Listener
|
|
565
412
|
*/
|
|
566
|
-
export type TransactionListener
|
|
567
|
-
store: Store
|
|
413
|
+
export type TransactionListener = (
|
|
414
|
+
store: Store,
|
|
568
415
|
cellsTouched: boolean,
|
|
569
416
|
valuesTouched: boolean,
|
|
570
417
|
) => void;
|
|
@@ -589,12 +436,9 @@ export type TransactionListener<Schemas extends OptionalSchemas = NoSchemas> = (
|
|
|
589
436
|
* changes.
|
|
590
437
|
* @category Listener
|
|
591
438
|
*/
|
|
592
|
-
export type TablesListener
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
> = (
|
|
596
|
-
store: Store<Schemas>,
|
|
597
|
-
getCellChange: GetCellChange<TablesSchema> | undefined,
|
|
439
|
+
export type TablesListener = (
|
|
440
|
+
store: Store,
|
|
441
|
+
getCellChange: GetCellChange | undefined,
|
|
598
442
|
) => void;
|
|
599
443
|
|
|
600
444
|
/**
|
|
@@ -609,9 +453,7 @@ export type TablesListener<
|
|
|
609
453
|
* @param store A reference to the Store that changed.
|
|
610
454
|
* @category Listener
|
|
611
455
|
*/
|
|
612
|
-
export type TableIdsListener
|
|
613
|
-
store: Store<Schemas>,
|
|
614
|
-
) => void;
|
|
456
|
+
export type TableIdsListener = (store: Store) => void;
|
|
615
457
|
|
|
616
458
|
/**
|
|
617
459
|
* The TableListener type describes a function that is used to listen to changes
|
|
@@ -634,19 +476,10 @@ export type TableIdsListener<Schemas extends OptionalSchemas = NoSchemas> = (
|
|
|
634
476
|
* changes.
|
|
635
477
|
* @category Listener
|
|
636
478
|
*/
|
|
637
|
-
export type TableListener
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
> | null = TableIdFromSchema<Schemas[0]> | null,
|
|
642
|
-
TableId = TableIdOrNull extends null
|
|
643
|
-
? TableIdFromSchema<Schemas[0]>
|
|
644
|
-
: TableIdOrNull,
|
|
645
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
646
|
-
> = (
|
|
647
|
-
store: Store<Schemas>,
|
|
648
|
-
tableId: TableId,
|
|
649
|
-
getCellChange: GetCellChange<TablesSchema> | undefined,
|
|
479
|
+
export type TableListener = (
|
|
480
|
+
store: Store,
|
|
481
|
+
tableId: Id,
|
|
482
|
+
getCellChange: GetCellChange | undefined,
|
|
650
483
|
) => void;
|
|
651
484
|
|
|
652
485
|
/**
|
|
@@ -663,15 +496,7 @@ export type TableListener<
|
|
|
663
496
|
* @param tableId The Id of the Table that changed.
|
|
664
497
|
* @category Listener
|
|
665
498
|
*/
|
|
666
|
-
export type RowIdsListener
|
|
667
|
-
Schemas extends OptionalSchemas = NoSchemas,
|
|
668
|
-
TableIdOrNull extends TableIdFromSchema<
|
|
669
|
-
Schemas[0]
|
|
670
|
-
> | null = TableIdFromSchema<Schemas[0]> | null,
|
|
671
|
-
TableId = TableIdOrNull extends null
|
|
672
|
-
? TableIdFromSchema<Schemas[0]>
|
|
673
|
-
: TableIdOrNull,
|
|
674
|
-
> = (store: Store<Schemas>, tableId: TableId) => void;
|
|
499
|
+
export type RowIdsListener = (store: Store, tableId: Id) => void;
|
|
675
500
|
|
|
676
501
|
/**
|
|
677
502
|
* The SortedRowIdsListener type describes a function that is used to listen to
|
|
@@ -697,22 +522,13 @@ export type RowIdsListener<
|
|
|
697
522
|
* @category Listener
|
|
698
523
|
* @since v2.0.0
|
|
699
524
|
*/
|
|
700
|
-
export type SortedRowIdsListener
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
Offset extends number = number,
|
|
708
|
-
Limit extends number | undefined = number | undefined,
|
|
709
|
-
> = (
|
|
710
|
-
store: Store<Schemas>,
|
|
711
|
-
tableId: TableId,
|
|
712
|
-
cellId: CellId,
|
|
713
|
-
descending: Descending,
|
|
714
|
-
offset: Offset,
|
|
715
|
-
limit: Limit,
|
|
525
|
+
export type SortedRowIdsListener = (
|
|
526
|
+
store: Store,
|
|
527
|
+
tableId: Id,
|
|
528
|
+
cellId: Id | undefined,
|
|
529
|
+
descending: boolean,
|
|
530
|
+
offset: number,
|
|
531
|
+
limit: number | undefined,
|
|
716
532
|
sortedRowIds: Ids,
|
|
717
533
|
) => void;
|
|
718
534
|
|
|
@@ -739,22 +555,11 @@ export type SortedRowIdsListener<
|
|
|
739
555
|
* changes.
|
|
740
556
|
* @category Listener
|
|
741
557
|
*/
|
|
742
|
-
export type RowListener
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
RowIdOrNull extends IdOrNull = IdOrNull,
|
|
748
|
-
TableId = TableIdOrNull extends null
|
|
749
|
-
? TableIdFromSchema<Schemas[0]>
|
|
750
|
-
: TableIdOrNull,
|
|
751
|
-
RowId = RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
752
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
753
|
-
> = (
|
|
754
|
-
store: Store<Schemas>,
|
|
755
|
-
tableId: TableId,
|
|
756
|
-
rowId: RowId,
|
|
757
|
-
getCellChange: GetCellChange<TablesSchema> | undefined,
|
|
558
|
+
export type RowListener = (
|
|
559
|
+
store: Store,
|
|
560
|
+
tableId: Id,
|
|
561
|
+
rowId: Id,
|
|
562
|
+
getCellChange: GetCellChange | undefined,
|
|
758
563
|
) => void;
|
|
759
564
|
|
|
760
565
|
/**
|
|
@@ -772,17 +577,7 @@ export type RowListener<
|
|
|
772
577
|
* @param rowId The Id of the Row that changed.
|
|
773
578
|
* @category Listener
|
|
774
579
|
*/
|
|
775
|
-
export type CellIdsListener
|
|
776
|
-
Schemas extends OptionalSchemas = NoSchemas,
|
|
777
|
-
TableIdOrNull extends TableIdFromSchema<
|
|
778
|
-
Schemas[0]
|
|
779
|
-
> | null = TableIdFromSchema<Schemas[0]> | null,
|
|
780
|
-
RowIdOrNull extends IdOrNull = null,
|
|
781
|
-
TableId = TableIdOrNull extends null
|
|
782
|
-
? TableIdFromSchema<Schemas[0]>
|
|
783
|
-
: TableIdOrNull,
|
|
784
|
-
RowId = RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
785
|
-
> = (store: Store<Schemas>, tableId: TableId, rowId: RowId) => void;
|
|
580
|
+
export type CellIdsListener = (store: Store, tableId: Id, rowId: Id) => void;
|
|
786
581
|
|
|
787
582
|
/**
|
|
788
583
|
* The CellListener type describes a function that is used to listen to changes
|
|
@@ -812,40 +607,14 @@ export type CellIdsListener<
|
|
|
812
607
|
* changes.
|
|
813
608
|
* @category Listener
|
|
814
609
|
*/
|
|
815
|
-
export type CellListener
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
RowIdOrNull extends IdOrNull = IdOrNull,
|
|
821
|
-
CellIdOrNull extends
|
|
822
|
-
| (TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
823
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
824
|
-
: AllCellIdFromSchema<Schemas[0]>)
|
|
825
|
-
| null =
|
|
826
|
-
| (TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
827
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
828
|
-
: AllCellIdFromSchema<Schemas[0]>)
|
|
829
|
-
| null,
|
|
830
|
-
TableId extends Id = TableIdOrNull extends null
|
|
831
|
-
? TableIdFromSchema<Schemas[0]>
|
|
832
|
-
: TableIdOrNull,
|
|
833
|
-
RowId = RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
834
|
-
CellId extends Id = CellIdOrNull extends null
|
|
835
|
-
? TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
836
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
837
|
-
: AllCellIdFromSchema<Schemas[0]>
|
|
838
|
-
: CellIdOrNull,
|
|
839
|
-
Cell = CellFromSchema<Schemas[0], TableId, CellId>,
|
|
840
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
841
|
-
> = (
|
|
842
|
-
store: Store<Schemas>,
|
|
843
|
-
tableId: TableId,
|
|
844
|
-
rowId: RowId,
|
|
845
|
-
cellId: CellId,
|
|
610
|
+
export type CellListener = (
|
|
611
|
+
store: Store,
|
|
612
|
+
tableId: Id,
|
|
613
|
+
rowId: Id,
|
|
614
|
+
cellId: Id,
|
|
846
615
|
newCell: Cell,
|
|
847
616
|
oldCell: Cell,
|
|
848
|
-
getCellChange: GetCellChange
|
|
617
|
+
getCellChange: GetCellChange | undefined,
|
|
849
618
|
) => void;
|
|
850
619
|
|
|
851
620
|
/**
|
|
@@ -868,12 +637,9 @@ export type CellListener<
|
|
|
868
637
|
* changes.
|
|
869
638
|
* @category Listener
|
|
870
639
|
*/
|
|
871
|
-
export type ValuesListener
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
> = (
|
|
875
|
-
store: Store<Schemas>,
|
|
876
|
-
getValueChange: GetValueChange<ValuesSchema> | undefined,
|
|
640
|
+
export type ValuesListener = (
|
|
641
|
+
store: Store,
|
|
642
|
+
getValueChange: GetValueChange | undefined,
|
|
877
643
|
) => void;
|
|
878
644
|
|
|
879
645
|
/**
|
|
@@ -888,9 +654,7 @@ export type ValuesListener<
|
|
|
888
654
|
* @param store A reference to the Store that changed.
|
|
889
655
|
* @category Listener
|
|
890
656
|
*/
|
|
891
|
-
export type ValueIdsListener
|
|
892
|
-
store: Store<Schemas>,
|
|
893
|
-
) => void;
|
|
657
|
+
export type ValueIdsListener = (store: Store) => void;
|
|
894
658
|
|
|
895
659
|
/**
|
|
896
660
|
* The ValueListener type describes a function that is used to listen to changes
|
|
@@ -918,22 +682,12 @@ export type ValueIdsListener<Schemas extends OptionalSchemas = NoSchemas> = (
|
|
|
918
682
|
* @category Listener
|
|
919
683
|
* @since v3.0.0
|
|
920
684
|
*/
|
|
921
|
-
export type ValueListener
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
Schemas[1]
|
|
925
|
-
> | null = ValueIdFromSchema<Schemas[1]> | null,
|
|
926
|
-
ValueId extends Id = ValueIdOrNull extends null
|
|
927
|
-
? ValueIdFromSchema<Schemas[1]>
|
|
928
|
-
: ValueIdOrNull,
|
|
929
|
-
Value = ValueFromSchema<Schemas[1], ValueId>,
|
|
930
|
-
ValuesSchema extends OptionalValuesSchema = Schemas[1],
|
|
931
|
-
> = (
|
|
932
|
-
store: Store<Schemas>,
|
|
933
|
-
valueId: ValueId,
|
|
685
|
+
export type ValueListener = (
|
|
686
|
+
store: Store,
|
|
687
|
+
valueId: Id,
|
|
934
688
|
newValue: Value,
|
|
935
689
|
oldValue: Value,
|
|
936
|
-
getValueChange: GetValueChange
|
|
690
|
+
getValueChange: GetValueChange | undefined,
|
|
937
691
|
) => void;
|
|
938
692
|
|
|
939
693
|
/**
|
|
@@ -958,8 +712,8 @@ export type ValueListener<
|
|
|
958
712
|
* @category Listener
|
|
959
713
|
* @since v1.1.0
|
|
960
714
|
*/
|
|
961
|
-
export type InvalidCellListener
|
|
962
|
-
store: Store
|
|
715
|
+
export type InvalidCellListener = (
|
|
716
|
+
store: Store,
|
|
963
717
|
tableId: Id,
|
|
964
718
|
rowId: Id,
|
|
965
719
|
cellId: Id,
|
|
@@ -986,8 +740,11 @@ export type InvalidCellListener<Schemas extends OptionalSchemas = NoSchemas> = (
|
|
|
986
740
|
* @category Listener
|
|
987
741
|
* @since v3.0.0
|
|
988
742
|
*/
|
|
989
|
-
export type InvalidValueListener
|
|
990
|
-
|
|
743
|
+
export type InvalidValueListener = (
|
|
744
|
+
store: Store,
|
|
745
|
+
valueId: Id,
|
|
746
|
+
invalidValues: any[],
|
|
747
|
+
) => void;
|
|
991
748
|
|
|
992
749
|
/**
|
|
993
750
|
* The GetCellChange type describes a function that returns information about
|
|
@@ -1004,16 +761,7 @@ export type InvalidValueListener<Schemas extends OptionalSchemas = NoSchemas> =
|
|
|
1004
761
|
* @returns A CellChange array containing information about the Cell's changes.
|
|
1005
762
|
* @category Listener
|
|
1006
763
|
*/
|
|
1007
|
-
export type GetCellChange
|
|
1008
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
1009
|
-
> = <
|
|
1010
|
-
TableId extends TableIdFromSchema<Schema>,
|
|
1011
|
-
CellId extends CellIdFromSchema<Schema, TableId>,
|
|
1012
|
-
>(
|
|
1013
|
-
tableId: TableId,
|
|
1014
|
-
rowId: Id,
|
|
1015
|
-
cellId: CellId,
|
|
1016
|
-
) => CellChange<Schema, TableId, CellId>;
|
|
764
|
+
export type GetCellChange = (tableId: Id, rowId: Id, cellId: Id) => CellChange;
|
|
1017
765
|
|
|
1018
766
|
/**
|
|
1019
767
|
* The CellChange type describes a Cell's changes during a transaction.
|
|
@@ -1025,15 +773,11 @@ export type GetCellChange<
|
|
|
1025
773
|
*
|
|
1026
774
|
* @category Listener
|
|
1027
775
|
*/
|
|
1028
|
-
export type CellChange
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
TableId
|
|
1034
|
-
>,
|
|
1035
|
-
CellOrUndefined = Cell<Schema, TableId, CellId> | undefined,
|
|
1036
|
-
> = [changed: boolean, oldCell: CellOrUndefined, newCell: CellOrUndefined];
|
|
776
|
+
export type CellChange = [
|
|
777
|
+
changed: boolean,
|
|
778
|
+
oldCell: CellOrUndefined,
|
|
779
|
+
newCell: CellOrUndefined,
|
|
780
|
+
];
|
|
1037
781
|
|
|
1038
782
|
/**
|
|
1039
783
|
* The GetValueChange type describes a function that returns information about
|
|
@@ -1049,11 +793,7 @@ export type CellChange<
|
|
|
1049
793
|
* changes.
|
|
1050
794
|
* @category Listener
|
|
1051
795
|
*/
|
|
1052
|
-
export type GetValueChange
|
|
1053
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
1054
|
-
> = <ValueId extends ValueIdFromSchema<Schema>>(
|
|
1055
|
-
valueId: ValueId,
|
|
1056
|
-
) => ValueChange<Schema, ValueId>;
|
|
796
|
+
export type GetValueChange = (valueId: Id) => ValueChange;
|
|
1057
797
|
|
|
1058
798
|
/**
|
|
1059
799
|
* The ValueChange type describes a Value's changes during a transaction.
|
|
@@ -1065,27 +805,17 @@ export type GetValueChange<
|
|
|
1065
805
|
*
|
|
1066
806
|
* @category Listener
|
|
1067
807
|
*/
|
|
1068
|
-
export type ValueChange
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
ValueOrUndefined
|
|
1072
|
-
|
|
808
|
+
export type ValueChange = [
|
|
809
|
+
changed: boolean,
|
|
810
|
+
oldValue: ValueOrUndefined,
|
|
811
|
+
newValue: ValueOrUndefined,
|
|
812
|
+
];
|
|
1073
813
|
|
|
1074
814
|
/**
|
|
1075
815
|
* The ChangedCells type describes the Cell values that have been changed during
|
|
1076
816
|
* a transaction, primarily used so that you can indicate whether the
|
|
1077
817
|
* transaction should be rolled back.
|
|
1078
818
|
*
|
|
1079
|
-
* ```ts override
|
|
1080
|
-
* {
|
|
1081
|
-
* [tableId: Id]: {
|
|
1082
|
-
* [rowId: Id]: {
|
|
1083
|
-
* [cellId: Id]: [CellOrUndefined, CellOrUndefined],
|
|
1084
|
-
* },
|
|
1085
|
-
* },
|
|
1086
|
-
* }
|
|
1087
|
-
* ```
|
|
1088
|
-
*
|
|
1089
819
|
* A ChangedCells object is provided to the `doRollback` callback when using the
|
|
1090
820
|
* transaction method and the finishTransaction method. See those methods for
|
|
1091
821
|
* specific examples.
|
|
@@ -1106,17 +836,13 @@ export type ValueChange<
|
|
|
1106
836
|
* @category Transaction
|
|
1107
837
|
* @since v1.2.0
|
|
1108
838
|
*/
|
|
1109
|
-
export type ChangedCells
|
|
1110
|
-
{
|
|
1111
|
-
[
|
|
1112
|
-
[
|
|
1113
|
-
[CellId in CellIdFromSchema<Schema, TableId>]?: [
|
|
1114
|
-
CellOrUndefined<Schema, TableId, CellId>,
|
|
1115
|
-
CellOrUndefined<Schema, TableId, CellId>,
|
|
1116
|
-
];
|
|
1117
|
-
};
|
|
839
|
+
export type ChangedCells = {
|
|
840
|
+
[tableId: Id]: {
|
|
841
|
+
[rowId: Id]: {
|
|
842
|
+
[cellId: Id]: [CellOrUndefined, CellOrUndefined];
|
|
1118
843
|
};
|
|
1119
844
|
};
|
|
845
|
+
};
|
|
1120
846
|
|
|
1121
847
|
/**
|
|
1122
848
|
* The InvalidCells type describes the invalid Cell values that have been
|
|
@@ -1148,10 +874,6 @@ export type InvalidCells = {
|
|
|
1148
874
|
* transaction, primarily used so that you can indicate whether the transaction
|
|
1149
875
|
* should be rolled back.
|
|
1150
876
|
*
|
|
1151
|
-
* ```ts override
|
|
1152
|
-
* {[valueId: Id]: [ValueOrUndefined, ValueOrUndefined]}
|
|
1153
|
-
* ```
|
|
1154
|
-
*
|
|
1155
877
|
* A ChangedValues object is provided to the `doRollback` callback when using
|
|
1156
878
|
* the transaction method and the finishTransaction method. See those methods
|
|
1157
879
|
* for specific examples.
|
|
@@ -1171,14 +893,10 @@ export type InvalidCells = {
|
|
|
1171
893
|
* @category Transaction
|
|
1172
894
|
* @since v3.0.0
|
|
1173
895
|
*/
|
|
1174
|
-
export type ChangedValues
|
|
1175
|
-
|
|
1176
|
-
> = {
|
|
1177
|
-
[ValueId in ValueIdFromSchema<Schema>]?: [
|
|
1178
|
-
ValueOrUndefined<Schema, ValueId>,
|
|
1179
|
-
ValueOrUndefined<Schema, ValueId>,
|
|
1180
|
-
];
|
|
896
|
+
export type ChangedValues = {
|
|
897
|
+
[valueId: Id]: [ValueOrUndefined, ValueOrUndefined];
|
|
1181
898
|
};
|
|
899
|
+
|
|
1182
900
|
/**
|
|
1183
901
|
* The InvalidValues type describes the invalid Values that have been attempted
|
|
1184
902
|
* during a transaction, primarily used so that you can indicate whether the
|
|
@@ -1406,13 +1124,6 @@ export type StoreListenerStats = {
|
|
|
1406
1124
|
* getSchemaJson method, and remove the schemas altogether with the
|
|
1407
1125
|
* delValuesSchema method and delTablesSchema method.
|
|
1408
1126
|
*
|
|
1409
|
-
* Throughout this API documentation, you will see the generic type parameter
|
|
1410
|
-
* `Schemas`, which refers to a pair of TablesSchema and ValuesSchema
|
|
1411
|
-
* respectively. These can be used on the Store interface to constrain its
|
|
1412
|
-
* methods, for example. This type parameter is defaulted if not provided, and
|
|
1413
|
-
* so if you are using a Store without schemas, you can ignore it and use the
|
|
1414
|
-
* Store type bare.
|
|
1415
|
-
*
|
|
1416
1127
|
* Read more about schemas in the Using Schemas guide.
|
|
1417
1128
|
*
|
|
1418
1129
|
* # Convenience methods
|
|
@@ -1459,7 +1170,7 @@ export type StoreListenerStats = {
|
|
|
1459
1170
|
* @see Todo App demos
|
|
1460
1171
|
* @category Store
|
|
1461
1172
|
*/
|
|
1462
|
-
export interface Store
|
|
1173
|
+
export interface Store {
|
|
1463
1174
|
/**
|
|
1464
1175
|
* The getTables method returns a Tables object containing the entire data of
|
|
1465
1176
|
* the Store.
|
|
@@ -1489,13 +1200,9 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1489
1200
|
* console.log(store.getTables());
|
|
1490
1201
|
* // -> {}
|
|
1491
1202
|
* ```
|
|
1492
|
-
* @see
|
|
1493
|
-
* # Guides
|
|
1494
|
-
* Creating a Store
|
|
1495
|
-
* @see Indexes
|
|
1496
1203
|
* @category Getter
|
|
1497
1204
|
*/
|
|
1498
|
-
getTables
|
|
1205
|
+
getTables(): Tables;
|
|
1499
1206
|
|
|
1500
1207
|
/**
|
|
1501
1208
|
* The getTableIds method returns the Ids of every Table in the Store.
|
|
@@ -1526,7 +1233,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1526
1233
|
* ```
|
|
1527
1234
|
* @category Getter
|
|
1528
1235
|
*/
|
|
1529
|
-
getTableIds
|
|
1236
|
+
getTableIds(): Ids;
|
|
1530
1237
|
|
|
1531
1238
|
/**
|
|
1532
1239
|
* The getTable method returns an object containing the entire data of a
|
|
@@ -1560,12 +1267,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1560
1267
|
* ```
|
|
1561
1268
|
* @category Getter
|
|
1562
1269
|
*/
|
|
1563
|
-
getTable
|
|
1564
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
1565
|
-
Table = TableFromSchema<Schemas[0]>,
|
|
1566
|
-
>(
|
|
1567
|
-
tableId: TableId,
|
|
1568
|
-
): Table;
|
|
1270
|
+
getTable(tableId: Id): Table;
|
|
1569
1271
|
|
|
1570
1272
|
/**
|
|
1571
1273
|
* The getRowIds method returns the Ids of every Row in a given Table.
|
|
@@ -1599,9 +1301,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1599
1301
|
* ```
|
|
1600
1302
|
* @category Getter
|
|
1601
1303
|
*/
|
|
1602
|
-
getRowIds
|
|
1603
|
-
tableId: TableId,
|
|
1604
|
-
): Ids;
|
|
1304
|
+
getRowIds(tableId: Id): Ids;
|
|
1605
1305
|
|
|
1606
1306
|
/**
|
|
1607
1307
|
* The getSortedRowIds method returns the Ids of every Row in a given Table,
|
|
@@ -1702,12 +1402,9 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1702
1402
|
* @category Getter
|
|
1703
1403
|
* @since v2.0.0
|
|
1704
1404
|
*/
|
|
1705
|
-
getSortedRowIds
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
>(
|
|
1709
|
-
tableId: TableId,
|
|
1710
|
-
cellId?: CellId,
|
|
1405
|
+
getSortedRowIds(
|
|
1406
|
+
tableId: Id,
|
|
1407
|
+
cellId?: Id,
|
|
1711
1408
|
descending?: boolean,
|
|
1712
1409
|
offset?: number,
|
|
1713
1410
|
limit?: number,
|
|
@@ -1748,13 +1445,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1748
1445
|
* ```
|
|
1749
1446
|
* @category Getter
|
|
1750
1447
|
*/
|
|
1751
|
-
getRow
|
|
1752
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
1753
|
-
Row = RowFromSchema<Schemas[0], TableId>,
|
|
1754
|
-
>(
|
|
1755
|
-
tableId: TableId,
|
|
1756
|
-
rowId: Id,
|
|
1757
|
-
): Row;
|
|
1448
|
+
getRow(tableId: Id, rowId: Id): Row;
|
|
1758
1449
|
|
|
1759
1450
|
/**
|
|
1760
1451
|
* The getCellIds method returns the Ids of every Cell in a given Row, in a
|
|
@@ -1789,13 +1480,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1789
1480
|
* ```
|
|
1790
1481
|
* @category Getter
|
|
1791
1482
|
*/
|
|
1792
|
-
getCellIds
|
|
1793
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
1794
|
-
Ids extends CellIdFromSchema<Schemas[0], TableId>[],
|
|
1795
|
-
>(
|
|
1796
|
-
tableId: TableId,
|
|
1797
|
-
rowId: Id,
|
|
1798
|
-
): Ids;
|
|
1483
|
+
getCellIds(tableId: Id, rowId: Id): Ids;
|
|
1799
1484
|
|
|
1800
1485
|
/**
|
|
1801
1486
|
* The getCell method returns the value of a single Cell in a given Row, in a
|
|
@@ -1825,15 +1510,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1825
1510
|
* ```
|
|
1826
1511
|
* @category Getter
|
|
1827
1512
|
*/
|
|
1828
|
-
getCell
|
|
1829
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
1830
|
-
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
1831
|
-
CellOrUndefined = CellFromSchema<Schemas[0], TableId, CellId> | undefined,
|
|
1832
|
-
>(
|
|
1833
|
-
tableId: TableId,
|
|
1834
|
-
rowId: Id,
|
|
1835
|
-
cellId: CellId,
|
|
1836
|
-
): CellOrUndefined;
|
|
1513
|
+
getCell(tableId: Id, rowId: Id, cellId: Id): CellOrUndefined;
|
|
1837
1514
|
|
|
1838
1515
|
/**
|
|
1839
1516
|
* The getValues method returns an object containing the entire set of keyed
|
|
@@ -1864,7 +1541,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1864
1541
|
* @category Getter
|
|
1865
1542
|
* @since v3.0.0
|
|
1866
1543
|
*/
|
|
1867
|
-
getValues
|
|
1544
|
+
getValues(): Values;
|
|
1868
1545
|
|
|
1869
1546
|
/**
|
|
1870
1547
|
* The getValueIds method returns the Ids of every Value in a Store.
|
|
@@ -1893,7 +1570,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1893
1570
|
* @category Getter
|
|
1894
1571
|
* @since v3.0.0
|
|
1895
1572
|
*/
|
|
1896
|
-
getValueIds
|
|
1573
|
+
getValueIds(): Ids;
|
|
1897
1574
|
|
|
1898
1575
|
/**
|
|
1899
1576
|
* The getValue method returns a single keyed Value in the Store.
|
|
@@ -1919,12 +1596,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1919
1596
|
* @category Getter
|
|
1920
1597
|
* @since v3.0.0
|
|
1921
1598
|
*/
|
|
1922
|
-
getValue
|
|
1923
|
-
ValueId extends ValueIdFromSchema<Schemas[1]>,
|
|
1924
|
-
ValueOrUndefined = ValueFromSchema<Schemas[1], ValueId> | undefined,
|
|
1925
|
-
>(
|
|
1926
|
-
valueId: ValueId,
|
|
1927
|
-
): ValueOrUndefined;
|
|
1599
|
+
getValue(valueId: Id): ValueOrUndefined;
|
|
1928
1600
|
|
|
1929
1601
|
/**
|
|
1930
1602
|
* The hasTables method returns a boolean indicating whether any Table objects
|
|
@@ -1964,9 +1636,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1964
1636
|
* ```
|
|
1965
1637
|
* @category Getter
|
|
1966
1638
|
*/
|
|
1967
|
-
hasTable
|
|
1968
|
-
tableId: TableId,
|
|
1969
|
-
): boolean;
|
|
1639
|
+
hasTable(tableId: Id): boolean;
|
|
1970
1640
|
|
|
1971
1641
|
/**
|
|
1972
1642
|
* The hasRow method returns a boolean indicating whether a given Row exists
|
|
@@ -1987,10 +1657,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1987
1657
|
* ```
|
|
1988
1658
|
* @category Getter
|
|
1989
1659
|
*/
|
|
1990
|
-
hasRow
|
|
1991
|
-
tableId: TableId,
|
|
1992
|
-
rowId: Id,
|
|
1993
|
-
): boolean;
|
|
1660
|
+
hasRow(tableId: Id, rowId: Id): boolean;
|
|
1994
1661
|
|
|
1995
1662
|
/**
|
|
1996
1663
|
* The hasCell method returns a boolean indicating whether a given Cell exists
|
|
@@ -2012,14 +1679,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2012
1679
|
* ```
|
|
2013
1680
|
* @category Getter
|
|
2014
1681
|
*/
|
|
2015
|
-
hasCell
|
|
2016
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2017
|
-
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
2018
|
-
>(
|
|
2019
|
-
tableId: TableId,
|
|
2020
|
-
rowId: Id,
|
|
2021
|
-
cellId: CellId,
|
|
2022
|
-
): boolean;
|
|
1682
|
+
hasCell(tableId: Id, rowId: Id, cellId: Id): boolean;
|
|
2023
1683
|
|
|
2024
1684
|
/**
|
|
2025
1685
|
* The hasTables method returns a boolean indicating whether any Values exist
|
|
@@ -2061,9 +1721,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2061
1721
|
* @category Getter
|
|
2062
1722
|
* @since v3.0.0
|
|
2063
1723
|
*/
|
|
2064
|
-
hasValue
|
|
2065
|
-
valueId: ValueId,
|
|
2066
|
-
): boolean;
|
|
1724
|
+
hasValue(valueId: Id): boolean;
|
|
2067
1725
|
|
|
2068
1726
|
/**
|
|
2069
1727
|
* The getTablesJson method returns a string serialization of all of the
|
|
@@ -2302,9 +1960,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2302
1960
|
* ```
|
|
2303
1961
|
* @category Setter
|
|
2304
1962
|
*/
|
|
2305
|
-
setTables
|
|
2306
|
-
tables: Tables,
|
|
2307
|
-
): Store<Schemas>;
|
|
1963
|
+
setTables(tables: Tables): Store;
|
|
2308
1964
|
|
|
2309
1965
|
/**
|
|
2310
1966
|
* The setTable method takes an object and sets the entire data of a single
|
|
@@ -2355,13 +2011,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2355
2011
|
* ```
|
|
2356
2012
|
* @category Setter
|
|
2357
2013
|
*/
|
|
2358
|
-
setTable
|
|
2359
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2360
|
-
Table = TableFromSchema<Schemas[0], TableId, true>,
|
|
2361
|
-
>(
|
|
2362
|
-
tableId: TableId,
|
|
2363
|
-
table: Table,
|
|
2364
|
-
): Store<Schemas>;
|
|
2014
|
+
setTable(tableId: Id, table: Table): Store;
|
|
2365
2015
|
|
|
2366
2016
|
/**
|
|
2367
2017
|
* The setRow method takes an object and sets the entire data of a single Row
|
|
@@ -2411,14 +2061,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2411
2061
|
* ```
|
|
2412
2062
|
* @category Setter
|
|
2413
2063
|
*/
|
|
2414
|
-
setRow
|
|
2415
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2416
|
-
Row = RowFromSchema<Schemas[0], TableId, true>,
|
|
2417
|
-
>(
|
|
2418
|
-
tableId: TableId,
|
|
2419
|
-
rowId: Id,
|
|
2420
|
-
row: Row,
|
|
2421
|
-
): Store<Schemas>;
|
|
2064
|
+
setRow(tableId: Id, rowId: Id, row: Row): Store;
|
|
2422
2065
|
|
|
2423
2066
|
/**
|
|
2424
2067
|
* The addRow method takes an object and creates a new Row in the Store,
|
|
@@ -2471,13 +2114,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2471
2114
|
* ```
|
|
2472
2115
|
* @category Setter
|
|
2473
2116
|
*/
|
|
2474
|
-
addRow
|
|
2475
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2476
|
-
Row = RowFromSchema<Schemas[0], TableId, true>,
|
|
2477
|
-
>(
|
|
2478
|
-
tableId: TableId,
|
|
2479
|
-
row: Row,
|
|
2480
|
-
): Id | undefined;
|
|
2117
|
+
addRow(tableId: Id, row: Row): Id | undefined;
|
|
2481
2118
|
|
|
2482
2119
|
/**
|
|
2483
2120
|
* The setPartialRow method takes an object and sets partial data of a single
|
|
@@ -2529,14 +2166,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2529
2166
|
* ```
|
|
2530
2167
|
* @category Setter
|
|
2531
2168
|
*/
|
|
2532
|
-
setPartialRow
|
|
2533
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2534
|
-
Row = RowFromSchema<Schemas[0], TableId, true>,
|
|
2535
|
-
>(
|
|
2536
|
-
tableId: TableId,
|
|
2537
|
-
rowId: Id,
|
|
2538
|
-
partialRow: Row,
|
|
2539
|
-
): Store<Schemas>;
|
|
2169
|
+
setPartialRow(tableId: Id, rowId: Id, partialRow: Row): Store;
|
|
2540
2170
|
|
|
2541
2171
|
/**
|
|
2542
2172
|
* The setCell method sets the value of a single Cell in the Store.
|
|
@@ -2594,17 +2224,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2594
2224
|
* ```
|
|
2595
2225
|
* @category Setter
|
|
2596
2226
|
*/
|
|
2597
|
-
setCell
|
|
2598
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
2599
|
-
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
2600
|
-
Cell = CellFromSchema<Schemas[0], TableId, CellId>,
|
|
2601
|
-
MapCell = (cell: Cell | undefined) => Cell,
|
|
2602
|
-
>(
|
|
2603
|
-
tableId: TableId,
|
|
2604
|
-
rowId: Id,
|
|
2605
|
-
cellId: CellId,
|
|
2606
|
-
cell: Cell | MapCell,
|
|
2607
|
-
): Store<Schemas>;
|
|
2227
|
+
setCell(tableId: Id, rowId: Id, cellId: Id, cell: Cell | MapCell): Store;
|
|
2608
2228
|
|
|
2609
2229
|
/**
|
|
2610
2230
|
* The setValues method takes an object and sets all the Values in the Store.
|
|
@@ -2652,9 +2272,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2652
2272
|
* @category Setter
|
|
2653
2273
|
* @since v3.0.0
|
|
2654
2274
|
*/
|
|
2655
|
-
setValues
|
|
2656
|
-
values: Values,
|
|
2657
|
-
): Store<Schemas>;
|
|
2275
|
+
setValues(values: Values): Store;
|
|
2658
2276
|
|
|
2659
2277
|
/**
|
|
2660
2278
|
* The setPartialValues method takes an object and sets its Values in the
|
|
@@ -2704,9 +2322,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2704
2322
|
* @category Setter
|
|
2705
2323
|
* @since v3.0.0
|
|
2706
2324
|
*/
|
|
2707
|
-
setPartialValues
|
|
2708
|
-
partialValues: Values,
|
|
2709
|
-
): Store<Schemas>;
|
|
2325
|
+
setPartialValues(partialValues: Values): Store;
|
|
2710
2326
|
|
|
2711
2327
|
/**
|
|
2712
2328
|
* The setValue method sets a single keyed Value in the Store.
|
|
@@ -2760,14 +2376,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2760
2376
|
* @category Setter
|
|
2761
2377
|
* @since v3.0.0
|
|
2762
2378
|
*/
|
|
2763
|
-
setValue
|
|
2764
|
-
ValueId extends ValueIdFromSchema<Schemas[1]>,
|
|
2765
|
-
Value = ValueFromSchema<Schemas[1], ValueId>,
|
|
2766
|
-
MapValue = (value: Value | undefined) => Value,
|
|
2767
|
-
>(
|
|
2768
|
-
valueId: ValueId,
|
|
2769
|
-
value: Value | MapValue,
|
|
2770
|
-
): Store<Schemas>;
|
|
2379
|
+
setValue(valueId: Id, value: Value | MapValue): Store;
|
|
2771
2380
|
|
|
2772
2381
|
/**
|
|
2773
2382
|
* The setTablesJson method takes a string serialization of all of the Tables
|
|
@@ -2802,7 +2411,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2802
2411
|
* @category Setter
|
|
2803
2412
|
* @since v3.0.0
|
|
2804
2413
|
*/
|
|
2805
|
-
setTablesJson(tablesJson: Json): Store
|
|
2414
|
+
setTablesJson(tablesJson: Json): Store;
|
|
2806
2415
|
|
|
2807
2416
|
/**
|
|
2808
2417
|
* The setValuesJson method takes a string serialization of all of the Values
|
|
@@ -2837,7 +2446,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2837
2446
|
* @category Setter
|
|
2838
2447
|
* @since v3.0.0
|
|
2839
2448
|
*/
|
|
2840
|
-
setValuesJson(valuesJson: Json): Store
|
|
2449
|
+
setValuesJson(valuesJson: Json): Store;
|
|
2841
2450
|
|
|
2842
2451
|
/**
|
|
2843
2452
|
* The setJson method takes a string serialization of all of the Tables and
|
|
@@ -2896,24 +2505,16 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2896
2505
|
* ```
|
|
2897
2506
|
* @category Setter
|
|
2898
2507
|
*/
|
|
2899
|
-
setJson(tablesAndValuesJson: Json): Store
|
|
2508
|
+
setJson(tablesAndValuesJson: Json): Store;
|
|
2900
2509
|
|
|
2901
2510
|
/**
|
|
2902
2511
|
* The setTablesSchema method lets you specify the TablesSchema of the tabular
|
|
2903
2512
|
* part of the Store.
|
|
2904
2513
|
*
|
|
2905
|
-
* ```ts override
|
|
2906
|
-
* setTablesSchema(tablesSchema: TablesSchema): Store<Schemas>
|
|
2907
|
-
* ```
|
|
2908
|
-
*
|
|
2909
2514
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
2910
2515
|
* applied or as invalid Table, Row, or Cell objects are removed. These
|
|
2911
2516
|
* changes will fire any listeners to that data, as expected.
|
|
2912
2517
|
*
|
|
2913
|
-
* This method will return a Store that is typed according to the schema that
|
|
2914
|
-
* you provided. To benefit from that, you may wish to assign it to a new
|
|
2915
|
-
* variable so that TypeScript is able to reason about its subsequent usage.
|
|
2916
|
-
*
|
|
2917
2518
|
* When no longer needed, you can also completely remove an existing
|
|
2918
2519
|
* TablesSchema with the delTablesSchema method.
|
|
2919
2520
|
*
|
|
@@ -2937,29 +2538,16 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2937
2538
|
* @category Setter
|
|
2938
2539
|
* @since v3.0.0
|
|
2939
2540
|
*/
|
|
2940
|
-
setTablesSchema
|
|
2941
|
-
TablesSchema extends TablesSchemaAlias,
|
|
2942
|
-
ValuesSchema extends OptionalValuesSchema = Schemas[1],
|
|
2943
|
-
>(
|
|
2944
|
-
tablesSchema: TablesSchema,
|
|
2945
|
-
): Store<[typeof tablesSchema, ValuesSchema]>;
|
|
2541
|
+
setTablesSchema(tablesSchema: TablesSchema): Store;
|
|
2946
2542
|
|
|
2947
2543
|
/**
|
|
2948
2544
|
* The setValuesSchema method lets you specify the ValuesSchema of the keyed
|
|
2949
2545
|
* Values part of the Store.
|
|
2950
2546
|
*
|
|
2951
|
-
* ```ts override
|
|
2952
|
-
* setValuesSchema(valuesSchema: ValuesSchema): Store<Schemas>
|
|
2953
|
-
* ```
|
|
2954
|
-
*
|
|
2955
2547
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
2956
2548
|
* applied or as invalid Values are removed. These changes will fire any
|
|
2957
2549
|
* listeners to that data, as expected.
|
|
2958
2550
|
*
|
|
2959
|
-
* This method will return a Store that is typed according to the schema that
|
|
2960
|
-
* you provided. To benefit from that, you may wish to assign it to a new
|
|
2961
|
-
* variable so that TypeScript is able to reason about its subsequent usage.
|
|
2962
|
-
*
|
|
2963
2551
|
* When no longer needed, you can also completely remove an existing
|
|
2964
2552
|
* ValuesSchema with the delValuesSchema method.
|
|
2965
2553
|
*
|
|
@@ -2980,32 +2568,16 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
2980
2568
|
* @category Setter
|
|
2981
2569
|
* @since v3.0.0
|
|
2982
2570
|
*/
|
|
2983
|
-
setValuesSchema
|
|
2984
|
-
ValuesSchema extends ValuesSchemaAlias,
|
|
2985
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
2986
|
-
>(
|
|
2987
|
-
valuesSchema: ValuesSchema,
|
|
2988
|
-
): Store<[TablesSchema, typeof valuesSchema]>;
|
|
2571
|
+
setValuesSchema(valuesSchema: ValuesSchema): Store;
|
|
2989
2572
|
|
|
2990
2573
|
/**
|
|
2991
2574
|
* The setSchema method lets you specify the TablesSchema and ValuesSchema of
|
|
2992
2575
|
* the Store.
|
|
2993
2576
|
*
|
|
2994
|
-
* ```ts override
|
|
2995
|
-
* setSchema(
|
|
2996
|
-
* tablesSchema: TablesSchema,
|
|
2997
|
-
* valuesSchema?: ValuesSchema,
|
|
2998
|
-
* ): Store<Schemas>
|
|
2999
|
-
* ```
|
|
3000
|
-
*
|
|
3001
2577
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
3002
2578
|
* applied or as invalid Table, Row, Cell, or Value objects are removed. These
|
|
3003
2579
|
* changes will fire any listeners to that data, as expected.
|
|
3004
2580
|
*
|
|
3005
|
-
* This method will return a Store that is typed according to the schemas that
|
|
3006
|
-
* you provided. To benefit from that, you may wish to assign it to a new
|
|
3007
|
-
* variable so that TypeScript is able to reason about its subsequent usage.
|
|
3008
|
-
*
|
|
3009
2581
|
* From v3.0.0 onwards, this method takes two arguments. The first is the
|
|
3010
2582
|
* TablesSchema object, the second the ValuesSchema. In previous versions
|
|
3011
2583
|
* (before the existence of the ValuesSchema data structure), only the first
|
|
@@ -3055,20 +2627,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3055
2627
|
* ```
|
|
3056
2628
|
* @category Setter
|
|
3057
2629
|
*/
|
|
3058
|
-
setSchema
|
|
3059
|
-
TablesSchema extends TablesSchemaAlias,
|
|
3060
|
-
ValuesSchema extends ValuesSchemaAlias,
|
|
3061
|
-
>(
|
|
3062
|
-
tablesSchema: TablesSchema,
|
|
3063
|
-
valuesSchema?: ValuesSchema,
|
|
3064
|
-
): Store<
|
|
3065
|
-
[
|
|
3066
|
-
typeof tablesSchema,
|
|
3067
|
-
Exclude<ValuesSchemaAlias, typeof valuesSchema> extends never
|
|
3068
|
-
? NoValuesSchema
|
|
3069
|
-
: NonNullable<typeof valuesSchema>,
|
|
3070
|
-
]
|
|
3071
|
-
>;
|
|
2630
|
+
setSchema(tablesSchema: TablesSchema, valuesSchema?: ValuesSchema): Store;
|
|
3072
2631
|
|
|
3073
2632
|
/**
|
|
3074
2633
|
* The delTables method lets you remove all of the data in a Store.
|
|
@@ -3086,7 +2645,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3086
2645
|
* ```
|
|
3087
2646
|
* @category Deleter
|
|
3088
2647
|
*/
|
|
3089
|
-
delTables(): Store
|
|
2648
|
+
delTables(): Store;
|
|
3090
2649
|
|
|
3091
2650
|
/**
|
|
3092
2651
|
* The delTable method lets you remove a single Table from the Store.
|
|
@@ -3108,9 +2667,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3108
2667
|
* ```
|
|
3109
2668
|
* @category Deleter
|
|
3110
2669
|
*/
|
|
3111
|
-
delTable
|
|
3112
|
-
tableId: TableId,
|
|
3113
|
-
): Store<Schemas>;
|
|
2670
|
+
delTable(tableId: Id): Store;
|
|
3114
2671
|
|
|
3115
2672
|
/**
|
|
3116
2673
|
* The delRow method lets you remove a single Row from a Table.
|
|
@@ -3134,10 +2691,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3134
2691
|
* ```
|
|
3135
2692
|
* @category Deleter
|
|
3136
2693
|
*/
|
|
3137
|
-
delRow
|
|
3138
|
-
tableId: TableId,
|
|
3139
|
-
rowId: Id,
|
|
3140
|
-
): Store<Schemas>;
|
|
2694
|
+
delRow(tableId: Id, rowId: Id): Store;
|
|
3141
2695
|
|
|
3142
2696
|
/**
|
|
3143
2697
|
* The delCell method lets you remove a single Cell from a Row.
|
|
@@ -3221,15 +2775,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3221
2775
|
* ```
|
|
3222
2776
|
* @category Deleter
|
|
3223
2777
|
*/
|
|
3224
|
-
delCell
|
|
3225
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3226
|
-
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
3227
|
-
>(
|
|
3228
|
-
tableId: TableId,
|
|
3229
|
-
rowId: Id,
|
|
3230
|
-
cellId: CellId,
|
|
3231
|
-
forceDel?: boolean,
|
|
3232
|
-
): Store<Schemas>;
|
|
2778
|
+
delCell(tableId: Id, rowId: Id, cellId: Id, forceDel?: boolean): Store;
|
|
3233
2779
|
|
|
3234
2780
|
/**
|
|
3235
2781
|
* The delValues method lets you remove all the Values from a Store.
|
|
@@ -3268,7 +2814,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3268
2814
|
* @category Deleter
|
|
3269
2815
|
* @since v3.0.0
|
|
3270
2816
|
*/
|
|
3271
|
-
delValues(): Store
|
|
2817
|
+
delValues(): Store;
|
|
3272
2818
|
|
|
3273
2819
|
/**
|
|
3274
2820
|
* The delValue method lets you remove a single Value from a Store.
|
|
@@ -3308,9 +2854,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3308
2854
|
* @category Deleter
|
|
3309
2855
|
* @since v3.0.0
|
|
3310
2856
|
*/
|
|
3311
|
-
delValue
|
|
3312
|
-
valueId: ValueId,
|
|
3313
|
-
): Store<Schemas>;
|
|
2857
|
+
delValue(valueId: Id): Store;
|
|
3314
2858
|
|
|
3315
2859
|
/**
|
|
3316
2860
|
* The delTablesSchema method lets you remove the TablesSchema of the Store.
|
|
@@ -3329,9 +2873,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3329
2873
|
* ```
|
|
3330
2874
|
* @category Deleter
|
|
3331
2875
|
*/
|
|
3332
|
-
delTablesSchema
|
|
3333
|
-
ValuesSchema extends OptionalValuesSchema = Schemas[1],
|
|
3334
|
-
>(): Store<[NoTablesSchema, ValuesSchema]>;
|
|
2876
|
+
delTablesSchema(): Store;
|
|
3335
2877
|
|
|
3336
2878
|
/**
|
|
3337
2879
|
* The delValuesSchema method lets you remove the ValuesSchema of the Store.
|
|
@@ -3351,9 +2893,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3351
2893
|
* @category Deleter
|
|
3352
2894
|
* @since v3.0.0
|
|
3353
2895
|
*/
|
|
3354
|
-
delValuesSchema
|
|
3355
|
-
TablesSchema extends OptionalTablesSchema = Schemas[0],
|
|
3356
|
-
>(): Store<[TablesSchema, NoValuesSchema]>;
|
|
2896
|
+
delValuesSchema(): Store;
|
|
3357
2897
|
|
|
3358
2898
|
/**
|
|
3359
2899
|
* The delSchema method lets you remove both the TablesSchema and ValuesSchema
|
|
@@ -3380,7 +2920,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3380
2920
|
* @category Deleter
|
|
3381
2921
|
* @since v3.0.0
|
|
3382
2922
|
*/
|
|
3383
|
-
delSchema(): Store
|
|
2923
|
+
delSchema(): Store;
|
|
3384
2924
|
|
|
3385
2925
|
/**
|
|
3386
2926
|
* The transaction method takes a function that makes multiple mutations to
|
|
@@ -3508,10 +3048,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3508
3048
|
* ```
|
|
3509
3049
|
* @category Transaction
|
|
3510
3050
|
*/
|
|
3511
|
-
transaction<Return>(
|
|
3512
|
-
actions: () => Return,
|
|
3513
|
-
doRollback?: DoRollback<Schemas>,
|
|
3514
|
-
): Return;
|
|
3051
|
+
transaction<Return>(actions: () => Return, doRollback?: DoRollback): Return;
|
|
3515
3052
|
|
|
3516
3053
|
/**
|
|
3517
3054
|
* The startTransaction method allows you to explicitly start a transaction
|
|
@@ -3562,7 +3099,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3562
3099
|
* @category Transaction
|
|
3563
3100
|
* @since v1.3.0
|
|
3564
3101
|
*/
|
|
3565
|
-
startTransaction(): Store
|
|
3102
|
+
startTransaction(): Store;
|
|
3566
3103
|
|
|
3567
3104
|
/**
|
|
3568
3105
|
* The finishTransaction method allows you to explicitly finish a transaction
|
|
@@ -3660,7 +3197,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3660
3197
|
* @category Transaction
|
|
3661
3198
|
* @since v1.3.0
|
|
3662
3199
|
*/
|
|
3663
|
-
finishTransaction(doRollback?: DoRollback
|
|
3200
|
+
finishTransaction(doRollback?: DoRollback): Store;
|
|
3664
3201
|
|
|
3665
3202
|
/**
|
|
3666
3203
|
* The forEachTable method takes a function that it will then call for each
|
|
@@ -3693,9 +3230,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3693
3230
|
* ```
|
|
3694
3231
|
* @category Iterator
|
|
3695
3232
|
*/
|
|
3696
|
-
forEachTable
|
|
3697
|
-
tableCallback: TableCallback,
|
|
3698
|
-
): void;
|
|
3233
|
+
forEachTable(tableCallback: TableCallback): void;
|
|
3699
3234
|
|
|
3700
3235
|
/**
|
|
3701
3236
|
* The forEachRow method takes a function that it will then call for each Row
|
|
@@ -3730,13 +3265,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3730
3265
|
* ```
|
|
3731
3266
|
* @category Iterator
|
|
3732
3267
|
*/
|
|
3733
|
-
forEachRow
|
|
3734
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3735
|
-
RowCallback = RowCallbackAlias<Schemas[0], TableId>,
|
|
3736
|
-
>(
|
|
3737
|
-
tableId: TableId,
|
|
3738
|
-
rowCallback: RowCallback,
|
|
3739
|
-
): void;
|
|
3268
|
+
forEachRow(tableId: Id, rowCallback: RowCallback): void;
|
|
3740
3269
|
|
|
3741
3270
|
/**
|
|
3742
3271
|
* The forEachCell method takes a function that it will then call for each
|
|
@@ -3764,14 +3293,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3764
3293
|
* ```
|
|
3765
3294
|
* @category Iterator
|
|
3766
3295
|
*/
|
|
3767
|
-
forEachCell
|
|
3768
|
-
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3769
|
-
CellCallback = CellCallbackAlias<Schemas[0], TableId>,
|
|
3770
|
-
>(
|
|
3771
|
-
tableId: TableId,
|
|
3772
|
-
rowId: Id,
|
|
3773
|
-
cellCallback: CellCallback,
|
|
3774
|
-
): void;
|
|
3296
|
+
forEachCell(tableId: Id, rowId: Id, cellCallback: CellCallback): void;
|
|
3775
3297
|
|
|
3776
3298
|
/**
|
|
3777
3299
|
* The forEachValue method takes a function that it will then call for each
|
|
@@ -3796,9 +3318,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3796
3318
|
* @category Iterator
|
|
3797
3319
|
* @since v3.0.0
|
|
3798
3320
|
*/
|
|
3799
|
-
forEachValue
|
|
3800
|
-
valueCallback: ValueCallback,
|
|
3801
|
-
): void;
|
|
3321
|
+
forEachValue(valueCallback: ValueCallback): void;
|
|
3802
3322
|
|
|
3803
3323
|
/**
|
|
3804
3324
|
* The addTablesListener method registers a listener function with the Store
|
|
@@ -3862,7 +3382,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3862
3382
|
* ```
|
|
3863
3383
|
* @category Listener
|
|
3864
3384
|
*/
|
|
3865
|
-
addTablesListener(listener: TablesListener
|
|
3385
|
+
addTablesListener(listener: TablesListener, mutator?: boolean): Id;
|
|
3866
3386
|
|
|
3867
3387
|
/**
|
|
3868
3388
|
* The addTableIdsListener method registers a listener function with the Store
|
|
@@ -3925,10 +3445,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
3925
3445
|
* ```
|
|
3926
3446
|
* @category Listener
|
|
3927
3447
|
*/
|
|
3928
|
-
addTableIdsListener(
|
|
3929
|
-
listener: TableIdsListener<Schemas>,
|
|
3930
|
-
mutator?: boolean,
|
|
3931
|
-
): Id;
|
|
3448
|
+
addTableIdsListener(listener: TableIdsListener, mutator?: boolean): Id;
|
|
3932
3449
|
|
|
3933
3450
|
/**
|
|
3934
3451
|
* The addTableListener method registers a listener function with the Store
|
|
@@ -4021,9 +3538,9 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4021
3538
|
* ```
|
|
4022
3539
|
* @category Listener
|
|
4023
3540
|
*/
|
|
4024
|
-
addTableListener
|
|
4025
|
-
tableId:
|
|
4026
|
-
listener: TableListener
|
|
3541
|
+
addTableListener(
|
|
3542
|
+
tableId: IdOrNull,
|
|
3543
|
+
listener: TableListener,
|
|
4027
3544
|
mutator?: boolean,
|
|
4028
3545
|
): Id;
|
|
4029
3546
|
|
|
@@ -4113,9 +3630,9 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4113
3630
|
* ```
|
|
4114
3631
|
* @category Listener
|
|
4115
3632
|
*/
|
|
4116
|
-
addRowIdsListener
|
|
4117
|
-
tableId:
|
|
4118
|
-
listener: RowIdsListener
|
|
3633
|
+
addRowIdsListener(
|
|
3634
|
+
tableId: IdOrNull,
|
|
3635
|
+
listener: RowIdsListener,
|
|
4119
3636
|
mutator?: boolean,
|
|
4120
3637
|
): Id;
|
|
4121
3638
|
|
|
@@ -4335,26 +3852,13 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4335
3852
|
* @category Listener
|
|
4336
3853
|
* @since v2.0.0
|
|
4337
3854
|
*/
|
|
4338
|
-
addSortedRowIdsListener
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
tableId: TableId,
|
|
4346
|
-
cellId: CellId,
|
|
4347
|
-
descending: Descending,
|
|
4348
|
-
offset: Offset,
|
|
4349
|
-
limit: Limit,
|
|
4350
|
-
listener: SortedRowIdsListener<
|
|
4351
|
-
Schemas,
|
|
4352
|
-
TableId,
|
|
4353
|
-
CellId,
|
|
4354
|
-
Descending,
|
|
4355
|
-
Offset,
|
|
4356
|
-
Limit
|
|
4357
|
-
>,
|
|
3855
|
+
addSortedRowIdsListener(
|
|
3856
|
+
tableId: Id,
|
|
3857
|
+
cellId: Id | undefined,
|
|
3858
|
+
descending: boolean,
|
|
3859
|
+
offset: number,
|
|
3860
|
+
limit: number | undefined,
|
|
3861
|
+
listener: SortedRowIdsListener,
|
|
4358
3862
|
mutator?: boolean,
|
|
4359
3863
|
): Id;
|
|
4360
3864
|
|
|
@@ -4461,13 +3965,10 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4461
3965
|
* ```
|
|
4462
3966
|
* @category Listener
|
|
4463
3967
|
*/
|
|
4464
|
-
addRowListener
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
tableId: TableIdOrNull,
|
|
4469
|
-
rowId: RowIdOrNull,
|
|
4470
|
-
listener: RowListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
3968
|
+
addRowListener(
|
|
3969
|
+
tableId: IdOrNull,
|
|
3970
|
+
rowId: IdOrNull,
|
|
3971
|
+
listener: RowListener,
|
|
4471
3972
|
mutator?: boolean,
|
|
4472
3973
|
): Id;
|
|
4473
3974
|
|
|
@@ -4570,13 +4071,10 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4570
4071
|
* ```
|
|
4571
4072
|
* @category Listener
|
|
4572
4073
|
*/
|
|
4573
|
-
addCellIdsListener
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
tableId: TableIdOrNull,
|
|
4578
|
-
rowId: RowIdOrNull,
|
|
4579
|
-
listener: CellIdsListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
4074
|
+
addCellIdsListener(
|
|
4075
|
+
tableId: IdOrNull,
|
|
4076
|
+
rowId: IdOrNull,
|
|
4077
|
+
listener: CellIdsListener,
|
|
4580
4078
|
mutator?: boolean,
|
|
4581
4079
|
): Id;
|
|
4582
4080
|
|
|
@@ -4692,24 +4190,10 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4692
4190
|
* ```
|
|
4693
4191
|
* @category Listener
|
|
4694
4192
|
*/
|
|
4695
|
-
addCellListener
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
| (TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
4700
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
4701
|
-
: AllCellIdFromSchema<Schemas[0]>)
|
|
4702
|
-
| null,
|
|
4703
|
-
CellListener extends CellListenerAlias<
|
|
4704
|
-
Schemas,
|
|
4705
|
-
TableIdOrNull,
|
|
4706
|
-
RowIdOrNull,
|
|
4707
|
-
CellIdOrNull
|
|
4708
|
-
>,
|
|
4709
|
-
>(
|
|
4710
|
-
tableId: TableIdOrNull,
|
|
4711
|
-
rowId: RowIdOrNull,
|
|
4712
|
-
cellId: CellIdOrNull,
|
|
4193
|
+
addCellListener(
|
|
4194
|
+
tableId: IdOrNull,
|
|
4195
|
+
rowId: IdOrNull,
|
|
4196
|
+
cellId: IdOrNull,
|
|
4713
4197
|
listener: CellListener,
|
|
4714
4198
|
mutator?: boolean,
|
|
4715
4199
|
): Id;
|
|
@@ -4773,7 +4257,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4773
4257
|
* @category Listener
|
|
4774
4258
|
* @since v3.0.0
|
|
4775
4259
|
*/
|
|
4776
|
-
addValuesListener(listener: ValuesListener
|
|
4260
|
+
addValuesListener(listener: ValuesListener, mutator?: boolean): Id;
|
|
4777
4261
|
|
|
4778
4262
|
/**
|
|
4779
4263
|
* The addValueIdsListener method registers a listener function with the Store
|
|
@@ -4837,10 +4321,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4837
4321
|
* @category Listener
|
|
4838
4322
|
* @since v3.0.0
|
|
4839
4323
|
*/
|
|
4840
|
-
addValueIdsListener(
|
|
4841
|
-
listener: ValueIdsListener<Schemas>,
|
|
4842
|
-
mutator?: boolean,
|
|
4843
|
-
): Id;
|
|
4324
|
+
addValueIdsListener(listener: ValueIdsListener, mutator?: boolean): Id;
|
|
4844
4325
|
|
|
4845
4326
|
/**
|
|
4846
4327
|
* The addValueListener method registers a listener function with the Store
|
|
@@ -4929,11 +4410,8 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
4929
4410
|
* @category Listener
|
|
4930
4411
|
* @since v3.0.0
|
|
4931
4412
|
*/
|
|
4932
|
-
addValueListener
|
|
4933
|
-
|
|
4934
|
-
ValueListener = ValueListenerAlias<Schemas, ValueIdOrNull>,
|
|
4935
|
-
>(
|
|
4936
|
-
valueId: ValueIdOrNull,
|
|
4413
|
+
addValueListener(
|
|
4414
|
+
valueId: IdOrNull,
|
|
4937
4415
|
listener: ValueListener,
|
|
4938
4416
|
mutator?: boolean,
|
|
4939
4417
|
): Id;
|
|
@@ -5165,7 +4643,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5165
4643
|
tableId: IdOrNull,
|
|
5166
4644
|
rowId: IdOrNull,
|
|
5167
4645
|
cellId: IdOrNull,
|
|
5168
|
-
listener: InvalidCellListener
|
|
4646
|
+
listener: InvalidCellListener,
|
|
5169
4647
|
mutator?: boolean,
|
|
5170
4648
|
): Id;
|
|
5171
4649
|
|
|
@@ -5341,7 +4819,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5341
4819
|
*/
|
|
5342
4820
|
addInvalidValueListener(
|
|
5343
4821
|
valueId: IdOrNull,
|
|
5344
|
-
listener: InvalidValueListener
|
|
4822
|
+
listener: InvalidValueListener,
|
|
5345
4823
|
mutator?: boolean,
|
|
5346
4824
|
): Id;
|
|
5347
4825
|
|
|
@@ -5435,7 +4913,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5435
4913
|
* @category Listener
|
|
5436
4914
|
* @since v1.3.0
|
|
5437
4915
|
*/
|
|
5438
|
-
addWillFinishTransactionListener(listener: TransactionListener
|
|
4916
|
+
addWillFinishTransactionListener(listener: TransactionListener): Id;
|
|
5439
4917
|
|
|
5440
4918
|
/**
|
|
5441
4919
|
* The addDidFinishTransactionListener method registers a listener function
|
|
@@ -5528,7 +5006,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5528
5006
|
* @category Listener
|
|
5529
5007
|
* @since v1.3.0
|
|
5530
5008
|
*/
|
|
5531
|
-
addDidFinishTransactionListener(listener: TransactionListener
|
|
5009
|
+
addDidFinishTransactionListener(listener: TransactionListener): Id;
|
|
5532
5010
|
|
|
5533
5011
|
/**
|
|
5534
5012
|
* The callListener method provides a way for you to manually provoke a
|
|
@@ -5645,7 +5123,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5645
5123
|
* ```
|
|
5646
5124
|
* @category Listener
|
|
5647
5125
|
*/
|
|
5648
|
-
callListener(listenerId: Id): Store
|
|
5126
|
+
callListener(listenerId: Id): Store;
|
|
5649
5127
|
|
|
5650
5128
|
/**
|
|
5651
5129
|
* The delListener method removes a listener that was previously added to the
|
|
@@ -5678,7 +5156,7 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5678
5156
|
* ```
|
|
5679
5157
|
* @category Listener
|
|
5680
5158
|
*/
|
|
5681
|
-
delListener(listenerId: Id): Store
|
|
5159
|
+
delListener(listenerId: Id): Store;
|
|
5682
5160
|
|
|
5683
5161
|
/**
|
|
5684
5162
|
* The getListenerStats method provides a set of statistics about the
|
|
@@ -5755,389 +5233,3 @@ export interface Store<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
5755
5233
|
* @category Creation
|
|
5756
5234
|
*/
|
|
5757
5235
|
export function createStore(): Store;
|
|
5758
|
-
|
|
5759
|
-
/**
|
|
5760
|
-
* The TablesFromSchema type is a utility for determining a Tables structure
|
|
5761
|
-
* from a provided TablesSchema.
|
|
5762
|
-
*
|
|
5763
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5764
|
-
* expected to need to use it directly.
|
|
5765
|
-
*
|
|
5766
|
-
* @category Internal
|
|
5767
|
-
*/
|
|
5768
|
-
export type TablesFromSchema<
|
|
5769
|
-
Schema extends OptionalTablesSchema,
|
|
5770
|
-
WhenSet extends boolean = false,
|
|
5771
|
-
> = {
|
|
5772
|
-
-readonly [TableId in TableIdFromSchema<Schema>]?: TableFromSchema<
|
|
5773
|
-
Schema,
|
|
5774
|
-
TableId,
|
|
5775
|
-
WhenSet
|
|
5776
|
-
>;
|
|
5777
|
-
};
|
|
5778
|
-
|
|
5779
|
-
/**
|
|
5780
|
-
* The TableIdFromSchema type is a utility for determining the Id of Tables from
|
|
5781
|
-
* a provided TablesSchema.
|
|
5782
|
-
*
|
|
5783
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5784
|
-
* expected to need to use it directly.
|
|
5785
|
-
*
|
|
5786
|
-
* @category Internal
|
|
5787
|
-
*/
|
|
5788
|
-
export type TableIdFromSchema<Schema extends OptionalTablesSchema> = AsId<
|
|
5789
|
-
keyof Schema
|
|
5790
|
-
>;
|
|
5791
|
-
|
|
5792
|
-
/**
|
|
5793
|
-
* The TableFromSchema type is a utility for determining a Table structure from
|
|
5794
|
-
* a provided TablesSchema.
|
|
5795
|
-
*
|
|
5796
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5797
|
-
* expected to need to use it directly.
|
|
5798
|
-
*
|
|
5799
|
-
* @category Internal
|
|
5800
|
-
*/
|
|
5801
|
-
export type TableFromSchema<
|
|
5802
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
5803
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
5804
|
-
WhenSet extends boolean = false,
|
|
5805
|
-
> = {[rowId: Id]: RowFromSchema<Schema, TableId, WhenSet>};
|
|
5806
|
-
|
|
5807
|
-
/**
|
|
5808
|
-
* The RowFromSchema type is a utility for determining a Row structure from a
|
|
5809
|
-
* provided TablesSchema.
|
|
5810
|
-
*
|
|
5811
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5812
|
-
* expected to need to use it directly.
|
|
5813
|
-
*
|
|
5814
|
-
* @category Internal
|
|
5815
|
-
*/
|
|
5816
|
-
export type RowFromSchema<
|
|
5817
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
5818
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
5819
|
-
WhenSet extends boolean = false,
|
|
5820
|
-
> = (WhenSet extends true
|
|
5821
|
-
? {
|
|
5822
|
-
-readonly [CellId in DefaultCellIdFromSchema<
|
|
5823
|
-
Schema,
|
|
5824
|
-
TableId
|
|
5825
|
-
>]?: CellFromSchema<Schema, TableId, CellId>;
|
|
5826
|
-
}
|
|
5827
|
-
: {
|
|
5828
|
-
-readonly [CellId in DefaultCellIdFromSchema<
|
|
5829
|
-
Schema,
|
|
5830
|
-
TableId
|
|
5831
|
-
>]: CellFromSchema<Schema, TableId, CellId>;
|
|
5832
|
-
}) & {
|
|
5833
|
-
-readonly [CellId in DefaultCellIdFromSchema<
|
|
5834
|
-
Schema,
|
|
5835
|
-
TableId,
|
|
5836
|
-
false
|
|
5837
|
-
>]?: CellFromSchema<Schema, TableId, CellId>;
|
|
5838
|
-
};
|
|
5839
|
-
|
|
5840
|
-
/**
|
|
5841
|
-
* The CellIdFromSchema type is a utility for determining the Id of Cells from a
|
|
5842
|
-
* provided TablesSchema.
|
|
5843
|
-
*
|
|
5844
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5845
|
-
* expected to need to use it directly.
|
|
5846
|
-
*
|
|
5847
|
-
* @category Internal
|
|
5848
|
-
*/
|
|
5849
|
-
export type CellIdFromSchema<
|
|
5850
|
-
Schema extends OptionalTablesSchema,
|
|
5851
|
-
TableId extends TableIdFromSchema<Schema>,
|
|
5852
|
-
> = AsId<keyof Schema[TableId]>;
|
|
5853
|
-
|
|
5854
|
-
/**
|
|
5855
|
-
* The DefaultCellIdFromSchema type is a utility for determining Cells with or
|
|
5856
|
-
* without default status from a provided TablesSchema.
|
|
5857
|
-
*
|
|
5858
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5859
|
-
* expected to need to use it directly.
|
|
5860
|
-
*
|
|
5861
|
-
* @category Internal
|
|
5862
|
-
*/
|
|
5863
|
-
export type DefaultCellIdFromSchema<
|
|
5864
|
-
Schema extends OptionalTablesSchema,
|
|
5865
|
-
TableId extends TableIdFromSchema<Schema>,
|
|
5866
|
-
IsDefaulted extends boolean = true,
|
|
5867
|
-
> = AsId<
|
|
5868
|
-
{
|
|
5869
|
-
[CellId in CellIdFromSchema<
|
|
5870
|
-
Schema,
|
|
5871
|
-
TableId
|
|
5872
|
-
>]: Schema[TableId][CellId] extends {
|
|
5873
|
-
default: string | number | boolean;
|
|
5874
|
-
}
|
|
5875
|
-
? IsDefaulted extends true
|
|
5876
|
-
? CellId
|
|
5877
|
-
: never
|
|
5878
|
-
: IsDefaulted extends true
|
|
5879
|
-
? never
|
|
5880
|
-
: CellId;
|
|
5881
|
-
}[CellIdFromSchema<Schema, TableId>]
|
|
5882
|
-
>;
|
|
5883
|
-
|
|
5884
|
-
/**
|
|
5885
|
-
* The AllCellIdFromSchema type is a utility for determining the Id of Cells
|
|
5886
|
-
* across all Tables, from a provided TablesSchema.
|
|
5887
|
-
*
|
|
5888
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5889
|
-
* expected to need to use it directly.
|
|
5890
|
-
*
|
|
5891
|
-
* @category Internal
|
|
5892
|
-
*/
|
|
5893
|
-
export type AllCellIdFromSchema<
|
|
5894
|
-
Schema extends OptionalTablesSchema,
|
|
5895
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
5896
|
-
> = TableId extends TableIdFromSchema<Schema>
|
|
5897
|
-
? CellIdFromSchema<Schema, TableId>
|
|
5898
|
-
: never;
|
|
5899
|
-
|
|
5900
|
-
/**
|
|
5901
|
-
* The CellFromSchema type is a utility for determining a Cell type from a
|
|
5902
|
-
* provided TablesSchema.
|
|
5903
|
-
*
|
|
5904
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5905
|
-
* expected to need to use it directly.
|
|
5906
|
-
*
|
|
5907
|
-
* @category Internal
|
|
5908
|
-
*/
|
|
5909
|
-
export type CellFromSchema<
|
|
5910
|
-
Schema extends OptionalTablesSchema,
|
|
5911
|
-
TableId extends TableIdFromSchema<Schema>,
|
|
5912
|
-
CellId extends CellIdFromSchema<Schema, TableId>,
|
|
5913
|
-
CellType = Schema[TableId][CellId]['type'],
|
|
5914
|
-
> = CellType extends 'string'
|
|
5915
|
-
? string
|
|
5916
|
-
: CellType extends 'number'
|
|
5917
|
-
? number
|
|
5918
|
-
: CellType extends 'boolean'
|
|
5919
|
-
? boolean
|
|
5920
|
-
: string | number | boolean;
|
|
5921
|
-
|
|
5922
|
-
/**
|
|
5923
|
-
* The ValuesFromSchema type is a utility for determining a Values structure
|
|
5924
|
-
* from a provided ValuesSchema.
|
|
5925
|
-
*
|
|
5926
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5927
|
-
* expected to need to use it directly.
|
|
5928
|
-
*
|
|
5929
|
-
* @category Internal
|
|
5930
|
-
*/
|
|
5931
|
-
export type ValuesFromSchema<
|
|
5932
|
-
Schema extends OptionalValuesSchema,
|
|
5933
|
-
WhenSet extends boolean = false,
|
|
5934
|
-
> = (WhenSet extends true
|
|
5935
|
-
? {
|
|
5936
|
-
-readonly [ValueId in DefaultValueIdFromSchema<Schema>]?: ValueFromSchema<
|
|
5937
|
-
Schema,
|
|
5938
|
-
ValueId
|
|
5939
|
-
>;
|
|
5940
|
-
}
|
|
5941
|
-
: {
|
|
5942
|
-
-readonly [ValueId in DefaultValueIdFromSchema<Schema>]: ValueFromSchema<
|
|
5943
|
-
Schema,
|
|
5944
|
-
ValueId
|
|
5945
|
-
>;
|
|
5946
|
-
}) & {
|
|
5947
|
-
-readonly [ValueId in DefaultValueIdFromSchema<
|
|
5948
|
-
Schema,
|
|
5949
|
-
false
|
|
5950
|
-
>]?: ValueFromSchema<Schema, ValueId>;
|
|
5951
|
-
};
|
|
5952
|
-
|
|
5953
|
-
/**
|
|
5954
|
-
* The ValueIdFromSchema type is a utility for determining the Id of Values from
|
|
5955
|
-
* a provided ValuesSchema.
|
|
5956
|
-
*
|
|
5957
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5958
|
-
* expected to need to use it directly.
|
|
5959
|
-
*
|
|
5960
|
-
* @category Internal
|
|
5961
|
-
*/
|
|
5962
|
-
export type ValueIdFromSchema<Schema extends OptionalValuesSchema> = AsId<
|
|
5963
|
-
keyof Schema
|
|
5964
|
-
>;
|
|
5965
|
-
|
|
5966
|
-
/**
|
|
5967
|
-
* The DefaultValueIdFromSchema type is a utility for determining Values with or
|
|
5968
|
-
* without default status from a provided ValuesSchema.
|
|
5969
|
-
*
|
|
5970
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5971
|
-
* expected to need to use it directly.
|
|
5972
|
-
*
|
|
5973
|
-
* @category Internal
|
|
5974
|
-
*/
|
|
5975
|
-
export type DefaultValueIdFromSchema<
|
|
5976
|
-
Schema extends OptionalValuesSchema,
|
|
5977
|
-
IsDefaulted extends boolean = true,
|
|
5978
|
-
> = {
|
|
5979
|
-
[ValueId in ValueIdFromSchema<Schema>]: Schema[ValueId] extends {
|
|
5980
|
-
default: string | number | boolean;
|
|
5981
|
-
}
|
|
5982
|
-
? IsDefaulted extends true
|
|
5983
|
-
? ValueId
|
|
5984
|
-
: never
|
|
5985
|
-
: IsDefaulted extends true
|
|
5986
|
-
? never
|
|
5987
|
-
: ValueId;
|
|
5988
|
-
}[ValueIdFromSchema<Schema>];
|
|
5989
|
-
|
|
5990
|
-
/**
|
|
5991
|
-
* The ValueFromSchema type is a utility for determining a Value type from a
|
|
5992
|
-
* provided ValuesSchema.
|
|
5993
|
-
*
|
|
5994
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
5995
|
-
* expected to need to use it directly.
|
|
5996
|
-
*
|
|
5997
|
-
* @category Internal
|
|
5998
|
-
*/
|
|
5999
|
-
export type ValueFromSchema<
|
|
6000
|
-
Schema extends OptionalValuesSchema,
|
|
6001
|
-
ValueId extends ValueIdFromSchema<Schema>,
|
|
6002
|
-
ValueType = Schema[ValueId]['type'],
|
|
6003
|
-
> = ValueType extends 'string'
|
|
6004
|
-
? string
|
|
6005
|
-
: ValueType extends 'number'
|
|
6006
|
-
? number
|
|
6007
|
-
: ValueType extends 'boolean'
|
|
6008
|
-
? boolean
|
|
6009
|
-
: string | number | boolean;
|
|
6010
|
-
|
|
6011
|
-
/**
|
|
6012
|
-
* The AsId type is a utility for coercing keys to be Id-like.
|
|
6013
|
-
*
|
|
6014
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6015
|
-
* expected to need to use it directly.
|
|
6016
|
-
*
|
|
6017
|
-
* @category Internal
|
|
6018
|
-
*/
|
|
6019
|
-
export type AsId<Key> = Exclude<Key & Id, number>;
|
|
6020
|
-
|
|
6021
|
-
/**
|
|
6022
|
-
* The TablesSchemaAlias type is a duplicate of TablesSchema, used to mask
|
|
6023
|
-
* complex generics from documentation.
|
|
6024
|
-
*
|
|
6025
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6026
|
-
* expected to need to use it directly.
|
|
6027
|
-
*
|
|
6028
|
-
* @category Internal
|
|
6029
|
-
*/
|
|
6030
|
-
export type TablesSchemaAlias = TablesSchema;
|
|
6031
|
-
|
|
6032
|
-
/**
|
|
6033
|
-
* The ValuesSchemaAlias type is a duplicate of ValuesSchema, used to mask
|
|
6034
|
-
* complex generics from documentation.
|
|
6035
|
-
*
|
|
6036
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6037
|
-
* expected to need to use it directly.
|
|
6038
|
-
*
|
|
6039
|
-
* @category Internal
|
|
6040
|
-
*/
|
|
6041
|
-
export type ValuesSchemaAlias = ValuesSchema;
|
|
6042
|
-
|
|
6043
|
-
/**
|
|
6044
|
-
* The TableCallbackAlias type is a duplicate of TableCallback, used to mask
|
|
6045
|
-
* complex generics from documentation.
|
|
6046
|
-
*
|
|
6047
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6048
|
-
* expected to need to use it directly.
|
|
6049
|
-
*
|
|
6050
|
-
* @category Internal
|
|
6051
|
-
*/
|
|
6052
|
-
export type TableCallbackAlias<
|
|
6053
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
6054
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
6055
|
-
> = TableCallback<Schema, TableId>;
|
|
6056
|
-
|
|
6057
|
-
/**
|
|
6058
|
-
* The RowCallbackAlias type is a duplicate of RowCallback, used to mask complex
|
|
6059
|
-
* generics from documentation.
|
|
6060
|
-
*
|
|
6061
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6062
|
-
* expected to need to use it directly.
|
|
6063
|
-
*
|
|
6064
|
-
* @category Internal
|
|
6065
|
-
*/
|
|
6066
|
-
export type RowCallbackAlias<
|
|
6067
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
6068
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
6069
|
-
> = RowCallback<Schema, TableId>;
|
|
6070
|
-
|
|
6071
|
-
/**
|
|
6072
|
-
* The CellCallbackAlias type is a duplicate of CellCallback, used to mask
|
|
6073
|
-
* complex generics from documentation.
|
|
6074
|
-
*
|
|
6075
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6076
|
-
* expected to need to use it directly.
|
|
6077
|
-
*
|
|
6078
|
-
* @category Internal
|
|
6079
|
-
*/
|
|
6080
|
-
export type CellCallbackAlias<
|
|
6081
|
-
Schema extends OptionalTablesSchema = NoTablesSchema,
|
|
6082
|
-
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
6083
|
-
CellId extends CellIdFromSchema<Schema, TableId> = CellIdFromSchema<
|
|
6084
|
-
Schema,
|
|
6085
|
-
TableId
|
|
6086
|
-
>,
|
|
6087
|
-
> = CellCallback<Schema, TableId, CellId>;
|
|
6088
|
-
|
|
6089
|
-
/**
|
|
6090
|
-
* The ValueCallbackAlias type is a duplicate of ValueCallback, used to mask
|
|
6091
|
-
* complex generics from documentation.
|
|
6092
|
-
*
|
|
6093
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6094
|
-
* expected to need to use it directly.
|
|
6095
|
-
*
|
|
6096
|
-
* @category Internal
|
|
6097
|
-
*/
|
|
6098
|
-
export type ValueCallbackAlias<
|
|
6099
|
-
Schema extends OptionalValuesSchema = NoValuesSchema,
|
|
6100
|
-
ValueId extends ValueIdFromSchema<Schema> = ValueIdFromSchema<Schema>,
|
|
6101
|
-
> = ValueCallback<Schema, ValueId>;
|
|
6102
|
-
|
|
6103
|
-
/**
|
|
6104
|
-
* The CellListenerAlias type is a duplicate of CellListener, used to mask
|
|
6105
|
-
* complex generics from documentation.
|
|
6106
|
-
*
|
|
6107
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6108
|
-
* expected to need to use it directly.
|
|
6109
|
-
*
|
|
6110
|
-
* @category Internal
|
|
6111
|
-
*/
|
|
6112
|
-
export type CellListenerAlias<
|
|
6113
|
-
Schemas extends OptionalSchemas = NoSchemas,
|
|
6114
|
-
TableIdOrNull extends TableIdFromSchema<
|
|
6115
|
-
Schemas[0]
|
|
6116
|
-
> | null = TableIdFromSchema<Schemas[0]> | null,
|
|
6117
|
-
RowIdOrNull extends IdOrNull = IdOrNull,
|
|
6118
|
-
CellIdOrNull extends
|
|
6119
|
-
| (TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
6120
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
6121
|
-
: AllCellIdFromSchema<Schemas[0]>)
|
|
6122
|
-
| null =
|
|
6123
|
-
| (TableIdOrNull extends TableIdFromSchema<Schemas[0]>
|
|
6124
|
-
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
6125
|
-
: AllCellIdFromSchema<Schemas[0]>)
|
|
6126
|
-
| null,
|
|
6127
|
-
> = CellListener<Schemas, TableIdOrNull, RowIdOrNull, CellIdOrNull>;
|
|
6128
|
-
|
|
6129
|
-
/**
|
|
6130
|
-
* The ValueListenerAlias type is a duplicate of ValueListener, used to mask
|
|
6131
|
-
* complex generics from documentation.
|
|
6132
|
-
*
|
|
6133
|
-
* This type is used internally to the TinyBase type system and you are not
|
|
6134
|
-
* expected to need to use it directly.
|
|
6135
|
-
*
|
|
6136
|
-
* @category Internal
|
|
6137
|
-
*/
|
|
6138
|
-
export type ValueListenerAlias<
|
|
6139
|
-
Schemas extends OptionalSchemas = NoSchemas,
|
|
6140
|
-
ValueIdOrNull extends ValueIdFromSchema<
|
|
6141
|
-
Schemas[1]
|
|
6142
|
-
> | null = ValueIdFromSchema<Schemas[1]> | null,
|
|
6143
|
-
> = ValueListener<Schemas, ValueIdOrNull>;
|