import type { DbAdminColumn } from "../../db-admin/types.js"; /** * Type-aware cell formatting and parsing helpers for the DB admin grid. * * These are intentionally dialect-agnostic: they look at the column's `type` * string and normalize it into one of a small set of editor "kinds" that drive * which editor UI is rendered and how values are parsed back into the mutation * payload. */ export type EditorKind = "text" | "number" | "boolean" | "json" | "timestamp" | "enum" | "uuid"; /** Sentinel meaning "store SQL NULL". */ export declare const NULL_VALUE: null; /** * Try to pull allowed enum values out of a column definition. * * The base contract column shape (`DbAdminColumn`) only carries a `type` * string, but introspection may attach extra fields per dialect. We probe a * few likely shapes and also parse a Postgres/MySQL-style inline list embedded * in the type string, e.g. `enum('a','b')`. */ export declare function inferEnumValues(col: DbAdminColumn): string[] | null; /** Infer which editor UI a column should use. */ export declare function inferEditorKind(col: DbAdminColumn): EditorKind; /** Whether a value is SQL NULL (vs empty string, 0, false, etc). */ export declare function isNull(value: unknown): boolean; /** * Format a DB value for compact in-cell display. Returns a marker the cell uses * to render NULL distinctly; for plain string consumers the text is "NULL". */ export declare function formatCellValue(value: unknown, kind: EditorKind): { text: string; isNull: boolean; }; /** Compact single-line JSON for cell display. */ export declare function formatJsonCompact(value: unknown): string; /** Pretty multi-line JSON for the expanded editor. */ export declare function formatJsonPretty(value: unknown): string; /** Human-readable timestamp; tolerant of strings, numbers, and Dates. */ export declare function formatTimestamp(value: unknown): string; /** Convert a DB value to the string an editor input should start with. */ export declare function valueToEditString(value: unknown, kind: EditorKind): string; export declare class ParseError extends Error { } /** * Parse an edited string back into the JS value sent in the mutation payload. * * `allowEmptyString` distinguishes "" → empty string from "" → NULL. For most * types empty means NULL; for text the editor decides. */ export declare function parseEditValue(raw: string, kind: EditorKind, opts?: { allowEmptyString?: boolean; }): unknown; /** Cycle a tri-state boolean: null → true → false → null. */ export declare function cycleTriStateBoolean(value: unknown): boolean | null; //# sourceMappingURL=cell-format.d.ts.map