@dreamlake/dreamdb 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/browser/dreamdb.d.ts +101 -3
- package/browser/dreamdb.js +1 -1
- package/browser/dreamdb_bg.js +337 -5
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +22 -0
- package/index.d.ts +121 -7
- package/node/dreamdb.cjs +360 -7
- package/node/dreamdb.d.cts +121 -7
- package/node/dreamdb_bg.wasm +0 -0
- package/node/dreamdb_bg.wasm.d.ts +27 -1
- package/node.mjs +5 -4
- package/package.json +1 -1
- package/web/dreamdb.d.ts +123 -3
- package/web/dreamdb.js +337 -5
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +22 -0
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @dreamlake/dreamdb
|
|
2
2
|
|
|
3
|
+
Package scope: npm 0.5.4 retains entity keys, progressive geometry and structured
|
|
4
|
+
arrays, and adds query-local rerank policy/pool options. Shared-core fixes include
|
|
5
|
+
reference-mode GC retention; Rust operator APIs are not automatically JS exports.
|
|
6
|
+
See the [release notes](https://github.com/dreamlake-ai/dreamdb-core/blob/main/docs/releases/python-0.0.12-npm-0.5.4.md),
|
|
7
|
+
[feature guide](https://dreamdb.dreamlake.ai/main-features) and
|
|
8
|
+
[SDK reference](https://dreamdb.dreamlake.ai/typescript-sdk-api).
|
|
9
|
+
|
|
3
10
|
The DreamDB SDK — read and write, in the browser and on the server, compiled to
|
|
4
11
|
WebAssembly from the same Rust core the CLI and Python SDK use.
|
|
5
12
|
|
package/browser/dreamdb.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
export class GeometryReader {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
/**
|
|
9
|
+
* Returns only the new suffix at this total logical byte budget.
|
|
10
|
+
*/
|
|
11
|
+
extendCellPrefix(key: any, budget: any): Promise<Uint8Array>;
|
|
12
|
+
/**
|
|
13
|
+
* Declaration plus cells/LODs; no payload transfer. u64 values are BigInt.
|
|
14
|
+
*/
|
|
15
|
+
metadata(): any;
|
|
16
|
+
readMeshLod(level: any): Promise<Uint8Array>;
|
|
17
|
+
selectCells(min: any, max: any): Array<any>;
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
/**
|
|
5
21
|
* A `fetch`-backed backend rooted at a base URL.
|
|
6
22
|
*/
|
|
@@ -37,6 +53,15 @@ export class Space {
|
|
|
37
53
|
private constructor();
|
|
38
54
|
free(): void;
|
|
39
55
|
[Symbol.dispose](): void;
|
|
56
|
+
/**
|
|
57
|
+
* Validate all referenced Items, including tombstoned payloads.
|
|
58
|
+
*/
|
|
59
|
+
auditArrayField(field: string): Promise<bigint>;
|
|
60
|
+
/**
|
|
61
|
+
* Validate all graph pages and, when declared, exact-source correspondence.
|
|
62
|
+
* The returned count is exactly representable (GraphIndex node_count is u32).
|
|
63
|
+
*/
|
|
64
|
+
auditGraphIndex(field: string): Promise<number>;
|
|
40
65
|
/**
|
|
41
66
|
* The Space's human-readable description, or `undefined` when none is set.
|
|
42
67
|
*
|
|
@@ -71,11 +96,21 @@ export class Space {
|
|
|
71
96
|
* no-backend path).
|
|
72
97
|
*/
|
|
73
98
|
static fromUri(uri: string, backend: any): Promise<Space>;
|
|
99
|
+
/**
|
|
100
|
+
* Read at this pinned Manifest. Returns null for never-created keys;
|
|
101
|
+
* deleted keys retain metadata with sample=null. Integer keys and anchors
|
|
102
|
+
* are BigInt; sample values use the Writer's tagged field shapes.
|
|
103
|
+
*/
|
|
104
|
+
getEntity(key: any): Promise<any>;
|
|
74
105
|
/**
|
|
75
106
|
* Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
|
|
76
107
|
* `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
|
|
77
108
|
*/
|
|
78
109
|
history(max_depth?: number | null): Promise<Array<any>>;
|
|
110
|
+
/**
|
|
111
|
+
* Open one pinned geometry Item. Missing/deleted anchors return undefined.
|
|
112
|
+
*/
|
|
113
|
+
openGeometryItem(field: string, anchor: any): Promise<GeometryReader | undefined>;
|
|
79
114
|
/**
|
|
80
115
|
* Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
|
|
81
116
|
* sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
|
|
@@ -98,10 +133,17 @@ export class Space {
|
|
|
98
133
|
* ```
|
|
99
134
|
*
|
|
100
135
|
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
|
|
101
|
-
*
|
|
102
|
-
* scalar
|
|
136
|
+
* Optional `scalarField` / `scalarOp` / `scalarValue` properties select
|
|
137
|
+
* the same scalar pre/post-filter planner used by the native API.
|
|
103
138
|
*/
|
|
104
139
|
queryHybrid(vector: Float32Array, opts: any): Promise<Array<any>>;
|
|
140
|
+
/**
|
|
141
|
+
* Hybrid query with an observable `{hits, trace}` result. `opts` accepts
|
|
142
|
+
* `maxLatencyMs`, `costModel`, and the optional scalar triple
|
|
143
|
+
* `scalarField`/`scalarOp`/`scalarValue` in addition to `queryHybrid`'s
|
|
144
|
+
* existing properties.
|
|
145
|
+
*/
|
|
146
|
+
queryHybridPlanned(vector: Float32Array, opts: any): Promise<any>;
|
|
105
147
|
/**
|
|
106
148
|
* Scalar-index lookup: every anchor whose `field` satisfies `op value`
|
|
107
149
|
* (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
|
|
@@ -135,7 +177,11 @@ export class Space {
|
|
|
135
177
|
queryText(field: string, query: string, top_k: number): Promise<Array<any>>;
|
|
136
178
|
/**
|
|
137
179
|
* Top-K cosine vector search over an embedding `field`. `opts` may be a
|
|
138
|
-
* number (topK) or `{ topK?, probeCount
|
|
180
|
+
* number (topK) or `{ topK?, probeCount?, specId?, rerankPoolSize?, rerankMode? }`.
|
|
181
|
+
* The optional pool must be a positive integer at least topK; it changes
|
|
182
|
+
* neither probe coverage nor Schema exactness. rerankMode explicitly selects
|
|
183
|
+
* inherit (default), approximate or exact. Graphs reject explicit overrides.
|
|
184
|
+
* Returns `[{ anchor, score }]`
|
|
139
185
|
* sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
|
|
140
186
|
*
|
|
141
187
|
* Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
|
|
@@ -152,6 +198,11 @@ export class Space {
|
|
|
152
198
|
* authoritative shape and semantic metadata.
|
|
153
199
|
*/
|
|
154
200
|
readArrayConstant(field: string): Promise<any>;
|
|
201
|
+
/**
|
|
202
|
+
* Point read; full-u64 BigInt anchors are supported. Returned components
|
|
203
|
+
* are owned typed arrays (one Item's bytes), never unaligned aliases.
|
|
204
|
+
*/
|
|
205
|
+
readArrayItem(field: string, anchor: any): Promise<any>;
|
|
155
206
|
/**
|
|
156
207
|
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
157
208
|
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
@@ -231,6 +282,11 @@ export class Writer {
|
|
|
231
282
|
private constructor();
|
|
232
283
|
free(): void;
|
|
233
284
|
[Symbol.dispose](): void;
|
|
285
|
+
/**
|
|
286
|
+
* Atomically hot-append a complete Sample batch. Embeddings retain v1;
|
|
287
|
+
* scalar/text values use v2. Identified embeddings require embeddingSpecs.
|
|
288
|
+
*/
|
|
289
|
+
appendHot(samples: Array<any>, embedding_specs?: object | null): Promise<number>;
|
|
234
290
|
/**
|
|
235
291
|
* Append records and commit in one call.
|
|
236
292
|
*
|
|
@@ -244,6 +300,11 @@ export class Writer {
|
|
|
244
300
|
* lifetime is under the caller's control.
|
|
245
301
|
*/
|
|
246
302
|
appendMany(samples: Array<any>): Promise<number>;
|
|
303
|
+
/**
|
|
304
|
+
* Append records with a field-to-`spec_id` map for identified embeddings.
|
|
305
|
+
* Values are full canonical base32 multihashes.
|
|
306
|
+
*/
|
|
307
|
+
appendManyWithSpecs(samples: Array<any>, embedding_specs: object): Promise<number>;
|
|
247
308
|
/**
|
|
248
309
|
* Flush staged entries and publish a new manifest.
|
|
249
310
|
*
|
|
@@ -253,10 +314,30 @@ export class Writer {
|
|
|
253
314
|
* its records on top of the new head is correct.
|
|
254
315
|
*/
|
|
255
316
|
commit(): Promise<string>;
|
|
317
|
+
/**
|
|
318
|
+
* Producer policy only: TTL is evaluated on append, not by a timer.
|
|
319
|
+
*/
|
|
320
|
+
configureHotShard(flush_threshold: number, ttl_seconds: number): void;
|
|
321
|
+
/**
|
|
322
|
+
* Create a never-used key. Sample uses appendMany's tagged fields, no anchor.
|
|
323
|
+
*/
|
|
324
|
+
createEntity(key: any, sample: object, embedding_specs?: object | null): Promise<object>;
|
|
325
|
+
/**
|
|
326
|
+
* Delete exactly a live revision, retaining its key and stable identity.
|
|
327
|
+
*/
|
|
328
|
+
deleteEntity(key: any, expected: Uint8Array): Promise<object>;
|
|
256
329
|
/**
|
|
257
330
|
* Tombstone records by anchor. Returns the new manifest hash.
|
|
258
331
|
*/
|
|
259
332
|
deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
|
|
333
|
+
/**
|
|
334
|
+
* Enable one exact typed entity namespace: string, bytes or int.
|
|
335
|
+
*/
|
|
336
|
+
enableEntityKeys(key_kind: string): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* Explicitly fold every pending hot field into cold Tracks in one publish.
|
|
339
|
+
*/
|
|
340
|
+
flushHot(): Promise<void>;
|
|
260
341
|
/**
|
|
261
342
|
* Open a ref for writing.
|
|
262
343
|
*
|
|
@@ -271,10 +352,27 @@ export class Writer {
|
|
|
271
352
|
* until it calls it.
|
|
272
353
|
*/
|
|
273
354
|
static open(uri: string, backend: any): Promise<Writer>;
|
|
355
|
+
/**
|
|
356
|
+
* Publish prequantized fixed-stride records. Coordinates is
|
|
357
|
+
* {origin:[x,y,z],step:[x,y,z],units:string}; depth is 0..16.
|
|
358
|
+
*/
|
|
359
|
+
publishGeometryCells(field: string, anchor: any, coordinates: any, depth: any, records: Uint8Array): Promise<string>;
|
|
360
|
+
/**
|
|
361
|
+
* Each level is {errorGrid,vertices,triangles,bytes:Uint8Array}.
|
|
362
|
+
*/
|
|
363
|
+
publishGeometryMesh(field: string, anchor: any, coordinates: any, levels: Array<any>): Promise<string>;
|
|
274
364
|
/**
|
|
275
365
|
* Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
|
|
276
366
|
*/
|
|
277
367
|
snapshot(label: string): Promise<string>;
|
|
368
|
+
/**
|
|
369
|
+
* Replace only a live revision, atomically hiding its old physical row.
|
|
370
|
+
*/
|
|
371
|
+
supersedeEntity(key: any, sample: object, expected: Uint8Array, embedding_specs?: object | null): Promise<object>;
|
|
372
|
+
/**
|
|
373
|
+
* Create with no expected token, or replace/restore exactly that revision.
|
|
374
|
+
*/
|
|
375
|
+
upsertEntity(key: any, sample: object, expected?: Uint8Array | null, embedding_specs?: object | null): Promise<object>;
|
|
278
376
|
/**
|
|
279
377
|
* Current manifest hash, base32.
|
|
280
378
|
*/
|
package/browser/dreamdb.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./dreamdb_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
S3Backend, Space, Writer, __wasm_init, addressRoundTrip, addressVariant, bytesToBase32, decodeCbor, encodeCbor, modalityParse, multihashBase32, multihashHex, rangeHeader, spatialKeyRoundTrip, timeAnchorFromHex, timeAnchorHex, timeBucket, typedArrayDecode, version, zeroSpatialKey
|
|
8
|
+
GeometryReader, S3Backend, Space, Writer, __wasm_init, addressRoundTrip, addressVariant, bytesToBase32, decodeCbor, encodeCbor, modalityParse, multihashBase32, multihashHex, rangeHeader, spatialKeyRoundTrip, timeAnchorFromHex, timeAnchorHex, timeBucket, typedArrayDecode, version, zeroSpatialKey
|
|
9
9
|
} from "./dreamdb_bg.js";
|