tanstack-db-pglite 1.1.3 → 1.1.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.
- package/dist/drizzle.d.ts +30 -6
- package/dist/sql.d.ts +29 -4
- package/package.json +1 -1
package/dist/drizzle.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeleteMutationFnParams, InsertMutationFnParams, SyncConfig, UpdateMutationFnParams } from '@tanstack/db';
|
|
2
2
|
import type { IndexColumn, PgTable } from 'drizzle-orm/pg-core';
|
|
3
3
|
import type { PgliteDatabase } from 'drizzle-orm/pglite';
|
|
4
4
|
import type { BuildSchema } from 'drizzle-zod';
|
|
5
5
|
type SyncParams<Table extends PgTable> = Parameters<SyncConfig<Table['$inferSelect'], string>['sync']>[0];
|
|
6
|
-
type Schema<Table extends PgTable> = BuildSchema<'select', Table['_']['columns'], undefined, true>;
|
|
7
6
|
export declare function drizzleCollectionOptions<Table extends PgTable>({ startSync, ...config }: {
|
|
8
7
|
db: PgliteDatabase<any>;
|
|
9
8
|
table: Table;
|
|
@@ -14,9 +13,34 @@ export declare function drizzleCollectionOptions<Table extends PgTable>({ startS
|
|
|
14
13
|
startSync?: boolean;
|
|
15
14
|
prepare?: () => Promise<unknown> | unknown;
|
|
16
15
|
sync?: (params: Pick<SyncParams<Table>, 'write' | 'collection'>) => Promise<void>;
|
|
17
|
-
}):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
}): {
|
|
17
|
+
startSync: true;
|
|
18
|
+
sync: {
|
|
19
|
+
sync: (params: {
|
|
20
|
+
collection: import("@tanstack/db").Collection<Table["$inferSelect"], string, any, any, any>;
|
|
21
|
+
begin: (options?: {
|
|
22
|
+
immediate?: boolean;
|
|
23
|
+
}) => void;
|
|
24
|
+
write: (message: import("@tanstack/db").ChangeMessageOrDeleteKeyMessage<Table["$inferSelect"], string>) => void;
|
|
25
|
+
commit: () => void;
|
|
26
|
+
markReady: () => void;
|
|
27
|
+
truncate: () => void;
|
|
28
|
+
}) => void;
|
|
29
|
+
};
|
|
30
|
+
gcTime: number;
|
|
31
|
+
schema: BuildSchema<"select", Table["_"]["columns"], undefined, undefined>;
|
|
32
|
+
getKey: (t: Table["$inferSelect"]) => string;
|
|
33
|
+
onInsert: (params: InsertMutationFnParams<Table["$inferSelect"], string, {
|
|
34
|
+
runSync: () => Promise<void>;
|
|
35
|
+
}>) => Promise<void>;
|
|
36
|
+
onUpdate: (params: UpdateMutationFnParams<Table["$inferSelect"], string, {
|
|
37
|
+
runSync: () => Promise<void>;
|
|
38
|
+
}>) => Promise<void>;
|
|
39
|
+
onDelete: (params: DeleteMutationFnParams<Table["$inferSelect"], string, {
|
|
40
|
+
runSync: () => Promise<void>;
|
|
41
|
+
}>) => Promise<void>;
|
|
42
|
+
utils: {
|
|
43
|
+
runSync: () => Promise<void>;
|
|
44
|
+
};
|
|
21
45
|
};
|
|
22
46
|
export {};
|
package/dist/sql.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PGlite } from '@electric-sql/pglite';
|
|
2
2
|
import type { PGliteWorker } from '@electric-sql/pglite/worker';
|
|
3
3
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DeleteMutationFnParams, InsertMutationFnParams, SyncConfig, UpdateMutationFnParams } from '@tanstack/db';
|
|
5
5
|
type Output<T extends StandardSchemaV1> = StandardSchemaV1.InferOutput<T>;
|
|
6
6
|
type SyncParams<ItemType extends Record<string, unknown>> = Parameters<SyncConfig<ItemType, string>['sync']>[0];
|
|
7
7
|
export declare function sqlCollectionOptions<Schema extends StandardSchemaV1<Record<string, unknown>>>({ startSync, ...config }: {
|
|
@@ -16,9 +16,34 @@ export declare function sqlCollectionOptions<Schema extends StandardSchemaV1<Rec
|
|
|
16
16
|
startSync?: boolean;
|
|
17
17
|
prepare?: () => Promise<unknown> | unknown;
|
|
18
18
|
sync?: (params: Pick<SyncParams<Output<Schema>>, 'write' | 'collection'>) => Promise<void>;
|
|
19
|
-
}):
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}): {
|
|
20
|
+
startSync: boolean;
|
|
21
|
+
sync: {
|
|
22
|
+
sync: (params: {
|
|
23
|
+
collection: import("@tanstack/db").Collection<Output<Schema>, string, any, any, any>;
|
|
24
|
+
begin: (options?: {
|
|
25
|
+
immediate?: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
write: (message: import("@tanstack/db").ChangeMessageOrDeleteKeyMessage<Output<Schema>, string>) => void;
|
|
28
|
+
commit: () => void;
|
|
29
|
+
markReady: () => void;
|
|
30
|
+
truncate: () => void;
|
|
31
|
+
}) => void;
|
|
32
|
+
};
|
|
33
|
+
gcTime: number;
|
|
22
34
|
schema: Schema;
|
|
35
|
+
getKey: (row: Output<Schema>) => string;
|
|
36
|
+
onInsert: (params: InsertMutationFnParams<Output<Schema>, string, {
|
|
37
|
+
runSync: () => Promise<void>;
|
|
38
|
+
}>) => Promise<void>;
|
|
39
|
+
onUpdate: (params: UpdateMutationFnParams<Output<Schema>, string, {
|
|
40
|
+
runSync: () => Promise<void>;
|
|
41
|
+
}>) => Promise<void>;
|
|
42
|
+
onDelete: (params: DeleteMutationFnParams<Output<Schema>, string, {
|
|
43
|
+
runSync: () => Promise<void>;
|
|
44
|
+
}>) => Promise<void>;
|
|
45
|
+
utils: {
|
|
46
|
+
runSync: () => Promise<void>;
|
|
47
|
+
};
|
|
23
48
|
};
|
|
24
49
|
export {};
|