/* tslint:disable */ /* eslint-disable */ /** * Index registry for managing multiple indexes */ export class IndexRegistry { free(): void; [Symbol.dispose](): void; /** * Add a remote index */ add_remote(name: string, base_url: string): Promise; /** * List index names */ list(): any; constructor(); /** * Remove an index */ remove(name: string): void; /** * Search an index by name */ search(index_name: string, text: string, limit: number): Promise; } /** * IPFS Index that uses JavaScript verified-fetch for content retrieval * * This allows loading indexes from IPFS without using gateways by * leveraging @helia/verified-fetch in JavaScript. */ export class IpfsIndex { free(): void; [Symbol.dispose](): void; /** * Get cache statistics */ cache_stats(): any; /** * Clear IndexedDB cache */ clear_idb_cache(): Promise; /** * Get default fields */ default_fields(): any; /** * Export cache */ export_cache(): Uint8Array | undefined; /** * Get field names */ field_names(): any; /** * Get a document by address, loading only the specified fields. */ getDocumentWithFields(segment_id: string, doc_id: number, fields_to_load: string[]): Promise; /** * Get a document by address */ get_document(segment_id: string, doc_id: number): Promise; /** * Import cache */ import_cache(data: Uint8Array): void; /** * Load index using JavaScript fetch functions * * @param fetch_fn - JS function: (path: string) => Promise * @param size_fn - JS function: (path: string) => Promise */ load(fetch_fn: Function, size_fn: Function): Promise; /** * Load cache from IndexedDB */ load_cache_from_idb(): Promise; /** * Load index with IndexedDB cache pre-loaded * * This method first loads any cached data from IndexedDB, then opens the index. * This allows previously cached slices to be used during index loading, * reducing network requests on page refresh. * * @param fetch_fn - JS function: (path: string) => Promise * @param size_fn - JS function: (path: string) => Promise */ load_with_idb_cache(fetch_fn: Function, size_fn: Function): Promise; /** * Get network statistics */ network_stats(): any; /** * Create a new IPFS index * * @param base_path - The IPFS path (e.g., "/ipfs/Qm..." or "/ipns/...") */ constructor(base_path: string); /** * Get number of documents */ num_docs(): number; /** * Get number of segments */ num_segments(): number; /** * Reset network statistics */ reset_network_stats(): void; /** * Save cache to IndexedDB */ save_cache_to_idb(): Promise; /** * Search the index * * Returns `{ hits: [{ address: { segment_id: string, doc_id: number }, score: number }], total_hits: number }`. * Use `get_document(hit.address.segment_id, hit.address.doc_id)` to fetch document content. */ search(query_str: string, limit: number): Promise; /** * Structured search: accepts a query object instead of a query string. */ searchStructured(request: any): Promise; /** * Search the index with offset for pagination */ search_offset(query_str: string, limit: number, offset: number): Promise; /** * Create with custom cache size */ static with_cache_size(base_path: string, cache_size: number): IpfsIndex; } /** * In-browser local index — create, index documents, search, all in WASM. * * ```js * // In-memory (ephemeral) * const index = await LocalIndex.create("index articles { ... }"); * * // With pluggable storage (IDB, encrypted, remote, etc.) * const index = await LocalIndex.withStorage(myStorage, "index articles { ... }"); * ``` */ export class LocalIndex { private constructor(); free(): void; [Symbol.dispose](): void; /** * Add a single document (JSON object with field names matching the schema). */ addDocument(doc_json: any): Promise; /** * Add multiple documents at once (array of JSON objects). */ addDocuments(docs_json: any): Promise; /** * Commit pending documents — builds segments and updates metadata. * * For persistent indexes, only writes new/changed files to storage. */ commit(): Promise; /** * Create a new in-memory index from an SDL schema string. * * Data is lost on page refresh. Use `withStorage()` for persistence. */ static create(schema_sdl: string): Promise; /** * Get field names from the schema. */ fieldNames(): any; /** * Get a document by its address. */ getDocument(segment_id: string, doc_id: number): Promise; /** * Get a document by its address, loading only the specified fields. * * `fields_to_load` is a JS array of field name strings, e.g. `["title", "body"]`. */ getDocumentWithFields(segment_id: string, doc_id: number, fields_to_load: string[]): Promise; /** * Number of indexed documents (across all committed segments). */ numDocs(): number; /** * Number of documents pending (not yet committed). */ pendingDocs(): number; /** * Search the index. * * Returns `{ hits: [{ address: { segment_id, doc_id }, score }], total_hits }`. */ search(query_str: string, limit: number): Promise; /** * Search with offset for pagination. */ searchOffset(query_str: string, limit: number, offset: number): Promise; /** * Structured search: accepts a query object instead of a query string. * * ```js * const results = await index.searchStructured({ * query: { boolean: { must: [{ term: { field: "title", value: "rust" } }] } }, * limit: 10, * offset: 0, * fieldsToLoad: ["title"], * }); * ``` */ searchStructured(request: any): Promise; /** * Create or open an index with a pluggable storage backend. * * If the storage already contains index files, the index is reopened. * Otherwise a new index is created from the SDL schema. * * The storage object must implement: * ```ts * interface IFilesStorage { * write(name: string, buffer: ArrayBuffer): Promise; * get(name: string): Promise; * delete(names: string[]): Promise; * list(): Promise; * } * ``` */ static withStorage(storage: any, schema_sdl: string): Promise; } /** * Remote index that loads data via HTTP with slice caching */ export class RemoteIndex { free(): void; [Symbol.dispose](): void; /** * Get cache statistics */ cache_stats(): any; /** * Clear the persisted cache from IndexedDB */ clear_idb_cache(): Promise; /** * Get default field names for query parsing */ default_fields(): any; /** * Export the current slice cache as bytes * * Returns the serialized cache data that can be stored in IndexedDB * or other persistent storage for later restoration. */ export_cache(): Uint8Array | undefined; /** * Get field names */ field_names(): any; /** * Get a document by its address, loading only the specified fields. * * `fields_to_load` is a JS array of field name strings, e.g. `["title", "body"]`. * Only the requested fields are returned (skips expensive reads for dense vectors). */ getDocumentWithFields(segment_id: string, doc_id: number, fields_to_load: string[]): Promise; /** * Get a document by its address (segment_id + doc_id) * * Returns the document as a JSON object, or null if not found. */ get_document(segment_id: string, doc_id: number): Promise; /** * Import a previously exported slice cache * * Merges the cached slices into the current cache, reducing * network requests for previously fetched data. */ import_cache(data: Uint8Array): void; /** * Load index from URL using hermes-core Index with slice caching * * Automatically attempts to load the slice cache file (index.slicecache) * to prefill the cache with hot data, reducing cold-start latency. */ load(): Promise; /** * Load the slice cache from IndexedDB * * Call this after load() to restore cached data from a previous session. */ load_cache_from_idb(): Promise; /** * Load index with IndexedDB cache pre-loaded * * This method first loads any cached data from IndexedDB, then opens the index. * This allows previously cached slices to be used during index loading, * reducing network requests on page refresh. */ load_with_idb_cache(): Promise; /** * Get network statistics (requests made, bytes transferred, etc.) */ network_stats(): any; /** * Create a new remote index pointing to a URL */ constructor(base_url: string); /** * Get number of documents */ num_docs(): number; /** * Get number of segments */ num_segments(): number; /** * Reset network statistics */ reset_network_stats(): void; /** * Save the slice cache to IndexedDB for persistence across sessions * * The cache is stored under a key derived from the base URL. */ save_cache_to_idb(): Promise; /** * Search the index * * Accepts both query language syntax (field:term, AND, OR, NOT, grouping) * and simple text (tokenized and searched across default fields). * * Returns `{ hits: [{ address: { segment_id: string, doc_id: number }, score: number }], total_hits: number }`. * Use `get_document(hit.address.segment_id, hit.address.doc_id)` to fetch document content. */ search(query_str: string, limit: number): Promise; /** * Structured search: accepts a query object instead of a query string. */ searchStructured(request: any): Promise; /** * Search with offset for pagination */ search_offset(query_str: string, limit: number, offset: number): Promise; /** * Create with custom cache size (in bytes) */ static with_cache_size(base_url: string, cache_size: number): RemoteIndex; } /** * Initialize panic hook and logging (defaults to Warn level) */ export function init(): void; /** * Set log level: "error", "warn", "info", "debug", "trace", "off" */ export function set_log_level(level: string): void; /** * Setup logging to browser console (can be called explicitly) */ export function setup_logging(): void; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_indexregistry_free: (a: number, b: number) => void; readonly __wbg_ipfsindex_free: (a: number, b: number) => void; readonly __wbg_remoteindex_free: (a: number, b: number) => void; readonly indexregistry_add_remote: (a: number, b: number, c: number, d: number, e: number) => any; readonly indexregistry_list: (a: number) => any; readonly indexregistry_new: () => number; readonly indexregistry_remove: (a: number, b: number, c: number) => void; readonly indexregistry_search: (a: number, b: number, c: number, d: number, e: number, f: number) => any; readonly ipfsindex_cache_stats: (a: number) => any; readonly ipfsindex_clear_idb_cache: (a: number) => any; readonly ipfsindex_default_fields: (a: number) => any; readonly ipfsindex_export_cache: (a: number) => [number, number]; readonly ipfsindex_field_names: (a: number) => any; readonly ipfsindex_getDocumentWithFields: (a: number, b: number, c: number, d: number, e: number, f: number) => any; readonly ipfsindex_get_document: (a: number, b: number, c: number, d: number) => any; readonly ipfsindex_import_cache: (a: number, b: number, c: number) => [number, number]; readonly ipfsindex_load: (a: number, b: any, c: any) => any; readonly ipfsindex_load_cache_from_idb: (a: number) => any; readonly ipfsindex_load_with_idb_cache: (a: number, b: any, c: any) => any; readonly ipfsindex_network_stats: (a: number) => any; readonly ipfsindex_new: (a: number, b: number) => number; readonly ipfsindex_num_docs: (a: number) => number; readonly ipfsindex_num_segments: (a: number) => number; readonly ipfsindex_reset_network_stats: (a: number) => void; readonly ipfsindex_save_cache_to_idb: (a: number) => any; readonly ipfsindex_search: (a: number, b: number, c: number, d: number) => any; readonly ipfsindex_searchStructured: (a: number, b: any) => any; readonly ipfsindex_search_offset: (a: number, b: number, c: number, d: number, e: number) => any; readonly ipfsindex_with_cache_size: (a: number, b: number, c: number) => number; readonly remoteindex_cache_stats: (a: number) => any; readonly remoteindex_clear_idb_cache: (a: number) => any; readonly remoteindex_default_fields: (a: number) => any; readonly remoteindex_export_cache: (a: number) => [number, number]; readonly remoteindex_field_names: (a: number) => any; readonly remoteindex_getDocumentWithFields: (a: number, b: number, c: number, d: number, e: number, f: number) => any; readonly remoteindex_get_document: (a: number, b: number, c: number, d: number) => any; readonly remoteindex_import_cache: (a: number, b: number, c: number) => [number, number]; readonly remoteindex_load: (a: number) => any; readonly remoteindex_load_cache_from_idb: (a: number) => any; readonly remoteindex_load_with_idb_cache: (a: number) => any; readonly remoteindex_network_stats: (a: number) => any; readonly remoteindex_new: (a: number, b: number) => number; readonly remoteindex_reset_network_stats: (a: number) => void; readonly remoteindex_save_cache_to_idb: (a: number) => any; readonly remoteindex_search: (a: number, b: number, c: number, d: number) => any; readonly remoteindex_searchStructured: (a: number, b: any) => any; readonly remoteindex_search_offset: (a: number, b: number, c: number, d: number, e: number) => any; readonly remoteindex_with_cache_size: (a: number, b: number, c: number) => number; readonly set_log_level: (a: number, b: number) => void; readonly init: () => void; readonly setup_logging: () => void; readonly remoteindex_num_docs: (a: number) => number; readonly remoteindex_num_segments: (a: number) => number; readonly __wbg_localindex_free: (a: number, b: number) => void; readonly localindex_addDocument: (a: number, b: any) => any; readonly localindex_addDocuments: (a: number, b: any) => any; readonly localindex_commit: (a: number) => any; readonly localindex_create: (a: number, b: number) => any; readonly localindex_fieldNames: (a: number) => any; readonly localindex_getDocument: (a: number, b: number, c: number, d: number) => any; readonly localindex_getDocumentWithFields: (a: number, b: number, c: number, d: number, e: number, f: number) => any; readonly localindex_numDocs: (a: number) => number; readonly localindex_pendingDocs: (a: number) => number; readonly localindex_search: (a: number, b: number, c: number, d: number) => any; readonly localindex_searchOffset: (a: number, b: number, c: number, d: number, e: number) => any; readonly localindex_searchStructured: (a: number, b: any) => any; readonly localindex_withStorage: (a: any, b: number, c: number) => any; readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number; readonly rust_zstd_wasm_shim_free: (a: number) => void; readonly rust_zstd_wasm_shim_malloc: (a: number) => number; readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number; readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void; readonly wasm_bindgen_7e519ff5bc59ba8e___convert__closures_____invoke___wasm_bindgen_7e519ff5bc59ba8e___JsValue__core_5858575f5ab61d4b___result__Result_____wasm_bindgen_7e519ff5bc59ba8e___JsError___true_: (a: number, b: number, c: any) => [number, number]; readonly wasm_bindgen_7e519ff5bc59ba8e___convert__closures_____invoke___js_sys_f1382650b4d99aec___Function_fn_wasm_bindgen_7e519ff5bc59ba8e___JsValue_____wasm_bindgen_7e519ff5bc59ba8e___sys__Undefined___js_sys_f1382650b4d99aec___Function_fn_wasm_bindgen_7e519ff5bc59ba8e___JsValue_____wasm_bindgen_7e519ff5bc59ba8e___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void; readonly wasm_bindgen_7e519ff5bc59ba8e___convert__closures_____invoke___web_sys_653f9c5ad68810ef___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true_: (a: number, b: number, c: any) => void; readonly wasm_bindgen_7e519ff5bc59ba8e___convert__closures_____invoke___web_sys_653f9c5ad68810ef___features__gen_IdbVersionChangeEvent__IdbVersionChangeEvent______true__2: (a: number, b: number, c: any) => void; readonly wasm_bindgen_7e519ff5bc59ba8e___convert__closures_____invoke_______true_: (a: number, b: number) => void; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_exn_store: (a: number) => void; readonly __externref_table_alloc: () => number; readonly __wbindgen_externrefs: WebAssembly.Table; readonly __wbindgen_free: (a: number, b: number, c: number) => void; readonly __wbindgen_destroy_closure: (a: number, b: number) => void; readonly __externref_table_dealloc: (a: number) => void; readonly __wbindgen_start: () => void; } 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;