@dreamlake/dreamdb 0.3.0 → 0.4.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/README.md +178 -0
- package/browser/dreamdb.d.ts +326 -0
- package/browser/dreamdb.js +9 -0
- package/{dreamdb_bg.js → browser/dreamdb_bg.js} +612 -2
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +56 -0
- package/browser-extras.mjs +193 -0
- package/browser.mjs +4 -0
- package/index.d.ts +541 -1
- package/node/dreamdb.cjs +1762 -0
- package/node/dreamdb.d.cts +425 -0
- package/node/dreamdb_bg.wasm +0 -0
- package/node/dreamdb_bg.wasm.d.ts +72 -0
- package/node.cjs +10 -0
- package/node.mjs +19 -0
- package/package.json +40 -16
- package/web/dreamdb.d.ts +407 -0
- package/web/dreamdb.js +1558 -0
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +56 -0
- package/web.mjs +17 -0
- package/dreamdb.d.ts +0 -150
- package/dreamdb.js +0 -9
- package/dreamdb_bg.wasm +0 -0
- package/index.js +0 -6
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_s3backend_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_space_free: (a: number, b: number) => void;
|
|
6
|
+
export const __wbg_writer_free: (a: number, b: number) => void;
|
|
7
|
+
export const addressRoundTrip: (a: number, b: number) => [number, number, number, number];
|
|
8
|
+
export const addressVariant: (a: number, b: number) => [number, number, number, number];
|
|
9
|
+
export const bytesToBase32: (a: number, b: number) => [number, number];
|
|
10
|
+
export const decodeCbor: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const encodeCbor: (a: any) => [number, number, number, number];
|
|
12
|
+
export const modalityParse: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const multihashBase32: (a: number, b: number) => [number, number];
|
|
14
|
+
export const multihashHex: (a: number, b: number) => [number, number];
|
|
15
|
+
export const rangeHeader: (a: bigint, b: bigint) => [number, number, number, number];
|
|
16
|
+
export const s3backend_get: (a: number, b: number, c: number, d: any) => any;
|
|
17
|
+
export const s3backend_list: (a: number, b: number, c: number) => any;
|
|
18
|
+
export const s3backend_new: (a: number, b: number) => number;
|
|
19
|
+
export const space_connectorBase: (a: number) => [number, number];
|
|
20
|
+
export const space_fromUri: (a: number, b: number, c: any) => any;
|
|
21
|
+
export const space_history: (a: number, b: number) => any;
|
|
22
|
+
export const space_manifestHash: (a: number) => [number, number];
|
|
23
|
+
export const space_queryHybrid: (a: number, b: number, c: number, d: any) => any;
|
|
24
|
+
export const space_queryScalar: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
25
|
+
export const space_queryText: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
26
|
+
export const space_queryVector: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
|
|
27
|
+
export const space_readScalarColumn: (a: number, b: any, c: any) => any;
|
|
28
|
+
export const space_resolveObjectIndex: (a: number, b: any) => any;
|
|
29
|
+
export const space_timelineId: (a: number) => [number, number, number, number];
|
|
30
|
+
export const space_trackFor: (a: number, b: number, c: number) => any;
|
|
31
|
+
export const space_tracks: (a: number) => any;
|
|
32
|
+
export const spatialKeyRoundTrip: (a: number, b: number) => [number, number, number, number];
|
|
33
|
+
export const timeAnchorFromHex: (a: number, b: number) => [bigint, number, number];
|
|
34
|
+
export const timeAnchorHex: (a: bigint) => [number, number];
|
|
35
|
+
export const timeBucket: (a: bigint, b: number, c: number) => [bigint, number, number];
|
|
36
|
+
export const version: () => [number, number];
|
|
37
|
+
export const writer_appendMany: (a: number, b: any) => any;
|
|
38
|
+
export const writer_commit: (a: number) => any;
|
|
39
|
+
export const writer_deleteRecords: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
40
|
+
export const writer_manifestHash: (a: number) => [number, number, number, number];
|
|
41
|
+
export const writer_open: (a: number, b: number, c: any) => any;
|
|
42
|
+
export const writer_refName: (a: number) => [number, number];
|
|
43
|
+
export const writer_snapshot: (a: number, b: number, c: number) => any;
|
|
44
|
+
export const zeroSpatialKey: () => [number, number];
|
|
45
|
+
export const __wasm_init: () => void;
|
|
46
|
+
export const 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];
|
|
47
|
+
export const wasm_bindgen_f7c54996eb9137d9___convert__closures_____invoke___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined___js_sys_ac40961855821e8e___Function_fn_wasm_bindgen_f7c54996eb9137d9___JsValue_____wasm_bindgen_f7c54996eb9137d9___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
48
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
49
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
50
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
51
|
+
export const __externref_table_alloc: () => number;
|
|
52
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
53
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
54
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
55
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
56
|
+
export const __wbindgen_start: () => void;
|
package/web.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// No-bundler entry, for `<script type="module">` and Deno.
|
|
2
|
+
//
|
|
3
|
+
// Unlike the bundler build this one cannot instantiate itself: the browser has
|
|
4
|
+
// to fetch the .wasm at runtime. `init()` is the default export and MUST be
|
|
5
|
+
// awaited before any other export is used. Calling `Space.fromUri` first
|
|
6
|
+
// throws from inside wasm-bindgen's glue with no useful message, which is why
|
|
7
|
+
// this entry exists rather than pointing people at './web/dreamdb.js'.
|
|
8
|
+
import init from './web/dreamdb.js'
|
|
9
|
+
export * from './web/dreamdb.js'
|
|
10
|
+
export { ZERO_SPATIAL_KEY, PresignedBackend, Authoring } from './browser-extras.mjs'
|
|
11
|
+
|
|
12
|
+
let started
|
|
13
|
+
/** Fetch and instantiate the wasm. Idempotent; await before anything else. */
|
|
14
|
+
export default function ready(input) {
|
|
15
|
+
started ??= init(input)
|
|
16
|
+
return started
|
|
17
|
+
}
|
package/dreamdb.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
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
|
-
* Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
|
|
46
|
-
* sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
|
|
47
|
-
* list sorted by fused score descending — the same scored shape as
|
|
48
|
-
* `queryVector`.
|
|
49
|
-
*
|
|
50
|
-
* `vector` is the dense sub-query embedding (a `Float32Array`). `opts` is a
|
|
51
|
-
* plain JS object:
|
|
52
|
-
* ```js
|
|
53
|
-
* {
|
|
54
|
-
* textField, textQuery, // BM25 sub-query (required)
|
|
55
|
-
* vectorField, // dense field the `vector` targets (required)
|
|
56
|
-
* topK = 10, // fused results to return
|
|
57
|
-
* fusion = 'rrf', // 'rrf' | 'linear' | 'max' | 'pareto'
|
|
58
|
-
* rrfK = 60, // RRF rank constant (fusion='rrf')
|
|
59
|
-
* textWeight = 1, vectorWeight = 1, // Linear weights (fusion='linear')
|
|
60
|
-
* textK = topK, vectorK = topK, // per-sub-query candidate depths
|
|
61
|
-
* textRequired = false, vectorRequired = false, // §5.3 boolean-AND gates
|
|
62
|
-
* }
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* 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.)
|
|
68
|
-
*/
|
|
69
|
-
queryHybrid(vector: Float32Array, opts: any): Promise<Array<any>>;
|
|
70
|
-
/**
|
|
71
|
-
* Lexical BM25 text search over a text `field` (spec/0015 §3.6).
|
|
72
|
-
*
|
|
73
|
-
* Tokenizes `query` with the built-in `dreamdb.utf8-words` tokenizer
|
|
74
|
-
* (lowercase + split on non-alphanumeric — pure Rust, compiled into the
|
|
75
|
-
* wasm; no external model needed even though the field's embeddings were
|
|
76
|
-
* produced elsewhere), scores docs with BM25, and suppresses tombstoned
|
|
77
|
-
* anchors. Returns `[{ anchor, score }]` sorted by score descending — the
|
|
78
|
-
* same scored shape as `queryVector`.
|
|
79
|
-
*
|
|
80
|
-
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_text`.
|
|
81
|
-
*/
|
|
82
|
-
queryText(field: string, query: string, top_k: number): Promise<Array<any>>;
|
|
83
|
-
/**
|
|
84
|
-
* Top-K cosine vector search over an embedding `field`. `opts` may be a
|
|
85
|
-
* number (topK) or `{ topK?, probeCount? }`. Returns `[{ anchor, score }]`
|
|
86
|
-
* sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
|
|
87
|
-
*
|
|
88
|
-
* Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
|
|
89
|
-
* two-pass rerank + HotShard merge + tombstone suppression.
|
|
90
|
-
*/
|
|
91
|
-
queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
|
|
92
|
-
/**
|
|
93
|
-
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
94
|
-
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
95
|
-
* de-dupe) their bucket and roaring-decode the anchor set.
|
|
96
|
-
*/
|
|
97
|
-
readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
|
|
98
|
-
/**
|
|
99
|
-
* Fetch a track object and return its `object_index` (array of CBOR
|
|
100
|
-
* entries). Inline indexes only — paged indexes are not resolved (matching
|
|
101
|
-
* dreamdb-ts, which also doesn't support them on this path).
|
|
102
|
-
*/
|
|
103
|
-
resolveObjectIndex(track: any): Promise<Array<any>>;
|
|
104
|
-
/**
|
|
105
|
-
* Base32 hash of the manifest's first timeline.
|
|
106
|
-
*/
|
|
107
|
-
timelineId(): string;
|
|
108
|
-
/**
|
|
109
|
-
* Find a track by its resolved `key` or by `modality`.
|
|
110
|
-
*/
|
|
111
|
-
trackFor(key_or_modality: string): any;
|
|
112
|
-
/**
|
|
113
|
-
* List resolved tracks from this manifest.
|
|
114
|
-
*/
|
|
115
|
-
tracks(): Array<any>;
|
|
116
|
-
/**
|
|
117
|
-
* The base URL objects are fetched relative to (consumers build their own
|
|
118
|
-
* object URLs from this — e.g. `dreamdb-demo`'s track readers).
|
|
119
|
-
*/
|
|
120
|
-
readonly connectorBase: string;
|
|
121
|
-
/**
|
|
122
|
-
* The manifest's base32 multihash.
|
|
123
|
-
*/
|
|
124
|
-
readonly manifestHash: string;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Encode arbitrary bytes as lowercase RFC-4648 base32 (no padding).
|
|
129
|
-
*
|
|
130
|
-
* Byte-identical to `dreamdb-ts`'s `bytesToBase32` (alphabet
|
|
131
|
-
* `abcdefghijklmnopqrstuvwxyz234567`) and to `dreamdb_core`'s multihash
|
|
132
|
-
* `to_base32`, which is how object addresses are spelled on disk.
|
|
133
|
-
*/
|
|
134
|
-
export function bytesToBase32(bytes: Uint8Array): string;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Decode a single CBOR value from `bytes` into its JS representation.
|
|
138
|
-
*/
|
|
139
|
-
export function decodeCbor(bytes: Uint8Array): any;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Package version — useful for consumers to confirm which build is loaded.
|
|
143
|
-
*/
|
|
144
|
-
export function version(): string;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The all-zero spatial-key path segment used for non-spatial (fragment) object
|
|
148
|
-
* addresses. Matches `dreamdb-ts`'s `ZERO_SPATIAL_KEY` constant exactly.
|
|
149
|
-
*/
|
|
150
|
-
export function zeroSpatialKey(): string;
|
package/dreamdb.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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";
|
package/dreamdb_bg.wasm
DELETED
|
Binary file
|
package/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @dreamlake/dreamdb — public entry. Re-exports the wasm-bindgen bindings and
|
|
2
|
-
// adds the plain-constant / type members consumers import.
|
|
3
|
-
export * from './dreamdb.js'
|
|
4
|
-
|
|
5
|
-
/** Zero spatial-key path segment for non-spatial (fragment) object addresses. */
|
|
6
|
-
export const ZERO_SPATIAL_KEY = '0000000000000000'
|