import { Kysely } from 'kysely'; import { type MigrateResult } from './db-migrator.js'; import { type CodegenResult } from './db-codegen.js'; import { type ZodCodegenResult } from './zod-codegen.js'; import { type SeedResult } from './sqlite/seed.js'; import type { UserConfigShape } from '../commands/db-shared.js'; interface ResolvedDbBase { rootDir: string; migrationsDir: string; schemaFile: string; coercionFile: string; manifestFile: string; classificationMapFile: string; schemaJsonFile: string; classificationsFile: string; classificationsGenJsonFile: string; enumsFile: string; zodFile: string; camelCase: boolean; } export interface ResolvedSqliteDb extends ResolvedDbBase { dialect: 'sqlite'; dbFile: string; runtimeDir: string; seedFile: string; } export interface ResolvedPostgresDb extends ResolvedDbBase { dialect: 'postgres'; mode: 'url' | 'pglite'; connectionString?: string; pgliteDir?: string; runtimeDir: string; seedFile: string; } export type ResolvedDb = ResolvedSqliteDb | ResolvedPostgresDb; /** * Parse a DATABASE_URL string into the subset of UserConfigShape that resolveDb understands. * - postgres(ql):// → { postgresUrl } * - libsql:// or http(s):// → {} (remote, not handled by the CLI layer) * - anything else → { sqliteDb } (local file path) */ export declare function parseDatabaseUrl(url: string): Pick; /** * Resolve a UserConfigShape into an absolute-path descriptor. * Returns null when neither sqliteDb nor postgresUrl is configured. */ export declare function resolveDb(userConfig: UserConfigShape, rootDir: string, outDir: string, runtimeDir?: string): ResolvedDb | null; /** @deprecated Use resolveDb(userConfig, ...) instead. */ export declare function resolveLocalDb(sqliteDb: string | undefined, rootDir: string, outDir: string, runtimeDir?: string): ResolvedSqliteDb | null; export interface MigrateAndCodegenOutcome { migrate: MigrateResult; codegen: CodegenResult; zod: ZodCodegenResult; classificationsScaffolded: boolean; classificationsJsonWritten: boolean; } export declare function migrateAndCodegen(resolved: ResolvedDb): Promise; export declare function seed(resolved: ResolvedDb): Promise; export declare function reset(resolved: ResolvedDb, rootDir: string): Promise; export declare function createKysely(resolved: ResolvedDb): Promise>; type SchemaMap = Map>; export interface DesiredAuthSchema { tables: SchemaMap; sql: string; } export declare function desiredAuthSchema(resolved: ResolvedDb, rootDir: string, srcDirectories: string[], logger: { error: (msg: string) => void; }): Promise; export declare function introspectSchema(resolved: ResolvedDb): Promise; export interface AuthDriftResult { hasAuth: boolean; inSync: boolean; missingTables: string[]; missingColumns: { table: string; columns: string[]; }[]; } export declare function computeAuthDrift(resolved: ResolvedDb, rootDir: string, srcDirectories: string[], logger: { error: (msg: string) => void; }): Promise; export interface GenerateAuthResult { status: 'no-auth' | 'up-to-date' | 'written' | 'incremental-unsupported'; file?: string; missingTables?: string[]; missingColumns?: { table: string; columns: string[]; }[]; } export declare function generateAuthMigration(resolved: ResolvedDb, rootDir: string, srcDirectories: string[], logger: { error: (msg: string) => void; }): Promise; export {};