@dreamlake/dreamdb 0.1.1 → 0.2.0

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/dreamdb.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A `fetch`-backed backend rooted at a base URL.
6
+ */
7
+ export class S3Backend {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Fetch `path` (relative to the base URL) and resolve to its bytes.
12
+ * `opts.noCache` is accepted for API compatibility (currently a no-op:
13
+ * content is hash-addressed; refs are read fresh each page load anyway).
14
+ */
15
+ get(path: string, _opts: any): Promise<Uint8Array>;
16
+ /**
17
+ * List object paths under `prefix`. Stub (returns empty); the current
18
+ * consumer read paths don't require listing.
19
+ */
20
+ list(_prefix: string): Promise<Array<any>>;
21
+ /**
22
+ * Construct rooted at `base_url` (trailing slash trimmed).
23
+ */
24
+ constructor(base_url: string);
25
+ }
26
+
27
+ export class Space {
28
+ private constructor();
29
+ free(): void;
30
+ [Symbol.dispose](): void;
31
+ /**
32
+ * Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
33
+ * resolving the ref (if any) and loading the manifest. If `backend` is
34
+ * provided it handles IO (relative paths); otherwise a direct-fetch
35
+ * connector rooted at the parsed base URL is used (the `dreamdb-demo`
36
+ * no-backend path).
37
+ */
38
+ static fromUri(uri: string, backend: any): Promise<Space>;
39
+ /**
40
+ * Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
41
+ * `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
42
+ */
43
+ history(max_depth?: number | null): Promise<Array<any>>;
44
+ /**
45
+ * Top-K cosine vector search over an embedding `field`. `opts` may be a
46
+ * number (topK) or `{ topK?, probeCount? }`. Returns `[{ anchor, score }]`
47
+ * sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
48
+ *
49
+ * Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
50
+ * two-pass rerank + HotShard merge + tombstone suppression.
51
+ */
52
+ queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
53
+ /**
54
+ * Read a scalar track as a `Map<anchorString, value>`. Single-anchor
55
+ * entries resolve from the track index; multi-anchor entries fetch (and
56
+ * de-dupe) their bucket and roaring-decode the anchor set.
57
+ */
58
+ readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
59
+ /**
60
+ * Find a track by its resolved `key` or by `modality`.
61
+ */
62
+ trackFor(key_or_modality: string): any;
63
+ /**
64
+ * List resolved tracks from this manifest.
65
+ */
66
+ tracks(): Array<any>;
67
+ /**
68
+ * The base URL objects are fetched relative to (consumers build their own
69
+ * object URLs from this — e.g. `dreamdb-demo`'s track readers).
70
+ */
71
+ readonly connectorBase: string;
72
+ /**
73
+ * The manifest's base32 multihash.
74
+ */
75
+ readonly manifestHash: string;
76
+ }
77
+
78
+ /**
79
+ * Encode arbitrary bytes as lowercase RFC-4648 base32 (no padding).
80
+ *
81
+ * Byte-identical to `dreamdb-ts`'s `bytesToBase32` (alphabet
82
+ * `abcdefghijklmnopqrstuvwxyz234567`) and to `dreamdb_core`'s multihash
83
+ * `to_base32`, which is how object addresses are spelled on disk.
84
+ */
85
+ export function bytesToBase32(bytes: Uint8Array): string;
86
+
87
+ /**
88
+ * Decode a single CBOR value from `bytes` into its JS representation.
89
+ */
90
+ export function decodeCbor(bytes: Uint8Array): any;
91
+
92
+ /**
93
+ * Package version — useful for consumers to confirm which build is loaded.
94
+ */
95
+ export function version(): string;
96
+
97
+ /**
98
+ * The all-zero spatial-key path segment used for non-spatial (fragment) object
99
+ * addresses. Matches `dreamdb-ts`'s `ZERO_SPATIAL_KEY` constant exactly.
100
+ */
101
+ export function zeroSpatialKey(): string;
package/dreamdb.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./dreamdb.d.ts" */
2
+ import * as wasm from "./dreamdb_bg.wasm";
3
+ import { __wbg_set_wasm } from "./dreamdb_bg.js";
4
+
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ S3Backend, Space, bytesToBase32, decodeCbor, version, zeroSpatialKey
9
+ } from "./dreamdb_bg.js";