import { AdapterSchemaConfigOptions, ArrayColumn, ArrayColumnValue, BigIntColumn, BigSerialColumn, CitextColumn, Column, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, DateColumn, DecimalColumn, DoublePrecisionColumn, EnumColumn, IntegerColumn, JSONColumn, JSONTextColumn, MoneyColumn, RealColumn, SerialColumn, SmallIntColumn, SmallSerialColumn, StringColumn, StringData, TextColumn, TimestampColumn, TimestampTZColumn, VarCharColumn } from "pqb/internal"; import { ZodArray, ZodBoolean, ZodDate, ZodEnum, ZodNever, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodType, ZodTypeAny, ZodUnion, ZodUnknown, core } from "zod/v4"; declare class ZodJSONColumn extends JSONColumn { constructor(schemaConfig: ZodSchemaConfig, schema: ZodSchema, encodedByDriver?: boolean); } declare class ZodJSONTextColumn extends JSONTextColumn { constructor(schemaConfig: ZodSchemaConfig, schema: ZodSchema); } interface ArrayMethods { min(this: T, value: Value, params?: Column.Error.StringOrMessage): T; max(this: T, value: Value, params?: Column.Error.StringOrMessage): T; length(this: T, value: Value, params?: Column.Error.StringOrMessage): T; nonEmpty(this: T, params?: Column.Error.StringOrMessage): T; } interface ZodArrayColumn extends ArrayColumn, ZodArray, ZodArray>, ArrayMethods {} declare class ZodArrayColumn extends ArrayColumn, ZodArray, ZodArray> { constructor(schemaConfig: ZodSchemaConfig, item: Item); } interface NumberMethods { lt(this: T, value: number, params?: Column.Error.StringOrMessage): T; lte(this: T, value: number, params?: Column.Error.StringOrMessage): T; max(this: T, value: number, params?: Column.Error.StringOrMessage): T; gt(this: T, value: number, params?: Column.Error.StringOrMessage): T; gte(this: T, value: number, params?: Column.Error.StringOrMessage): T; min(this: T, value: number, params?: Column.Error.StringOrMessage): T; positive(this: T, params?: Column.Error.StringOrMessage): T; nonNegative(this: T, params?: Column.Error.StringOrMessage): T; negative(this: T, params?: Column.Error.StringOrMessage): T; nonPositive(this: T, params?: Column.Error.StringOrMessage): T; step(this: T, value: number, params?: Column.Error.StringOrMessage): T; int(this: T, params?: Column.Error.StringOrMessage): T; finite(this: T, params?: Column.Error.StringOrMessage): T; safe(this: T, params?: Column.Error.StringOrMessage): T; } interface SmallIntColumnZod extends SmallIntColumn, NumberMethods {} declare class SmallIntColumnZod extends SmallIntColumn {} interface IntegerColumnZod extends IntegerColumn, NumberMethods {} declare class IntegerColumnZod extends IntegerColumn {} interface RealColumnZod extends RealColumn, NumberMethods {} declare class RealColumnZod extends RealColumn {} interface SmallSerialColumnZod extends SmallSerialColumn, NumberMethods {} declare class SmallSerialColumnZod extends SmallSerialColumn {} interface SerialColumnZod extends SerialColumn, NumberMethods {} declare class SerialColumnZod extends SerialColumn {} interface StringMethods extends ArrayMethods { email(this: T, params?: Column.Error.StringOrMessage): T; url(this: T, params?: Column.Error.StringOrMessage): T; emoji(this: T, params?: Column.Error.StringOrMessage): T; uuid(this: T, params?: Column.Error.StringOrMessage): T; cuid(this: T, params?: Column.Error.StringOrMessage): T; cuid2(this: T, params?: Column.Error.StringOrMessage): T; ulid(this: T, params?: Column.Error.StringOrMessage): T; regex(this: T, value: RegExp, params?: Column.Error.StringOrMessage): T; includes(this: T, value: Value, params?: Column.Error.StringOrMessage): T; startsWith(this: T, value: Value, params?: Column.Error.StringOrMessage): T; endsWith(this: T, value: Value, params?: Column.Error.StringOrMessage): T; datetime(this: T, params?: StringData['datetime'] & Exclude): T; ipv4(this: T, params?: Exclude): T; ipv6(this: T, params?: Exclude): T; trim(this: T, params?: Column.Error.StringOrMessage): T; toLowerCase(this: T, params?: Column.Error.StringOrMessage): T; toUpperCase(this: T, params?: Column.Error.StringOrMessage): T; } interface BigIntColumnZod extends BigIntColumn, StringMethods {} declare class BigIntColumnZod extends BigIntColumn {} interface DecimalColumnZod extends DecimalColumn, StringMethods {} declare class DecimalColumnZod extends DecimalColumn {} interface DoublePrecisionColumnZod extends DoublePrecisionColumn, StringMethods {} declare class DoublePrecisionColumnZod extends DoublePrecisionColumn {} interface BigSerialColumnZod extends BigSerialColumn, StringMethods {} declare class BigSerialColumnZod extends BigSerialColumn {} interface MoneyColumnZod extends MoneyColumn, NumberMethods {} declare class MoneyColumnZod extends MoneyColumn {} interface VarCharColumnZod extends VarCharColumn, StringMethods {} declare class VarCharColumnZod extends VarCharColumn {} interface TextColumnZod extends TextColumn, StringMethods {} declare class TextColumnZod extends TextColumn {} interface StringColumnZod extends StringColumn, StringMethods {} declare class StringColumnZod extends StringColumn {} interface CitextColumnZod extends CitextColumn, StringMethods {} declare class CitextColumnZod extends CitextColumn {} interface DateMethods { min(this: T, value: Date, params?: Column.Error.StringOrMessage): T; max(this: T, value: Date, params?: Column.Error.StringOrMessage): T; } interface DateColumnZod extends DateColumn, DateMethods {} declare class DateColumnZod extends DateColumn {} interface TimestampNoTzColumnZod extends TimestampColumn, DateMethods {} declare class TimestampNoTzColumnZod extends TimestampColumn {} interface TimestampColumnZod extends TimestampTZColumn, DateMethods {} declare class TimestampColumnZod extends TimestampTZColumn {} type PointSchemaZod = ZodObject<{ srid: ZodOptional; lon: ZodNumber; lat: ZodNumber; }>; interface BareZodType { _output: unknown; } interface ZodSchemaConfig extends ColumnSchemaConfig { __schemaType: ZodTypeAny; parse(this: T, _schema: OutputSchema, fn: (input: T['__type']) => Output): Column.Parse; parseNull(this: T, _schema: NullSchema, fn: () => NullType): Column.ParseNull; encode(this: T, _schema: InputSchema, fn: (input: Input) => unknown): Column.Encode; /** * @deprecated use narrowType instead */ asType, TypeSchema extends ZodTypeAny = Types extends { type: ZodTypeAny; } ? Types['type'] : never, Type = TypeSchema['_output']>(this: T, types: Types): { [K in keyof T]: K extends '__type' ? Type : K extends '__inputType' ? Types['input'] extends ZodTypeAny ? Types['input']['_output'] : Type : K extends 'inputSchema' ? Types['input'] extends ZodTypeAny ? Types['input'] : TypeSchema : K extends '__outputType' ? Types['output'] extends ZodTypeAny ? Types['output']['_output'] : Type : K extends 'outputSchema' ? Types['output'] extends ZodTypeAny ? Types['output'] : TypeSchema : K extends '__queryType' ? Types['query'] extends ZodTypeAny ? Types['query']['_output'] : Type : K extends 'querySchema' ? Types['query'] extends ZodTypeAny ? Types['query'] : TypeSchema : T[K]; }; narrowType(this: T, type: Type): { [K in keyof T]: K extends '__inputType' ? T['__inputType'] extends never ? never : Type['_output'] : K extends '__outputType' | '__queryType' ? Type['_output'] : K extends 'inputSchema' ? T['__inputType'] extends never ? ZodNever : Type : K extends 'outputSchema' | 'querySchema' ? Type : T[K]; }; narrowAllTypes(this: T, types: Types): { [K in keyof T]: K extends '__inputType' ? Types['input'] extends BareZodType ? Types['input']['_output'] : T['__inputType'] : K extends 'inputSchema' ? Types['input'] extends BareZodType ? Types['input'] : T['inputSchema'] : K extends '__outputType' ? Types['output'] extends BareZodType ? Types['output']['_output'] : T['__outputType'] : K extends 'outputSchema' ? Types['output'] extends BareZodType ? Types['output'] : T['outputSchema'] : K extends '__queryType' ? Types['query'] extends BareZodType ? Types['query']['_output'] : T['__queryType'] : K extends 'querySchema' ? Types['query'] extends BareZodType ? Types['query'] : T['querySchema'] : T[K]; }; dateAsNumber(this: T): Column.Parse; dateAsDate(this: T): Column.Parse; enum(dataType: string, type: T): EnumColumn, T>; array(item: Item): ZodArrayColumn; nullable(this: T): Column.NullableWithSchema, T['nullSchema'] extends ZodTypeAny ? ZodUnion<[T['outputSchema'], T['nullSchema']]> : ZodNullable, ZodNullable>; json(schema?: ZodSchema): ZodJSONColumn; jsonText(schema?: ZodSchema): ZodJSONTextColumn; boolean(): ZodBoolean; buffer(): ZodType; unknown(): ZodUnknown; never(): ZodNever; stringSchema(): ZodString; stringMin(max: number): ZodString; stringMax(max: number): ZodString; stringMinMax(min: number, max: number): ZodString; number(): ZodNumber; int(): ZodNumber; stringNumberDate(): ZodDate; timeInterval(): ZodObject<{ years: ZodOptional; months: ZodOptional; days: ZodOptional; hours: ZodOptional; minutes: ZodOptional; seconds: ZodOptional; }>; bit(max: number): ZodString; uuid(): ZodString; inputSchema(this: T): MapSchema; outputSchema(this: T): MapSchema; querySchema(this: T): QuerySchema; createSchema(this: T): CreateSchema; updateSchema(this: T): UpdateSchema; pkeySchema(this: T): PkeySchema; error(this: T, error: Column.Error.Messages): T; smallint(): SmallIntColumnZod; integer(): IntegerColumnZod; real(): RealColumnZod; smallSerial(): SmallSerialColumnZod; serial(): SerialColumnZod; bigint(): BigIntColumnZod; decimal(precision?: number, scale?: number): DecimalColumnZod; doublePrecision(): DoublePrecisionColumnZod; bigSerial(): BigSerialColumnZod; money(): MoneyColumnZod; varchar(limit?: number): VarCharColumnZod; text(): TextColumnZod; string(limit?: number): StringColumnZod; citext(): CitextColumnZod; date(): DateColumnZod; timestampNoTZ(precision?: number): TimestampNoTzColumnZod; timestamp(precision?: number): TimestampColumnZod; geographyPointSchema(): PointSchemaZod; } declare const zodSchemaConfig: (options?: AdapterSchemaConfigOptions) => ZodSchemaConfig; type MapSchema = ZodObject<{ [K in keyof ColumnSchemaGetterColumns]: ColumnValidationSchema; }, core.$strip>; type TableName = T['data'] extends { table: infer Table extends string; } ? Table : T['data'] extends { name: infer Name extends string; } ? Name : never; type ColumnBrand = Column extends { data: { branded: infer Brand extends string | true; }; } ? true extends Brand ? `${Table}.${Key}` : Brand & string : never; type BrandedSchema = Schema extends ZodTypeAny ? core.$ZodBranded : Schema; type ColumnValidationSchema, Key extends 'inputSchema' | 'outputSchema' | 'querySchema', Brand extends PropertyKey = ColumnBrand[K], TableName, K & string>> = [Brand] extends [never] ? ColumnSchemaGetterColumns[K][Key] : BrandedSchema[K][Key], Brand>; type QuerySchema = ZodObject<{ [K in keyof ColumnSchemaGetterColumns]: ZodOptional>; }, core.$strip>; type CreateSchema = ZodObject<{ [K in keyof ColumnSchemaGetterColumns as ColumnSchemaGetterColumns[K]['data']['primaryKey'] extends string ? never : K]: ColumnSchemaGetterColumns[K]['data']['isNullable'] extends true ? ZodOptional> : ColumnSchemaGetterColumns[K]['data']['default'] extends true ? ZodOptional> : ColumnValidationSchema; }, core.$strip>; type UpdateSchema = ZodObject<{ [K in keyof ColumnSchemaGetterColumns as ColumnSchemaGetterColumns[K]['data']['primaryKey'] extends string ? never : K]: ZodOptional>; }, core.$strip>; type PkeySchema = ZodObject<{ [K in keyof ColumnSchemaGetterColumns as ColumnSchemaGetterColumns[K]['data']['primaryKey'] extends string ? K : never]: ColumnValidationSchema; }, core.$strip>; export { BareZodType, ZodSchemaConfig, zodSchemaConfig };