@dreamlake/dreamdb 0.5.1 → 0.5.2
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/LICENSE-APACHE +20 -0
- package/LICENSE-MIT +21 -0
- package/README.md +18 -3
- package/browser/dreamdb.d.ts +89 -0
- package/browser/dreamdb.js +1 -1
- package/browser/dreamdb_bg.js +392 -2
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +13 -2
- package/browser-extras.mjs +82 -7
- package/browser.mjs +7 -0
- package/index.d.ts +212 -2
- package/node/dreamdb.cjs +504 -4
- package/node/dreamdb.d.cts +134 -0
- package/node/dreamdb_bg.wasm +0 -0
- package/node/dreamdb_bg.wasm.d.ts +15 -2
- package/node.mjs +1 -1
- package/package.json +4 -2
- package/web/dreamdb.d.ts +102 -2
- package/web/dreamdb.js +399 -2
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +13 -2
- package/web.mjs +5 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2026 DreamLake AI
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
The full text of the Apache License, Version 2.0 is available at the URL
|
|
20
|
+
above and is incorporated here by reference.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DreamLake AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -114,13 +114,21 @@ trained index as a layer, or build it with the CLI.
|
|
|
114
114
|
## Implementing a Backend
|
|
115
115
|
|
|
116
116
|
Only `get` is required; a `get`-only backend is the read-only v1 shape and
|
|
117
|
-
still works for reading.
|
|
118
|
-
|
|
117
|
+
still works for reading. Implement `getStream` to keep full-object reads bounded
|
|
118
|
+
when DreamDB must scan a historical oversized inline Track. Write entry points
|
|
119
|
+
check for `put` up front and refuse with a message naming what is missing.
|
|
119
120
|
|
|
120
121
|
```ts
|
|
121
122
|
interface Backend {
|
|
123
|
+
// `range` is half-open: start is included, end is excluded.
|
|
122
124
|
get(path: string, range?: { start: number; end: number })
|
|
123
|
-
: Promise<Uint8Array | { bytes: Uint8Array; etag?: string }>
|
|
125
|
+
: Promise<Uint8Array | { bytes: Uint8Array; etag?: string; totalLength?: number }>
|
|
126
|
+
getStream?(path: string)
|
|
127
|
+
: Promise<ReadableStream<Uint8Array> | {
|
|
128
|
+
stream: ReadableStream<Uint8Array>
|
|
129
|
+
etag?: string
|
|
130
|
+
totalLength?: number
|
|
131
|
+
}>
|
|
124
132
|
head?(path: string): Promise<{ exists?: boolean; etag?: string; size?: number }>
|
|
125
133
|
put?(path: string, bytes: Uint8Array,
|
|
126
134
|
opts?: { ifMatch?: string; ifNoneMatchStar?: boolean })
|
|
@@ -130,6 +138,13 @@ interface Backend {
|
|
|
130
138
|
}
|
|
131
139
|
```
|
|
132
140
|
|
|
141
|
+
`getStream` chunks must themselves be bounded; returning one object-sized
|
|
142
|
+
`Uint8Array` is functionally valid but does not provide the bounded-memory
|
|
143
|
+
profile. The SDK hashes every chunk and exposes no decoded result until the
|
|
144
|
+
complete response matches its content address. Existing backends without
|
|
145
|
+
`getStream` continue through `get` and are intentionally classified as the
|
|
146
|
+
unbounded compatibility profile.
|
|
147
|
+
|
|
133
148
|
### Two things that will bite you
|
|
134
149
|
|
|
135
150
|
**Your bucket's CORS rule must include `ExposeHeaders: ["ETag"]`.**
|
package/browser/dreamdb.d.ts
CHANGED
|
@@ -13,6 +13,15 @@ export class S3Backend {
|
|
|
13
13
|
* content is hash-addressed; refs are read fresh each page load anyway).
|
|
14
14
|
*/
|
|
15
15
|
get(path: string, _opts: any): Promise<Uint8Array>;
|
|
16
|
+
/**
|
|
17
|
+
* Stream `path` without first aggregating the response in wasm memory.
|
|
18
|
+
*
|
|
19
|
+
* Returning the length beside the browser stream satisfies the optional
|
|
20
|
+
* `Backend.getStream` contract. Older injected backends that implement
|
|
21
|
+
* only [`Self::get`] remain compatible, but cannot claim bounded memory
|
|
22
|
+
* for historical oversized inline Track reads.
|
|
23
|
+
*/
|
|
24
|
+
getStream(path: string): Promise<any>;
|
|
16
25
|
/**
|
|
17
26
|
* List object paths under `prefix`. Stub (returns empty); the current
|
|
18
27
|
* consumer read paths don't require listing.
|
|
@@ -28,6 +37,32 @@ export class Space {
|
|
|
28
37
|
private constructor();
|
|
29
38
|
free(): void;
|
|
30
39
|
[Symbol.dispose](): void;
|
|
40
|
+
/**
|
|
41
|
+
* The Space's human-readable description, or `undefined` when none is set.
|
|
42
|
+
*
|
|
43
|
+
* The read half of `Authoring.setDescription` (#129). It lives here rather
|
|
44
|
+
* than on `Authoring` because that type is `write-full` and so exists only
|
|
45
|
+
* in the Node build — a description is metadata a READER wants, and
|
|
46
|
+
* `Space` is the surface all three build targets share.
|
|
47
|
+
*
|
|
48
|
+
* `async` although `Dataset::description` is not: the value comes from the
|
|
49
|
+
* Dataset this Space opens lazily at the Manifest hash already pinned by
|
|
50
|
+
* this Space, so the first call may perform that open without re-resolving
|
|
51
|
+
* a source Ref.
|
|
52
|
+
*
|
|
53
|
+
* Deliberately routed through `Dataset::description` rather than read out
|
|
54
|
+
* of `self.manifest`'s registry, which would be shorter and would also
|
|
55
|
+
* serve the cached decoded Manifest. `Dataset::recover_meta` is not a prefix
|
|
56
|
+
* filter: it accepts the legacy `vortex.*` namespace as well as
|
|
57
|
+
* `dreamdb.*`, canonicalises, and drops structural keys. Matching
|
|
58
|
+
* `dreamdb.description` here would silently return nothing for a legacy
|
|
59
|
+
* Space whose description is on disk and readable from Rust — the exact
|
|
60
|
+
* defect `recover_meta`'s own comment records.
|
|
61
|
+
*
|
|
62
|
+
* `Option<String>` marshals to `string | undefined`, NOT to `""`. An unset
|
|
63
|
+
* description and an empty one stay distinguishable across the boundary.
|
|
64
|
+
*/
|
|
65
|
+
description(): Promise<string | undefined>;
|
|
31
66
|
/**
|
|
32
67
|
* Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
|
|
33
68
|
* resolving the ref (if any) and loading the manifest. If `backend` is
|
|
@@ -107,18 +142,55 @@ export class Space {
|
|
|
107
142
|
* two-pass rerank + HotShard merge + tombstone suppression.
|
|
108
143
|
*/
|
|
109
144
|
queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
|
|
145
|
+
/**
|
|
146
|
+
* Read an Event/Unbucketed or Continuous/TimeBatch typed-array field as
|
|
147
|
+
* `Map<anchorString, {values, shape, ...}>`.
|
|
148
|
+
*/
|
|
149
|
+
readArrayColumn(field: string): Promise<Map<any, any>>;
|
|
150
|
+
/**
|
|
151
|
+
* Read a typed-array Constant and decode it to a JS TypedArray plus its
|
|
152
|
+
* authoritative shape and semantic metadata.
|
|
153
|
+
*/
|
|
154
|
+
readArrayConstant(field: string): Promise<any>;
|
|
110
155
|
/**
|
|
111
156
|
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
112
157
|
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
113
158
|
* de-dupe) their bucket and roaring-decode the anchor set.
|
|
114
159
|
*/
|
|
115
160
|
readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
|
|
161
|
+
/**
|
|
162
|
+
* Fetch verified initialization and complete Fragments overlapping one
|
|
163
|
+
* item-relative half-open range. This materializes the selected bytes; it
|
|
164
|
+
* is not a streaming API.
|
|
165
|
+
*/
|
|
166
|
+
readVideoItemRange(field: string, item_key: Uint8Array, relative_start_ns: any, relative_end_ns: any): Promise<any>;
|
|
116
167
|
/**
|
|
117
168
|
* Fetch a track object and return its `object_index` (array of CBOR
|
|
118
169
|
* entries). Inline indexes only — paged indexes are not resolved (matching
|
|
119
170
|
* dreamdb-ts, which also doesn't support them on this path).
|
|
120
171
|
*/
|
|
121
172
|
resolveObjectIndex(track: any): Promise<Array<any>>;
|
|
173
|
+
/**
|
|
174
|
+
* Semantic-cache capacity in bytes (spec/0006 §3.6). Default 1 GiB.
|
|
175
|
+
*/
|
|
176
|
+
semanticCacheCapacity(): Promise<number>;
|
|
177
|
+
/**
|
|
178
|
+
* Semantic-cache occupancy as `{ entries, bytesUsed, maxBytes }`.
|
|
179
|
+
*/
|
|
180
|
+
semanticCacheStats(): Promise<object>;
|
|
181
|
+
/**
|
|
182
|
+
* Set the semantic-cache capacity in bytes, evicting down to it before
|
|
183
|
+
* returning. Returns the bytes evicted. `0` disables the cache.
|
|
184
|
+
*
|
|
185
|
+
* An index whose accounted size exceeds the cap is not cached and is
|
|
186
|
+
* re-fetched on every query, reported honestly as a miss. The default is
|
|
187
|
+
* not raised globally to suit one corpus.
|
|
188
|
+
*
|
|
189
|
+
* Sizing is workload- and architecture-dependent, and figures measured on
|
|
190
|
+
* a 64-bit host do NOT carry over here: `usize` is 32 bits on `wasm32`, so
|
|
191
|
+
* every offset and length inside a decoded index accounts differently.
|
|
192
|
+
*/
|
|
193
|
+
setSemanticCacheCapacity(n_bytes: number): Promise<number>;
|
|
122
194
|
/**
|
|
123
195
|
* Base32 hash of the manifest's first timeline.
|
|
124
196
|
*/
|
|
@@ -131,6 +203,16 @@ export class Space {
|
|
|
131
203
|
* List resolved tracks from this manifest.
|
|
132
204
|
*/
|
|
133
205
|
tracks(): Array<any>;
|
|
206
|
+
/**
|
|
207
|
+
* Look up the logical VideoItem containing one absolute Timeline anchor
|
|
208
|
+
* without fetching media. Exact nanosecond values are returned as bigint.
|
|
209
|
+
*/
|
|
210
|
+
videoItemAt(field: string, anchor_ns: any): Promise<any>;
|
|
211
|
+
/**
|
|
212
|
+
* Look up one logical VideoItem by its stable opaque key without fetching
|
|
213
|
+
* initialization or Fragment bytes.
|
|
214
|
+
*/
|
|
215
|
+
videoItemByKey(field: string, item_key: Uint8Array): Promise<any>;
|
|
134
216
|
/**
|
|
135
217
|
* The base URL objects are fetched relative to (consumers build their own
|
|
136
218
|
* object URLs from this — e.g. `dreamdb-demo`'s track readers).
|
|
@@ -314,6 +396,13 @@ export function timeAnchorHex(value: bigint): string;
|
|
|
314
396
|
*/
|
|
315
397
|
export function timeBucket(t_start: bigint, duration: string): bigint;
|
|
316
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Decode one spec/0025 item using the same declaration and payload path as
|
|
401
|
+
* `Space.readArrayColumn`, without requiring storage IO. This is the SDK's
|
|
402
|
+
* pure conformance entry point for language-neutral vectors.
|
|
403
|
+
*/
|
|
404
|
+
export function typedArrayDecode(item_type: any, payload: Uint8Array): any;
|
|
405
|
+
|
|
317
406
|
/**
|
|
318
407
|
* Package version — useful for consumers to confirm which build is loaded.
|
|
319
408
|
*/
|
package/browser/dreamdb.js
CHANGED
|
@@ -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, version, zeroSpatialKey
|
|
8
|
+
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";
|