import type { S2CellId } from '../../index.js'; /** The kind of input required to store a vector for proper indexing */ export interface VectorKey { cell: S2CellId; } /** Represents a vector store or an array */ export interface VectorStore { push: (value: V) => void; get: (index: number | S2CellId) => Promise; has: (key: number | S2CellId) => boolean | Promise; length: number; values: () => AsyncGenerator; sort: (() => void) | (() => Promise); [Symbol.asyncIterator]: () => AsyncGenerator; close: () => void; } /** A constructor for a vector store */ export type VectorStoreConstructor = new () => VectorStore; /** * # Vector Store * * ## Description * A local vector store * * ## Usage * ```ts * import { Vector } from 'gis-tools-ts'; * import type { VectorKey } from 'gis-tools-ts'; * * interface Data extends VectorKey { name: string }; * * const vec = new Vector(); * // push an entry * vec.push({ cell: 1n, name: 'test' }); * vec.push({ cell: 1n, name: 'test2' }); * // check if a key exists * vec.has(1n); // true * // get length of the store * console.log(vec.length); // 2 * * // iterate over the store * for await (const entry of vec) console.log(entry); * * // close the store * vec.close(); * ``` */ export declare class Vector implements VectorStore { #private; /** * Push a value into the store * @param value - the value to store */ push(value: V): void; /** * @param index - the position in the store to get the value from * @returns the value */ get(index: number | S2CellId): Promise; /** * Check if the key exists * @param key - the key * @returns true if the key exists */ has(key: number | S2CellId): boolean; /** @returns the length of the store */ get length(): number; /** * iterate through the values * @yields {V} - the values iterator */ values(): AsyncGenerator; /** Sort the store in place */ sort(): void; /** * iterate through the values * @returns an iterator */ [Symbol.asyncIterator](): AsyncGenerator; /** Closes the store */ close(): void; } //# sourceMappingURL=index.d.ts.map