UNPKG

@universis/janitor

Version:

Universis api plugin for handling user authorization and rate limiting

23 lines (20 loc) 962 B
import { ApplicationService } from '@themost/common'; import { Application, Router } from 'express'; import { Options as RateLimitProfile, Store } from 'express-rate-limit'; import { BehaviorSubject } from 'rxjs'; export declare type RateLimitStoreConstructor = new (...arg: unknown[]) => Store; export declare interface RateLimitServiceConfiguration { extends?: string; storeType?: string; profiles?: [string, RateLimitProfile][]; paths?: [string, ({ profile: string } | RateLimitProfile)][]; } export declare class RateLimitService extends ApplicationService { constructor(app: import('@themost/common').ApplicationBase); readonly loaded: BehaviorSubject<Router>; getServiceContainer(): BehaviorSubject<Router | Application>; getServiceName(): string; getServiceConfiguration(): RateLimitServiceConfiguration; set(path: string, options: { profile?: string } | RateLimitProfile): this; unset(path: string): this; }