/** * Performance Optimization Utilities * Helper functions for performance optimization */ import type { PerformancePresetName, DataPatternType, PerformanceConfig, BundleSizeLevel, PerformanceOptions, PerformanceOption, PerformanceFetchResponse, PerformanceRequestConfig, PerformanceResponseError } from '@plyaz/types/api'; /** * Apply performance preset by name with tracking */ export declare function applyPerformancePreset(preset: PerformancePresetName): PerformanceConfig; /** * Resolve performance option to configuration * Supports string preset names, config objects, or false to disable * * @param option - Performance option to resolve * @returns Resolved performance configuration or undefined if disabled * * @example * ```typescript * // String preset * const config = resolvePerformanceOption('balanced'); * * // Config object * const config = resolvePerformanceOption({ cacheTime: 300 }); * * // Disabled * const config = resolvePerformanceOption(false); // returns undefined * ``` */ export declare function resolvePerformanceOption(option: PerformanceOption): PerformanceConfig | undefined; /** * Apply data pattern configuration with tracking */ export declare function applyDataPattern(pattern: DataPatternType): PerformanceConfig; /** * Get optimized configuration based on multiple factors */ export declare function getOptimizedConfig(options?: PerformanceOptions): PerformanceConfig; /** * Merge multiple performance configurations * Later configs override earlier ones */ export declare function mergePerformanceConfigs(...configs: (PerformanceConfig | undefined)[]): PerformanceConfig; /** * Get bundle-size optimized configuration * Reduces features based on bundle size requirements */ export declare function getBundleSizeOptimizedConfig(level: BundleSizeLevel): PerformanceConfig; /** * Calculate optimal cache time based on data characteristics */ export declare function calculateOptimalCacheTime(options: { updateFrequency?: number; dataSize?: number; importance?: 'low' | 'medium' | 'high'; userTolerance?: number; }): number; /** * Calculate optimal dedupe time based on request patterns */ export declare function calculateOptimalDedupeTime(options: { requestRate?: number; userInteraction?: boolean; dataVolatility?: 'low' | 'medium' | 'high'; }): number; /** * Get performance recommendation based on endpoint */ export declare function getPerformanceRecommendation(options: { method?: string; url?: string; responseSize?: number; frequency?: 'rare' | 'occasional' | 'frequent' | 'continuous'; dataPattern?: DataPatternType; }): { preset: PerformancePresetName; pattern: DataPatternType | undefined; config: PerformanceConfig; reason: string; }; /** * Check if performance optimization is worth it */ export declare function shouldOptimize(metrics: { requestCount: number; averageResponseTime: number; errorRate: number; cacheHitRate?: number; }): { shouldOptimize: boolean; reasons: string[]; }; /** * Type guards for performance monitoring */ export declare function isPerformanceRequestConfig(config: unknown): config is PerformanceRequestConfig; export declare function isPerformanceFetchResponse(response: unknown): response is PerformanceFetchResponse; export declare function isPerformanceResponseError(error: unknown): error is PerformanceResponseError; //# sourceMappingURL=utils.d.ts.map