/**
 * Data plane messages encapsulate changes that are sent by ChangeSources,
 * forwarded / fanned out to subscribers by the ChangeStreamerService, and
 * stored in the Change DB for catchup of old subscribers.
 */
import { type JSONObject } from '../../../../../../shared/src/bigint-json.ts';
import * as v from '../../../../../../shared/src/valita.ts';
import type { Satisfies } from '../../../../types/satisfies.ts';
export declare const beginSchema: v.ObjectType<{
    tag: v.Type<"begin">;
    json: v.Optional<"p" | "s">;
}, undefined>;
export declare const commitSchema: v.ObjectType<{
    tag: v.Type<"commit">;
}, undefined>;
export declare const rollbackSchema: v.ObjectType<{
    tag: v.Type<"rollback">;
}, undefined>;
export declare const relationSchema: v.ObjectType<{
    schema: v.Type<string>;
    name: v.Type<string>;
    keyColumns: v.ArrayType<v.Type<string>>;
    replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
}, undefined>;
export declare const rowSchema: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
export declare const insertSchema: v.ObjectType<{
    tag: v.Type<"insert">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    new: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>;
export declare const updateSchema: v.ObjectType<{
    tag: v.Type<"update">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    key: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue> | null>;
    new: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>;
export declare const deleteSchema: v.ObjectType<{
    tag: v.Type<"delete">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    key: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>;
export declare const truncateSchema: v.ObjectType<{
    tag: v.Type<"truncate">;
    relations: v.ArrayType<v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>>;
}, undefined>;
declare const identifierSchema: v.ObjectType<{
    schema: v.Type<string>;
    name: v.Type<string>;
}, undefined>;
export type Identifier = v.Infer<typeof identifierSchema>;
export declare const createTableSchema: v.ObjectType<{
    tag: v.Type<"create-table">;
    spec: v.ObjectType<Omit<{
        name: v.Type<string>;
        columns: v.Type<Record<string, {
            pgTypeClass?: "e" | "b" | "d" | "c" | "p" | "r" | "m" | undefined;
            elemPgTypeClass?: "e" | "b" | "d" | "c" | "p" | "r" | "m" | null | undefined;
            characterMaximumLength?: number | null | undefined;
            notNull?: boolean | null | undefined;
            dflt?: string | null | undefined;
            pos: number;
            dataType: string;
        }>>;
        primaryKey: v.Optional<string[]>;
    }, "schema"> & {
        schema: v.Type<string>;
    }, undefined>;
}, undefined>;
export declare const renameTableSchema: v.ObjectType<{
    tag: v.Type<"rename-table">;
    old: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    new: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>;
export declare const addColumnSchema: v.ObjectType<{
    tag: v.Type<"add-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    column: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
}, undefined>;
export declare const updateColumnSchema: v.ObjectType<{
    tag: v.Type<"update-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    old: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
    new: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
}, undefined>;
export declare const dropColumnSchema: v.ObjectType<{
    tag: v.Type<"drop-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    column: v.Type<string>;
}, undefined>;
export declare const dropTableSchema: v.ObjectType<{
    tag: v.Type<"drop-table">;
    id: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>;
export declare const createIndexSchema: v.ObjectType<{
    tag: v.Type<"create-index">;
    spec: v.ObjectType<Omit<{
        name: v.Type<string>;
        tableName: v.Type<string>;
        unique: v.Type<boolean>;
        columns: v.Type<Record<string, "ASC" | "DESC">>;
    }, "schema"> & {
        schema: v.Type<string>;
    }, undefined>;
}, undefined>;
export declare const dropIndexSchema: v.ObjectType<{
    tag: v.Type<"drop-index">;
    id: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>;
export type MessageBegin = v.Infer<typeof beginSchema>;
export type MessageCommit = v.Infer<typeof commitSchema>;
export type MessageRollback = v.Infer<typeof rollbackSchema>;
export type MessageRelation = v.Infer<typeof relationSchema>;
export type MessageInsert = v.Infer<typeof insertSchema>;
export type MessageUpdate = v.Infer<typeof updateSchema>;
export type MessageDelete = v.Infer<typeof deleteSchema>;
export type MessageTruncate = v.Infer<typeof truncateSchema>;
export type TableCreate = v.Infer<typeof createTableSchema>;
export type TableRename = v.Infer<typeof renameTableSchema>;
export type ColumnAdd = v.Infer<typeof addColumnSchema>;
export type ColumnUpdate = v.Infer<typeof updateColumnSchema>;
export type ColumnDrop = v.Infer<typeof dropColumnSchema>;
export type TableDrop = v.Infer<typeof dropTableSchema>;
export type IndexCreate = v.Infer<typeof createIndexSchema>;
export type IndexDrop = v.Infer<typeof dropIndexSchema>;
export declare const dataChangeSchema: v.UnionType<[v.ObjectType<{
    tag: v.Type<"insert">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    new: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"update">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    key: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue> | null>;
    new: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"delete">;
    relation: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>;
    key: v.Type<Record<string, import("../../../../../../shared/src/bigint-json.ts").JSONValue>>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"truncate">;
    relations: v.ArrayType<v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
        keyColumns: v.ArrayType<v.Type<string>>;
        replicaIdentity: v.Optional<"default" | "nothing" | "full" | "index">;
    }, undefined>>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"create-table">;
    spec: v.ObjectType<Omit<{
        name: v.Type<string>;
        columns: v.Type<Record<string, {
            pgTypeClass?: "e" | "b" | "d" | "c" | "p" | "r" | "m" | undefined;
            elemPgTypeClass?: "e" | "b" | "d" | "c" | "p" | "r" | "m" | null | undefined;
            characterMaximumLength?: number | null | undefined;
            notNull?: boolean | null | undefined;
            dflt?: string | null | undefined;
            pos: number;
            dataType: string;
        }>>;
        primaryKey: v.Optional<string[]>;
    }, "schema"> & {
        schema: v.Type<string>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"rename-table">;
    old: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    new: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"add-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    column: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"update-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    old: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
    new: v.ObjectType<{
        name: v.Type<string>;
        spec: v.ObjectType<{
            pos: v.Type<number>;
            dataType: v.Type<string>;
            pgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m">;
            elemPgTypeClass: v.Optional<"e" | "b" | "d" | "c" | "p" | "r" | "m" | null>;
            characterMaximumLength: v.Optional<number | null>;
            notNull: v.Optional<boolean | null>;
            dflt: v.Optional<string | null>;
        }, undefined>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"drop-column">;
    table: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
    column: v.Type<string>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"drop-table">;
    id: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"create-index">;
    spec: v.ObjectType<Omit<{
        name: v.Type<string>;
        tableName: v.Type<string>;
        unique: v.Type<boolean>;
        columns: v.Type<Record<string, "ASC" | "DESC">>;
    }, "schema"> & {
        schema: v.Type<string>;
    }, undefined>;
}, undefined>, v.ObjectType<{
    tag: v.Type<"drop-index">;
    id: v.ObjectType<{
        schema: v.Type<string>;
        name: v.Type<string>;
    }, undefined>;
}, undefined>]>;
export type DataChange = Satisfies<JSONObject, // guarantees serialization over IPC or network
v.Infer<typeof dataChangeSchema>>;
export type Change = MessageBegin | DataChange | MessageCommit | MessageRollback;
export type ChangeTag = Change['tag'];
export {};
//# sourceMappingURL=data.d.ts.map