/** * Rate Limiter * * Handles API rate limiting for external platforms (GitHub, JIRA, ADO). * Prevents hitting rate limits and provides graceful backoff strategies. */ /** * Rate limit information */ export interface RateLimitInfo { /** Remaining requests in current window */ remaining: number; /** Total requests allowed per window */ limit: number; /** Timestamp when rate limit resets (ISO string) */ resetAt: string; /** Seconds until reset */ resetInSeconds: number; /** Platform name */ platform: 'github' | 'jira' | 'ado'; } /** * Rate limit thresholds */ export interface RateLimitThresholds { /** Warn when remaining requests drop below this (default: 100) */ warningThreshold?: number; /** Pause when remaining requests drop below this (default: 10) */ pauseThreshold?: number; /** Wait time in seconds when paused (default: 60) */ pauseDuration?: number; } /** * Rate Limiter * * Monitors and manages API rate limits across platforms. */ export declare class RateLimiter { private thresholds; private lastRateLimitInfo; constructor(thresholds?: RateLimitThresholds); /** * Check GitHub rate limit from response headers * * @param headers - HTTP response headers from GitHub API * @returns Rate limit information */ checkGitHubRateLimit(headers: Record): RateLimitInfo; /** * Check JIRA rate limit (placeholder - JIRA doesn't expose rate limits in headers) * * @returns Rate limit information (estimated) */ checkJiraRateLimit(): RateLimitInfo; /** * Check Azure DevOps rate limit (placeholder - ADO has different rate limit model) * * @returns Rate limit information (estimated) */ checkAdoRateLimit(): RateLimitInfo; /** * Wait if rate limit is low * * @param platform - Platform to check * @param onWait - Callback when waiting (receives wait duration in seconds) * @returns True if waited, false if no wait needed */ waitIfNeeded(platform: 'github' | 'jira' | 'ado', onWait?: (platform: string, seconds: number) => void): Promise; /** * Check if rate limit warning should be shown * * @param platform - Platform to check * @returns True if remaining requests are below warning threshold */ shouldWarn(platform: 'github' | 'jira' | 'ado'): boolean; /** * Get last known rate limit info for a platform * * @param platform - Platform to query * @returns Rate limit info or undefined if not cached */ getLastRateLimitInfo(platform: 'github' | 'jira' | 'ado'): RateLimitInfo | undefined; /** * Format rate limit warning message * * @param rateLimitInfo - Rate limit information * @returns Formatted warning message */ formatWarning(rateLimitInfo: RateLimitInfo): string; /** * Format pause message * * @param platform - Platform name * @param seconds - Wait duration in seconds * @returns Formatted pause message */ formatPauseMessage(platform: string, seconds: number): string; /** * Sleep for specified milliseconds */ private sleep; /** * Clear cached rate limit info (useful for testing) */ clearCache(): void; /** * Get current thresholds */ getThresholds(): Required; } /** * Check if a large import should prompt for confirmation * * @param itemCount - Number of items to import * @param threshold - Confirmation threshold (default: 100) * @returns True if confirmation should be requested */ export declare function shouldConfirmLargeImport(itemCount: number, threshold?: number): boolean; /** * Format large import confirmation message * * @param itemCount - Number of items to import * @returns Formatted confirmation message */ export declare function formatLargeImportMessage(itemCount: number): string; //# sourceMappingURL=rate-limiter.d.ts.map