import type { DatabaseSchema } from '../schema/types'; export interface DbformFieldDef { name: string; dbType: string; inputType: string; required: boolean; maxLength?: number; enumValues?: string[]; foreignKey?: { table: string; displayField: string; }; primaryKey?: boolean; autoGenerated?: boolean; label?: string; } export interface DbformNormalizedSchema { table: string; fields: Record; } export type DbformSchemaRegistry = Record; export interface ToDbformRegistryOptions { /** * Override the FK display field per (fromTable, column, targetTable). * Defaults to a heuristic: prefer columns named name/label/title/full_name/ * display_name on the referenced table; otherwise the first non-PK string * column; otherwise the referenced PK column. */ resolveFkDisplayField?: (fk: { fromTable: string; column: string; targetTable: string; targetColumns: string[]; }) => string | undefined; /** * Map a SQL type string to a dbform-style dbType. Defaults to a * normalizer that collapses Postgres aliases to the canonical names * dbform's default input-type registry understands * (varchar, text, int, bigint, decimal, boolean, timestamp, ...). */ mapDbType?: (sqlType: string) => string; } /** * Convert a raw introspected DatabaseSchema into a registry that * @dbform/core can consume directly. Server-managed columns are flagged * (`primaryKey`, `autoGenerated`) so dbform hides them by default. */ export declare function toDbformRegistry(schema: DatabaseSchema, options?: ToDbformRegistryOptions): DbformSchemaRegistry;