@dreamlake/dreamdb 0.5.1 → 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/LICENSE-APACHE +20 -0
- package/LICENSE-MIT +21 -0
- package/README.md +24 -3
- package/browser/dreamdb.d.ts +185 -2
- package/browser/dreamdb.js +1 -1
- package/browser/dreamdb_bg.js +723 -5
- package/browser/dreamdb_bg.wasm +0 -0
- package/browser/dreamdb_bg.wasm.d.ts +35 -2
- package/browser-extras.mjs +82 -7
- package/browser.mjs +7 -0
- package/index.d.ts +328 -8
- package/node/dreamdb.cjs +858 -9
- package/node/dreamdb.d.cts +250 -6
- package/node/dreamdb_bg.wasm +0 -0
- package/node/dreamdb_bg.wasm.d.ts +42 -3
- package/node.mjs +5 -4
- package/package.json +4 -2
- package/web/dreamdb.d.ts +220 -4
- package/web/dreamdb.js +730 -5
- package/web/dreamdb_bg.wasm +0 -0
- package/web/dreamdb_bg.wasm.d.ts +35 -2
- package/web.mjs +5 -0
package/index.d.ts
CHANGED
|
@@ -23,6 +23,14 @@ export class Authoring {
|
|
|
23
23
|
private constructor();
|
|
24
24
|
free(): void;
|
|
25
25
|
[Symbol.dispose](): void;
|
|
26
|
+
/**
|
|
27
|
+
* Add one fixed-shape typed-array Constant.
|
|
28
|
+
*
|
|
29
|
+
* `field` is the same `{name, kind:'array', ...}` descriptor accepted by
|
|
30
|
+
* `create`, with `trackKind:'constant'` and `objectKind:'constant'`.
|
|
31
|
+
* `payload` is a raw or NPY payload matching that declaration.
|
|
32
|
+
*/
|
|
33
|
+
addArrayConstant(field: any, payload: Uint8Array): Promise<void>;
|
|
26
34
|
/**
|
|
27
35
|
* Add an embedding column whose index artifacts already exist.
|
|
28
36
|
*
|
|
@@ -38,7 +46,7 @@ export class Authoring {
|
|
|
38
46
|
* off, reads decode 1-bit reconstructions and relevance degrades in a way
|
|
39
47
|
* no API-level check can see.
|
|
40
48
|
*/
|
|
41
|
-
addEmbeddingLayer(name: string, parent_field: string, dim: number, algorithm: string, spatial_index: string, compressor: string, rerank: boolean, version: number | null | undefined, samples: Array<any
|
|
49
|
+
addEmbeddingLayer(name: string, parent_field: string, dim: number, algorithm: string, spatial_index: string, compressor: string, rerank: boolean, version: number | null | undefined, samples: Array<any>, bucket_max_bytes?: number | null, embed_spec?: Uint8Array | null): Promise<void>;
|
|
42
50
|
/**
|
|
43
51
|
* Add a field to the schema of an existing dataset.
|
|
44
52
|
*/
|
|
@@ -56,10 +64,20 @@ export class Authoring {
|
|
|
56
64
|
* `int|float|bool|string|categorical|timestamp`.
|
|
57
65
|
*/
|
|
58
66
|
addScalarLayer(name: string, parent_field: string, value_type: string, samples: Array<any>): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Append `[anchor, vector]` pairs, adopting a raw graph as Fresh Vamana.
|
|
69
|
+
*/
|
|
70
|
+
appendGraphNodes(field: string, samples: Array<any>): Promise<any>;
|
|
59
71
|
/**
|
|
60
72
|
* Fork the current manifest to a new ref name.
|
|
61
73
|
*/
|
|
62
74
|
branch(new_name: string): Promise<Authoring>;
|
|
75
|
+
/**
|
|
76
|
+
* Merge one or more branches into this ref. Returns the new manifest hash.
|
|
77
|
+
* Build a raw Vamana field. Samples are `[anchor, vector]` pairs; anchors
|
|
78
|
+
* use the same lossless representation as addEmbeddingLayer.
|
|
79
|
+
*/
|
|
80
|
+
buildGraphIndex(name: string, parent_field: string, dim: number, samples: Array<any>, r: number, seed: Uint8Array, embed_spec?: Uint8Array | null): Promise<void>;
|
|
63
81
|
/**
|
|
64
82
|
* Collapse per-cell fragments. Returns
|
|
65
83
|
* `{cellsExamined, cellsCompacted, fragmentsCollapsed, manifest?}`.
|
|
@@ -70,6 +88,15 @@ export class Authoring {
|
|
|
70
88
|
* nothing needed compacting — a no-op, not a failure.
|
|
71
89
|
*/
|
|
72
90
|
compact(modality: string | null | undefined, threshold: number, max_cells: number): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* Compress a raw graph with canonical VectorCompressor CBOR. The raw
|
|
93
|
+
* lineage is retained; rerank selects exact scoring of the candidate pool.
|
|
94
|
+
*/
|
|
95
|
+
compressGraphIndex(field: string, compressor: Uint8Array, rerank: boolean): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Caller-driven region consolidation; does not erase tombstones or ids.
|
|
98
|
+
*/
|
|
99
|
+
consolidateGraph(field: string): Promise<any>;
|
|
73
100
|
/**
|
|
74
101
|
* Create a new dataset and publish `refs/<name>`.
|
|
75
102
|
*
|
|
@@ -93,9 +120,6 @@ export class Authoring {
|
|
|
93
120
|
* Ref names under `refs/`. Requires a backend implementing `list`.
|
|
94
121
|
*/
|
|
95
122
|
listRefs(): Promise<string[]>;
|
|
96
|
-
/**
|
|
97
|
-
* Merge one or more branches into this ref. Returns the new manifest hash.
|
|
98
|
-
*/
|
|
99
123
|
mergeMany(branches: string[]): Promise<string>;
|
|
100
124
|
/**
|
|
101
125
|
* Open an existing ref for authoring.
|
|
@@ -115,6 +139,22 @@ export class Authoring {
|
|
|
115
139
|
readonly refName: string;
|
|
116
140
|
}
|
|
117
141
|
|
|
142
|
+
export class GeometryReader {
|
|
143
|
+
private constructor();
|
|
144
|
+
free(): void;
|
|
145
|
+
[Symbol.dispose](): void;
|
|
146
|
+
/**
|
|
147
|
+
* Returns only the new suffix at this total logical byte budget.
|
|
148
|
+
*/
|
|
149
|
+
extendCellPrefix(key: any, budget: any): Promise<Uint8Array>;
|
|
150
|
+
/**
|
|
151
|
+
* Declaration plus cells/LODs; no payload transfer. u64 values are BigInt.
|
|
152
|
+
*/
|
|
153
|
+
metadata(): any;
|
|
154
|
+
readMeshLod(level: any): Promise<Uint8Array>;
|
|
155
|
+
selectCells(min: any, max: any): Array<any>;
|
|
156
|
+
}
|
|
157
|
+
|
|
118
158
|
/**
|
|
119
159
|
* A `fetch`-backed backend rooted at a base URL.
|
|
120
160
|
*/
|
|
@@ -127,6 +167,15 @@ export class S3Backend {
|
|
|
127
167
|
* content is hash-addressed; refs are read fresh each page load anyway).
|
|
128
168
|
*/
|
|
129
169
|
get(path: string, _opts: any): Promise<Uint8Array>;
|
|
170
|
+
/**
|
|
171
|
+
* Stream `path` without first aggregating the response in wasm memory.
|
|
172
|
+
*
|
|
173
|
+
* Returning the length beside the browser stream satisfies the optional
|
|
174
|
+
* `Backend.getStream` contract. Older injected backends that implement
|
|
175
|
+
* only [`Self::get`] remain compatible, but cannot claim bounded memory
|
|
176
|
+
* for historical oversized inline Track reads.
|
|
177
|
+
*/
|
|
178
|
+
getStream(path: string): Promise<any>;
|
|
130
179
|
/**
|
|
131
180
|
* List object paths under `prefix`. Stub (returns empty); the current
|
|
132
181
|
* consumer read paths don't require listing.
|
|
@@ -142,6 +191,41 @@ export class Space {
|
|
|
142
191
|
private constructor();
|
|
143
192
|
free(): void;
|
|
144
193
|
[Symbol.dispose](): void;
|
|
194
|
+
/**
|
|
195
|
+
* Validate all referenced Items, including tombstoned payloads.
|
|
196
|
+
*/
|
|
197
|
+
auditArrayField(field: string): Promise<bigint>;
|
|
198
|
+
/**
|
|
199
|
+
* Validate all graph pages and, when declared, exact-source correspondence.
|
|
200
|
+
* The returned count is exactly representable (GraphIndex node_count is u32).
|
|
201
|
+
*/
|
|
202
|
+
auditGraphIndex(field: string): Promise<number>;
|
|
203
|
+
/**
|
|
204
|
+
* The Space's human-readable description, or `undefined` when none is set.
|
|
205
|
+
*
|
|
206
|
+
* The read half of `Authoring.setDescription` (#129). It lives here rather
|
|
207
|
+
* than on `Authoring` because that type is `write-full` and so exists only
|
|
208
|
+
* in the Node build — a description is metadata a READER wants, and
|
|
209
|
+
* `Space` is the surface all three build targets share.
|
|
210
|
+
*
|
|
211
|
+
* `async` although `Dataset::description` is not: the value comes from the
|
|
212
|
+
* Dataset this Space opens lazily at the Manifest hash already pinned by
|
|
213
|
+
* this Space, so the first call may perform that open without re-resolving
|
|
214
|
+
* a source Ref.
|
|
215
|
+
*
|
|
216
|
+
* Deliberately routed through `Dataset::description` rather than read out
|
|
217
|
+
* of `self.manifest`'s registry, which would be shorter and would also
|
|
218
|
+
* serve the cached decoded Manifest. `Dataset::recover_meta` is not a prefix
|
|
219
|
+
* filter: it accepts the legacy `vortex.*` namespace as well as
|
|
220
|
+
* `dreamdb.*`, canonicalises, and drops structural keys. Matching
|
|
221
|
+
* `dreamdb.description` here would silently return nothing for a legacy
|
|
222
|
+
* Space whose description is on disk and readable from Rust — the exact
|
|
223
|
+
* defect `recover_meta`'s own comment records.
|
|
224
|
+
*
|
|
225
|
+
* `Option<String>` marshals to `string | undefined`, NOT to `""`. An unset
|
|
226
|
+
* description and an empty one stay distinguishable across the boundary.
|
|
227
|
+
*/
|
|
228
|
+
description(): Promise<string | undefined>;
|
|
145
229
|
/**
|
|
146
230
|
* Open a Space from a `.../refs/<name>` or `.../manifests/<hash>` URI,
|
|
147
231
|
* resolving the ref (if any) and loading the manifest. If `backend` is
|
|
@@ -150,11 +234,21 @@ export class Space {
|
|
|
150
234
|
* no-backend path).
|
|
151
235
|
*/
|
|
152
236
|
static fromUri(uri: string, backend: any): Promise<Space>;
|
|
237
|
+
/**
|
|
238
|
+
* Read at this pinned Manifest. Returns null for never-created keys;
|
|
239
|
+
* deleted keys retain metadata with sample=null. Integer keys and anchors
|
|
240
|
+
* are BigInt; sample values use the Writer's tagged field shapes.
|
|
241
|
+
*/
|
|
242
|
+
getEntity(key: any): Promise<any>;
|
|
153
243
|
/**
|
|
154
244
|
* Walk the manifest DAG from HEAD, up to `max_depth` entries. Each entry:
|
|
155
245
|
* `{ manifestHash, ts, writer, tracks: [{modality, address}] }`.
|
|
156
246
|
*/
|
|
157
247
|
history(max_depth?: number | null): Promise<Array<any>>;
|
|
248
|
+
/**
|
|
249
|
+
* Open one pinned geometry Item. Missing/deleted anchors return undefined.
|
|
250
|
+
*/
|
|
251
|
+
openGeometryItem(field: string, anchor: any): Promise<GeometryReader | undefined>;
|
|
158
252
|
/**
|
|
159
253
|
* Hybrid search fusing a lexical (BM25) sub-query and a dense (vector)
|
|
160
254
|
* sub-query per spec/0015 §5/§6. Returns the fused `[{ anchor, score }]`
|
|
@@ -177,10 +271,17 @@ export class Space {
|
|
|
177
271
|
* ```
|
|
178
272
|
*
|
|
179
273
|
* Delegates to the real (tested) `dreamdb-dataset::Dataset::query_hybrid`.
|
|
180
|
-
*
|
|
181
|
-
* scalar
|
|
274
|
+
* Optional `scalarField` / `scalarOp` / `scalarValue` properties select
|
|
275
|
+
* the same scalar pre/post-filter planner used by the native API.
|
|
182
276
|
*/
|
|
183
277
|
queryHybrid(vector: Float32Array, opts: any): Promise<Array<any>>;
|
|
278
|
+
/**
|
|
279
|
+
* Hybrid query with an observable `{hits, trace}` result. `opts` accepts
|
|
280
|
+
* `maxLatencyMs`, `costModel`, and the optional scalar triple
|
|
281
|
+
* `scalarField`/`scalarOp`/`scalarValue` in addition to `queryHybrid`'s
|
|
282
|
+
* existing properties.
|
|
283
|
+
*/
|
|
284
|
+
queryHybridPlanned(vector: Float32Array, opts: any): Promise<any>;
|
|
184
285
|
/**
|
|
185
286
|
* Scalar-index lookup: every anchor whose `field` satisfies `op value`
|
|
186
287
|
* (spec/0011). Returns a `BigUint64Array`-style `Array` of anchors,
|
|
@@ -221,18 +322,60 @@ export class Space {
|
|
|
221
322
|
* two-pass rerank + HotShard merge + tombstone suppression.
|
|
222
323
|
*/
|
|
223
324
|
queryVector(field: string, query: Float32Array, opts: any): Promise<Array<any>>;
|
|
325
|
+
/**
|
|
326
|
+
* Read an Event/Unbucketed or Continuous/TimeBatch typed-array field as
|
|
327
|
+
* `Map<anchorString, {values, shape, ...}>`.
|
|
328
|
+
*/
|
|
329
|
+
readArrayColumn(field: string): Promise<Map<any, any>>;
|
|
330
|
+
/**
|
|
331
|
+
* Read a typed-array Constant and decode it to a JS TypedArray plus its
|
|
332
|
+
* authoritative shape and semantic metadata.
|
|
333
|
+
*/
|
|
334
|
+
readArrayConstant(field: string): Promise<any>;
|
|
335
|
+
/**
|
|
336
|
+
* Point read; full-u64 BigInt anchors are supported. Returned components
|
|
337
|
+
* are owned typed arrays (one Item's bytes), never unaligned aliases.
|
|
338
|
+
*/
|
|
339
|
+
readArrayItem(field: string, anchor: any): Promise<any>;
|
|
224
340
|
/**
|
|
225
341
|
* Read a scalar track as a `Map<anchorString, value>`. Single-anchor
|
|
226
342
|
* entries resolve from the track index; multi-anchor entries fetch (and
|
|
227
343
|
* de-dupe) their bucket and roaring-decode the anchor set.
|
|
228
344
|
*/
|
|
229
345
|
readScalarColumn(track: any, _opts: any): Promise<Map<any, any>>;
|
|
346
|
+
/**
|
|
347
|
+
* Fetch verified initialization and complete Fragments overlapping one
|
|
348
|
+
* item-relative half-open range. This materializes the selected bytes; it
|
|
349
|
+
* is not a streaming API.
|
|
350
|
+
*/
|
|
351
|
+
readVideoItemRange(field: string, itemKey: Uint8Array, relativeStartNs: bigint | number, relativeEndNs: bigint | number): Promise<VideoItemRead | undefined>;
|
|
230
352
|
/**
|
|
231
353
|
* Fetch a track object and return its `object_index` (array of CBOR
|
|
232
354
|
* entries). Inline indexes only — paged indexes are not resolved (matching
|
|
233
355
|
* dreamdb-ts, which also doesn't support them on this path).
|
|
234
356
|
*/
|
|
235
357
|
resolveObjectIndex(track: any): Promise<Array<any>>;
|
|
358
|
+
/**
|
|
359
|
+
* Semantic-cache capacity in bytes (spec/0006 §3.6). Default 1 GiB.
|
|
360
|
+
*/
|
|
361
|
+
semanticCacheCapacity(): Promise<number>;
|
|
362
|
+
/**
|
|
363
|
+
* Semantic-cache occupancy as `{ entries, bytesUsed, maxBytes }`.
|
|
364
|
+
*/
|
|
365
|
+
semanticCacheStats(): Promise<object>;
|
|
366
|
+
/**
|
|
367
|
+
* Set the semantic-cache capacity in bytes, evicting down to it before
|
|
368
|
+
* returning. Returns the bytes evicted. `0` disables the cache.
|
|
369
|
+
*
|
|
370
|
+
* An index whose accounted size exceeds the cap is not cached and is
|
|
371
|
+
* re-fetched on every query, reported honestly as a miss. The default is
|
|
372
|
+
* not raised globally to suit one corpus.
|
|
373
|
+
*
|
|
374
|
+
* Sizing is workload- and architecture-dependent, and figures measured on
|
|
375
|
+
* a 64-bit host do NOT carry over here: `usize` is 32 bits on `wasm32`, so
|
|
376
|
+
* every offset and length inside a decoded index accounts differently.
|
|
377
|
+
*/
|
|
378
|
+
setSemanticCacheCapacity(n_bytes: number): Promise<number>;
|
|
236
379
|
/**
|
|
237
380
|
* Base32 hash of the manifest's first timeline.
|
|
238
381
|
*/
|
|
@@ -245,6 +388,16 @@ export class Space {
|
|
|
245
388
|
* List resolved tracks from this manifest.
|
|
246
389
|
*/
|
|
247
390
|
tracks(): Array<any>;
|
|
391
|
+
/**
|
|
392
|
+
* Look up the logical VideoItem containing one absolute Timeline anchor
|
|
393
|
+
* without fetching media. Exact nanosecond values are returned as bigint.
|
|
394
|
+
*/
|
|
395
|
+
videoItemAt(field: string, anchorNs: bigint | number): Promise<VideoItemInfo | undefined>;
|
|
396
|
+
/**
|
|
397
|
+
* Look up one logical VideoItem by its stable opaque key without fetching
|
|
398
|
+
* initialization or Fragment bytes.
|
|
399
|
+
*/
|
|
400
|
+
videoItemByKey(field: string, itemKey: Uint8Array): Promise<VideoItemInfo | undefined>;
|
|
248
401
|
/**
|
|
249
402
|
* The base URL objects are fetched relative to (consumers build their own
|
|
250
403
|
* object URLs from this — e.g. `dreamdb-demo`'s track readers).
|
|
@@ -263,6 +416,11 @@ export class Writer {
|
|
|
263
416
|
private constructor();
|
|
264
417
|
free(): void;
|
|
265
418
|
[Symbol.dispose](): void;
|
|
419
|
+
/**
|
|
420
|
+
* Atomically hot-append a complete Sample batch. Embeddings retain v1;
|
|
421
|
+
* scalar/text values use v2. Identified embeddings require embeddingSpecs.
|
|
422
|
+
*/
|
|
423
|
+
appendHot(samples: Array<any>, embedding_specs?: object | null): Promise<number>;
|
|
266
424
|
/**
|
|
267
425
|
* Append records and commit in one call.
|
|
268
426
|
*
|
|
@@ -276,6 +434,11 @@ export class Writer {
|
|
|
276
434
|
* lifetime is under the caller's control.
|
|
277
435
|
*/
|
|
278
436
|
appendMany(samples: Array<any>): Promise<number>;
|
|
437
|
+
/**
|
|
438
|
+
* Append records with a field-to-`spec_id` map for identified embeddings.
|
|
439
|
+
* Values are full canonical base32 multihashes.
|
|
440
|
+
*/
|
|
441
|
+
appendManyWithSpecs(samples: Array<any>, embedding_specs: object): Promise<number>;
|
|
279
442
|
/**
|
|
280
443
|
* Flush staged entries and publish a new manifest.
|
|
281
444
|
*
|
|
@@ -285,10 +448,74 @@ export class Writer {
|
|
|
285
448
|
* its records on top of the new head is correct.
|
|
286
449
|
*/
|
|
287
450
|
commit(): Promise<string>;
|
|
451
|
+
/**
|
|
452
|
+
* Producer policy only: TTL is evaluated on append, not by a timer.
|
|
453
|
+
*/
|
|
454
|
+
configureHotShard(flush_threshold: number, ttl_seconds: number): void;
|
|
455
|
+
/**
|
|
456
|
+
* Create a never-used key. Sample uses appendMany's tagged fields, no anchor.
|
|
457
|
+
*/
|
|
458
|
+
createEntity(key: any, sample: object, embedding_specs?: object | null): Promise<object>;
|
|
459
|
+
/**
|
|
460
|
+
* Delete exactly a live revision, retaining its key and stable identity.
|
|
461
|
+
*/
|
|
462
|
+
deleteEntity(key: any, expected: Uint8Array): Promise<object>;
|
|
288
463
|
/**
|
|
289
464
|
* Tombstone records by anchor. Returns the new manifest hash.
|
|
290
465
|
*/
|
|
291
466
|
deleteRecords(anchors: BigUint64Array, reason?: string | null): Promise<string>;
|
|
467
|
+
/**
|
|
468
|
+
* Enable one exact typed entity namespace: string, bytes or int.
|
|
469
|
+
*/
|
|
470
|
+
enableEntityKeys(key_kind: string): Promise<void>;
|
|
471
|
+
/**
|
|
472
|
+
* Explicitly fold every pending hot field into cold Tracks in one publish.
|
|
473
|
+
*/
|
|
474
|
+
flushHot(): Promise<void>;
|
|
475
|
+
/**
|
|
476
|
+
* Ingest a pre-fragmented CMAF (fragmented-MP4) video into a Video field
|
|
477
|
+
* as a `spec/0007` §5 media Track — the thing that makes a video Track
|
|
478
|
+
* time-seekable and MSE-playable rather than one opaque blob.
|
|
479
|
+
*
|
|
480
|
+
* ```js
|
|
481
|
+
* const out = await writer.ingestCmaf('video', initBytes, [
|
|
482
|
+
* [frag0, 0n, 2_000_000_000n],
|
|
483
|
+
* [frag1, 2_000_000_000n, 4_000_000_000n],
|
|
484
|
+
* ])
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* - `init` is the initialization segment (`ftyp`+`moov`).
|
|
488
|
+
* - each fragment is `[Uint8Array, tStartNs, tEndNs]`, half-open, already
|
|
489
|
+
* offset to the timeline anchor the caller wants. Pass `bigint`s:
|
|
490
|
+
* wall-clock nanosecond anchors are far past `Number.MAX_SAFE_INTEGER`
|
|
491
|
+
* and a rounded `tStart` writes the fragment into a 60 s bucket that
|
|
492
|
+
* does not match the address it is indexed at.
|
|
493
|
+
*
|
|
494
|
+
* Calling it again on the SAME field APPENDS (one episode per call on a
|
|
495
|
+
* shared timeline) and reuses the track's existing init segment; a clip
|
|
496
|
+
* whose init differs — different codec, resolution, fps or audio config —
|
|
497
|
+
* is refused, because a Track carries exactly one init segment and the
|
|
498
|
+
* mismatch would produce fragments that decode against the wrong one.
|
|
499
|
+
*
|
|
500
|
+
* Returns `{field, modality, initHash, fragmentCount, coverage: [bigint,
|
|
501
|
+
* bigint], trackHash, manifestHash}`. `coverage` is `bigint` for the
|
|
502
|
+
* reason above; `fragmentCount` is the track's total after the append,
|
|
503
|
+
* not the number passed in.
|
|
504
|
+
*
|
|
505
|
+
* **Node only** (`write-full`). This takes every fragment's bytes as an
|
|
506
|
+
* argument, so peak memory is the whole clip; the native path form streams
|
|
507
|
+
* fragment-by-fragment off disk, which wasm32 cannot do because it has no
|
|
508
|
+
* filesystem. Fragmenting a multi-GB source inside a browser tab's 32-bit
|
|
509
|
+
* address space is not a workflow worth pretending to support.
|
|
510
|
+
*/
|
|
511
|
+
/**
|
|
512
|
+
* **Node only.** Gated behind the `write-full` feature, which the browser
|
|
513
|
+
* and web builds are not compiled with: CMAF ingest takes the whole clip as
|
|
514
|
+
* one argument, so peak memory is the entire source. Calling it in a browser
|
|
515
|
+
* throws with an explanation — see the stub in browser-extras.mjs. Typed on
|
|
516
|
+
* both ends, like `Authoring`, so shared code type-checks once.
|
|
517
|
+
*/
|
|
518
|
+
ingestCmaf(field: string, init: Uint8Array, fragments: CmafFragment[]): Promise<CmafIngestResult>;
|
|
292
519
|
/**
|
|
293
520
|
* Open a ref for writing.
|
|
294
521
|
*
|
|
@@ -303,10 +530,27 @@ export class Writer {
|
|
|
303
530
|
* until it calls it.
|
|
304
531
|
*/
|
|
305
532
|
static open(uri: string, backend: any): Promise<Writer>;
|
|
533
|
+
/**
|
|
534
|
+
* Publish prequantized fixed-stride records. Coordinates is
|
|
535
|
+
* {origin:[x,y,z],step:[x,y,z],units:string}; depth is 0..16.
|
|
536
|
+
*/
|
|
537
|
+
publishGeometryCells(field: string, anchor: any, coordinates: any, depth: any, records: Uint8Array): Promise<string>;
|
|
538
|
+
/**
|
|
539
|
+
* Each level is {errorGrid,vertices,triangles,bytes:Uint8Array}.
|
|
540
|
+
*/
|
|
541
|
+
publishGeometryMesh(field: string, anchor: any, coordinates: any, levels: Array<any>): Promise<string>;
|
|
306
542
|
/**
|
|
307
543
|
* Tag the current manifest with an immutable label (`refs/<ref>@<label>`).
|
|
308
544
|
*/
|
|
309
545
|
snapshot(label: string): Promise<string>;
|
|
546
|
+
/**
|
|
547
|
+
* Replace only a live revision, atomically hiding its old physical row.
|
|
548
|
+
*/
|
|
549
|
+
supersedeEntity(key: any, sample: object, expected: Uint8Array, embedding_specs?: object | null): Promise<object>;
|
|
550
|
+
/**
|
|
551
|
+
* Create with no expected token, or replace/restore exactly that revision.
|
|
552
|
+
*/
|
|
553
|
+
upsertEntity(key: any, sample: object, expected?: Uint8Array | null, embedding_specs?: object | null): Promise<object>;
|
|
310
554
|
/**
|
|
311
555
|
* Current manifest hash, base32.
|
|
312
556
|
*/
|
|
@@ -428,6 +672,13 @@ export function timeAnchorHex(value: bigint): string;
|
|
|
428
672
|
*/
|
|
429
673
|
export function timeBucket(t_start: bigint, duration: string): bigint;
|
|
430
674
|
|
|
675
|
+
/**
|
|
676
|
+
* Decode one spec/0025 item using the same declaration and payload path as
|
|
677
|
+
* `Space.readArrayColumn`, without requiring storage IO. This is the SDK's
|
|
678
|
+
* pure conformance entry point for language-neutral vectors.
|
|
679
|
+
*/
|
|
680
|
+
export function typedArrayDecode(item_type: any, payload: Uint8Array): any;
|
|
681
|
+
|
|
431
682
|
/**
|
|
432
683
|
* Package version — useful for consumers to confirm which build is loaded.
|
|
433
684
|
*/
|
|
@@ -444,6 +695,62 @@ export function zeroSpatialKey(): string;
|
|
|
444
695
|
/** Zero spatial-key path segment for non-spatial (fragment) object addresses. */
|
|
445
696
|
export const ZERO_SPATIAL_KEY: string
|
|
446
697
|
|
|
698
|
+
/**
|
|
699
|
+
* One CMAF fragment for {@link Writer.ingestCmaf}: `[bytes, tStartNs, tEndNs)`,
|
|
700
|
+
* half-open, already offset to the timeline anchor you want.
|
|
701
|
+
*
|
|
702
|
+
* Pass `bigint`s. A `number` is accepted only while it is an exact
|
|
703
|
+
* non-negative integer at or below `Number.MAX_SAFE_INTEGER` and is rejected
|
|
704
|
+
* above it rather than rounded — wall-clock nanosecond anchors are ~1.7e18, and
|
|
705
|
+
* a rounded `tStart` files the fragment under a different 60 s bucket than the
|
|
706
|
+
* address it is indexed at.
|
|
707
|
+
*/
|
|
708
|
+
export type CmafFragment = [bytes: Uint8Array, tStartNs: bigint | number, tEndNs: bigint | number]
|
|
709
|
+
|
|
710
|
+
/** What {@link Writer.ingestCmaf} resolves to. */
|
|
711
|
+
export interface CmafIngestResult {
|
|
712
|
+
/** Schema field this Track materializes. */
|
|
713
|
+
field: string
|
|
714
|
+
/** Modality string, e.g. `video.h264`. */
|
|
715
|
+
modality: string
|
|
716
|
+
/** Base32 multihash of the initialization-segment object. */
|
|
717
|
+
initHash: string
|
|
718
|
+
/** Fragments in the Track *after* this call — not the number passed in. */
|
|
719
|
+
fragmentCount: number
|
|
720
|
+
/** Half-open `[tMin, tMax)` coverage of the whole Track, in ns. */
|
|
721
|
+
coverage: [bigint, bigint]
|
|
722
|
+
/** Base32 multihash of the new Track object. */
|
|
723
|
+
trackHash: string
|
|
724
|
+
/** Base32 multihash of the manifest this ingest published. */
|
|
725
|
+
manifestHash: string
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/** Stable metadata for one logical VideoItem. All times are exact bigint ns. */
|
|
729
|
+
export interface VideoItemInfo {
|
|
730
|
+
modality: string
|
|
731
|
+
itemKey: Uint8Array
|
|
732
|
+
tStartNs: bigint
|
|
733
|
+
durationNs: bigint
|
|
734
|
+
itemAddress: string
|
|
735
|
+
initAddress: string
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/** One complete Fragment selected by {@link Space.readVideoItemRange}. */
|
|
739
|
+
export interface VideoItemFragmentRead {
|
|
740
|
+
tStartNs: bigint
|
|
741
|
+
tEndNs: bigint
|
|
742
|
+
bytes: Uint8Array
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/** Materialized initialization plus complete Fragments for one relative range. */
|
|
746
|
+
export interface VideoItemRead {
|
|
747
|
+
item: VideoItemInfo
|
|
748
|
+
rangeStartNs: bigint
|
|
749
|
+
rangeEndNs: bigint
|
|
750
|
+
init: Uint8Array
|
|
751
|
+
fragments: VideoItemFragmentRead[]
|
|
752
|
+
}
|
|
753
|
+
|
|
447
754
|
/** A resolved manifest track (shape returned by `Space.tracks()`). */
|
|
448
755
|
export interface ResolvedTrack {
|
|
449
756
|
modality: string
|
|
@@ -475,11 +782,24 @@ export type PutStatus = 'created' | 'exists' | 'casFailed'
|
|
|
475
782
|
* CORS rule; without it the browser cannot read the header at all.
|
|
476
783
|
*/
|
|
477
784
|
export interface Backend {
|
|
478
|
-
/**
|
|
785
|
+
/** Half-open byte range `[start, end)`. Returning a bare Uint8Array is the accepted whole-object v1 shape. */
|
|
479
786
|
get(
|
|
480
787
|
path: string,
|
|
481
788
|
range?: { start: number; end: number },
|
|
482
|
-
): Promise<Uint8Array | { bytes: Uint8Array; etag?: string }>
|
|
789
|
+
): Promise<Uint8Array | { bytes: Uint8Array; etag?: string; totalLength?: number }>
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Optional bounded full-object stream. Without this method reads remain
|
|
793
|
+
* functional, but oversized historical inline Tracks use the unbounded v1
|
|
794
|
+
* compatibility path.
|
|
795
|
+
*/
|
|
796
|
+
getStream?(
|
|
797
|
+
path: string,
|
|
798
|
+
): Promise<ReadableStream<Uint8Array> | {
|
|
799
|
+
stream: ReadableStream<Uint8Array>
|
|
800
|
+
etag?: string
|
|
801
|
+
totalLength?: number
|
|
802
|
+
}>
|
|
483
803
|
|
|
484
804
|
head?(path: string): Promise<{ exists?: boolean; etag?: string; size?: number }>
|
|
485
805
|
|