/** * @module RateLimiter */ import { type BackoffPolicy } from "../../../../backoff-policies/contracts/_module.js"; import { type IReadableContext } from "../../../../execution-context/contracts/_module.js"; import { type IRateLimiterStorageAdapter } from "../../../../rate-limiter/contracts/_module.js"; import { type AllRateLimiterState, type InternalRateLimiterPolicy } from "../../../../rate-limiter/implementations/adapters/database-rate-limiter-adapter/internal-rate-limiter-policy.js"; import { type InvocableFn } from "../../../../utilities/_module.js"; /** * @internal */ export type RateLimiterStorageSettings = { adapter: IRateLimiterStorageAdapter>; rateLimiterPolicy: InternalRateLimiterPolicy; backoffPolicy: BackoffPolicy; }; /** * @internal */ export type IRateLimiterStorageState = { success: boolean; attempt: number; resetTime: Date; }; /** * @internal */ export type AtomicUpdateArgs = { context: IReadableContext; key: string; update: InvocableFn<[ currentState: AllRateLimiterState ], AllRateLimiterState>; }; /** * @internal */ export declare class RateLimiterStorage { private readonly adapter; private readonly rateLimiterPolicy; private readonly backoffPolicy; constructor(settings: RateLimiterStorageSettings); private static resolveStorageData; private toAdapterState; atomicUpdate(args: AtomicUpdateArgs): Promise; find(context: IReadableContext, key: string): Promise; remove(context: IReadableContext, key: string): Promise; }