@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/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>): Promise<void>;
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
- * (v0 does not expose the optional scalar pre/post-filter; it runs with no
224
- * scalar gate.)
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,
@@ -257,7 +315,11 @@ export class Space {
257
315
  queryText(field: string, query: string, top_k: number): Promise<Array<any>>;
258
316
  /**
259
317
  * Top-K cosine vector search over an embedding `field`. `opts` may be a
260
- * number (topK) or `{ topK?, probeCount? }`. Returns `[{ anchor, score }]`
318
+ * number (topK) or `{ topK?, probeCount?, specId?, rerankPoolSize?, rerankMode? }`.
319
+ * The optional pool must be a positive integer at least topK; it changes
320
+ * neither probe coverage nor Schema exactness. rerankMode explicitly selects
321
+ * inherit (default), approximate or exact. Graphs reject explicit overrides.
322
+ * Returns `[{ anchor, score }]`
261
323
  * sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
262
324
  *
263
325
  * Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
@@ -274,6 +336,11 @@ export class Space {
274
336
  * authoritative shape and semantic metadata.
275
337
  */
276
338
  readArrayConstant(field: string): Promise<any>;
339
+ /**
340
+ * Point read; full-u64 BigInt anchors are supported. Returned components
341
+ * are owned typed arrays (one Item's bytes), never unaligned aliases.
342
+ */
343
+ readArrayItem(field: string, anchor: any): Promise<any>;
277
344
  /**
278
345
  * Read a scalar track as a `Map<anchorString, value>`. Single-anchor
279
346
  * entries resolve from the track index; multi-anchor entries fetch (and
@@ -353,6 +420,11 @@ export class Writer {
353
420
  private constructor();
354
421
  free(): void;
355
422
  [Symbol.dispose](): void;
423
+ /**
424
+ * Atomically hot-append a complete Sample batch. Embeddings retain v1;
425
+ * scalar/text values use v2. Identified embeddings require embeddingSpecs.
426
+ */
427
+ appendHot(samples: Array<any>, embedding_specs?: object | null): Promise<number>;
356
428
  /**
357
429
  * Append records and commit in one call.
358
430
  *
@@ -366,6 +438,11 @@ export class Writer {
366
438
  * lifetime is under the caller's control.
367
439
  */
368
440
  appendMany(samples: Array<any>): Promise<number>;
441
+ /**
442
+ * Append records with a field-to-`spec_id` map for identified embeddings.
443
+ * Values are full canonical base32 multihashes.
444
+ */
445
+ appendManyWithSpecs(samples: Array<any>, embedding_specs: object): Promise<number>;
369
446
  /**
370
447
  * Flush staged entries and publish a new manifest.
371
448
  *
@@ -375,10 +452,30 @@ export class Writer {
375
452
  * its records on top of the new head is correct.
376
453
  */
377
454
  commit(): Promise<string>;
455
+ /**
456
+ * Producer policy only: TTL is evaluated on append, not by a timer.
457
+ */
458
+ configureHotShard(flush_threshold: number, ttl_seconds: number): void;
459
+ /**
460
+ * Create a never-used key. Sample uses appendMany's tagged fields, no anchor.
461
+ */
462
+ createEntity(key: any, sample: object, embedding_specs?: object | null): Promise<object>;
463
+ /**
464
+ * Delete exactly a live revision, retaining its key and stable identity.
465
+ */
466
+ deleteEntity(key: any, expected: Uint8Array): Promise<object>;
378
467
  /**
379
468
  * Tombstone records by anchor. Returns the new manifest hash.
380
469
  */
381
470
  deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
471
+ /**
472
+ * Enable one exact typed entity namespace: string, bytes or int.
473
+ */
474
+ enableEntityKeys(key_kind: string): Promise<void>;
475
+ /**
476
+ * Explicitly fold every pending hot field into cold Tracks in one publish.
477
+ */
478
+ flushHot(): Promise<void>;
382
479
  /**
383
480
  * Ingest a pre-fragmented CMAF (fragmented-MP4) video into a Video field
384
481
  * as a `spec/0007` §5 media Track — the thing that makes a video Track
@@ -437,10 +534,27 @@ export class Writer {
437
534
  * until it calls it.
438
535
  */
439
536
  static open(uri: string, backend: any): Promise<Writer>;
537
+ /**
538
+ * Publish prequantized fixed-stride records. Coordinates is
539
+ * {origin:[x,y,z],step:[x,y,z],units:string}; depth is 0..16.
540
+ */
541
+ publishGeometryCells(field: string, anchor: any, coordinates: any, depth: any, records: Uint8Array): Promise<string>;
542
+ /**
543
+ * Each level is {errorGrid,vertices,triangles,bytes:Uint8Array}.
544
+ */
545
+ publishGeometryMesh(field: string, anchor: any, coordinates: any, levels: Array<any>): Promise<string>;
440
546
  /**
441
547
  * Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
442
548
  */
443
549
  snapshot(label: string): Promise<string>;
550
+ /**
551
+ * Replace only a live revision, atomically hiding its old physical row.
552
+ */
553
+ supersedeEntity(key: any, sample: object, expected: Uint8Array, embedding_specs?: object | null): Promise<object>;
554
+ /**
555
+ * Create with no expected token, or replace/restore exactly that revision.
556
+ */
557
+ upsertEntity(key: any, sample: object, expected?: Uint8Array | null, embedding_specs?: object | null): Promise<object>;
444
558
  /**
445
559
  * Current manifest hash, base32.
446
560
  */