import { z } from 'zod'; import { ServiceBubble } from '../../types/service-bubble-class.js'; import type { BubbleContext } from '../../types/bubble.js'; import { CredentialType, type DatabaseMetadata } from '@bubblelab/shared-schemas'; export declare const SqlOperations: z.ZodEnum<["SELECT", "INSERT", "UPDATE", "DELETE", "WITH", "EXPLAIN", "ANALYZE", "SHOW", "DESCRIBE", "DESC", "CREATE"]>; declare const PostgreSQLParamsSchema: z.ZodObject<{ ignoreSSL: z.ZodDefault; query: z.ZodEffects; allowedOperations: z.ZodDefault, "many">>; parameters: z.ZodDefault>>; timeout: z.ZodDefault; maxRows: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>; }, "strip", z.ZodTypeAny, { parameters: unknown[]; timeout: number; ignoreSSL: boolean; query: string; allowedOperations: ("SELECT" | "INSERT" | "UPDATE" | "DELETE" | "WITH" | "EXPLAIN" | "ANALYZE" | "SHOW" | "DESCRIBE" | "DESC" | "CREATE")[]; maxRows: number; credentials?: Partial> | undefined; }, { query: string; parameters?: unknown[] | undefined; credentials?: Partial> | undefined; timeout?: number | undefined; ignoreSSL?: boolean | undefined; allowedOperations?: ("SELECT" | "INSERT" | "UPDATE" | "DELETE" | "WITH" | "EXPLAIN" | "ANALYZE" | "SHOW" | "DESCRIBE" | "DESC" | "CREATE")[] | undefined; maxRows?: number | undefined; }>; type PostgreSQLParamsInput = z.input; type PostgreSQLParams = z.output; declare const PostgreSQLResultSchema: z.ZodObject<{ rows: z.ZodArray, "many">; rowCount: z.ZodNullable; command: z.ZodString; fields: z.ZodOptional, "many">>; executionTime: z.ZodNumber; success: z.ZodBoolean; error: z.ZodString; cleanedJSONString: z.ZodString; }, "strip", z.ZodTypeAny, { executionTime: number; error: string; success: boolean; rows: Record[]; rowCount: number | null; command: string; cleanedJSONString: string; fields?: { name: string; dataTypeID: number; }[] | undefined; }, { executionTime: number; error: string; success: boolean; rows: Record[]; rowCount: number | null; command: string; cleanedJSONString: string; fields?: { name: string; dataTypeID: number; }[] | undefined; }>; type PostgreSQLResult = z.output; export declare class PostgreSQLBubble extends ServiceBubble { testCredential(): Promise; static readonly type: "service"; static readonly service = "postgresql"; static readonly authType: "connection-string"; static readonly bubbleName = "postgresql"; static readonly schema: z.ZodObject<{ ignoreSSL: z.ZodDefault; query: z.ZodEffects; allowedOperations: z.ZodDefault, "many">>; parameters: z.ZodDefault>>; timeout: z.ZodDefault; maxRows: z.ZodDefault; credentials: z.ZodOptional, z.ZodString>>; }, "strip", z.ZodTypeAny, { parameters: unknown[]; timeout: number; ignoreSSL: boolean; query: string; allowedOperations: ("SELECT" | "INSERT" | "UPDATE" | "DELETE" | "WITH" | "EXPLAIN" | "ANALYZE" | "SHOW" | "DESCRIBE" | "DESC" | "CREATE")[]; maxRows: number; credentials?: Partial> | undefined; }, { query: string; parameters?: unknown[] | undefined; credentials?: Partial> | undefined; timeout?: number | undefined; ignoreSSL?: boolean | undefined; allowedOperations?: ("SELECT" | "INSERT" | "UPDATE" | "DELETE" | "WITH" | "EXPLAIN" | "ANALYZE" | "SHOW" | "DESCRIBE" | "DESC" | "CREATE")[] | undefined; maxRows?: number | undefined; }>; static readonly resultSchema: z.ZodObject<{ rows: z.ZodArray, "many">; rowCount: z.ZodNullable; command: z.ZodString; fields: z.ZodOptional, "many">>; executionTime: z.ZodNumber; success: z.ZodBoolean; error: z.ZodString; cleanedJSONString: z.ZodString; }, "strip", z.ZodTypeAny, { executionTime: number; error: string; success: boolean; rows: Record[]; rowCount: number | null; command: string; cleanedJSONString: string; fields?: { name: string; dataTypeID: number; }[] | undefined; }, { executionTime: number; error: string; success: boolean; rows: Record[]; rowCount: number | null; command: string; cleanedJSONString: string; fields?: { name: string; dataTypeID: number; }[] | undefined; }>; static readonly shortDescription = "Execute PostgreSQL queries with operation validation"; static readonly longDescription = "\n Execute SQL queries against PostgreSQL databases with proper validation and security controls.\n Use cases:\n - Data retrieval with SELECT queries\n - Data manipulation with INSERT, UPDATE, DELETE (when explicitly allowed)\n - Database reporting and analytics\n - Data migration and synchronization tasks\n - JSON string output for integration with other systems\n \n Security Features:\n - Operation whitelist (defaults to SELECT only)\n - Parameterized queries to prevent SQL injection\n - Connection timeout controls\n - Result sanitization for JSON output\n "; static readonly alias = "pg"; constructor(params?: PostgreSQLParamsInput, context?: BubbleContext); protected performAction(context?: BubbleContext): Promise; getCredentialMetadata(): Promise; /** * Validate that the SQL query operation is allowed */ private validateSqlOperation; /** * Validate parameter usage to encourage parameterized queries */ private validateParameterUsage; /** * Validate parentheses and quotes are balanced */ private validateParenthesesBalance; /** * Clean and format query results as a JSON string */ private cleanJSONString; /** * Clean an object by handling special values and preventing circular references */ private cleanObject; protected chooseCredential(): string | undefined; } export {}; //# sourceMappingURL=postgresql.d.ts.map