/* tslint:disable */ /* eslint-disable */ /** * An open store. Wraps `nidus::Nidus`; every method must run on the worker thread that * registered its OPFS pool (for an `opfs://` location). */ export class NidusHandle { private constructor(); free(): void; [Symbol.dispose](): void; /** * Close the store. Consumes the handle: nidus's `Drop` releases the writer lock (a * trivial always-held guard on OPFS), and the JS wrapper is invalidated with it. */ close(): void; /** * Drop a collection's rows. The terminal's `clear` — dropping rather than deleting * OPFS files underneath the pool's open handles. */ drop_collection(collection: string): void; /** * fsync both files. */ flush(): void; /** * A RAM/disk footprint snapshot, shaped like `FootprintDto`. The terminal's `stats`. */ footprint(): any; /** * Open (creating if absent) a store at `location` — `opfs://name` (needs * `init_opfs_pool` first, same thread) or `file://…`/a bare path. */ static open(location: string, dimension: number): NidusHandle; /** * Open a RAM-only store, no persistence config. The terminal's fallback when the * worker/OPFS handshake fails. */ static open_in_memory(dimension: number): NidusHandle; /** * Nearest-neighbour search in `collection`, returning a JS array of hits shaped like * `server::dto::HitDto`: `{collection, id, score, attrs}`. */ search(collection: string, query: Float32Array, top_k: number): any; /** * Upsert records given as a JS array of `{id, vector?, vectors?, attrs}` (mirrors * `server::dto::UpsertRequest`'s `Record`, the same type). `vectors` (nidus-85t) is a * plain `{name: embedding}` object; confirmed round-tripping via `serde-wasm-bindgen`. */ upsert(collection: string, records: any): number; } /** * Add freshly-opened handles to the pool already registered on this thread — the async * growth step a `put` exhaustion error asks for. Same thread as `init_opfs_pool` only. */ export function grow_opfs_pool(handles: Array): void; /** * Adopt a fresh pool of already-opened OPFS handles (`handles[0]` is the directory slot, * `handles[1..]` are body slots) and register it on this worker thread. Must run before any * `NidusHandle::open("opfs://…")` call on the same thread. */ export function init_opfs_pool(handles: Array): void; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_nidushandle_free: (a: number, b: number) => void; readonly grow_opfs_pool: (a: number, b: number) => void; readonly init_opfs_pool: (a: number, b: number) => void; readonly nidushandle_close: (a: number) => void; readonly nidushandle_drop_collection: (a: number, b: number, c: number, d: number) => void; readonly nidushandle_flush: (a: number, b: number) => void; readonly nidushandle_footprint: (a: number, b: number) => void; readonly nidushandle_open: (a: number, b: number, c: number, d: number) => void; readonly nidushandle_open_in_memory: (a: number, b: number) => void; readonly nidushandle_search: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void; readonly nidushandle_upsert: (a: number, b: number, c: number, d: number, e: number) => void; readonly __wbindgen_export: (a: number, b: number) => number; readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_export3: (a: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;