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

    1.2.1 • 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

    // Type definitions for overload-protection 1.2
    // Project: https://github.com/davidmarkclements/overload-protection
    // Definitions by: Daniel Hirth <https://github.com/dornfeder>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    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: Thu, 08 Jul 2021 20:19:13 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Daniel Hirth.

    Keywords

    none

    Install

    npm i @types/overload-protection

    DownloadsWeekly Downloads

    2,097

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    6.11 kB

    Total Files

    4

    Last publish

    Collaborators

    • types