From b87f1be92d9733709caf7dbc6815af80dde76b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 14 Apr 2021 19:35:21 +0200 Subject: typings: add types for "http_parser" and "options" bindings PR-URL: https://github.com/nodejs/node/pull/38239 Reviewed-By: James M Snell Reviewed-By: Daniele Belardi --- typings/internalBinding/http_parser.d.ts | 42 ++++++++++++++++++++++++++++++++ typings/internalBinding/options.d.ts | 34 ++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 typings/internalBinding/http_parser.d.ts create mode 100644 typings/internalBinding/options.d.ts (limited to 'typings') diff --git a/typings/internalBinding/http_parser.d.ts b/typings/internalBinding/http_parser.d.ts new file mode 100644 index 0000000000..260c6e802b --- /dev/null +++ b/typings/internalBinding/http_parser.d.ts @@ -0,0 +1,42 @@ +declare namespace InternalHttpParserBinding { + class HTTPParser { + static REQUEST: 1; + static RESPONSE: 2; + + static kOnMessageBegin: 0; + static kOnHeaders: 1; + static kOnHeadersComplete: 2; + static kOnBody: 3; + static kOnMessageComplete: 4; + static kOnExecute: 5; + static kOnTimeout: 6; + + static kLenientNone: number; + static kLenientHeaders: number; + static kLenientChunkedLength: number; + static kLenientKeepAlive: number; + static kLenientAll: number; + + close(): void; + free(): void; + execute(buffer: Buffer): Error | Buffer; + finish(): Error | Buffer; + initialize( + type: number, + resource: object, + maxHeaderSize?: number, + lenient?: number, + headersTimeout?: number, + ): void; + pause(): void; + resume(): void; + consume(stream: object): void; + unconsume(): void; + getCurrentBuffer(): Buffer; + } +} + +declare function InternalBinding(binding: 'http_parser'): { + methods: string[]; + HTTPParser: typeof InternalHttpParserBinding.HTTPParser; +}; diff --git a/typings/internalBinding/options.d.ts b/typings/internalBinding/options.d.ts new file mode 100644 index 0000000000..2257463174 --- /dev/null +++ b/typings/internalBinding/options.d.ts @@ -0,0 +1,34 @@ +declare function InternalBinding(binding: 'options'): { + getOptions(): { + options: Map< + string, + { + helpText: string; + envVarSettings: 0 | 1; + } & ( + | { type: 0 | 1; value: undefined } + | { type: 2; value: boolean } + | { type: 3 | 4; value: number } + | { type: 5; value: string } + | { type: 6; value: { host: string; port: number } } + | { type: 7; value: string[] } + ) + >; + aliases: Map; + }; + envSettings: { + kAllowedInEnvironment: 0; + kDisallowedInEnvironment: 1; + }; + shouldNotRegisterESMLoader: boolean; + types: { + kNoOp: 0; + kV8Option: 1; + kBoolean: 2; + kInteger: 3; + kUInteger: 4; + kString: 5; + kHostPort: 6; + kStringList: 7; + }; +}; -- cgit v1.2.1