/** * Configuration options for the PandaDB client */ export interface PandaDBConfig { /** Authentication token */ token: string; /** Base URL for the PandaDB API */ baseUrl?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; /** Maximum number of retry attempts (default: 3) */ retries?: number; /** Custom headers to include in requests */ headers?: Record; } /** * Database information */ export interface Database { id: string; name: string; description?: string; created_at: string; updated_at: string; size: number; tables: string[]; } /** * Query parameters */ export interface QueryParams { sql: string; params?: any[]; options?: QueryOptions; } /** * Query options */ export interface QueryOptions { /** Query timeout in milliseconds */ timeout?: number; /** Whether the query is read-only */ readOnly?: boolean; /** Whether to use prepared statement */ prepared?: boolean; } /** * Query result metadata */ export interface QueryResultMeta { rows_affected?: number; execution_time: number; has_more?: boolean; } /** * Query result */ export interface QueryResult { data: T; meta: QueryResultMeta; } /** * Batch query request */ export interface BatchQuery { sql: string; params?: any[]; } /** * Batch query options */ export interface BatchOptions { /** Whether to execute queries in a transaction */ transaction?: boolean; /** Transaction timeout in milliseconds */ timeout?: number; } /** * Real-time subscription handlers */ export interface SubscriptionHandlers { onCreate?: (data: T) => void; onUpdate?: (data: T) => void; onDelete?: (id: string | number) => void; onError?: (error: Error) => void; } /** * Change event types */ export type ChangeType = 'INSERT' | 'UPDATE' | 'DELETE'; /** * Change event data */ export interface Change { type: ChangeType; data: T; timestamp: string; database: string; table: string; } /** * AI query options */ export interface AIQueryOptions { /** Whether to explain the generated query */ explain?: boolean; /** Whether to validate the generated query */ validate?: boolean; /** Additional context for the AI */ context?: Record; } /** * AI query result */ export interface AIQueryResult extends QueryResult { meta: QueryResultMeta & { generated_sql: string; explanation?: string; validation?: { valid: boolean; issues?: string[]; }; }; } /** * Pagination parameters */ export interface PaginationParams { page?: number; limit?: number; sort?: string; order?: 'asc' | 'desc'; } /** * List response with pagination */ export interface ListResponse { data: T[]; meta: { page: number; total: number; limit: number; }; } /** * Saved query */ export interface SavedQuery { id: string; name: string; sql: string; created_at: string; } /** * Query history entry */ export interface QueryHistoryEntry { sql: string; params: any[]; duration: number; rows_affected: number; error?: string; timestamp: string; status: 'success' | 'error'; } /** * Error codes */ export declare enum ErrorCode { AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR", AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR", VALIDATION_ERROR = "VALIDATION_ERROR", RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND", QUOTA_EXCEEDED = "QUOTA_EXCEEDED", SYNTAX_ERROR = "SYNTAX_ERROR", CONSTRAINT_VIOLATION = "CONSTRAINT_VIOLATION", CONNECTION_ERROR = "CONNECTION_ERROR", TIMEOUT_ERROR = "TIMEOUT_ERROR", INTERNAL_ERROR = "INTERNAL_ERROR" } /** * Error details */ export interface ErrorDetails { code: ErrorCode; message: string; details?: Record; } //# sourceMappingURL=types.d.ts.map