feat: add AI data validation, test data generator, index advisor, and snapshots
Four new killer features leveraging AI (Ollama) and PostgreSQL internals: - Data Validation: describe quality rules in natural language, AI generates SQL to find violations, run with pass/fail results and sample violations - Test Data Generator: right-click table to generate realistic FK-aware test data with AI, preview before inserting in a transaction - Index Advisor: analyze pg_stat tables + AI recommendations for CREATE/DROP INDEX with one-click apply - Data Snapshots: export selected tables to JSON (FK-ordered), restore from file with optional truncate in a transaction Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,15 @@ import type {
|
||||
TuskContainer,
|
||||
AppSettings,
|
||||
McpStatus,
|
||||
ValidationRule,
|
||||
GenerateDataParams,
|
||||
GeneratedDataPreview,
|
||||
DataGenProgress,
|
||||
IndexAdvisorReport,
|
||||
SnapshotMetadata,
|
||||
CreateSnapshotParams,
|
||||
RestoreSnapshotParams,
|
||||
SnapshotProgress,
|
||||
} from "@/types";
|
||||
|
||||
// Connections
|
||||
@@ -334,3 +343,50 @@ export const saveAppSettings = (settings: AppSettings) =>
|
||||
|
||||
export const getMcpStatus = () =>
|
||||
invoke<McpStatus>("get_mcp_status");
|
||||
|
||||
// Validation (Wave 1)
|
||||
export const generateValidationSql = (connectionId: string, ruleDescription: string) =>
|
||||
invoke<string>("generate_validation_sql", { connectionId, ruleDescription });
|
||||
|
||||
export const runValidationRule = (connectionId: string, sql: string, sampleLimit?: number) =>
|
||||
invoke<ValidationRule>("run_validation_rule", { connectionId, sql, sampleLimit });
|
||||
|
||||
export const suggestValidationRules = (connectionId: string) =>
|
||||
invoke<string[]>("suggest_validation_rules", { connectionId });
|
||||
|
||||
// Data Generator (Wave 2)
|
||||
export const generateTestDataPreview = (params: GenerateDataParams, genId: string) =>
|
||||
invoke<GeneratedDataPreview>("generate_test_data_preview", { params, genId });
|
||||
|
||||
export const insertGeneratedData = (connectionId: string, preview: GeneratedDataPreview) =>
|
||||
invoke<number>("insert_generated_data", { connectionId, preview });
|
||||
|
||||
export const onDataGenProgress = (
|
||||
callback: (p: DataGenProgress) => void
|
||||
): Promise<UnlistenFn> =>
|
||||
listen<DataGenProgress>("datagen-progress", (e) => callback(e.payload));
|
||||
|
||||
// Index Advisor (Wave 3A)
|
||||
export const getIndexAdvisorReport = (connectionId: string) =>
|
||||
invoke<IndexAdvisorReport>("get_index_advisor_report", { connectionId });
|
||||
|
||||
export const applyIndexRecommendation = (connectionId: string, ddl: string) =>
|
||||
invoke<void>("apply_index_recommendation", { connectionId, ddl });
|
||||
|
||||
// Snapshots (Wave 3B)
|
||||
export const createSnapshot = (params: CreateSnapshotParams, snapshotId: string, filePath: string) =>
|
||||
invoke<SnapshotMetadata>("create_snapshot", { params, snapshotId, filePath });
|
||||
|
||||
export const restoreSnapshot = (params: RestoreSnapshotParams, snapshotId: string) =>
|
||||
invoke<number>("restore_snapshot", { params, snapshotId });
|
||||
|
||||
export const listSnapshots = () =>
|
||||
invoke<SnapshotMetadata[]>("list_snapshots");
|
||||
|
||||
export const readSnapshotMetadata = (filePath: string) =>
|
||||
invoke<SnapshotMetadata>("read_snapshot_metadata", { filePath });
|
||||
|
||||
export const onSnapshotProgress = (
|
||||
callback: (p: SnapshotProgress) => void
|
||||
): Promise<UnlistenFn> =>
|
||||
listen<SnapshotProgress>("snapshot-progress", (e) => callback(e.payload));
|
||||
|
||||
Reference in New Issue
Block a user