import { Connection } from "./connection"; import { HeaderProvider } from "./header"; import { ListDatabasesResponse, Catalog as NativeCatalog, CatalogOptions as NativeCatalogOptions } from "./native.js"; import { OAuthConfig } from "./oauth"; /** Options shared by a catalog and the database connections it returns. */ export interface CatalogOptions extends Omit { oauthConfig?: OAuthConfig; /** Called for each request to supply authentication headers. */ headerProvider?: HeaderProvider | (() => Record | Promise>); } export type { ListDatabasesResponse } from "./native.js"; /** A remote catalog manages databases through the server's root namespace. */ export declare class Catalog { private readonly inner; /** @hidden */ constructor(inner: NativeCatalog); /** The root namespace endpoint. */ get uri(): string; /** Create a database, or open an existing database when existOk is true. */ createDatabase(name: string, options?: { existOk?: boolean; }): Promise; /** Connect to an existing database by its logical name. */ connectDatabase(name: string): Promise; /** Drop an empty database. The server rejects nonempty databases. */ dropDatabase(name: string, options?: { ignoreMissing?: boolean; }): Promise; /** List one page of databases; pass pageToken from a response for the next page. */ listDatabases(options?: { limit?: number; pageToken?: string; }): Promise; } /** * Connect to an HTTP(S) catalog endpoint. Catalog requests omit database-selection * headers; opened database connections inherit authentication and client options. * * @example * ```ts * const catalog = await connectCatalog("https://my-server.example", { apiKey: "secret" }); * const db = await catalog.createDatabase("analytics", { existOk: true }); * const page = await catalog.listDatabases({ limit: 20 }); * ``` */ export declare function connectCatalog(endpoint: string, options?: CatalogOptions): Promise;