@taladb/web 0.9.3 → 0.10.0

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/LICENSE CHANGED
@@ -1,21 +1,202 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 thinkgrid-labs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025-2026 thinkgrid-labs
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Browser WASM bindings for TalaDB — persistent local-first storage via WASM + OPFS.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@taladb/web)](https://www.npmjs.com/package/@taladb/web)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)](LICENSE)
6
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-orange.svg)](LICENSE)
7
7
 
8
8
  > **Note:** Most users should install [`taladb`](https://www.npmjs.com/package/taladb) instead, which auto-selects this package when running in the browser.
9
9
 
@@ -90,4 +90,4 @@ pnpm --filter @taladb/web build
90
90
 
91
91
  ## License
92
92
 
93
- MIT © [ThinkGrid Labs](https://github.com/thinkgrid-labs)
93
+ Apache 2.0 © [ThinkGrid Labs](https://github.com/thinkgrid-labs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taladb/web",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
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",
@@ -28,7 +28,7 @@
28
28
  "engines": {
29
29
  "node": ">=18"
30
30
  },
31
- "license": "MIT",
31
+ "license": "Apache-2.0",
32
32
  "scripts": {
33
33
  "build": "wasm-pack build --target web --out-dir pkg --release",
34
34
  "build:dev": "wasm-pack build --target web --out-dir pkg --dev",
package/pkg/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Browser WASM bindings for TalaDB — persistent local-first storage via WASM + OPFS.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@taladb/web)](https://www.npmjs.com/package/@taladb/web)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-orange.svg)](LICENSE)
6
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-orange.svg)](LICENSE)
7
7
 
8
8
  > **Note:** Most users should install [`taladb`](https://www.npmjs.com/package/taladb) instead, which auto-selects this package when running in the browser.
9
9
 
@@ -90,4 +90,4 @@ pnpm --filter @taladb/web build
90
90
 
91
91
  ## License
92
92
 
93
- MIT © [ThinkGrid Labs](https://github.com/thinkgrid-labs)
93
+ Apache 2.0 © [ThinkGrid Labs](https://github.com/thinkgrid-labs)
package/pkg/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "thinkgrid-labs"
6
6
  ],
7
7
  "description": "TalaDB browser WASM bindings (wasm-bindgen + OPFS) and Cloudflare Workers",
8
- "version": "0.9.3",
9
- "license": "MIT",
8
+ "version": "0.10.0",
9
+ "license": "Apache-2.0",
10
10
  "files": [
11
11
  "taladb_web_bg.wasm",
12
12
  "taladb_web.js",
@@ -18,6 +18,10 @@ export class CollectionWasm {
18
18
  * Create a compound index. `fields_json` is a JSON array of field names.
19
19
  */
20
20
  createCompoundIndex(fields_json: string): void;
21
+ /**
22
+ * Create a full-text search index on a string field.
23
+ */
24
+ createFtsIndex(field: string): void;
21
25
  /**
22
26
  * Create a secondary index on a field.
23
27
  */
@@ -36,6 +40,10 @@ export class CollectionWasm {
36
40
  * Delete all matching documents. Returns the count deleted.
37
41
  */
38
42
  deleteMany(filter: any): number;
43
+ /**
44
+ * Delete many documents by id, in one commit. Returns the number removed.
45
+ */
46
+ deleteManyWithIds(ids: any, origin: string): number;
39
47
  /**
40
48
  * Delete the first matching document. Returns true if deleted.
41
49
  */
@@ -44,6 +52,10 @@ export class CollectionWasm {
44
52
  * Drop a compound index by its ordered field list (`fields_json`).
45
53
  */
46
54
  dropCompoundIndex(fields_json: string): void;
55
+ /**
56
+ * Drop a full-text search index and everything it stores.
57
+ */
58
+ dropFtsIndex(field: string): void;
47
59
  /**
48
60
  * Drop a secondary index.
49
61
  */
@@ -69,6 +81,14 @@ export class CollectionWasm {
69
81
  * Find a single document. Returns the document or null.
70
82
  */
71
83
  findOne(filter: any): any;
84
+ /**
85
+ * Hybrid retrieval — BM25 and vector similarity fused with reciprocal
86
+ * rank fusion.
87
+ *
88
+ * `options` accepts `{ rrfK, textWeight, vectorWeight, candidates, k1, b }`.
89
+ * Returns a JSON array of `{ document, score, textRank, vectorRank }`.
90
+ */
91
+ hybridSearch(text_field: string, text: string, vector_field: string, vector: Float32Array, top_k: number, filter: any, options: any): any;
72
92
  /**
73
93
  * Insert a document. Accepts a plain JS object, returns the ULID string id.
74
94
  */
@@ -77,6 +97,24 @@ export class CollectionWasm {
77
97
  * Insert multiple documents. Returns an array of ULID string ids.
78
98
  */
79
99
  insertMany(docs: any): any;
100
+ /**
101
+ * Upsert many documents **by caller-supplied `_id`**, in one commit.
102
+ *
103
+ * Unlike [`Self::insert_many`] — which mints a fresh ULID and discards `_id` —
104
+ * this honours the id on each document, which is what lets replication address
105
+ * a remote row by a *derived* id so repeated fetches converge on one document
106
+ * instead of duplicating it.
107
+ *
108
+ * `origin` is `"remote"` for authoritative rows replicated in from an origin,
109
+ * or `"local"` for ordinary user writes.
110
+ */
111
+ replaceManyWithIds(docs: any, origin: string): any;
112
+ /**
113
+ * Rank documents against a free-text query using BM25 (OR semantics).
114
+ *
115
+ * Returns a JSON array of `{ document, score }`.
116
+ */
117
+ searchText(field: string, query: string, top_k: number, filter: any, options: any): any;
80
118
  /**
81
119
  * Update all matching documents. Returns the count updated.
82
120
  */
@@ -211,6 +249,10 @@ export class WorkerDB {
211
249
  * Delete all matching documents. Returns the count deleted.
212
250
  */
213
251
  deleteMany(collection: string, filter_json: string): number;
252
+ /**
253
+ * Delete many documents by id, in one commit. Returns the number removed.
254
+ */
255
+ deleteManyWithIds(collection: string, ids_json: string, origin: string): number;
214
256
  /**
215
257
  * Delete the first matching document. Returns `true` / `false`.
216
258
  */
@@ -261,6 +303,14 @@ export class WorkerDB {
261
303
  * default immediate durability. Backs `db.flush()`.
262
304
  */
263
305
  flush(): void;
306
+ /**
307
+ * Hybrid retrieval — BM25 and vector similarity fused with reciprocal
308
+ * rank fusion.
309
+ *
310
+ * `options_json` accepts `{ rrfK, textWeight, vectorWeight, candidates, k1, b }`.
311
+ * Returns a JSON array of `{ document, score, textRank, vectorRank }`.
312
+ */
313
+ hybridSearch(collection: string, text_field: string, text: string, vector_field: string, vector_json: string, top_k: number, filter_json: string, options_json: string): string;
264
314
  /**
265
315
  * Import a remote changeset and merge it into the local database using
266
316
  * Last-Write-Wins conflict resolution.
@@ -355,6 +405,25 @@ export class WorkerDB {
355
405
  * of `{ document, reason, changedAt }`.
356
406
  */
357
407
  quarantined(collection: string): string;
408
+ /**
409
+ * Upsert many documents **by caller-supplied `_id`**, in one commit.
410
+ *
411
+ * Unlike `insert_many` — which discards `_id` and mints a fresh ULID — this
412
+ * honours the id in each document. That is what lets the replication
413
+ * coordinator address a remote row by a *derived* id (see `deriveDocId`) and
414
+ * have repeated fetches converge on one document instead of duplicating it.
415
+ *
416
+ * `origin` is `"remote"` for authoritative rows replicated in from an origin,
417
+ * or `"local"` for ordinary user writes. Remote rows are marked so they can
418
+ * never replicate back out — see `Collection::replace_many_with_ids`.
419
+ */
420
+ replaceManyWithIds(collection: string, docs_json: string, origin: string): string;
421
+ /**
422
+ * Rank documents against a free-text query using BM25 (OR semantics).
423
+ *
424
+ * Returns a JSON array of `{ document, score }`.
425
+ */
426
+ searchText(collection: string, field: string, query: string, top_k: number, filter_json: string, options_json: string): string;
358
427
  /**
359
428
  * Set write durability: `eventual = true` batches OPFS fsyncs for
360
429
  * throughput (call `flush()` to force), `false` (default) fsyncs each
@@ -453,6 +522,7 @@ export interface InitOutput {
453
522
  readonly workerdb_createIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
454
523
  readonly workerdb_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
455
524
  readonly workerdb_deleteMany: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
525
+ readonly workerdb_deleteManyWithIds: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
456
526
  readonly workerdb_deleteOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
457
527
  readonly workerdb_dropCompoundIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
458
528
  readonly workerdb_dropFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -464,6 +534,7 @@ export interface InitOutput {
464
534
  readonly workerdb_findNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
465
535
  readonly workerdb_findOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
466
536
  readonly workerdb_flush: (a: number) => [number, number];
537
+ readonly workerdb_hybridSearch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => [number, number, number, number];
467
538
  readonly workerdb_importChangeset: (a: number, b: number, c: number) => [number, number, number];
468
539
  readonly workerdb_importChangesetValidated: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
469
540
  readonly workerdb_insert: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
@@ -476,6 +547,8 @@ export interface InitOutput {
476
547
  readonly workerdb_openWithOpfs: (a: any) => [number, number, number];
477
548
  readonly workerdb_openWithSnapshot: (a: number, b: number) => [number, number, number];
478
549
  readonly workerdb_quarantined: (a: number, b: number, c: number) => [number, number, number, number];
550
+ readonly workerdb_replaceManyWithIds: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
551
+ readonly workerdb_searchText: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
479
552
  readonly workerdb_setDurability: (a: number, b: number) => void;
480
553
  readonly workerdb_setUserVersion: (a: number, b: number) => [number, number];
481
554
  readonly workerdb_syncPending: (a: number) => bigint;
@@ -489,18 +562,24 @@ export interface InitOutput {
489
562
  readonly collectionwasm_aggregate: (a: number, b: any) => [number, number, number];
490
563
  readonly collectionwasm_count: (a: number, b: any) => [number, number, number];
491
564
  readonly collectionwasm_createCompoundIndex: (a: number, b: number, c: number) => [number, number];
565
+ readonly collectionwasm_createFtsIndex: (a: number, b: number, c: number) => [number, number];
492
566
  readonly collectionwasm_createIndex: (a: number, b: number, c: number) => [number, number];
493
567
  readonly collectionwasm_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
494
568
  readonly collectionwasm_deleteMany: (a: number, b: any) => [number, number, number];
569
+ readonly collectionwasm_deleteManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
495
570
  readonly collectionwasm_deleteOne: (a: number, b: any) => [number, number, number];
496
571
  readonly collectionwasm_dropCompoundIndex: (a: number, b: number, c: number) => [number, number];
572
+ readonly collectionwasm_dropFtsIndex: (a: number, b: number, c: number) => [number, number];
497
573
  readonly collectionwasm_dropIndex: (a: number, b: number, c: number) => [number, number];
498
574
  readonly collectionwasm_dropVectorIndex: (a: number, b: number, c: number) => [number, number];
499
575
  readonly collectionwasm_find: (a: number, b: any) => [number, number, number];
500
576
  readonly collectionwasm_findNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => [number, number, number];
501
577
  readonly collectionwasm_findOne: (a: number, b: any) => [number, number, number];
578
+ readonly collectionwasm_hybridSearch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: any, l: any) => [number, number, number];
502
579
  readonly collectionwasm_insert: (a: number, b: any) => [number, number, number, number];
503
580
  readonly collectionwasm_insertMany: (a: number, b: any) => [number, number, number];
581
+ readonly collectionwasm_replaceManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
582
+ readonly collectionwasm_searchText: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any) => [number, number, number];
504
583
  readonly collectionwasm_updateMany: (a: number, b: any, c: any) => [number, number, number];
505
584
  readonly collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
506
585
  readonly collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
@@ -514,20 +593,20 @@ export interface InitOutput {
514
593
  readonly taladbwasm_setUserVersion: (a: number, b: number) => [number, number];
515
594
  readonly taladbwasm_userVersion: (a: number) => [number, number, number];
516
595
  readonly init: () => void;
517
- readonly opfs_open_backend: (a: number, b: number) => any;
518
- readonly idb_load_snapshot: (a: number, b: number) => any;
519
- readonly idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
520
596
  readonly is_opfs_available: () => any;
521
597
  readonly opfs_delete_snapshot: (a: number, b: number) => any;
522
598
  readonly opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
523
599
  readonly opfs_load_snapshot: (a: number, b: number) => any;
524
- readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______: (a: number, b: number) => void;
525
- readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
526
- readonly wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___: (a: number, b: number) => void;
527
- readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_: (a: number, b: number, c: any) => [number, number];
528
- readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
529
- readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_: (a: number, b: number, c: any) => void;
530
- readonly wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_: (a: number, b: number) => void;
600
+ readonly idb_load_snapshot: (a: number, b: number) => any;
601
+ readonly idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
602
+ readonly opfs_open_backend: (a: number, b: number) => any;
603
+ readonly wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output_______: (a: number, b: number) => void;
604
+ readonly wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
605
+ readonly wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output___core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___: (a: number, b: number) => void;
606
+ readonly wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___true_: (a: number, b: number, c: any) => [number, number];
607
+ readonly wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
608
+ readonly wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue______true_: (a: number, b: number, c: any) => void;
609
+ readonly wasm_bindgen_4501a39796791c69___convert__closures_____invoke_______true_: (a: number, b: number) => void;
531
610
  readonly __wbindgen_malloc: (a: number, b: number) => number;
532
611
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
533
612
  readonly __wbindgen_exn_store: (a: number) => void;
package/pkg/taladb_web.js CHANGED
@@ -55,6 +55,18 @@ export class CollectionWasm {
55
55
  throw takeFromExternrefTable0(ret[0]);
56
56
  }
57
57
  }
58
+ /**
59
+ * Create a full-text search index on a string field.
60
+ * @param {string} field
61
+ */
62
+ createFtsIndex(field) {
63
+ const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
64
+ const len0 = WASM_VECTOR_LEN;
65
+ const ret = wasm.collectionwasm_createFtsIndex(this.__wbg_ptr, ptr0, len0);
66
+ if (ret[1]) {
67
+ throw takeFromExternrefTable0(ret[0]);
68
+ }
69
+ }
58
70
  /**
59
71
  * Create a secondary index on a field.
60
72
  * @param {string} field
@@ -106,6 +118,21 @@ export class CollectionWasm {
106
118
  }
107
119
  return ret[0] >>> 0;
108
120
  }
121
+ /**
122
+ * Delete many documents by id, in one commit. Returns the number removed.
123
+ * @param {any} ids
124
+ * @param {string} origin
125
+ * @returns {number}
126
+ */
127
+ deleteManyWithIds(ids, origin) {
128
+ const ptr0 = passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
129
+ const len0 = WASM_VECTOR_LEN;
130
+ const ret = wasm.collectionwasm_deleteManyWithIds(this.__wbg_ptr, ids, ptr0, len0);
131
+ if (ret[2]) {
132
+ throw takeFromExternrefTable0(ret[1]);
133
+ }
134
+ return ret[0] >>> 0;
135
+ }
109
136
  /**
110
137
  * Delete the first matching document. Returns true if deleted.
111
138
  * @param {any} filter
@@ -130,6 +157,18 @@ export class CollectionWasm {
130
157
  throw takeFromExternrefTable0(ret[0]);
131
158
  }
132
159
  }
160
+ /**
161
+ * Drop a full-text search index and everything it stores.
162
+ * @param {string} field
163
+ */
164
+ dropFtsIndex(field) {
165
+ const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
166
+ const len0 = WASM_VECTOR_LEN;
167
+ const ret = wasm.collectionwasm_dropFtsIndex(this.__wbg_ptr, ptr0, len0);
168
+ if (ret[1]) {
169
+ throw takeFromExternrefTable0(ret[0]);
170
+ }
171
+ }
133
172
  /**
134
173
  * Drop a secondary index.
135
174
  * @param {string} field
@@ -202,6 +241,36 @@ export class CollectionWasm {
202
241
  }
203
242
  return takeFromExternrefTable0(ret[0]);
204
243
  }
244
+ /**
245
+ * Hybrid retrieval — BM25 and vector similarity fused with reciprocal
246
+ * rank fusion.
247
+ *
248
+ * `options` accepts `{ rrfK, textWeight, vectorWeight, candidates, k1, b }`.
249
+ * Returns a JSON array of `{ document, score, textRank, vectorRank }`.
250
+ * @param {string} text_field
251
+ * @param {string} text
252
+ * @param {string} vector_field
253
+ * @param {Float32Array} vector
254
+ * @param {number} top_k
255
+ * @param {any} filter
256
+ * @param {any} options
257
+ * @returns {any}
258
+ */
259
+ hybridSearch(text_field, text, vector_field, vector, top_k, filter, options) {
260
+ const ptr0 = passStringToWasm0(text_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
261
+ const len0 = WASM_VECTOR_LEN;
262
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
263
+ const len1 = WASM_VECTOR_LEN;
264
+ const ptr2 = passStringToWasm0(vector_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
+ const len2 = WASM_VECTOR_LEN;
266
+ const ptr3 = passArrayF32ToWasm0(vector, wasm.__wbindgen_malloc);
267
+ const len3 = WASM_VECTOR_LEN;
268
+ const ret = wasm.collectionwasm_hybridSearch(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, top_k, filter, options);
269
+ if (ret[2]) {
270
+ throw takeFromExternrefTable0(ret[1]);
271
+ }
272
+ return takeFromExternrefTable0(ret[0]);
273
+ }
205
274
  /**
206
275
  * Insert a document. Accepts a plain JS object, returns the ULID string id.
207
276
  * @param {any} doc
@@ -237,6 +306,51 @@ export class CollectionWasm {
237
306
  }
238
307
  return takeFromExternrefTable0(ret[0]);
239
308
  }
309
+ /**
310
+ * Upsert many documents **by caller-supplied `_id`**, in one commit.
311
+ *
312
+ * Unlike [`Self::insert_many`] — which mints a fresh ULID and discards `_id` —
313
+ * this honours the id on each document, which is what lets replication address
314
+ * a remote row by a *derived* id so repeated fetches converge on one document
315
+ * instead of duplicating it.
316
+ *
317
+ * `origin` is `"remote"` for authoritative rows replicated in from an origin,
318
+ * or `"local"` for ordinary user writes.
319
+ * @param {any} docs
320
+ * @param {string} origin
321
+ * @returns {any}
322
+ */
323
+ replaceManyWithIds(docs, origin) {
324
+ const ptr0 = passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
325
+ const len0 = WASM_VECTOR_LEN;
326
+ const ret = wasm.collectionwasm_replaceManyWithIds(this.__wbg_ptr, docs, ptr0, len0);
327
+ if (ret[2]) {
328
+ throw takeFromExternrefTable0(ret[1]);
329
+ }
330
+ return takeFromExternrefTable0(ret[0]);
331
+ }
332
+ /**
333
+ * Rank documents against a free-text query using BM25 (OR semantics).
334
+ *
335
+ * Returns a JSON array of `{ document, score }`.
336
+ * @param {string} field
337
+ * @param {string} query
338
+ * @param {number} top_k
339
+ * @param {any} filter
340
+ * @param {any} options
341
+ * @returns {any}
342
+ */
343
+ searchText(field, query, top_k, filter, options) {
344
+ const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
345
+ const len0 = WASM_VECTOR_LEN;
346
+ const ptr1 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
+ const len1 = WASM_VECTOR_LEN;
348
+ const ret = wasm.collectionwasm_searchText(this.__wbg_ptr, ptr0, len0, ptr1, len1, top_k, filter, options);
349
+ if (ret[2]) {
350
+ throw takeFromExternrefTable0(ret[1]);
351
+ }
352
+ return takeFromExternrefTable0(ret[0]);
353
+ }
240
354
  /**
241
355
  * Update all matching documents. Returns the count updated.
242
356
  * @param {any} filter
@@ -640,6 +754,26 @@ export class WorkerDB {
640
754
  }
641
755
  return ret[0] >>> 0;
642
756
  }
757
+ /**
758
+ * Delete many documents by id, in one commit. Returns the number removed.
759
+ * @param {string} collection
760
+ * @param {string} ids_json
761
+ * @param {string} origin
762
+ * @returns {number}
763
+ */
764
+ deleteManyWithIds(collection, ids_json, origin) {
765
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
766
+ const len0 = WASM_VECTOR_LEN;
767
+ const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
768
+ const len1 = WASM_VECTOR_LEN;
769
+ const ptr2 = passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
770
+ const len2 = WASM_VECTOR_LEN;
771
+ const ret = wasm.workerdb_deleteManyWithIds(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
772
+ if (ret[2]) {
773
+ throw takeFromExternrefTable0(ret[1]);
774
+ }
775
+ return ret[0] >>> 0;
776
+ }
643
777
  /**
644
778
  * Delete the first matching document. Returns `true` / `false`.
645
779
  * @param {string} collection
@@ -866,6 +1000,54 @@ export class WorkerDB {
866
1000
  throw takeFromExternrefTable0(ret[0]);
867
1001
  }
868
1002
  }
1003
+ /**
1004
+ * Hybrid retrieval — BM25 and vector similarity fused with reciprocal
1005
+ * rank fusion.
1006
+ *
1007
+ * `options_json` accepts `{ rrfK, textWeight, vectorWeight, candidates, k1, b }`.
1008
+ * Returns a JSON array of `{ document, score, textRank, vectorRank }`.
1009
+ * @param {string} collection
1010
+ * @param {string} text_field
1011
+ * @param {string} text
1012
+ * @param {string} vector_field
1013
+ * @param {string} vector_json
1014
+ * @param {number} top_k
1015
+ * @param {string} filter_json
1016
+ * @param {string} options_json
1017
+ * @returns {string}
1018
+ */
1019
+ hybridSearch(collection, text_field, text, vector_field, vector_json, top_k, filter_json, options_json) {
1020
+ let deferred9_0;
1021
+ let deferred9_1;
1022
+ try {
1023
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1024
+ const len0 = WASM_VECTOR_LEN;
1025
+ const ptr1 = passStringToWasm0(text_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1026
+ const len1 = WASM_VECTOR_LEN;
1027
+ const ptr2 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1028
+ const len2 = WASM_VECTOR_LEN;
1029
+ const ptr3 = passStringToWasm0(vector_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1030
+ const len3 = WASM_VECTOR_LEN;
1031
+ const ptr4 = passStringToWasm0(vector_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1032
+ const len4 = WASM_VECTOR_LEN;
1033
+ const ptr5 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1034
+ const len5 = WASM_VECTOR_LEN;
1035
+ const ptr6 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1036
+ const len6 = WASM_VECTOR_LEN;
1037
+ const ret = wasm.workerdb_hybridSearch(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, top_k, ptr5, len5, ptr6, len6);
1038
+ var ptr8 = ret[0];
1039
+ var len8 = ret[1];
1040
+ if (ret[3]) {
1041
+ ptr8 = 0; len8 = 0;
1042
+ throw takeFromExternrefTable0(ret[2]);
1043
+ }
1044
+ deferred9_0 = ptr8;
1045
+ deferred9_1 = len8;
1046
+ return getStringFromWasm0(ptr8, len8);
1047
+ } finally {
1048
+ wasm.__wbindgen_free(deferred9_0, deferred9_1, 1);
1049
+ }
1050
+ }
869
1051
  /**
870
1052
  * Import a remote changeset and merge it into the local database using
871
1053
  * Last-Write-Wins conflict resolution.
@@ -1157,6 +1339,86 @@ export class WorkerDB {
1157
1339
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1158
1340
  }
1159
1341
  }
1342
+ /**
1343
+ * Upsert many documents **by caller-supplied `_id`**, in one commit.
1344
+ *
1345
+ * Unlike `insert_many` — which discards `_id` and mints a fresh ULID — this
1346
+ * honours the id in each document. That is what lets the replication
1347
+ * coordinator address a remote row by a *derived* id (see `deriveDocId`) and
1348
+ * have repeated fetches converge on one document instead of duplicating it.
1349
+ *
1350
+ * `origin` is `"remote"` for authoritative rows replicated in from an origin,
1351
+ * or `"local"` for ordinary user writes. Remote rows are marked so they can
1352
+ * never replicate back out — see `Collection::replace_many_with_ids`.
1353
+ * @param {string} collection
1354
+ * @param {string} docs_json
1355
+ * @param {string} origin
1356
+ * @returns {string}
1357
+ */
1358
+ replaceManyWithIds(collection, docs_json, origin) {
1359
+ let deferred5_0;
1360
+ let deferred5_1;
1361
+ try {
1362
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1363
+ const len0 = WASM_VECTOR_LEN;
1364
+ const ptr1 = passStringToWasm0(docs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1365
+ const len1 = WASM_VECTOR_LEN;
1366
+ const ptr2 = passStringToWasm0(origin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1367
+ const len2 = WASM_VECTOR_LEN;
1368
+ const ret = wasm.workerdb_replaceManyWithIds(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1369
+ var ptr4 = ret[0];
1370
+ var len4 = ret[1];
1371
+ if (ret[3]) {
1372
+ ptr4 = 0; len4 = 0;
1373
+ throw takeFromExternrefTable0(ret[2]);
1374
+ }
1375
+ deferred5_0 = ptr4;
1376
+ deferred5_1 = len4;
1377
+ return getStringFromWasm0(ptr4, len4);
1378
+ } finally {
1379
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
1380
+ }
1381
+ }
1382
+ /**
1383
+ * Rank documents against a free-text query using BM25 (OR semantics).
1384
+ *
1385
+ * Returns a JSON array of `{ document, score }`.
1386
+ * @param {string} collection
1387
+ * @param {string} field
1388
+ * @param {string} query
1389
+ * @param {number} top_k
1390
+ * @param {string} filter_json
1391
+ * @param {string} options_json
1392
+ * @returns {string}
1393
+ */
1394
+ searchText(collection, field, query, top_k, filter_json, options_json) {
1395
+ let deferred7_0;
1396
+ let deferred7_1;
1397
+ try {
1398
+ const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1399
+ const len0 = WASM_VECTOR_LEN;
1400
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1401
+ const len1 = WASM_VECTOR_LEN;
1402
+ const ptr2 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1403
+ const len2 = WASM_VECTOR_LEN;
1404
+ const ptr3 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1405
+ const len3 = WASM_VECTOR_LEN;
1406
+ const ptr4 = passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1407
+ const len4 = WASM_VECTOR_LEN;
1408
+ const ret = wasm.workerdb_searchText(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, top_k, ptr3, len3, ptr4, len4);
1409
+ var ptr6 = ret[0];
1410
+ var len6 = ret[1];
1411
+ if (ret[3]) {
1412
+ ptr6 = 0; len6 = 0;
1413
+ throw takeFromExternrefTable0(ret[2]);
1414
+ }
1415
+ deferred7_0 = ptr6;
1416
+ deferred7_1 = len6;
1417
+ return getStringFromWasm0(ptr6, len6);
1418
+ } finally {
1419
+ wasm.__wbindgen_free(deferred7_0, deferred7_1, 1);
1420
+ }
1421
+ }
1160
1422
  /**
1161
1423
  * Set write durability: `eventual = true` batches OPFS fsyncs for
1162
1424
  * throughput (call `flush()` to force), `false` (default) fsyncs each
@@ -1766,7 +2028,7 @@ function __wbg_get_imports() {
1766
2028
  const a = state0.a;
1767
2029
  state0.a = 0;
1768
2030
  try {
1769
- return wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(a, state0.b, arg0, arg1);
2031
+ return wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1770
2032
  } finally {
1771
2033
  state0.a = a;
1772
2034
  }
@@ -1788,7 +2050,7 @@ function __wbg_get_imports() {
1788
2050
  const a = state0.a;
1789
2051
  state0.a = 0;
1790
2052
  try {
1791
- return wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(a, state0.b, arg0, arg1);
2053
+ return wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1792
2054
  } finally {
1793
2055
  state0.a = a;
1794
2056
  }
@@ -1972,18 +2234,18 @@ function __wbg_get_imports() {
1972
2234
  return ret;
1973
2235
  },
1974
2236
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1975
- // Cast intrinsic for `Closure(Closure { dtor_idx: 144, function: Function { arguments: [Externref], shim_idx: 145, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1976
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_);
2237
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 142, function: Function { arguments: [Externref], shim_idx: 143, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2238
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output_______, wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue______true_);
1977
2239
  return ret;
1978
2240
  },
1979
2241
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1980
- // Cast intrinsic for `Closure(Closure { dtor_idx: 224, function: Function { arguments: [], shim_idx: 225, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1981
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_);
2242
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 222, function: Function { arguments: [], shim_idx: 223, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2243
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut_____Output_______, wasm_bindgen_4501a39796791c69___convert__closures_____invoke_______true_);
1982
2244
  return ret;
1983
2245
  },
1984
2246
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1985
- // Cast intrinsic for `Closure(Closure { dtor_idx: 700, function: Function { arguments: [Externref], shim_idx: 701, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1986
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___, wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_);
2247
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 702, function: Function { arguments: [Externref], shim_idx: 703, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2248
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output___core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___, wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___true_);
1987
2249
  return ret;
1988
2250
  },
1989
2251
  __wbindgen_cast_0000000000000004: function(arg0) {
@@ -2034,23 +2296,23 @@ function __wbg_get_imports() {
2034
2296
  };
2035
2297
  }
2036
2298
 
2037
- function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_(arg0, arg1) {
2038
- wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_(arg0, arg1);
2299
+ function wasm_bindgen_4501a39796791c69___convert__closures_____invoke_______true_(arg0, arg1) {
2300
+ wasm.wasm_bindgen_4501a39796791c69___convert__closures_____invoke_______true_(arg0, arg1);
2039
2301
  }
2040
2302
 
2041
- function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_(arg0, arg1, arg2) {
2042
- wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_(arg0, arg1, arg2);
2303
+ function wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue______true_(arg0, arg1, arg2) {
2304
+ wasm.wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue______true_(arg0, arg1, arg2);
2043
2305
  }
2044
2306
 
2045
- function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_(arg0, arg1, arg2) {
2046
- const ret = wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_(arg0, arg1, arg2);
2307
+ function wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___true_(arg0, arg1, arg2) {
2308
+ const ret = wasm.wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___true_(arg0, arg1, arg2);
2047
2309
  if (ret[1]) {
2048
2310
  throw takeFromExternrefTable0(ret[0]);
2049
2311
  }
2050
2312
  }
2051
2313
 
2052
- function wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
2053
- wasm.wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
2314
+ function wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
2315
+ wasm.wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
2054
2316
  }
2055
2317
 
2056
2318
 
Binary file
@@ -11,6 +11,7 @@ export const workerdb_createFtsIndex: (a: number, b: number, c: number, d: numbe
11
11
  export const workerdb_createIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
12
12
  export const workerdb_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
13
13
  export const workerdb_deleteMany: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
14
+ export const workerdb_deleteManyWithIds: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
14
15
  export const workerdb_deleteOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
15
16
  export const workerdb_dropCompoundIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
16
17
  export const workerdb_dropFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
@@ -22,6 +23,7 @@ export const workerdb_find: (a: number, b: number, c: number, d: number, e: numb
22
23
  export const workerdb_findNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
23
24
  export const workerdb_findOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
24
25
  export const workerdb_flush: (a: number) => [number, number];
26
+ export const workerdb_hybridSearch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => [number, number, number, number];
25
27
  export const workerdb_importChangeset: (a: number, b: number, c: number) => [number, number, number];
26
28
  export const workerdb_importChangesetValidated: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
27
29
  export const workerdb_insert: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
@@ -34,6 +36,8 @@ export const workerdb_openWithConfigAndSnapshot: (a: number, b: number, c: numbe
34
36
  export const workerdb_openWithOpfs: (a: any) => [number, number, number];
35
37
  export const workerdb_openWithSnapshot: (a: number, b: number) => [number, number, number];
36
38
  export const workerdb_quarantined: (a: number, b: number, c: number) => [number, number, number, number];
39
+ export const workerdb_replaceManyWithIds: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
40
+ export const workerdb_searchText: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
37
41
  export const workerdb_setDurability: (a: number, b: number) => void;
38
42
  export const workerdb_setUserVersion: (a: number, b: number) => [number, number];
39
43
  export const workerdb_syncPending: (a: number) => bigint;
@@ -47,18 +51,24 @@ export const __wbg_taladbwasm_free: (a: number, b: number) => void;
47
51
  export const collectionwasm_aggregate: (a: number, b: any) => [number, number, number];
48
52
  export const collectionwasm_count: (a: number, b: any) => [number, number, number];
49
53
  export const collectionwasm_createCompoundIndex: (a: number, b: number, c: number) => [number, number];
54
+ export const collectionwasm_createFtsIndex: (a: number, b: number, c: number) => [number, number];
50
55
  export const collectionwasm_createIndex: (a: number, b: number, c: number) => [number, number];
51
56
  export const collectionwasm_createVectorIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
52
57
  export const collectionwasm_deleteMany: (a: number, b: any) => [number, number, number];
58
+ export const collectionwasm_deleteManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
53
59
  export const collectionwasm_deleteOne: (a: number, b: any) => [number, number, number];
54
60
  export const collectionwasm_dropCompoundIndex: (a: number, b: number, c: number) => [number, number];
61
+ export const collectionwasm_dropFtsIndex: (a: number, b: number, c: number) => [number, number];
55
62
  export const collectionwasm_dropIndex: (a: number, b: number, c: number) => [number, number];
56
63
  export const collectionwasm_dropVectorIndex: (a: number, b: number, c: number) => [number, number];
57
64
  export const collectionwasm_find: (a: number, b: any) => [number, number, number];
58
65
  export const collectionwasm_findNearest: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => [number, number, number];
59
66
  export const collectionwasm_findOne: (a: number, b: any) => [number, number, number];
67
+ export const collectionwasm_hybridSearch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: any, l: any) => [number, number, number];
60
68
  export const collectionwasm_insert: (a: number, b: any) => [number, number, number, number];
61
69
  export const collectionwasm_insertMany: (a: number, b: any) => [number, number, number];
70
+ export const collectionwasm_replaceManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
71
+ export const collectionwasm_searchText: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any) => [number, number, number];
62
72
  export const collectionwasm_updateMany: (a: number, b: any, c: any) => [number, number, number];
63
73
  export const collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
64
74
  export const collectionwasm_upgradeVectorIndex: (a: number, b: number, c: number) => [number, number];
@@ -72,20 +82,20 @@ export const taladbwasm_openWithSnapshot: (a: number, b: number) => [number, num
72
82
  export const taladbwasm_setUserVersion: (a: number, b: number) => [number, number];
73
83
  export const taladbwasm_userVersion: (a: number) => [number, number, number];
74
84
  export const init: () => void;
75
- export const opfs_open_backend: (a: number, b: number) => any;
76
- export const idb_load_snapshot: (a: number, b: number) => any;
77
- export const idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
78
85
  export const is_opfs_available: () => any;
79
86
  export const opfs_delete_snapshot: (a: number, b: number) => any;
80
87
  export const opfs_flush_snapshot: (a: number, b: number, c: number, d: number) => any;
81
88
  export const opfs_load_snapshot: (a: number, b: number) => any;
82
- export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output_______: (a: number, b: number) => void;
83
- export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
84
- export const wasm_bindgen_60ce93de3f474933___closure__destroy___dyn_core_7d5f0a2ba6a62c33___ops__function__FnMut__wasm_bindgen_60ce93de3f474933___JsValue____Output___core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___: (a: number, b: number) => void;
85
- export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_60ce93de3f474933___JsError___true_: (a: number, b: number, c: any) => [number, number];
86
- export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined___js_sys_517e1093b71f55ec___Function_fn_wasm_bindgen_60ce93de3f474933___JsValue_____wasm_bindgen_60ce93de3f474933___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
87
- export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke___wasm_bindgen_60ce93de3f474933___JsValue______true_: (a: number, b: number, c: any) => void;
88
- export const wasm_bindgen_60ce93de3f474933___convert__closures_____invoke_______true_: (a: number, b: number) => void;
89
+ export const idb_load_snapshot: (a: number, b: number) => any;
90
+ export const idb_save_snapshot: (a: number, b: number, c: number, d: number) => any;
91
+ export const opfs_open_backend: (a: number, b: number) => any;
92
+ export const wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output_______: (a: number, b: number) => void;
93
+ export const wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut_____Output_______: (a: number, b: number) => void;
94
+ export const wasm_bindgen_4501a39796791c69___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_4501a39796791c69___JsValue____Output___core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___: (a: number, b: number) => void;
95
+ export const wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_4501a39796791c69___JsError___true_: (a: number, b: number, c: any) => [number, number];
96
+ export const wasm_bindgen_4501a39796791c69___convert__closures_____invoke___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined___js_sys_d1fdfe5cb3da44fc___Function_fn_wasm_bindgen_4501a39796791c69___JsValue_____wasm_bindgen_4501a39796791c69___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
97
+ export const wasm_bindgen_4501a39796791c69___convert__closures_____invoke___wasm_bindgen_4501a39796791c69___JsValue______true_: (a: number, b: number, c: any) => void;
98
+ export const wasm_bindgen_4501a39796791c69___convert__closures_____invoke_______true_: (a: number, b: number) => void;
89
99
  export const __wbindgen_malloc: (a: number, b: number) => number;
90
100
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
91
101
  export const __wbindgen_exn_store: (a: number) => void;
@@ -49,6 +49,8 @@
49
49
  * dropVectorIndex { collection, field }
50
50
  * upgradeVectorIndex { collection, field }
51
51
  * findNearest { collection, field, queryJson, topK, filterJson? }
52
+ * searchText { collection, field, query, topK, filterJson?, optionsJson? }
53
+ * hybridSearch { collection, textField, text, vectorField, vectorJson, topK, filterJson?, optionsJson? }
52
54
  * listCollections {} → JSON string[]
53
55
  * compact {} → null
54
56
  * compactTombstones { collection, beforeMs } → number pruned
@@ -432,6 +434,18 @@ async function dispatch(op, args) {
432
434
  return result;
433
435
  }
434
436
 
437
+ case 'replaceManyWithIds': {
438
+ const result = db.replaceManyWithIds(args.collection, args.docsJson, args.origin);
439
+ onWriteCommitted();
440
+ return result;
441
+ }
442
+
443
+ case 'deleteManyWithIds': {
444
+ const result = db.deleteManyWithIds(args.collection, args.idsJson, args.origin);
445
+ onWriteCommitted();
446
+ return result;
447
+ }
448
+
435
449
  case 'find':
436
450
  return db.find(args.collection, args.filterJson ?? 'null');
437
451
 
@@ -524,6 +538,28 @@ async function dispatch(op, args) {
524
538
  args.filterJson ?? 'null',
525
539
  );
526
540
 
541
+ case 'searchText':
542
+ return db.searchText(
543
+ args.collection,
544
+ args.field,
545
+ args.query,
546
+ args.topK,
547
+ args.filterJson ?? 'null',
548
+ args.optionsJson ?? 'null',
549
+ );
550
+
551
+ case 'hybridSearch':
552
+ return db.hybridSearch(
553
+ args.collection,
554
+ args.textField,
555
+ args.text,
556
+ args.vectorField,
557
+ args.vectorJson,
558
+ args.topK,
559
+ args.filterJson ?? 'null',
560
+ args.optionsJson ?? 'null',
561
+ );
562
+
527
563
  case 'listCollections':
528
564
  return db.listCollections();
529
565