IRateLimiterAdapter: {
    getState(
        context: IReadableContext,
        key: string,
    ): Promise<null | IRateLimiterAdapterState>;
    reset(context: IReadableContext, key: string): Promise<void>;
    updateState(
        context: IReadableContext,
        key: string,
        limit: number,
    ): Promise<IRateLimiterAdapterState>;
}

Low-level adapter contract for rate limiter implementations. Provides core operations for tracking attempts and enforcing limits according to the adapter's configured policy. This contract is not meant to be used directly; instead use IRateLimiterFactory.

The adapter works with a policy interface that determines the blocking algorithm (e.g., fixed-window, sliding-window). This separation allows multiple algorithm implementations to share the same storage layer.

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

Type declaration