tinybase 3.1.0-beta.5 → 3.1.0
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/types/checkpoints.d.ts +2 -0
- package/lib/types/indexes.d.ts +2 -0
- package/lib/types/metrics.d.ts +2 -0
- package/lib/types/persisters.d.ts +2 -0
- package/lib/types/queries.d.ts +2 -0
- package/lib/types/relationships.d.ts +2 -0
- package/lib/types/store.d.ts +50 -0
- package/lib/types/tools.d.ts +5 -0
- package/lib/types/with-schemas/checkpoints.d.ts +84 -0
- package/lib/types/with-schemas/indexes.d.ts +105 -0
- package/lib/types/with-schemas/metrics.d.ts +61 -0
- package/lib/types/with-schemas/persisters.d.ts +98 -0
- package/lib/types/with-schemas/queries.d.ts +258 -0
- package/lib/types/with-schemas/relationships.d.ts +122 -0
- package/lib/types/with-schemas/store.d.ts +732 -8
- package/lib/types/with-schemas/tools.d.ts +14 -0
- package/lib/types/with-schemas/ui-react.d.ts +1054 -0
- package/package.json +2 -2
- package/readme.md +14 -14
|
@@ -178,6 +178,7 @@ export type CheckpointsListenerStats = {
|
|
|
178
178
|
* @category Checkpoints
|
|
179
179
|
*/
|
|
180
180
|
export interface Checkpoints {
|
|
181
|
+
//
|
|
181
182
|
/**
|
|
182
183
|
* The setSize method lets you specify how many checkpoints the Checkpoints
|
|
183
184
|
* object will store.
|
|
@@ -922,6 +923,7 @@ export interface Checkpoints {
|
|
|
922
923
|
* @category Development
|
|
923
924
|
*/
|
|
924
925
|
getListenerStats(): CheckpointsListenerStats;
|
|
926
|
+
//
|
|
925
927
|
}
|
|
926
928
|
|
|
927
929
|
/**
|
package/lib/types/indexes.d.ts
CHANGED
|
@@ -196,6 +196,7 @@ export type IndexesListenerStats = {
|
|
|
196
196
|
* @category Indexes
|
|
197
197
|
*/
|
|
198
198
|
export interface Indexes {
|
|
199
|
+
//
|
|
199
200
|
/**
|
|
200
201
|
* The setIndexDefinition method lets you set the definition of an Index.
|
|
201
202
|
*
|
|
@@ -929,6 +930,7 @@ export interface Indexes {
|
|
|
929
930
|
* @category Development
|
|
930
931
|
*/
|
|
931
932
|
getListenerStats(): IndexesListenerStats;
|
|
933
|
+
//
|
|
932
934
|
}
|
|
933
935
|
|
|
934
936
|
/**
|
package/lib/types/metrics.d.ts
CHANGED
|
@@ -246,6 +246,7 @@ export type MetricsListenerStats = {
|
|
|
246
246
|
* @category Metrics
|
|
247
247
|
*/
|
|
248
248
|
export interface Metrics {
|
|
249
|
+
//
|
|
249
250
|
/**
|
|
250
251
|
* The setMetricDefinition method lets you set the definition of a Metric.
|
|
251
252
|
*
|
|
@@ -789,6 +790,7 @@ export interface Metrics {
|
|
|
789
790
|
* @category Development
|
|
790
791
|
*/
|
|
791
792
|
getListenerStats(): MetricsListenerStats;
|
|
793
|
+
//
|
|
792
794
|
}
|
|
793
795
|
|
|
794
796
|
/**
|
|
@@ -146,6 +146,7 @@ export type PersisterStats = {
|
|
|
146
146
|
* @category Persister
|
|
147
147
|
*/
|
|
148
148
|
export interface Persister {
|
|
149
|
+
//
|
|
149
150
|
/**
|
|
150
151
|
* The load method gets persisted data from storage, and loads it into the
|
|
151
152
|
* Store with which the Persister is associated, once.
|
|
@@ -516,6 +517,7 @@ export interface Persister {
|
|
|
516
517
|
* @category Development
|
|
517
518
|
*/
|
|
518
519
|
getStats(): PersisterStats;
|
|
520
|
+
//
|
|
519
521
|
}
|
|
520
522
|
|
|
521
523
|
/**
|
package/lib/types/queries.d.ts
CHANGED
|
@@ -1592,6 +1592,7 @@ export type Having = {
|
|
|
1592
1592
|
* @since v2.0.0
|
|
1593
1593
|
*/
|
|
1594
1594
|
export interface Queries {
|
|
1595
|
+
//
|
|
1595
1596
|
/**
|
|
1596
1597
|
* The setQueryDefinition method lets you set the definition of a query.
|
|
1597
1598
|
*
|
|
@@ -3153,6 +3154,7 @@ export interface Queries {
|
|
|
3153
3154
|
* @since v2.0.0
|
|
3154
3155
|
*/
|
|
3155
3156
|
getListenerStats(): QueriesListenerStats;
|
|
3157
|
+
//
|
|
3156
3158
|
}
|
|
3157
3159
|
|
|
3158
3160
|
/**
|
|
@@ -248,6 +248,7 @@ export type RelationshipsListenerStats = {
|
|
|
248
248
|
* @category Relationships
|
|
249
249
|
*/
|
|
250
250
|
export interface Relationships {
|
|
251
|
+
//
|
|
251
252
|
/**
|
|
252
253
|
* The setRelationshipDefinition method lets you set the definition of a
|
|
253
254
|
* Relationship.
|
|
@@ -1164,6 +1165,7 @@ export interface Relationships {
|
|
|
1164
1165
|
* @category Development
|
|
1165
1166
|
*/
|
|
1166
1167
|
getListenerStats(): RelationshipsListenerStats;
|
|
1168
|
+
//
|
|
1167
1169
|
}
|
|
1168
1170
|
|
|
1169
1171
|
/**
|
package/lib/types/store.d.ts
CHANGED
|
@@ -118,6 +118,54 @@ 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
|
+
* @category Schema
|
|
126
|
+
*/
|
|
127
|
+
export type NoTablesSchema = {[tableId: Id]: {[cellId: Id]: {type: 'any'}}};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The NoValuesSchema type is a ValuesSchema-like type for when one has not been
|
|
131
|
+
* provided.
|
|
132
|
+
*
|
|
133
|
+
* @category Schema
|
|
134
|
+
*/
|
|
135
|
+
export type NoValuesSchema = {[valueId: Id]: {type: 'any'}};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The OptionalTablesSchema type is used by generic types that can optionally
|
|
139
|
+
* take a TablesSchema.
|
|
140
|
+
*
|
|
141
|
+
* @category Schema
|
|
142
|
+
*/
|
|
143
|
+
export type OptionalTablesSchema = TablesSchema | NoTablesSchema;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The OptionalValuesSchema type is used by generic types that can optionally
|
|
147
|
+
* take a ValuesSchema.
|
|
148
|
+
*
|
|
149
|
+
* @category Schema
|
|
150
|
+
*/
|
|
151
|
+
export type OptionalValuesSchema = ValuesSchema | NoValuesSchema;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The OptionalSchemas type is used by generic types that can optionally take
|
|
155
|
+
* either or both of a TablesSchema and ValuesSchema.
|
|
156
|
+
*
|
|
157
|
+
* @category Schema
|
|
158
|
+
*/
|
|
159
|
+
export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The NoSchemas type is used as a default by generic types that can optionally
|
|
163
|
+
* take either or both of a TablesSchema and ValuesSchema.
|
|
164
|
+
*
|
|
165
|
+
* @category Schema
|
|
166
|
+
*/
|
|
167
|
+
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
168
|
+
|
|
121
169
|
/**
|
|
122
170
|
* The Tables type is the data structure representing all of the data in a
|
|
123
171
|
* Store.
|
|
@@ -1171,6 +1219,7 @@ export type StoreListenerStats = {
|
|
|
1171
1219
|
* @category Store
|
|
1172
1220
|
*/
|
|
1173
1221
|
export interface Store {
|
|
1222
|
+
//
|
|
1174
1223
|
/**
|
|
1175
1224
|
* The getTables method returns a Tables object containing the entire data of
|
|
1176
1225
|
* the Store.
|
|
@@ -5188,6 +5237,7 @@ export interface Store {
|
|
|
5188
5237
|
* @category Development
|
|
5189
5238
|
*/
|
|
5190
5239
|
getListenerStats(): StoreListenerStats;
|
|
5240
|
+
//
|
|
5191
5241
|
}
|
|
5192
5242
|
|
|
5193
5243
|
/**
|
package/lib/types/tools.d.ts
CHANGED
|
@@ -113,6 +113,7 @@ export type StoreStatsRowDetail = {
|
|
|
113
113
|
* @since v2.2.0
|
|
114
114
|
*/
|
|
115
115
|
export interface Tools {
|
|
116
|
+
//
|
|
116
117
|
/* eslint-disable max-len */
|
|
117
118
|
/**
|
|
118
119
|
* The getStoreStats method provides a set of statistics about the Store, and
|
|
@@ -171,6 +172,7 @@ export interface Tools {
|
|
|
171
172
|
* @since v2.2.0
|
|
172
173
|
*/
|
|
173
174
|
getStoreStats(detail?: boolean): StoreStats;
|
|
175
|
+
|
|
174
176
|
/* eslint-enable max-len */
|
|
175
177
|
|
|
176
178
|
/**
|
|
@@ -481,6 +483,7 @@ export interface Tools {
|
|
|
481
483
|
* @since v3.0.0
|
|
482
484
|
*/
|
|
483
485
|
getStore(): Store;
|
|
486
|
+
//
|
|
484
487
|
}
|
|
485
488
|
|
|
486
489
|
/* eslint-disable max-len */
|
|
@@ -528,4 +531,6 @@ export interface Tools {
|
|
|
528
531
|
* @since v2.2.0
|
|
529
532
|
*/
|
|
530
533
|
export function createTools(store: Store): Tools;
|
|
534
|
+
//
|
|
535
|
+
|
|
531
536
|
/* eslint-enable max-len */
|
|
@@ -51,6 +51,12 @@ export type CheckpointCallback = (checkpointId: Id, label?: string) => void;
|
|
|
51
51
|
* The CheckpointIdsListener type describes a function that is used to listen to
|
|
52
52
|
* changes to the checkpoint Ids in a Checkpoints object.
|
|
53
53
|
*
|
|
54
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
55
|
+
*
|
|
56
|
+
* ```ts override
|
|
57
|
+
* (checkpoints: Checkpoints) => void;
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
54
60
|
* A CheckpointIdsListener is provided when using the addCheckpointIdsListener
|
|
55
61
|
* method. See that method for specific examples.
|
|
56
62
|
*
|
|
@@ -68,6 +74,15 @@ export type CheckpointIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
68
74
|
* The CheckpointListener type describes a function that is used to listen to
|
|
69
75
|
* changes to a checkpoint's label in a Checkpoints object.
|
|
70
76
|
*
|
|
77
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
78
|
+
*
|
|
79
|
+
* ```ts override
|
|
80
|
+
* (
|
|
81
|
+
* checkpoints: Checkpoints,
|
|
82
|
+
* checkpointId: Id,
|
|
83
|
+
* ) => void;
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
71
86
|
* A CheckpointListener is provided when using the addCheckpointListener method.
|
|
72
87
|
* See that method for specific examples.
|
|
73
88
|
*
|
|
@@ -184,6 +199,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
184
199
|
* The setSize method lets you specify how many checkpoints the Checkpoints
|
|
185
200
|
* object will store.
|
|
186
201
|
*
|
|
202
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
203
|
+
*
|
|
204
|
+
* ```ts override
|
|
205
|
+
* setSize(size: number): Checkpoints;
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
187
208
|
* If you set more checkpoints than this size, the oldest checkpoints will be
|
|
188
209
|
* pruned to make room for more recent ones.
|
|
189
210
|
*
|
|
@@ -273,6 +294,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
273
294
|
* The setCheckpoint method updates the label for a checkpoint in the
|
|
274
295
|
* Checkpoints object after it has been created
|
|
275
296
|
*
|
|
297
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
298
|
+
*
|
|
299
|
+
* ```ts override
|
|
300
|
+
* setCheckpoint(checkpointId: Id, label: string): Checkpoints;
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
276
303
|
* The `label` parameter can be used to describe the actions that changed the
|
|
277
304
|
* Store before the given checkpoint. This can be useful for interfaces that
|
|
278
305
|
* let users 'Undo [last action]'.
|
|
@@ -328,6 +355,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
328
355
|
* The getStore method returns a reference to the underlying Store that is
|
|
329
356
|
* backing this Checkpoints object.
|
|
330
357
|
*
|
|
358
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
359
|
+
*
|
|
360
|
+
* ```ts override
|
|
361
|
+
* getStore(): Store;
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
331
364
|
* @returns A reference to the Store.
|
|
332
365
|
* @example
|
|
333
366
|
* This example creates a Checkpoints object against a newly-created Store
|
|
@@ -493,6 +526,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
493
526
|
* Checkpoints object that will be called whenever its set of checkpoints
|
|
494
527
|
* changes.
|
|
495
528
|
*
|
|
529
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
530
|
+
*
|
|
531
|
+
* ```ts override
|
|
532
|
+
* addCheckpointIdsListener(listener: CheckpointIdsListener): Id;
|
|
533
|
+
* ```
|
|
534
|
+
*
|
|
496
535
|
* The provided listener is a CheckpointIdsListener function, and will be
|
|
497
536
|
* called with a reference to the Checkpoints object.
|
|
498
537
|
*
|
|
@@ -543,6 +582,15 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
543
582
|
* Checkpoints object that will be called whenever the label of a checkpoint
|
|
544
583
|
* changes.
|
|
545
584
|
*
|
|
585
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
586
|
+
*
|
|
587
|
+
* ```ts override
|
|
588
|
+
* addCheckpointListener(
|
|
589
|
+
* checkpointId: IdOrNull,
|
|
590
|
+
* listener: CheckpointListener,
|
|
591
|
+
* ): Id;
|
|
592
|
+
* ```
|
|
593
|
+
*
|
|
546
594
|
* You can either listen to a single checkpoint label (by specifying the
|
|
547
595
|
* checkpoint Id as the method's first parameter), or changes to any
|
|
548
596
|
* checkpoint label (by providing a `null` wildcard).
|
|
@@ -605,6 +653,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
605
653
|
* The delListener method removes a listener that was previously added to the
|
|
606
654
|
* Checkpoints object.
|
|
607
655
|
*
|
|
656
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
657
|
+
*
|
|
658
|
+
* ```ts override
|
|
659
|
+
* delListener(listenerId: Id): Checkpoints;
|
|
660
|
+
* ```
|
|
661
|
+
*
|
|
608
662
|
* Use the Id returned by the addCheckpointIdsListener method. Note that the
|
|
609
663
|
* Checkpoints object may re-use this Id for future listeners added to it.
|
|
610
664
|
*
|
|
@@ -645,6 +699,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
645
699
|
* The goBackward method moves the state of the underlying Store back to the
|
|
646
700
|
* previous checkpoint, effectively performing an 'undo' on the Store data.
|
|
647
701
|
*
|
|
702
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
703
|
+
*
|
|
704
|
+
* ```ts override
|
|
705
|
+
* goBackward(): Checkpoints;
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
648
708
|
* If there is no previous checkpoint to return to, this method has no effect.
|
|
649
709
|
*
|
|
650
710
|
* @returns A reference to the Checkpoints object.
|
|
@@ -678,6 +738,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
678
738
|
* The goForward method moves the state of the underlying Store forwards to a
|
|
679
739
|
* future checkpoint, effectively performing an 'redo' on the Store data.
|
|
680
740
|
*
|
|
741
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
742
|
+
*
|
|
743
|
+
* ```ts override
|
|
744
|
+
* goForward(): Checkpoints;
|
|
745
|
+
* ```
|
|
746
|
+
*
|
|
681
747
|
* If there is no future checkpoint to return to, this method has no effect.
|
|
682
748
|
*
|
|
683
749
|
* Note that if you have previously used the goBackward method to undo
|
|
@@ -758,6 +824,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
758
824
|
* The goTo method moves the state of the underlying Store backwards or
|
|
759
825
|
* forwards to a specified checkpoint.
|
|
760
826
|
*
|
|
827
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
828
|
+
*
|
|
829
|
+
* ```ts override
|
|
830
|
+
* goTo(checkpointId: Id): Checkpoints;
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
761
833
|
* If there is no checkpoint with the Id specified, this method has no effect.
|
|
762
834
|
*
|
|
763
835
|
* @param checkpointId The Id of the checkpoint to move to.
|
|
@@ -808,6 +880,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
808
880
|
* The clear method resets this Checkpoints object to its initial state,
|
|
809
881
|
* removing all the checkpoints it has been managing.
|
|
810
882
|
*
|
|
883
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
884
|
+
*
|
|
885
|
+
* ```ts override
|
|
886
|
+
* clear(): Checkpoints;
|
|
887
|
+
* ```
|
|
888
|
+
*
|
|
811
889
|
* Obviously this method should be used with caution as it destroys the
|
|
812
890
|
* ability to undo recent changes to the Store (though of course the Store
|
|
813
891
|
* itself is not reset by this method).
|
|
@@ -930,6 +1008,12 @@ export interface Checkpoints<in out Schemas extends OptionalSchemas> {
|
|
|
930
1008
|
* The createCheckpoints function creates a Checkpoints object, and is the main
|
|
931
1009
|
* entry point into the checkpoints module.
|
|
932
1010
|
*
|
|
1011
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
1012
|
+
*
|
|
1013
|
+
* ```ts override
|
|
1014
|
+
* createCheckpoints(store: Store): Checkpoints;
|
|
1015
|
+
* ```
|
|
1016
|
+
*
|
|
933
1017
|
* A given Store can only have one Checkpoints object associated with it. If you
|
|
934
1018
|
* call this function twice on the same Store, your second call will return a
|
|
935
1019
|
* reference to the Checkpoints object created by the first.
|
|
@@ -54,6 +54,15 @@ export type Slice = Ids;
|
|
|
54
54
|
* The IndexCallback type describes a function that takes an Index's Id and a
|
|
55
55
|
* callback to loop over each Slice within it.
|
|
56
56
|
*
|
|
57
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
58
|
+
*
|
|
59
|
+
* ```ts override
|
|
60
|
+
* (
|
|
61
|
+
* indexId: Id,
|
|
62
|
+
* forEachSlice: (sliceCallback: SliceCallback) => void,
|
|
63
|
+
* ) => void;
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
57
66
|
* A IndexCallback is provided when using the forEachIndex method, so that you
|
|
58
67
|
* can do something based on every Index in the Indexes object. See that method
|
|
59
68
|
* for specific examples.
|
|
@@ -72,6 +81,15 @@ export type IndexCallback<Schema extends OptionalTablesSchema> = (
|
|
|
72
81
|
* The SliceCallback type describes a function that takes a Slice's Id and a
|
|
73
82
|
* callback to loop over each Row within it.
|
|
74
83
|
*
|
|
84
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
85
|
+
*
|
|
86
|
+
* ```ts override
|
|
87
|
+
* (
|
|
88
|
+
* sliceId: Id,
|
|
89
|
+
* forEachRow: (rowCallback: RowCallback) => void,
|
|
90
|
+
* ) => void;
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
75
93
|
* A SliceCallback is provided when using the forEachSlice method, so that you
|
|
76
94
|
* can do something based on every Slice in an Index. See that method for
|
|
77
95
|
* specific examples.
|
|
@@ -90,6 +108,12 @@ export type SliceCallback<Schema extends OptionalTablesSchema> = (
|
|
|
90
108
|
* The SliceIdsListener type describes a function that is used to listen to
|
|
91
109
|
* changes to the Slice Ids in an Index.
|
|
92
110
|
*
|
|
111
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
112
|
+
*
|
|
113
|
+
* ```ts override
|
|
114
|
+
* (indexes: Indexes, indexId: Id) => void;
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
93
117
|
* A SliceIdsListener is provided when using the addSliceIdsListener method. See
|
|
94
118
|
* that method for specific examples.
|
|
95
119
|
*
|
|
@@ -109,6 +133,16 @@ export type SliceIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
109
133
|
* The SliceRowIdsListener type describes a function that is used to listen to
|
|
110
134
|
* changes to the Row Ids in a Slice.
|
|
111
135
|
*
|
|
136
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
137
|
+
*
|
|
138
|
+
* ```ts override
|
|
139
|
+
* (
|
|
140
|
+
* indexes: Indexes,
|
|
141
|
+
* indexId: Id,
|
|
142
|
+
* sliceId: Id,
|
|
143
|
+
* ) => void;
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
112
146
|
* A SliceRowIdsListener is provided when using the addSliceRowIdsListener
|
|
113
147
|
* method. See that method for specific examples.
|
|
114
148
|
*
|
|
@@ -209,6 +243,19 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
209
243
|
/**
|
|
210
244
|
* The setIndexDefinition method lets you set the definition of an Index.
|
|
211
245
|
*
|
|
246
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
247
|
+
*
|
|
248
|
+
* ```ts override
|
|
249
|
+
* setIndexDefinition(
|
|
250
|
+
* indexId: Id,
|
|
251
|
+
* tableId: Id,
|
|
252
|
+
* getSliceIdOrIds?: Id | ((getCell: GetCell, rowId: Id) => Id | Ids),
|
|
253
|
+
* getSortKey?: Id | ((getCell: GetCell, rowId: Id) => SortKey),
|
|
254
|
+
* sliceIdSorter?: (sliceId1: Id, sliceId2: Id) => number,
|
|
255
|
+
* rowIdSorter?: (sortKey1: SortKey, sortKey2: SortKey, sliceId: Id) => number,
|
|
256
|
+
* ): Indexes;
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
212
259
|
* Every Index definition is identified by a unique Id, and if you re-use an
|
|
213
260
|
* existing Id with this method, the previous definition is overwritten.
|
|
214
261
|
*
|
|
@@ -374,6 +421,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
374
421
|
/**
|
|
375
422
|
* The delIndexDefinition method removes an existing Index definition.
|
|
376
423
|
*
|
|
424
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
425
|
+
*
|
|
426
|
+
* ```ts override
|
|
427
|
+
* delIndexDefinition(indexId: Id): Indexes;
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
377
430
|
* @param indexId The Id of the Index to remove.
|
|
378
431
|
* @returns A reference to the Indexes object.
|
|
379
432
|
* @example
|
|
@@ -404,6 +457,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
404
457
|
* The getStore method returns a reference to the underlying Store that is
|
|
405
458
|
* backing this Indexes object.
|
|
406
459
|
*
|
|
460
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
461
|
+
*
|
|
462
|
+
* ```ts override
|
|
463
|
+
* getStore(): Store;
|
|
464
|
+
* ```
|
|
465
|
+
*
|
|
407
466
|
* @returns A reference to the Store.
|
|
408
467
|
* @example
|
|
409
468
|
* This example creates an Indexes object against a newly-created Store and
|
|
@@ -445,6 +504,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
445
504
|
* The forEachIndex method takes a function that it will then call for each
|
|
446
505
|
* Index in a specified Indexes object.
|
|
447
506
|
*
|
|
507
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
508
|
+
*
|
|
509
|
+
* ```ts override
|
|
510
|
+
* forEachIndex(indexCallback: IndexCallback): void;
|
|
511
|
+
* ```
|
|
512
|
+
*
|
|
448
513
|
* This method is useful for iterating over the structure of the Indexes
|
|
449
514
|
* object in a functional style. The `indexCallback` parameter is a
|
|
450
515
|
* IndexCallback function that will be called with the Id of each Index, and
|
|
@@ -485,6 +550,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
485
550
|
* The forEachSlice method takes a function that it will then call for each
|
|
486
551
|
* Slice in a specified Index.
|
|
487
552
|
*
|
|
553
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
554
|
+
*
|
|
555
|
+
* ```ts override
|
|
556
|
+
* forEachSlice(indexId: Id, sliceCallback: SliceCallback): void;
|
|
557
|
+
* ```
|
|
558
|
+
*
|
|
488
559
|
* This method is useful for iterating over the Slice structure of the Index
|
|
489
560
|
* in a functional style. The `rowCallback` parameter is a RowCallback
|
|
490
561
|
* function that will be called with the Id and value of each Row in the
|
|
@@ -570,6 +641,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
570
641
|
* The getTableId method returns the Id of the underlying Table that is
|
|
571
642
|
* backing an Index.
|
|
572
643
|
*
|
|
644
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
645
|
+
*
|
|
646
|
+
* ```ts override
|
|
647
|
+
* getTableId(indexId: Id): Id | undefined;
|
|
648
|
+
* ```
|
|
649
|
+
*
|
|
573
650
|
* If the Index Id is invalid, the method returns `undefined`.
|
|
574
651
|
*
|
|
575
652
|
* @param indexId The Id of an Index.
|
|
@@ -666,6 +743,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
666
743
|
* Indexes object that will be called whenever the Slice Ids in an Index
|
|
667
744
|
* change.
|
|
668
745
|
*
|
|
746
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
747
|
+
*
|
|
748
|
+
* ```ts override
|
|
749
|
+
* addSliceIdsListener(indexId: IdOrNull, listener: SliceIdsListener): Id;
|
|
750
|
+
* ```
|
|
751
|
+
*
|
|
669
752
|
* You can either listen to a single Index (by specifying the Index Id as the
|
|
670
753
|
* method's first parameter), or changes to any Index (by providing a `null`
|
|
671
754
|
* wildcard).
|
|
@@ -748,6 +831,16 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
748
831
|
* The addSliceRowIdsListener method registers a listener function with the
|
|
749
832
|
* Indexes object that will be called whenever the Row Ids in a Slice change.
|
|
750
833
|
*
|
|
834
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
835
|
+
*
|
|
836
|
+
* ```ts override
|
|
837
|
+
* addSliceRowIdsListener(
|
|
838
|
+
* indexId: IdOrNull,
|
|
839
|
+
* sliceId: IdOrNull,
|
|
840
|
+
* listener: SliceRowIdsListener,
|
|
841
|
+
* ): Id;
|
|
842
|
+
* ```
|
|
843
|
+
*
|
|
751
844
|
* You can either listen to a single Slice (by specifying the Index Id and
|
|
752
845
|
* Slice Id as the method's first two parameters), or changes to any Slice (by
|
|
753
846
|
* providing `null` wildcards).
|
|
@@ -841,6 +934,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
841
934
|
* The delListener method removes a listener that was previously added to the
|
|
842
935
|
* Indexes object.
|
|
843
936
|
*
|
|
937
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
938
|
+
*
|
|
939
|
+
* ```ts override
|
|
940
|
+
* delListener(listenerId: Id): Indexes;
|
|
941
|
+
* ```
|
|
942
|
+
*
|
|
844
943
|
* Use the Id returned by whichever method was used to add the listener. Note
|
|
845
944
|
* that the Indexes object may re-use this Id for future listeners added to
|
|
846
945
|
* it.
|
|
@@ -954,6 +1053,12 @@ export interface Indexes<in out Schemas extends OptionalSchemas> {
|
|
|
954
1053
|
* The createIndexes function creates an Indexes object, and is the main entry
|
|
955
1054
|
* point into the indexes module.
|
|
956
1055
|
*
|
|
1056
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
1057
|
+
*
|
|
1058
|
+
* ```ts override
|
|
1059
|
+
* createIndexes(store: Store): Indexes;
|
|
1060
|
+
* ```
|
|
1061
|
+
*
|
|
957
1062
|
* A given Store can only have one Indexes object associated with it. If you
|
|
958
1063
|
* call this function twice on the same Store, your second call will return a
|
|
959
1064
|
* reference to the Indexes object created by the first.
|
|
@@ -152,6 +152,17 @@ export type MetricAggregateReplace = (
|
|
|
152
152
|
* The MetricListener type describes a function that is used to listen to
|
|
153
153
|
* changes to a Metric.
|
|
154
154
|
*
|
|
155
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
156
|
+
*
|
|
157
|
+
* ```ts override
|
|
158
|
+
* (
|
|
159
|
+
* metrics: Metrics,
|
|
160
|
+
* metricId: Id,
|
|
161
|
+
* newMetric: Metric | undefined,
|
|
162
|
+
* oldMetric: Metric | undefined,
|
|
163
|
+
* ) => void;
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
155
166
|
* A MetricListener is provided when using the addMetricListener method. See
|
|
156
167
|
* that method for specific examples.
|
|
157
168
|
*
|
|
@@ -250,6 +261,20 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
250
261
|
/**
|
|
251
262
|
* The setMetricDefinition method lets you set the definition of a Metric.
|
|
252
263
|
*
|
|
264
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
265
|
+
*
|
|
266
|
+
* ```ts override
|
|
267
|
+
* setMetricDefinition(
|
|
268
|
+
* metricId: Id,
|
|
269
|
+
* tableId: Id,
|
|
270
|
+
* aggregate?: 'sum' | 'avg' | 'min' | 'max' | MetricAggregate,
|
|
271
|
+
* getNumber?: Id | ((getCell: GetCell, rowId: Id) => number),
|
|
272
|
+
* aggregateAdd?: MetricAggregateAdd,
|
|
273
|
+
* aggregateRemove?: MetricAggregateRemove,
|
|
274
|
+
* aggregateReplace?: MetricAggregateReplace,
|
|
275
|
+
* ): Metrics;
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
253
278
|
* Every Metric definition is identified by a unique Id, and if you re-use an
|
|
254
279
|
* existing Id with this method, the previous definition is overwritten.
|
|
255
280
|
*
|
|
@@ -427,6 +452,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
427
452
|
/**
|
|
428
453
|
* The delMetricDefinition method removes an existing Metric definition.
|
|
429
454
|
*
|
|
455
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
456
|
+
*
|
|
457
|
+
* ```ts override
|
|
458
|
+
* delMetricDefinition(metricId: Id): Metrics;
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
430
461
|
* @param metricId The Id of the Metric to remove.
|
|
431
462
|
* @returns A reference to the Metrics object.
|
|
432
463
|
* @example
|
|
@@ -457,6 +488,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
457
488
|
* The getStore method returns a reference to the underlying Store that is
|
|
458
489
|
* backing this Metrics object.
|
|
459
490
|
*
|
|
491
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
492
|
+
*
|
|
493
|
+
* ```ts override
|
|
494
|
+
* getStore(): Store;
|
|
495
|
+
* ```
|
|
496
|
+
*
|
|
460
497
|
* @returns A reference to the Store.
|
|
461
498
|
* @example
|
|
462
499
|
* This example creates a Metrics object against a newly-created Store and
|
|
@@ -556,6 +593,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
556
593
|
* The getTableId method returns the Id of the underlying Table that is
|
|
557
594
|
* backing a Metric.
|
|
558
595
|
*
|
|
596
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
597
|
+
*
|
|
598
|
+
* ```ts override
|
|
599
|
+
* getTableId(metricId: Id): Id | undefined;
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
559
602
|
* If the Metric Id is invalid, the method returns `undefined`.
|
|
560
603
|
*
|
|
561
604
|
* @param metricId The Id of a Metric.
|
|
@@ -617,6 +660,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
617
660
|
* object that will be called whenever the value of a specified Metric
|
|
618
661
|
* changes.
|
|
619
662
|
*
|
|
663
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
664
|
+
*
|
|
665
|
+
* ```ts override
|
|
666
|
+
* addMetricListener(metricId: IdOrNull, listener: MetricListener): Id;
|
|
667
|
+
* ```
|
|
668
|
+
*
|
|
620
669
|
* You can either listen to a single Metric (by specifying the Metric Id as
|
|
621
670
|
* the method's first parameter), or changes to any Metric (by providing a
|
|
622
671
|
* `null` wildcard).
|
|
@@ -696,6 +745,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
696
745
|
* The delListener method removes a listener that was previously added to the
|
|
697
746
|
* Metrics object.
|
|
698
747
|
*
|
|
748
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
749
|
+
*
|
|
750
|
+
* ```ts override
|
|
751
|
+
* delListener(listenerId: Id): Metrics;
|
|
752
|
+
* ```
|
|
753
|
+
*
|
|
699
754
|
* Use the Id returned by the addMetricListener method. Note that the Metrics
|
|
700
755
|
* object may re-use this Id for future listeners added to it.
|
|
701
756
|
*
|
|
@@ -800,6 +855,12 @@ export interface Metrics<in out Schemas extends OptionalSchemas> {
|
|
|
800
855
|
* The createMetrics function creates a Metrics object, and is the main entry
|
|
801
856
|
* point into the metrics module.
|
|
802
857
|
*
|
|
858
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
859
|
+
*
|
|
860
|
+
* ```ts override
|
|
861
|
+
* createMetrics(store: Store): Metrics;
|
|
862
|
+
* ```
|
|
863
|
+
*
|
|
803
864
|
* A given Store can only have one Metrics object associated with it. If you
|
|
804
865
|
* call this function twice on the same Store, your second call will return a
|
|
805
866
|
* reference to the Metrics object created by the first.
|