import type { AsyncClient, DisposableClient, DisposableAsyncClient, PreparedStatementParams, ResultRow, RunResult, SqlfuProjectConfig } from './types.js'; import type { QueryCatalog } from './typegen/query-catalog.js'; import type { SqlAnalysisResponse } from './ui/shared.js'; export type { DisposableAsyncClient, DisposableClient } from './types.js'; export type AdHocSqlResult = { mode: 'rows'; rows: ResultRow[]; } | { mode: 'metadata'; metadata: RunResult; }; export type AdHocSqlParams = PreparedStatementParams | undefined; export interface HostFs { readFile(path: string): Promise; writeFile(path: string, contents: string): Promise; readdir(path: string): Promise; mkdir(path: string): Promise; rm(path: string, options?: { force?: boolean; }): Promise; rename(from: string, to: string): Promise; exists(path: string): Promise; } export interface HostLogger { log(...args: unknown[]): void; warn(...args: unknown[]): void; error(...args: unknown[]): void; } export interface HostCatalog { load(config: SqlfuProjectConfig): Promise; refresh(config: SqlfuProjectConfig): Promise; analyzeSql(config: SqlfuProjectConfig, sql: string): Promise; } export interface SqlfuHost { fs: HostFs; openDb(config: SqlfuProjectConfig): Promise; openScratchDb(slug: string): Promise; execAdHocSql(client: AsyncClient, sql: string, params: AdHocSqlParams): Promise; initializeProject(input: { projectRoot: string; configContents: string; configPath?: string; }): Promise; digest(content: string): Promise; now(): Date; uuid(): string; logger: HostLogger; catalog: HostCatalog; } export type SqlfuUiHost = { openDb(config: SqlfuProjectConfig): Promise; openScratchDb?(slug: string): Promise; } & Partial>;