/** * `useSchemaReflection` — calls the `reflect_entity_schema(p_table_name)` * Postgres RPC to discover the live column list + PK/FK metadata for a * Supabase table. Referenced by §3.6 item 4 of the master plan. * * The RPC is OPTIONAL infrastructure: if the function is not deployed the * Postgres error code is `42883` (undefined_function). In that case we * resolve to an empty column set with `rpcAvailable: false` so consumers * can degrade gracefully to the `tenant_field_definitions` path. */ import type { LooseSupabaseClient } from '../service.js'; export interface ReflectedColumn { column_name: string; data_type: string; is_nullable: boolean; is_primary: boolean; is_foreign_key: boolean; fk_table: string | null; fk_column: string | null; } export interface UseSchemaReflectionOptions { supabase: LooseSupabaseClient; tableName: string | null | undefined; schema?: string; enabled?: boolean; } export interface UseSchemaReflectionResult { columns: ReflectedColumn[]; isLoading: boolean; error: Error | null; /** * `false` iff the server returned a `42883` (undefined_function) error, * indicating the migration has not been applied. Consumers should fall * back to their `tenant_field_definitions` query in that case. */ rpcAvailable: boolean; } export declare function useSchemaReflection({ supabase, tableName, schema, enabled, }: UseSchemaReflectionOptions): UseSchemaReflectionResult; //# sourceMappingURL=useSchemaReflection.d.ts.map