Type Alias RateLimiterAllowedState

RateLimiterAllowedState: {
    limit: number;
    remainingAttempts: number;
    resetAfter: TimeSpan;
    type: typeof RATE_LIMITER_STATE["ALLOWED"];
    usedAttempts: number;
}

Represents a rate limiter state where requests are being allowed. The rate limiter is tracking attempts and has remaining quota available. This state includes metrics about current usage within the configured limit.

IMPORT_PATH: "@daiso-tech/core/rate-limiter/contracts"

Type declaration

  • limit: number

    Maximum number of allowed attempts in the current time window. Configured when the rate limiter was created.

  • remainingAttempts: number

    Number of attempts remaining before the rate limiter blocks further requests. Calculated as (limit - usedAttempts).

  • resetAfter: TimeSpan

    Time duration until the rate limiter resets and begins a new window. Attempts counter will reset after this time span elapses.

  • type: typeof RATE_LIMITER_STATE["ALLOWED"]

    Discriminator for the ALLOWED state.

  • usedAttempts: number

    Number of attempts already consumed in the current time window. This represents the current usage count within the limit.