/** * Walk userland + framework-default models, return the rendered * `database/types.d.ts` content plus a structured per-table summary * the CLI can render. */ export declare function buildDatabaseSchema(options?: GenerateSchemaOptions): Promise; /** * Pure renderer — for tests that don't want to round-trip through the * model loader. */ export declare function renderDatabaseTypeFile(tables: Array<{ table: string, columns: Record }>, target?: SchemaTarget): string; export declare interface GenerateSchemaOptions { modelsDir?: string defaultsDir?: string outFile?: string dryRun?: boolean target?: SchemaTarget } export declare interface GenerateSchemaResult { outFile: string tables: Array<{ table: string, model: string, columns: Record }> errors: Array<{ file: string, error: string }> content: string } /** * The two shapes this generator can write. * * `app` augments `DatabaseSchema` from userland, which is what * `buddy generate:db-types` produces. `framework` declares `FrameworkSchema` * *inside* the database package, so the framework's own default models are typed * for the framework's own code - which is the difference between * `db.selectFrom('reviews')` answering a review and answering an unknown-valued * record that every call site then has to assert. * * They are separate interfaces rather than one merged declaration on purpose: * an app that overrides a default model must win, and declaration merging has no * notion of precedence - two declarations of the same table would be a * conflict rather than an override. */ export type SchemaTarget = 'app' | 'framework';