/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare class BlobFile { size(): bigint read(maxBytes?: bigint | undefined | null, signal?: AbortSignal | undefined | null): Promise readRange(start: bigint, end: bigint, signal?: AbortSignal | undefined | null): Promise readRanges(ranges: Array, signal?: AbortSignal | undefined | null): Promise> seek(position: bigint): Promise tell(): Promise close(): Promise isClosed(): boolean } export declare class BranchContents { parentBranch?: string parentVersion: number manifestSize: number } export declare class Branches { list(): Promise> create(name: string, fromRef?: string | undefined | null, fromVersion?: number | undefined | null): Promise checkout(name: string, version?: number | undefined | null): Promise
delete(name: string): Promise diff(fromBranch: string): Promise> cherryPick(fromBranch: string, dryRun?: boolean | undefined | null): Promise> } export declare class Catalog { static new(endpoint: string, options: CatalogOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise get uri(): string createDatabase(name: string, existOk?: boolean | undefined | null): Promise connectDatabase(name: string): Promise dropDatabase(name: string, ignoreMissing?: boolean | undefined | null): Promise listDatabases(limit?: number | undefined | null, pageToken?: string | undefined | null): Promise } export declare class Connection { /** Create a new Connection instance from the given URI. */ static new(uri: string, options: ConnectionOptions, headerProvider?: JsHeaderProvider | undefined | null): Promise /** Create a new Connection instance backed by a namespace implementation. */ static newWithNamespace(implName: string, properties: Record, options: ConnectNamespaceOptions): Promise display(): string isOpen(): boolean close(): void /** List all tables in the dataset. */ tableNames(namespacePath?: Array | undefined | null, startAfter?: string | undefined | null, limit?: number | undefined | null): Promise> /** List a page of tables in the database. */ listTables(namespacePath?: Array | undefined | null, pageToken?: string | undefined | null, limit?: number | undefined | null): Promise /** * 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 | undefined | null, storageOptions?: Record | undefined | null): Promise
createEmptyTable(name: string, schemaBuf: Buffer, mode: string, namespacePath?: Array | undefined | null, storageOptions?: Record | undefined | null): Promise
createMaterializedView(name: string, source: string, projections: Array> | undefined | null, filter: string | undefined | null, limit: number | undefined | null, withNoData: boolean): Promise
openMaterializedView(name: string): Promise
listMaterializedViews(): Promise> /** Drop a materialized view. */ dropMaterializedView(name: string, namespacePath?: Array | undefined | null): Promise /** Create a view: a named query planned on every read. */ createView(name: string, query: string, namespacePath?: Array | undefined | null): Promise /** What the database records about one view. */ describeView(name: string, namespacePath?: Array | undefined | null): Promise /** * Drop a view and wait for its definition to be deleted. The tables it * reads are untouched. */ dropView(name: string, namespacePath?: Array | undefined | null): Promise /** Start dropping a view and return the job deleting its definition. */ dropViewAsync(name: string, namespacePath?: Array | undefined | null): Promise /** The names of the views in one namespace. */ listViews(namespacePath?: Array | undefined | null): Promise> /** Start dropping a materialized view and return its cleanup job. */ dropMaterializedViewAsync(name: string, namespacePath?: Array | undefined | null): Promise openTable(name: string, namespacePath?: Array | undefined | null, storageOptions?: Record | undefined | null, indexCacheSize?: number | undefined | null): Promise
cloneTable(targetTableName: string, sourceUri: string, targetNamespacePath: Array | undefined | null, sourceVersion: number | undefined | null, sourceTag: string | undefined | null, isShallow: boolean): Promise
/** Drop table with the name. Or raise an error if the table does not exist. */ dropTable(name: string, namespacePath?: Array | undefined | null): Promise /** Start dropping a table and return its cleanup job. */ dropTableAsync(name: string, namespacePath?: Array | undefined | null): Promise dropAllTables(namespacePath?: Array | undefined | null): Promise /** * Open a server-side job by id, returning a handle with its record * already populated. Rejects when the server has no such job. * * The returned handle answers for its own state, specification, result, * failure and event history, so there is no separate connection-level * call for any of them. */ openJob(jobId: string): Promise /** List server-side jobs across the database's tables. */ listJobs(): Promise> /** * Request cancellation of a server-side job by id. Returns true if the * server accepted the cancellation, false if no such job exists. */ cancelJob(jobId: string): Promise /** * Pause a server-side job by id: its workers drain and it stays parked * until resumed. Returns "pausing", "already_paused", or "committing". */ pauseJob(jobId: string): Promise /** * Resume a paused server-side job by id. Returns "resumed", * "still_pausing", or "not_paused". */ resumeJob(jobId: string): Promise /** Describe a namespace and return its properties. */ describeNamespace(namespacePath: Array): Promise /** List child namespaces under the given namespace path */ listNamespaces(namespacePath?: Array | undefined | null, pageToken?: string | undefined | null, limit?: number | undefined | null): Promise /** Create a new namespace with optional properties. */ createNamespace(namespacePath: Array, mode?: string | undefined | null, properties?: Record | undefined | null): Promise /** Drop a namespace. */ dropNamespace(namespacePath: Array, mode?: string | undefined | null, behavior?: string | undefined | null): Promise /** * 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 | undefined | null, newNamespacePath?: Array | undefined | null): Promise } 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, customStopWords?: Array | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null, blockSize?: number | 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 } /** A handle to an operation that may still be running. */ export declare class Job { /** * Identifies the operation on the server that is running it. Operations * that run in this process have no server id. The value is opaque. */ get id(): string | null /** * The operation's current lifecycle state: "running", "finished", * "failed", or "cancelled". * * A point snapshot; unlike {@link Job.wait} it does not block or reject * on a terminal failure state. States a newer server reports that this * client version does not know pass through as-is. */ status(): Promise /** Wait until the operation reaches a terminal state. */ wait(): Promise /** Request cancellation. Cancelling a finished operation is a no-op. */ cancel(): Promise /** * Ask the backend for this job's current state, and for a server-side job * its full record, then cache it for the getters below. * * They are all null until this runs, because submitting an operation * returns only a job id. {@link Job.status} fetches the whole record too; * {@link Job.wait} records only the terminal state it establishes. */ refresh(): Promise /** The last observed lifecycle state, without contacting the backend. */ get state(): string | null /** * The job's type, as the server names it. Null for an in-process job, * which has no server-side record. */ get jobType(): string | null /** When the job was created, in milliseconds since the epoch. */ get creationMs(): number | null /** The job-type-specific specification as a JSON string, when present. */ get specJson(): string | null /** * The job-type-specific terminal result as a JSON string. Null until the * job succeeds, so a job that never terminates reports its progress * through {@link Job.events} instead. */ get resultJson(): string | null /** Why the job failed, when it failed and the server reports a reason. */ get failure(): JobFailureInfo | null /** * This job's recorded lifecycle events, as an Arrow IPC stream buffer. * The TypeScript wrapper turns it into an Arrow table. */ events(limit?: number | undefined | null, filter?: string | undefined | null): Promise } 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, boosts: Array | 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>) } /** * 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) } /** 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 useLsm(enable: boolean): NativeMergeInsertBuilder validateSingleShard(validateSingleShard: boolean): NativeMergeInsertBuilder execute(buf: Buffer): Promise } /** * Explicit OAuth session lifecycle for the persistent token cache: eager * `login`, non-secret `status`, and local `logout`. * * A session is built from the same `OAuthConfig` used to connect (including * its `tokenCache` options). A connection created with the same * configuration shares the cache, so logging in here prepares tokens for * later processes without any database request. */ export declare class OAuthSession { /** * Create a session manager for the given OAuth configuration. * * The configuration must enable `tokenCache` options and use a flow that * supports persistent sessions (authorization code or device code). */ constructor(config: OAuthConfig) /** * Eagerly run the configured authentication flow and store the session. * * A successful login always replaces any prior cached session for this * identity; if the provider does not issue a refresh token (for example * without `offline_access`), the previous record is removed and the * status reports `refreshable == false`. */ login(): Promise /** * Report whether a matching cached session exists, with safe metadata. * * This never contacts the identity provider and never exposes token * values. */ status(): Promise /** * Remove the matching local cached credential. * * This only deletes the local cache entry. It does not revoke the * refresh token with the provider and does not sign out of a browser * SSO session. Repeated calls succeed; `removed` reports whether a * credential existed. */ logout(): Promise } 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
} export declare class Query { onlyIf(predicate: string): void fullTextSearch(query: object): void select(columns: Array<[string, string]>): void selectColumns(columns: Array): void limit(limit: number): void offset(offset: number): void nearestTo(vector: Float32Array): VectorQuery nearestToRaw(data: Uint8Array, dtype: string): VectorQuery fastSearch(): void withRowId(): void useLsm(enable: boolean): void orderBy(ordering?: Array | undefined | null): void outputSchema(): Promise execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise explainPlan(verbose: boolean): Promise analyzePlan(distributedMetrics?: string | undefined | null): Promise } /** Typescript-style Async Iterator over RecordBatches */ export declare class RecordBatchIterator { next(): Promise } /** Wrapper around rust RRFReranker */ export declare class RrfReranker { static tryNew(k: Float32Array): Promise rerankHybrid(query: string, vecResults: Buffer, ftsResults: Buffer): Promise } 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 add(buf: Buffer, mode: string, progressCallback?: (progress: WriteProgressInfo) => void, allowExternalBlobOutsideBases?: boolean): Promise countRows(filter?: string | undefined | null): Promise delete(predicate: string): Promise createIndex(index: Index | undefined | null, column: string, replace?: boolean | undefined | null, waitTimeoutS?: number | undefined | null, name?: string | undefined | null, train?: boolean | undefined | null): Promise createIndexAsync(index: Index | undefined | null, column: string, replace?: boolean | undefined | null, waitTimeoutS?: number | undefined | null, name?: string | undefined | null, train?: boolean | undefined | null): Promise dropIndex(indexName: string): Promise prewarmIndex(indexName: string): Promise prewarmData(columns?: Array | undefined | null): Promise waitForIndex(indexNames: Array, timeoutS: number): Promise stats(): Promise initialStorageOptions(): Promise | null> latestStorageOptions(): Promise | null> update(onlyIf: string | undefined | null, columns: Array<[string, string]>): Promise query(): Query /** Return a read-only table handle pinned to the current query revision. */ querySnapshot(): Promise
takeOffsets(offsets: Array): TakeQuery takeRowIds(rowIds: Array): TakeQuery blobColumns(): Promise> fetchBlobs(column: string, rowIds: Array, signal?: AbortSignal | undefined | null): Promise> fetchBlobFiles(column: string, rowIds: Array, signal?: AbortSignal | undefined | null): Promise> vectorSearch(vector: Float32Array): VectorQuery addColumns(transforms: Array): Promise addComputedColumns(columns: Array): Promise refreshColumn(column: string): Promise refreshColumnAsync(column: string): Promise functionErrors(options?: FunctionErrorsOptions | undefined | null): Promise refreshMaterializedView(full?: boolean | undefined | null, sourceVersion?: number | undefined | null): Promise materializedViewDefinition(): Promise addColumnsWithSchema(schemaBuf: Buffer): Promise alterColumns(alterations: Array): Promise updateFieldMetadata(updates: Array): Promise dropColumns(columns: Array): Promise setUnenforcedPrimaryKey(columns: Array): Promise setLsmWriteSpec(spec: LsmWriteSpec): Promise unsetLsmWriteSpec(): Promise getLsmWriteSpec(): Promise closeLsmWriters(): Promise flushLsm(): Promise compactLsm(): Promise checkpointLsm(): Promise getLsmStats(includeGenerationRows: boolean): Promise version(): Promise checkoutCurrent(): Promise
checkout(version: number): Promise checkoutTag(tag: string): Promise checkoutLatest(): Promise listVersions(): Promise> restore(): Promise tags(): Promise branches(): Promise /** The branch this handle is scoped to, or `null` for the main branch. */ currentBranch(): string | null optimize(beforeTimestampMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise listIndices(): Promise> tokenize(query: string, column?: string | undefined | null, indexName?: string | undefined | null): Promise> indexStats(indexName: string): Promise mergeInsert(on: Array): NativeMergeInsertBuilder usesV2ManifestPaths(): Promise migrateManifestPathsV2(): Promise } export declare class TagContents { version: number manifestSize: number } export declare class Tags { list(): Promise> getVersion(tag: string): Promise create(tag: string, version: number): Promise delete(tag: string): Promise update(tag: string, version: number): Promise } export declare class TakeQuery { select(columns: Array<[string, string]>): void selectColumns(columns: Array): void withRowId(): void useLsm(enable: boolean): void outputSchema(): Promise execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise explainPlan(verbose: boolean): Promise analyzePlan(distributedMetrics?: string | undefined | null): Promise } 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): void limit(limit: number): void offset(offset: number): void fastSearch(): void withRowId(): void useLsm(enable: boolean): void rerank(rerankHybrid: (arg: RerankHybridCallbackArgs) => Promise): void orderBy(ordering?: Array | undefined | null): void outputSchema(): Promise execute(maxBatchLength?: number | undefined | null, timeoutMs?: number | undefined | null): Promise explainPlan(verbose: boolean): Promise analyzePlan(distributedMetrics?: string | undefined | null): Promise } 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 BlobRange { start: bigint end: bigint } /** * Live state of one bucket. A table is N buckets on one node; flattening to a * single number hides the one hot bucket that is usually why someone opened * this endpoint. */ export interface BucketStats { /** The shard this bucket writes. */ shardId: string /** `"Active"` or `"Sealed"` (drop-table 2PC in flight). */ status: string /** Epoch of the writer that currently owns the shard. */ writerEpoch: number /** Version of the shard manifest these numbers were read from. */ manifestVersion: number /** The generation the active memtable will become. */ currentGeneration: number /** WAL position replay resumes from. */ replayAfterWalEntryPosition: number /** * Highest WAL position the writer has seen. The difference against * `replayAfterWalEntryPosition` is the WAL lag. */ walEntryPositionLastSeen: number /** Flushed L0 generations not yet merged into the base table. */ generations: Array /** * Whether a pass owns this bucket's compaction latch right now. Says *a* * driver is running, not *whose*, and the latch is held from dispatch — * including while the pass queues for a pod-wide compactor permit. Read it * as "do not pile on", never as "mine is progressing". */ compacting: boolean /** * Oldest first, active last. Absent for a `"Sealed"` bucket, whose * in-memory state is torn down. */ memtables?: Array } export interface CatalogOptions { apiKey?: string clientConfig?: ClientConfig /** SQL service endpoint inherited by database connections. */ sqlHostOverride?: string readConsistencyInterval?: number oauthConfig?: OAuthConfig } export interface ClientConfig { userAgent?: string retryConfig?: RetryConfig timeoutConfig?: TimeoutConfig extraHeaders?: Record /** * The delimiter joining a namespace path and a name into one object * identifier. `"$"` is the only supported value, and leaving this unset is * how to get it; anything else is rejected when the connection is created. */ 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 /** * (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 /** * (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 /** Extra properties for the backing namespace client. */ namespaceClientProperties?: Record /** * The session to use for this connection. Holds shared caches and other * session-specific state. */ session?: Session } export interface CreateNamespaceResponse { properties?: Record transactionId?: string } export interface DeleteResult { numDeletedRows: number version: number } export interface DescribeNamespaceResponse { properties?: Record } export interface DropColumnsResult { version: number } export interface DropNamespaceResponse { properties?: Record transactionId?: Array } /** * 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 /** 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 token produced by the tokenizer configured on a full-text search index. */ export interface FtsToken { /** The token text after the index tokenizer has applied its filters. */ text: string /** The token position used by full-text query matching. */ position: number } /** * A fragment whose per-row error detail was capped: `rowsSkipped` rows * failed, of which only `rowsRecorded` have a record of their own. */ export interface FunctionErrorFragment { jobId: string fragmentId: number rowsSkipped: number rowsRecorded: number } /** One row a Function refresh skipped, as the server recorded it. */ export interface FunctionErrorRecord { jobId: string fragmentId: number /** * The row's offset within the fragment; absent when the fragment's * detail was capped. */ rowOffset?: number column: string function: string functionVersion: string tableVersion: number errorType: string errorMessage: string createdAtMillis: number } /** A table's per-row Function errors. */ export interface FunctionErrors { /** The recorded rows, newest job first. */ records: Array /** Fragments whose detail was capped. */ fragments: Array /** Whether the listing stopped at its limit. */ truncated: boolean } /** Which per-row Function errors to list; every filter is optional. */ export interface FunctionErrorsOptions { /** Only errors recorded by this job. */ jobId?: string /** Only errors on this column. */ column?: string /** At most this many records (server default 10000, cap 100000). */ limit?: number } /** One flushed L0 generation. */ export interface GenerationStats { /** The generation number. Increases as memtables are sealed into L0. */ generation: number /** On-disk size of the generation. */ bytes: number /** * Present only when `includeGenerationRows` was requested. Off by default * because each count opens an uncached Lance dataset. */ rows?: 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 /** * 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 } /** The server's account of why a job failed. */ export interface JobFailureInfo { phase?: string message?: string retryable?: boolean } /** A row from `Connection.listJobs`: one server-side job. */ export interface JobInfo { /** * The job id -- what `Connection.openJob` and `Connection.cancelJob` * accept. */ jobId: string /** The table the job runs against, without URI or namespace. */ table: string jobType: string /** Lifecycle state: "running", "finished", "failed", or "cancelled". */ state: string /** When the job was created, in milliseconds since the epoch. */ createdAtMillis: number } /** The catalog of described LanceDB metrics. Empty until the recorder is installed. */ export declare function lancedbMetricsCatalog(): Array export interface ListDatabasesResponse { databases: Array pageToken?: string } export interface ListNamespacesResponse { namespaces: Array pageToken?: string } export interface ListTablesResponse { tables: Array pageToken?: string } /** * Live per-bucket LSM state, as returned by `Table#getLsmStats`. * * Nothing here is derived: sums and differences (total L0 bytes, WAL lag) are * the caller's to compute. */ export interface LsmStats { /** One entry per bucket backing this table. */ buckets: Array } /** * 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 /** * Indexes the MemWAL keeps up to date. Omitted resolves every * maintainable index on install; an empty array means none. */ maintainedIndexes?: Array /** Default `ShardWriter` configuration recorded in the MemWAL index. */ writerConfigDefaults?: Record } /** One in-memory memtable. */ export interface MemtableStats { /** The generation this memtable will become once sealed. */ generation: number /** Rows currently buffered. */ rows: number /** Estimated in-memory size. */ bytes: number /** Record batches currently buffered. */ batches: number /** * Names of the indexes this memtable carries. An absent name is the whole * answer to "why is my fresh-tier search on that column brute-force". */ indexes: Array } export interface MergeResult { version: number numInsertedRows: number numUpdatedRows: number numDeletedRows: number numAttempts: number numRows: number } /** One cumulative histogram bucket: all samples with value `<= le`. */ export interface MetricBucket { /** The inclusive upper bound of the bucket, or `"+Inf"` for the final bucket. */ le: string /** Cumulative number of samples less than or equal to `le`. */ cumulativeCount: number } /** A described metric, used by the JavaScript layer to create instruments up front. */ export interface MetricDescription { name: string kind: string unit?: string description: string } /** * One aggregated metric data point. For counters and gauges only `value` is * set; for histograms `buckets` (cumulative `le` counts), `count`, and `sum` * are set. */ export interface MetricPoint { name: string kind: string attributes: Record value?: number buckets?: Array count?: number sum?: 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 /** Optional resource indicator for authorization and token requests. */ resource?: string /** Optional provider-specific audience for authorization and token requests. */ audience?: string /** * Authentication flow: "client_credentials", "authorization_code", * "device_code", or "azure_managed_identity" */ flow?: string /** Client secret (required for client_credentials). */ clientSecret?: string /** * How the client authenticates to the token endpoint: "none", * "client_secret_basic", or "client_secret_post". Defaults to * "client_secret_basic" when a client secret is set, and "none" for * public clients. */ clientAuthMethod?: string /** Loopback redirect URI for authorization_code. */ redirectUri?: string /** Port for the authorization_code loopback callback server. */ callbackPort?: number /** Whether authorization_code uses S256 PKCE (default: true). */ usePkce?: boolean /** 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 /** * Opt in to the persistent token cache so short-lived processes reuse * one session. Only refresh tokens are persisted. */ tokenCache?: TokenCacheOptions } export interface OpenTableOptions { storageOptions?: Record } /** 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 export interface RefreshColumnResult { rowsFilled: number version: number } export interface RefreshMaterializedViewResult { /** How the view was brought up to date: "rebuild", "incremental" or "no_op". */ mode: string rowsWritten: number sourceVersion: number version: number } /** * Install the LanceDB metrics recorder as the process-global `metrics` recorder. * * Returns `true` if the recorder is installed (now or previously). Returns * `false` if a *different* recorder is already installed — `metrics` allows * only one global recorder per process, so LanceDB cannot coexist with another. */ export declare function registerLancedbMetricsRecorder(): boolean /** 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 } /** Result of `OAuthSession.logout()`. */ export interface SessionLogout { /** * Whether a cached credential was removed. `false` means no matching * session was cached; logout is idempotent. */ removed: boolean } /** * Safe, non-secret view of a cached OAuth session, returned by * `OAuthSession.status()` and `OAuthSession.login()`. */ export interface SessionStatus { /** * Whether a cached session exists that can obtain tokens without * interactive authentication. */ refreshable: boolean /** Canonical issuer URL of the cached session. */ issuerUrl: string /** Client ID of the cached session. */ clientId: string /** Canonical (sorted, de-duplicated) scopes of the cached session. */ scopes: Array /** Optional resource indicator for authorization and token requests. */ resource?: string /** Optional provider-specific audience for authorization and token requests. */ audience?: string /** Flow that produced the cached session. */ flow: string /** When the cached session was obtained, as Unix seconds. */ obtainedAt?: number } export interface ShuffleOptions { seed?: number clumpSize?: number } /** * A point-in-time snapshot of every recorded metric. Empty until the recorder * is installed. */ export declare function snapshotLancedbMetrics(): Array export interface SplitCalculatedOptions { calculation: string splitNames?: Array } export interface SplitHashOptions { columns: Array splitWeights: Array discardWeight?: number splitNames?: Array } export interface SplitRandomOptions { ratios?: Array counts?: Array fixed?: number seed?: number clumpSize?: number splitNames?: Array } export interface SplitSequentialOptions { ratios?: Array counts?: Array fixed?: number splitNames?: Array } export interface TableStatistics { /** * The total size, in bytes, of the table's data files, index files, and * overlay files * * Read from the manifest, so this excludes deletion files and manifests. */ 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 } /** * Options for the persistent OAuth token cache. * * The cache is opt-in: it is only used when set as `tokenCache` on * `OAuthConfig`. Only refresh tokens are persisted, in a private directory * with owner-only permissions, so short-lived processes can reuse an * authenticated session instead of re-prompting on every start. */ export interface TokenCacheOptions { /** * Directory that holds cached credentials. Defaults to * `$XDG_CACHE_HOME/lancedb/oauth`, `$HOME/.cache/lancedb/oauth` on Unix, * or `%LOCALAPPDATA%\lancedb\oauth` on Windows. The directory is created * with owner-only permissions (`0700`) when missing. */ cacheDir?: string /** * How long to wait for the cross-process refresh lock before failing, * in seconds (default: 30). */ lockTimeoutSecs?: number } export declare function tokenize(query: string, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, customStopWords?: Array | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Array export interface UpdateFieldMetadataResult { version: number } export interface UpdateResult { rowsUpdated: number version: number } export interface Version { version: number timestamp: number metadata: Record } /** What a database records about one view. */ export interface ViewDescription { name: string namespacePath: Array query: string defaultDatabase: string defaultNamespacePath: Array /** * The view's schema as an empty Arrow IPC file, the way a table reports * its own. */ schema: Buffer } /** * 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 }