/** * PostgreSQL Core Tools - Convenience Schemas * * Zod schemas and preprocessors for convenience operations: * Upsert, BatchInsert, Count, Exists, Truncate. */ import { z } from "zod"; import type { PostgresAdapter } from "../../postgres-adapter.js"; import { type ErrorResponse } from "../../../../types/error-types.js"; /** * Validate that a table exists before executing operations. * Throws a high-signal error instead of letting raw PostgreSQL * "relation does not exist" errors propagate. */ export declare function validateTableExists(adapter: PostgresAdapter, table: string, schema: string, transactionId?: string): Promise; /** * Preprocess table parameters: * - Alias: tableName/name → table * - Parse schema.table format */ export declare function preprocessTableParams(input: unknown): unknown; export declare const UpsertSchemaBase: z.ZodObject<{ table: z.ZodOptional; tableName: z.ZodOptional; schema: z.ZodOptional; data: z.ZodOptional>; values: z.ZodOptional>; conflictColumns: z.ZodOptional>; updateColumns: z.ZodOptional>; returning: z.ZodOptional>; }, z.core.$strip>; export declare const UpsertSchema: z.ZodPipe; tableName: z.ZodOptional; schema: z.ZodOptional; data: z.ZodOptional>; values: z.ZodOptional>; conflictColumns: z.ZodOptional>; updateColumns: z.ZodOptional>; returning: z.ZodOptional>; }, z.core.$strip>>, z.ZodTransform<{ table: string; data: Record; conflictColumns: string[]; tableName?: string | undefined; schema?: string | undefined; values?: Record | undefined; updateColumns?: string[] | undefined; returning?: string[] | undefined; }, { table?: string | undefined; tableName?: string | undefined; schema?: string | undefined; data?: Record | undefined; values?: Record | undefined; conflictColumns?: string[] | undefined; updateColumns?: string[] | undefined; returning?: string[] | undefined; }>>; export declare const BatchInsertSchemaBase: z.ZodObject<{ table: z.ZodOptional; tableName: z.ZodOptional; schema: z.ZodOptional; rows: z.ZodOptional>>; returning: z.ZodOptional>; }, z.core.$strip>; export declare const BatchInsertSchema: z.ZodPipe; tableName: z.ZodOptional; schema: z.ZodOptional; rows: z.ZodOptional>>; returning: z.ZodOptional>; }, z.core.$strip>>, z.ZodTransform<{ table: string; rows: Record[]; tableName?: string | undefined; schema?: string | undefined; returning?: string[] | undefined; }, { table?: string | undefined; tableName?: string | undefined; schema?: string | undefined; rows?: Record[] | undefined; returning?: string[] | undefined; }>>; export declare const CountSchemaBase: z.ZodObject<{ table: z.ZodOptional; tableName: z.ZodOptional; schema: z.ZodOptional; where: z.ZodOptional; params: z.ZodOptional; condition: z.ZodOptional; filter: z.ZodOptional; column: z.ZodOptional; }, z.core.$strip>; export declare const CountSchema: z.ZodPipe; tableName: z.ZodOptional; schema: z.ZodOptional; where: z.ZodOptional; params: z.ZodOptional>; condition: z.ZodOptional; filter: z.ZodOptional; column: z.ZodOptional; }, z.core.$strip>>, z.ZodTransform<{ table: string; where: string | undefined; tableName?: string | undefined; schema?: string | undefined; params?: unknown[] | undefined; condition?: string | undefined; filter?: string | undefined; column?: string | undefined; }, { table?: string | undefined; tableName?: string | undefined; schema?: string | undefined; where?: string | undefined; params?: unknown[] | undefined; condition?: string | undefined; filter?: string | undefined; column?: string | undefined; }>>; export declare const ExistsSchemaBase: z.ZodObject<{ table: z.ZodOptional; tableName: z.ZodOptional; schema: z.ZodOptional; where: z.ZodOptional; params: z.ZodOptional; condition: z.ZodOptional; filter: z.ZodOptional; }, z.core.$strip>; export declare const ExistsSchema: z.ZodPipe; tableName: z.ZodOptional; schema: z.ZodOptional; where: z.ZodOptional; params: z.ZodOptional>; condition: z.ZodOptional; filter: z.ZodOptional; }, z.core.$strip>>, z.ZodTransform<{ table: string; where: string | undefined; tableName?: string | undefined; schema?: string | undefined; params?: unknown[] | undefined; condition?: string | undefined; filter?: string | undefined; }, { table?: string | undefined; tableName?: string | undefined; schema?: string | undefined; where?: string | undefined; params?: unknown[] | undefined; condition?: string | undefined; filter?: string | undefined; }>>; export declare const TruncateSchemaBase: z.ZodObject<{ table: z.ZodOptional; tableName: z.ZodOptional; schema: z.ZodOptional; cascade: z.ZodOptional; restartIdentity: z.ZodOptional; }, z.core.$strip>; export declare const TruncateSchema: z.ZodPipe; tableName: z.ZodOptional; schema: z.ZodOptional; cascade: z.ZodOptional; restartIdentity: z.ZodOptional; }, z.core.$strip>>, z.ZodTransform<{ table: string; tableName?: string | undefined; schema?: string | undefined; cascade?: unknown; restartIdentity?: unknown; }, { table?: string | undefined; tableName?: string | undefined; schema?: string | undefined; cascade?: unknown; restartIdentity?: unknown; }>>; //# sourceMappingURL=convenience-schemas.d.ts.map