@dreamlake/dreamdb 0.5.1 → 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/web/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
  */
@@ -13,6 +29,15 @@ export class S3Backend {
13
29
  * content is hash-addressed; refs are read fresh each page load anyway).
14
30
  */
15
31
  get(path: string, _opts: any): Promise<Uint8Array>;
32
+ /**
33
+ * Stream `path` without first aggregating the response in wasm memory.
34
+ *
35
+ * Returning the length beside the browser stream satisfies the optional
36
+ * `Backend.getStream` contract. Older injected backends that implement
37
+ * only [`Self::get`] remain compatible, but cannot claim bounded memory
38
+ * for historical oversized inline Track reads.
39
+ */
40
+ getStream(path: string): Promise<any>;
16
41
  /**
17
42
  * List object paths under `prefix`. Stub (returns empty); the current
18
43
  * consumer read paths don't require listing.
@@ -28,6 +53,41 @@ export class Space {
28
53
  private constructor();
29
54
  free(): void;
30
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>;
65
+ /**
66
+ * The Space's human-readable description, or `undefined` when none is set.
67
+ *
68
+ * The read half of `Authoring.setDescription` (#129). It lives here rather
69
+ * than on `Authoring` because that type is `write-full` and so exists only
70
+ * in the Node build — a description is metadata a READER wants, and
71
+ * `Space` is the surface all three build targets share.
72
+ *
73
+ * `async` although `Dataset::description` is not: the value comes from the
74
+ * Dataset this Space opens lazily at the Manifest hash already pinned by
75
+ * this Space, so the first call may perform that open without re-resolving
76
+ * a source Ref.
77
+ *
78
+ * Deliberately routed through `Dataset::description` rather than read out
79
+ * of `self.manifest`'s registry, which would be shorter and would also
80
+ * serve the cached decoded Manifest. `Dataset::recover_meta` is not a prefix
81
+ * filter: it accepts the legacy `vortex.*` namespace as well as
82
+ * `dreamdb.*`, canonicalises, and drops structural keys. Matching
83
+ * `dreamdb.description` here would silently return nothing for a legacy
84
+ * Space whose description is on disk and readable from Rust — the exact
85
+ * defect `recover_meta`'s own comment records.
86
+ *
87
+ * `Option<String>` marshals to `string | undefined`, NOT to `""`. An unset
88
+ * description and an empty one stay distinguishable across the boundary.
89
+ */
90
+ description(): Promise<string | undefined>;
31
91
  /**
32
92
  * Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
33
93
  * resolving the ref (if any) and loading the manifest. If `backend` is
@@ -36,11 +96,21 @@ export class Space {
36
96
  * no-backend path).
37
97
  */
38
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>;
39
105
  /**
40
106
  * Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
41
107
  * `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
42
108
  */
43
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>;
44
114
  /**
45
115
  * Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
46
116
  * sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
@@ -63,10 +133,17 @@ export class Space {
63
133
  * ```
64
134
  *
65
135
  * Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
66
- * (v0 does not expose the optional scalar pre/post-filter; it runs with no
67
- * scalar gate.)
136
+ * Optional `scalarField` / `scalarOp` / `scalarValue` properties select
137
+ * the same scalar pre/post-filter planner used by the native API.
68
138
  */
69
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>;
70
147
  /**
71
148
  * Scalar-index lookup: every anchor whose `field` satisfies `op value`
72
149
  * (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
@@ -107,18 +184,60 @@ export class Space {
107
184
  * two-pass rerank + HotShard merge + tombstone suppression.
108
185
  */
109
186
  queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
187
+ /**
188
+ * Read an Event/Unbucketed or Continuous/TimeBatch typed-array field as
189
+ * `Map<anchorString, {values, shape, ...}>`.
190
+ */
191
+ readArrayColumn(field: string): Promise<Map<any, any>>;
192
+ /**
193
+ * Read a typed-array Constant and decode it to a JS TypedArray plus its
194
+ * authoritative shape and semantic metadata.
195
+ */
196
+ readArrayConstant(field: string): Promise<any>;
197
+ /**
198
+ * Point read; full-u64 BigInt anchors are supported. Returned components
199
+ * are owned typed arrays (one Item's bytes), never unaligned aliases.
200
+ */
201
+ readArrayItem(field: string, anchor: any): Promise<any>;
110
202
  /**
111
203
  * Read a scalar track as a `Map<anchorString, value>`. Single-anchor
112
204
  * entries resolve from the track index; multi-anchor entries fetch (and
113
205
  * de-dupe) their bucket and roaring-decode the anchor set.
114
206
  */
115
207
  readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
208
+ /**
209
+ * Fetch verified initialization and complete Fragments overlapping one
210
+ * item-relative half-open range. This materializes the selected bytes; it
211
+ * is not a streaming API.
212
+ */
213
+ readVideoItemRange(field: string, item_key: Uint8Array, relative_start_ns: any, relative_end_ns: any): Promise<any>;
116
214
  /**
117
215
  * Fetch a track object and return its `object_index` (array of CBOR
118
216
  * entries). Inline indexes only — paged indexes are not resolved (matching
119
217
  * dreamdb-ts, which also doesn't support them on this path).
120
218
  */
121
219
  resolveObjectIndex(track: any): Promise<Array<any>>;
220
+ /**
221
+ * Semantic-cache capacity in bytes (spec/0006 §3.6). Default 1 GiB.
222
+ */
223
+ semanticCacheCapacity(): Promise<number>;
224
+ /**
225
+ * Semantic-cache occupancy as `{ entries, bytesUsed, maxBytes }`.
226
+ */
227
+ semanticCacheStats(): Promise<object>;
228
+ /**
229
+ * Set the semantic-cache capacity in bytes, evicting down to it before
230
+ * returning. Returns the bytes evicted. `0` disables the cache.
231
+ *
232
+ * An index whose accounted size exceeds the cap is not cached and is
233
+ * re-fetched on every query, reported honestly as a miss. The default is
234
+ * not raised globally to suit one corpus.
235
+ *
236
+ * Sizing is workload- and architecture-dependent, and figures measured on
237
+ * a 64-bit host do NOT carry over here: `usize` is 32 bits on `wasm32`, so
238
+ * every offset and length inside a decoded index accounts differently.
239
+ */
240
+ setSemanticCacheCapacity(n_bytes: number): Promise<number>;
122
241
  /**
123
242
  * Base32 hash of the manifest's first timeline.
124
243
  */
@@ -131,6 +250,16 @@ export class Space {
131
250
  * List resolved tracks from this manifest.
132
251
  */
133
252
  tracks(): Array<any>;
253
+ /**
254
+ * Look up the logical VideoItem containing one absolute Timeline anchor
255
+ * without fetching media. Exact nanosecond values are returned as bigint.
256
+ */
257
+ videoItemAt(field: string, anchor_ns: any): Promise<any>;
258
+ /**
259
+ * Look up one logical VideoItem by its stable opaque key without fetching
260
+ * initialization or Fragment bytes.
261
+ */
262
+ videoItemByKey(field: string, item_key: Uint8Array): Promise<any>;
134
263
  /**
135
264
  * The base URL objects are fetched relative to (consumers build their own
136
265
  * object URLs from this — e.g. `dreamdb-demo`'s track readers).
@@ -149,6 +278,11 @@ export class Writer {
149
278
  private constructor();
150
279
  free(): void;
151
280
  [Symbol.dispose](): void;
281
+ /**
282
+ * Atomically hot-append a complete Sample batch. Embeddings retain v1;
283
+ * scalar/text values use v2. Identified embeddings require embeddingSpecs.
284
+ */
285
+ appendHot(samples: Array<any>, embedding_specs?: object | null): Promise<number>;
152
286
  /**
153
287
  * Append records and commit in one call.
154
288
  *
@@ -162,6 +296,11 @@ export class Writer {
162
296
  * lifetime is under the caller's control.
163
297
  */
164
298
  appendMany(samples: Array<any>): Promise<number>;
299
+ /**
300
+ * Append records with a field-to-`spec_id` map for identified embeddings.
301
+ * Values are full canonical base32 multihashes.
302
+ */
303
+ appendManyWithSpecs(samples: Array<any>, embedding_specs: object): Promise<number>;
165
304
  /**
166
305
  * Flush staged entries and publish a new manifest.
167
306
  *
@@ -171,10 +310,30 @@ export class Writer {
171
310
  * its records on top of the new head is correct.
172
311
  */
173
312
  commit(): Promise<string>;
313
+ /**
314
+ * Producer policy only: TTL is evaluated on append, not by a timer.
315
+ */
316
+ configureHotShard(flush_threshold: number, ttl_seconds: number): void;
317
+ /**
318
+ * Create a never-used key. Sample uses appendMany's tagged fields, no anchor.
319
+ */
320
+ createEntity(key: any, sample: object, embedding_specs?: object | null): Promise<object>;
321
+ /**
322
+ * Delete exactly a live revision, retaining its key and stable identity.
323
+ */
324
+ deleteEntity(key: any, expected: Uint8Array): Promise<object>;
174
325
  /**
175
326
  * Tombstone records by anchor. Returns the new manifest hash.
176
327
  */
177
328
  deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
329
+ /**
330
+ * Enable one exact typed entity namespace: string, bytes or int.
331
+ */
332
+ enableEntityKeys(key_kind: string): Promise<void>;
333
+ /**
334
+ * Explicitly fold every pending hot field into cold Tracks in one publish.
335
+ */
336
+ flushHot(): Promise<void>;
178
337
  /**
179
338
  * Open a ref for writing.
180
339
  *
@@ -189,10 +348,27 @@ export class Writer {
189
348
  * until it calls it.
190
349
  */
191
350
  static open(uri: string, backend: any): Promise<Writer>;
351
+ /**
352
+ * Publish prequantized fixed-stride records. Coordinates is
353
+ * {origin:[x,y,z],step:[x,y,z],units:string}; depth is 0..16.
354
+ */
355
+ publishGeometryCells(field: string, anchor: any, coordinates: any, depth: any, records: Uint8Array): Promise<string>;
356
+ /**
357
+ * Each level is {errorGrid,vertices,triangles,bytes:Uint8Array}.
358
+ */
359
+ publishGeometryMesh(field: string, anchor: any, coordinates: any, levels: Array<any>): Promise<string>;
192
360
  /**
193
361
  * Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
194
362
  */
195
363
  snapshot(label: string): Promise<string>;
364
+ /**
365
+ * Replace only a live revision, atomically hiding its old physical row.
366
+ */
367
+ supersedeEntity(key: any, sample: object, expected: Uint8Array, embedding_specs?: object | null): Promise<object>;
368
+ /**
369
+ * Create with no expected token, or replace/restore exactly that revision.
370
+ */
371
+ upsertEntity(key: any, sample: object, expected?: Uint8Array | null, embedding_specs?: object | null): Promise<object>;
196
372
  /**
197
373
  * Current manifest hash, base32.
198
374
  */
@@ -314,6 +490,13 @@ export function timeAnchorHex(value: bigint): string;
314
490
  */
315
491
  export function timeBucket(t_start: bigint, duration: string): bigint;
316
492
 
493
+ /**
494
+ * Decode one spec/0025 item using the same declaration and payload path as
495
+ * `Space.readArrayColumn`, without requiring storage IO. This is the SDK's
496
+ * pure conformance entry point for language-neutral vectors.
497
+ */
498
+ export function typedArrayDecode(item_type: any, payload: Uint8Array): any;
499
+
317
500
  /**
318
501
  * Package version — useful for consumers to confirm which build is loaded.
319
502
  */
@@ -329,6 +512,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
329
512
 
330
513
  export interface InitOutput {
331
514
  readonly memory: WebAssembly.Memory;
515
+ readonly __wbg_geometryreader_free: (a: number, b: number) => void;
332
516
  readonly __wbg_s3backend_free: (a: number, b: number) => void;
333
517
  readonly __wbg_space_free: (a: number, b: number) => void;
334
518
  readonly __wbg_writer_free: (a: number, b: number) => void;
@@ -337,38 +521,70 @@ export interface InitOutput {
337
521
  readonly bytesToBase32: (a: number, b: number) => [number, number];
338
522
  readonly decodeCbor: (a: number, b: number) => [number, number, number];
339
523
  readonly encodeCbor: (a: any) => [number, number, number, number];
524
+ readonly geometryreader_extendCellPrefix: (a: number, b: any, c: any) => any;
525
+ readonly geometryreader_metadata: (a: number) => [number, number, number];
526
+ readonly geometryreader_readMeshLod: (a: number, b: any) => any;
527
+ readonly geometryreader_selectCells: (a: number, b: any, c: any) => [number, number, number];
340
528
  readonly modalityParse: (a: number, b: number) => [number, number, number];
341
529
  readonly multihashBase32: (a: number, b: number) => [number, number];
342
530
  readonly multihashHex: (a: number, b: number) => [number, number];
343
531
  readonly rangeHeader: (a: bigint, b: bigint) => [number, number, number, number];
344
532
  readonly s3backend_get: (a: number, b: number, c: number, d: any) => any;
533
+ readonly s3backend_getStream: (a: number, b: number, c: number) => any;
345
534
  readonly s3backend_list: (a: number, b: number, c: number) => any;
346
535
  readonly s3backend_new: (a: number, b: number) => number;
536
+ readonly space_auditArrayField: (a: number, b: number, c: number) => any;
537
+ readonly space_auditGraphIndex: (a: number, b: number, c: number) => any;
347
538
  readonly space_connectorBase: (a: number) => [number, number];
539
+ readonly space_description: (a: number) => any;
348
540
  readonly space_fromUri: (a: number, b: number, c: any) => any;
541
+ readonly space_getEntity: (a: number, b: any) => any;
349
542
  readonly space_history: (a: number, b: number) => any;
350
543
  readonly space_manifestHash: (a: number) => [number, number];
544
+ readonly space_openGeometryItem: (a: number, b: number, c: number, d: any) => any;
351
545
  readonly space_queryHybrid: (a: number, b: number, c: number, d: any) => any;
546
+ readonly space_queryHybridPlanned: (a: number, b: number, c: number, d: any) => any;
352
547
  readonly space_queryScalar: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
353
548
  readonly space_queryText: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
354
549
  readonly space_queryVector: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
550
+ readonly space_readArrayColumn: (a: number, b: number, c: number) => any;
551
+ readonly space_readArrayConstant: (a: number, b: number, c: number) => any;
552
+ readonly space_readArrayItem: (a: number, b: number, c: number, d: any) => any;
355
553
  readonly space_readScalarColumn: (a: number, b: any, c: any) => any;
554
+ readonly space_readVideoItemRange: (a: number, b: number, c: number, d: any, e: any, f: any) => any;
356
555
  readonly space_resolveObjectIndex: (a: number, b: any) => any;
556
+ readonly space_semanticCacheCapacity: (a: number) => any;
557
+ readonly space_semanticCacheStats: (a: number) => any;
558
+ readonly space_setSemanticCacheCapacity: (a: number, b: number) => any;
357
559
  readonly space_timelineId: (a: number) => [number, number, number, number];
358
- readonly space_trackFor: (a: number, b: number, c: number) => any;
359
- readonly space_tracks: (a: number) => any;
560
+ readonly space_trackFor: (a: number, b: number, c: number) => [number, number, number];
561
+ readonly space_tracks: (a: number) => [number, number, number];
562
+ readonly space_videoItemAt: (a: number, b: number, c: number, d: any) => any;
563
+ readonly space_videoItemByKey: (a: number, b: number, c: number, d: any) => any;
360
564
  readonly spatialKeyRoundTrip: (a: number, b: number) => [number, number, number, number];
361
565
  readonly timeAnchorFromHex: (a: number, b: number) => [bigint, number, number];
362
566
  readonly timeAnchorHex: (a: bigint) => [number, number];
363
567
  readonly timeBucket: (a: bigint, b: number, c: number) => [bigint, number, number];
568
+ readonly typedArrayDecode: (a: any, b: number, c: number) => [number, number, number];
364
569
  readonly version: () => [number, number];
570
+ readonly writer_appendHot: (a: number, b: any, c: number) => any;
365
571
  readonly writer_appendMany: (a: number, b: any) => any;
572
+ readonly writer_appendManyWithSpecs: (a: number, b: any, c: any) => any;
366
573
  readonly writer_commit: (a: number) => any;
574
+ readonly writer_configureHotShard: (a: number, b: number, c: number) => [number, number];
575
+ readonly writer_createEntity: (a: number, b: any, c: any, d: number) => any;
576
+ readonly writer_deleteEntity: (a: number, b: any, c: any) => any;
367
577
  readonly writer_deleteRecords: (a: number, b: number, c: number, d: number, e: number) => any;
578
+ readonly writer_enableEntityKeys: (a: number, b: number, c: number) => any;
579
+ readonly writer_flushHot: (a: number) => any;
368
580
  readonly writer_manifestHash: (a: number) => [number, number, number, number];
369
581
  readonly writer_open: (a: number, b: number, c: any) => any;
582
+ readonly writer_publishGeometryCells: (a: number, b: number, c: number, d: any, e: any, f: any, g: any) => any;
583
+ readonly writer_publishGeometryMesh: (a: number, b: number, c: number, d: any, e: any, f: any) => any;
370
584
  readonly writer_refName: (a: number) => [number, number];
371
585
  readonly writer_snapshot: (a: number, b: number, c: number) => any;
586
+ readonly writer_supersedeEntity: (a: number, b: any, c: any, d: any, e: number) => any;
587
+ readonly writer_upsertEntity: (a: number, b: any, c: any, d: number, e: number) => any;
372
588
  readonly zeroSpatialKey: () => [number, number];
373
589
  readonly __wasm_init: () => void;
374
590
  readonly wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___wasm_bindgen_f7c54996eb9137d9___JsValue__core_7d5f0a2ba6a62c33___result__Result_____wasm_bindgen_f7c54996eb9137d9___JsError___true_: (a: number, b: number, c: any) => [number, number];