@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.
16 lines (15 loc) • 825 B
TypeScript
/**
* @module RateLimiter
*/
import { type BackoffPolicy } from "../../../../backoff-policies/contracts/_module.js";
import { type AllRateLimiterState, type InternalRateLimiterPolicy } from "../../../../rate-limiter/implementations/adapters/database-rate-limiter-adapter/internal-rate-limiter-policy.js";
/**
* @internal
*/
export declare class RateLimiterStateManager<TMetrics = unknown> {
private readonly rateLimiterPolicy;
private readonly backoffPolicy;
constructor(rateLimiterPolicy: InternalRateLimiterPolicy<TMetrics>, backoffPolicy: BackoffPolicy);
updateState: (limit: number, currentDate: Date) => (currentState: AllRateLimiterState<TMetrics>) => AllRateLimiterState<TMetrics>;
track: (currentDate: Date) => (currentState: AllRateLimiterState<TMetrics>) => AllRateLimiterState<TMetrics>;
}