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.

49 lines (48 loc) 1.21 kB
/** * @module RateLimiter */ import { type ITimeSpan } from "../../time-span/contracts/_module.js"; /** * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"` * @group Contracts */ export declare const RATE_LIMITER_STATE: { readonly BLOCKED: "BLOCKED"; readonly ALLOWED: "ALLOWED"; }; /** * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"` * @group Contracts */ export type RateLimiterStateLiterals = (typeof RATE_LIMITER_STATE)[keyof typeof RATE_LIMITER_STATE]; /** * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"` * @group Contracts */ export type RateLimiterAllowedState = { type: (typeof RATE_LIMITER_STATE)["ALLOWED"]; usedAttempts: number; reaminingAttemps: number; limit: number; }; /** * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"` * @group Contracts */ export type RateLimiterBlockedState = { type: (typeof RATE_LIMITER_STATE)["BLOCKED"]; limit: number; totalAttempts: number; exceedAttempts: number; resetTime: ITimeSpan; }; /** * * IMPORT_PATH: `"@daiso-tech/core/rate-limiter/contracts"` * @group Contracts */ export type RateLimiterState = RateLimiterBlockedState | RateLimiterAllowedState;