tinybase 3.1.0-beta.3 → 3.1.0-beta.4

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.
Files changed (72) hide show
  1. package/bin/cli.js +1 -1
  2. package/lib/checkpoints.d.ts +13 -11
  3. package/lib/cjs/checkpoints.d.ts +13 -11
  4. package/lib/cjs/indexes.d.ts +15 -7
  5. package/lib/cjs/metrics.d.ts +9 -7
  6. package/lib/cjs/persisters.d.ts +30 -24
  7. package/lib/cjs/queries.d.ts +10 -6
  8. package/lib/cjs/relationships.d.ts +15 -7
  9. package/lib/cjs/store.d.ts +1190 -291
  10. package/lib/cjs/tools.cjs +1 -1
  11. package/lib/cjs/tools.cjs.gz +0 -0
  12. package/lib/cjs/tools.d.ts +12 -178
  13. package/lib/cjs-es6/checkpoints.d.ts +13 -11
  14. package/lib/cjs-es6/indexes.d.ts +15 -7
  15. package/lib/cjs-es6/metrics.d.ts +9 -7
  16. package/lib/cjs-es6/persisters.d.ts +30 -24
  17. package/lib/cjs-es6/queries.d.ts +10 -6
  18. package/lib/cjs-es6/relationships.d.ts +15 -7
  19. package/lib/cjs-es6/store.d.ts +1190 -291
  20. package/lib/cjs-es6/tools.cjs +1 -1
  21. package/lib/cjs-es6/tools.cjs.gz +0 -0
  22. package/lib/cjs-es6/tools.d.ts +12 -178
  23. package/lib/debug/checkpoints.d.ts +13 -11
  24. package/lib/debug/indexes.d.ts +15 -7
  25. package/lib/debug/metrics.d.ts +9 -7
  26. package/lib/debug/persisters.d.ts +30 -24
  27. package/lib/debug/queries.d.ts +10 -6
  28. package/lib/debug/relationships.d.ts +15 -7
  29. package/lib/debug/store.d.ts +1190 -291
  30. package/lib/debug/tools.d.ts +12 -178
  31. package/lib/debug/tools.js +14 -621
  32. package/lib/es6/checkpoints.d.ts +13 -11
  33. package/lib/es6/indexes.d.ts +15 -7
  34. package/lib/es6/metrics.d.ts +9 -7
  35. package/lib/es6/persisters.d.ts +30 -24
  36. package/lib/es6/queries.d.ts +10 -6
  37. package/lib/es6/relationships.d.ts +15 -7
  38. package/lib/es6/store.d.ts +1190 -291
  39. package/lib/es6/tools.d.ts +12 -178
  40. package/lib/es6/tools.js +1 -1
  41. package/lib/es6/tools.js.gz +0 -0
  42. package/lib/indexes.d.ts +15 -7
  43. package/lib/metrics.d.ts +9 -7
  44. package/lib/persisters.d.ts +30 -24
  45. package/lib/queries.d.ts +10 -6
  46. package/lib/relationships.d.ts +15 -7
  47. package/lib/store.d.ts +1190 -291
  48. package/lib/tools.d.ts +12 -178
  49. package/lib/tools.js +1 -1
  50. package/lib/tools.js.gz +0 -0
  51. package/lib/umd/checkpoints.d.ts +13 -11
  52. package/lib/umd/indexes.d.ts +15 -7
  53. package/lib/umd/metrics.d.ts +9 -7
  54. package/lib/umd/persisters.d.ts +30 -24
  55. package/lib/umd/queries.d.ts +10 -6
  56. package/lib/umd/relationships.d.ts +15 -7
  57. package/lib/umd/store.d.ts +1190 -291
  58. package/lib/umd/tools.d.ts +12 -178
  59. package/lib/umd/tools.js +1 -1
  60. package/lib/umd/tools.js.gz +0 -0
  61. package/lib/umd-es6/checkpoints.d.ts +13 -11
  62. package/lib/umd-es6/indexes.d.ts +15 -7
  63. package/lib/umd-es6/metrics.d.ts +9 -7
  64. package/lib/umd-es6/persisters.d.ts +30 -24
  65. package/lib/umd-es6/queries.d.ts +10 -6
  66. package/lib/umd-es6/relationships.d.ts +15 -7
  67. package/lib/umd-es6/store.d.ts +1190 -291
  68. package/lib/umd-es6/tools.d.ts +12 -178
  69. package/lib/umd-es6/tools.js +1 -1
  70. package/lib/umd-es6/tools.js.gz +0 -0
  71. package/package.json +20 -20
  72. package/readme.md +1 -1
package/bin/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- import{resolve as e,dirname as t}from"path";import{readFileSync as r,writeFileSync as i}from"fs";import{createStore as a}from"tinybase";import{createTools as s}from"tinybase/tools";import{fileURLToPath as n}from"url";const o=JSON.parse,m=Object,c="provide a valid schemaFile, storeName, and outputDir",p=(...e)=>{return t=e=>process.stdout.write(e+"\n"),e.forEach(t);var t},f=e=>process.stderr.write(`ERROR: ${e}\n`),d=e=>o(r(e,"utf8")),l=(t,r,a,s)=>{const n=e(t,r);p(s.padStart(23)+": "+n),i(n,a,"utf8")},u=e=>{const t=d(e);return s(a().setSchema(...(r=t,Array.isArray(r)?t:[t])));var r},h=()=>{var e,t;p("","tinybase <command>","","Usage:",""),e=y,t=([,e,t],r)=>p(` tinybase ${r} ${e}`," - "+t,""),((e,t)=>{e.map(t)})(m.entries(e),(([e,r])=>t(r,e))),p("See also http://tinybase.org/guides/developer-tools/command-line/","")},y={help:[h,"","print this message"],version:[()=>p(d(e(t(n(import.meta.url)),"../package.json")).version),"","get the current TinyBase version"],getStoreApi:[async(e,t,r)=>{try{const[i,a,s,n]=await u(e).getPrettyStoreApi(t);l(r,t+".d.ts",i,"Definition"),l(r,t+".ts",a,"Implementation"),l(r,t+"-ui-react.d.ts",s,"UI React definition"),l(r,t+"-ui-react.tsx",n,"UI React implementation")}catch{f(c)}},"<schemaFile> <storeName> <outputDir>","generate .d.ts, .ts, and .tsx API files from a schema file"],getStoreRefinement:[async(e,t,r)=>{try{const[i,a]=await u(e).getPrettyStoreRefinement(t);l(r,t+"-refinement.d.ts",i,"Definition"),l(r,t+"-ui-react-refinement.d.ts",a,"UI React definition")}catch{f(c)}},"<schemaFile> <storeName> <outputDir>","generate .d.ts refinement files from a schema file"]};(()=>{const[,,e,...t]=process.argv;(y[e]?.[0]??h)(...t)})();
2
+ import{resolve as t,dirname as e}from"path";import{readFileSync as r,writeFileSync as s}from"fs";import{createStore as a}from"tinybase";import{createTools as o}from"tinybase/tools";import{fileURLToPath as i}from"url";const n=JSON.parse,m=Object,c=(...t)=>{return e=t=>process.stdout.write(t+"\n"),t.forEach(e);var e},p=t=>n(r(t,"utf8")),d=(e,r,a,o)=>{const i=t(e,r);c(o.padStart(23)+": "+i),s(i,a,"utf8")},l=()=>{var t,e;c("","tinybase <command>","","Usage:",""),t=u,e=([,t,e],r)=>c(` tinybase ${r} ${t}`," - "+e,""),((t,e)=>{t.map(e)})(m.entries(t),(([t,r])=>e(r,t))),c("See also http://tinybase.org/guides/developer-tools/command-line/","")},u={help:[l,"","print this message"],version:[()=>c(p(t(e(i(import.meta.url)),"../package.json")).version),"","get the current TinyBase version"],getStoreApi:[async(t,e,r)=>{try{const[s,i,n,m]=await(t=>{const e=p(t);return o(a().setSchema(...(r=e,Array.isArray(r)?e:[e])));var r})(t).getPrettyStoreApi(e);d(r,e+".d.ts",s,"Definition"),d(r,e+".ts",i,"Implementation"),d(r,e+"-ui-react.d.ts",n,"UI React definition"),d(r,e+"-ui-react.tsx",m,"UI React implementation")}catch{process.stderr.write("ERROR: provide a valid schemaFile, storeName, and outputDir\n")}},"<schemaFile> <storeName> <outputDir>","generate .d.ts, .ts, and .tsx API files from a schema file"]};(()=>{const[,,t,...e]=process.argv;(u[t]?.[0]??l)(...e)})();
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import {Id, IdOrNull, Ids} from './common.d';
15
- import {Store} from './store.d';
15
+ import {NoSchemas, OptionalSchemas, Store} from './store.d';
16
16
 
17
17
  /**
18
18
  * The CheckpointIds type is a representation of the list of checkpoint Ids
@@ -177,7 +177,7 @@ export type CheckpointsListenerStats = {
177
177
  * @see Drawing demo
178
178
  * @category Checkpoints
179
179
  */
180
- export interface Checkpoints {
180
+ export interface Checkpoints<Schemas extends OptionalSchemas = NoSchemas> {
181
181
  /**
182
182
  * The setSize method lets you specify how many checkpoints the Checkpoints
183
183
  * object will store.
@@ -220,7 +220,7 @@ export interface Checkpoints {
220
220
  * ```
221
221
  * @category Configuration
222
222
  */
223
- setSize(size: number): Checkpoints;
223
+ setSize(size: number): Checkpoints<Schemas>;
224
224
 
225
225
  /**
226
226
  * The addCheckpoint method records a checkpoint of the Store into the
@@ -320,7 +320,7 @@ export interface Checkpoints {
320
320
  * ```
321
321
  * @category Setter
322
322
  */
323
- setCheckpoint(checkpointId: Id, label: string): Checkpoints;
323
+ setCheckpoint(checkpointId: Id, label: string): Checkpoints<Schemas>;
324
324
 
325
325
  /**
326
326
  * The getStore method returns a reference to the underlying Store that is
@@ -341,7 +341,7 @@ export interface Checkpoints {
341
341
  * ```
342
342
  * @category Getter
343
343
  */
344
- getStore(): Store;
344
+ getStore(): Store<Schemas>;
345
345
 
346
346
  /**
347
347
  * The getCheckpointIds method returns an array of the checkpoint Ids being
@@ -637,7 +637,7 @@ export interface Checkpoints {
637
637
  * ```
638
638
  * @category Listener
639
639
  */
640
- delListener(listenerId: Id): Checkpoints;
640
+ delListener(listenerId: Id): Checkpoints<Schemas>;
641
641
 
642
642
  /**
643
643
  * The goBackward method moves the state of the underlying Store back to the
@@ -670,7 +670,7 @@ export interface Checkpoints {
670
670
  * ```
671
671
  * @category Movement
672
672
  */
673
- goBackward(): Checkpoints;
673
+ goBackward(): Checkpoints<Schemas>;
674
674
 
675
675
  /**
676
676
  * The goForward method moves the state of the underlying Store forwards to a
@@ -750,7 +750,7 @@ export interface Checkpoints {
750
750
  * ```
751
751
  * @category Movement
752
752
  */
753
- goForward(): Checkpoints;
753
+ goForward(): Checkpoints<Schemas>;
754
754
 
755
755
  /**
756
756
  * The goTo method moves the state of the underlying Store backwards or
@@ -800,7 +800,7 @@ export interface Checkpoints {
800
800
  * ```
801
801
  * @category Movement
802
802
  */
803
- goTo(checkpointId: Id): Checkpoints;
803
+ goTo(checkpointId: Id): Checkpoints<Schemas>;
804
804
 
805
805
  /**
806
806
  * The clear method resets this Checkpoints object to its initial state,
@@ -858,7 +858,7 @@ export interface Checkpoints {
858
858
  * ```
859
859
  * @category Lifecycle
860
860
  */
861
- clear(): Checkpoints;
861
+ clear(): Checkpoints<Schemas>;
862
862
 
863
863
  /**
864
864
  * The destroy method should be called when this Checkpoints object is no
@@ -956,4 +956,6 @@ export interface Checkpoints {
956
956
  * ```
957
957
  * @category Creation
958
958
  */
959
- export function createCheckpoints(store: Store): Checkpoints;
959
+ export function createCheckpoints<Schemas extends OptionalSchemas>(
960
+ store: Store<Schemas>,
961
+ ): Checkpoints<Schemas>;
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import {Id, IdOrNull, Ids} from './common.d';
15
- import {Store} from './store.d';
15
+ import {NoSchemas, OptionalSchemas, Store} from './store.d';
16
16
 
17
17
  /**
18
18
  * The CheckpointIds type is a representation of the list of checkpoint Ids
@@ -177,7 +177,7 @@ export type CheckpointsListenerStats = {
177
177
  * @see Drawing demo
178
178
  * @category Checkpoints
179
179
  */
180
- export interface Checkpoints {
180
+ export interface Checkpoints<Schemas extends OptionalSchemas = NoSchemas> {
181
181
  /**
182
182
  * The setSize method lets you specify how many checkpoints the Checkpoints
183
183
  * object will store.
@@ -220,7 +220,7 @@ export interface Checkpoints {
220
220
  * ```
221
221
  * @category Configuration
222
222
  */
223
- setSize(size: number): Checkpoints;
223
+ setSize(size: number): Checkpoints<Schemas>;
224
224
 
225
225
  /**
226
226
  * The addCheckpoint method records a checkpoint of the Store into the
@@ -320,7 +320,7 @@ export interface Checkpoints {
320
320
  * ```
321
321
  * @category Setter
322
322
  */
323
- setCheckpoint(checkpointId: Id, label: string): Checkpoints;
323
+ setCheckpoint(checkpointId: Id, label: string): Checkpoints<Schemas>;
324
324
 
325
325
  /**
326
326
  * The getStore method returns a reference to the underlying Store that is
@@ -341,7 +341,7 @@ export interface Checkpoints {
341
341
  * ```
342
342
  * @category Getter
343
343
  */
344
- getStore(): Store;
344
+ getStore(): Store<Schemas>;
345
345
 
346
346
  /**
347
347
  * The getCheckpointIds method returns an array of the checkpoint Ids being
@@ -637,7 +637,7 @@ export interface Checkpoints {
637
637
  * ```
638
638
  * @category Listener
639
639
  */
640
- delListener(listenerId: Id): Checkpoints;
640
+ delListener(listenerId: Id): Checkpoints<Schemas>;
641
641
 
642
642
  /**
643
643
  * The goBackward method moves the state of the underlying Store back to the
@@ -670,7 +670,7 @@ export interface Checkpoints {
670
670
  * ```
671
671
  * @category Movement
672
672
  */
673
- goBackward(): Checkpoints;
673
+ goBackward(): Checkpoints<Schemas>;
674
674
 
675
675
  /**
676
676
  * The goForward method moves the state of the underlying Store forwards to a
@@ -750,7 +750,7 @@ export interface Checkpoints {
750
750
  * ```
751
751
  * @category Movement
752
752
  */
753
- goForward(): Checkpoints;
753
+ goForward(): Checkpoints<Schemas>;
754
754
 
755
755
  /**
756
756
  * The goTo method moves the state of the underlying Store backwards or
@@ -800,7 +800,7 @@ export interface Checkpoints {
800
800
  * ```
801
801
  * @category Movement
802
802
  */
803
- goTo(checkpointId: Id): Checkpoints;
803
+ goTo(checkpointId: Id): Checkpoints<Schemas>;
804
804
 
805
805
  /**
806
806
  * The clear method resets this Checkpoints object to its initial state,
@@ -858,7 +858,7 @@ export interface Checkpoints {
858
858
  * ```
859
859
  * @category Lifecycle
860
860
  */
861
- clear(): Checkpoints;
861
+ clear(): Checkpoints<Schemas>;
862
862
 
863
863
  /**
864
864
  * The destroy method should be called when this Checkpoints object is no
@@ -956,4 +956,6 @@ export interface Checkpoints {
956
956
  * ```
957
957
  * @category Creation
958
958
  */
959
- export function createCheckpoints(store: Store): Checkpoints;
959
+ export function createCheckpoints<Schemas extends OptionalSchemas>(
960
+ store: Store<Schemas>,
961
+ ): Checkpoints<Schemas>;
@@ -11,7 +11,13 @@
11
11
  * @module indexes
12
12
  */
13
13
 
14
- import {GetCell, RowCallback, Store} from './store.d';
14
+ import {
15
+ GetCell,
16
+ NoSchemas,
17
+ OptionalSchemas,
18
+ RowCallback,
19
+ Store,
20
+ } from './store.d';
15
21
  import {Id, IdOrNull, Ids, SortKey} from './common.d';
16
22
 
17
23
  /**
@@ -195,7 +201,7 @@ export type IndexesListenerStats = {
195
201
  * @see Word Frequencies demo
196
202
  * @category Indexes
197
203
  */
198
- export interface Indexes {
204
+ export interface Indexes<Schemas extends OptionalSchemas = NoSchemas> {
199
205
  /**
200
206
  * The setIndexDefinition method lets you set the definition of an Index.
201
207
  *
@@ -355,7 +361,7 @@ export interface Indexes {
355
361
  getSortKey?: Id | ((getCell: GetCell, rowId: Id) => SortKey),
356
362
  sliceIdSorter?: (sliceId1: Id, sliceId2: Id) => number,
357
363
  rowIdSorter?: (sortKey1: SortKey, sortKey2: SortKey, sliceId: Id) => number,
358
- ): Indexes;
364
+ ): Indexes<Schemas>;
359
365
 
360
366
  /**
361
367
  * The delIndexDefinition method removes an existing Index definition.
@@ -384,7 +390,7 @@ export interface Indexes {
384
390
  * ```
385
391
  * @category Configuration
386
392
  */
387
- delIndexDefinition(indexId: Id): Indexes;
393
+ delIndexDefinition(indexId: Id): Indexes<Schemas>;
388
394
 
389
395
  /**
390
396
  * The getStore method returns a reference to the underlying Store that is
@@ -404,7 +410,7 @@ export interface Indexes {
404
410
  * ```
405
411
  * @category Getter
406
412
  */
407
- getStore(): Store;
413
+ getStore(): Store<Schemas>;
408
414
 
409
415
  /**
410
416
  * The getIndexIds method returns an array of the Index Ids registered with
@@ -860,7 +866,7 @@ export interface Indexes {
860
866
  * ```
861
867
  * @category Listener
862
868
  */
863
- delListener(listenerId: Id): Indexes;
869
+ delListener(listenerId: Id): Indexes<Schemas>;
864
870
 
865
871
  /**
866
872
  * The destroy method should be called when this Indexes object is no longer
@@ -963,4 +969,6 @@ export interface Indexes {
963
969
  * ```
964
970
  * @category Creation
965
971
  */
966
- export function createIndexes(store: Store): Indexes;
972
+ export function createIndexes<Schemas extends OptionalSchemas>(
973
+ store: Store<Schemas>,
974
+ ): Indexes<Schemas>;
@@ -11,7 +11,7 @@
11
11
  * @module metrics
12
12
  */
13
13
 
14
- import {GetCell, Store} from './store.d';
14
+ import {GetCell, NoSchemas, OptionalSchemas, Store} from './store.d';
15
15
  import {Id, IdOrNull, Ids} from './common.d';
16
16
 
17
17
  /**
@@ -246,7 +246,7 @@ export type MetricsListenerStats = {
246
246
  * @see Todo App demos
247
247
  * @category Metrics
248
248
  */
249
- export interface Metrics {
249
+ export interface Metrics<Schemas extends OptionalSchemas = NoSchemas> {
250
250
  /**
251
251
  * The setMetricDefinition method lets you set the definition of a Metric.
252
252
  *
@@ -420,7 +420,7 @@ export interface Metrics {
420
420
  aggregateAdd?: AggregateAdd,
421
421
  aggregateRemove?: AggregateRemove,
422
422
  aggregateReplace?: AggregateReplace,
423
- ): Metrics;
423
+ ): Metrics<Schemas>;
424
424
 
425
425
  /**
426
426
  * The delMetricDefinition method removes an existing Metric definition.
@@ -449,7 +449,7 @@ export interface Metrics {
449
449
  * ```
450
450
  * @category Configuration
451
451
  */
452
- delMetricDefinition(metricId: Id): Metrics;
452
+ delMetricDefinition(metricId: Id): Metrics<Schemas>;
453
453
 
454
454
  /**
455
455
  * The getStore method returns a reference to the underlying Store that is
@@ -469,7 +469,7 @@ export interface Metrics {
469
469
  * ```
470
470
  * @category Getter
471
471
  */
472
- getStore(): Store;
472
+ getStore(): Store<Schemas>;
473
473
 
474
474
  /**
475
475
  * The getMetricIds method returns an array of the Metric Ids registered with
@@ -729,7 +729,7 @@ export interface Metrics {
729
729
  * ```
730
730
  * @category Listener
731
731
  */
732
- delListener(listenerId: Id): Metrics;
732
+ delListener(listenerId: Id): Metrics<Schemas>;
733
733
 
734
734
  /**
735
735
  * The destroy method should be called when this Metrics object is no longer
@@ -824,4 +824,6 @@ export interface Metrics {
824
824
  * ```
825
825
  * @category Creation
826
826
  */
827
- export function createMetrics(store: Store): Metrics;
827
+ export function createMetrics<Schemas extends OptionalSchemas>(
828
+ store: Store<Schemas>,
829
+ ): Metrics<Schemas>;
@@ -27,7 +27,7 @@
27
27
  * @module persisters
28
28
  */
29
29
 
30
- import {Store, Tables, Values} from './store.d';
30
+ import {NoSchemas, OptionalSchemas, Store, Tables, Values} from './store.d';
31
31
  import {Callback} from './common.d';
32
32
 
33
33
  /**
@@ -145,7 +145,7 @@ export type PersisterStats = {
145
145
  * ```
146
146
  * @category Persister
147
147
  */
148
- export interface Persister {
148
+ export interface Persister<Schemas extends OptionalSchemas = NoSchemas> {
149
149
  /**
150
150
  * The load method gets persisted data from storage, and loads it into the
151
151
  * Store with which the Persister is associated, once.
@@ -206,7 +206,10 @@ export interface Persister {
206
206
  * ```
207
207
  * @category Load
208
208
  */
209
- load(initialTables?: Tables, initialValues?: Values): Promise<Persister>;
209
+ load(
210
+ initialTables?: Tables<Schemas[0], true>,
211
+ initialValues?: Values,
212
+ ): Promise<Persister<Schemas>>;
210
213
 
211
214
  /**
212
215
  * The startAutoLoad method gets persisted data from storage, and loads it
@@ -263,9 +266,9 @@ export interface Persister {
263
266
  * @category Load
264
267
  */
265
268
  startAutoLoad(
266
- initialTables?: Tables,
269
+ initialTables?: Tables<Schemas[0], true>,
267
270
  initialValues?: Values,
268
- ): Promise<Persister>;
271
+ ): Promise<Persister<Schemas>>;
269
272
 
270
273
  /**
271
274
  * The stopAutoLoad method stops the automatic loading of data from storage
@@ -310,7 +313,7 @@ export interface Persister {
310
313
  * ```
311
314
  * @category Load
312
315
  */
313
- stopAutoLoad(): Persister;
316
+ stopAutoLoad(): Persister<Schemas>;
314
317
 
315
318
  /**
316
319
  * The save method takes data from the Store with which the Persister is
@@ -339,7 +342,7 @@ export interface Persister {
339
342
  * ```
340
343
  * @category Save
341
344
  */
342
- save(): Promise<Persister>;
345
+ save(): Promise<Persister<Schemas>>;
343
346
 
344
347
  /**
345
348
  * The save method takes data from the Store with which the Persister is
@@ -377,7 +380,7 @@ export interface Persister {
377
380
  * ```
378
381
  * @category Save
379
382
  */
380
- startAutoSave(): Promise<Persister>;
383
+ startAutoSave(): Promise<Persister<Schemas>>;
381
384
 
382
385
  /**
383
386
  * The stopAutoSave method stops the automatic save of data to storage
@@ -415,7 +418,7 @@ export interface Persister {
415
418
  * ```
416
419
  * @category Save
417
420
  */
418
- stopAutoSave(): Persister;
421
+ stopAutoSave(): Persister<Schemas>;
419
422
 
420
423
  /**
421
424
  * The getStore method returns a reference to the underlying Store that is
@@ -439,7 +442,7 @@ export interface Persister {
439
442
  * ```
440
443
  * @category Getter
441
444
  */
442
- getStore(): Store;
445
+ getStore(): Store<Schemas>;
443
446
 
444
447
  /**
445
448
  * The destroy method should be called when this Persister object is no longer
@@ -470,7 +473,7 @@ export interface Persister {
470
473
  * ```
471
474
  * @category Lifecycle
472
475
  */
473
- destroy(): Persister;
476
+ destroy(): Persister<Schemas>;
474
477
 
475
478
  /**
476
479
  * The getStats method provides a set of statistics about the Persister, and
@@ -546,10 +549,10 @@ export interface Persister {
546
549
  * ```
547
550
  * @category Creation
548
551
  */
549
- export function createSessionPersister(
550
- store: Store,
552
+ export function createSessionPersister<Schemas extends OptionalSchemas>(
553
+ store: Store<Schemas>,
551
554
  storageName: string,
552
- ): Persister;
555
+ ): Persister<Schemas>;
553
556
 
554
557
  /**
555
558
  * The createLocalPersister function creates a Persister object that can
@@ -579,10 +582,10 @@ export function createSessionPersister(
579
582
  * ```
580
583
  * @category Creation
581
584
  */
582
- export function createLocalPersister(
583
- store: Store,
585
+ export function createLocalPersister<Schemas extends OptionalSchemas>(
586
+ store: Store<Schemas>,
584
587
  storageName: string,
585
- ): Persister;
588
+ ): Persister<Schemas>;
586
589
 
587
590
  /**
588
591
  * The createRemotePersister function creates a Persister object that can
@@ -626,12 +629,12 @@ export function createLocalPersister(
626
629
  * ```
627
630
  * @category Creation
628
631
  */
629
- export function createRemotePersister(
630
- store: Store,
632
+ export function createRemotePersister<Schemas extends OptionalSchemas>(
633
+ store: Store<Schemas>,
631
634
  loadUrl: string,
632
635
  saveUrl: string,
633
636
  autoLoadIntervalSeconds: number,
634
- ): Persister;
637
+ ): Persister<Schemas>;
635
638
 
636
639
  /**
637
640
  * The createFilePersister function creates a Persister object that can persist
@@ -661,7 +664,10 @@ export function createRemotePersister(
661
664
  * ```
662
665
  * @category Creation
663
666
  */
664
- export function createFilePersister(store: Store, filePath: string): Persister;
667
+ export function createFilePersister<Schemas extends OptionalSchemas>(
668
+ store: Store<Schemas>,
669
+ filePath: string,
670
+ ): Persister<Schemas>;
665
671
 
666
672
  /**
667
673
  * The createCustomPersister function creates a Persister object that you can
@@ -718,10 +724,10 @@ export function createFilePersister(store: Store, filePath: string): Persister;
718
724
  * ```
719
725
  * @category Creation
720
726
  */
721
- export function createCustomPersister(
722
- store: Store,
727
+ export function createCustomPersister<Schemas extends OptionalSchemas>(
728
+ store: Store<Schemas>,
723
729
  getPersisted: () => Promise<string | null | undefined>,
724
730
  setPersisted: (json: string) => Promise<void>,
725
731
  startListeningToPersisted: (didChange: Callback) => void,
726
732
  stopListeningToPersisted: Callback,
727
- ): Persister;
733
+ ): Persister<Schemas>;
@@ -18,6 +18,8 @@ import {
18
18
  CellOrUndefined,
19
19
  GetCell,
20
20
  GetCellChange,
21
+ NoSchemas,
22
+ OptionalSchemas,
21
23
  Row,
22
24
  RowCallback,
23
25
  Store,
@@ -1427,7 +1429,7 @@ export type Having = {
1427
1429
  * @category Queries
1428
1430
  * @since v2.0.0
1429
1431
  */
1430
- export interface Queries {
1432
+ export interface Queries<Schemas extends OptionalSchemas = NoSchemas> {
1431
1433
  /**
1432
1434
  * The setQueryDefinition method lets you set the definition of a query.
1433
1435
  *
@@ -1501,7 +1503,7 @@ export interface Queries {
1501
1503
  group: Group;
1502
1504
  having: Having;
1503
1505
  }) => void,
1504
- ): Queries;
1506
+ ): Queries<Schemas>;
1505
1507
 
1506
1508
  /**
1507
1509
  * The delQueryDefinition method removes an existing query definition.
@@ -1534,7 +1536,7 @@ export interface Queries {
1534
1536
  * @category Configuration
1535
1537
  * @since v2.0.0
1536
1538
  */
1537
- delQueryDefinition(queryId: Id): Queries;
1539
+ delQueryDefinition(queryId: Id): Queries<Schemas>;
1538
1540
 
1539
1541
  /**
1540
1542
  * The getStore method returns a reference to the underlying Store that is
@@ -1560,7 +1562,7 @@ export interface Queries {
1560
1562
  * @category Getter
1561
1563
  * @since v2.0.0
1562
1564
  */
1563
- getStore(): Store;
1565
+ getStore(): Store<Schemas>;
1564
1566
 
1565
1567
  /**
1566
1568
  * The getQueryIds method returns an array of the query Ids registered with
@@ -2919,7 +2921,7 @@ export interface Queries {
2919
2921
  * @category Listener
2920
2922
  * @since v2.0.0
2921
2923
  */
2922
- delListener(listenerId: Id): Queries;
2924
+ delListener(listenerId: Id): Queries<Schemas>;
2923
2925
 
2924
2926
  /**
2925
2927
  * The destroy method should be called when this Queries object is no longer
@@ -3021,4 +3023,6 @@ export interface Queries {
3021
3023
  * @category Creation
3022
3024
  * @since v2.0.0
3023
3025
  */
3024
- export function createQueries(store: Store): Queries;
3026
+ export function createQueries<Schemas extends OptionalSchemas>(
3027
+ store: Store<Schemas>,
3028
+ ): Queries<Schemas>;
@@ -11,7 +11,13 @@
11
11
  * @module relationships
12
12
  */
13
13
 
14
- import {GetCell, RowCallback, Store} from './store.d';
14
+ import {
15
+ GetCell,
16
+ NoSchemas,
17
+ OptionalSchemas,
18
+ RowCallback,
19
+ Store,
20
+ } from './store.d';
15
21
  import {Id, IdOrNull, Ids} from './common.d';
16
22
 
17
23
  /**
@@ -247,7 +253,7 @@ export type RelationshipsListenerStats = {
247
253
  * @see Drawing demo
248
254
  * @category Relationships
249
255
  */
250
- export interface Relationships {
256
+ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
251
257
  /**
252
258
  * The setRelationshipDefinition method lets you set the definition of a
253
259
  * Relationship.
@@ -339,7 +345,7 @@ export interface Relationships {
339
345
  localTableId: Id,
340
346
  remoteTableId: Id,
341
347
  getRemoteRowId: Id | ((getCell: GetCell, localRowId: Id) => Id),
342
- ): Relationships;
348
+ ): Relationships<Schemas>;
343
349
 
344
350
  /**
345
351
  * The delRelationshipDefinition method removes an existing Relationship
@@ -379,7 +385,7 @@ export interface Relationships {
379
385
  * ```
380
386
  * @category Configuration
381
387
  */
382
- delRelationshipDefinition(relationshipId: Id): Relationships;
388
+ delRelationshipDefinition(relationshipId: Id): Relationships<Schemas>;
383
389
 
384
390
  /**
385
391
  * The getStore method returns a reference to the underlying Store that is
@@ -404,7 +410,7 @@ export interface Relationships {
404
410
  * ```
405
411
  * @category Getter
406
412
  */
407
- getStore(): Store;
413
+ getStore(): Store<Schemas>;
408
414
 
409
415
  /**
410
416
  * The getRelationshipIds method returns an array of the Relationship Ids
@@ -1081,7 +1087,7 @@ export interface Relationships {
1081
1087
  * ```
1082
1088
  * @category Listener
1083
1089
  */
1084
- delListener(listenerId: Id): Relationships;
1090
+ delListener(listenerId: Id): Relationships<Schemas>;
1085
1091
 
1086
1092
  /**
1087
1093
  * The destroy method should be called when this Relationships object is no
@@ -1198,4 +1204,6 @@ export interface Relationships {
1198
1204
  * ```
1199
1205
  * @category Creation
1200
1206
  */
1201
- export function createRelationships(store: Store): Relationships;
1207
+ export function createRelationships<Schemas extends OptionalSchemas>(
1208
+ store: Store<Schemas>,
1209
+ ): Relationships<Schemas>;