import { z } from 'zod'; import { PodTable, InferTableData, InferInsertData, InferUpdateData } from './schema'; type GenericPodTable = PodTable; /** * 从 PodTable 生成 Zod 模式 * 支持 drizzle-zod 集成 */ export declare function createTableSchema(table: TTable, customValidations?: Record): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 创建插入数据的 Zod 模式 * 主键字段可选,必需字段必填 */ export declare function createInsertSchema(table: TTable): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 创建更新数据的 Zod 模式 * 所有字段都是可选的 */ export declare function createUpdateSchema(table: TTable): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 类型安全的表模式创建器 * 提供完整的类型推断支持 */ export declare class TableSchemaBuilder { private table; private customValidations; constructor(table: TTable); /** * 创建完整的表模式 */ get schema(): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 获取完整的表模式(兼容性方法) */ getSchema(): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 创建插入模式 */ get insert(): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 创建更新模式 */ get update(): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; /** * 添加自定义验证 */ addValidation(columnName: string, validation: z.ZodTypeAny): this; /** * 验证表数据 */ validate(data: unknown): InferTableData; /** * 验证插入数据 */ validateInsert(data: unknown): InferInsertData; /** * 验证更新数据 */ validateUpdate(data: unknown): InferUpdateData; /** * 安全解析表数据(不抛出异常) */ safeValidate(data: unknown): z.ZodSafeParseResult>; /** * 安全解析插入数据(不抛出异常) */ safeValidateInsert(data: unknown): z.ZodSafeParseResult>; /** * 安全解析更新数据(不抛出异常) */ safeValidateUpdate(data: unknown): z.ZodSafeParseResult>; } /** * 为表创建 Zod 模式构建器 */ export declare function getTableSchema(table: TTable): TableSchemaBuilder; /** * 直接获取表的 Zod schema(兼容性函数) */ export declare function getTableSchemaDirect(table: TTable): z.ZodObject<{ [x: string]: z.ZodType>; }, z.core.$strip>; export {}; //# sourceMappingURL=zod-integration.d.ts.map