1.2.6 • Published 6 months ago
@types/redis-rate-limiter v1.2.6
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
// Type definitions for redis-rate-limiter 1.2
// Project: https://github.com/tabcorp/redis-rate-limiter
// Definitions by: Seth Westphal <https://github.com/westy92>
// Hasan Oezdemir <https://github.com/nodify-at>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
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: Thu, 09 Dec 2021 09:01:25 GMT
- Dependencies: @types/express, @types/redis
- Global values: none
Credits
These definitions were written by Seth Westphal, and Hasan Oezdemir.