@types/node 14.18.9 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node v14.18 → node}/LICENSE +0 -0
- node/README.md +16 -0
- node/assert/strict.d.ts +4 -0
- node v14.18/assert.d.ts → node/assert.d.ts +8 -7
- node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +11 -7
- node/base.d.ts +19 -0
- node/buffer.d.ts +26 -0
- node v14.18/child_process.d.ts → node/child_process.d.ts +71 -71
- node v14.18/cluster.d.ts → node/cluster.d.ts +17 -16
- node v14.18/console.d.ts → node/console.d.ts +17 -22
- node v14.18/constants.d.ts → node/constants.d.ts +9 -8
- node v14.18/crypto.d.ts → node/crypto.d.ts +139 -54
- node v14.18/dgram.d.ts → node/dgram.d.ts +24 -23
- node/dns/promises.d.ts +101 -0
- node/dns.d.ts +326 -0
- node v14.18/domain.d.ts → node/domain.d.ts +5 -4
- node v14.18/events.d.ts → node/events.d.ts +13 -8
- node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +23 -30
- node v14.18/fs.d.ts → node/fs.d.ts +85 -97
- node v14.18/globals.d.ts → node/globals.d.ts +60 -67
- {node v14.18 → node}/globals.global.d.ts +0 -0
- node v14.18/http.d.ts → node/http.d.ts +114 -178
- node v14.18/http2.d.ts → node/http2.d.ts +86 -79
- node/https.d.ts +40 -0
- node v14.18/index.d.ts → node/index.d.ts +16 -55
- node v14.18/inspector.d.ts → node/inspector.d.ts +159 -162
- node v14.18/module.d.ts → node/module.d.ts +6 -5
- node v14.18/net.d.ts → node/net.d.ts +77 -45
- node v14.18/os.d.ts → node/os.d.ts +4 -3
- node v14.18/package.json → node/package.json +30 -19
- node v14.18/path.d.ts → node/path.d.ts +10 -9
- node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +10 -9
- node v14.18/process.d.ts → node/process.d.ts +58 -18
- node v14.18/punycode.d.ts → node/punycode.d.ts +11 -3
- node v14.18/querystring.d.ts → node/querystring.d.ts +7 -6
- node v14.18/readline.d.ts → node/readline.d.ts +19 -19
- node v14.18/repl.d.ts → node/repl.d.ts +24 -23
- node/stream/promises.d.ts +71 -0
- node v14.18/stream.d.ts → node/stream.d.ts +170 -61
- node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +4 -3
- node/timers/promises.d.ts +17 -0
- node v14.18/timers.d.ts → node/timers.d.ts +20 -5
- node v14.18/tls.d.ts → node/tls.d.ts +56 -57
- node v14.18/trace_events.d.ts → node/trace_events.d.ts +4 -3
- node/ts3.6/assert.d.ts +103 -0
- node/ts3.6/base.d.ts +66 -0
- node/ts3.6/index.d.ts +7 -0
- node v14.18/tty.d.ts → node/tty.d.ts +5 -4
- node v14.18/url.d.ts → node/url.d.ts +21 -20
- node v14.18/util.d.ts → node/util.d.ts +7 -12
- node v14.18/v8.d.ts → node/v8.d.ts +5 -4
- node v14.18/vm.d.ts → node/vm.d.ts +29 -28
- node v14.18/wasi.d.ts → node/wasi.d.ts +11 -10
- node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +27 -23
- node v14.18/zlib.d.ts → node/zlib.d.ts +21 -20
- node v14.18/README.md +0 -16
- node v14.18/buffer.d.ts +0 -89
- node v14.18/dns.d.ts +0 -387
- node v14.18/https.d.ts +0 -142
|
@@ -8,7 +8,7 @@ interface ErrorConstructor {
|
|
|
8
8
|
*
|
|
9
9
|
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
10
10
|
*/
|
|
11
|
-
prepareStackTrace?: (
|
|
11
|
+
prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
|
|
12
12
|
|
|
13
13
|
stackTraceLimit: number;
|
|
14
14
|
}
|
|
@@ -75,53 +75,10 @@ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2"
|
|
|
75
75
|
|
|
76
76
|
type WithImplicitCoercion<T> = T | { valueOf(): T };
|
|
77
77
|
|
|
78
|
-
//#region borrowed
|
|
79
|
-
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
|
80
|
-
/**
|
|
81
|
-
* A controller object that allows you to abort one or more DOM requests as and when desired.
|
|
82
|
-
* @since v14.7.0
|
|
83
|
-
*/
|
|
84
|
-
interface AbortController {
|
|
85
|
-
/**
|
|
86
|
-
* Returns the AbortSignal object associated with this object.
|
|
87
|
-
* @since v14.7.0
|
|
88
|
-
*/
|
|
89
|
-
readonly signal: AbortSignal;
|
|
90
|
-
/**
|
|
91
|
-
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
92
|
-
* @since v14.7.0
|
|
93
|
-
*/
|
|
94
|
-
abort(): void;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
|
|
99
|
-
* @since v14.7.0
|
|
100
|
-
*/
|
|
101
|
-
interface AbortSignal {
|
|
102
|
-
/**
|
|
103
|
-
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
|
104
|
-
* @since v14.7.0
|
|
105
|
-
*/
|
|
106
|
-
readonly aborted: boolean;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
declare var AbortController: {
|
|
110
|
-
prototype: AbortController;
|
|
111
|
-
new(): AbortController;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
declare var AbortSignal: {
|
|
115
|
-
prototype: AbortSignal;
|
|
116
|
-
new(): AbortSignal;
|
|
117
|
-
// TODO: Add abort() static
|
|
118
|
-
};
|
|
119
|
-
//#endregion borrowed
|
|
120
|
-
|
|
121
78
|
/**
|
|
122
79
|
* Raw data is stored in instances of the Buffer class.
|
|
123
80
|
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
|
|
124
|
-
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'
|
|
81
|
+
* Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
125
82
|
*/
|
|
126
83
|
declare class Buffer extends Uint8Array {
|
|
127
84
|
/**
|
|
@@ -203,7 +160,7 @@ declare class Buffer extends Uint8Array {
|
|
|
203
160
|
static isBuffer(obj: any): obj is Buffer;
|
|
204
161
|
/**
|
|
205
162
|
* Returns true if {encoding} is a valid encoding argument.
|
|
206
|
-
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'
|
|
163
|
+
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
207
164
|
*
|
|
208
165
|
* @param encoding string to test.
|
|
209
166
|
*/
|
|
@@ -354,6 +311,39 @@ declare class Buffer extends Uint8Array {
|
|
|
354
311
|
values(): IterableIterator<number>;
|
|
355
312
|
}
|
|
356
313
|
|
|
314
|
+
//#region borrowed
|
|
315
|
+
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
|
316
|
+
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
317
|
+
interface AbortController {
|
|
318
|
+
/**
|
|
319
|
+
* Returns the AbortSignal object associated with this object.
|
|
320
|
+
*/
|
|
321
|
+
readonly signal: AbortSignal;
|
|
322
|
+
/**
|
|
323
|
+
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
324
|
+
*/
|
|
325
|
+
abort(): void;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
|
|
329
|
+
interface AbortSignal {
|
|
330
|
+
/**
|
|
331
|
+
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
|
332
|
+
*/
|
|
333
|
+
readonly aborted: boolean;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
declare var AbortController: {
|
|
337
|
+
prototype: AbortController;
|
|
338
|
+
new(): AbortController;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
declare var AbortSignal: {
|
|
342
|
+
prototype: AbortSignal;
|
|
343
|
+
new(): AbortSignal;
|
|
344
|
+
};
|
|
345
|
+
//#endregion borrowed
|
|
346
|
+
|
|
357
347
|
/*----------------------------------------------*
|
|
358
348
|
* *
|
|
359
349
|
* GLOBAL INTERFACES *
|
|
@@ -369,24 +359,24 @@ declare namespace NodeJS {
|
|
|
369
359
|
* the getter function.
|
|
370
360
|
* @default `false`
|
|
371
361
|
*/
|
|
372
|
-
getters?: 'get' | 'set' | boolean
|
|
373
|
-
showHidden?: boolean
|
|
362
|
+
getters?: 'get' | 'set' | boolean;
|
|
363
|
+
showHidden?: boolean;
|
|
374
364
|
/**
|
|
375
365
|
* @default 2
|
|
376
366
|
*/
|
|
377
|
-
depth?: number | null
|
|
378
|
-
colors?: boolean
|
|
379
|
-
customInspect?: boolean
|
|
380
|
-
showProxy?: boolean
|
|
381
|
-
maxArrayLength?: number | null
|
|
367
|
+
depth?: number | null;
|
|
368
|
+
colors?: boolean;
|
|
369
|
+
customInspect?: boolean;
|
|
370
|
+
showProxy?: boolean;
|
|
371
|
+
maxArrayLength?: number | null;
|
|
382
372
|
/**
|
|
383
373
|
* Specifies the maximum number of characters to
|
|
384
374
|
* include when formatting. Set to `null` or `Infinity` to show all elements.
|
|
385
375
|
* Set to `0` or negative to show no characters.
|
|
386
|
-
* @default
|
|
376
|
+
* @default 10000
|
|
387
377
|
*/
|
|
388
|
-
maxStringLength?: number | null
|
|
389
|
-
breakLength?: number
|
|
378
|
+
maxStringLength?: number | null;
|
|
379
|
+
breakLength?: number;
|
|
390
380
|
/**
|
|
391
381
|
* Setting this to `false` causes each object key
|
|
392
382
|
* to be displayed on a new line. It will also add new lines to text that is
|
|
@@ -397,8 +387,8 @@ declare namespace NodeJS {
|
|
|
397
387
|
* For more information, see the example below.
|
|
398
388
|
* @default `true`
|
|
399
389
|
*/
|
|
400
|
-
compact?: boolean | number
|
|
401
|
-
sorted?: boolean | ((a: string, b: string) => number)
|
|
390
|
+
compact?: boolean | number;
|
|
391
|
+
sorted?: boolean | ((a: string, b: string) => number);
|
|
402
392
|
}
|
|
403
393
|
|
|
404
394
|
interface CallSite {
|
|
@@ -476,10 +466,11 @@ declare namespace NodeJS {
|
|
|
476
466
|
}
|
|
477
467
|
|
|
478
468
|
interface ErrnoException extends Error {
|
|
479
|
-
errno?: number
|
|
480
|
-
code?: string
|
|
481
|
-
path?: string
|
|
482
|
-
syscall?: string
|
|
469
|
+
errno?: number;
|
|
470
|
+
code?: string;
|
|
471
|
+
path?: string;
|
|
472
|
+
syscall?: string;
|
|
473
|
+
stack?: string;
|
|
483
474
|
}
|
|
484
475
|
|
|
485
476
|
interface ReadableStream extends EventEmitter {
|
|
@@ -489,7 +480,7 @@ declare namespace NodeJS {
|
|
|
489
480
|
pause(): this;
|
|
490
481
|
resume(): this;
|
|
491
482
|
isPaused(): boolean;
|
|
492
|
-
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean
|
|
483
|
+
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
|
493
484
|
unpipe(destination?: WritableStream): this;
|
|
494
485
|
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
495
486
|
wrap(oldStream: ReadableStream): this;
|
|
@@ -500,14 +491,16 @@ declare namespace NodeJS {
|
|
|
500
491
|
writable: boolean;
|
|
501
492
|
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
502
493
|
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
503
|
-
end(cb?: () => void):
|
|
504
|
-
end(data: string | Uint8Array, cb?: () => void):
|
|
505
|
-
end(str: string, encoding?: BufferEncoding, cb?: () => void):
|
|
494
|
+
end(cb?: () => void): void;
|
|
495
|
+
end(data: string | Uint8Array, cb?: () => void): void;
|
|
496
|
+
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
|
|
506
497
|
}
|
|
507
498
|
|
|
508
499
|
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
|
509
500
|
|
|
510
501
|
interface Global {
|
|
502
|
+
AbortController: typeof AbortController;
|
|
503
|
+
AbortSignal: typeof AbortSignal;
|
|
511
504
|
Array: typeof Array;
|
|
512
505
|
ArrayBuffer: typeof ArrayBuffer;
|
|
513
506
|
Boolean: typeof Boolean;
|
|
@@ -619,7 +612,7 @@ declare namespace NodeJS {
|
|
|
619
612
|
}
|
|
620
613
|
|
|
621
614
|
interface RequireResolve {
|
|
622
|
-
(id: string, options?: { paths?: string[]
|
|
615
|
+
(id: string, options?: { paths?: string[]; }): string;
|
|
623
616
|
paths(request: string): string[] | null;
|
|
624
617
|
}
|
|
625
618
|
|
|
File without changes
|
|
@@ -1,73 +1,77 @@
|
|
|
1
|
+
declare module 'node:http' {
|
|
2
|
+
export * from 'http';
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
declare module 'http' {
|
|
2
|
-
import * as stream from 'stream';
|
|
3
|
-
import { URL } from 'url';
|
|
4
|
-
import { Socket, Server as NetServer
|
|
6
|
+
import * as stream from 'node:stream';
|
|
7
|
+
import { URL } from 'node:url';
|
|
8
|
+
import { Socket, Server as NetServer } from 'node:net';
|
|
5
9
|
|
|
6
10
|
// incoming headers will never contain number
|
|
7
11
|
interface IncomingHttpHeaders extends NodeJS.Dict<string | string[]> {
|
|
8
|
-
'accept'?: string
|
|
9
|
-
'accept-language'?: string
|
|
10
|
-
'accept-patch'?: string
|
|
11
|
-
'accept-ranges'?: string
|
|
12
|
-
'access-control-allow-credentials'?: string
|
|
13
|
-
'access-control-allow-headers'?: string
|
|
14
|
-
'access-control-allow-methods'?: string
|
|
15
|
-
'access-control-allow-origin'?: string
|
|
16
|
-
'access-control-expose-headers'?: string
|
|
17
|
-
'access-control-max-age'?: string
|
|
18
|
-
'access-control-request-headers'?: string
|
|
19
|
-
'access-control-request-method'?: string
|
|
20
|
-
'age'?: string
|
|
21
|
-
'allow'?: string
|
|
22
|
-
'alt-svc'?: string
|
|
23
|
-
'authorization'?: string
|
|
24
|
-
'cache-control'?: string
|
|
25
|
-
'connection'?: string
|
|
26
|
-
'content-disposition'?: string
|
|
27
|
-
'content-encoding'?: string
|
|
28
|
-
'content-language'?: string
|
|
29
|
-
'content-length'?: string
|
|
30
|
-
'content-location'?: string
|
|
31
|
-
'content-range'?: string
|
|
32
|
-
'content-type'?: string
|
|
33
|
-
'cookie'?: string
|
|
34
|
-
'date'?: string
|
|
35
|
-
'etag'?: string
|
|
36
|
-
'expect'?: string
|
|
37
|
-
'expires'?: string
|
|
38
|
-
'forwarded'?: string
|
|
39
|
-
'from'?: string
|
|
40
|
-
'host'?: string
|
|
41
|
-
'if-match'?: string
|
|
42
|
-
'if-modified-since'?: string
|
|
43
|
-
'if-none-match'?: string
|
|
44
|
-
'if-unmodified-since'?: string
|
|
45
|
-
'last-modified'?: string
|
|
46
|
-
'location'?: string
|
|
47
|
-
'origin'?: string
|
|
48
|
-
'pragma'?: string
|
|
49
|
-
'proxy-authenticate'?: string
|
|
50
|
-
'proxy-authorization'?: string
|
|
51
|
-
'public-key-pins'?: string
|
|
52
|
-
'range'?: string
|
|
53
|
-
'referer'?: string
|
|
54
|
-
'retry-after'?: string
|
|
55
|
-
'sec-websocket-accept'?: string
|
|
56
|
-
'sec-websocket-extensions'?: string
|
|
57
|
-
'sec-websocket-key'?: string
|
|
58
|
-
'sec-websocket-protocol'?: string
|
|
59
|
-
'sec-websocket-version'?: string
|
|
60
|
-
'set-cookie'?: string[]
|
|
61
|
-
'strict-transport-security'?: string
|
|
62
|
-
'tk'?: string
|
|
63
|
-
'trailer'?: string
|
|
64
|
-
'transfer-encoding'?: string
|
|
65
|
-
'upgrade'?: string
|
|
66
|
-
'user-agent'?: string
|
|
67
|
-
'vary'?: string
|
|
68
|
-
'via'?: string
|
|
69
|
-
'warning'?: string
|
|
70
|
-
'www-authenticate'?: string
|
|
12
|
+
'accept'?: string;
|
|
13
|
+
'accept-language'?: string;
|
|
14
|
+
'accept-patch'?: string;
|
|
15
|
+
'accept-ranges'?: string;
|
|
16
|
+
'access-control-allow-credentials'?: string;
|
|
17
|
+
'access-control-allow-headers'?: string;
|
|
18
|
+
'access-control-allow-methods'?: string;
|
|
19
|
+
'access-control-allow-origin'?: string;
|
|
20
|
+
'access-control-expose-headers'?: string;
|
|
21
|
+
'access-control-max-age'?: string;
|
|
22
|
+
'access-control-request-headers'?: string;
|
|
23
|
+
'access-control-request-method'?: string;
|
|
24
|
+
'age'?: string;
|
|
25
|
+
'allow'?: string;
|
|
26
|
+
'alt-svc'?: string;
|
|
27
|
+
'authorization'?: string;
|
|
28
|
+
'cache-control'?: string;
|
|
29
|
+
'connection'?: string;
|
|
30
|
+
'content-disposition'?: string;
|
|
31
|
+
'content-encoding'?: string;
|
|
32
|
+
'content-language'?: string;
|
|
33
|
+
'content-length'?: string;
|
|
34
|
+
'content-location'?: string;
|
|
35
|
+
'content-range'?: string;
|
|
36
|
+
'content-type'?: string;
|
|
37
|
+
'cookie'?: string;
|
|
38
|
+
'date'?: string;
|
|
39
|
+
'etag'?: string;
|
|
40
|
+
'expect'?: string;
|
|
41
|
+
'expires'?: string;
|
|
42
|
+
'forwarded'?: string;
|
|
43
|
+
'from'?: string;
|
|
44
|
+
'host'?: string;
|
|
45
|
+
'if-match'?: string;
|
|
46
|
+
'if-modified-since'?: string;
|
|
47
|
+
'if-none-match'?: string;
|
|
48
|
+
'if-unmodified-since'?: string;
|
|
49
|
+
'last-modified'?: string;
|
|
50
|
+
'location'?: string;
|
|
51
|
+
'origin'?: string;
|
|
52
|
+
'pragma'?: string;
|
|
53
|
+
'proxy-authenticate'?: string;
|
|
54
|
+
'proxy-authorization'?: string;
|
|
55
|
+
'public-key-pins'?: string;
|
|
56
|
+
'range'?: string;
|
|
57
|
+
'referer'?: string;
|
|
58
|
+
'retry-after'?: string;
|
|
59
|
+
'sec-websocket-accept'?: string;
|
|
60
|
+
'sec-websocket-extensions'?: string;
|
|
61
|
+
'sec-websocket-key'?: string;
|
|
62
|
+
'sec-websocket-protocol'?: string;
|
|
63
|
+
'sec-websocket-version'?: string;
|
|
64
|
+
'set-cookie'?: string[];
|
|
65
|
+
'strict-transport-security'?: string;
|
|
66
|
+
'tk'?: string;
|
|
67
|
+
'trailer'?: string;
|
|
68
|
+
'transfer-encoding'?: string;
|
|
69
|
+
'upgrade'?: string;
|
|
70
|
+
'user-agent'?: string;
|
|
71
|
+
'vary'?: string;
|
|
72
|
+
'via'?: string;
|
|
73
|
+
'warning'?: string;
|
|
74
|
+
'www-authenticate'?: string;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
// outgoing headers allows numbers (as they are converted internally to strings)
|
|
@@ -77,55 +81,52 @@ declare module 'http' {
|
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
interface ClientRequestArgs {
|
|
80
|
-
protocol?: string | null
|
|
81
|
-
host?: string | null
|
|
82
|
-
hostname?: string | null
|
|
83
|
-
family?: number
|
|
84
|
-
port?: number | string | null
|
|
85
|
-
defaultPort?: number | string
|
|
86
|
-
localAddress?: string
|
|
87
|
-
socketPath?: string
|
|
84
|
+
protocol?: string | null;
|
|
85
|
+
host?: string | null;
|
|
86
|
+
hostname?: string | null;
|
|
87
|
+
family?: number;
|
|
88
|
+
port?: number | string | null;
|
|
89
|
+
defaultPort?: number | string;
|
|
90
|
+
localAddress?: string;
|
|
91
|
+
socketPath?: string;
|
|
88
92
|
/**
|
|
89
93
|
* @default 8192
|
|
90
94
|
*/
|
|
91
|
-
maxHeaderSize?: number
|
|
92
|
-
method?: string
|
|
93
|
-
path?: string | null
|
|
94
|
-
headers?: OutgoingHttpHeaders
|
|
95
|
-
auth?: string | null
|
|
96
|
-
agent?: Agent | boolean
|
|
97
|
-
_defaultAgent?: Agent
|
|
98
|
-
timeout?: number
|
|
99
|
-
setHost?: boolean
|
|
95
|
+
maxHeaderSize?: number;
|
|
96
|
+
method?: string;
|
|
97
|
+
path?: string | null;
|
|
98
|
+
headers?: OutgoingHttpHeaders;
|
|
99
|
+
auth?: string | null;
|
|
100
|
+
agent?: Agent | boolean;
|
|
101
|
+
_defaultAgent?: Agent;
|
|
102
|
+
timeout?: number;
|
|
103
|
+
setHost?: boolean;
|
|
100
104
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
|
|
101
|
-
createConnection?: (
|
|
102
|
-
lookup?: LookupFunction | undefined;
|
|
105
|
+
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
interface ServerOptions {
|
|
106
|
-
IncomingMessage?: typeof IncomingMessage
|
|
107
|
-
ServerResponse?: typeof ServerResponse
|
|
109
|
+
IncomingMessage?: typeof IncomingMessage;
|
|
110
|
+
ServerResponse?: typeof ServerResponse;
|
|
108
111
|
/**
|
|
109
112
|
* Optionally overrides the value of
|
|
110
113
|
* [`--max-http-header-size`][] for requests received by this server, i.e.
|
|
111
114
|
* the maximum length of request headers in bytes.
|
|
112
115
|
* @default 8192
|
|
113
116
|
*/
|
|
114
|
-
maxHeaderSize?: number
|
|
117
|
+
maxHeaderSize?: number;
|
|
115
118
|
/**
|
|
116
119
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when true.
|
|
117
120
|
* Using the insecure parser should be avoided.
|
|
118
121
|
* See --insecure-http-parser for more information.
|
|
119
122
|
* @default false
|
|
120
123
|
*/
|
|
121
|
-
insecureHTTPParser?: boolean
|
|
124
|
+
insecureHTTPParser?: boolean;
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
constructor(requestListener?: RequestListener);
|
|
128
|
-
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
129
|
+
interface HttpBase {
|
|
129
130
|
setTimeout(msecs?: number, callback?: () => void): this;
|
|
130
131
|
setTimeout(callback: () => void): this;
|
|
131
132
|
/**
|
|
@@ -148,72 +149,12 @@ declare module 'http' {
|
|
|
148
149
|
* {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
|
|
149
150
|
*/
|
|
150
151
|
requestTimeout: number;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
addListener(event: 'checkExpectation', listener: RequestListener): this;
|
|
158
|
-
addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
159
|
-
addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
160
|
-
addListener(event: 'request', listener: RequestListener): this;
|
|
161
|
-
addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
162
|
-
emit(event: string, ...args: any[]): boolean;
|
|
163
|
-
emit(event: 'close'): boolean;
|
|
164
|
-
emit(event: 'connection', socket: Socket): boolean;
|
|
165
|
-
emit(event: 'error', err: Error): boolean;
|
|
166
|
-
emit(event: 'listening'): boolean;
|
|
167
|
-
emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
|
|
168
|
-
emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
|
|
169
|
-
emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
|
|
170
|
-
emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
|
|
171
|
-
emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
|
|
172
|
-
emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
|
|
173
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
174
|
-
on(event: 'close', listener: () => void): this;
|
|
175
|
-
on(event: 'connection', listener: (socket: Socket) => void): this;
|
|
176
|
-
on(event: 'error', listener: (err: Error) => void): this;
|
|
177
|
-
on(event: 'listening', listener: () => void): this;
|
|
178
|
-
on(event: 'checkContinue', listener: RequestListener): this;
|
|
179
|
-
on(event: 'checkExpectation', listener: RequestListener): this;
|
|
180
|
-
on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
181
|
-
on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
182
|
-
on(event: 'request', listener: RequestListener): this;
|
|
183
|
-
on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
184
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
185
|
-
once(event: 'close', listener: () => void): this;
|
|
186
|
-
once(event: 'connection', listener: (socket: Socket) => void): this;
|
|
187
|
-
once(event: 'error', listener: (err: Error) => void): this;
|
|
188
|
-
once(event: 'listening', listener: () => void): this;
|
|
189
|
-
once(event: 'checkContinue', listener: RequestListener): this;
|
|
190
|
-
once(event: 'checkExpectation', listener: RequestListener): this;
|
|
191
|
-
once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
192
|
-
once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
193
|
-
once(event: 'request', listener: RequestListener): this;
|
|
194
|
-
once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
195
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
196
|
-
prependListener(event: 'close', listener: () => void): this;
|
|
197
|
-
prependListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
198
|
-
prependListener(event: 'error', listener: (err: Error) => void): this;
|
|
199
|
-
prependListener(event: 'listening', listener: () => void): this;
|
|
200
|
-
prependListener(event: 'checkContinue', listener: RequestListener): this;
|
|
201
|
-
prependListener(event: 'checkExpectation', listener: RequestListener): this;
|
|
202
|
-
prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
203
|
-
prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
204
|
-
prependListener(event: 'request', listener: RequestListener): this;
|
|
205
|
-
prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
206
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
207
|
-
prependOnceListener(event: 'close', listener: () => void): this;
|
|
208
|
-
prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
209
|
-
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
210
|
-
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
211
|
-
prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
|
|
212
|
-
prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
|
|
213
|
-
prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
|
|
214
|
-
prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
215
|
-
prependOnceListener(event: 'request', listener: RequestListener): this;
|
|
216
|
-
prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface Server extends HttpBase {}
|
|
155
|
+
class Server extends NetServer {
|
|
156
|
+
constructor(requestListener?: RequestListener);
|
|
157
|
+
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
217
158
|
}
|
|
218
159
|
|
|
219
160
|
// https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
|
|
@@ -229,7 +170,7 @@ declare module 'http' {
|
|
|
229
170
|
finished: boolean;
|
|
230
171
|
headersSent: boolean;
|
|
231
172
|
/**
|
|
232
|
-
* @
|
|
173
|
+
* @deprecate Use `socket` instead.
|
|
233
174
|
*/
|
|
234
175
|
connection: Socket | null;
|
|
235
176
|
socket: Socket | null;
|
|
@@ -237,7 +178,7 @@ declare module 'http' {
|
|
|
237
178
|
constructor();
|
|
238
179
|
|
|
239
180
|
setTimeout(msecs: number, callback?: () => void): this;
|
|
240
|
-
setHeader(name: string, value: number | string | ReadonlyArray<string>):
|
|
181
|
+
setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
|
|
241
182
|
getHeader(name: string): number | string | string[] | undefined;
|
|
242
183
|
getHeaders(): OutgoingHttpHeaders;
|
|
243
184
|
getHeaderNames(): string[];
|
|
@@ -259,7 +200,7 @@ declare module 'http' {
|
|
|
259
200
|
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
|
|
260
201
|
// no args in writeContinue callback
|
|
261
202
|
writeContinue(callback?: () => void): void;
|
|
262
|
-
writeHead(statusCode: number,
|
|
203
|
+
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
263
204
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
264
205
|
writeProcessing(): void;
|
|
265
206
|
}
|
|
@@ -279,8 +220,6 @@ declare module 'http' {
|
|
|
279
220
|
aborted: boolean;
|
|
280
221
|
host: string;
|
|
281
222
|
protocol: string;
|
|
282
|
-
reusedSocket: boolean;
|
|
283
|
-
maxHeadersCount: number;
|
|
284
223
|
|
|
285
224
|
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
|
286
225
|
|
|
@@ -395,52 +334,52 @@ declare module 'http' {
|
|
|
395
334
|
/**
|
|
396
335
|
* Only valid for request obtained from http.Server.
|
|
397
336
|
*/
|
|
398
|
-
method?: string
|
|
337
|
+
method?: string;
|
|
399
338
|
/**
|
|
400
339
|
* Only valid for request obtained from http.Server.
|
|
401
340
|
*/
|
|
402
|
-
url?: string
|
|
341
|
+
url?: string;
|
|
403
342
|
/**
|
|
404
343
|
* Only valid for response obtained from http.ClientRequest.
|
|
405
344
|
*/
|
|
406
|
-
statusCode?: number
|
|
345
|
+
statusCode?: number;
|
|
407
346
|
/**
|
|
408
347
|
* Only valid for response obtained from http.ClientRequest.
|
|
409
348
|
*/
|
|
410
|
-
statusMessage?: string
|
|
411
|
-
destroy(error?: Error):
|
|
349
|
+
statusMessage?: string;
|
|
350
|
+
destroy(error?: Error): void;
|
|
412
351
|
}
|
|
413
352
|
|
|
414
353
|
interface AgentOptions {
|
|
415
354
|
/**
|
|
416
355
|
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
|
417
356
|
*/
|
|
418
|
-
keepAlive?: boolean
|
|
357
|
+
keepAlive?: boolean;
|
|
419
358
|
/**
|
|
420
359
|
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
|
|
421
360
|
* Only relevant if keepAlive is set to true.
|
|
422
361
|
*/
|
|
423
|
-
keepAliveMsecs?: number
|
|
362
|
+
keepAliveMsecs?: number;
|
|
424
363
|
/**
|
|
425
364
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
|
426
365
|
*/
|
|
427
|
-
maxSockets?: number
|
|
366
|
+
maxSockets?: number;
|
|
428
367
|
/**
|
|
429
368
|
* Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
|
|
430
369
|
*/
|
|
431
|
-
maxTotalSockets?: number
|
|
370
|
+
maxTotalSockets?: number;
|
|
432
371
|
/**
|
|
433
372
|
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
|
434
373
|
*/
|
|
435
|
-
maxFreeSockets?: number
|
|
374
|
+
maxFreeSockets?: number;
|
|
436
375
|
/**
|
|
437
376
|
* Socket timeout in milliseconds. This will set the timeout after the socket is connected.
|
|
438
377
|
*/
|
|
439
|
-
timeout?: number
|
|
378
|
+
timeout?: number;
|
|
440
379
|
/**
|
|
441
380
|
* Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
|
|
442
381
|
*/
|
|
443
|
-
scheduling?: 'fifo' | 'lifo'
|
|
382
|
+
scheduling?: 'fifo' | 'lifo';
|
|
444
383
|
}
|
|
445
384
|
|
|
446
385
|
class Agent {
|
|
@@ -487,6 +426,3 @@ declare module 'http' {
|
|
|
487
426
|
*/
|
|
488
427
|
const maxHeaderSize: number;
|
|
489
428
|
}
|
|
490
|
-
declare module 'node:http' {
|
|
491
|
-
export * from 'http';
|
|
492
|
-
}
|