@types/node 14.18.8 → 15.0.2
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 +3 -7
- node v14.18/async_hooks.d.ts → node/async_hooks.d.ts +4 -7
- node/base.d.ts +19 -0
- node/buffer.d.ts +22 -0
- node v14.18/child_process.d.ts → node/child_process.d.ts +63 -67
- node v14.18/cluster.d.ts → node/cluster.d.ts +10 -13
- node v14.18/console.d.ts → node/console.d.ts +13 -22
- node v14.18/constants.d.ts → node/constants.d.ts +0 -5
- node v14.18/crypto.d.ts → node/crypto.d.ts +134 -53
- node v14.18/dgram.d.ts → node/dgram.d.ts +17 -20
- node/dns/promises.d.ts +97 -0
- node/dns.d.ts +322 -0
- node v14.18/domain.d.ts → node/domain.d.ts +0 -3
- node v14.18/events.d.ts → node/events.d.ts +8 -8
- node v14.18/fs/promises.d.ts → node/fs/promises.d.ts +18 -29
- node v14.18/fs.d.ts → node/fs.d.ts +77 -93
- node v14.18/globals.d.ts → node/globals.d.ts +60 -24
- {node v14.18 → node}/globals.global.d.ts +0 -0
- node v14.18/http.d.ts → node/http.d.ts +108 -176
- node v14.18/http2.d.ts → node/http2.d.ts +74 -71
- node/https.d.ts +36 -0
- node v14.18/index.d.ts → node/index.d.ts +15 -55
- node v14.18/inspector.d.ts → node/inspector.d.ts +151 -161
- node v14.18/module.d.ts → node/module.d.ts +0 -4
- node v14.18/net.d.ts → node/net.d.ts +70 -42
- node v14.18/os.d.ts → node/os.d.ts +0 -3
- node v14.18/package.json → node/package.json +25 -19
- node v14.18/path.d.ts → node/path.d.ts +5 -9
- node v14.18/perf_hooks.d.ts → node/perf_hooks.d.ts +5 -8
- node v14.18/process.d.ts → node/process.d.ts +53 -17
- node v14.18/punycode.d.ts → node/punycode.d.ts +0 -3
- node v14.18/querystring.d.ts → node/querystring.d.ts +3 -6
- node v14.18/readline.d.ts → node/readline.d.ts +14 -18
- node v14.18/repl.d.ts → node/repl.d.ts +17 -20
- node/stream/promises.d.ts +67 -0
- node v14.18/stream.d.ts → node/stream.d.ts +164 -60
- node v14.18/string_decoder.d.ts → node/string_decoder.d.ts +0 -3
- node/timers/promises.d.ts +13 -0
- node v14.18/timers.d.ts → node/timers.d.ts +16 -5
- node v14.18/tls.d.ts → node/tls.d.ts +51 -56
- node v14.18/trace_events.d.ts → node/trace_events.d.ts +0 -3
- node/ts3.6/assert.d.ts +98 -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 +0 -3
- node v14.18/url.d.ts → node/url.d.ts +16 -19
- node v14.18/util.d.ts → node/util.d.ts +3 -12
- node v14.18/v8.d.ts → node/v8.d.ts +0 -3
- node v14.18/vm.d.ts → node/vm.d.ts +25 -28
- node v14.18/wasi.d.ts → node/wasi.d.ts +7 -10
- node v14.18/worker_threads.d.ts → node/worker_threads.d.ts +18 -18
- node v14.18/zlib.d.ts → node/zlib.d.ts +16 -19
- 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
|
}
|
|
@@ -78,7 +78,7 @@ type WithImplicitCoercion<T> = T | { valueOf(): T };
|
|
|
78
78
|
/**
|
|
79
79
|
* Raw data is stored in instances of the Buffer class.
|
|
80
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.
|
|
81
|
-
* 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'
|
|
82
82
|
*/
|
|
83
83
|
declare class Buffer extends Uint8Array {
|
|
84
84
|
/**
|
|
@@ -160,7 +160,7 @@ declare class Buffer extends Uint8Array {
|
|
|
160
160
|
static isBuffer(obj: any): obj is Buffer;
|
|
161
161
|
/**
|
|
162
162
|
* Returns true if {encoding} is a valid encoding argument.
|
|
163
|
-
* 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'
|
|
164
164
|
*
|
|
165
165
|
* @param encoding string to test.
|
|
166
166
|
*/
|
|
@@ -311,6 +311,39 @@ declare class Buffer extends Uint8Array {
|
|
|
311
311
|
values(): IterableIterator<number>;
|
|
312
312
|
}
|
|
313
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
|
+
|
|
314
347
|
/*----------------------------------------------*
|
|
315
348
|
* *
|
|
316
349
|
* GLOBAL INTERFACES *
|
|
@@ -326,24 +359,24 @@ declare namespace NodeJS {
|
|
|
326
359
|
* the getter function.
|
|
327
360
|
* @default `false`
|
|
328
361
|
*/
|
|
329
|
-
getters?: 'get' | 'set' | boolean
|
|
330
|
-
showHidden?: boolean
|
|
362
|
+
getters?: 'get' | 'set' | boolean;
|
|
363
|
+
showHidden?: boolean;
|
|
331
364
|
/**
|
|
332
365
|
* @default 2
|
|
333
366
|
*/
|
|
334
|
-
depth?: number | null
|
|
335
|
-
colors?: boolean
|
|
336
|
-
customInspect?: boolean
|
|
337
|
-
showProxy?: boolean
|
|
338
|
-
maxArrayLength?: number | null
|
|
367
|
+
depth?: number | null;
|
|
368
|
+
colors?: boolean;
|
|
369
|
+
customInspect?: boolean;
|
|
370
|
+
showProxy?: boolean;
|
|
371
|
+
maxArrayLength?: number | null;
|
|
339
372
|
/**
|
|
340
373
|
* Specifies the maximum number of characters to
|
|
341
374
|
* include when formatting. Set to `null` or `Infinity` to show all elements.
|
|
342
375
|
* Set to `0` or negative to show no characters.
|
|
343
|
-
* @default
|
|
376
|
+
* @default 10000
|
|
344
377
|
*/
|
|
345
|
-
maxStringLength?: number | null
|
|
346
|
-
breakLength?: number
|
|
378
|
+
maxStringLength?: number | null;
|
|
379
|
+
breakLength?: number;
|
|
347
380
|
/**
|
|
348
381
|
* Setting this to `false` causes each object key
|
|
349
382
|
* to be displayed on a new line. It will also add new lines to text that is
|
|
@@ -354,8 +387,8 @@ declare namespace NodeJS {
|
|
|
354
387
|
* For more information, see the example below.
|
|
355
388
|
* @default `true`
|
|
356
389
|
*/
|
|
357
|
-
compact?: boolean | number
|
|
358
|
-
sorted?: boolean | ((a: string, b: string) => number)
|
|
390
|
+
compact?: boolean | number;
|
|
391
|
+
sorted?: boolean | ((a: string, b: string) => number);
|
|
359
392
|
}
|
|
360
393
|
|
|
361
394
|
interface CallSite {
|
|
@@ -433,10 +466,11 @@ declare namespace NodeJS {
|
|
|
433
466
|
}
|
|
434
467
|
|
|
435
468
|
interface ErrnoException extends Error {
|
|
436
|
-
errno?: number
|
|
437
|
-
code?: string
|
|
438
|
-
path?: string
|
|
439
|
-
syscall?: string
|
|
469
|
+
errno?: number;
|
|
470
|
+
code?: string;
|
|
471
|
+
path?: string;
|
|
472
|
+
syscall?: string;
|
|
473
|
+
stack?: string;
|
|
440
474
|
}
|
|
441
475
|
|
|
442
476
|
interface ReadableStream extends EventEmitter {
|
|
@@ -446,7 +480,7 @@ declare namespace NodeJS {
|
|
|
446
480
|
pause(): this;
|
|
447
481
|
resume(): this;
|
|
448
482
|
isPaused(): boolean;
|
|
449
|
-
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean
|
|
483
|
+
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
|
450
484
|
unpipe(destination?: WritableStream): this;
|
|
451
485
|
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
452
486
|
wrap(oldStream: ReadableStream): this;
|
|
@@ -457,14 +491,16 @@ declare namespace NodeJS {
|
|
|
457
491
|
writable: boolean;
|
|
458
492
|
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
459
493
|
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
460
|
-
end(cb?: () => void):
|
|
461
|
-
end(data: string | Uint8Array, cb?: () => void):
|
|
462
|
-
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;
|
|
463
497
|
}
|
|
464
498
|
|
|
465
499
|
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
|
466
500
|
|
|
467
501
|
interface Global {
|
|
502
|
+
AbortController: typeof AbortController;
|
|
503
|
+
AbortSignal: typeof AbortSignal;
|
|
468
504
|
Array: typeof Array;
|
|
469
505
|
ArrayBuffer: typeof ArrayBuffer;
|
|
470
506
|
Boolean: typeof Boolean;
|
|
@@ -576,7 +612,7 @@ declare namespace NodeJS {
|
|
|
576
612
|
}
|
|
577
613
|
|
|
578
614
|
interface RequireResolve {
|
|
579
|
-
(id: string, options?: { paths?: string[]
|
|
615
|
+
(id: string, options?: { paths?: string[]; }): string;
|
|
580
616
|
paths(request: string): string[] | null;
|
|
581
617
|
}
|
|
582
618
|
|
|
File without changes
|
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
declare module 'http' {
|
|
2
2
|
import * as stream from 'stream';
|
|
3
3
|
import { URL } from 'url';
|
|
4
|
-
import { Socket, Server as NetServer
|
|
4
|
+
import { Socket, Server as NetServer } from 'net';
|
|
5
5
|
|
|
6
6
|
// incoming headers will never contain number
|
|
7
7
|
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
|
|
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;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// outgoing headers allows numbers (as they are converted internally to strings)
|
|
@@ -77,55 +77,52 @@ declare module 'http' {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
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
|
|
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;
|
|
88
88
|
/**
|
|
89
89
|
* @default 8192
|
|
90
90
|
*/
|
|
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
|
|
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;
|
|
100
100
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
|
|
101
|
-
createConnection?: (
|
|
102
|
-
lookup?: LookupFunction | undefined;
|
|
101
|
+
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
interface ServerOptions {
|
|
106
|
-
IncomingMessage?: typeof IncomingMessage
|
|
107
|
-
ServerResponse?: typeof ServerResponse
|
|
105
|
+
IncomingMessage?: typeof IncomingMessage;
|
|
106
|
+
ServerResponse?: typeof ServerResponse;
|
|
108
107
|
/**
|
|
109
108
|
* Optionally overrides the value of
|
|
110
109
|
* [`--max-http-header-size`][] for requests received by this server, i.e.
|
|
111
110
|
* the maximum length of request headers in bytes.
|
|
112
111
|
* @default 8192
|
|
113
112
|
*/
|
|
114
|
-
maxHeaderSize?: number
|
|
113
|
+
maxHeaderSize?: number;
|
|
115
114
|
/**
|
|
116
115
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when true.
|
|
117
116
|
* Using the insecure parser should be avoided.
|
|
118
117
|
* See --insecure-http-parser for more information.
|
|
119
118
|
* @default false
|
|
120
119
|
*/
|
|
121
|
-
insecureHTTPParser?: boolean
|
|
120
|
+
insecureHTTPParser?: boolean;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
constructor(requestListener?: RequestListener);
|
|
128
|
-
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
125
|
+
interface HttpBase {
|
|
129
126
|
setTimeout(msecs?: number, callback?: () => void): this;
|
|
130
127
|
setTimeout(callback: () => void): this;
|
|
131
128
|
/**
|
|
@@ -148,72 +145,12 @@ declare module 'http' {
|
|
|
148
145
|
* {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
|
|
149
146
|
*/
|
|
150
147
|
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;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface Server extends HttpBase {}
|
|
151
|
+
class Server extends NetServer {
|
|
152
|
+
constructor(requestListener?: RequestListener);
|
|
153
|
+
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
217
154
|
}
|
|
218
155
|
|
|
219
156
|
// https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
|
|
@@ -229,7 +166,7 @@ declare module 'http' {
|
|
|
229
166
|
finished: boolean;
|
|
230
167
|
headersSent: boolean;
|
|
231
168
|
/**
|
|
232
|
-
* @
|
|
169
|
+
* @deprecate Use `socket` instead.
|
|
233
170
|
*/
|
|
234
171
|
connection: Socket | null;
|
|
235
172
|
socket: Socket | null;
|
|
@@ -237,7 +174,7 @@ declare module 'http' {
|
|
|
237
174
|
constructor();
|
|
238
175
|
|
|
239
176
|
setTimeout(msecs: number, callback?: () => void): this;
|
|
240
|
-
setHeader(name: string, value: number | string | ReadonlyArray<string>):
|
|
177
|
+
setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
|
|
241
178
|
getHeader(name: string): number | string | string[] | undefined;
|
|
242
179
|
getHeaders(): OutgoingHttpHeaders;
|
|
243
180
|
getHeaderNames(): string[];
|
|
@@ -259,7 +196,7 @@ declare module 'http' {
|
|
|
259
196
|
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
|
|
260
197
|
// no args in writeContinue callback
|
|
261
198
|
writeContinue(callback?: () => void): void;
|
|
262
|
-
writeHead(statusCode: number,
|
|
199
|
+
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
263
200
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
264
201
|
writeProcessing(): void;
|
|
265
202
|
}
|
|
@@ -279,8 +216,6 @@ declare module 'http' {
|
|
|
279
216
|
aborted: boolean;
|
|
280
217
|
host: string;
|
|
281
218
|
protocol: string;
|
|
282
|
-
reusedSocket: boolean;
|
|
283
|
-
maxHeadersCount: number;
|
|
284
219
|
|
|
285
220
|
constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
|
|
286
221
|
|
|
@@ -395,52 +330,52 @@ declare module 'http' {
|
|
|
395
330
|
/**
|
|
396
331
|
* Only valid for request obtained from http.Server.
|
|
397
332
|
*/
|
|
398
|
-
method?: string
|
|
333
|
+
method?: string;
|
|
399
334
|
/**
|
|
400
335
|
* Only valid for request obtained from http.Server.
|
|
401
336
|
*/
|
|
402
|
-
url?: string
|
|
337
|
+
url?: string;
|
|
403
338
|
/**
|
|
404
339
|
* Only valid for response obtained from http.ClientRequest.
|
|
405
340
|
*/
|
|
406
|
-
statusCode?: number
|
|
341
|
+
statusCode?: number;
|
|
407
342
|
/**
|
|
408
343
|
* Only valid for response obtained from http.ClientRequest.
|
|
409
344
|
*/
|
|
410
|
-
statusMessage?: string
|
|
411
|
-
destroy(error?: Error):
|
|
345
|
+
statusMessage?: string;
|
|
346
|
+
destroy(error?: Error): void;
|
|
412
347
|
}
|
|
413
348
|
|
|
414
349
|
interface AgentOptions {
|
|
415
350
|
/**
|
|
416
351
|
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
|
417
352
|
*/
|
|
418
|
-
keepAlive?: boolean
|
|
353
|
+
keepAlive?: boolean;
|
|
419
354
|
/**
|
|
420
355
|
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
|
|
421
356
|
* Only relevant if keepAlive is set to true.
|
|
422
357
|
*/
|
|
423
|
-
keepAliveMsecs?: number
|
|
358
|
+
keepAliveMsecs?: number;
|
|
424
359
|
/**
|
|
425
360
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
|
426
361
|
*/
|
|
427
|
-
maxSockets?: number
|
|
362
|
+
maxSockets?: number;
|
|
428
363
|
/**
|
|
429
364
|
* 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
365
|
*/
|
|
431
|
-
maxTotalSockets?: number
|
|
366
|
+
maxTotalSockets?: number;
|
|
432
367
|
/**
|
|
433
368
|
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
|
434
369
|
*/
|
|
435
|
-
maxFreeSockets?: number
|
|
370
|
+
maxFreeSockets?: number;
|
|
436
371
|
/**
|
|
437
372
|
* Socket timeout in milliseconds. This will set the timeout after the socket is connected.
|
|
438
373
|
*/
|
|
439
|
-
timeout?: number
|
|
374
|
+
timeout?: number;
|
|
440
375
|
/**
|
|
441
376
|
* Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
|
|
442
377
|
*/
|
|
443
|
-
scheduling?: 'fifo' | 'lifo'
|
|
378
|
+
scheduling?: 'fifo' | 'lifo';
|
|
444
379
|
}
|
|
445
380
|
|
|
446
381
|
class Agent {
|
|
@@ -487,6 +422,3 @@ declare module 'http' {
|
|
|
487
422
|
*/
|
|
488
423
|
const maxHeaderSize: number;
|
|
489
424
|
}
|
|
490
|
-
declare module 'node:http' {
|
|
491
|
-
export * from 'http';
|
|
492
|
-
}
|