export type DbDiffMode = "row" | "schema" | "aggregate" | "value"; export type DbDriver = "sqlite" | "postgres" | "mysql"; export type Row = Record; export interface ColumnDef { name: string; type: string; nullable: boolean; primaryKey: boolean; defaultValue?: string; } export interface DbWatchConfig { connectionString: string; driver: DbDriver; table: string; /** Custom SELECT query -> overrides the default `SELECT * FROM `. */ query?: string; /** Column(s) used to identify a row across snapshots (default: first column). */ primaryKey?: string[]; /** Columns to exclude from comparison. */ ignoreColumns?: string[]; diffMode: DbDiffMode; interval: number; label: string; dryRun?: boolean; cooldown?: number; maxSnapshots?: number; alertOnInsert?: boolean; alertOnDelete?: boolean; alertOnUpdate?: boolean; /** For aggregate mode: alert when value changes by more than this % (0 = any change). */ threshold?: number; webhooks?: string[]; webhookRetries?: number; onChange?: (report: DbDiffReport) => void | Promise; onError?: (err: Error, config: DbWatchConfig) => void; onSchemaChange?: (info: SchemaChangeInfo) => void; onThreshold?: (info: ThresholdInfo) => void; /** Generate an AI-powered summary of detected DB changes. */ aiSummary?: boolean; /** AI provider - auto-detected from env vars when omitted. */ aiProvider?: import("./ai-summarizer/index.js").AiProvider; } export interface DbSnapshot { connectionString: string; table: string; rows: Row[]; schema?: ColumnDef[]; capturedAt: Date; checksum: string; rowCount: number; } export type DbChangeKind = "inserted" | "deleted" | "updated" | "schema_changed" | "threshold_exceeded" | "value_changed"; export interface RowModification { column: string; before: unknown; after: unknown; } export interface DbChange { kind: DbChangeKind; /** Primary-key values for the affected row, serialized as JSON. */ rowKey?: string; /** Full row content (for inserted / deleted). */ row?: Row; /** Per-column diffs (for updated). */ modifications?: RowModification[]; /** Affected column name (for schema_changed). */ column?: string; before?: unknown; after?: unknown; context?: string; } export interface DbDiffReport { connectionString: string; table: string; label: string; before: DbSnapshot; after: DbSnapshot; changes: DbChange[]; diffMode: DbDiffMode; comparedAt: Date; /** AI-generated summary (populated when aiSummary is enabled on the config). */ aiSummary?: string; } export interface SchemaChangeInfo { connectionString: string; table: string; label: string; changes: DbChange[]; } export interface ThresholdInfo { connectionString: string; table: string; label: string; previousValue: number; currentValue: number; changePercent: number; threshold: number; } export declare function makeDbWatchConfig(connectionString: string, table: string, opts?: Partial>): DbWatchConfig; export declare function makeDbSnapshot(connectionString: string, table: string, rows: Row[], schema?: ColumnDef[]): DbSnapshot; /** Stable storage key for IStore -> encodes connection + table without leaking credentials. */ export declare function dbSnapshotKey(connectionString: string, table: string): string; export declare function dbHasChanges(report: DbDiffReport): boolean; export declare function dbReportSummary(report: DbDiffReport): string; //# sourceMappingURL=db-models.d.ts.map