/** * RPC Configuration Utilities * * Centralizes validation, merge logic, and resolution for per-service * and per-target RPC options (circuit breaker, retry, timeout, bulkhead, * concurrency). * * Merge precedence (lowest → highest): * 1. Framework defaults (in Interceptors.ts constructors) * 2. Service-level `rpc` field * 3. Target-level `rpcTargets[targetName]` * 4. Contract-level options (static contract = { circuitBreaker: ... }) * 5. Per-method decorator options (@Expose({ retry: false })) * * Steps 1-3 are resolved here. Steps 4-5 are resolved in ServiceProxy. */ export interface CircuitBreakerOptions { failureThreshold?: number; /** Percentage-based failure rate threshold (0-100). When set, the breaker * opens if the failure rate within the sliding window exceeds this value * AND the minimum sample count is met. Takes precedence over failureThreshold. */ failureRateThreshold?: number; /** Minimum number of calls in the window before failure rate is evaluated. */ minimumCallCount?: number; resetTimeoutMs?: number; successThreshold?: number; windowMs?: number; /** Number of concurrent probe requests allowed in half-open state. */ halfOpenMaxProbes?: number; } export interface RetryOptions { maxAttempts?: number; baseDelayMs?: number; maxDelayMs?: number; } export interface BulkheadOptions { maxConcurrent?: number; } export interface ConcurrencyOptions { initialLimit?: number; minLimit?: number; maxLimit?: number; smoothing?: number; tolerance?: number; } export interface RpcOptions { circuitBreaker?: CircuitBreakerOptions; retry?: RetryOptions | false; defaultTimeout?: number; bulkhead?: BulkheadOptions; concurrency?: ConcurrencyOptions; } export interface RpcConfig { rpc?: RpcOptions; rpcTargets?: Record; } /** * Validate an RPC options object shape. */ export declare function validateRpcOptions(serviceName: string, label: string, options: unknown): void; /** * Deep-merge two RPC options objects. Override values take precedence. * For nested objects (circuitBreaker, retry, bulkhead, concurrency), * individual fields merge so you only need to specify what changes. */ export declare function mergeRpcOptions(base?: RpcOptions, override?: RpcOptions): RpcOptions; /** * Resolve the final RPC options for a specific target service. * Merges service-level `rpc` defaults with target-specific `rpcTargets` overrides. */ export declare function resolveRpcOptionsForTarget(config: RpcConfig | undefined, targetName: string): RpcOptions; //# sourceMappingURL=RpcConfig.d.ts.map