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 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
- declare function getSchema<Table extends PgTable>(table: Table): import("drizzle-zod").BuildSchema<"select", Table["_"]["columns"], undefined, undefined>;
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, ReturnType<typeof getSchema<Table>>, PgliteUtils> & {
18
- schema: ReturnType<typeof getSchema<Table>>;
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: getSchema(config.table),
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tanstack-db-pglite",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "packageManager": "pnpm@10.32.1",
5
5
  "description": "",
6
6
  "author": "Valerii Strilets",