UNPKG

supa-seed

Version:

A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support

302 lines 8.33 kB
/** * Configuration Testing and Debugging Tools for SupaSeed v2.5.0 * Implements Task 5.3.3: Configuration testing and debugging with performance optimization * Provides comprehensive testing, debugging, and performance analysis capabilities */ import type { LayeredConfiguration } from './config-layers'; /** * Configuration testing options */ export interface ConfigTestingOptions { includePerformanceTests?: boolean; includeValidationTests?: boolean; includeCompatibilityTests?: boolean; includeStressTests?: boolean; maxTestDuration?: number; testEnvironment?: 'development' | 'staging' | 'production'; verboseOutput?: boolean; generateReport?: boolean; } /** * Configuration test suite result */ export interface ConfigTestSuiteResult { summary: { totalTests: number; passed: number; failed: number; skipped: number; duration: number; score: number; }; testResults: ConfigTestResult[]; performanceAnalysis?: PerformanceTestResult; recommendations: string[]; issues: ConfigTestIssue[]; report?: string; } /** * Individual configuration test result */ export interface ConfigTestResult { id: string; name: string; category: 'validation' | 'performance' | 'compatibility' | 'stress' | 'security'; status: 'passed' | 'failed' | 'skipped' | 'error'; duration: number; message?: string; details?: any; expectedValue?: any; actualValue?: any; assertion?: string; stackTrace?: string; } /** * Performance test results for configuration */ export interface PerformanceTestResult { loadTime: { universal: number; detection: number; extensions: number; total: number; }; memoryUsage: { before: number; after: number; peak: number; delta: number; }; validationPerformance: { basicValidation: number; layeredValidation: number; crossLayerValidation: number; total: number; }; compositionPerformance: { templateApplication: number; inheritanceResolution: number; conflictResolution: number; total: number; }; benchmarks: { cpuScore: number; memoryScore: number; ioScore: number; overallScore: number; }; recommendations: string[]; } /** * Configuration test issue */ export interface ConfigTestIssue { severity: 'critical' | 'high' | 'medium' | 'low'; category: 'performance' | 'validation' | 'compatibility' | 'security'; message: string; location: string; suggestion?: string; autoFixable: boolean; relatedTests: string[]; } /** * Configuration debugging session */ export interface ConfigDebuggingSession { id: string; config: LayeredConfiguration; startTime: Date; endTime?: Date; debugSteps: ConfigDebugStep[]; breakpoints: ConfigBreakpoint[]; watchedValues: ConfigWatchedValue[]; callStack: ConfigCallStack[]; logs: ConfigDebugLog[]; } /** * Configuration debug step */ export interface ConfigDebugStep { id: string; timestamp: Date; type: 'validation' | 'composition' | 'application' | 'transformation'; layer: 'universal' | 'detection' | 'extensions' | 'cross-layer'; operation: string; input: any; output: any; duration: number; success: boolean; error?: string; } /** * Configuration breakpoint */ export interface ConfigBreakpoint { id: string; path: string; condition?: string; hitCount: number; enabled: boolean; actions: ('log' | 'pause' | 'trace' | 'measure')[]; } /** * Configuration watched value */ export interface ConfigWatchedValue { id: string; path: string; currentValue: any; previousValue?: any; changeCount: number; lastChanged: Date; type: string; } /** * Configuration call stack entry */ export interface ConfigCallStack { function: string; file: string; line: number; arguments: any[]; timestamp: Date; duration?: number; } /** * Configuration debug log entry */ export interface ConfigDebugLog { timestamp: Date; level: 'debug' | 'info' | 'warn' | 'error'; message: string; context: any; location: string; } /** * Performance profiling result */ export interface ConfigPerformanceProfile { overview: { totalTime: number; cpuTime: number; memoryPeak: number; operationCount: number; }; hotspots: { function: string; totalTime: number; callCount: number; averageTime: number; percentage: number; }[]; timeline: { timestamp: number; operation: string; duration: number; memory: number; }[]; recommendations: { type: 'optimization' | 'caching' | 'lazy-loading' | 'batching'; description: string; impact: 'high' | 'medium' | 'low'; implementation: string; }[]; } /** * Configuration Testing and Debugging Engine * Provides comprehensive testing, debugging, and performance analysis for layered configurations */ export declare class ConfigurationTestingEngine { private activeSessions; private testHistory; private performanceBaselines; /** * Run comprehensive configuration test suite */ runTestSuite(config: LayeredConfiguration, options?: ConfigTestingOptions): Promise<ConfigTestSuiteResult>; /** * Run validation tests for configuration */ private runValidationTests; /** * Run performance tests for configuration */ private runPerformanceTests; /** * Run compatibility tests for configuration */ private runCompatibilityTests; /** * Run stress tests for configuration */ private runStressTests; /** * Start configuration debugging session */ startDebuggingSession(config: LayeredConfiguration): string; /** * Add breakpoint to debugging session */ addBreakpoint(sessionId: string, path: string, condition?: string, actions?: ConfigBreakpoint['actions']): void; /** * Add watched value to debugging session */ addWatchedValue(sessionId: string, path: string): void; /** * Profile configuration performance */ profilePerformance(config: LayeredConfiguration, operation: 'load' | 'validate' | 'compose' | 'apply'): Promise<ConfigPerformanceProfile>; /** * Test utilities and helper methods */ private testLayerStructure; private testUniversalLayerValidation; private testDetectionLayerValidation; private testExtensionsLayerValidation; private testCrossLayerCompatibility; private testConfigurationIntegrity; private testSecurityConfiguration; private testRLSCompliance; /** * Performance measurement utilities */ private measureConfigurationLoadTime; private measureMemoryUsage; /** * Utility methods */ private calculateTestSummary; private mapTestSeverity; private generateTestSuggestion; private isTestAutoFixable; private generateTestRecommendations; private generateTestReport; private getValueAtPath; private detectCircularReferences; private generateConfigurationHash; private profileLoadOperation; private profileValidateOperation; private profileComposeOperation; private profileApplyOperation; private analyzePerformanceHotspots; private generateProfileRecommendations; private calculatePerformanceBenchmarks; private generatePerformanceRecommendations; private measureValidationPerformance; private measureCompositionPerformance; private testVersionCompatibility; private testBackwardCompatibility; private testForwardCompatibility; private testExtensionCompatibility; private testTemplateCompatibility; private testPlatformCompatibility; private testLargeConfigurationHandling; private testComplexInheritanceStress; private testMultipleExtensionStress; private testConcurrentAccessStress; } /** * Default configuration testing engine instance */ export declare const configTestingEngine: ConfigurationTestingEngine; //# sourceMappingURL=config-testing-tools.d.ts.map