import { Context } from "koa"; import MemoryStore = require("./src/MemoryStore"); import MongodbStore = require("./src/MongodbStore"); import RateLimit = require("./src/RateLimit"); import RedisStore = require("./src/RedisStore"); import SequelizeStore = require("./src/SequelizeStore"); import Store = require("./src/Store"); export = Koa2Ratelimit; declare const Koa2Ratelimit: { RateLimit: typeof RateLimit; Stores: { Memory: typeof MemoryStore; Sequelize: typeof SequelizeStore; Mongodb: typeof MongodbStore; Redis: typeof RedisStore; Store: typeof Store; }; }; declare namespace Koa2Ratelimit { type TimeKey = "ms" | "sec" | "min" | "hour" | "day" | "week" | "month" | "year"; type TimeKeyObject = { [key in TimeKey]?: number; }; interface RateLimitOptions { interval: TimeKeyObject | number; delayAfter: number; timeWait: TimeKeyObject | number; max: number; message: string; statusCode: number; headers: boolean; skipFailedRequests: boolean; prefixKey: string; store: Store; keyGenerator(ctx: Context): Promise; skip(ctx: Context): Promise; getUserId(ctx: Context): Promise; handler(ctx: Context): Promise; onLimitReached(ctx: Context): Promise; weight(ctx: Context): Promise; whitelist: string[]; } }