1.2.4 • Published 6 months ago

@types/overload-protection v1.2.4

Weekly downloads
503
License
MIT
Repository
github
Last release
6 months ago

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.

1.2.4

6 months ago

1.2.3

7 months ago

1.2.2

8 months ago

1.2.1

3 years ago

1.2.0

4 years ago