import type { PostgresClient } from "@databricks/sdk-postgres/v1"; export type DatabricksPostgresClient = Pick; export interface LakebaseClient { query>(sql: string, params?: unknown[]): Promise<{ rows: T[]; }>; end(): Promise; /** `pg.Pool` emits idle-client failures here; callers may observe them without crashing Node. */ on?(event: "error", listener: (error: Error) => void): unknown; } export interface LakebasePoolConfig { host: string; port: number; database: string; user: string; password: string | (() => string | Promise); ssl?: boolean | { rejectUnauthorized?: boolean; }; max?: number; } export type LakebasePoolFactory = (config: LakebasePoolConfig) => LakebaseClient; export interface LakebaseCredentialProviderOptions { client: DatabricksPostgresClient; /** Full endpoint resource name: projects/.../branches/.../endpoints/.... */ endpoint: string; /** Refresh this long before expiry. Default five minutes. */ refreshBeforeMs?: number; /** Additional randomized early-refresh window. Default thirty seconds. */ refreshJitterMs?: number; now?: () => number; random?: () => number; } /** * Exchange a workspace OAuth token for a Lakebase database credential. The * result is cached, refreshed early with jitter, and refreshes are single-flight. */ export declare function lakebaseCredentialProvider(options: LakebaseCredentialProviderOptions): () => Promise; export interface LakebaseClientOptions { host: string; database: string; user: string; /** Direct database password. Intended for local Postgres/testing, not workspace OAuth. */ password?: string | (() => string | Promise); /** Native Databricks Postgres client used for OAuth database credential exchange. */ credentialClient?: DatabricksPostgresClient; endpoint?: string; refreshBeforeMs?: number; refreshJitterMs?: number; port?: number; ssl?: boolean | { rejectUnauthorized?: boolean; }; max?: number; poolFactory?: LakebasePoolFactory; /** Observe recoverable idle pooled-connection failures. */ onPoolError?: (error: Error) => void; } export declare function lakebaseClient(options: LakebaseClientOptions): LakebaseClient; //# sourceMappingURL=lakebase.d.ts.map