@taladb/web 0.6.1 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taladb/web",
3
- "version": "0.6.1",
3
+ "version": "0.7.3",
4
4
  "description": "TalaDB WASM bindings — document queries and vector search in the browser",
5
5
  "main": "pkg/taladb_web.js",
6
6
  "types": "pkg/taladb_web.d.ts",
package/pkg/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "collaborators": [
5
5
  "thinkgrid-labs"
6
6
  ],
7
- "description": "TalaDB browser WASM bindings (wasm-bindgen + OPFS)",
8
- "version": "0.6.1",
7
+ "description": "TalaDB browser WASM bindings (wasm-bindgen + OPFS) and Cloudflare Workers",
8
+ "version": "0.7.3",
9
9
  "license": "MIT",
10
10
  "files": [
11
11
  "taladb_web_bg.wasm",
@@ -16,11 +16,11 @@ export class CollectionWasm {
16
16
  /**
17
17
  * Create a vector index on `field`.
18
18
  *
19
- * `dimensions` expected vector length.
20
- * `metric` optional: `"cosine"` (default), `"dot"`, or `"euclidean"`.
21
- * `index_type` optional: `"flat"` (default) or `"hnsw"`.
22
- * `hnsw_m` HNSW connectivity (default 16).
23
- * `hnsw_ef_construction` build quality (default 200).
19
+ * `dimensions` - expected vector length.
20
+ * `metric` - optional: `"cosine"` (default), `"dot"`, or `"euclidean"`.
21
+ * `index_type` - optional: `"flat"` (default) or `"hnsw"`.
22
+ * `hnsw_m` - HNSW connectivity (default 16).
23
+ * `hnsw_ef_construction` - build quality (default 200).
24
24
  */
25
25
  createVectorIndex(field: string, dimensions: number, metric?: string | null, index_type?: string | null, hnsw_m?: number | null, hnsw_ef_construction?: number | null): void;
26
26
  /**
@@ -46,7 +46,7 @@ export class CollectionWasm {
46
46
  /**
47
47
  * Find the `top_k` nearest documents to `query` on a vector index.
48
48
  *
49
- * `filter` optional pre-filter (same format as `find`). Pass `null` to
49
+ * `filter` - optional pre-filter (same format as `find`). Pass `null` to
50
50
  * search across all documents that have the vector field.
51
51
  *
52
52
  * Returns a JSON array of `{ document: {...}, score: number }` objects.
@@ -108,7 +108,7 @@ export class TalaDBWasm {
108
108
  * ```js
109
109
  * const bytes = await opfs_load_snapshot('myapp.db'); // null on first open
110
110
  * const db = TalaDBWasm.openWithSnapshot(bytes);
111
- * // mutations
111
+ * // ... mutations ...
112
112
  * await opfs_flush_snapshot('myapp.db', db.exportSnapshot());
113
113
  * ```
114
114
  */
@@ -119,6 +119,18 @@ export class WorkerDB {
119
119
  private constructor();
120
120
  free(): void;
121
121
  [Symbol.dispose](): void;
122
+ /**
123
+ * Compact the underlying OPFS / redb storage file, reclaiming space freed
124
+ * by deletes and updates.
125
+ *
126
+ * Call this during idle periods (e.g. once on app startup after tombstone
127
+ * compaction). No-op on in-memory (IDB-fallback) databases.
128
+ *
129
+ * ```js
130
+ * db.compact();
131
+ * ```
132
+ */
133
+ compact(): void;
122
134
  /**
123
135
  * Remove tombstones older than `before_ms` from the given collection.
124
136
  *
@@ -202,7 +214,7 @@ export class WorkerDB {
202
214
  * ```js
203
215
  * const resp = await fetch('/sync?since=' + lastSync);
204
216
  * const applied = db.importChangeset(await resp.text());
205
- * if (applied > 0) { /* refresh UI */ }
217
+ * if (applied > 0) { rerender(); }
206
218
  * ```
207
219
  */
208
220
  importChangeset(changeset_json: string): number;
@@ -231,7 +243,9 @@ export class WorkerDB {
231
243
  /**
232
244
  * Open a database backed by OPFS with HTTP push sync config.
233
245
  *
234
- * `config_json` JSON-serialised `TalaDbConfig`, or `null` to open without sync.
246
+ * Not available when compiled with the `cf-workers` feature.
247
+ *
248
+ * `config_json` - JSON-serialised `TalaDbConfig`, or `null` to open without sync.
235
249
  *
236
250
  * ```js
237
251
  * const handle = await file_handle.createSyncAccessHandle();
@@ -242,7 +256,7 @@ export class WorkerDB {
242
256
  /**
243
257
  * Open a database from an optional snapshot with HTTP push sync config.
244
258
  *
245
- * `config_json` JSON-serialised `TalaDbConfig`, or `null` to open without sync.
259
+ * `config_json` - JSON-serialised `TalaDbConfig`, or `null` to open without sync.
246
260
  *
247
261
  * ```js
248
262
  * const db = WorkerDB.openWithConfigAndSnapshot(snapshot, JSON.stringify(config));
@@ -252,6 +266,8 @@ export class WorkerDB {
252
266
  /**
253
267
  * Open a database backed by an OPFS `FileSystemSyncAccessHandle`.
254
268
  *
269
+ * Not available when compiled with the `cf-workers` feature.
270
+ *
255
271
  * Call sequence in the SharedWorker:
256
272
  * ```js
257
273
  * const handle = await file_handle.createSyncAccessHandle();
@@ -342,6 +358,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
342
358
  export interface InitOutput {
343
359
  readonly memory: WebAssembly.Memory;
344
360
  readonly __wbg_workerdb_free: (a: number, b: number) => void;
361
+ readonly workerdb_compact: (a: number) => [number, number];
345
362
  readonly workerdb_compactTombstones: (a: number, b: number, c: number, d: number) => [number, number, number];
346
363
  readonly workerdb_count: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
347
364
  readonly workerdb_createFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -387,25 +404,25 @@ export interface InitOutput {
387
404
  readonly collectionwasm_updateMany: (a: number, b: any, c: any) => [number, number, number];
388
405
  readonly collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
389
406
  readonly collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
390
- readonly taladbwasm_collection: (a: number, b: number, c: number) => number;
407
+ readonly taladbwasm_collection: (a: number, b: number, c: number) => [number, number, number];
391
408
  readonly taladbwasm_exportSnapshot: (a: number) => [number, number, number, number];
392
409
  readonly taladbwasm_openInMemory: () => [number, number, number];
393
410
  readonly taladbwasm_openWithSnapshot: (a: number, b: number) => [number, number, number];
394
411
  readonly init: () => void;
395
- readonly idb_load_snapshot: (a: number, b: number) => any;
396
- readonly idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
397
412
  readonly is_opfs_available: () => any;
398
413
  readonly opfs_delete_snapshot: (a: number, b: number) => any;
399
414
  readonly opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
400
415
  readonly opfs_load_snapshot: (a: number, b: number) => any;
416
+ readonly idb_load_snapshot: (a: number, b: number) => any;
417
+ readonly idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
401
418
  readonly opfs_open_backend: (a: number, b: number) => any;
402
- readonly wasm_bindgen__closure__destroy__h72641f1e1c5255af: (a: number, b: number) => void;
403
- readonly wasm_bindgen__closure__destroy__h478053cb26acc43f: (a: number, b: number) => void;
404
- readonly wasm_bindgen__closure__destroy__h1febc128ce23ccd1: (a: number, b: number) => void;
405
- readonly wasm_bindgen__convert__closures_____invoke__h3022e61d849d0b12: (a: number, b: number, c: any) => [number, number];
406
- readonly wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015: (a: number, b: number, c: any, d: any) => void;
407
- readonly wasm_bindgen__convert__closures_____invoke__h296c8d2fd599fbcf: (a: number, b: number, c: any) => void;
408
- readonly wasm_bindgen__convert__closures_____invoke__h325a87e086f6f78c: (a: number, b: number) => void;
419
+ readonly wasm_bindgen__closure__destroy__hf5d71bc2d02a6064: (a: number, b: number) => void;
420
+ readonly wasm_bindgen__closure__destroy__h48e8a8f67ee293c6: (a: number, b: number) => void;
421
+ readonly wasm_bindgen__closure__destroy__h8b8dc50e88fa67bc: (a: number, b: number) => void;
422
+ readonly wasm_bindgen__convert__closures_____invoke__hfb64ebab929241fc: (a: number, b: number, c: any) => [number, number];
423
+ readonly wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae: (a: number, b: number, c: any, d: any) => void;
424
+ readonly wasm_bindgen__convert__closures_____invoke__h57a4f572d4d576bf: (a: number, b: number, c: any) => void;
425
+ readonly wasm_bindgen__convert__closures_____invoke__had96e062ebd712a6: (a: number, b: number) => void;
409
426
  readonly __wbindgen_malloc: (a: number, b: number) => number;
410
427
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
411
428
  readonly __wbindgen_exn_store: (a: number) => void;
package/pkg/taladb_web.js CHANGED
@@ -45,11 +45,11 @@ export class CollectionWasm {
45
45
  /**
46
46
  * Create a vector index on `field`.
47
47
  *
48
- * `dimensions` expected vector length.
49
- * `metric` optional: `"cosine"` (default), `"dot"`, or `"euclidean"`.
50
- * `index_type` optional: `"flat"` (default) or `"hnsw"`.
51
- * `hnsw_m` HNSW connectivity (default 16).
52
- * `hnsw_ef_construction` build quality (default 200).
48
+ * `dimensions` - expected vector length.
49
+ * `metric` - optional: `"cosine"` (default), `"dot"`, or `"euclidean"`.
50
+ * `index_type` - optional: `"flat"` (default) or `"hnsw"`.
51
+ * `hnsw_m` - HNSW connectivity (default 16).
52
+ * `hnsw_ef_construction` - build quality (default 200).
53
53
  * @param {string} field
54
54
  * @param {number} dimensions
55
55
  * @param {string | null} [metric]
@@ -132,7 +132,7 @@ export class CollectionWasm {
132
132
  /**
133
133
  * Find the `top_k` nearest documents to `query` on a vector index.
134
134
  *
135
- * `filter` optional pre-filter (same format as `find`). Pass `null` to
135
+ * `filter` - optional pre-filter (same format as `find`). Pass `null` to
136
136
  * search across all documents that have the vector field.
137
137
  *
138
138
  * Returns a JSON array of `{ document: {...}, score: number }` objects.
@@ -268,7 +268,10 @@ export class TalaDBWasm {
268
268
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
269
  const len0 = WASM_VECTOR_LEN;
270
270
  const ret = wasm.taladbwasm_collection(this.__wbg_ptr, ptr0, len0);
271
- return CollectionWasm.__wrap(ret);
271
+ if (ret[2]) {
272
+ throw takeFromExternrefTable0(ret[1]);
273
+ }
274
+ return CollectionWasm.__wrap(ret[0]);
272
275
  }
273
276
  /**
274
277
  * Serialize the entire in-memory database to bytes.
@@ -308,7 +311,7 @@ export class TalaDBWasm {
308
311
  * ```js
309
312
  * const bytes = await opfs_load_snapshot('myapp.db'); // null on first open
310
313
  * const db = TalaDBWasm.openWithSnapshot(bytes);
311
- * // mutations
314
+ * // ... mutations ...
312
315
  * await opfs_flush_snapshot('myapp.db', db.exportSnapshot());
313
316
  * ```
314
317
  * @param {Uint8Array | null} [snapshot]
@@ -344,6 +347,23 @@ export class WorkerDB {
344
347
  const ptr = this.__destroy_into_raw();
345
348
  wasm.__wbg_workerdb_free(ptr, 0);
346
349
  }
350
+ /**
351
+ * Compact the underlying OPFS / redb storage file, reclaiming space freed
352
+ * by deletes and updates.
353
+ *
354
+ * Call this during idle periods (e.g. once on app startup after tombstone
355
+ * compaction). No-op on in-memory (IDB-fallback) databases.
356
+ *
357
+ * ```js
358
+ * db.compact();
359
+ * ```
360
+ */
361
+ compact() {
362
+ const ret = wasm.workerdb_compact(this.__wbg_ptr);
363
+ if (ret[1]) {
364
+ throw takeFromExternrefTable0(ret[0]);
365
+ }
366
+ }
347
367
  /**
348
368
  * Remove tombstones older than `before_ms` from the given collection.
349
369
  *
@@ -670,7 +690,7 @@ export class WorkerDB {
670
690
  * ```js
671
691
  * const resp = await fetch('/sync?since=' + lastSync);
672
692
  * const applied = db.importChangeset(await resp.text());
673
- * if (applied > 0) { /* refresh UI */ }
693
+ * if (applied > 0) { rerender(); }
674
694
  * ```
675
695
  * @param {string} changeset_json
676
696
  * @returns {number}
@@ -803,7 +823,9 @@ export class WorkerDB {
803
823
  /**
804
824
  * Open a database backed by OPFS with HTTP push sync config.
805
825
  *
806
- * `config_json` JSON-serialised `TalaDbConfig`, or `null` to open without sync.
826
+ * Not available when compiled with the `cf-workers` feature.
827
+ *
828
+ * `config_json` - JSON-serialised `TalaDbConfig`, or `null` to open without sync.
807
829
  *
808
830
  * ```js
809
831
  * const handle = await file_handle.createSyncAccessHandle();
@@ -825,7 +847,7 @@ export class WorkerDB {
825
847
  /**
826
848
  * Open a database from an optional snapshot with HTTP push sync config.
827
849
  *
828
- * `config_json` JSON-serialised `TalaDbConfig`, or `null` to open without sync.
850
+ * `config_json` - JSON-serialised `TalaDbConfig`, or `null` to open without sync.
829
851
  *
830
852
  * ```js
831
853
  * const db = WorkerDB.openWithConfigAndSnapshot(snapshot, JSON.stringify(config));
@@ -848,6 +870,8 @@ export class WorkerDB {
848
870
  /**
849
871
  * Open a database backed by an OPFS `FileSystemSyncAccessHandle`.
850
872
  *
873
+ * Not available when compiled with the `cf-workers` feature.
874
+ *
851
875
  * Call sequence in the SharedWorker:
852
876
  * ```js
853
877
  * const handle = await file_handle.createSyncAccessHandle();
@@ -1429,7 +1453,7 @@ function __wbg_get_imports() {
1429
1453
  const a = state0.a;
1430
1454
  state0.a = 0;
1431
1455
  try {
1432
- return wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015(a, state0.b, arg0, arg1);
1456
+ return wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae(a, state0.b, arg0, arg1);
1433
1457
  } finally {
1434
1458
  state0.a = a;
1435
1459
  }
@@ -1451,7 +1475,7 @@ function __wbg_get_imports() {
1451
1475
  const a = state0.a;
1452
1476
  state0.a = 0;
1453
1477
  try {
1454
- return wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015(a, state0.b, arg0, arg1);
1478
+ return wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae(a, state0.b, arg0, arg1);
1455
1479
  } finally {
1456
1480
  state0.a = a;
1457
1481
  }
@@ -1612,18 +1636,18 @@ function __wbg_get_imports() {
1612
1636
  return ret;
1613
1637
  },
1614
1638
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1615
- // Cast intrinsic for `Closure(Closure { dtor_idx: 102, function: Function { arguments: [Externref], shim_idx: 103, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1616
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h72641f1e1c5255af, wasm_bindgen__convert__closures_____invoke__h296c8d2fd599fbcf);
1639
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 137, function: Function { arguments: [Externref], shim_idx: 138, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1640
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5d71bc2d02a6064, wasm_bindgen__convert__closures_____invoke__h57a4f572d4d576bf);
1617
1641
  return ret;
1618
1642
  },
1619
1643
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1620
- // Cast intrinsic for `Closure(Closure { dtor_idx: 181, function: Function { arguments: [], shim_idx: 182, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1621
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h478053cb26acc43f, wasm_bindgen__convert__closures_____invoke__h325a87e086f6f78c);
1644
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 187, function: Function { arguments: [], shim_idx: 188, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1645
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h48e8a8f67ee293c6, wasm_bindgen__convert__closures_____invoke__had96e062ebd712a6);
1622
1646
  return ret;
1623
1647
  },
1624
1648
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1625
- // Cast intrinsic for `Closure(Closure { dtor_idx: 589, function: Function { arguments: [Externref], shim_idx: 590, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1626
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1febc128ce23ccd1, wasm_bindgen__convert__closures_____invoke__h3022e61d849d0b12);
1649
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 629, function: Function { arguments: [Externref], shim_idx: 630, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1650
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8b8dc50e88fa67bc, wasm_bindgen__convert__closures_____invoke__hfb64ebab929241fc);
1627
1651
  return ret;
1628
1652
  },
1629
1653
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -1669,23 +1693,23 @@ function __wbg_get_imports() {
1669
1693
  };
1670
1694
  }
1671
1695
 
1672
- function wasm_bindgen__convert__closures_____invoke__h325a87e086f6f78c(arg0, arg1) {
1673
- wasm.wasm_bindgen__convert__closures_____invoke__h325a87e086f6f78c(arg0, arg1);
1696
+ function wasm_bindgen__convert__closures_____invoke__had96e062ebd712a6(arg0, arg1) {
1697
+ wasm.wasm_bindgen__convert__closures_____invoke__had96e062ebd712a6(arg0, arg1);
1674
1698
  }
1675
1699
 
1676
- function wasm_bindgen__convert__closures_____invoke__h296c8d2fd599fbcf(arg0, arg1, arg2) {
1677
- wasm.wasm_bindgen__convert__closures_____invoke__h296c8d2fd599fbcf(arg0, arg1, arg2);
1700
+ function wasm_bindgen__convert__closures_____invoke__h57a4f572d4d576bf(arg0, arg1, arg2) {
1701
+ wasm.wasm_bindgen__convert__closures_____invoke__h57a4f572d4d576bf(arg0, arg1, arg2);
1678
1702
  }
1679
1703
 
1680
- function wasm_bindgen__convert__closures_____invoke__h3022e61d849d0b12(arg0, arg1, arg2) {
1681
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h3022e61d849d0b12(arg0, arg1, arg2);
1704
+ function wasm_bindgen__convert__closures_____invoke__hfb64ebab929241fc(arg0, arg1, arg2) {
1705
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hfb64ebab929241fc(arg0, arg1, arg2);
1682
1706
  if (ret[1]) {
1683
1707
  throw takeFromExternrefTable0(ret[0]);
1684
1708
  }
1685
1709
  }
1686
1710
 
1687
- function wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015(arg0, arg1, arg2, arg3) {
1688
- wasm.wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015(arg0, arg1, arg2, arg3);
1711
+ function wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae(arg0, arg1, arg2, arg3) {
1712
+ wasm.wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae(arg0, arg1, arg2, arg3);
1689
1713
  }
1690
1714
 
1691
1715
 
Binary file
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_workerdb_free: (a: number, b: number) => void;
5
+ export const workerdb_compact: (a: number) => [number, number];
5
6
  export const workerdb_compactTombstones: (a: number, b: number, c: number, d: number) => [number, number, number];
6
7
  export const workerdb_count: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
7
8
  export const workerdb_createFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -47,25 +48,25 @@ export const collectionwasm_insertMany: (a: number, b: any) => [number, number,
47
48
  export const collectionwasm_updateMany: (a: number, b: any, c: any) => [number, number, number];
48
49
  export const collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
49
50
  export const collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
50
- export const taladbwasm_collection: (a: number, b: number, c: number) => number;
51
+ export const taladbwasm_collection: (a: number, b: number, c: number) => [number, number, number];
51
52
  export const taladbwasm_exportSnapshot: (a: number) => [number, number, number, number];
52
53
  export const taladbwasm_openInMemory: () => [number, number, number];
53
54
  export const taladbwasm_openWithSnapshot: (a: number, b: number) => [number, number, number];
54
55
  export const init: () => void;
55
- export const idb_load_snapshot: (a: number, b: number) => any;
56
- export const idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
57
56
  export const is_opfs_available: () => any;
58
57
  export const opfs_delete_snapshot: (a: number, b: number) => any;
59
58
  export const opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
60
59
  export const opfs_load_snapshot: (a: number, b: number) => any;
60
+ export const idb_load_snapshot: (a: number, b: number) => any;
61
+ export const idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
61
62
  export const opfs_open_backend: (a: number, b: number) => any;
62
- export const wasm_bindgen__closure__destroy__h72641f1e1c5255af: (a: number, b: number) => void;
63
- export const wasm_bindgen__closure__destroy__h478053cb26acc43f: (a: number, b: number) => void;
64
- export const wasm_bindgen__closure__destroy__h1febc128ce23ccd1: (a: number, b: number) => void;
65
- export const wasm_bindgen__convert__closures_____invoke__h3022e61d849d0b12: (a: number, b: number, c: any) => [number, number];
66
- export const wasm_bindgen__convert__closures_____invoke__h470c93d8a24e0015: (a: number, b: number, c: any, d: any) => void;
67
- export const wasm_bindgen__convert__closures_____invoke__h296c8d2fd599fbcf: (a: number, b: number, c: any) => void;
68
- export const wasm_bindgen__convert__closures_____invoke__h325a87e086f6f78c: (a: number, b: number) => void;
63
+ export const wasm_bindgen__closure__destroy__hf5d71bc2d02a6064: (a: number, b: number) => void;
64
+ export const wasm_bindgen__closure__destroy__h48e8a8f67ee293c6: (a: number, b: number) => void;
65
+ export const wasm_bindgen__closure__destroy__h8b8dc50e88fa67bc: (a: number, b: number) => void;
66
+ export const wasm_bindgen__convert__closures_____invoke__hfb64ebab929241fc: (a: number, b: number, c: any) => [number, number];
67
+ export const wasm_bindgen__convert__closures_____invoke__h31b79bb0cf86afae: (a: number, b: number, c: any, d: any) => void;
68
+ export const wasm_bindgen__convert__closures_____invoke__h57a4f572d4d576bf: (a: number, b: number, c: any) => void;
69
+ export const wasm_bindgen__convert__closures_____invoke__had96e062ebd712a6: (a: number, b: number) => void;
69
70
  export const __wbindgen_malloc: (a: number, b: number) => number;
70
71
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
71
72
  export const __wbindgen_exn_store: (a: number) => void;
@@ -49,6 +49,7 @@
49
49
  * upgradeVectorIndex { collection, field }
50
50
  * findNearest { collection, field, queryJson, topK, filterJson? }
51
51
  * listCollections {} → JSON string[]
52
+ * compact {} → null
52
53
  * compactTombstones { collection, beforeMs } → number pruned
53
54
  * exportChangeset { collectionsJson, sinceMs? } → JSON changeset string
54
55
  * importChangeset { changesetJson } → number of applied changes
@@ -459,6 +460,11 @@ async function dispatch(op, args) {
459
460
  case 'listCollections':
460
461
  return db.listCollections();
461
462
 
463
+ case 'compact':
464
+ // Compact the storage file, reclaiming freed space. No-op on IDB fallback.
465
+ db.compact();
466
+ return null;
467
+
462
468
  case 'compactTombstones':
463
469
  // Prune tombstones older than beforeMs from a collection.
464
470
  // Returns the count of tombstones removed.
@@ -499,7 +505,7 @@ async function dispatch(op, args) {
499
505
  // ---------------------------------------------------------------------------
500
506
 
501
507
  async function doInit(dbName, configJson) {
502
- const wasm = await import('../pkg/taladb_web.js');
508
+ const wasm = await import(/* @vite-ignore */ '../pkg/taladb_web.js');
503
509
  await wasm.default();
504
510
 
505
511
  // Hoist to module scope so snapshot reloads in dispatch() can use it.