Installation
npm install --save @types/overload-protection
Summary
This package contains type definitions for overload-protection (https://github.com/davidmarkclements/overload-protection).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/overload-protection.
declare namespace protect {
type KoaFrameworkSelection = "koa";
type HttpFrameworkSelection = "express" | "http" | "restify";
interface ProtectionConfig {
production?: boolean | undefined;
clientRetrySecs?: number | undefined;
sampleInterval?: number | undefined;
maxEventLoopDelay?: number | undefined;
maxHeapUsedBytes?: number | undefined;
maxRssBytes?: number | undefined;
errorPropagationMode?: boolean | undefined;
logging?: boolean | string | ((msg: string) => void) | undefined;
logStatsOnReq?: false | undefined;
}
interface ProtectionInstance {
overload: boolean;
eventLoopOverload: boolean;
heapUsedOverload: boolean;
rssOverload: boolean;
eventLoopDelay: number;
maxEventLoopDelay: number;
maxHeapUsedBytes: number;
maxRssBytes: number;
}
interface KoaProtectionInstance extends ProtectionInstance {
(ctx: object, next: () => any): any;
}
interface HttpProtectionInstance extends ProtectionInstance {
(req: object, res: object, next: () => any): any;
}
}
declare function protect(
framework: protect.KoaFrameworkSelection,
config?: protect.ProtectionConfig,
): protect.KoaProtectionInstance;
declare function protect(
framework: protect.HttpFrameworkSelection,
config?: protect.ProtectionConfig,
): protect.HttpProtectionInstance;
export = protect;
Additional Details
- Last updated: Tue, 07 Nov 2023 09:09:39 GMT
- Dependencies: none
Credits
These definitions were written by Daniel Hirth.