@dreamlake/dreamdb 0.1.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/dist/index.cjs +2271 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +498 -0
- package/dist/index.d.ts +498 -0
- package/dist/index.js +2215 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/** 33-byte multihash, represented as Uint8Array on the wire. */
|
|
2
|
+
type MultihashBytes = Uint8Array;
|
|
3
|
+
/** Base32-encoded string form of a multihash. */
|
|
4
|
+
type Base32Hash = string;
|
|
5
|
+
/** Nanoseconds since UNIX epoch — the join key across all modalities. */
|
|
6
|
+
type TimeAnchor = number;
|
|
7
|
+
type FieldKind = "image" | "audio" | "video" | "embedding" | "scalar";
|
|
8
|
+
type ScalarValueType = "categorical" | "bool" | "int" | "float" | "string" | "timestamp";
|
|
9
|
+
interface ImageFieldDef {
|
|
10
|
+
kind: "image";
|
|
11
|
+
name: string;
|
|
12
|
+
mime: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
chunkSize?: number;
|
|
15
|
+
packItems?: number;
|
|
16
|
+
}
|
|
17
|
+
interface AudioFieldDef {
|
|
18
|
+
kind: "audio";
|
|
19
|
+
name: string;
|
|
20
|
+
mime: string;
|
|
21
|
+
required: boolean;
|
|
22
|
+
chunkSize?: number;
|
|
23
|
+
packItems?: number;
|
|
24
|
+
}
|
|
25
|
+
interface VideoFieldDef {
|
|
26
|
+
kind: "video";
|
|
27
|
+
name: string;
|
|
28
|
+
mime: string;
|
|
29
|
+
required: boolean;
|
|
30
|
+
chunkSize?: number;
|
|
31
|
+
packItems?: number;
|
|
32
|
+
}
|
|
33
|
+
interface EmbeddingFieldDef {
|
|
34
|
+
kind: "embedding";
|
|
35
|
+
name: string;
|
|
36
|
+
dim: number;
|
|
37
|
+
algorithm: string;
|
|
38
|
+
required: boolean;
|
|
39
|
+
lshBits?: number;
|
|
40
|
+
compressor?: MultihashBytes;
|
|
41
|
+
spatialIndex?: MultihashBytes;
|
|
42
|
+
rerank: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface ScalarFieldDef {
|
|
45
|
+
kind: "scalar";
|
|
46
|
+
name: string;
|
|
47
|
+
valueType: ScalarValueType;
|
|
48
|
+
required: boolean;
|
|
49
|
+
}
|
|
50
|
+
type FieldDef = ImageFieldDef | AudioFieldDef | VideoFieldDef | EmbeddingFieldDef | ScalarFieldDef;
|
|
51
|
+
interface ManifestTrack {
|
|
52
|
+
modality: string;
|
|
53
|
+
kind: string;
|
|
54
|
+
role: string;
|
|
55
|
+
address: MultihashBytes;
|
|
56
|
+
timeline: MultihashBytes;
|
|
57
|
+
coverage: unknown;
|
|
58
|
+
}
|
|
59
|
+
interface Manifest {
|
|
60
|
+
timelines: MultihashBytes[];
|
|
61
|
+
tracks: ManifestTrack[];
|
|
62
|
+
parents?: MultihashBytes[];
|
|
63
|
+
ts?: number | bigint;
|
|
64
|
+
writer?: string;
|
|
65
|
+
registry?: Record<string, RegistryEntry>;
|
|
66
|
+
}
|
|
67
|
+
interface RegistryEntry {
|
|
68
|
+
spatial_index?: MultihashBytes[];
|
|
69
|
+
spatial_index_hashes?: MultihashBytes[];
|
|
70
|
+
vector_compressor?: MultihashBytes;
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
interface ResolvedTrack {
|
|
74
|
+
modality: string;
|
|
75
|
+
field: string | null;
|
|
76
|
+
key: string;
|
|
77
|
+
kind: string;
|
|
78
|
+
role: string;
|
|
79
|
+
address: Base32Hash;
|
|
80
|
+
timeline: Base32Hash;
|
|
81
|
+
coverage: unknown;
|
|
82
|
+
}
|
|
83
|
+
interface VectorQueryOptions {
|
|
84
|
+
topK?: number;
|
|
85
|
+
probeCount?: number;
|
|
86
|
+
maxHamming?: number;
|
|
87
|
+
}
|
|
88
|
+
interface VectorQueryResult {
|
|
89
|
+
anchor: TimeAnchor;
|
|
90
|
+
score: number;
|
|
91
|
+
}
|
|
92
|
+
interface QueryStats {
|
|
93
|
+
bucketsTotal: number;
|
|
94
|
+
bucketsProbed: number;
|
|
95
|
+
fellBackToBruteForce: boolean;
|
|
96
|
+
candidatesScored?: number;
|
|
97
|
+
topT?: number;
|
|
98
|
+
rerankFetchCount?: number;
|
|
99
|
+
rerankSkippedNoHash?: number;
|
|
100
|
+
}
|
|
101
|
+
interface HistoryEntry {
|
|
102
|
+
manifestHash: Base32Hash;
|
|
103
|
+
ts: number;
|
|
104
|
+
writer: string;
|
|
105
|
+
tracks: Array<{
|
|
106
|
+
modality: string;
|
|
107
|
+
address: Base32Hash;
|
|
108
|
+
}>;
|
|
109
|
+
parents: number;
|
|
110
|
+
truncatedAt?: string;
|
|
111
|
+
}
|
|
112
|
+
interface Batch {
|
|
113
|
+
[fieldName: string]: unknown[];
|
|
114
|
+
_time_anchors: TimeAnchor[];
|
|
115
|
+
}
|
|
116
|
+
interface BackendGetOptions {
|
|
117
|
+
noCache?: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface BackendPutOptions {
|
|
120
|
+
contentType?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Abstract storage backend. All connector implementations must fulfill
|
|
124
|
+
* this interface. GET is required; PUT is needed only for write paths.
|
|
125
|
+
*/
|
|
126
|
+
interface Backend {
|
|
127
|
+
/** Fetch bytes at `path` relative to the backend root. */
|
|
128
|
+
get(path: string, opts?: BackendGetOptions): Promise<Uint8Array>;
|
|
129
|
+
/** Store bytes at `path`. Returns the path written. */
|
|
130
|
+
put(path: string, data: Uint8Array, opts?: BackendPutOptions): Promise<string>;
|
|
131
|
+
/** List keys under `prefix`. */
|
|
132
|
+
list(prefix: string): Promise<string[]>;
|
|
133
|
+
/** Delete a key. */
|
|
134
|
+
delete(path: string): Promise<void>;
|
|
135
|
+
}
|
|
136
|
+
type SampleValue = Uint8Array | number[] | Float32Array | string | number | boolean | null;
|
|
137
|
+
type Sample = {
|
|
138
|
+
[fieldName: string]: SampleValue;
|
|
139
|
+
};
|
|
140
|
+
interface DatasetInfo {
|
|
141
|
+
refName: string;
|
|
142
|
+
manifest: Base32Hash;
|
|
143
|
+
timeline: Base32Hash;
|
|
144
|
+
}
|
|
145
|
+
interface SnapshotInfo {
|
|
146
|
+
label: string;
|
|
147
|
+
manifest: Base32Hash;
|
|
148
|
+
timeline: Base32Hash;
|
|
149
|
+
}
|
|
150
|
+
type WhereClause = Record<string, string | number | boolean>;
|
|
151
|
+
interface SpatialDispatcher {
|
|
152
|
+
algorithm: string;
|
|
153
|
+
dim: number;
|
|
154
|
+
bits: number;
|
|
155
|
+
k?: number;
|
|
156
|
+
probeKeys(qNorm: Float32Array, probeCount: number, maxHamming: number): string[];
|
|
157
|
+
}
|
|
158
|
+
interface VectorCompressorDecoder {
|
|
159
|
+
algorithm: string;
|
|
160
|
+
dim: number;
|
|
161
|
+
recordCodeBytes: number;
|
|
162
|
+
decode(codes: Uint8Array): Float32Array;
|
|
163
|
+
rotateQuery?(qNorm: Float32Array): Float32Array;
|
|
164
|
+
adcScore?(rotatedQuery: Float32Array, codes: Uint8Array): number;
|
|
165
|
+
}
|
|
166
|
+
interface BucketRecord {
|
|
167
|
+
anchor: TimeAnchor;
|
|
168
|
+
ordinal: number;
|
|
169
|
+
vec?: Float32Array;
|
|
170
|
+
codes?: Uint8Array;
|
|
171
|
+
}
|
|
172
|
+
type CborValue = number | bigint | string | boolean | null | undefined | Uint8Array | CborValue[] | {
|
|
173
|
+
[key: string]: CborValue;
|
|
174
|
+
};
|
|
175
|
+
declare const SCALAR_ENCODING_MAP: Record<string, string>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* CBOR decoder — handles the exact DreamDB/Vortex subset:
|
|
179
|
+
* Major type 0: unsigned integers (u8/u16/u32/u64)
|
|
180
|
+
* Major type 1: negative integers
|
|
181
|
+
* Major type 2: byte strings
|
|
182
|
+
* Major type 3: text strings
|
|
183
|
+
* Major type 4: arrays
|
|
184
|
+
* Major type 5: maps
|
|
185
|
+
* Major type 7: simple values (false, true, null, undefined) + IEEE-754 floats
|
|
186
|
+
*
|
|
187
|
+
* Port of the hand-rolled decoder from demo/dreamdb.js.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
/** Decode a single CBOR value from the front of `bytes`. */
|
|
191
|
+
declare function decodeCbor(bytes: Uint8Array): CborValue;
|
|
192
|
+
/**
|
|
193
|
+
* Encode a CBOR value. Supports the same subset the decoder handles:
|
|
194
|
+
* unsigned ints, negative ints, byte strings, text strings, arrays,
|
|
195
|
+
* maps, booleans, null, undefined, and f64 floats.
|
|
196
|
+
*/
|
|
197
|
+
declare function encodeCbor(value: CborValue): Uint8Array;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* DreamDB URI parsing and Base32 encoding/decoding.
|
|
201
|
+
*
|
|
202
|
+
* A "DreamDB Space URI" is the absolute HTTP URL of either a `refs/<name>`
|
|
203
|
+
* or `manifests/<hash>` Object on the connector backend:
|
|
204
|
+
*
|
|
205
|
+
* http://localhost:9000/ucf101-mp4/refs/ucf101-mp4
|
|
206
|
+
* http://localhost:9000/ucf101-mp4/manifests/dytslnbcty5b...
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
declare const MULTIHASH_BYTES = 33;
|
|
210
|
+
/** Encode raw bytes to lowercase base32 (RFC 4648, no padding). */
|
|
211
|
+
declare function bytesToBase32(bytes: Uint8Array): Base32Hash;
|
|
212
|
+
/** Decode a base32 string back to raw bytes. */
|
|
213
|
+
declare function base32ToBytes(str: string): Uint8Array;
|
|
214
|
+
interface ParsedSpaceUri {
|
|
215
|
+
connectorBase: string;
|
|
216
|
+
kind: "ref" | "manifest";
|
|
217
|
+
id: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Split a Space URI into { connectorBase, kind, id }.
|
|
221
|
+
*
|
|
222
|
+
* "https://host/bucket/refs/foo" → { connectorBase: "https://host/bucket", kind: "ref", id: "foo" }
|
|
223
|
+
* "https://host/bucket/manifests/dXYZ" → { connectorBase: "https://host/bucket", kind: "manifest", id: "dXYZ" }
|
|
224
|
+
*/
|
|
225
|
+
declare function parseSpaceUri(uri: string): ParsedSpaceUri;
|
|
226
|
+
/** Map a scalar value_type to its modality encoding fragment. */
|
|
227
|
+
declare function scalarModalityFragment(valueType: string): string;
|
|
228
|
+
/**
|
|
229
|
+
* Given a Schema field definition, compute the expected Track modality string.
|
|
230
|
+
* Mirrors `scalar_modality_for` in dreamdb-dataset/src/dataset/util.rs.
|
|
231
|
+
*/
|
|
232
|
+
declare function modalityForField(field: {
|
|
233
|
+
kind: string;
|
|
234
|
+
mime?: string;
|
|
235
|
+
dim?: number;
|
|
236
|
+
name?: string;
|
|
237
|
+
value_type?: string;
|
|
238
|
+
valueType?: string;
|
|
239
|
+
}): string | null;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Backend implementations for DreamDB storage.
|
|
243
|
+
*
|
|
244
|
+
* - S3Backend: fetch-based HTTP backend for S3-compatible storage (MinIO, R2, etc.)
|
|
245
|
+
* - MemoryBackend: in-process Map-based backend for tests and ephemeral use
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* S3Backend talks to an S3-compatible HTTP endpoint via `fetch`.
|
|
250
|
+
* Works in both browser and Node 18+.
|
|
251
|
+
*
|
|
252
|
+
* The `baseUrl` is the connector base URL, e.g. "http://localhost:9000/my-bucket".
|
|
253
|
+
* All paths are joined relative to this base.
|
|
254
|
+
*/
|
|
255
|
+
declare class S3Backend implements Backend {
|
|
256
|
+
readonly baseUrl: string;
|
|
257
|
+
constructor(baseUrl: string);
|
|
258
|
+
get(path: string, opts?: BackendGetOptions): Promise<Uint8Array>;
|
|
259
|
+
put(path: string, data: Uint8Array, opts?: BackendPutOptions): Promise<string>;
|
|
260
|
+
list(prefix: string): Promise<string[]>;
|
|
261
|
+
delete(path: string): Promise<void>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* MemoryBackend stores all Objects in a Map<string, Uint8Array>.
|
|
265
|
+
* Useful for tests and ephemeral datasets.
|
|
266
|
+
*/
|
|
267
|
+
declare class MemoryBackend implements Backend {
|
|
268
|
+
private store;
|
|
269
|
+
get(path: string, _opts?: BackendGetOptions): Promise<Uint8Array>;
|
|
270
|
+
put(path: string, data: Uint8Array, _opts?: BackendPutOptions): Promise<string>;
|
|
271
|
+
list(prefix: string): Promise<string[]>;
|
|
272
|
+
delete(path: string): Promise<void>;
|
|
273
|
+
/** Check whether a key exists. */
|
|
274
|
+
has(path: string): boolean;
|
|
275
|
+
/** Get the number of stored objects. */
|
|
276
|
+
get size(): number;
|
|
277
|
+
/** Clear all stored objects. */
|
|
278
|
+
clear(): void;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Space class — resolve refs, decode manifests, iterate tracks.
|
|
283
|
+
*
|
|
284
|
+
* Port of the DreamDBSpace class from demo/dreamdb.js.
|
|
285
|
+
* Uses the Backend interface for storage access.
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
interface SpaceOptions {
|
|
289
|
+
connectorBase?: string;
|
|
290
|
+
backend?: Backend;
|
|
291
|
+
}
|
|
292
|
+
declare class Space {
|
|
293
|
+
readonly connectorBase: string;
|
|
294
|
+
readonly manifestHash: Base32Hash;
|
|
295
|
+
readonly manifest: Manifest;
|
|
296
|
+
readonly refName: string | null;
|
|
297
|
+
private backend;
|
|
298
|
+
private _siCache;
|
|
299
|
+
private _vcCache;
|
|
300
|
+
private _lastQueryStats;
|
|
301
|
+
constructor(opts: {
|
|
302
|
+
connectorBase: string;
|
|
303
|
+
manifestHash: Base32Hash;
|
|
304
|
+
manifest: Manifest;
|
|
305
|
+
refName: string | null;
|
|
306
|
+
backend?: Backend;
|
|
307
|
+
});
|
|
308
|
+
/**
|
|
309
|
+
* Open a Space from a space URI.
|
|
310
|
+
* If a Backend is provided, it is used; otherwise fetch-based HTTP access.
|
|
311
|
+
*/
|
|
312
|
+
static fromUri(uri: string, backend?: Backend): Promise<Space>;
|
|
313
|
+
/** Get the timeline ID (base32 hash of the first timeline entry). */
|
|
314
|
+
timelineId(): Base32Hash;
|
|
315
|
+
/**
|
|
316
|
+
* Map each Manifest Track to the Schema-declared field name.
|
|
317
|
+
* Returns a parallel array to manifest.tracks.
|
|
318
|
+
*/
|
|
319
|
+
private _fieldNamesForTracks;
|
|
320
|
+
/** List resolved tracks from this Manifest. */
|
|
321
|
+
tracks(): ResolvedTrack[];
|
|
322
|
+
/** Find a Track by key (field name or modality). */
|
|
323
|
+
trackFor(keyOrModality: string): ResolvedTrack | undefined;
|
|
324
|
+
/** Walk the Manifest DAG and return history entries. */
|
|
325
|
+
history(maxDepth?: number): Promise<HistoryEntry[]>;
|
|
326
|
+
/** Get the last query's statistics. */
|
|
327
|
+
get lastQueryStats(): QueryStats | null;
|
|
328
|
+
queryVector(field: string, queryVec: number[] | Float32Array, opts?: VectorQueryOptions | number): Promise<VectorQueryResult[]>;
|
|
329
|
+
private _embeddingTrackFor;
|
|
330
|
+
private _fetchBytes;
|
|
331
|
+
private _fetchSpatialDispatcher;
|
|
332
|
+
private _fetchVectorCompressor;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Vector query, LSH dispatch, IVF dispatch, ChaCha20 hyperplane derivation,
|
|
337
|
+
* PQ/RaBitQ decode + rerank.
|
|
338
|
+
*
|
|
339
|
+
* Port of the spatial-indexing and vector-scoring logic from demo/dreamdb.js.
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
interface ChaCha20Stream {
|
|
343
|
+
fill(out: Uint8Array): void;
|
|
344
|
+
}
|
|
345
|
+
/** Streaming ChaCha20 keystream from a 32-byte seed. */
|
|
346
|
+
declare function chacha20Stream(seedBytes32: Uint8Array): ChaCha20Stream;
|
|
347
|
+
/** f32 left-fold L2-normalize (matches Rust's normalize_l2). */
|
|
348
|
+
declare function normalizeL2F32(v: Float32Array | number[]): Float32Array | null;
|
|
349
|
+
/** f64 L2-normalize (higher precision, for rerank path). */
|
|
350
|
+
declare function normalizeL2(v: Float32Array | number[]): Float32Array;
|
|
351
|
+
/** f32 left-fold dot product (matches Rust's dot_product_left_fold). */
|
|
352
|
+
declare function dotF32(a: Float32Array, b: Float32Array): number;
|
|
353
|
+
/** f64 dot product of L2-normalized vectors. */
|
|
354
|
+
declare function dotL2Normalized(a: Float32Array, b: Float32Array): number;
|
|
355
|
+
/**
|
|
356
|
+
* Derive `bits` hyperplanes of `dim` f32 values each, from a 32-byte seed.
|
|
357
|
+
* Mirrors `derive_hyperplanes` in dreamdb-protocol/src/lsh_cosine.rs.
|
|
358
|
+
*/
|
|
359
|
+
declare function deriveHyperplanesLshCosine(seedBytes32: Uint8Array, dim: number, bits: number): Float32Array;
|
|
360
|
+
declare function projectionsLshCosine(qNormalized: Float32Array, hyperplanes: Float32Array, dim: number, bits: number): Float32Array;
|
|
361
|
+
declare function bitsFromProjections(projections: Float32Array): boolean[];
|
|
362
|
+
declare function bitsToBase2(bits: boolean[]): string;
|
|
363
|
+
/**
|
|
364
|
+
* Enumerate up to `probeCount` keys (including primary) ranked by
|
|
365
|
+
* smallest total |projection| flip-cost.
|
|
366
|
+
*/
|
|
367
|
+
declare function multiProbeKeys(projections: Float32Array, probeCount: number, maxHamming: number): string[];
|
|
368
|
+
/**
|
|
369
|
+
* Derive the dim x dim orthogonal rotation matrix from a 32-byte seed.
|
|
370
|
+
* Uses Modified Gram-Schmidt. Returns Float32Array of length dim*dim, row-major.
|
|
371
|
+
*/
|
|
372
|
+
declare function deriveRotationMatrix(seedBytes32: Uint8Array, dim: number): Float32Array;
|
|
373
|
+
declare function buildPqCosineDecoder(vcCborBytes: Uint8Array): VectorCompressorDecoder;
|
|
374
|
+
declare function buildRabitqCosineDecoder(vcCborBytes: Uint8Array): VectorCompressorDecoder;
|
|
375
|
+
/**
|
|
376
|
+
* Decode a SpatialBucket binary into BucketRecord[].
|
|
377
|
+
* Supports v1 (160-byte header, raw f32) and v2 (200-byte header, compressed).
|
|
378
|
+
*/
|
|
379
|
+
declare function decodeBucketRecords(bytes: Uint8Array, expectRecordSize: number, dim: number): BucketRecord[];
|
|
380
|
+
/** Decode only the time anchors from a SpatialBucket binary. */
|
|
381
|
+
declare function decodeBucketAnchorsOnly(bytes: Uint8Array): number[];
|
|
382
|
+
/** Peek the bucket header without decoding records. */
|
|
383
|
+
declare function peekBucketHeader(bytes: Uint8Array): {
|
|
384
|
+
recordSize: number;
|
|
385
|
+
recordCount: number;
|
|
386
|
+
headerSize: number;
|
|
387
|
+
isCompressed: boolean;
|
|
388
|
+
vectorCompressorHash: Uint8Array | null;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* High-level Dataset API — mirrors the Python SDK's Dataset/Schema surface.
|
|
393
|
+
*
|
|
394
|
+
* Provides:
|
|
395
|
+
* - Schema (add_image, add_embedding, add_scalar_categorical, etc.)
|
|
396
|
+
* - Dataset.create / Dataset.open
|
|
397
|
+
* - append_many, iter_vector, iter_stream
|
|
398
|
+
* - snapshot, branch, merge, delete, tombstone_set
|
|
399
|
+
* - history, list_refs, count
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Builder for a Dataset's schema. Chainable API:
|
|
404
|
+
*
|
|
405
|
+
* const schema = new Schema()
|
|
406
|
+
* .addImage("image", { mime: "jpeg" })
|
|
407
|
+
* .addEmbedding("embedding", { dim: 512 })
|
|
408
|
+
* .addScalarCategorical("label");
|
|
409
|
+
*/
|
|
410
|
+
declare class Schema {
|
|
411
|
+
readonly fields: FieldDef[];
|
|
412
|
+
addImage(name: string, opts?: {
|
|
413
|
+
mime?: string;
|
|
414
|
+
required?: boolean;
|
|
415
|
+
chunkSize?: number;
|
|
416
|
+
packItems?: number;
|
|
417
|
+
}): this;
|
|
418
|
+
addAudio(name: string, opts?: {
|
|
419
|
+
mime?: string;
|
|
420
|
+
required?: boolean;
|
|
421
|
+
chunkSize?: number;
|
|
422
|
+
packItems?: number;
|
|
423
|
+
}): this;
|
|
424
|
+
addVideo(name: string, opts?: {
|
|
425
|
+
mime?: string;
|
|
426
|
+
required?: boolean;
|
|
427
|
+
chunkSize?: number;
|
|
428
|
+
packItems?: number;
|
|
429
|
+
}): this;
|
|
430
|
+
addEmbedding(name: string, opts: {
|
|
431
|
+
dim: number;
|
|
432
|
+
algorithm?: string;
|
|
433
|
+
required?: boolean;
|
|
434
|
+
lshBits?: number;
|
|
435
|
+
compressor?: Uint8Array;
|
|
436
|
+
spatialIndex?: Uint8Array;
|
|
437
|
+
rerank?: boolean;
|
|
438
|
+
}): this;
|
|
439
|
+
addScalarCategorical(name: string, opts?: {
|
|
440
|
+
required?: boolean;
|
|
441
|
+
}): this;
|
|
442
|
+
addScalarBool(name: string, opts?: {
|
|
443
|
+
required?: boolean;
|
|
444
|
+
}): this;
|
|
445
|
+
addScalarInt(name: string, opts?: {
|
|
446
|
+
required?: boolean;
|
|
447
|
+
}): this;
|
|
448
|
+
addScalarFloat(name: string, opts?: {
|
|
449
|
+
required?: boolean;
|
|
450
|
+
}): this;
|
|
451
|
+
addScalarString(name: string, opts?: {
|
|
452
|
+
required?: boolean;
|
|
453
|
+
}): this;
|
|
454
|
+
addScalarTimestamp(name: string, opts?: {
|
|
455
|
+
required?: boolean;
|
|
456
|
+
}): this;
|
|
457
|
+
/** Serialize the schema to CBOR-encodable object. */
|
|
458
|
+
toCbor(): CborValue;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Versioned multimodal Dataset.
|
|
462
|
+
*
|
|
463
|
+
* TypeScript SDK mirror of the Python vortex_dataset.Dataset surface.
|
|
464
|
+
*/
|
|
465
|
+
declare class Dataset {
|
|
466
|
+
private backend;
|
|
467
|
+
private _refName;
|
|
468
|
+
private _manifestHash;
|
|
469
|
+
private _timelineHash;
|
|
470
|
+
private _schema;
|
|
471
|
+
private constructor();
|
|
472
|
+
static create(name: string, schema: Schema, backendUrl: string): Promise<Dataset>;
|
|
473
|
+
static open(name: string, schema?: Schema | null, backendUrl?: string): Promise<Dataset>;
|
|
474
|
+
refName(): string;
|
|
475
|
+
currentManifest(): Base32Hash;
|
|
476
|
+
timeline(): Base32Hash;
|
|
477
|
+
schema(): Schema;
|
|
478
|
+
history(maxDepth?: number): Promise<Array<{
|
|
479
|
+
manifest: Base32Hash;
|
|
480
|
+
ts_ns: number;
|
|
481
|
+
writer: string;
|
|
482
|
+
parents_count: number;
|
|
483
|
+
tracks_count: number;
|
|
484
|
+
}>>;
|
|
485
|
+
listRefs(): Promise<string[]>;
|
|
486
|
+
count(): Promise<number>;
|
|
487
|
+
appendMany(samples: Sample[]): Promise<number>;
|
|
488
|
+
iterVector(field: string, query: number[] | Float32Array, topK: number, batchSize?: number, opts?: {
|
|
489
|
+
whereEq?: WhereClause;
|
|
490
|
+
}): Promise<Batch[]>;
|
|
491
|
+
private _iterStreamImpl;
|
|
492
|
+
iterStream(batchSize?: number): Promise<Batch[]>;
|
|
493
|
+
snapshot(label: string): Promise<SnapshotInfo>;
|
|
494
|
+
branch(newName: string): Promise<Dataset>;
|
|
495
|
+
private _resolveScalarLabels;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export { type AudioFieldDef, type Backend, type BackendGetOptions, type BackendPutOptions, type Base32Hash, type Batch, type BucketRecord, type CborValue, type ChaCha20Stream, Dataset, type DatasetInfo, type EmbeddingFieldDef, type FieldDef, type FieldKind, type HistoryEntry, type ImageFieldDef, MULTIHASH_BYTES, type Manifest, type ManifestTrack, MemoryBackend, type MultihashBytes, type ParsedSpaceUri, type QueryStats, type RegistryEntry, type ResolvedTrack, S3Backend, SCALAR_ENCODING_MAP, type Sample, type SampleValue, type ScalarFieldDef, type ScalarValueType, Schema, type SnapshotInfo, Space, type SpaceOptions, type SpatialDispatcher, type TimeAnchor, type VectorCompressorDecoder, type VectorQueryOptions, type VectorQueryResult, type VideoFieldDef, type WhereClause, base32ToBytes, bitsFromProjections, bitsToBase2, buildPqCosineDecoder, buildRabitqCosineDecoder, bytesToBase32, chacha20Stream, decodeBucketAnchorsOnly, decodeBucketRecords, decodeCbor, deriveHyperplanesLshCosine, deriveRotationMatrix, dotF32, dotL2Normalized, encodeCbor, modalityForField, multiProbeKeys, normalizeL2, normalizeL2F32, parseSpaceUri, peekBucketHeader, projectionsLshCosine, scalarModalityFragment };
|