@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
105 lines • 3.57 kB
TypeScript
/**
* Storage Service for Code Quality Orchestrator
* Provides high-level database operations with optimized batch processing
*/
import type { Violation, ViolationHistory, RuleSchedule, NewRuleSchedule, ViolationSummaryItem, RulePerformanceItem, ViolationQueryParameters, HistoryQueryParameters, DashboardData, StorageServiceConfig } from "../database/types.js";
import type { Violation as OrchestratorViolation } from "../utils/violation-types.js";
export declare class StorageService {
private config;
private batchSize;
private maxHistoryAge;
private enableMetrics;
constructor(config?: Partial<StorageServiceConfig>);
/**
* Store violations with batch processing and deduplication
*/
storeViolations(violations: OrchestratorViolation[]): Promise<{
inserted: number;
updated: number;
errors: string[];
}>;
/**
* Get violations with flexible filtering
*/
getViolations(parameters?: ViolationQueryParameters): Promise<Violation[]>;
/**
* Get violation summary for dashboard
*/
getViolationSummary(): Promise<ViolationSummaryItem[]>;
/**
* Mark violations as resolved
*/
resolveViolations(hashes: string[]): Promise<number>;
/**
* Start a new rule check
*/
startRuleCheck(rule: string, engine: "typescript" | "eslint"): Promise<number>;
/**
* Complete a rule check with results
*/
completeRuleCheck(checkId: number, violationsFound: number, executionTimeMs: number, filesChecked?: number, filesWithViolations?: number): Promise<void>;
/**
* Mark rule check as failed
*/
failRuleCheck(checkId: number, errorMessage: string): Promise<void>;
/**
* Record violation deltas for historical tracking
*/
recordViolationDeltas(checkId: number, currentViolationHashes: string[]): Promise<{
added: number;
removed: number;
unchanged: number;
}>;
/**
* Get violation history for analysis
*/
getViolationHistory(parameters?: HistoryQueryParameters): Promise<ViolationHistory[]>;
/**
* Initialize or update rule schedule
*/
upsertRuleSchedule(schedule: NewRuleSchedule): Promise<number>;
/**
* Get next rules to check based on schedule
*/
getNextRulesToCheck(limit?: number): Promise<RuleSchedule[]>;
/**
* Get rule performance data
*/
getRulePerformance(): Promise<RulePerformanceItem[]>;
/**
* Get comprehensive dashboard data
*/
getDashboardData(): Promise<DashboardData>;
/**
* Record performance metric
*/
recordPerformanceMetric(type: string, value: number, unit: string, context?: string): Promise<void>;
/**
* Clean up old historical data
*/
cleanupOldData(): Promise<{
violationHistoryDeleted: number;
performanceMetricsDeleted: number;
resolvedViolationsDeleted: number;
}>;
/**
* Get storage statistics
*/
getStorageStats(): Promise<{
totalViolations: number;
activeViolations: number;
totalRuleChecks: number;
totalHistoryRecords: number;
oldestViolation: string | undefined;
newestViolation: string | undefined;
}>;
}
/**
* Get or create storage service instance
*/
export declare function getStorageService(config?: Partial<StorageServiceConfig>): StorageService;
/**
* Reset storage service instance (useful for testing)
*/
export declare function resetStorageService(): void;
//# sourceMappingURL=storage-service.d.ts.map