@dreamlake/dreamdb 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/browser/dreamdb.d.ts +96 -2
- package/browser/dreamdb.js +1 -1
- package/browser/dreamdb_bg.js +332 -4
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +22 -0
- package/index.d.ts +116 -6
- package/node/dreamdb.cjs +355 -6
- package/node/dreamdb.d.cts +116 -6
- 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 +118 -2
- package/web/dreamdb.js +332 -4
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +22 -0
package/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export class Authoring {
|
|
|
46
46
|
* off, reads decode 1-bit reconstructions and relevance degrades in a way
|
|
47
47
|
* no API-level check can see.
|
|
48
48
|
*/
|
|
49
|
-
addEmbeddingLayer(name: string, parent_field: string, dim: number, algorithm: string, spatial_index: string, compressor: string, rerank: boolean, version: number | null | undefined, samples: Array<any
|
|
49
|
+
addEmbeddingLayer(name: string, parent_field: string, dim: number, algorithm: string, spatial_index: string, compressor: string, rerank: boolean, version: number | null | undefined, samples: Array<any>, bucket_max_bytes?: number | null, embed_spec?: Uint8Array | null): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Add a field to the schema of an existing dataset.
|
|
52
52
|
*/
|
|
@@ -64,10 +64,20 @@ export class Authoring {
|
|
|
64
64
|
* `int|float|bool|string|categorical|timestamp`.
|
|
65
65
|
*/
|
|
66
66
|
addScalarLayer(name: string, parent_field: string, value_type: string, samples: Array<any>): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Append `[anchor, vector]` pairs, adopting a raw graph as Fresh Vamana.
|
|
69
|
+
*/
|
|
70
|
+
appendGraphNodes(field: string, samples: Array<any>): Promise<any>;
|
|
67
71
|
/**
|
|
68
72
|
* Fork the current manifest to a new ref name.
|
|
69
73
|
*/
|
|
70
74
|
branch(new_name: string): Promise<Authoring>;
|
|
75
|
+
/**
|
|
76
|
+
* Merge one or more branches into this ref. Returns the new manifest hash.
|
|
77
|
+
* Build a raw Vamana field. Samples are `[anchor, vector]` pairs; anchors
|
|
78
|
+
* use the same lossless representation as addEmbeddingLayer.
|
|
79
|
+
*/
|
|
80
|
+
buildGraphIndex(name: string, parent_field: string, dim: number, samples: Array<any>, r: number, seed: Uint8Array, embed_spec?: Uint8Array | null): Promise<void>;
|
|
71
81
|
/**
|
|
72
82
|
* Collapse per-cell fragments. Returns
|
|
73
83
|
* `{cellsExamined, cellsCompacted, fragmentsCollapsed, manifest?}`.
|
|
@@ -78,6 +88,15 @@ export class Authoring {
|
|
|
78
88
|
* nothing needed compacting — a no-op, not a failure.
|
|
79
89
|
*/
|
|
80
90
|
compact(modality: string | null | undefined, threshold: number, max_cells: number): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* Compress a raw graph with canonical VectorCompressor CBOR. The raw
|
|
93
|
+
* lineage is retained; rerank selects exact scoring of the candidate pool.
|
|
94
|
+
*/
|
|
95
|
+
compressGraphIndex(field: string, compressor: Uint8Array, rerank: boolean): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Caller-driven region consolidation; does not erase tombstones or ids.
|
|
98
|
+
*/
|
|
99
|
+
consolidateGraph(field: string): Promise<any>;
|
|
81
100
|
/**
|
|
82
101
|
* Create a new dataset and publish `refs/<name>`.
|
|
83
102
|
*
|
|
@@ -101,9 +120,6 @@ export class Authoring {
|
|
|
101
120
|
* Ref names under `refs/`. Requires a backend implementing `list`.
|
|
102
121
|
*/
|
|
103
122
|
listRefs(): Promise<string[]>;
|
|
104
|
-
/**
|
|
105
|
-
* Merge one or more branches into this ref. Returns the new manifest hash.
|
|
106
|
-
*/
|
|
107
123
|
mergeMany(branches: string[]): Promise<string>;
|
|
108
124
|
/**
|
|
109
125
|
* Open an existing ref for authoring.
|
|
@@ -123,6 +139,22 @@ export class Authoring {
|
|
|
123
139
|
readonly refName: string;
|
|
124
140
|
}
|
|
125
141
|
|
|
142
|
+
export class GeometryReader {
|
|
143
|
+
private constructor();
|
|
144
|
+
free(): void;
|
|
145
|
+
[Symbol.dispose](): void;
|
|
146
|
+
/**
|
|
147
|
+
* Returns only the new suffix at this total logical byte budget.
|
|
148
|
+
*/
|
|
149
|
+
extendCellPrefix(key: any, budget: any): Promise<Uint8Array>;
|
|
150
|
+
/**
|
|
151
|
+
* Declaration plus cells/LODs; no payload transfer. u64 values are BigInt.
|
|
152
|
+
*/
|
|
153
|
+
metadata(): any;
|
|
154
|
+
readMeshLod(level: any): Promise<Uint8Array>;
|
|
155
|
+
selectCells(min: any, max: any): Array<any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
126
158
|
/**
|
|
127
159
|
* A `fetch`-backed backend rooted at a base URL.
|
|
128
160
|
*/
|
|
@@ -159,6 +191,15 @@ export class Space {
|
|
|
159
191
|
private constructor();
|
|
160
192
|
free(): void;
|
|
161
193
|
[Symbol.dispose](): void;
|
|
194
|
+
/**
|
|
195
|
+
* Validate all referenced Items, including tombstoned payloads.
|
|
196
|
+
*/
|
|
197
|
+
auditArrayField(field: string): Promise<bigint>;
|
|
198
|
+
/**
|
|
199
|
+
* Validate all graph pages and, when declared, exact-source correspondence.
|
|
200
|
+
* The returned count is exactly representable (GraphIndex node_count is u32).
|
|
201
|
+
*/
|
|
202
|
+
auditGraphIndex(field: string): Promise<number>;
|
|
162
203
|
/**
|
|
163
204
|
* The Space's human-readable description, or `undefined` when none is set.
|
|
164
205
|
*
|
|
@@ -193,11 +234,21 @@ export class Space {
|
|
|
193
234
|
* no-backend path).
|
|
194
235
|
*/
|
|
195
236
|
static fromUri(uri: string, backend: any): Promise<Space>;
|
|
237
|
+
/**
|
|
238
|
+
* Read at this pinned Manifest. Returns null for never-created keys;
|
|
239
|
+
* deleted keys retain metadata with sample=null. Integer keys and anchors
|
|
240
|
+
* are BigInt; sample values use the Writer's tagged field shapes.
|
|
241
|
+
*/
|
|
242
|
+
getEntity(key: any): Promise<any>;
|
|
196
243
|
/**
|
|
197
244
|
* Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
|
|
198
245
|
* `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
|
|
199
246
|
*/
|
|
200
247
|
history(max_depth?: number | null): Promise<Array<any>>;
|
|
248
|
+
/**
|
|
249
|
+
* Open one pinned geometry Item. Missing/deleted anchors return undefined.
|
|
250
|
+
*/
|
|
251
|
+
openGeometryItem(field: string, anchor: any): Promise<GeometryReader | undefined>;
|
|
201
252
|
/**
|
|
202
253
|
* Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
|
|
203
254
|
* sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
|
|
@@ -220,10 +271,17 @@ export class Space {
|
|
|
220
271
|
* ```
|
|
221
272
|
*
|
|
222
273
|
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
|
|
223
|
-
*
|
|
224
|
-
* scalar
|
|
274
|
+
* Optional `scalarField` / `scalarOp` / `scalarValue` properties select
|
|
275
|
+
* the same scalar pre/post-filter planner used by the native API.
|
|
225
276
|
*/
|
|
226
277
|
queryHybrid(vector: Float32Array, opts: any): Promise<Array<any>>;
|
|
278
|
+
/**
|
|
279
|
+
* Hybrid query with an observable `{hits, trace}` result. `opts` accepts
|
|
280
|
+
* `maxLatencyMs`, `costModel`, and the optional scalar triple
|
|
281
|
+
* `scalarField`/`scalarOp`/`scalarValue` in addition to `queryHybrid`'s
|
|
282
|
+
* existing properties.
|
|
283
|
+
*/
|
|
284
|
+
queryHybridPlanned(vector: Float32Array, opts: any): Promise<any>;
|
|
227
285
|
/**
|
|
228
286
|
* Scalar-index lookup: every anchor whose `field` satisfies `op value`
|
|
229
287
|
* (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
|
|
@@ -274,6 +332,11 @@ export class Space {
|
|
|
274
332
|
* authoritative shape and semantic metadata.
|
|
275
333
|
*/
|
|
276
334
|
readArrayConstant(field: string): Promise<any>;
|
|
335
|
+
/**
|
|
336
|
+
* Point read; full-u64 BigInt anchors are supported. Returned components
|
|
337
|
+
* are owned typed arrays (one Item's bytes), never unaligned aliases.
|
|
338
|
+
*/
|
|
339
|
+
readArrayItem(field: string, anchor: any): Promise<any>;
|
|
277
340
|
/**
|
|
278
341
|
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
279
342
|
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
@@ -353,6 +416,11 @@ export class Writer {
|
|
|
353
416
|
private constructor();
|
|
354
417
|
free(): void;
|
|
355
418
|
[Symbol.dispose](): void;
|
|
419
|
+
/**
|
|
420
|
+
* Atomically hot-append a complete Sample batch. Embeddings retain v1;
|
|
421
|
+
* scalar/text values use v2. Identified embeddings require embeddingSpecs.
|
|
422
|
+
*/
|
|
423
|
+
appendHot(samples: Array<any>, embedding_specs?: object | null): Promise<number>;
|
|
356
424
|
/**
|
|
357
425
|
* Append records and commit in one call.
|
|
358
426
|
*
|
|
@@ -366,6 +434,11 @@ export class Writer {
|
|
|
366
434
|
* lifetime is under the caller's control.
|
|
367
435
|
*/
|
|
368
436
|
appendMany(samples: Array<any>): Promise<number>;
|
|
437
|
+
/**
|
|
438
|
+
* Append records with a field-to-`spec_id` map for identified embeddings.
|
|
439
|
+
* Values are full canonical base32 multihashes.
|
|
440
|
+
*/
|
|
441
|
+
appendManyWithSpecs(samples: Array<any>, embedding_specs: object): Promise<number>;
|
|
369
442
|
/**
|
|
370
443
|
* Flush staged entries and publish a new manifest.
|
|
371
444
|
*
|
|
@@ -375,10 +448,30 @@ export class Writer {
|
|
|
375
448
|
* its records on top of the new head is correct.
|
|
376
449
|
*/
|
|
377
450
|
commit(): Promise<string>;
|
|
451
|
+
/**
|
|
452
|
+
* Producer policy only: TTL is evaluated on append, not by a timer.
|
|
453
|
+
*/
|
|
454
|
+
configureHotShard(flush_threshold: number, ttl_seconds: number): void;
|
|
455
|
+
/**
|
|
456
|
+
* Create a never-used key. Sample uses appendMany's tagged fields, no anchor.
|
|
457
|
+
*/
|
|
458
|
+
createEntity(key: any, sample: object, embedding_specs?: object | null): Promise<object>;
|
|
459
|
+
/**
|
|
460
|
+
* Delete exactly a live revision, retaining its key and stable identity.
|
|
461
|
+
*/
|
|
462
|
+
deleteEntity(key: any, expected: Uint8Array): Promise<object>;
|
|
378
463
|
/**
|
|
379
464
|
* Tombstone records by anchor. Returns the new manifest hash.
|
|
380
465
|
*/
|
|
381
466
|
deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
|
|
467
|
+
/**
|
|
468
|
+
* Enable one exact typed entity namespace: string, bytes or int.
|
|
469
|
+
*/
|
|
470
|
+
enableEntityKeys(key_kind: string): Promise<void>;
|
|
471
|
+
/**
|
|
472
|
+
* Explicitly fold every pending hot field into cold Tracks in one publish.
|
|
473
|
+
*/
|
|
474
|
+
flushHot(): Promise<void>;
|
|
382
475
|
/**
|
|
383
476
|
* Ingest a pre-fragmented CMAF (fragmented-MP4) video into a Video field
|
|
384
477
|
* as a `spec/0007` §5 media Track — the thing that makes a video Track
|
|
@@ -437,10 +530,27 @@ export class Writer {
|
|
|
437
530
|
* until it calls it.
|
|
438
531
|
*/
|
|
439
532
|
static open(uri: string, backend: any): Promise<Writer>;
|
|
533
|
+
/**
|
|
534
|
+
* Publish prequantized fixed-stride records. Coordinates is
|
|
535
|
+
* {origin:[x,y,z],step:[x,y,z],units:string}; depth is 0..16.
|
|
536
|
+
*/
|
|
537
|
+
publishGeometryCells(field: string, anchor: any, coordinates: any, depth: any, records: Uint8Array): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Each level is {errorGrid,vertices,triangles,bytes:Uint8Array}.
|
|
540
|
+
*/
|
|
541
|
+
publishGeometryMesh(field: string, anchor: any, coordinates: any, levels: Array<any>): Promise<string>;
|
|
440
542
|
/**
|
|
441
543
|
* Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
|
|
442
544
|
*/
|
|
443
545
|
snapshot(label: string): Promise<string>;
|
|
546
|
+
/**
|
|
547
|
+
* Replace only a live revision, atomically hiding its old physical row.
|
|
548
|
+
*/
|
|
549
|
+
supersedeEntity(key: any, sample: object, expected: Uint8Array, embedding_specs?: object | null): Promise<object>;
|
|
550
|
+
/**
|
|
551
|
+
* Create with no expected token, or replace/restore exactly that revision.
|
|
552
|
+
*/
|
|
553
|
+
upsertEntity(key: any, sample: object, expected?: Uint8Array | null, embedding_specs?: object | null): Promise<object>;
|
|
444
554
|
/**
|
|
445
555
|
* Current manifest hash, base32.
|
|
446
556
|
*/
|