UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

70 lines (69 loc) 2.81 kB
/** * @module Resilience */ import { type TimeSpan } from "../../time-span/implementations/_module.js"; /** * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export declare class TimeoutResilienceError extends Error { readonly waitTime: TimeSpan; static create(waitTime: TimeSpan): TimeoutResilienceError; /** * Note: Do not instantiate `TimeoutResilienceError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(waitTime: TimeSpan, message: string, cause?: unknown); } /** * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export declare class RetryResilienceError extends AggregateError { readonly maxAttempts: number; static create(allErrors: Array<unknown>, maxAttempts: number): RetryResilienceError; /** * Note: Do not instantiate `RetryResilienceError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(errors: Array<unknown>, maxAttempts: number, message: string); } /** * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export declare class RetryIntervalResilienceError extends AggregateError { readonly attempts: number; readonly time: TimeSpan; readonly interval: TimeSpan; static create(allErrors: Array<unknown>, attempt: number, time: TimeSpan, interval: TimeSpan): RetryIntervalResilienceError; /** * Note: Do not instantiate `RetryIntervalResilienceError` directly via the constructor. Use the static `create()` factory method instead. * The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors. * @internal */ constructor(errors: Array<unknown>, attempts: number, time: TimeSpan, interval: TimeSpan, message: string); } /** * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export declare const RESILIENCE_ERRORS: { readonly RetryInterval: typeof RetryIntervalResilienceError; readonly Retry: typeof RetryResilienceError; readonly Timeout: typeof TimeoutResilienceError; }; /** * Union of all error types that can be thrown by resilience middlewares. * * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export type AllResilienceErrors = RetryIntervalResilienceError | RetryResilienceError | TimeoutResilienceError; /** * IMPORT_PATH: `"@daiso-tech/core/resilience"` * @group Errors */ export declare function isResilienceError(value: unknown): value is AllResilienceErrors;