Prometheus Entity Management API
    Preparing search index...

    Interface RegisterEntityFromSqlOptions

    schema-from-sql.ts

    Generates a JSON Schema (and registers it via registerEntityJsonSchema) directly from a Postgres CREATE TABLE statement. Lets a consumer keep latest-data/supabase/migrations/*.sql as the single source of truth for column shapes — no hand-maintained TypeScript schema duplicates.

    Deliberately regex-based: a real SQL parser is overkill for the slice of DDL we care about, and would add a non-trivial runtime dep.

    UUID, TEXT, VARCHAR() -> { type: "string" } INTEGER, INT, BIGINT, SMALLINT -> { type: "integer" } NUMERIC(), DECIMAL(*) -> { type: "number" } BOOLEAN, BOOL -> { type: "boolean" } TIMESTAMPTZ, TIMESTAMP -> { type: "string", format: "date-time" } DATE -> { type: "string", format: "date" } JSONB, JSON -> { type: "object" } TEXT[] -> { type: "array", items: { type: "string" } } anything else -> { type: "string" } + "x-warning"

    required is populated from NOT NULL columns that lack a DEFAULT. Callers can pass overrides to deep-merge a partial config (typically to narrow a JSONB column to an array, or to add enum/format hints).

    interface RegisterEntityFromSqlOptions {
        createTableSql: string;
        entityType: string;
        overrides?: Partial<EntityJsonSchemaConfig>;
    }
    Index
    createTableSql: string

    A single CREATE TABLE statement (extra DDL around it is ignored).

    entityType: string
    overrides?: Partial<EntityJsonSchemaConfig>

    Optional deep-merge overrides (overrides win).