export declare class Index { uid: Uint8Array; value: Uint8Array; constructor(uid: Uint8Array, value: Uint8Array); } export declare class IndexedValue { static L_PREFIX: number; static W_PREFIX: number; bytes: Uint8Array; constructor(bytes: Uint8Array); static fromData(data: Data): IndexedValue; static fromNextWord(keyword: Keyword): IndexedValue; toBase64(): string; getData(): Data | null; getNextWord(): Keyword | null; } export declare class Data { bytes: Uint8Array; constructor(bytes: Uint8Array); static fromString(value: string): Data; /** * Numbers are encoded in big-endian 8 bytes. * JS `number` type cannot encode the all 64 bits numbers because it uses floating point representation * that's why we use `BigInt` internally but we convert to `number` (it's theoretically wrong) because `number` * is easier to use in JS that BigInt. If we insert a really big 64bits number in Java for example, JS will * not be able to read it. * @param value number * @returns data */ static fromNumber(value: number): Data; /** * Convert UUIDv4 only because they are more common. * @param uuidv4 uuid * @returns data */ static fromUuid(uuidv4: string): Data; toString(): string; toNumber(): number; toUuidString(): string; } export declare class Keyword { bytes: Uint8Array; constructor(bytes: Uint8Array); static fromString(value: string): Keyword; static fromUuid(value: string): Keyword; toBase64(): string; toString(): string; } /** * A new value to index for a given set of keywords: * IndexedValue -> Set */ export interface IndexedEntry { indexedValue: IndexedValue | Data | Keyword; keywords: Set | Keyword[] | string[]; } /** * Generates aliases for a keyword to use in upsert * If keyword is "Thibaud" and minChars is 3 return these aliases ["Thi" => "Thib", "Thib" => "Thiba", "Thiba" => "Thibau", "Thibau" => "Thibaud"] * @param keyword Generate aliases to this keyword * @param minChars Start at this number of characters * @returns IndexedEntry to add with upsert */ export declare function generateAliases(keyword: string, minChars?: number): IndexedEntry[]; /** * A helper class to create a {@link IndexedEntry} when * indexing a {@link Data} with keywords supplied * as arrays of strings or bytes */ export declare class DataIndexEntry implements IndexedEntry { indexedValue: IndexedValue; keywords: Set; constructor(data: string | Uint8Array, keywords: string[] | Uint8Array[]); } /** * A helper class to create a {@link IndexedEntry} when * indexing a {@link Keyword} to point to another {@link Keyword} */ export declare class KeywordIndexEntry implements IndexedEntry { indexedValue: IndexedValue; keywords: Set; constructor(source: string | Uint8Array, destination: string | Uint8Array); } /** * Represents a `(uid, value)` tuple, i.e. a line, in the Entry or Chain table */ export type UidsAndValues = Index[]; /** * Fetch a uid in the Entry table and return the (uid, value) column */ export type Fetch = (uids: Uint8Array[]) => Promise; /** * Insert, or update an existing, (uid, value) line in the Entry table */ export type Upsert = (old_values: UidsAndValues, new_values: UidsAndValues) => Promise; /** * Insert, or update an existing, (uid, value) line in the Chain table */ export type Insert = (uidsAndValues: UidsAndValues) => Promise; /** * Called with results found at every node while the search walks the search graph. * Returning false, stops the walk. */ export type Interrupt = (indexedValues: IntermediateSearchResults) => Promise; export declare class SearchResults { dataPerKeywords: Array<{ keyword: Uint8Array; data: Data[]; }>; constructor(resultsPerKeywords: Array<{ keyword: Uint8Array; results: Uint8Array[]; }>); get(keyword: string | Uint8Array): Data[]; data(): Data[]; toNumbers(): number[]; toStrings(): string[]; toUuidStrings(): string[]; total(): number; [Symbol.iterator](): Generator; } export declare class IntermediateSearchResults { indexedValuesPerKeywords: Array<{ keyword: Uint8Array; indexedValues: IndexedValue[]; }>; constructor(resultsPerKeywords: Array<{ keyword: Uint8Array; results: Uint8Array[]; }>); getData(keyword: string | Uint8Array): Data[]; getKeywords(keyword: string | Uint8Array): Keyword[]; getAllIndexedValues(keyword: string | Uint8Array): IndexedValue[]; indexedValues(): IndexedValue[]; total(): number; [Symbol.iterator](): Generator; } /** * * @param indexedEntries JS new indexed entries * @param debugName Name of the parameter to show in errors * @returns wasm formatted indexed values to keywords */ export declare function indexedEntriesToBytes(indexedEntries: IndexedEntry[], debugName: string): Array<{ indexedValue: Uint8Array; keywords: Uint8Array[]; }>; //# sourceMappingURL=types.d.ts.map