@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dreamlake/dreamdb
2
2
 
3
+ Documentation scope: the public npm release is 0.5.2 as checked on 2026-09-10.
4
+ New APIs merged on main (entity keys, progressive geometry and structured arrays)
5
+ require a source build until a corresponding package is published. See the
6
+ [main/unreleased guide](https://dreamdb.dreamlake.ai/main-features) separately
7
+ from the [released SDK reference](https://dreamdb.dreamlake.ai/typescript-sdk-api).
8
+
3
9
  The DreamDB SDK — read and write, in the browser and on the server, compiled to
4
10
  WebAssembly from the same Rust core the CLI and Python SDK use.
5
11
 
@@ -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
- * (v0 does not expose the optional scalar pre/post-filter; it runs with no
102
- * scalar gate.)
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,
@@ -152,6 +194,11 @@ export class Space {
152
194
  * authoritative shape and semantic metadata.
153
195
  */
154
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>;
155
202
  /**
156
203
  * Read a scalar track as a `Map<anchorString, value>`. Single-anchor
157
204
  * entries resolve from the track index; multi-anchor entries fetch (and
@@ -231,6 +278,11 @@ export class Writer {
231
278
  private constructor();
232
279
  free(): void;
233
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>;
234
286
  /**
235
287
  * Append records and commit in one call.
236
288
  *
@@ -244,6 +296,11 @@ export class Writer {
244
296
  * lifetime is under the caller's control.
245
297
  */
246
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>;
247
304
  /**
248
305
  * Flush staged entries and publish a new manifest.
249
306
  *
@@ -253,10 +310,30 @@ export class Writer {
253
310
  * its records on top of the new head is correct.
254
311
  */
255
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>;
256
325
  /**
257
326
  * Tombstone records by anchor. Returns the new manifest hash.
258
327
  */
259
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>;
260
337
  /**
261
338
  * Open a ref for writing.
262
339
  *
@@ -271,10 +348,27 @@ export class Writer {
271
348
  * until it calls it.
272
349
  */
273
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>;
274
360
  /**
275
361
  * Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
276
362
  */
277
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>;
278
372
  /**
279
373
  * Current manifest hash, base32.
280
374
  */
@@ -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";