@taladb/node 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
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/index.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ export declare class TalaDbNode {
|
|
|
10
10
|
/**
|
|
11
11
|
* Open a file-backed database at the given path.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
* every collection returned by `collection()`.
|
|
13
|
+
* `config_json` is an optional JSON-serialised `TalaDbConfig`; only its
|
|
14
|
+
* `durability` block is read here. Change webhooks are delivered by the
|
|
15
|
+
* `taladb` TypeScript client, not by this binding.
|
|
17
16
|
*/
|
|
18
17
|
static open(path: string, configJson?: string | undefined | null, passphrase?: string | undefined | null): TalaDbNode
|
|
19
18
|
/**
|
|
@@ -23,8 +22,8 @@ export declare class TalaDbNode {
|
|
|
23
22
|
flush(): void
|
|
24
23
|
/**
|
|
25
24
|
* Compact the underlying storage file, reclaiming space freed by deletes
|
|
26
|
-
* and updates. Call during idle periods after large bulk deletes
|
|
27
|
-
*
|
|
25
|
+
* and updates. Call during idle periods after large bulk deletes.
|
|
26
|
+
* Returns the number of bytes reclaimed (may be 0).
|
|
28
27
|
*/
|
|
29
28
|
compact(): void
|
|
30
29
|
/**
|
|
@@ -35,37 +34,8 @@ export declare class TalaDbNode {
|
|
|
35
34
|
* garbage-collected — drop them too to fully release the file.
|
|
36
35
|
*/
|
|
37
36
|
close(): void
|
|
38
|
-
/**
|
|
39
|
-
* List user collection names (excludes reserved `_`-prefixed collections
|
|
40
|
-
* such as the sync cursor store). Backs "sync all collections".
|
|
41
|
-
*/
|
|
37
|
+
/** List user collection names (excludes reserved `_`-prefixed collections). */
|
|
42
38
|
listCollectionNames(): Array<string>
|
|
43
|
-
/**
|
|
44
|
-
* Export changes to `collections` after `sinceMs` (exclusive) as a JSON
|
|
45
|
-
* changeset string, for the bidirectional sync orchestration. `sinceMs`
|
|
46
|
-
* is a millisecond epoch timestamp (the persisted sync cursor).
|
|
47
|
-
*/
|
|
48
|
-
exportChanges(sinceMs: number, collections: Array<string>): string
|
|
49
|
-
/**
|
|
50
|
-
* Merge a JSON changeset string (from a remote peer) into the local
|
|
51
|
-
* database via Last-Write-Wins. Returns the number of documents changed.
|
|
52
|
-
*/
|
|
53
|
-
importChanges(changesetJson: string): number
|
|
54
|
-
/**
|
|
55
|
-
* Merge a JSON changeset through a tolerant structural validator built from
|
|
56
|
-
* `schemas_json` — a `{ "<collection>": { version, required, types,
|
|
57
|
-
* defaults } }` object. Every imported upsert is normalized, skipped, or
|
|
58
|
-
* quarantined per its collection schema before Last-Write-Wins; a rejected
|
|
59
|
-
* document is set aside (see `quarantined`), never dropped, and never
|
|
60
|
-
* aborts the batch. Returns `{ applied, skipped, quarantined }`.
|
|
61
|
-
*/
|
|
62
|
-
importChangesValidated(changesetJson: string, schemasJson: string): JsonValue
|
|
63
|
-
/**
|
|
64
|
-
* Return every document currently held in `collection`'s quarantine table,
|
|
65
|
-
* each as `{ document, reason, changedAt }`. Empty when nothing has been
|
|
66
|
-
* set aside. For operator inspection and recovery tooling.
|
|
67
|
-
*/
|
|
68
|
-
quarantined(collection: string): Array<JsonValue>
|
|
69
39
|
/**
|
|
70
40
|
* Read the current application migration version (0 if never set). Backs
|
|
71
41
|
* the `openDB({ migrations })` runner, which advances it per migration.
|
|
@@ -76,10 +46,7 @@ export declare class TalaDbNode {
|
|
|
76
46
|
* body succeeds so a crash mid-run resumes from the last applied version.
|
|
77
47
|
*/
|
|
78
48
|
setUserVersion(version: number): void
|
|
79
|
-
/**
|
|
80
|
-
* Get a collection by name. If an HTTP sync hook is configured it is
|
|
81
|
-
* automatically attached to the returned collection.
|
|
82
|
-
*/
|
|
49
|
+
/** Get a collection by name. */
|
|
83
50
|
collection(name: string): CollectionNode
|
|
84
51
|
}
|
|
85
52
|
export declare class CollectionNode {
|
|
@@ -87,21 +54,6 @@ export declare class CollectionNode {
|
|
|
87
54
|
insert(doc: JsonValue): string
|
|
88
55
|
/** Insert multiple documents. */
|
|
89
56
|
insertMany(docs: Array<JsonValue>): Array<string>
|
|
90
|
-
/**
|
|
91
|
-
* Upsert many documents **by caller-supplied `_id`**, in one commit.
|
|
92
|
-
*
|
|
93
|
-
* Unlike `insertMany` — which discards `_id` and mints a fresh ULID — this
|
|
94
|
-
* honours the id on each document, which is what lets replication address a
|
|
95
|
-
* remote row by a *derived* id so repeated fetches converge on one document
|
|
96
|
-
* rather than duplicating it.
|
|
97
|
-
*
|
|
98
|
-
* `origin` is `"remote"` for authoritative rows replicated in from an origin,
|
|
99
|
-
* or `"local"` for ordinary user writes. Remote rows are marked so they can
|
|
100
|
-
* never replicate back out.
|
|
101
|
-
*/
|
|
102
|
-
replaceManyWithIds(docs: Array<JsonValue>, origin: string): Array<string>
|
|
103
|
-
/** Delete many documents by id, in one commit. Returns the number removed. */
|
|
104
|
-
deleteManyWithIds(ids: Array<string>, origin: string): number
|
|
105
57
|
/** Find documents matching the filter. */
|
|
106
58
|
find(filter: JsonValue): Array<JsonValue>
|
|
107
59
|
/** Find a single document or return null. */
|
|
@@ -200,21 +152,12 @@ export declare class CollectionNode {
|
|
|
200
152
|
*/
|
|
201
153
|
findAsync(filter: JsonValue): Promise<Array<any>>
|
|
202
154
|
/**
|
|
203
|
-
* Async variant of `insert` — the write
|
|
204
|
-
*
|
|
155
|
+
* Async variant of `insert` — the write runs on the libuv thread pool
|
|
156
|
+
* instead of blocking the JS thread.
|
|
205
157
|
*/
|
|
206
158
|
insertAsync(doc: JsonValue): Promise<string>
|
|
207
159
|
/** Async variant of `insertMany`. */
|
|
208
160
|
insertManyAsync(docs: Array<JsonValue>): Promise<Array<string>>
|
|
209
|
-
/**
|
|
210
|
-
* `replaceManyWithIds` on the libuv thread pool.
|
|
211
|
-
*
|
|
212
|
-
* The bulk path: a hydration page is hundreds of rows in one commit, and with
|
|
213
|
-
* fsync-per-commit durability that is long enough to stall the event loop.
|
|
214
|
-
*/
|
|
215
|
-
replaceManyWithIdsAsync(docs: Array<JsonValue>, origin: string): Promise<unknown>
|
|
216
|
-
/** `deleteManyWithIds` on the libuv thread pool. */
|
|
217
|
-
deleteManyWithIdsAsync(ids: Array<string>, origin: string): Promise<unknown>
|
|
218
161
|
/** Async variant of `updateOne`. */
|
|
219
162
|
updateOneAsync(filter: JsonValue, update: JsonValue): Promise<boolean>
|
|
220
163
|
/** Async variant of `updateMany`. */
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taladb/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "TalaDB Node.js native module — document queries and vector search via napi-rs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
+
"LICENSE-APACHE",
|
|
9
|
+
"LICENSE-MIT",
|
|
8
10
|
"index.js",
|
|
9
11
|
"index.d.ts",
|
|
10
12
|
"*.node"
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
"node": ">=18",
|
|
36
38
|
"bun": ">=1.0"
|
|
37
39
|
},
|
|
38
|
-
"license": "Apache-2.0",
|
|
40
|
+
"license": "MIT OR Apache-2.0",
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@napi-rs/cli": "^2.18.0",
|
|
41
43
|
"jest": "^29.0.0",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|