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
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
* @module relationships
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import {CellIdFromSchema, TableIdFromSchema} from './internal/store';
|
|
14
15
|
import {
|
|
15
16
|
GetCell,
|
|
16
|
-
NoSchemas,
|
|
17
17
|
OptionalSchemas,
|
|
18
|
+
OptionalTablesSchema,
|
|
18
19
|
RowCallback,
|
|
19
20
|
Store,
|
|
20
21
|
} from './store.d';
|
|
@@ -59,9 +60,9 @@ export type Relationship = {
|
|
|
59
60
|
* objects in this Relationship.
|
|
60
61
|
* @category Callback
|
|
61
62
|
*/
|
|
62
|
-
export type RelationshipCallback = (
|
|
63
|
+
export type RelationshipCallback<Schema extends OptionalTablesSchema> = (
|
|
63
64
|
relationshipId: Id,
|
|
64
|
-
forEachRow: (rowCallback: RowCallback) => void,
|
|
65
|
+
forEachRow: (rowCallback: RowCallback<Schema>) => void,
|
|
65
66
|
) => void;
|
|
66
67
|
|
|
67
68
|
/**
|
|
@@ -80,8 +81,8 @@ export type RelationshipCallback = (
|
|
|
80
81
|
* @param localRowId The Id of the local Row whose remote Row Id changed.
|
|
81
82
|
* @category Listener
|
|
82
83
|
*/
|
|
83
|
-
export type RemoteRowIdListener = (
|
|
84
|
-
relationships: Relationships
|
|
84
|
+
export type RemoteRowIdListener<Schemas extends OptionalSchemas> = (
|
|
85
|
+
relationships: Relationships<Schemas>,
|
|
85
86
|
relationshipId: Id,
|
|
86
87
|
localRowId: Id,
|
|
87
88
|
) => void;
|
|
@@ -102,8 +103,8 @@ export type RemoteRowIdListener = (
|
|
|
102
103
|
* @param remoteRowId The Id of the remote Row whose local Row Ids changed.
|
|
103
104
|
* @category Listener
|
|
104
105
|
*/
|
|
105
|
-
export type LocalRowIdsListener = (
|
|
106
|
-
relationships: Relationships
|
|
106
|
+
export type LocalRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
107
|
+
relationships: Relationships<Schemas>,
|
|
107
108
|
relationshipId: Id,
|
|
108
109
|
remoteRowId: Id,
|
|
109
110
|
) => void;
|
|
@@ -125,8 +126,8 @@ export type LocalRowIdsListener = (
|
|
|
125
126
|
* members changed.
|
|
126
127
|
* @category Listener
|
|
127
128
|
*/
|
|
128
|
-
export type LinkedRowIdsListener = (
|
|
129
|
-
relationships: Relationships
|
|
129
|
+
export type LinkedRowIdsListener<Schemas extends OptionalSchemas> = (
|
|
130
|
+
relationships: Relationships<Schemas>,
|
|
130
131
|
relationshipId: Id,
|
|
131
132
|
firstRowId: Id,
|
|
132
133
|
) => void;
|
|
@@ -253,7 +254,7 @@ export type RelationshipsListenerStats = {
|
|
|
253
254
|
* @see Drawing demo
|
|
254
255
|
* @category Relationships
|
|
255
256
|
*/
|
|
256
|
-
export interface Relationships<Schemas extends OptionalSchemas
|
|
257
|
+
export interface Relationships<in out Schemas extends OptionalSchemas> {
|
|
257
258
|
/**
|
|
258
259
|
* The setRelationshipDefinition method lets you set the definition of a
|
|
259
260
|
* Relationship.
|
|
@@ -340,11 +341,13 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
340
341
|
* ```
|
|
341
342
|
* @category Configuration
|
|
342
343
|
*/
|
|
343
|
-
setRelationshipDefinition(
|
|
344
|
+
setRelationshipDefinition<LocalTableId extends TableIdFromSchema<Schemas[0]>>(
|
|
344
345
|
relationshipId: Id,
|
|
345
|
-
localTableId:
|
|
346
|
-
remoteTableId:
|
|
347
|
-
getRemoteRowId:
|
|
346
|
+
localTableId: LocalTableId,
|
|
347
|
+
remoteTableId: TableIdFromSchema<Schemas[0]>,
|
|
348
|
+
getRemoteRowId:
|
|
349
|
+
| CellIdFromSchema<Schemas[0], LocalTableId>
|
|
350
|
+
| ((getCell: GetCell<Schemas[0], LocalTableId>, localRowId: Id) => Id),
|
|
348
351
|
): Relationships<Schemas>;
|
|
349
352
|
|
|
350
353
|
/**
|
|
@@ -473,7 +476,9 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
473
476
|
* ```
|
|
474
477
|
* @category Iterator
|
|
475
478
|
*/
|
|
476
|
-
forEachRelationship(
|
|
479
|
+
forEachRelationship(
|
|
480
|
+
relationshipCallback: RelationshipCallback<Schemas[0]>,
|
|
481
|
+
): void;
|
|
477
482
|
|
|
478
483
|
/**
|
|
479
484
|
* The hasRelationship method returns a boolean indicating whether a given
|
|
@@ -528,7 +533,9 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
528
533
|
* ```
|
|
529
534
|
* @category Getter
|
|
530
535
|
*/
|
|
531
|
-
getLocalTableId
|
|
536
|
+
getLocalTableId<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
537
|
+
relationshipId: Id,
|
|
538
|
+
): TableId | undefined;
|
|
532
539
|
|
|
533
540
|
/**
|
|
534
541
|
* The getRemoteTableId method returns the Id of the underlying remote Table
|
|
@@ -560,7 +567,9 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
560
567
|
* ```
|
|
561
568
|
* @category Getter
|
|
562
569
|
*/
|
|
563
|
-
getRemoteTableId
|
|
570
|
+
getRemoteTableId<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
571
|
+
relationshipId: Id,
|
|
572
|
+
): TableId | undefined;
|
|
564
573
|
|
|
565
574
|
/**
|
|
566
575
|
* The getRemoteRowId method gets the remote Row Id for a given local Row in a
|
|
@@ -833,7 +842,7 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
833
842
|
addRemoteRowIdListener(
|
|
834
843
|
relationshipId: IdOrNull,
|
|
835
844
|
localRowId: IdOrNull,
|
|
836
|
-
listener: RemoteRowIdListener
|
|
845
|
+
listener: RemoteRowIdListener<Schemas>,
|
|
837
846
|
): Id;
|
|
838
847
|
|
|
839
848
|
/**
|
|
@@ -959,7 +968,7 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
959
968
|
addLocalRowIdsListener(
|
|
960
969
|
relationshipId: IdOrNull,
|
|
961
970
|
remoteRowId: IdOrNull,
|
|
962
|
-
listener: LocalRowIdsListener
|
|
971
|
+
listener: LocalRowIdsListener<Schemas>,
|
|
963
972
|
): Id;
|
|
964
973
|
|
|
965
974
|
/**
|
|
@@ -1030,7 +1039,7 @@ export interface Relationships<Schemas extends OptionalSchemas = NoSchemas> {
|
|
|
1030
1039
|
addLinkedRowIdsListener(
|
|
1031
1040
|
relationshipId: Id,
|
|
1032
1041
|
firstRowId: Id,
|
|
1033
|
-
listener: LinkedRowIdsListener
|
|
1042
|
+
listener: LinkedRowIdsListener<Schemas>,
|
|
1034
1043
|
): Id;
|
|
1035
1044
|
|
|
1036
1045
|
/**
|