UNPKG

@lancedb/lancedb

Version:

LanceDB: A serverless, low-latency vector database for AI applications

915 lines (855 loc) 35.3 kB
/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare class BranchContents { parentBranch?: string parentVersion: number manifestSize: number } export declare class Branches { list(): Promise<Record<string, BranchContents>> create(name: string, fromRef?: string | undefined | null, fromVersion?: number | undefined | null): Promise<Table> checkout(name: string, version?: number | undefined | null): Promise<Table> delete(name: string): Promise<void> } export declare class Connection { /** Create a new Connection instance from the given URI. */ static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise<Connection> /** Create a new Connection instance backed by a namespace implementation. */ static newWithNamespace(implName: string, properties: Record<string, string>, options: ConnectNamespaceOptions): Promise<Connection> display(): string isOpen(): boolean close(): void /** List all tables in the dataset. */ tableNames(namespacePath?: Array<string> | undefined | null, startAfter?: string | undefined | null, limit?: number | undefined | null): Promise<Array<string>> /** * Create table from a Apache Arrow IPC (file) buffer. * * Parameters: * - name: The name of the table. * - buf: The buffer containing the IPC file. */ createTable(name: string, buf: Buffer, mode: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null): Promise<Table> createEmptyTable(name: string, schemaBuf: Buffer, mode: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null): Promise<Table> openTable(name: string, namespacePath?: Array<string> | undefined | null, storageOptions?: Record<string, string> | undefined | null, indexCacheSize?: number | undefined | null): Promise<Table> cloneTable(targetTableName: string, sourceUri: string, targetNamespacePath: Array<string> | undefined | null, sourceVersion: number | undefined | null, sourceTag: string | undefined | null, isShallow: boolean): Promise<Table> /** Drop table with the name. Or raise an error if the table does not exist. */ dropTable(name: string, namespacePath?: Array<string> | undefined | null): Promise<void> dropAllTables(namespacePath?: Array<string> | undefined | null): Promise<void> /** Describe a namespace and return its properties. */ describeNamespace(namespacePath: Array<string>): Promise<DescribeNamespaceResponse> /** List child namespaces under the given namespace path */ listNamespaces(namespacePath?: Array<string> | undefined | null, pageToken?: string | undefined | null, limit?: number | undefined | null): Promise<ListNamespacesResponse> /** Create a new namespace with optional properties. */ createNamespace(namespacePath: Array<string>, mode?: string | undefined | null, properties?: Record<string, string> | undefined | null): Promise<CreateNamespaceResponse> /** Drop a namespace. */ dropNamespace(namespacePath: Array<string>, mode?: string | undefined | null, behavior?: string | undefined | null): Promise<DropNamespaceResponse> /** * Rename a table. `current_namespace_path` and `new_namespace_path` default to * the root namespace when omitted; the caller is expected to either pass both * or pass neither. */ renameTable(currentName: string, newName: string, currentNamespacePath?: Array<string> | undefined | null, newNamespacePath?: Array<string> | undefined | null): Promise<void> } export declare class Index { static ivfPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, numBits?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index static ivfRq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numBits?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index static ivfFlat(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null): Index static btree(): Index static bitmap(): Index static labelList(): Index static fm(): Index static fts(withPosition?: boolean | undefined | null, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Index static hnswPq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, numSubVectors?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index static hnswSq(distanceType?: string | undefined | null, numPartitions?: number | undefined | null, maxIterations?: number | undefined | null, sampleRate?: number | undefined | null, m?: number | undefined | null, efConstruction?: number | undefined | null): Index } export declare class JsFullTextQuery { static matchQuery(query: string, column: string, boost: number, fuzziness: number | undefined | null, maxExpansions: number, operator: string, prefixLength: number): JsFullTextQuery static phraseQuery(query: string, column: string, slop: number): JsFullTextQuery static boostQuery(positive: JsFullTextQuery, negative: JsFullTextQuery, negativeBoost?: number | undefined | null): JsFullTextQuery static multiMatchQuery(query: string, columns: Array<string>, boosts: Array<number> | undefined | null, operator: string): JsFullTextQuery static booleanQuery(queries: Array<[string, JsFullTextQuery]>): JsFullTextQuery get queryType(): string } /** * JavaScript HeaderProvider implementation that wraps a JavaScript callback. * This is the only native header provider - all header provider implementations * should provide a JavaScript function that returns headers. */ export declare class JsHeaderProvider { /** Create a new JsHeaderProvider from a JavaScript callback */ constructor(getHeadersCallback: () => Promise<Record<string, string>>) } /** * A Rust-side view of a JS-constructed `Scannable`. * * Held in JS as the return value of the `Scannable` class constructor. When * passed to a consumer that accepts `impl lancedb::data::scannable::Scannable`, * the consumer invokes `scan_as_stream()` to pull batches through the JS * callback. */ export declare class NapiScannable { /** * Construct a new `NapiScannable`. * * - `schema_buf` — Arrow IPC File buffer carrying only the schema (no batches). * - `num_rows` — optional row count hint; not validated against the stream. * - `rescannable` — whether `get_next_batch` may be re-driven after the * scan completes. * - `get_next_batch` -- JS callback that yields the next batch as an Arrow * IPC Stream message wrapped in a `Buffer`, or `null` at EOF. The * `isStart` argument is `true` on the first call of each new scan; * JS uses it to discard any cached iterator before pulling. */ constructor(schemaBuf: Buffer, numRows: number | undefined | null, rescannable: boolean, getNextBatch: (arg: boolean) => Promise<Buffer | undefined | null>) } /** A builder used to create and run a merge insert operation */ export declare class NativeMergeInsertBuilder { whenMatchedUpdateAll(condition?: string | undefined | null): NativeMergeInsertBuilder whenNotMatchedInsertAll(): NativeMergeInsertBuilder whenNotMatchedBySourceDelete(filter?: string | undefined | null): NativeMergeInsertBuilder setTimeout(timeout: number): void useIndex(useIndex: boolean): NativeMergeInsertBuilder useLsmWrite(useLsmWrite: boolean): NativeMergeInsertBuilder validateSingleShard(validateSingleShard: boolean): NativeMergeInsertBuilder execute(buf: Buffer): Promise<MergeResult> } export declare class PermutationBuilder { persist(connection: Connection, tableName: string): PermutationBuilder /** Configure random splits */ splitRandom(options: SplitRandomOptions): PermutationBuilder /** Configure hash-based splits */ splitHash(options: SplitHashOptions): PermutationBuilder /** Configure sequential splits */ splitSequential(options: SplitSequentialOptions): PermutationBuilder /** Configure calculated splits */ splitCalculated(options: SplitCalculatedOptions): PermutationBuilder /** Configure shuffling */ shuffle(options: ShuffleOptions): PermutationBuilder /** Configure filtering */ filter(filter: string): PermutationBuilder /** Execute the permutation builder and create the table */ execute(): Promise<Table> } export declare class Query { onlyIf(predicate: string): void fullTextSearch(query: object): void select(columns: Array<[string, string]>): void selectColumns(columns: Array<string>): void limit(limit: number): void offset(offset: number): void nearestTo(vector: Float32Array): VectorQuery nearestToRaw(data: Uint8Array, dtype: string): VectorQuery fastSearch(): void withRowId(): void orderBy(ordering?: Array<ColumnOrdering> | undefined | null): void outputSchema(): Promise<Buffer> execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator> explainPlan(verbose: boolean): Promise<string> analyzePlan(): Promise<string> } /** Typescript-style Async Iterator over RecordBatches */ export declare class RecordBatchIterator { next(): Promise<Buffer | null> } /** Wrapper around rust RRFReranker */ export declare class RrfReranker { static tryNew(k: Float32Array): Promise<RrfReranker> rerankHybrid(query: string, vecResults: Buffer, ftsResults: Buffer): Promise<Buffer> } export type RRFReranker = RrfReranker /** * A session for managing caches and object stores across LanceDB operations. * * Sessions allow you to configure cache sizes for index and metadata caches, * which can significantly impact memory use and performance. They can * also be re-used across multiple connections to share the same cache state. */ export declare class Session { /** * Create a new session with custom cache sizes. * * # Parameters * * - `index_cache_size_bytes`: The size of the index cache in bytes. * Index data is stored in memory in this cache to speed up queries. * Defaults to 6GB if not specified. * - `metadata_cache_size_bytes`: The size of the metadata cache in bytes. * The metadata cache stores file metadata and schema information in memory. * This cache improves scan and write performance. * Defaults to 1GB if not specified. */ constructor(indexCacheSizeBytes?: bigint | undefined | null, metadataCacheSizeBytes?: bigint | undefined | null) /** * Create a session with default cache sizes. * * This is equivalent to creating a session with 6GB index cache * and 1GB metadata cache. */ static default(): Session /** Get the current size of the session caches in bytes. */ sizeBytes(): bigint /** Get the approximate number of items cached in the session. */ approxNumItems(): number } export declare class Table { name: string display(): string isOpen(): boolean close(): void /** Return Schema as empty Arrow IPC file. */ schema(): Promise<Buffer> add(buf: Buffer, mode: string, progressCallback?: (progress: WriteProgressInfo) => void): Promise<AddResult> countRows(filter?: string | undefined | null): Promise<number> delete(predicate: string): Promise<DeleteResult> createIndex(index: Index | undefined | null, column: string, replace?: boolean | undefined | null, waitTimeoutS?: number | undefined | null, name?: string | undefined | null, train?: boolean | undefined | null): Promise<void> dropIndex(indexName: string): Promise<void> prewarmIndex(indexName: string): Promise<void> prewarmData(columns?: Array<string> | undefined | null): Promise<void> waitForIndex(indexNames: Array<string>, timeoutS: number): Promise<void> stats(): Promise<TableStatistics> initialStorageOptions(): Promise<Record<string, string> | null> latestStorageOptions(): Promise<Record<string, string> | null> update(onlyIf: string | undefined | null, columns: Array<[string, string]>): Promise<UpdateResult> query(): Query takeOffsets(offsets: Array<number>): TakeQuery takeRowIds(rowIds: Array<bigint>): TakeQuery vectorSearch(vector: Float32Array): VectorQuery addColumns(transforms: Array<AddColumnsSql>): Promise<AddColumnsResult> addColumnsWithSchema(schemaBuf: Buffer): Promise<AddColumnsResult> alterColumns(alterations: Array<ColumnAlteration>): Promise<AlterColumnsResult> updateFieldMetadata(updates: Array<FieldMetadataUpdate>): Promise<UpdateFieldMetadataResult> dropColumns(columns: Array<string>): Promise<DropColumnsResult> setUnenforcedPrimaryKey(columns: Array<string>): Promise<void> setLsmWriteSpec(spec: LsmWriteSpec): Promise<void> unsetLsmWriteSpec(): Promise<void> closeLsmWriters(): Promise<void> version(): Promise<number> checkout(version: number): Promise<void> checkoutTag(tag: string): Promise<void> checkoutLatest(): Promise<void> listVersions(): Promise<Array<Version>> restore(): Promise<void> tags(): Promise<Tags> branches(): Promise<Branches> /** The branch this handle is scoped to, or `null` for the main branch. */ currentBranch(): string | null optimize(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats> listIndices(): Promise<Array<IndexConfig>> indexStats(indexName: string): Promise<IndexStatistics | null> mergeInsert(on: Array<string>): NativeMergeInsertBuilder usesV2ManifestPaths(): Promise<boolean> migrateManifestPathsV2(): Promise<void> } export declare class TagContents { version: number manifestSize: number } export declare class Tags { list(): Promise<Record<string, TagContents>> getVersion(tag: string): Promise<number> create(tag: string, version: number): Promise<void> delete(tag: string): Promise<void> update(tag: string, version: number): Promise<void> } export declare class TakeQuery { select(columns: Array<[string, string]>): void selectColumns(columns: Array<string>): void withRowId(): void outputSchema(): Promise<Buffer> execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator> explainPlan(verbose: boolean): Promise<string> analyzePlan(): Promise<string> } export declare class VectorQuery { column(column: string): void addQueryVector(vector: Float32Array): void addQueryVectorRaw(data: Uint8Array, dtype: string): void distanceType(distanceType: string): void postfilter(): void refineFactor(refineFactor: number): void nprobes(nprobe: number): void minimumNprobes(minimumNprobe: number): void maximumNprobes(maximumNprobes: number): void distanceRange(lowerBound?: number | undefined | null, upperBound?: number | undefined | null): void ef(ef: number): void bypassVectorIndex(): void onlyIf(predicate: string): void fullTextSearch(query: object): void select(columns: Array<[string, string]>): void selectColumns(columns: Array<string>): void limit(limit: number): void offset(offset: number): void fastSearch(): void withRowId(): void rerank(rerankHybrid: (arg: RerankHybridCallbackArgs) => Promise<Buffer>): void orderBy(ordering?: Array<ColumnOrdering> | undefined | null): void outputSchema(): Promise<Buffer> execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise<RecordBatchIterator> explainPlan(verbose: boolean): Promise<string> analyzePlan(): Promise<string> } export interface AddColumnsResult { version: number } /** A definition of a new column to add to a table. */ export interface AddColumnsSql { /** The name of the new column. */ name: string /** * The values to populate the new column with, as a SQL expression. * The expression can reference other columns in the table. */ valueSql: string } export interface AddResult { version: number } export interface AlterColumnsResult { version: number } export interface ClientConfig { userAgent?: string retryConfig?: RetryConfig timeoutConfig?: TimeoutConfig extraHeaders?: Record<string, string> idDelimiter?: string tlsConfig?: TlsConfig /** * User identifier for tracking purposes. * * This is sent as the `x-lancedb-user-id` header in requests to LanceDB Cloud/Enterprise. * It can be set directly, or via the `LANCEDB_USER_ID` environment variable. * Alternatively, set `LANCEDB_USER_ID_ENV_KEY` to specify another environment * variable that contains the user ID value. */ userId?: string } /** * A definition of a column alteration. The alteration changes the column at * `path` to have the new name `name`, to be nullable if `nullable` is true, * and to have the data type `data_type`. At least one of `rename` or `nullable` * must be provided. */ export interface ColumnAlteration { /** * The path to the column to alter. This is a dot-separated path to the column. * If it is a top-level column then it is just the name of the column. If it is * a nested column then it is the path to the column, e.g. "a.b.c" for a column * `c` nested inside a column `b` nested inside a column `a`. */ path: string /** * The new name of the column. If not provided then the name will not be changed. * This must be distinct from the names of all other columns in the table. */ rename?: string /** * A new data type for the column. If not provided then the data type will not be changed. * Changing data types is limited to casting to the same general type. For example, these * changes are valid: * * `int32` -> `int64` (integers) * * `double` -> `float` (floats) * * `string` -> `large_string` (strings) * But these changes are not: * * `int32` -> `double` (mix integers and floats) * * `string` -> `int32` (mix strings and integers) */ dataType?: string /** Set the new nullability. Note that a nullable column cannot be made non-nullable. */ nullable?: boolean } export interface ColumnOrdering { ascending: boolean nullsFirst: boolean columnName: string } /** Statistics about a compaction operation. */ export interface CompactionStats { /** The number of fragments removed */ fragmentsRemoved: number /** The number of new, compacted fragments added */ fragmentsAdded: number /** The number of data files removed */ filesRemoved: number /** The number of new, compacted data files added */ filesAdded: number } export interface ConnectionOptions { /** * The interval, in seconds, at which to check for updates to the table * from other processes. If None, then consistency is not checked. For * performance reasons, this is the default. For strong consistency, set * this to zero seconds. Then every read will check for updates from other * processes. As a compromise, you can set this to a non-zero value for * eventual consistency. If more than that interval has passed since the * last check, then the table will be checked for updates. Note: this * consistency only applies to read operations. Write operations are * always consistent. * * Stronger consistency is not free. The smaller the interval, the more * often each read pays the cost of checking for updates against object * storage, raising per-read latency and cost. */ readConsistencyInterval?: number /** * (For LanceDB OSS only): configuration for object storage. * * The available options are described at https://docs.lancedb.com/storage/ */ storageOptions?: Record<string, string> /** * (For LanceDB OSS only): use directory namespace manifests as the source * of truth for table metadata. Existing directory-listed root tables are * migrated into the manifest on access. */ manifestEnabled?: boolean /** * (For LanceDB OSS only): extra properties for the backing namespace * client used by manifest-enabled native connections. */ namespaceClientProperties?: Record<string, string> /** * (For LanceDB OSS only): the session to use for this connection. Holds * shared caches and other session-specific state. */ session?: Session /** (For LanceDB cloud only): configuration for the remote HTTP client. */ clientConfig?: ClientConfig /** * (For LanceDB cloud only): the API key to use with LanceDB Cloud. * * Can also be set via the environment variable `LANCEDB_API_KEY`. */ apiKey?: string /** * (For LanceDB cloud only): the region to use for LanceDB cloud. * Defaults to 'us-east-1'. */ region?: string /** * (For LanceDB cloud only): the host to use for LanceDB cloud. Used * for testing purposes. */ hostOverride?: string /** * (For LanceDB cloud only): OAuth configuration for IdP-based * authentication (e.g., Azure Entra ID). When set, token acquisition * and refresh are handled entirely in Rust. TypeScript users should pass * the public `OAuthConfig` type exported from `@lancedb/lancedb`. */ oauthConfig?: OAuthConfig } export interface ConnectNamespaceOptions { /** * The interval, in seconds, at which to check for updates to the table * from other processes. If None, then consistency is not checked. For * performance reasons, this is the default. For strong consistency, set * this to zero seconds. Then every read will check for updates from other * processes. As a compromise, you can set this to a non-zero value for * eventual consistency. */ readConsistencyInterval?: number /** * Configuration for object storage. The available options are described * at https://docs.lancedb.com/storage/ */ storageOptions?: Record<string, string> /** Extra properties for the backing namespace client. */ namespaceClientProperties?: Record<string, string> /** * The session to use for this connection. Holds shared caches and other * session-specific state. */ session?: Session } export interface CreateNamespaceResponse { properties?: Record<string, string> transactionId?: string } export interface DeleteResult { numDeletedRows: number version: number } export interface DescribeNamespaceResponse { properties?: Record<string, string> } export interface DropColumnsResult { version: number } export interface DropNamespaceResponse { properties?: Record<string, string> transactionId?: Array<string> } /** * A per-field metadata update, addressed by dot-path. Merges into the field's * existing metadata by default; a `null` value deletes a key, and `replace` * swaps the field's entire metadata map. */ export interface FieldMetadataUpdate { /** Dot-separated path to the field (e.g. "embedding" or "a.b.c"). */ path: string /** Metadata keys to set; a `null` value deletes that key. */ metadata: Record<string, string | undefined | null> /** If true, replace the field's entire metadata map instead of merging. */ replace?: boolean } export interface FragmentStatistics { /** The number of fragments in the table */ numFragments: number /** The number of uncompacted fragments in the table */ numSmallFragments: number /** Statistics on the number of rows in the table fragments */ lengths: FragmentSummaryStats } export interface FragmentSummaryStats { /** The number of rows in the fragment with the fewest rows */ min: number /** The number of rows in the fragment with the most rows */ max: number /** The mean number of rows in the fragments */ mean: number /** The 25th percentile of number of rows in the fragments */ p25: number /** The 50th percentile of number of rows in the fragments */ p50: number /** The 75th percentile of number of rows in the fragments */ p75: number /** The 99th percentile of number of rows in the fragments */ p99: number } /** A description of an index currently configured on a column */ export interface IndexConfig { /** The name of the index */ name: string /** The type of the index */ indexType: string /** * The columns in the index * * Currently this is always an array of size 1. In the future there may * be more columns to represent composite indices. */ columns: Array<string> /** * The UUID of the first segment of the index. * * `undefined` for remote tables, which do not yet surface this. */ indexUuid?: string /** * The protobuf type URL, a precise type identifier for the index. * * `undefined` for remote tables. */ typeUrl?: string /** * When the index was created. * * `undefined` for remote tables or indices created before timestamps were tracked. */ createdAt?: Date /** * The number of rows indexed, across all segments. * * `undefined` for remote tables. */ numIndexedRows?: number /** * The number of rows not yet covered by this index. * * `undefined` for remote tables. */ numUnindexedRows?: number /** * The total size in bytes of all index files across all segments. * * `undefined` for remote tables or indices without size tracking. */ sizeBytes?: number /** * The number of segments that make up the index. * * `undefined` for remote tables. */ numSegments?: number /** * The on-disk index format version. * * `undefined` for remote tables. */ indexVersion?: number /** * Index-type-specific details parsed as a JavaScript object. * * Falls back to a raw string if JSON parsing fails. `undefined` for * remote tables or when details are unavailable. */ indexDetails?: any } export interface IndexStatistics { /** The number of rows indexed by the index */ numIndexedRows: number /** The number of rows not indexed */ numUnindexedRows: number /** The type of the index */ indexType: string /** * The type of the distance function used by the index. This is only * present for vector indices. Scalar and full text search indices do * not have a distance function. */ distanceType?: string /** The number of parts this index is split into. */ numIndices?: number } export interface ListNamespacesResponse { namespaces: Array<string> pageToken?: string } /** * Specification selecting Lance's MemWAL LSM-style write path for * `mergeInsert`. * * `specType` must be `"bucket"`, `"identity"`, or `"unsharded"`. For * `"bucket"`, `column` and `numBuckets` are required; for `"identity"`, * `column` is required. */ export interface LsmWriteSpec { /** One of `"bucket"`, `"identity"`, or `"unsharded"`. */ specType: string /** Bucket and identity variants: the sharding column. */ column?: string /** Bucket variant: the number of buckets, in `[1, 1024]`. */ numBuckets?: number /** Names of indexes the MemWAL should keep up to date during writes. */ maintainedIndexes?: Array<string> /** Default `ShardWriter` configuration recorded in the MemWAL index. */ writerConfigDefaults?: Record<string, string> } export interface MergeResult { version: number numInsertedRows: number numUpdatedRows: number numDeletedRows: number numAttempts: number numRows: number } /** * OAuth configuration for LanceDB authentication. * * This is the generated napi-rs binding shape. TypeScript users should prefer * the public `OAuthConfig` type exported from `@lancedb/lancedb`. * * All token acquisition and refresh is handled in the Rust layer. */ export interface OAuthConfig { /** * OIDC issuer URL or OAuth authority URL. * For Azure: `https://login.microsoftonline.com/{tenant_id}/v2.0` */ issuerUrl: string /** Application / Client ID. */ clientId: string /** * OAuth scopes to request. For Azure managed identity, exactly one scope * or resource is required. For example: `["api://{app_id}/.default"]` */ scopes: Array<string> /** Authentication flow: "client_credentials" or "azure_managed_identity" */ flow?: string /** Client secret (required for client_credentials). */ clientSecret?: string /** Client ID for user-assigned managed identity (azure_managed_identity). */ managedIdentityClientId?: string /** * Seconds before expiry to trigger proactive refresh (default: 300). * Keep this well below the token TTL; if it is greater than or equal to * the TTL, each request refreshes the token. */ refreshBufferSecs?: number } export interface OpenTableOptions { storageOptions?: Record<string, string> } /** Statistics about an optimize operation */ export interface OptimizeStats { /** Statistics about the compaction operation */ compaction: CompactionStats /** Statistics about the removal operation */ prune: RemovalStats } /** Create a permutation builder for the given table */ export declare function permutationBuilder(table: Table): PermutationBuilder /** Statistics about a cleanup operation */ export interface RemovalStats { /** The number of bytes removed */ bytesRemoved: number /** The number of old versions removed */ oldVersionsRemoved: number } export interface RerankHybridCallbackArgs { query: string vecResults: Buffer ftsResults: Buffer } /** Retry configuration for the remote HTTP client. */ export interface RetryConfig { /** * The maximum number of retries for a request. Default is 3. You can also * set this via the environment variable `LANCE_CLIENT_MAX_RETRIES`. */ retries?: number /** * The maximum number of retries for connection errors. Default is 3. You * can also set this via the environment variable `LANCE_CLIENT_CONNECT_RETRIES`. */ connectRetries?: number /** * The maximum number of retries for read errors. Default is 3. You can also * set this via the environment variable `LANCE_CLIENT_READ_RETRIES`. */ readRetries?: number /** * The backoff factor to apply between retries. Default is 0.25. Between each retry * the client will wait for the amount of seconds: * `{backoff factor} * (2 ** ({number of previous retries}))`. So for the default * of 0.25, the first retry will wait 0.25 seconds, the second retry will wait 0.5 * seconds, the third retry will wait 1 second, etc. * * You can also set this via the environment variable * `LANCE_CLIENT_RETRY_BACKOFF_FACTOR`. */ backoffFactor?: number /** * The jitter to apply to the backoff factor, in seconds. Default is 0.25. * * A random value between 0 and `backoff_jitter` will be added to the backoff * factor in seconds. So for the default of 0.25 seconds, between 0 and 250 * milliseconds will be added to the sleep between each retry. * * You can also set this via the environment variable * `LANCE_CLIENT_RETRY_BACKOFF_JITTER`. */ backoffJitter?: number /** * The HTTP status codes for which to retry the request. Default is * [429, 500, 502, 503]. * * You can also set this via the environment variable * `LANCE_CLIENT_RETRY_STATUSES`. Use a comma-separated list of integers. */ statuses?: Array<number> } export interface ShuffleOptions { seed?: number clumpSize?: number } export interface SplitCalculatedOptions { calculation: string splitNames?: Array<string> } export interface SplitHashOptions { columns: Array<string> splitWeights: Array<number> discardWeight?: number splitNames?: Array<string> } export interface SplitRandomOptions { ratios?: Array<number> counts?: Array<number> fixed?: number seed?: number splitNames?: Array<string> } export interface SplitSequentialOptions { ratios?: Array<number> counts?: Array<number> fixed?: number splitNames?: Array<string> } export interface TableStatistics { /** The total number of bytes in the table */ totalBytes: number /** The number of rows in the table */ numRows: number /** The number of indices in the table */ numIndices: number /** Statistics on table fragments */ fragmentStats: FragmentStatistics } /** Timeout configuration for remote HTTP client. */ export interface TimeoutConfig { /** * The overall timeout for the entire request in seconds. This includes * connection, send, and read time. If the entire request doesn't complete * within this time, it will fail. Default is None (no overall timeout). * This can also be set via the environment variable `LANCE_CLIENT_TIMEOUT`, * as an integer number of seconds. */ timeout?: number /** * The timeout for establishing a connection in seconds. Default is 120 * seconds (2 minutes). This can also be set via the environment variable * `LANCE_CLIENT_CONNECT_TIMEOUT`, as an integer number of seconds. */ connectTimeout?: number /** * The timeout for reading data from the server in seconds. Default is 300 * seconds (5 minutes). This can also be set via the environment variable * `LANCE_CLIENT_READ_TIMEOUT`, as an integer number of seconds. */ readTimeout?: number /** * The timeout for keeping idle connections in the connection pool in seconds. * Default is 300 seconds (5 minutes). This can also be set via the * environment variable `LANCE_CLIENT_CONNECTION_TIMEOUT`, as an integer * number of seconds. */ poolIdleTimeout?: number } /** TLS/mTLS configuration for the remote HTTP client. */ export interface TlsConfig { /** Path to the client certificate file (PEM format) for mTLS authentication. */ certFile?: string /** Path to the client private key file (PEM format) for mTLS authentication. */ keyFile?: string /** Path to the CA certificate file (PEM format) for server verification. */ sslCaCert?: string /** Whether to verify the hostname in the server's certificate. */ assertHostname?: boolean } export interface UpdateFieldMetadataResult { version: number } export interface UpdateResult { rowsUpdated: number version: number } export interface Version { version: number timestamp: number metadata: Record<string, string> } /** * Progress snapshot for a write operation, delivered to the JS callback * passed to `Table.add`. */ export interface WriteProgressInfo { /** Number of rows written so far. */ outputRows: number /** Number of bytes written so far. */ outputBytes: number /** * Total rows expected, if the input source reports it. * Always set on the final callback (where `done` is `true`). */ totalRows?: number /** Wall-clock seconds since monitoring started. */ elapsedSeconds: number /** Number of parallel write tasks currently in flight. */ activeTasks: number /** Total number of parallel write tasks (the write parallelism). */ totalTasks: number /** `true` for the final callback; `false` otherwise. */ done: boolean }