@types/redis-rate-limiter
TypeScript icon, indicating that this package has built-in type declarations

1.2.6 • Public • Published

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

Credits

These definitions were written by Seth Westphal, and Hasan Oezdemir.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/redis-rate-limiter

Weekly Downloads

675

Version

1.2.6

License

MIT

Unpacked Size

4.91 kB

Total Files

5

Last publish

Collaborators

  • types