import * as v from '../../../../../../shared/src/valita.ts';
import { type ShardConfig } from '../../../../types/shards.ts';
export declare const PROTOCOL_VERSION = 1;
export declare const ddlEventSchema: v.ObjectType<Omit<{
    context: v.ObjectType<{
        query: v.Type<string>;
    }, v.Type<string>>;
}, "schema" | "version"> & {
    version: v.Type<1>;
    schema: v.ObjectType<Omit<{
        tables: v.ArrayType<v.ObjectType<Omit<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>;
        }, "publications" | "columns" | "oid" | "replicaIdentity"> & {
            oid: v.Type<number>;
            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;
                typeOID: number;
            }>>;
            replicaIdentity: v.Optional<"n" | "d" | "f" | "i">;
            publications: v.Type<Record<string, {
                rowFilter: string | null;
            }>>;
        }, undefined>>;
    }, "indexes"> & {
        indexes: v.ArrayType<v.ObjectType<Omit<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>;
        }, "isReplicaIdentity" | "isImmediate"> & {
            isReplicaIdentity: v.Optional<boolean>;
            isImmediate: v.Optional<boolean>;
        }, undefined>>;
    }, undefined>;
}, undefined>;
export declare const ddlStartEventSchema: v.ObjectType<Omit<Omit<{
    context: v.ObjectType<{
        query: v.Type<string>;
    }, v.Type<string>>;
}, "schema" | "version"> & {
    version: v.Type<1>;
    schema: v.ObjectType<Omit<{
        tables: v.ArrayType<v.ObjectType<Omit<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>;
        }, "publications" | "columns" | "oid" | "replicaIdentity"> & {
            oid: v.Type<number>;
            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;
                typeOID: number;
            }>>;
            replicaIdentity: v.Optional<"n" | "d" | "f" | "i">;
            publications: v.Type<Record<string, {
                rowFilter: string | null;
            }>>;
        }, undefined>>;
    }, "indexes"> & {
        indexes: v.ArrayType<v.ObjectType<Omit<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>;
        }, "isReplicaIdentity" | "isImmediate"> & {
            isReplicaIdentity: v.Optional<boolean>;
            isImmediate: v.Optional<boolean>;
        }, undefined>>;
    }, undefined>;
}, "type"> & {
    type: v.Type<"ddlStart">;
}, undefined>;
export type DdlStartEvent = v.Infer<typeof ddlStartEventSchema>;
/**
 * The {@link DdlUpdateEvent} contains an updated schema resulting from
 * a particular ddl event. The event type provides information
 * (i.e. constraints) on the difference from the schema of the preceding
 * {@link DdlStartEvent}.
 *
 * Note that in almost all cases (the exception being `CREATE` events),
 * it is possible that there is no relevant difference between the
 * ddl-start schema and the ddl-update schema, as many aspects of the
 * schema (e.g. column constraints) are not relevant to downstream
 * replication.
 */
export declare const ddlUpdateEventSchema: v.ObjectType<Omit<Omit<{
    context: v.ObjectType<{
        query: v.Type<string>;
    }, v.Type<string>>;
}, "schema" | "version"> & {
    version: v.Type<1>;
    schema: v.ObjectType<Omit<{
        tables: v.ArrayType<v.ObjectType<Omit<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>;
        }, "publications" | "columns" | "oid" | "replicaIdentity"> & {
            oid: v.Type<number>;
            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;
                typeOID: number;
            }>>;
            replicaIdentity: v.Optional<"n" | "d" | "f" | "i">;
            publications: v.Type<Record<string, {
                rowFilter: string | null;
            }>>;
        }, undefined>>;
    }, "indexes"> & {
        indexes: v.ArrayType<v.ObjectType<Omit<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>;
        }, "isReplicaIdentity" | "isImmediate"> & {
            isReplicaIdentity: v.Optional<boolean>;
            isImmediate: v.Optional<boolean>;
        }, undefined>>;
    }, undefined>;
}, "type" | "event"> & {
    type: v.Type<"ddlUpdate">;
    event: v.ObjectType<{
        tag: v.Type<string>;
    }, undefined>;
}, undefined>;
export type DdlUpdateEvent = v.Infer<typeof ddlUpdateEventSchema>;
export declare const replicationEventSchema: v.UnionType<[v.ObjectType<Omit<Omit<{
    context: v.ObjectType<{
        query: v.Type<string>;
    }, v.Type<string>>;
}, "schema" | "version"> & {
    version: v.Type<1>;
    schema: v.ObjectType<Omit<{
        tables: v.ArrayType<v.ObjectType<Omit<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>;
        }, "publications" | "columns" | "oid" | "replicaIdentity"> & {
            oid: v.Type<number>;
            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;
                typeOID: number;
            }>>;
            replicaIdentity: v.Optional<"n" | "d" | "f" | "i">;
            publications: v.Type<Record<string, {
                rowFilter: string | null;
            }>>;
        }, undefined>>;
    }, "indexes"> & {
        indexes: v.ArrayType<v.ObjectType<Omit<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>;
        }, "isReplicaIdentity" | "isImmediate"> & {
            isReplicaIdentity: v.Optional<boolean>;
            isImmediate: v.Optional<boolean>;
        }, undefined>>;
    }, undefined>;
}, "type"> & {
    type: v.Type<"ddlStart">;
}, undefined>, v.ObjectType<Omit<Omit<{
    context: v.ObjectType<{
        query: v.Type<string>;
    }, v.Type<string>>;
}, "schema" | "version"> & {
    version: v.Type<1>;
    schema: v.ObjectType<Omit<{
        tables: v.ArrayType<v.ObjectType<Omit<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>;
        }, "publications" | "columns" | "oid" | "replicaIdentity"> & {
            oid: v.Type<number>;
            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;
                typeOID: number;
            }>>;
            replicaIdentity: v.Optional<"n" | "d" | "f" | "i">;
            publications: v.Type<Record<string, {
                rowFilter: string | null;
            }>>;
        }, undefined>>;
    }, "indexes"> & {
        indexes: v.ArrayType<v.ObjectType<Omit<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>;
        }, "isReplicaIdentity" | "isImmediate"> & {
            isReplicaIdentity: v.Optional<boolean>;
            isImmediate: v.Optional<boolean>;
        }, undefined>>;
    }, undefined>;
}, "type" | "event"> & {
    type: v.Type<"ddlUpdate">;
    event: v.ObjectType<{
        tag: v.Type<string>;
    }, undefined>;
}, undefined>]>;
export type ReplicationEvent = v.Infer<typeof replicationEventSchema>;
export declare const TAGS: readonly ["CREATE TABLE", "ALTER TABLE", "CREATE INDEX", "DROP TABLE", "DROP INDEX", "ALTER PUBLICATION", "ALTER SCHEMA"];
export declare function createEventTriggerStatements(shard: ShardConfig): string;
export declare function dropEventTriggerStatements(appID: string, shardID: string | number): string;
//# sourceMappingURL=ddl.d.ts.map