@taladb/web 0.10.2 → 0.11.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-MIT +21 -0
- package/package.json +9 -3
- package/pkg/LICENSE-APACHE +202 -0
- package/pkg/LICENSE-MIT +21 -0
- package/pkg/package.json +3 -3
- package/pkg/taladb_web.d.ts +19 -115
- package/pkg/taladb_web.js +45 -316
- package/pkg/taladb_web_bg.wasm +0 -0
- package/pkg/taladb_web_bg.wasm.d.ts +3 -14
- package/worker/taladb.worker.js +320 -141
- /package/{LICENSE → LICENSE-APACHE} +0 -0
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 taladb
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taladb/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|
|
@@ -13,9 +13,14 @@
|
|
|
13
13
|
"./worker/*": "./worker/*"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
+
"LICENSE-APACHE",
|
|
17
|
+
"LICENSE-MIT",
|
|
16
18
|
"pkg/",
|
|
17
19
|
"worker/"
|
|
18
20
|
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"puppeteer-core": "^23.0.0"
|
|
23
|
+
},
|
|
19
24
|
"repository": {
|
|
20
25
|
"type": "git",
|
|
21
26
|
"url": "https://github.com/taladb/taladb.git",
|
|
@@ -28,10 +33,11 @@
|
|
|
28
33
|
"engines": {
|
|
29
34
|
"node": ">=18"
|
|
30
35
|
},
|
|
31
|
-
"license": "Apache-2.0",
|
|
36
|
+
"license": "MIT OR Apache-2.0",
|
|
32
37
|
"scripts": {
|
|
33
38
|
"build": "wasm-pack build --target web --out-dir pkg --release",
|
|
34
39
|
"build:dev": "wasm-pack build --target web --out-dir pkg --dev",
|
|
35
|
-
"test": "wasm-pack test --headless --chrome"
|
|
40
|
+
"test": "wasm-pack test --headless --chrome",
|
|
41
|
+
"test:e2e": "node e2e/run.mjs"
|
|
36
42
|
}
|
|
37
43
|
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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 taladb
|
|
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/pkg/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 taladb
|
|
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.
|
package/pkg/package.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"collaborators": [
|
|
5
5
|
"taladb"
|
|
6
6
|
],
|
|
7
|
-
"description": "TalaDB browser WASM bindings (wasm-bindgen + OPFS)
|
|
8
|
-
"version": "0.
|
|
9
|
-
"license": "Apache-2.0",
|
|
7
|
+
"description": "TalaDB browser WASM bindings (wasm-bindgen + OPFS)",
|
|
8
|
+
"version": "0.11.0",
|
|
9
|
+
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/taladb/taladb"
|
package/pkg/taladb_web.d.ts
CHANGED
|
@@ -40,10 +40,6 @@ export class CollectionWasm {
|
|
|
40
40
|
* Delete all matching documents. Returns the count deleted.
|
|
41
41
|
*/
|
|
42
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;
|
|
47
43
|
/**
|
|
48
44
|
* Delete the first matching document. Returns true if deleted.
|
|
49
45
|
*/
|
|
@@ -97,18 +93,6 @@ export class CollectionWasm {
|
|
|
97
93
|
* Insert multiple documents. Returns an array of ULID string ids.
|
|
98
94
|
*/
|
|
99
95
|
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
96
|
/**
|
|
113
97
|
* Rank documents against a free-text query using BM25 (OR semantics).
|
|
114
98
|
*
|
|
@@ -137,12 +121,6 @@ export class TalaDBWasm {
|
|
|
137
121
|
* Get a collection handle by name.
|
|
138
122
|
*/
|
|
139
123
|
collection(name: string): CollectionWasm;
|
|
140
|
-
/**
|
|
141
|
-
* Export changes to `collections` after `sinceMs` (exclusive) as a JSON
|
|
142
|
-
* changeset string, for bidirectional sync. `sinceMs` is a millisecond
|
|
143
|
-
* epoch timestamp (the persisted sync cursor).
|
|
144
|
-
*/
|
|
145
|
-
exportChanges(since_ms: number, collections: string[]): string;
|
|
146
124
|
/**
|
|
147
125
|
* Serialize the entire in-memory database to bytes.
|
|
148
126
|
*
|
|
@@ -151,14 +129,8 @@ export class TalaDBWasm {
|
|
|
151
129
|
* `openWithSnapshot` to restore all data.
|
|
152
130
|
*/
|
|
153
131
|
exportSnapshot(): Uint8Array;
|
|
154
|
-
/**
|
|
155
|
-
* Merge a JSON changeset string (from a remote peer) into the local
|
|
156
|
-
* database via Last-Write-Wins. Returns the number of documents changed.
|
|
157
|
-
*/
|
|
158
|
-
importChanges(changeset_json: string): number;
|
|
159
132
|
/**
|
|
160
133
|
* User collection names (reserved `_`-prefixed collections excluded).
|
|
161
|
-
* Backs the sync orchestration's "sync all collections" default.
|
|
162
134
|
*/
|
|
163
135
|
listCollectionNames(): string[];
|
|
164
136
|
/**
|
|
@@ -212,20 +184,6 @@ export class WorkerDB {
|
|
|
212
184
|
* ```
|
|
213
185
|
*/
|
|
214
186
|
compact(): void;
|
|
215
|
-
/**
|
|
216
|
-
* Remove tombstones older than `before_ms` from the given collection.
|
|
217
|
-
*
|
|
218
|
-
* Call periodically (e.g. on app startup) after your sync retention window
|
|
219
|
-
* has elapsed so deleted document IDs no longer accumulate indefinitely.
|
|
220
|
-
* Returns the number of tombstones removed.
|
|
221
|
-
*
|
|
222
|
-
* ```js
|
|
223
|
-
* // Prune tombstones older than 30 days
|
|
224
|
-
* const cutoff = Date.now() - 30 * 24 * 60 * 60 * 1000;
|
|
225
|
-
* const pruned = db.compactTombstones('users', cutoff);
|
|
226
|
-
* ```
|
|
227
|
-
*/
|
|
228
|
-
compactTombstones(collection: string, before_ms: number): number;
|
|
229
187
|
/**
|
|
230
188
|
* Count matching documents.
|
|
231
189
|
*/
|
|
@@ -250,9 +208,10 @@ export class WorkerDB {
|
|
|
250
208
|
*/
|
|
251
209
|
deleteMany(collection: string, filter_json: string): number;
|
|
252
210
|
/**
|
|
253
|
-
* Delete
|
|
211
|
+
* Delete documents by id. Returns how many were present and removed.
|
|
212
|
+
* The delete half of cross-tab write propagation.
|
|
254
213
|
*/
|
|
255
|
-
deleteManyWithIds(collection: string, ids_json: string
|
|
214
|
+
deleteManyWithIds(collection: string, ids_json: string): number;
|
|
256
215
|
/**
|
|
257
216
|
* Delete the first matching document. Returns `true` / `false`.
|
|
258
217
|
*/
|
|
@@ -267,18 +226,6 @@ export class WorkerDB {
|
|
|
267
226
|
* Drop a vector index (and its HNSW graph if present).
|
|
268
227
|
*/
|
|
269
228
|
dropVectorIndex(collection: string, field: string): void;
|
|
270
|
-
/**
|
|
271
|
-
* Export a changeset for the given collections since `since_ms`.
|
|
272
|
-
*
|
|
273
|
-
* Returns a JSON string representing `Vec<Change>` that can be sent
|
|
274
|
-
* to a remote peer via fetch, WebSocket, or SSE.
|
|
275
|
-
*
|
|
276
|
-
* ```js
|
|
277
|
-
* const json = db.exportChangeset(JSON.stringify(['users', 'posts']), 0);
|
|
278
|
-
* await fetch('/sync', { method: 'POST', body: json });
|
|
279
|
-
* ```
|
|
280
|
-
*/
|
|
281
|
-
exportChangeset(collections_json: string, since_ms: number): string;
|
|
282
229
|
/**
|
|
283
230
|
* Serialize the entire in-memory database to bytes for persistence.
|
|
284
231
|
*
|
|
@@ -311,26 +258,6 @@ export class WorkerDB {
|
|
|
311
258
|
* Returns a JSON array of `{ document, score, textRank, vectorRank }`.
|
|
312
259
|
*/
|
|
313
260
|
hybridSearch(collection: string, text_field: string, text: string, vector_field: string, vector_json: string, top_k: number, filter_json: string, options_json: string): string;
|
|
314
|
-
/**
|
|
315
|
-
* Import a remote changeset and merge it into the local database using
|
|
316
|
-
* Last-Write-Wins conflict resolution.
|
|
317
|
-
*
|
|
318
|
-
* Returns the number of documents actually changed.
|
|
319
|
-
*
|
|
320
|
-
* ```js
|
|
321
|
-
* const resp = await fetch('/sync?since=' + lastSync);
|
|
322
|
-
* const applied = db.importChangeset(await resp.text());
|
|
323
|
-
* if (applied > 0) { rerender(); }
|
|
324
|
-
* ```
|
|
325
|
-
*/
|
|
326
|
-
importChangeset(changeset_json: string): number;
|
|
327
|
-
/**
|
|
328
|
-
* Import a remote changeset through a tolerant structural validator built
|
|
329
|
-
* from `schemas_json` (`{ "<collection>": { version, required, types,
|
|
330
|
-
* defaults } }`). Returns a JSON `{ applied, skipped, quarantined }`.
|
|
331
|
-
* Rejected documents are set aside (see `quarantined`), never dropped.
|
|
332
|
-
*/
|
|
333
|
-
importChangesetValidated(changeset_json: string, schemas_json: string): string;
|
|
334
261
|
/**
|
|
335
262
|
* Insert a document. Returns the new ULID as a string.
|
|
336
263
|
*/
|
|
@@ -341,7 +268,6 @@ export class WorkerDB {
|
|
|
341
268
|
insertMany(collection: string, docs_json: string): string;
|
|
342
269
|
/**
|
|
343
270
|
* Returns a JSON array of all collection names in the database.
|
|
344
|
-
* Used by the Worker to build the collections list for exportChangeset.
|
|
345
271
|
*/
|
|
346
272
|
listCollections(): string;
|
|
347
273
|
/**
|
|
@@ -356,8 +282,6 @@ export class WorkerDB {
|
|
|
356
282
|
/**
|
|
357
283
|
* Open a database backed by OPFS with HTTP push sync config.
|
|
358
284
|
*
|
|
359
|
-
* Not available when compiled with the `cf-workers` feature.
|
|
360
|
-
*
|
|
361
285
|
* `config_json` - JSON-serialised `TalaDbConfig`, or `null` to open without sync.
|
|
362
286
|
*
|
|
363
287
|
* ```js
|
|
@@ -379,8 +303,6 @@ export class WorkerDB {
|
|
|
379
303
|
/**
|
|
380
304
|
* Open a database backed by an OPFS `FileSystemSyncAccessHandle`.
|
|
381
305
|
*
|
|
382
|
-
* Not available when compiled with the `cf-workers` feature.
|
|
383
|
-
*
|
|
384
306
|
* Call sequence in the SharedWorker:
|
|
385
307
|
* ```js
|
|
386
308
|
* const handle = await file_handle.createSyncAccessHandle();
|
|
@@ -400,24 +322,6 @@ export class WorkerDB {
|
|
|
400
322
|
* ```
|
|
401
323
|
*/
|
|
402
324
|
static openWithSnapshot(data?: Uint8Array | null): WorkerDB;
|
|
403
|
-
/**
|
|
404
|
-
* Documents set aside in `collection`'s quarantine table, as a JSON array
|
|
405
|
-
* of `{ document, reason, changedAt }`.
|
|
406
|
-
*/
|
|
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
325
|
/**
|
|
422
326
|
* Rank documents against a free-text query using BM25 (OR semantics).
|
|
423
327
|
*
|
|
@@ -435,8 +339,6 @@ export class WorkerDB {
|
|
|
435
339
|
* body succeeds so a crash mid-run resumes from the last applied version.
|
|
436
340
|
*/
|
|
437
341
|
setUserVersion(version: number): void;
|
|
438
|
-
syncPending(): bigint;
|
|
439
|
-
syncStatus(): string;
|
|
440
342
|
/**
|
|
441
343
|
* Update all matching documents. Returns the count updated.
|
|
442
344
|
*/
|
|
@@ -452,6 +354,19 @@ export class WorkerDB {
|
|
|
452
354
|
* No-op when the `vector-hnsw` feature is disabled or the index is flat-only.
|
|
453
355
|
*/
|
|
454
356
|
upgradeVectorIndex(collection: string, field: string): void;
|
|
357
|
+
/**
|
|
358
|
+
* Upsert documents **by their own `_id`**, in one commit per document.
|
|
359
|
+
*
|
|
360
|
+
* Backs cross-tab write propagation: a tab that cannot hold the OPFS lock
|
|
361
|
+
* writes to an in-memory database, then forwards the committed documents
|
|
362
|
+
* here so the tab holding the lock applies them to the durable file. The
|
|
363
|
+
* `_id`s travel with the documents, so an id an application already holds
|
|
364
|
+
* stays valid after the hand-off — which a plain re-`insert` would break by
|
|
365
|
+
* minting a new ULID.
|
|
366
|
+
*
|
|
367
|
+
* Unlike `insert_many`, a caller-supplied `_id` is required, not ignored.
|
|
368
|
+
*/
|
|
369
|
+
upsertManyWithIds(collection: string, docs_json: string): string;
|
|
455
370
|
/**
|
|
456
371
|
* Read the current application migration version (0 if never set). Backs
|
|
457
372
|
* the `openDB({ migrations })` runner, which advances it per migration.
|
|
@@ -531,7 +446,6 @@ export interface InitOutput {
|
|
|
531
446
|
readonly collectionwasm_createIndex: (a: number, b: number, c: number) => [number, number];
|
|
532
447
|
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];
|
|
533
448
|
readonly collectionwasm_deleteMany: (a: number, b: any) => [number, number, number];
|
|
534
|
-
readonly collectionwasm_deleteManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
535
449
|
readonly collectionwasm_deleteOne: (a: number, b: any) => [number, number, number];
|
|
536
450
|
readonly collectionwasm_dropCompoundIndex: (a: number, b: number, c: number) => [number, number];
|
|
537
451
|
readonly collectionwasm_dropFtsIndex: (a: number, b: number, c: number) => [number, number];
|
|
@@ -543,7 +457,6 @@ export interface InitOutput {
|
|
|
543
457
|
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];
|
|
544
458
|
readonly collectionwasm_insert: (a: number, b: any) => [number, number, number, number];
|
|
545
459
|
readonly collectionwasm_insertMany: (a: number, b: any) => [number, number, number];
|
|
546
|
-
readonly collectionwasm_replaceManyWithIds: (a: number, b: any, c: number, d: number) => [number, number, number];
|
|
547
460
|
readonly collectionwasm_searchText: (a: number, b: number, c: number, d: number, e: number, f: number, g: any, h: any) => [number, number, number];
|
|
548
461
|
readonly collectionwasm_updateMany: (a: number, b: any, c: any) => [number, number, number];
|
|
549
462
|
readonly collectionwasm_updateOne: (a: number, b: any, c: any) => [number, number, number];
|
|
@@ -556,9 +469,7 @@ export interface InitOutput {
|
|
|
556
469
|
readonly opfs_load_snapshot: (a: number, b: number) => any;
|
|
557
470
|
readonly opfs_open_backend: (a: number, b: number) => any;
|
|
558
471
|
readonly taladbwasm_collection: (a: number, b: number, c: number) => [number, number, number];
|
|
559
|
-
readonly taladbwasm_exportChanges: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
560
472
|
readonly taladbwasm_exportSnapshot: (a: number) => [number, number, number, number];
|
|
561
|
-
readonly taladbwasm_importChanges: (a: number, b: number, c: number) => [number, number, number];
|
|
562
473
|
readonly taladbwasm_listCollectionNames: (a: number) => [number, number, number, number];
|
|
563
474
|
readonly taladbwasm_openInMemory: () => [number, number, number];
|
|
564
475
|
readonly taladbwasm_openWithSnapshot: (a: number, b: number) => [number, number, number];
|
|
@@ -566,28 +477,24 @@ export interface InitOutput {
|
|
|
566
477
|
readonly taladbwasm_userVersion: (a: number) => [number, number, number];
|
|
567
478
|
readonly workerdb_aggregate: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
568
479
|
readonly workerdb_compact: (a: number) => [number, number];
|
|
569
|
-
readonly workerdb_compactTombstones: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
570
480
|
readonly workerdb_count: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
571
481
|
readonly workerdb_createCompoundIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
572
482
|
readonly workerdb_createFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
573
483
|
readonly workerdb_createIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
574
484
|
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];
|
|
575
485
|
readonly workerdb_deleteMany: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
576
|
-
readonly workerdb_deleteManyWithIds: (a: number, b: number, c: number, d: number, e: number
|
|
486
|
+
readonly workerdb_deleteManyWithIds: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
577
487
|
readonly workerdb_deleteOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
578
488
|
readonly workerdb_dropCompoundIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
579
489
|
readonly workerdb_dropFtsIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
580
490
|
readonly workerdb_dropIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
581
491
|
readonly workerdb_dropVectorIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
582
|
-
readonly workerdb_exportChangeset: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
583
492
|
readonly workerdb_exportSnapshot: (a: number) => [number, number, number, number];
|
|
584
493
|
readonly workerdb_find: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
585
494
|
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];
|
|
586
495
|
readonly workerdb_findOne: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
587
496
|
readonly workerdb_flush: (a: number) => [number, number];
|
|
588
497
|
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];
|
|
589
|
-
readonly workerdb_importChangeset: (a: number, b: number, c: number) => [number, number, number];
|
|
590
|
-
readonly workerdb_importChangesetValidated: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
591
498
|
readonly workerdb_insert: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
592
499
|
readonly workerdb_insertMany: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
593
500
|
readonly workerdb_listCollections: (a: number) => [number, number, number, number];
|
|
@@ -597,21 +504,18 @@ export interface InitOutput {
|
|
|
597
504
|
readonly workerdb_openWithConfigAndSnapshot: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
598
505
|
readonly workerdb_openWithOpfs: (a: any) => [number, number, number];
|
|
599
506
|
readonly workerdb_openWithSnapshot: (a: number, b: number) => [number, number, number];
|
|
600
|
-
readonly workerdb_quarantined: (a: number, b: number, c: number) => [number, number, number, number];
|
|
601
|
-
readonly workerdb_replaceManyWithIds: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
602
507
|
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];
|
|
603
508
|
readonly workerdb_setDurability: (a: number, b: number) => void;
|
|
604
509
|
readonly workerdb_setUserVersion: (a: number, b: number) => [number, number];
|
|
605
|
-
readonly workerdb_syncPending: (a: number) => bigint;
|
|
606
|
-
readonly workerdb_syncStatus: (a: number) => [number, number];
|
|
607
510
|
readonly workerdb_updateMany: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
608
511
|
readonly workerdb_updateOne: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
609
512
|
readonly workerdb_upgradeVectorIndex: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
513
|
+
readonly workerdb_upsertManyWithIds: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
610
514
|
readonly workerdb_userVersion: (a: number) => [number, number, number];
|
|
611
515
|
readonly workerdb_writeGeneration: (a: number, b: number, c: number) => [number, number, number];
|
|
612
516
|
readonly init: () => void;
|
|
613
|
-
readonly wasm_bindgen_188fd7264b65779d___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_188fd7264b65779d___JsValue____Output___core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_188fd7264b65779d___JsError___: (a: number, b: number) => void;
|
|
614
517
|
readonly wasm_bindgen_188fd7264b65779d___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_188fd7264b65779d___JsValue____Output_______: (a: number, b: number) => void;
|
|
518
|
+
readonly wasm_bindgen_188fd7264b65779d___closure__destroy___dyn_core_9b3796e30d99ddb7___ops__function__FnMut__wasm_bindgen_188fd7264b65779d___JsValue____Output___core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_188fd7264b65779d___JsError___: (a: number, b: number) => void;
|
|
615
519
|
readonly wasm_bindgen_188fd7264b65779d___convert__closures_____invoke___wasm_bindgen_188fd7264b65779d___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_188fd7264b65779d___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
616
520
|
readonly wasm_bindgen_188fd7264b65779d___convert__closures_____invoke___js_sys_6ed69cd23706a2fe___Function_fn_wasm_bindgen_188fd7264b65779d___JsValue_____wasm_bindgen_188fd7264b65779d___sys__Undefined___js_sys_6ed69cd23706a2fe___Function_fn_wasm_bindgen_188fd7264b65779d___JsValue_____wasm_bindgen_188fd7264b65779d___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
617
521
|
readonly wasm_bindgen_188fd7264b65779d___convert__closures_____invoke___wasm_bindgen_188fd7264b65779d___JsValue______true_: (a: number, b: number, c: any) => void;
|