tanstack-db-pglite 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/dist/drizzle.js +20 -17
  2. package/package.json +5 -3
package/dist/drizzle.js CHANGED
@@ -68,27 +68,30 @@ export function drizzleCollectionOptions({ startSync = true, ...config }) {
68
68
  return {
69
69
  startSync: true,
70
70
  sync: {
71
- sync: async (params) => {
72
- try {
73
- resolveSyncParams(params);
74
- await config.prepare?.();
75
- params.begin();
76
- // @ts-expect-error drizzle types
77
- const dbs = await config.db.select().from(config.table);
78
- dbs.forEach((db) => {
79
- params.write({ type: 'insert', value: db });
80
- });
81
- params.commit();
82
- if (config.sync && startSync) {
83
- await config.sync(await getSyncParams());
71
+ sync: (params) => {
72
+ resolveSyncParams(params);
73
+ (async () => {
74
+ try {
75
+ await config.prepare?.();
76
+ params.begin();
77
+ // @ts-expect-error drizzle types
78
+ const dbs = await config.db.select().from(config.table);
79
+ dbs.forEach((db) => {
80
+ params.write({ type: 'insert', value: db });
81
+ });
82
+ params.commit();
83
+ if (config.sync && startSync) {
84
+ await config.sync(await getSyncParams());
85
+ }
84
86
  }
85
- }
86
- finally {
87
- params.markReady();
88
- }
87
+ finally {
88
+ params.markReady();
89
+ }
90
+ })();
89
91
  },
90
92
  },
91
93
  gcTime: 0,
94
+ // @ts-expect-error wrong types
92
95
  schema: createSelectSchema(config.table),
93
96
  getKey: t => t[config.primaryColumn.name],
94
97
  onInsert: async (params) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tanstack-db-pglite",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "packageManager": "pnpm@10.16.1",
5
5
  "description": "",
6
6
  "author": "Valerii Strilets",
@@ -18,7 +18,9 @@
18
18
  ],
19
19
  "main": "dist/index.js",
20
20
  "types": "dist/index.d.ts",
21
- "files": ["dist"],
21
+ "files": [
22
+ "dist"
23
+ ],
22
24
  "scripts": {
23
25
  "prepublishOnly": "pnpm build",
24
26
  "build": "tsc",
@@ -26,7 +28,7 @@
26
28
  "lint:fix": "eslint . --fix"
27
29
  },
28
30
  "peerDependencies": {
29
- "@tanstack/db": ">=0.2.0",
31
+ "@tanstack/db": ">=0.4.0",
30
32
  "drizzle-orm": ">=0.44.0"
31
33
  },
32
34
  "dependencies": {