Installation
npm install --save @types/redis-rate-limiter
Summary
This package contains type definitions for redis-rate-limiter (https://github.com/tabcorp/redis-rate-limiter).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redis-rate-limiter.
index.d.ts
import * as express from "express";
import * as redis from "redis";
declare class RedisRateLimiter {
public static create(
options: RedisRateLimiter.Options,
): (req: express.Request, callback: (err: Error, res: RedisRateLimiter.Response) => void) => void;
public static middleware(options: RedisRateLimiter.Options): express.RequestHandler;
}
declare namespace RedisRateLimiter {
export interface Options {
redis: redis.RedisClient;
key: "ip" | ((req: express.Request) => string);
window?: number | undefined;
limit?: number | undefined;
rate?: string | undefined;
deleteImmediatelyIfRaceCondition?: boolean | undefined;
onPossibleRaceCondition?: ((key: string) => void) | undefined;
}
export interface Response {
key: string;
current: number;
limit: number;
window: number;
over: boolean;
}
}
export = RedisRateLimiter;
Additional Details
- Last updated: Tue, 07 Nov 2023 15:11:36 GMT
- Dependencies: @types/express, @types/redis
Credits
These definitions were written by Seth Westphal, and Hasan Oezdemir.