@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.
@@ -0,0 +1,425 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Dataset creation, layers, merge, compaction and history.
6
+ */
7
+ export class Authoring {
8
+ private constructor();
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * Add an embedding column whose index artifacts already exist.
13
+ *
14
+ * `spatialIndex` and `compressor` are base32 multihashes of objects the
15
+ * caller has already trained and uploaded (the CLI's `rebuild_exact` /
16
+ * index builders produce them). They are required rather than optional
17
+ * because training an IVF index inside a wasm module means holding the
18
+ * full training set in a 32-bit address space — the failure mode is an
19
+ * allocation abort that reaches JS as a bare `unreachable`.
20
+ *
21
+ * `rerank` stores exact f32 vectors alongside the compressed ones. Leave
22
+ * it on unless you have measured that you can live without it: with it
23
+ * off, reads decode 1-bit reconstructions and relevance degrades in a way
24
+ * no API-level check can see.
25
+ */
26
+ 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>;
27
+ /**
28
+ * Add a field to the schema of an existing dataset.
29
+ */
30
+ addField(field: any): Promise<void>;
31
+ /**
32
+ * Add an image column over an existing field's anchors.
33
+ * `samples` is `[[anchor, Uint8Array], …]`.
34
+ */
35
+ addImageLayer(name: string, parent_field: string, samples: Array<any>, mime: string): Promise<void>;
36
+ /**
37
+ * Add a scalar column over an existing field's anchors.
38
+ *
39
+ * `samples` is `[[anchor, value], …]`; anchors must already exist in the
40
+ * parent field. `valueType` is one of
41
+ * `int|float|bool|string|categorical|timestamp`.
42
+ */
43
+ addScalarLayer(name: string, parent_field: string, value_type: string, samples: Array<any>): Promise<void>;
44
+ /**
45
+ * Fork the current manifest to a new ref name.
46
+ */
47
+ branch(new_name: string): Promise<Authoring>;
48
+ /**
49
+ * Collapse per-cell fragments. Returns
50
+ * `{cellsExamined, cellsCompacted, fragmentsCollapsed, manifest?}`.
51
+ *
52
+ * This is the cheapest latency lever there is on a sharded ingest: on the
53
+ * `vision-mixed` corpus it took 32,782 buckets to 3,122 in 1m48s, for no
54
+ * change in results and no extra hardware. `manifest` is absent when
55
+ * nothing needed compacting — a no-op, not a failure.
56
+ */
57
+ compact(modality: string | null | undefined, threshold: number, max_cells: number): Promise<any>;
58
+ /**
59
+ * Create a new dataset and publish `refs/<name>`.
60
+ *
61
+ * `schema` is an array of field descriptors — see `marshal::schema_from_js`
62
+ * for the accepted shapes.
63
+ *
64
+ * Note the core's own constraint, surfaced rather than papered over:
65
+ * embedding fields declaring `dreamdb.ivf-cosine` / `dreamdb.imi-cosine`
66
+ * cannot be created here, because those index families need training data
67
+ * that does not exist yet at create time. Create with the default
68
+ * `dreamdb.lsh-cosine` and add a trained index as a layer once you have
69
+ * vectors, or build the index with the CLI.
70
+ */
71
+ static create(name: string, schema: Array<any>, base: string, backend: any): Promise<Authoring>;
72
+ /**
73
+ * Delete a ref. Does not delete the objects it pointed at — they stay
74
+ * reachable by manifest hash, which is what makes this recoverable.
75
+ */
76
+ deleteRef(name: string): Promise<void>;
77
+ /**
78
+ * Ref names under `refs/`. Requires a backend implementing `list`.
79
+ */
80
+ listRefs(): Promise<string[]>;
81
+ /**
82
+ * Merge one or more branches into this ref. Returns the new manifest hash.
83
+ */
84
+ mergeMany(branches: string[]): Promise<string>;
85
+ /**
86
+ * Open an existing ref for authoring.
87
+ */
88
+ static open(uri: string, backend: any): Promise<Authoring>;
89
+ /**
90
+ * Set a human-readable description on the dataset.
91
+ */
92
+ setDescription(text: string): Promise<void>;
93
+ /**
94
+ * A `Writer` sharing this handle — for append/commit/snapshot.
95
+ */
96
+ writer(): Writer;
97
+ /**
98
+ * The ref this handle writes to.
99
+ */
100
+ readonly refName: string;
101
+ }
102
+
103
+ /**
104
+ * A `fetch`-backed backend rooted at a base URL.
105
+ */
106
+ export class S3Backend {
107
+ free(): void;
108
+ [Symbol.dispose](): void;
109
+ /**
110
+ * Fetch `path` (relative to the base URL) and resolve to its bytes.
111
+ * `opts.noCache` is accepted for API compatibility (currently a no-op:
112
+ * content is hash-addressed; refs are read fresh each page load anyway).
113
+ */
114
+ get(path: string, _opts: any): Promise<Uint8Array>;
115
+ /**
116
+ * List object paths under `prefix`. Stub (returns empty); the current
117
+ * consumer read paths don't require listing.
118
+ */
119
+ list(_prefix: string): Promise<Array<any>>;
120
+ /**
121
+ * Construct rooted at `base_url` (trailing slash trimmed).
122
+ */
123
+ constructor(base_url: string);
124
+ }
125
+
126
+ export class Space {
127
+ private constructor();
128
+ free(): void;
129
+ [Symbol.dispose](): void;
130
+ /**
131
+ * Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
132
+ * resolving the ref (if any) and loading the manifest. If `backend` is
133
+ * provided it handles IO (relative paths); otherwise a direct-fetch
134
+ * connector rooted at the parsed base URL is used (the `dreamdb-demo`
135
+ * no-backend path).
136
+ */
137
+ static fromUri(uri: string, backend: any): Promise<Space>;
138
+ /**
139
+ * Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
140
+ * `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
141
+ */
142
+ history(max_depth?: number | null): Promise<Array<any>>;
143
+ /**
144
+ * Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
145
+ * sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
146
+ * list sorted by fused score descending — the same scored shape as
147
+ * `queryVector`.
148
+ *
149
+ * `vector` is the dense sub-query embedding (a `Float32Array`). `opts` is a
150
+ * plain JS object:
151
+ * ```js
152
+ * {
153
+ * textField, textQuery, // BM25 sub-query (required)
154
+ * vectorField, // dense field the `vector` targets (required)
155
+ * topK = 10, // fused results to return
156
+ * fusion = 'rrf', // 'rrf' | 'linear' | 'max' | 'pareto'
157
+ * rrfK = 60, // RRF rank constant (fusion='rrf')
158
+ * textWeight = 1, vectorWeight = 1, // Linear weights (fusion='linear')
159
+ * textK = topK, vectorK = topK, // per-sub-query candidate depths
160
+ * textRequired = false, vectorRequired = false, // §5.3 boolean-AND gates
161
+ * }
162
+ * ```
163
+ *
164
+ * Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
165
+ * (v0 does not expose the optional scalar pre/post-filter; it runs with no
166
+ * scalar gate.)
167
+ */
168
+ queryHybrid(vector: Float32Array, opts: any): Promise<Array<any>>;
169
+ /**
170
+ * Scalar-index lookup: every anchor whose `field` satisfies `op value`
171
+ * (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
172
+ * tombstone-suppressed, sorted ascending and deduped.
173
+ *
174
+ * This is the expansion half of a compact lexical index. A BM25 index
175
+ * built over a scalar field's DISTINCT values returns one representative
176
+ * anchor per matched value; resolving that value back to *every* record
177
+ * carrying it is a scalar-index lookup, not a text-index concern. Keeping
178
+ * the split this way is what lets the text index stay small enough to
179
+ * load in a browser — indexing one document per record instead produced a
180
+ * 406 MB object for ~1,700 distinct strings.
181
+ *
182
+ * `op` is one of `==`, `!=`, `<`, `<=`, `>`, `>=`. `value` may be a
183
+ * string, number, or boolean; strings match both `String` and
184
+ * `Categorical` scalar fields.
185
+ */
186
+ queryScalar(field: string, op: string, value: any): Promise<Array<any>>;
187
+ /**
188
+ * Lexical BM25 text search over a text `field` (spec/0015 §3.6).
189
+ *
190
+ * Tokenizes `query` with the built-in `dreamdb.utf8-words` tokenizer
191
+ * (lowercase + split on non-alphanumeric — pure Rust, compiled into the
192
+ * wasm; no external model needed even though the field's embeddings were
193
+ * produced elsewhere), scores docs with BM25, and suppresses tombstoned
194
+ * anchors. Returns `[{ anchor, score }]` sorted by score descending — the
195
+ * same scored shape as `queryVector`.
196
+ *
197
+ * Delegates to the real (tested) `dreamdb-dataset::Dataset::query_text`.
198
+ */
199
+ queryText(field: string, query: string, top_k: number): Promise<Array<any>>;
200
+ /**
201
+ * Top-K cosine vector search over an embedding `field`. `opts` may be a
202
+ * number (topK) or `{ topK?, probeCount? }`. Returns `[{ anchor, score }]`
203
+ * sorted by score descending — the shape dreamdb-ts's `queryVector` yields.
204
+ *
205
+ * Delegates to the real (tested) `dreamdb-dataset` query path: ADC cull +
206
+ * two-pass rerank + HotShard merge + tombstone suppression.
207
+ */
208
+ queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
209
+ /**
210
+ * Read a scalar track as a `Map<anchorString, value>`. Single-anchor
211
+ * entries resolve from the track index; multi-anchor entries fetch (and
212
+ * de-dupe) their bucket and roaring-decode the anchor set.
213
+ */
214
+ readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
215
+ /**
216
+ * Fetch a track object and return its `object_index` (array of CBOR
217
+ * entries). Inline indexes only — paged indexes are not resolved (matching
218
+ * dreamdb-ts, which also doesn't support them on this path).
219
+ */
220
+ resolveObjectIndex(track: any): Promise<Array<any>>;
221
+ /**
222
+ * Base32 hash of the manifest's first timeline.
223
+ */
224
+ timelineId(): string;
225
+ /**
226
+ * Find a track by its resolved `key` or by `modality`.
227
+ */
228
+ trackFor(key_or_modality: string): any;
229
+ /**
230
+ * List resolved tracks from this manifest.
231
+ */
232
+ tracks(): Array<any>;
233
+ /**
234
+ * The base URL objects are fetched relative to (consumers build their own
235
+ * object URLs from this — e.g. `dreamdb-demo`'s track readers).
236
+ */
237
+ readonly connectorBase: string;
238
+ /**
239
+ * The manifest's base32 multihash.
240
+ */
241
+ readonly manifestHash: string;
242
+ }
243
+
244
+ /**
245
+ * A write handle onto a ref.
246
+ */
247
+ export class Writer {
248
+ private constructor();
249
+ free(): void;
250
+ [Symbol.dispose](): void;
251
+ /**
252
+ * Append records and commit in one call.
253
+ *
254
+ * `samples` is an array of `{ anchor?: bigint|number, <field>: value }`.
255
+ * See `marshal::samples_from_js` for the accepted field shapes.
256
+ *
257
+ * Committing here rather than exposing a separate staged mode is
258
+ * deliberate for the browser surface: a staged write that is never
259
+ * committed leaves uploaded objects unreferenced, and a tab can close at
260
+ * any moment. `appendStaged` exists on the Node surface where the process
261
+ * lifetime is under the caller's control.
262
+ */
263
+ appendMany(samples: Array<any>): Promise<number>;
264
+ /**
265
+ * Flush staged entries and publish a new manifest.
266
+ *
267
+ * Fails with a CAS conflict if the ref moved underneath this writer. That
268
+ * is not retried automatically: an automatic retry would hide a logical
269
+ * conflict, and the caller is the only one who knows whether re-applying
270
+ * its records on top of the new head is correct.
271
+ */
272
+ commit(): Promise<string>;
273
+ /**
274
+ * Tombstone records by anchor. Returns the new manifest hash.
275
+ */
276
+ deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
277
+ /**
278
+ * Open a ref for writing.
279
+ *
280
+ * `uri` is the same `.../refs/<name>` form `Space.fromUri` takes; a
281
+ * `.../manifests/<hash>` URI is rejected rather than silently opening
282
+ * something unwritable, because a manifest hash names an immutable
283
+ * snapshot — there is nothing for a commit to advance.
284
+ *
285
+ * `backend` must implement `put` (Backend contract v2). Passing a
286
+ * read-only backend fails at the first write with a clear message rather
287
+ * than here, since the connector cannot know what the JS object omits
288
+ * until it calls it.
289
+ */
290
+ static open(uri: string, backend: any): Promise<Writer>;
291
+ /**
292
+ * Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
293
+ */
294
+ snapshot(label: string): Promise<string>;
295
+ /**
296
+ * Current manifest hash, base32.
297
+ */
298
+ readonly manifestHash: string;
299
+ /**
300
+ * The ref this writer advances.
301
+ */
302
+ readonly refName: string;
303
+ }
304
+
305
+ /**
306
+ * Install a panic hook that logs the panic message AND its `file:line:col`
307
+ * to the console before the wasm trap surfaces to JS.
308
+ *
309
+ * Without this, every Rust panic reaches JavaScript as a bare
310
+ * `RuntimeError: unreachable` with nothing but wasm frame offsets — and it is
311
+ * indistinguishable from an allocation failure, since Rust's alloc-error
312
+ * handler also aborts. That ambiguity cost real debugging time: a browser
313
+ * `unreachable` from exhausting wasm32's 32-bit address space on an oversized
314
+ * index was initially read as an integer-overflow panic.
315
+ *
316
+ * Zero new deps — uses the already-enabled `web-sys` `console` feature.
317
+ * Runs once at module init.
318
+ */
319
+ export function __wasm_init(): void;
320
+
321
+ /**
322
+ * Parse an object path and re-format it. Byte-identity of the result is the
323
+ * actual assertion: a parser that silently drops a component still "parses".
324
+ */
325
+ export function addressRoundTrip(path: string): string;
326
+
327
+ /**
328
+ * The address variant name (`Genesis`, `Manifest`, `Ref`, …) for a path.
329
+ *
330
+ * Derived from the Debug representation rather than a hand-written match.
331
+ * `DreamDbAddress` has seventeen variants and gains one whenever the protocol
332
+ * does; a match arm per variant would be a second list to keep in sync, and
333
+ * the vectors only ever assert the name.
334
+ */
335
+ export function addressVariant(path: string): string;
336
+
337
+ /**
338
+ * Encode arbitrary bytes as lowercase RFC-4648 base32 (no padding).
339
+ *
340
+ * Byte-identical to `dreamdb-ts`'s `bytesToBase32` (alphabet
341
+ * `abcdefghijklmnopqrstuvwxyz234567`) and to `dreamdb_core`'s multihash
342
+ * `to_base32`, which is how object addresses are spelled on disk.
343
+ */
344
+ export function bytesToBase32(bytes: Uint8Array): string;
345
+
346
+ /**
347
+ * Decode a single CBOR value from `bytes` into its JS representation.
348
+ */
349
+ export function decodeCbor(bytes: Uint8Array): any;
350
+
351
+ /**
352
+ * Canonically encode a JS value as CBOR, returning the bytes.
353
+ *
354
+ * Canonical here means what spec/0002 §3.1 means: map keys sorted by their
355
+ * encoded bytes, shortest-form integers, no indefinite lengths. Two writers
356
+ * that disagree on this produce different content hashes for the same logical
357
+ * object, and every address derived from them diverges.
358
+ */
359
+ export function encodeCbor(value: any): Uint8Array;
360
+
361
+ /**
362
+ * Parse a modality tag into `{class, encoding, trackKind, objectKind, params,
363
+ * flags}`, or throw if it is invalid.
364
+ *
365
+ * `params` is a plain object of the `key=value` segments and `flags` an array
366
+ * of the bare ones (`bucketed`, `graph`). They are separate because the
367
+ * grammar treats them differently and merging them would make a flag
368
+ * indistinguishable from a parameter whose value happened to be empty.
369
+ */
370
+ export function modalityParse(tag: string): any;
371
+
372
+ /**
373
+ * BLAKE3-256 multihash of `bytes`, base32 (the form used in object paths).
374
+ */
375
+ export function multihashBase32(bytes: Uint8Array): string;
376
+
377
+ /**
378
+ * BLAKE3-256 multihash of `bytes` as lowercase hex (33 bytes: tag + digest).
379
+ */
380
+ export function multihashHex(bytes: Uint8Array): string;
381
+
382
+ /**
383
+ * DreamDB's half-open `[start, end)` → an HTTP `Range` header value.
384
+ *
385
+ * The off-by-one here is worth a vector of its own: HTTP ranges are
386
+ * *inclusive* of the end byte. Getting it wrong reads one byte too few from
387
+ * every object, which corrupts decode in ways that look like anything but an
388
+ * off-by-one.
389
+ */
390
+ export function rangeHeader(start: bigint, end: bigint): string;
391
+
392
+ /**
393
+ * Round-trip a spatial key through its base-2 form, per spec/0002 §6.
394
+ *
395
+ * Returns the re-encoded string, so a caller can assert byte-identity rather
396
+ * than merely "it parsed".
397
+ */
398
+ export function spatialKeyRoundTrip(bits: string): string;
399
+
400
+ /**
401
+ * The 16-char hex address form → TimeAnchor. Throws on a malformed input
402
+ * (wrong length, uppercase) rather than coercing it.
403
+ */
404
+ export function timeAnchorFromHex(s: string): bigint;
405
+
406
+ /**
407
+ * TimeAnchor → the 16-char hex used in addresses.
408
+ */
409
+ export function timeAnchorHex(value: bigint): string;
410
+
411
+ /**
412
+ * Which time bucket an anchor falls in, given a duration like `"1s"`/`"60s"`.
413
+ */
414
+ export function timeBucket(t_start: bigint, duration: string): bigint;
415
+
416
+ /**
417
+ * Package version — useful for consumers to confirm which build is loaded.
418
+ */
419
+ export function version(): string;
420
+
421
+ /**
422
+ * The all-zero spatial-key path segment used for non-spatial (fragment) object
423
+ * addresses. Matches `dreamdb-ts`'s `ZERO_SPATIAL_KEY` constant exactly.
424
+ */
425
+ export function zeroSpatialKey(): string;
Binary file
@@ -0,0 +1,72 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_authoring_free: (a: number, b: number) => void;
5
+ export const __wbg_s3backend_free: (a: number, b: number) => void;
6
+ export const __wbg_space_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 authoring_addEmbeddingLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: any) => any;
10
+ export const authoring_addField: (a: number, b: any) => any;
11
+ export const authoring_addImageLayer: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => any;
12
+ export const authoring_addScalarLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: any) => any;
13
+ export const authoring_branch: (a: number, b: number, c: number) => any;
14
+ export const authoring_compact: (a: number, b: number, c: number, d: number, e: number) => any;
15
+ export const authoring_create: (a: number, b: number, c: any, d: number, e: number, f: any) => any;
16
+ export const authoring_deleteRef: (a: number, b: number, c: number) => any;
17
+ export const authoring_listRefs: (a: number) => any;
18
+ export const authoring_mergeMany: (a: number, b: number, c: number) => any;
19
+ export const authoring_open: (a: number, b: number, c: any) => any;
20
+ export const authoring_refName: (a: number) => [number, number];
21
+ export const authoring_setDescription: (a: number, b: number, c: number) => any;
22
+ export const authoring_writer: (a: number) => number;
23
+ export const bytesToBase32: (a: number, b: number) => [number, number];
24
+ export const decodeCbor: (a: number, b: number) => [number, number, number];
25
+ export const encodeCbor: (a: any) => [number, number, number, number];
26
+ export const modalityParse: (a: number, b: number) => [number, number, number];
27
+ export const multihashBase32: (a: number, b: number) => [number, number];
28
+ export const multihashHex: (a: number, b: number) => [number, number];
29
+ export const rangeHeader: (a: bigint, b: bigint) => [number, number, number, number];
30
+ export const s3backend_get: (a: number, b: number, c: number, d: any) => any;
31
+ export const s3backend_list: (a: number, b: number, c: number) => any;
32
+ export const s3backend_new: (a: number, b: number) => number;
33
+ export const space_connectorBase: (a: number) => [number, number];
34
+ export const space_fromUri: (a: number, b: number, c: any) => any;
35
+ export const space_history: (a: number, b: number) => any;
36
+ export const space_manifestHash: (a: number) => [number, number];
37
+ export const space_queryHybrid: (a: number, b: number, c: number, d: any) => any;
38
+ export const space_queryScalar: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
39
+ export const space_queryText: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
40
+ export const space_queryVector: (a: number, b: number, c: number, d: number, e: number, f: any) => any;
41
+ export const space_readScalarColumn: (a: number, b: any, c: any) => any;
42
+ export const space_resolveObjectIndex: (a: number, b: any) => any;
43
+ export const space_timelineId: (a: number) => [number, number, number, number];
44
+ export const space_trackFor: (a: number, b: number, c: number) => any;
45
+ export const space_tracks: (a: number) => any;
46
+ export const spatialKeyRoundTrip: (a: number, b: number) => [number, number, number, number];
47
+ export const timeAnchorFromHex: (a: number, b: number) => [bigint, number, number];
48
+ export const timeAnchorHex: (a: bigint) => [number, number];
49
+ export const timeBucket: (a: bigint, b: number, c: number) => [bigint, number, number];
50
+ export const version: () => [number, number];
51
+ export const writer_appendMany: (a: number, b: any) => any;
52
+ export const writer_commit: (a: number) => any;
53
+ export const writer_deleteRecords: (a: number, b: number, c: number, d: number, e: number) => any;
54
+ export const writer_manifestHash: (a: number) => [number, number, number, number];
55
+ export const writer_open: (a: number, b: number, c: any) => any;
56
+ export const writer_snapshot: (a: number, b: number, c: number) => any;
57
+ export const zeroSpatialKey: () => [number, number];
58
+ export const __wasm_init: () => void;
59
+ export const __wbg_writer_free: (a: number, b: number) => void;
60
+ export const writer_refName: (a: number) => [number, number];
61
+ 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];
62
+ 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;
63
+ export const __wbindgen_malloc: (a: number, b: number) => number;
64
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
65
+ export const __wbindgen_exn_store: (a: number) => void;
66
+ export const __externref_table_alloc: () => number;
67
+ export const __wbindgen_externrefs: WebAssembly.Table;
68
+ export const __wbindgen_destroy_closure: (a: number, b: number) => void;
69
+ export const __externref_drop_slice: (a: number, b: number) => void;
70
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
71
+ export const __externref_table_dealloc: (a: number) => void;
72
+ export const __wbindgen_start: () => void;
package/node.cjs ADDED
@@ -0,0 +1,10 @@
1
+ // Node CommonJS entry.
2
+ //
3
+ // `PresignedBackend` is deliberately absent here. It exists to keep bucket
4
+ // credentials out of a browser tab; on a server you already hold credentials,
5
+ // and minting a URL for yourself adds a round trip to every object write.
6
+ const mod = require('./node/dreamdb.cjs')
7
+
8
+ module.exports = Object.assign({}, mod, {
9
+ ZERO_SPATIAL_KEY: '0000000000000000',
10
+ })
package/node.mjs ADDED
@@ -0,0 +1,19 @@
1
+ // Node ESM entry. The underlying build is CommonJS (wasm-pack's nodejs target
2
+ // reads the .wasm off disk synchronously), so it is imported as a default and
3
+ // re-exported by name — Node's CJS named-export detection is a heuristic, and
4
+ // relying on it for a generated file is how a package works on one Node minor
5
+ // and not the next.
6
+ //
7
+ // This list is generated by build.sh from dreamdb.d.cts. Do not edit.
8
+ import mod from './node/dreamdb.cjs'
9
+
10
+ export const {
11
+ Authoring, S3Backend, Space, Writer, addressRoundTrip,
12
+ addressVariant, bytesToBase32, decodeCbor, encodeCbor, modalityParse,
13
+ multihashBase32, multihashHex, rangeHeader, spatialKeyRoundTrip, timeAnchorFromHex,
14
+ timeAnchorHex, timeBucket, version, zeroSpatialKey,
15
+ } = mod
16
+
17
+ /** Zero spatial-key path segment for non-spatial (fragment) object addresses. */
18
+ export const ZERO_SPATIAL_KEY = '0000000000000000'
19
+ export default mod
package/package.json CHANGED
@@ -1,23 +1,47 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamdb",
3
- "type": "module",
4
- "description": "WebAssembly binding of dreamdb-dataset the browser DreamDB SDK (@dreamlake/dreamdb)",
5
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
+ "description": "DreamDB SDKisomorphic (browser + Node) read and write, compiled from the Rust core",
6
5
  "license": "MIT OR Apache-2.0",
6
+ "type": "module",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "browser": "./browser.mjs",
12
+ "worker": "./browser.mjs",
13
+ "node": {
14
+ "import": "./node.mjs",
15
+ "require": "./node.cjs"
16
+ },
17
+ "import": "./browser.mjs",
18
+ "default": "./browser.mjs"
19
+ },
20
+ "./web": {
21
+ "types": "./index.d.ts",
22
+ "default": "./web.mjs"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "main": "./node.cjs",
27
+ "module": "./browser.mjs",
28
+ "browser": "./browser.mjs",
7
29
  "files": [
8
- "dreamdb_bg.wasm",
9
- "dreamdb.js",
10
- "dreamdb_bg.js",
11
- "dreamdb.d.ts",
12
- "index.js",
13
- "index.d.ts"
30
+ "browser/",
31
+ "web/",
32
+ "node/",
33
+ "browser.mjs",
34
+ "web.mjs",
35
+ "node.mjs",
36
+ "node.cjs",
37
+ "browser-extras.mjs",
38
+ "index.d.ts",
39
+ "README.md"
14
40
  ],
15
- "main": "index.js",
16
- "types": "index.d.ts",
17
41
  "sideEffects": [
18
- "./dreamdb.js",
19
- "./index.js",
20
- "./snippets/*"
21
- ],
22
- "module": "index.js"
42
+ "./browser/dreamdb.js",
43
+ "./web/dreamdb.js",
44
+ "./browser.mjs",
45
+ "./web.mjs"
46
+ ]
23
47
  }