@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.
40 lines (39 loc) • 1.61 kB
TypeScript
/**
* @module RateLimiter
*/
import { type IKey } from "../../namespace/contracts/_module.js";
import { type RateLimiterBlockedState } from "../../rate-limiter/contracts/rate-limiter-state.contract.js";
import { type InferInstance } from "../../utilities/_module.js";
/**
* The error is throw when rate limiter blocks the attempts.
*
* IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"`
* @group Errors
*/
export declare class BlockedRateLimiterError extends Error {
readonly state: Omit<RateLimiterBlockedState, "type">;
static create(state: Omit<RateLimiterBlockedState, "type">, key: IKey, cause?: unknown): BlockedRateLimiterError;
/**
* Note: Do not instantiate `BlockedRateLimiterError` 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(state: Omit<RateLimiterBlockedState, "type">, message?: string, cause?: unknown);
}
/**
* IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"`
* @group Errors
*/
export declare const RATE_LIMITER_ERRORS: {
readonly Blocked: typeof BlockedRateLimiterError;
};
/**
* IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"`
* @group Errors
*/
export type AllRateLimiterErrors = InferInstance<(typeof RATE_LIMITER_ERRORS)[keyof typeof RATE_LIMITER_ERRORS]>;
/**
* IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"`
* @group Errors
*/
export declare function isRateLimiterError(value: unknown): value is AllRateLimiterErrors;