UNPKG

@invisiblecities/sidequest-cqo

Version:

Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection

66 lines 2.42 kB
/** * Database utility functions for Code Quality Orchestrator * Includes hashing, deduplication, and data transformation helpers */ import type { Violation as ViolationType } from "../utils/violation-types.js"; import type { NewViolation, ViolationDelta } from "./types.js"; /** * Generate a consistent hash for violation deduplication * Hash includes: file_path + rule_id + message (excludes line_number for stability) * This makes violations more stable across code edits that shift line numbers */ export declare function generateViolationHash(violation: { file_path: string; line_number?: number | null | undefined; rule_id?: string | null | undefined; message: string; }): string; /** * Convert orchestrator violation to database violation format */ export declare function violationToDatabaseFormat(violation: ViolationType): NewViolation; /** * Convert multiple violations to database format with batch processing */ export declare function violationsToDatabaseFormat(violations: ViolationType[]): NewViolation[]; /** * Compare two sets of violation hashes to compute deltas */ export declare function computeViolationDeltas(previousHashes: string[], currentHashes: string[]): ViolationDelta[]; /** * Batch process deltas for database insertion */ export declare function prepareDeltasForInsertion(checkId: number, deltas: ViolationDelta[]): Array<{ check_id: number; violation_hash: string; action: "added" | "removed" | "modified" | "unchanged"; previous_line: number | null; previous_message: string | null; }>; /** * Format datetime for SQLite storage */ export declare function formatDateTimeForDatabase(date?: Date): string; /** * Batch array into chunks for efficient database operations */ export declare function chunk<T>(array: T[], size: number): T[][]; /** * Create performance metric entry */ export declare function createPerformanceMetric(type: string, value: number, unit: string, context?: string): { metric_type: string; metric_value: number; metric_unit: string; context: string | null; recorded_at: string; }; /** * Validate violation data before database insertion */ export declare function validateViolation(violation: Partial<NewViolation>): string[]; /** * Validate and clean violation data */ export declare function sanitizeViolation(violation: NewViolation): NewViolation; //# sourceMappingURL=utils.d.ts.map