tanstack-db-pglite 1.1.6 → 1.1.7
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 +4 -3
- package/dist/drizzle.js +1 -4
- package/package.json +1 -1
package/dist/drizzle.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
import type { CollectionConfig, DeleteMutationFnParams, InsertMutationFnParams, SyncConfig, UpdateMutationFnParams } from '@tanstack/db';
|
|
2
3
|
import type { IndexColumn, PgTable } from 'drizzle-orm/pg-core';
|
|
3
4
|
import type { PgliteDatabase } from 'drizzle-orm/pglite';
|
|
4
5
|
import type { PgliteUtils } from './utils';
|
|
5
|
-
|
|
6
|
+
type Schema<Table extends PgTable> = StandardSchemaV1<Table['$inferSelect'], Table['$inferSelect']>;
|
|
6
7
|
type SyncParams<Table extends PgTable> = Parameters<SyncConfig<Table['$inferSelect'], string>['sync']>[0];
|
|
7
8
|
export declare function drizzleCollectionOptions<Table extends PgTable>({ startSync, ...config }: {
|
|
8
9
|
db: PgliteDatabase<any>;
|
|
@@ -14,7 +15,7 @@ export declare function drizzleCollectionOptions<Table extends PgTable>({ startS
|
|
|
14
15
|
onInsert?: (params: InsertMutationFnParams<Table['$inferSelect'], string>) => Promise<void>;
|
|
15
16
|
onUpdate?: (params: UpdateMutationFnParams<Table['$inferSelect'], string>) => Promise<void>;
|
|
16
17
|
onDelete?: (params: DeleteMutationFnParams<Table['$inferSelect'], string>) => Promise<void>;
|
|
17
|
-
}): CollectionConfig<Table['$inferSelect'], string,
|
|
18
|
-
schema:
|
|
18
|
+
}): CollectionConfig<Table['$inferSelect'], string, Schema<Table>, PgliteUtils> & {
|
|
19
|
+
schema: Schema<Table>;
|
|
19
20
|
};
|
|
20
21
|
export {};
|
package/dist/drizzle.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { eq, inArray } from 'drizzle-orm';
|
|
2
2
|
import { createSelectSchema } from 'drizzle-zod';
|
|
3
|
-
function getSchema(table) {
|
|
4
|
-
return createSelectSchema(table);
|
|
5
|
-
}
|
|
6
3
|
export function drizzleCollectionOptions({ startSync = true, ...config }) {
|
|
7
4
|
let resolvers = Promise.withResolvers();
|
|
8
5
|
// Sync params can be null while running PGLite migrations
|
|
@@ -118,7 +115,7 @@ export function drizzleCollectionOptions({ startSync = true, ...config }) {
|
|
|
118
115
|
},
|
|
119
116
|
},
|
|
120
117
|
gcTime: 0,
|
|
121
|
-
schema:
|
|
118
|
+
schema: createSelectSchema(config.table),
|
|
122
119
|
getKey: t => t[config.primaryColumn.name],
|
|
123
120
|
onInsert: async (params) => {
|
|
124
121
|
await config.db.transaction(async (tx) => {
|