@types/overload-protection
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

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.

index.d.ts

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/overload-protection

Weekly Downloads

25,991

Version

1.2.4

License

MIT

Unpacked Size

5.58 kB

Total Files

5

Last publish

Collaborators

  • types