import { IngestStreamBuilder } from "./ingest-stream.js"; import type { AppendRowsResult, CatalogPage, DatabaseResource, IngestRequest, IngestResult, SchemaResource, StatementCancelResult, StatementRequest, StatementStatus, TableResource, TableResourceSummary } from "./protocol.js"; import type { ResultSet } from "./result.js"; import { Statement, StatementHandle } from "./statement.js"; import type { WaitOptions } from "./statement.js"; import { Table, type TableOptions } from "./table.js"; export interface RequestOptions { signal?: AbortSignal; } export interface CatalogListOptions extends RequestOptions { /** Number of resources to return. The server accepts values from 1 to 1000. */ pageSize?: number; /** Opaque token returned as `next_page_token` by the previous page. */ pageToken?: string; } export interface SchemaCatalogListOptions extends CatalogListOptions { database: string; } export interface TableCatalogListOptions extends CatalogListOptions { database: string; schema: string; } export interface SchemaReference extends RequestOptions { database: string; schema: string; } export interface TableReference extends SchemaReference { table: string; } export interface ClientOptions { fetch?: typeof globalThis.fetch; /** Default headers sent with every request. */ headers?: HeadersInit; /** * ScopeDB API key. It is sent as a Bearer credential and must only be used * from trusted server-side code. It takes precedence over `token` and an * `Authorization` value in `headers`. */ apiKey?: string; /** * Bearer token for authentication. * Equivalent to `headers: { Authorization: 'Bearer ' }`. * If `apiKey` is also provided, `apiKey` wins. * * @deprecated Use `apiKey`. */ token?: string; } export declare class Client { private readonly endpoint; private readonly fetchFn; private readonly defaultHeaders; constructor(endpoint: string | URL, options?: ClientOptions); statement(scopeql: string): Statement; statementHandle(statementId: string): StatementHandle; table(table: string, options?: TableOptions): Table; ingestStream(statement: string): IngestStreamBuilder; /** * Executes a ScopeQL statement and returns all rows. * * Shorthand for `client.statement(scopeql).execute(options)`. * * @example * const result = await client.query("FROM events SELECT * LIMIT 10"); * for (const row of result.toObjects()) { * console.log(row); * } */ query(scopeql: string, options?: WaitOptions): Promise; listDatabases(options?: CatalogListOptions): Promise>; fetchDatabase(database: string, options?: RequestOptions): Promise; listSchemas(reference: SchemaCatalogListOptions): Promise>; listSchemas(database: string, options?: CatalogListOptions): Promise>; fetchSchema(reference: SchemaReference): Promise; fetchSchema(database: string, schema: string, options?: RequestOptions): Promise; listTables(reference: TableCatalogListOptions): Promise>; listTables(database: string, schema: string, options?: CatalogListOptions): Promise>; fetchTable(reference: TableReference): Promise; fetchTable(database: string, schema: string, table: string, options?: RequestOptions): Promise; /** Iterates databases across all catalog pages. */ iterateDatabases(options?: CatalogListOptions): AsyncGenerator; /** Iterates schemas across all catalog pages. */ iterateSchemas(reference: SchemaCatalogListOptions): AsyncGenerator; iterateSchemas(database: string, options?: CatalogListOptions): AsyncGenerator; /** Iterates table summaries across all catalog pages. */ iterateTables(reference: TableCatalogListOptions): AsyncGenerator; iterateTables(database: string, schema: string, options?: CatalogListOptions): AsyncGenerator; /** @deprecated Use `client.table(name, location).append(ndjson)`. */ appendRows(database: string, schema: string, table: string, ndjson: string, options?: RequestOptions): Promise; private sendAppendRows; insert(rows: string, transform: string, options?: RequestOptions): Promise; /** @deprecated Use `client.statement(scopeql).submit()`. */ submitStatement(request: StatementRequest, options?: RequestOptions): Promise; /** @deprecated Use `client.statementHandle(id).status()` or `.wait()`. */ fetchStatement(statementId: string, options?: RequestOptions): Promise; /** @deprecated Use `client.statementHandle(id).cancel()`. */ cancelStatement(statementId: string, options?: RequestOptions): Promise; ingest(request: IngestRequest, options?: RequestOptions): Promise; private requestJson; private request; private makeUrl; private resourceUrl; private catalogUrl; } //# sourceMappingURL=client.d.ts.map