import { SymmetricKey } from "cloudproof_kms_js"; import { DbInterface } from "./backend"; import { IndexedEntry, Interrupt, Keyword, SearchResults } from "./types"; export interface InstantiatedFindex { /** * Add the given values to this Findex index for the corresponding * keywords. * @param {Uint8Array} key * @param {string} label * @param {Array<{indexedValue: Uint8Array, keywords: Array}>} associations * @returns {Promise>} */ add: (key: Uint8Array, label: string, associations: Array<{ indexedValue: Uint8Array; keywords: Uint8Array[]; }>) => Promise; /** * Remove the given values from this Findex index for the corresponding * keywords. * @param {Uint8Array} key * @param {Uint8Array} label * @param {Array<{indexedValue: Uint8Array, keywords: Array}>} associations * @returns {Promise>} */ delete: (key: Uint8Array, label: string, associations: Array<{ indexedValue: Uint8Array; keywords: Uint8Array[]; }>) => Promise; /** * Searches this Findex instance for the given keywords. * * The interrupt is called at each search graph level with the level's * results and allows interrupting the search. * @param {Uint8Array} key * @param {Uint8Array} label * @param {Array} keywords * @param {Function} interrupt * @returns {Promise }>>} */ search: (key: Uint8Array, label: string, keywords: Uint8Array[], interrupt?: Interrupt) => Promise>; } /** * Findex definition * @returns {Promise} results found at every node while the search walks the search graph */ export declare class Findex { key: Uint8Array; label: string; _instantiatedFindex: InstantiatedFindex | null; constructor(key: SymmetricKey | Uint8Array, label: string); /** * Instantiates a custom interface. * @param entryInterface Entry Table DB interface * @param chainInterface Chain Table DB interface */ instantiateCustomInterface(entryInterface: DbInterface, chainInterface?: DbInterface): Promise; /** * Instantiates a Findex REST interface using the given token and URL. * @param token findex server authorization token * @param entryUrl entry table url * @param chainUrl chain table url */ instantiateRestInterface(token: string, entryUrl: string, chainUrl?: string): Promise; /** * Add the given associations to the index. * @param {IndexedEntry[]} associations new entries to upsert in indexes * @param options Additional optional options * @param options.verbose the optional verbose bool parameter * @returns {Keyword[]} the list of the newly inserted keywords in the index * @throws when the DB interface is not instantiated */ add(associations: IndexedEntry[], options?: { verbose?: false; }): Promise; /** * Delete the given associations from the index. * @param {IndexedEntry[]} associations new entries to upsert in indexes * @param options Additional optional options * @param options.verbose the optional verbose bool parameter * @returns {Keyword[]} the list of the newly inserted keywords in the index * @throws when the DB interface is not instantiated */ delete(associations: IndexedEntry[], options?: { verbose?: false; }): Promise; /** * Search for the given keywords in the index and return the corresponding * data. * @param keywords keywords to search inside the indexes * @param options Additional optional options to the search * @param options.userInterrupt the optional callback of found values as the search graph is walked. Returning `true` stops the walk * @param options.verbose the optional verbose bool parameter * @returns the search results * @throws when the DB interface is not instantiated */ search(keywords: Set | Array, options?: { userInterrupt?: Interrupt; verbose?: false; }): Promise; } //# sourceMappingURL=findex.d.ts.map