adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
114 lines • 3.5 kB
TypeScript
/**
* Adobe Creative Suite Phase 2 - Enhanced Error Handling
*
* Provides comprehensive error handling, retry logic, and rate limiting
* for all Adobe Creative Suite API interactions.
*/
import { CreativeSuiteAuthenticator, type AuthenticationResult } from './authenticator.js';
export interface RetryOptions {
maxRetries: number;
baseDelay: number;
maxDelay: number;
backoffMultiplier: number;
retryableErrors: string[];
}
export interface RateLimitConfig {
requestsPerSecond: number;
requestsPerMinute: number;
burstLimit: number;
}
export interface ErrorDetails {
code: string;
message: string;
timestamp: Date;
context: any;
isRetryable: boolean;
}
export declare class EnhancedErrorHandler {
private retryOptions;
private rateLimitConfig;
private requestQueue;
constructor(retryOptions?: Partial<RetryOptions>, rateLimitConfig?: Partial<RateLimitConfig>);
/**
* Execute a function with comprehensive error handling and retry logic
*/
executeWithRetry<T>(operation: () => Promise<T>, context: string, customRetryOptions?: Partial<RetryOptions>): Promise<T>;
/**
* Check if the request is within rate limits
*/
private checkRateLimit;
/**
* Record a successful request for rate limiting
*/
private recordRequest;
/**
* Analyze an error to determine if it's retryable and extract details
*/
private analyzeError;
/**
* Enhance an error with additional context and details
*/
private enhanceError;
/**
* Calculate exponential backoff delay
*/
private calculateBackoffDelay;
/**
* Sleep for specified milliseconds
*/
private sleep;
/**
* Get current rate limit status
*/
getRateLimitStatus(): {
requestsInLastSecond: number;
requestsInLastMinute: number;
remainingQuota: number;
};
}
/**
* Enhanced Creative Suite Authenticator with error handling
*/
export declare class RobustCreativeSuiteAuthenticator extends CreativeSuiteAuthenticator {
private errorHandler;
constructor(errorHandlerOptions?: {
retryOptions?: Partial<RetryOptions>;
rateLimitConfig?: Partial<RateLimitConfig>;
});
/**
* Authenticate with comprehensive error handling and retry logic
*/
authenticateWithRetry(): Promise<AuthenticationResult>;
/**
* Get rate limit status for authentication requests
*/
getAuthRateLimitStatus(): {
requestsInLastSecond: number;
requestsInLastMinute: number;
remainingQuota: number;
};
}
/**
* Enhanced API Client wrapper with error handling
*/
export declare class RobustAPIClient {
private errorHandler;
private authenticator;
constructor(authenticator?: RobustCreativeSuiteAuthenticator, errorHandlerOptions?: {
retryOptions?: Partial<RetryOptions>;
rateLimitConfig?: Partial<RateLimitConfig>;
});
/**
* Execute any API call with comprehensive error handling
*/
executeAPICall<T>(apiCall: () => Promise<T>, context: string, customRetryOptions?: Partial<RetryOptions>): Promise<T>;
/**
* Get comprehensive API health status
*/
getHealthStatus(): Promise<{
authentication: 'healthy' | 'warning' | 'error';
rateLimits: ReturnType<EnhancedErrorHandler['getRateLimitStatus']>;
lastError?: ErrorDetails;
}>;
}
//# sourceMappingURL=enhanced-error-handling.d.ts.map