tinybase 3.1.0-beta.5 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/lib/checkpoints.js +1 -1
  2. package/lib/checkpoints.js.gz +0 -0
  3. package/lib/cjs/checkpoints.cjs +1 -1
  4. package/lib/cjs/checkpoints.cjs.gz +0 -0
  5. package/lib/cjs/indexes.cjs +1 -1
  6. package/lib/cjs/indexes.cjs.gz +0 -0
  7. package/lib/cjs/metrics.cjs +1 -1
  8. package/lib/cjs/metrics.cjs.gz +0 -0
  9. package/lib/cjs/relationships.cjs +1 -1
  10. package/lib/cjs/relationships.cjs.gz +0 -0
  11. package/lib/cjs/store.cjs +1 -1
  12. package/lib/cjs/store.cjs.gz +0 -0
  13. package/lib/cjs/tinybase.cjs +1 -1
  14. package/lib/cjs/tinybase.cjs.gz +0 -0
  15. package/lib/cjs/tools.cjs +1 -1
  16. package/lib/cjs/tools.cjs.gz +0 -0
  17. package/lib/cjs/ui-react.cjs +1 -1
  18. package/lib/cjs/ui-react.cjs.gz +0 -0
  19. package/lib/cjs-es6/checkpoints.cjs +1 -1
  20. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  21. package/lib/cjs-es6/indexes.cjs +1 -1
  22. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  23. package/lib/cjs-es6/metrics.cjs +1 -1
  24. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  25. package/lib/cjs-es6/relationships.cjs +1 -1
  26. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  27. package/lib/cjs-es6/store.cjs +1 -1
  28. package/lib/cjs-es6/store.cjs.gz +0 -0
  29. package/lib/cjs-es6/tinybase.cjs +1 -1
  30. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  31. package/lib/cjs-es6/tools.cjs +1 -1
  32. package/lib/cjs-es6/tools.cjs.gz +0 -0
  33. package/lib/cjs-es6/ui-react.cjs +1 -1
  34. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  35. package/lib/debug/checkpoints.js +2 -2
  36. package/lib/debug/indexes.js +2 -2
  37. package/lib/debug/metrics.js +2 -2
  38. package/lib/debug/relationships.js +2 -2
  39. package/lib/debug/store.js +7 -7
  40. package/lib/debug/tinybase.js +7 -7
  41. package/lib/debug/tools.js +5 -4
  42. package/lib/debug/ui-react.js +3 -2
  43. package/lib/es6/checkpoints.js +1 -1
  44. package/lib/es6/checkpoints.js.gz +0 -0
  45. package/lib/es6/indexes.js +1 -1
  46. package/lib/es6/indexes.js.gz +0 -0
  47. package/lib/es6/metrics.js +1 -1
  48. package/lib/es6/metrics.js.gz +0 -0
  49. package/lib/es6/relationships.js +1 -1
  50. package/lib/es6/relationships.js.gz +0 -0
  51. package/lib/es6/store.js +1 -1
  52. package/lib/es6/store.js.gz +0 -0
  53. package/lib/es6/tinybase.js +1 -1
  54. package/lib/es6/tinybase.js.gz +0 -0
  55. package/lib/es6/tools.js +1 -1
  56. package/lib/es6/tools.js.gz +0 -0
  57. package/lib/es6/ui-react.js +1 -1
  58. package/lib/es6/ui-react.js.gz +0 -0
  59. package/lib/indexes.js +1 -1
  60. package/lib/indexes.js.gz +0 -0
  61. package/lib/metrics.js +1 -1
  62. package/lib/metrics.js.gz +0 -0
  63. package/lib/relationships.js +1 -1
  64. package/lib/relationships.js.gz +0 -0
  65. package/lib/store.js +1 -1
  66. package/lib/store.js.gz +0 -0
  67. package/lib/tinybase.js +1 -1
  68. package/lib/tinybase.js.gz +0 -0
  69. package/lib/tools.js +1 -1
  70. package/lib/tools.js.gz +0 -0
  71. package/lib/types/checkpoints.d.ts +2 -0
  72. package/lib/types/indexes.d.ts +2 -0
  73. package/lib/types/metrics.d.ts +2 -0
  74. package/lib/types/persisters.d.ts +2 -0
  75. package/lib/types/queries.d.ts +2 -0
  76. package/lib/types/relationships.d.ts +2 -0
  77. package/lib/types/store.d.ts +60 -1
  78. package/lib/types/tools.d.ts +5 -0
  79. package/lib/types/ui-react.d.ts +11 -0
  80. package/lib/types/with-schemas/checkpoints.d.ts +84 -0
  81. package/lib/types/with-schemas/indexes.d.ts +105 -0
  82. package/lib/types/with-schemas/metrics.d.ts +61 -0
  83. package/lib/types/with-schemas/persisters.d.ts +98 -0
  84. package/lib/types/with-schemas/queries.d.ts +258 -0
  85. package/lib/types/with-schemas/relationships.d.ts +122 -0
  86. package/lib/types/with-schemas/store.d.ts +742 -8
  87. package/lib/types/with-schemas/tools.d.ts +14 -0
  88. package/lib/types/with-schemas/ui-react.d.ts +1066 -0
  89. package/lib/ui-react.js +1 -1
  90. package/lib/ui-react.js.gz +0 -0
  91. package/lib/umd/checkpoints.js +1 -1
  92. package/lib/umd/checkpoints.js.gz +0 -0
  93. package/lib/umd/indexes.js +1 -1
  94. package/lib/umd/indexes.js.gz +0 -0
  95. package/lib/umd/metrics.js +1 -1
  96. package/lib/umd/metrics.js.gz +0 -0
  97. package/lib/umd/relationships.js +1 -1
  98. package/lib/umd/relationships.js.gz +0 -0
  99. package/lib/umd/store.js +1 -1
  100. package/lib/umd/store.js.gz +0 -0
  101. package/lib/umd/tinybase.js +1 -1
  102. package/lib/umd/tinybase.js.gz +0 -0
  103. package/lib/umd/tools.js +1 -1
  104. package/lib/umd/tools.js.gz +0 -0
  105. package/lib/umd/ui-react.js +1 -1
  106. package/lib/umd/ui-react.js.gz +0 -0
  107. package/lib/umd-es6/checkpoints.js +1 -1
  108. package/lib/umd-es6/checkpoints.js.gz +0 -0
  109. package/lib/umd-es6/indexes.js +1 -1
  110. package/lib/umd-es6/indexes.js.gz +0 -0
  111. package/lib/umd-es6/metrics.js +1 -1
  112. package/lib/umd-es6/metrics.js.gz +0 -0
  113. package/lib/umd-es6/relationships.js +1 -1
  114. package/lib/umd-es6/relationships.js.gz +0 -0
  115. package/lib/umd-es6/store.js +1 -1
  116. package/lib/umd-es6/store.js.gz +0 -0
  117. package/lib/umd-es6/tinybase.js +1 -1
  118. package/lib/umd-es6/tinybase.js.gz +0 -0
  119. package/lib/umd-es6/tools.js +1 -1
  120. package/lib/umd-es6/tools.js.gz +0 -0
  121. package/lib/umd-es6/ui-react.js +1 -1
  122. package/lib/umd-es6/ui-react.js.gz +0 -0
  123. package/package.json +2 -2
  124. package/readme.md +14 -14
@@ -50,6 +50,15 @@ export type Relationship = {
50
50
  * The RelationshipCallback type describes a function that takes a
51
51
  * Relationship's Id and a callback to loop over each local Row within it.
52
52
  *
53
+ * This has schema-based typing. The following is a simplified representation:
54
+ *
55
+ * ```ts override
56
+ * (
57
+ * relationshipId: Id,
58
+ * forEachRow: (rowCallback: RowCallback) => void,
59
+ * ) => void;
60
+ * ```
61
+ *
53
62
  * A RelationshipCallback is provided when using the forEachRelationship method,
54
63
  * so that you can do something based on every Relationship in the Relationships
55
64
  * object. See that method for specific examples.
@@ -69,6 +78,16 @@ export type RelationshipCallback<Schema extends OptionalTablesSchema> = (
69
78
  * The RemoteRowIdListener type describes a function that is used to listen to
70
79
  * changes to the remote Row Id end of a Relationship.
71
80
  *
81
+ * This has schema-based typing. The following is a simplified representation:
82
+ *
83
+ * ```ts override
84
+ * (
85
+ * relationships: Relationships,
86
+ * relationshipId: Id,
87
+ * localRowId: Id,
88
+ * ) => void;
89
+ * ```
90
+ *
72
91
  * A RemoteRowIdListener is provided when using the addRemoteRowIdListener
73
92
  * method. See that method for specific examples.
74
93
  *
@@ -91,6 +110,16 @@ export type RemoteRowIdListener<Schemas extends OptionalSchemas> = (
91
110
  * The LocalRowIdsListener type describes a function that is used to listen to
92
111
  * changes to the local Row Id ends of a Relationship.
93
112
  *
113
+ * This has schema-based typing. The following is a simplified representation:
114
+ *
115
+ * ```ts override
116
+ * (
117
+ * relationships: Relationships,
118
+ * relationshipId: Id,
119
+ * remoteRowId: Id,
120
+ * ) => void;
121
+ * ```
122
+ *
94
123
  * A LocalRowIdsListener is provided when using the addLocalRowIdsListener
95
124
  * method. See that method for specific examples.
96
125
  *
@@ -113,6 +142,16 @@ export type LocalRowIdsListener<Schemas extends OptionalSchemas> = (
113
142
  * The LinkedRowIdsListener type describes a function that is used to listen to
114
143
  * changes to the local Row Id ends of a Relationship.
115
144
  *
145
+ * This has schema-based typing. The following is a simplified representation:
146
+ *
147
+ * ```ts override
148
+ * (
149
+ * relationships: Relationships,
150
+ * relationshipId: Id,
151
+ * firstRowId: Id,
152
+ * ) => void;
153
+ * ```
154
+ *
116
155
  * A LinkedRowIdsListener is provided when using the addLinkedRowIdsListener
117
156
  * method. See that method for specific examples.
118
157
  *
@@ -259,6 +298,17 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
259
298
  * The setRelationshipDefinition method lets you set the definition of a
260
299
  * Relationship.
261
300
  *
301
+ * This has schema-based typing. The following is a simplified representation:
302
+ *
303
+ * ```ts override
304
+ * setRelationshipDefinition(
305
+ * relationshipId: Id,
306
+ * localTableId: Id,
307
+ * remoteTableId: Id,
308
+ * getRemoteRowId: Id | ((getCell: GetCell, localRowId: Id) => Id),
309
+ * ): Relationships;
310
+ * ```
311
+ *
262
312
  * Every Relationship definition is identified by a unique Id, and if you
263
313
  * re-use an existing Id with this method, the previous definition is
264
314
  * overwritten.
@@ -354,6 +404,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
354
404
  * The delRelationshipDefinition method removes an existing Relationship
355
405
  * definition.
356
406
  *
407
+ * This has schema-based typing. The following is a simplified representation:
408
+ *
409
+ * ```ts override
410
+ * delRelationshipDefinition(relationshipId: Id): Relationships;
411
+ * ```
412
+ *
357
413
  * @param relationshipId The Id of the Relationship to remove.
358
414
  * @returns A reference to the Relationships object.
359
415
  * @example
@@ -394,6 +450,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
394
450
  * The getStore method returns a reference to the underlying Store that is
395
451
  * backing this Relationships object.
396
452
  *
453
+ * This has schema-based typing. The following is a simplified representation:
454
+ *
455
+ * ```ts override
456
+ * getStore(): Store;
457
+ * ```
458
+ *
397
459
  * @returns A reference to the Store.
398
460
  * @example
399
461
  * This example creates a Relationships object against a newly-created Store
@@ -439,6 +501,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
439
501
  * The forEachRelationship method takes a function that it will then call for
440
502
  * each Relationship in a specified Relationships object.
441
503
  *
504
+ * This has schema-based typing. The following is a simplified representation:
505
+ *
506
+ * ```ts override
507
+ * forEachRelationship(relationshipCallback: RelationshipCallback): void;
508
+ * ```
509
+ *
442
510
  * This method is useful for iterating over the structure of the Relationships
443
511
  * object in a functional style. The `relationshipCallback` parameter is a
444
512
  * RelationshipCallback function that will be called with the Id of each
@@ -507,6 +575,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
507
575
  * The getLocalTableId method returns the Id of the underlying local Table
508
576
  * that is used in the Relationship.
509
577
  *
578
+ * This has schema-based typing. The following is a simplified representation:
579
+ *
580
+ * ```ts override
581
+ * getLocalTableId(relationshipId: Id): Id | undefined;
582
+ * ```
583
+ *
510
584
  * If the Relationship Id is invalid, the method returns `undefined`.
511
585
  *
512
586
  * @param relationshipId The Id of a Relationship.
@@ -541,6 +615,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
541
615
  * The getRemoteTableId method returns the Id of the underlying remote Table
542
616
  * that is used in the Relationship.
543
617
  *
618
+ * This has schema-based typing. The following is a simplified representation:
619
+ *
620
+ * ```ts override
621
+ * getRemoteTableId(relationshipId: Id): Id | undefined;
622
+ * ```
623
+ *
544
624
  * If the Relationship Id is invalid, the method returns `undefined`.
545
625
  *
546
626
  * @param relationshipId The Id of a Relationship.
@@ -719,6 +799,16 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
719
799
  * Relationships object that will be called whenever a remote Row Id in a
720
800
  * Relationship changes.
721
801
  *
802
+ * This has schema-based typing. The following is a simplified representation:
803
+ *
804
+ * ```ts override
805
+ * addRemoteRowIdListener(
806
+ * relationshipId: IdOrNull,
807
+ * localRowId: IdOrNull,
808
+ * listener: RemoteRowIdListener,
809
+ * ): Id;
810
+ * ```
811
+ *
722
812
  * You can either listen to a single local Row (by specifying the Relationship
723
813
  * Id and local Row Id as the method's first two parameters), or changes to
724
814
  * any local Row (by providing a `null` wildcards).
@@ -850,6 +940,16 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
850
940
  * Relationships object that will be called whenever the local Row Ids in
851
941
  * a Relationship change.
852
942
  *
943
+ * This has schema-based typing. The following is a simplified representation:
944
+ *
945
+ * ```ts override
946
+ * addLocalRowIdsListener(
947
+ * relationshipId: IdOrNull,
948
+ * remoteRowId: IdOrNull,
949
+ * listener: LocalRowIdsListener,
950
+ * ): Id;
951
+ * ```
952
+ *
853
953
  * You can either listen to a single local Row (by specifying the Relationship
854
954
  * Id and local Row Id as the method's first two parameters), or changes to
855
955
  * any local Row (by providing a `null` wildcards).
@@ -976,6 +1076,16 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
976
1076
  * Relationships object that will be called whenever the linked Row Ids in a
977
1077
  * linked list Relationship change.
978
1078
  *
1079
+ * This has schema-based typing. The following is a simplified representation:
1080
+ *
1081
+ * ```ts override
1082
+ * addLinkedRowIdsListener(
1083
+ * relationshipId: Id,
1084
+ * firstRowId: Id,
1085
+ * listener: LinkedRowIdsListener,
1086
+ * ): Id;
1087
+ * ```
1088
+ *
979
1089
  * A linked list Relationship is one that has the same Table specified as both
980
1090
  * local Table Id and remote Table Id, allowing you to create a sequence of
981
1091
  * Row objects within that one Table.
@@ -1046,6 +1156,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
1046
1156
  * The delListener method removes a listener that was previously added to the
1047
1157
  * Relationships object.
1048
1158
  *
1159
+ * This has schema-based typing. The following is a simplified representation:
1160
+ *
1161
+ * ```ts override
1162
+ * delListener(listenerId: Id): Relationships;
1163
+ * ```
1164
+ *
1049
1165
  * Use the Id returned by whichever method was used to add the listener. Note
1050
1166
  * that the Relationships object may re-use this Id for future listeners added
1051
1167
  * to it.
@@ -1185,6 +1301,12 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
1185
1301
  * The createRelationships function creates a Relationships object, and is the
1186
1302
  * main entry point into the relationships module.
1187
1303
  *
1304
+ * This has schema-based typing. The following is a simplified representation:
1305
+ *
1306
+ * ```ts override
1307
+ * createRelationships(store: Store): Relationships;
1308
+ * ```
1309
+ *
1188
1310
  * A given Store can only have one Relationships object associated with it. If
1189
1311
  * you call this function twice on the same Store, your second call will return
1190
1312
  * a reference to the Relationships object created by the first.