import { JSONObject } from "kuzzle-sdk"; /** * Emulates the normalized object returned by Koncorde v3 */ export declare class NormalizedFilterV3 { /** * Filter Unique Identifier * * @type {string} */ id: string; /** * Data Index Name * * @type {string} */ index: string; /** * Data Collection Name * * @type {string} */ collection: string; /** * Filter converted to its canonical form * * @type {JSONObject[][]} */ normalized: JSONObject[][]; constructor(index: string, collection: string, normalized: JSONObject); } export declare class Koncorde { private filterIdIndexMap; private koncorde; constructor(options?: JSONObject); /** * Utility method converting a distance value to meters. * * @param {string} distance * @return {number} */ static convertDistance(distance: string): number; /** * Converts one of the accepted geopoint format into * a standardized version * * @param {Object} obj - object containing a geopoint * @returns {Coordinate} or null if no accepted format is found */ static convertGeopoint(point: string | JSONObject): { lat: number; lon: number; }; /** * Returns a boolean indicating if filters exist for a given index-collection * pair * * @param {string} index * @param {string} collection * @return {boolean} */ exists(index: string, collection: string): boolean; /** * Returns the list of collections associated to an index registered in this * Koncorde instance * * @param {string} index * @return {string[]} */ getCollections(index: string): string[]; /** * Returns the list of filter identifiers registered on a given * index-collection pair * * @param {string} index * @param {string} collection * @return {string[]} */ getFilterIds(index: string, collection: string): string[]; /** * Returns the list of indexes registered in this Koncorde instance * * @return {string[]} */ getIndexes(): string[]; /** * Checks if a filter is registered for the given filter identifier * * @param {string} filterId * @returns {boolean} */ hasFilter(filterId: string): boolean; /** * Returns a promise resolved if the provided filter are well-formed. * The resolved object contains the provided filter in its canonical form, * along with the corresponding filter unique identifier. * * This method does not modify the internal storage. To save a filter, the * store method must be called afterward. If you do not need the filter unique * identifier prior to save a filter in the engine, then consider using the * all-in-one register method instead. * * @param {string} index * @param {string} collection * @param {JSONObject} filter * @return {NormalizedFilterV3} */ normalize(index: string, collection: string, filter: JSONObject): Promise; /** * Registers a filter to the engine instance. This method is equivalent to * executing normalize + store. * * @param {string} index * @param {string} collection * @param {JSONObject} filter * @return {JSONObject} */ register(index: string, collection: string, filter: JSONObject): Promise; /** * Removes all references to a given filter from the engine. * * @param {string} filterId */ remove(filterId: string): Promise; /** * Stores a normalized filter (obtained with normalize). * * @param {NormalizedFilterV3} normalized * @return {JSONObject} */ store(normalized: NormalizedFilterV3): Promise; /** * Test data against filters registered in the engine, returning matching * filter identifiers, if any. * * @param {string} index * @param {string} collection * @param {JSONObject} data * @param {string} id * @return {string[]} */ test(index: string, collection: string, data: JSONObject, id?: string): string[]; /** * Tests the provided filter without storing it in the engine, to check * whether it is well-formed or not. * * @param {JSONObject} filter */ validate(filter: JSONObject): Promise; }