1.2.6 • Published 6 months ago

@types/redis-rate-limiter v1.2.6

Weekly downloads
551
License
MIT
Repository
github
Last release
6 months ago

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

Credits

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

1.2.6

6 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

2 years ago

1.2.2

3 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago