/** * ThreadTS Universal - Flow Control Decorators * * Decorators for controlling method execution flow: * retry, rate limiting, timeout, debounce, throttle, circuit breaker, concurrent. * Supports both legacy (experimentalDecorators) and Stage-3 decorator syntax. * * @module decorators/flow-control */ /** * Decorator for retry logic with exponential backoff */ export declare function retry(maxAttempts?: number, baseDelay?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Decorator for rate limiting method calls */ export declare function rateLimit(callsPerSecond?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Decorator for timeout handling * Automatically rejects if execution exceeds the specified timeout */ export declare function timeout(ms?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Decorator for debouncing method calls * Delays execution until no calls have been made for the specified duration */ export declare function debounce(ms?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Decorator for throttling method calls * Ensures the method is called at most once per specified interval */ export declare function throttle(ms?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Decorator for limiting concurrent executions of a method. * Useful for controlling resource usage when calling expensive operations. * * @param maxConcurrent - Maximum number of concurrent executions (default: 1) * * @example * ```typescript * class FileProcessor { * @concurrent(3) // Max 3 concurrent file operations * async processFile(path: string): Promise { * await heavyFileOperation(path); * } * } * ``` */ export declare function concurrent(maxConcurrent?: number): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; /** * Circuit breaker state type */ export type CircuitState = 'closed' | 'open' | 'half-open'; /** * Circuit breaker options */ export interface CircuitBreakerOptions { /** Number of failures before opening circuit (default: 5) */ failureThreshold?: number; /** Time in ms before attempting to close circuit (default: 30000) */ resetTimeout?: number; /** Number of test requests allowed in half-open state (default: 1) */ halfOpenRequests?: number; } /** * Decorator for circuit breaker pattern. * Prevents repeated calls to a failing service. * * @param options - Circuit breaker configuration * * @example * ```typescript * class ApiService { * @circuitBreaker({ failureThreshold: 5, resetTimeout: 30000 }) * async callExternalApi(): Promise { * return await externalApi.getData(); * } * } * ``` */ export declare function circuitBreaker(options?: CircuitBreakerOptions): (targetOrMethod: unknown, propertyKeyOrContext?: string | symbol | import('./utils').DecoratorContext, descriptor?: PropertyDescriptor) => import('./utils').DecoratorReturnType; //# sourceMappingURL=flow-control.d.ts.map