@types/node 15.14.7 → 16.0.1
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 v15.14 → node}/LICENSE +0 -0
- node v15.14/README.md → node/README.md +3 -3
- node/assert/strict.d.ts +9 -0
- node v15.14/assert.d.ts → node/assert.d.ts +35 -30
- node v15.14/async_hooks.d.ts → node/async_hooks.d.ts +7 -3
- {node v15.14 → node}/base.d.ts +0 -0
- node/buffer.d.ts +357 -0
- node v15.14/child_process.d.ts → node/child_process.d.ts +54 -50
- node v15.14/cluster.d.ts → node/cluster.d.ts +33 -108
- node v15.14/console.d.ts → node/console.d.ts +24 -23
- node v15.14/constants.d.ts → node/constants.d.ts +5 -0
- node v15.14/crypto.d.ts → node/crypto.d.ts +82 -67
- node v15.14/dgram.d.ts → node/dgram.d.ts +13 -9
- node v15.14/diagnostic_channel.d.ts → node/diagnostic_channel.d.ts +4 -0
- node v15.14/dns/promises.d.ts → node/dns/promises.d.ts +4 -0
- node v15.14/dns.d.ts → node/dns.d.ts +15 -11
- node/domain.d.ts +25 -0
- node v15.14/events.d.ts → node/events.d.ts +8 -3
- node v15.14/fs/promises.d.ts → node/fs/promises.d.ts +25 -17
- node v15.14/fs.d.ts → node/fs.d.ts +71 -75
- node/globals.d.ts +274 -0
- node/globals.global.d.ts +1 -0
- node v15.14/http.d.ts → node/http.d.ts +109 -167
- node v15.14/http2.d.ts → node/http2.d.ts +69 -66
- node/https.d.ts +40 -0
- node v15.14/index.d.ts → node/index.d.ts +1 -1
- node v15.14/inspector.d.ts → node/inspector.d.ts +152 -470
- node v15.14/module.d.ts → node/module.d.ts +25 -4
- node v15.14/net.d.ts → node/net.d.ts +34 -36
- node v15.14/os.d.ts → node/os.d.ts +4 -0
- node v15.14/package.json → node/package.json +2 -2
- node v15.14/path.d.ts → node/path.d.ts +10 -5
- node v15.14/perf_hooks.d.ts → node/perf_hooks.d.ts +70 -23
- node v15.14/process.d.ts → node/process.d.ts +54 -51
- node v15.14/punycode.d.ts → node/punycode.d.ts +4 -0
- node v15.14/querystring.d.ts → node/querystring.d.ts +7 -3
- node v15.14/readline.d.ts → node/readline.d.ts +20 -16
- node v15.14/repl.d.ts → node/repl.d.ts +18 -14
- node v15.14/stream/promises.d.ts → node/stream/promises.d.ts +4 -0
- node v15.14/stream.d.ts → node/stream.d.ts +22 -17
- node v15.14/string_decoder.d.ts → node/string_decoder.d.ts +4 -0
- node v15.14/timers/promises.d.ts → node/timers/promises.d.ts +4 -0
- node/timers.d.ts +92 -0
- node v15.14/tls.d.ts → node/tls.d.ts +54 -50
- node v15.14/trace_events.d.ts → node/trace_events.d.ts +4 -0
- node v15.14/ts3.6/assert.d.ts → node/ts3.6/assert.d.ts +26 -26
- {node v15.14 → node}/ts3.6/base.d.ts +0 -0
- {node v15.14 → node}/ts3.6/index.d.ts +0 -0
- node v15.14/tty.d.ts → node/tty.d.ts +4 -0
- node v15.14/url.d.ts → node/url.d.ts +19 -15
- node/util/types.d.ts +57 -0
- node v15.14/util.d.ts → node/util.d.ts +67 -21
- node v15.14/v8.d.ts → node/v8.d.ts +4 -0
- node v15.14/vm.d.ts → node/vm.d.ts +28 -24
- node v15.14/wasi.d.ts → node/wasi.d.ts +11 -7
- node v15.14/worker_threads.d.ts → node/worker_threads.d.ts +19 -15
- node v15.14/zlib.d.ts → node/zlib.d.ts +20 -16
- node v15.14/assert/strict.d.ts +0 -4
- node v15.14/buffer.d.ts +0 -112
- node v15.14/domain.d.ts +0 -24
- node v15.14/globals.d.ts +0 -659
- node v15.14/globals.global.d.ts +0 -1
- node v15.14/https.d.ts +0 -139
- node v15.14/timers.d.ts +0 -27
- node v15.14/util/types.d.ts +0 -53
node/globals.d.ts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// Declare "static" methods in Error
|
|
2
|
+
interface ErrorConstructor {
|
|
3
|
+
/** Create .stack property on a target object */
|
|
4
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Optional override for formatting stack traces
|
|
8
|
+
*
|
|
9
|
+
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
10
|
+
*/
|
|
11
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
12
|
+
|
|
13
|
+
stackTraceLimit: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Node.js ESNEXT support
|
|
17
|
+
interface String {
|
|
18
|
+
/** Removes whitespace from the left end of a string. */
|
|
19
|
+
trimLeft(): string;
|
|
20
|
+
/** Removes whitespace from the right end of a string. */
|
|
21
|
+
trimRight(): string;
|
|
22
|
+
|
|
23
|
+
/** Returns a copy with leading whitespace removed. */
|
|
24
|
+
trimStart(): string;
|
|
25
|
+
/** Returns a copy with trailing whitespace removed. */
|
|
26
|
+
trimEnd(): string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/*-----------------------------------------------*
|
|
30
|
+
* *
|
|
31
|
+
* GLOBAL *
|
|
32
|
+
* *
|
|
33
|
+
------------------------------------------------*/
|
|
34
|
+
|
|
35
|
+
// For backwards compability
|
|
36
|
+
interface NodeRequire extends NodeJS.Require { }
|
|
37
|
+
interface RequireResolve extends NodeJS.RequireResolve { }
|
|
38
|
+
interface NodeModule extends NodeJS.Module { }
|
|
39
|
+
|
|
40
|
+
declare var process: NodeJS.Process;
|
|
41
|
+
declare var console: Console;
|
|
42
|
+
|
|
43
|
+
declare var __filename: string;
|
|
44
|
+
declare var __dirname: string;
|
|
45
|
+
|
|
46
|
+
declare var require: NodeRequire;
|
|
47
|
+
declare var module: NodeModule;
|
|
48
|
+
|
|
49
|
+
// Same as module.exports
|
|
50
|
+
declare var exports: any;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Only available if `--expose-gc` is passed to the process.
|
|
54
|
+
*/
|
|
55
|
+
declare var gc: undefined | (() => void);
|
|
56
|
+
|
|
57
|
+
//#region borrowed
|
|
58
|
+
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
|
59
|
+
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
60
|
+
interface AbortController {
|
|
61
|
+
/**
|
|
62
|
+
* Returns the AbortSignal object associated with this object.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
readonly signal: AbortSignal;
|
|
66
|
+
/**
|
|
67
|
+
* 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.
|
|
68
|
+
*/
|
|
69
|
+
abort(): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 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. */
|
|
73
|
+
interface AbortSignal {
|
|
74
|
+
/**
|
|
75
|
+
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
readonly aborted: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare var AbortController: {
|
|
81
|
+
prototype: AbortController;
|
|
82
|
+
new(): AbortController;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
declare var AbortSignal: {
|
|
86
|
+
prototype: AbortSignal;
|
|
87
|
+
new(): AbortSignal;
|
|
88
|
+
// TODO: Add abort() static
|
|
89
|
+
};
|
|
90
|
+
//#endregion borrowed
|
|
91
|
+
|
|
92
|
+
/*----------------------------------------------*
|
|
93
|
+
* *
|
|
94
|
+
* GLOBAL INTERFACES *
|
|
95
|
+
* *
|
|
96
|
+
*-----------------------------------------------*/
|
|
97
|
+
declare namespace NodeJS {
|
|
98
|
+
interface CallSite {
|
|
99
|
+
/**
|
|
100
|
+
* Value of "this"
|
|
101
|
+
*/
|
|
102
|
+
getThis(): unknown;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Type of "this" as a string.
|
|
106
|
+
* This is the name of the function stored in the constructor field of
|
|
107
|
+
* "this", if available. Otherwise the object's [[Class]] internal
|
|
108
|
+
* property.
|
|
109
|
+
*/
|
|
110
|
+
getTypeName(): string | null;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Current function
|
|
114
|
+
*/
|
|
115
|
+
getFunction(): Function | undefined;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Name of the current function, typically its name property.
|
|
119
|
+
* If a name property is not available an attempt will be made to try
|
|
120
|
+
* to infer a name from the function's context.
|
|
121
|
+
*/
|
|
122
|
+
getFunctionName(): string | null;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Name of the property [of "this" or one of its prototypes] that holds
|
|
126
|
+
* the current function
|
|
127
|
+
*/
|
|
128
|
+
getMethodName(): string | null;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Name of the script [if this function was defined in a script]
|
|
132
|
+
*/
|
|
133
|
+
getFileName(): string | null;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Current line number [if this function was defined in a script]
|
|
137
|
+
*/
|
|
138
|
+
getLineNumber(): number | null;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Current column number [if this function was defined in a script]
|
|
142
|
+
*/
|
|
143
|
+
getColumnNumber(): number | null;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A call site object representing the location where eval was called
|
|
147
|
+
* [if this function was created using a call to eval]
|
|
148
|
+
*/
|
|
149
|
+
getEvalOrigin(): string | undefined;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Is this a toplevel invocation, that is, is "this" the global object?
|
|
153
|
+
*/
|
|
154
|
+
isToplevel(): boolean;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Does this call take place in code defined by a call to eval?
|
|
158
|
+
*/
|
|
159
|
+
isEval(): boolean;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Is this call in native V8 code?
|
|
163
|
+
*/
|
|
164
|
+
isNative(): boolean;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Is this a constructor call?
|
|
168
|
+
*/
|
|
169
|
+
isConstructor(): boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface ErrnoException extends Error {
|
|
173
|
+
errno?: number | undefined;
|
|
174
|
+
code?: string | undefined;
|
|
175
|
+
path?: string | undefined;
|
|
176
|
+
syscall?: string | undefined;
|
|
177
|
+
stack?: string | undefined;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface ReadableStream extends EventEmitter {
|
|
181
|
+
readable: boolean;
|
|
182
|
+
read(size?: number): string | Buffer;
|
|
183
|
+
setEncoding(encoding: BufferEncoding): this;
|
|
184
|
+
pause(): this;
|
|
185
|
+
resume(): this;
|
|
186
|
+
isPaused(): boolean;
|
|
187
|
+
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
|
|
188
|
+
unpipe(destination?: WritableStream): this;
|
|
189
|
+
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
190
|
+
wrap(oldStream: ReadableStream): this;
|
|
191
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface WritableStream extends EventEmitter {
|
|
195
|
+
writable: boolean;
|
|
196
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
197
|
+
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
198
|
+
end(cb?: () => void): void;
|
|
199
|
+
end(data: string | Uint8Array, cb?: () => void): void;
|
|
200
|
+
end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface ReadWriteStream extends ReadableStream, WritableStream { }
|
|
204
|
+
|
|
205
|
+
interface RefCounted {
|
|
206
|
+
ref(): this;
|
|
207
|
+
unref(): this;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
type TypedArray =
|
|
211
|
+
| Uint8Array
|
|
212
|
+
| Uint8ClampedArray
|
|
213
|
+
| Uint16Array
|
|
214
|
+
| Uint32Array
|
|
215
|
+
| Int8Array
|
|
216
|
+
| Int16Array
|
|
217
|
+
| Int32Array
|
|
218
|
+
| BigUint64Array
|
|
219
|
+
| BigInt64Array
|
|
220
|
+
| Float32Array
|
|
221
|
+
| Float64Array;
|
|
222
|
+
type ArrayBufferView = TypedArray | DataView;
|
|
223
|
+
|
|
224
|
+
interface Require {
|
|
225
|
+
(id: string): any;
|
|
226
|
+
resolve: RequireResolve;
|
|
227
|
+
cache: Dict<NodeModule>;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated
|
|
230
|
+
*/
|
|
231
|
+
extensions: RequireExtensions;
|
|
232
|
+
main: Module | undefined;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface RequireResolve {
|
|
236
|
+
(id: string, options?: { paths?: string[] | undefined; }): string;
|
|
237
|
+
paths(request: string): string[] | null;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
|
241
|
+
'.js': (m: Module, filename: string) => any;
|
|
242
|
+
'.json': (m: Module, filename: string) => any;
|
|
243
|
+
'.node': (m: Module, filename: string) => any;
|
|
244
|
+
}
|
|
245
|
+
interface Module {
|
|
246
|
+
/**
|
|
247
|
+
* `true` if the module is running during the Node.js preload
|
|
248
|
+
*/
|
|
249
|
+
isPreloading: boolean;
|
|
250
|
+
exports: any;
|
|
251
|
+
require: Require;
|
|
252
|
+
id: string;
|
|
253
|
+
filename: string;
|
|
254
|
+
loaded: boolean;
|
|
255
|
+
/** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
|
|
256
|
+
parent: Module | null | undefined;
|
|
257
|
+
children: Module[];
|
|
258
|
+
/**
|
|
259
|
+
* @since 11.14.0
|
|
260
|
+
*
|
|
261
|
+
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
|
262
|
+
*/
|
|
263
|
+
path: string;
|
|
264
|
+
paths: string[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
interface Dict<T> {
|
|
268
|
+
[key: string]: T | undefined;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
interface ReadOnlyDict<T> {
|
|
272
|
+
readonly [key: string]: T | undefined;
|
|
273
|
+
}
|
|
274
|
+
}
|
node/globals.global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare var global: typeof globalThis;
|
|
@@ -5,69 +5,69 @@ declare module 'http' {
|
|
|
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 | undefined;
|
|
9
|
+
'accept-language'?: string | undefined;
|
|
10
|
+
'accept-patch'?: string | undefined;
|
|
11
|
+
'accept-ranges'?: string | undefined;
|
|
12
|
+
'access-control-allow-credentials'?: string | undefined;
|
|
13
|
+
'access-control-allow-headers'?: string | undefined;
|
|
14
|
+
'access-control-allow-methods'?: string | undefined;
|
|
15
|
+
'access-control-allow-origin'?: string | undefined;
|
|
16
|
+
'access-control-expose-headers'?: string | undefined;
|
|
17
|
+
'access-control-max-age'?: string | undefined;
|
|
18
|
+
'access-control-request-headers'?: string | undefined;
|
|
19
|
+
'access-control-request-method'?: string | undefined;
|
|
20
|
+
'age'?: string | undefined;
|
|
21
|
+
'allow'?: string | undefined;
|
|
22
|
+
'alt-svc'?: string | undefined;
|
|
23
|
+
'authorization'?: string | undefined;
|
|
24
|
+
'cache-control'?: string | undefined;
|
|
25
|
+
'connection'?: string | undefined;
|
|
26
|
+
'content-disposition'?: string | undefined;
|
|
27
|
+
'content-encoding'?: string | undefined;
|
|
28
|
+
'content-language'?: string | undefined;
|
|
29
|
+
'content-length'?: string | undefined;
|
|
30
|
+
'content-location'?: string | undefined;
|
|
31
|
+
'content-range'?: string | undefined;
|
|
32
|
+
'content-type'?: string | undefined;
|
|
33
|
+
'cookie'?: string | undefined;
|
|
34
|
+
'date'?: string | undefined;
|
|
35
|
+
'etag'?: string | undefined;
|
|
36
|
+
'expect'?: string | undefined;
|
|
37
|
+
'expires'?: string | undefined;
|
|
38
|
+
'forwarded'?: string | undefined;
|
|
39
|
+
'from'?: string | undefined;
|
|
40
|
+
'host'?: string | undefined;
|
|
41
|
+
'if-match'?: string | undefined;
|
|
42
|
+
'if-modified-since'?: string | undefined;
|
|
43
|
+
'if-none-match'?: string | undefined;
|
|
44
|
+
'if-unmodified-since'?: string | undefined;
|
|
45
|
+
'last-modified'?: string | undefined;
|
|
46
|
+
'location'?: string | undefined;
|
|
47
|
+
'origin'?: string | undefined;
|
|
48
|
+
'pragma'?: string | undefined;
|
|
49
|
+
'proxy-authenticate'?: string | undefined;
|
|
50
|
+
'proxy-authorization'?: string | undefined;
|
|
51
|
+
'public-key-pins'?: string | undefined;
|
|
52
|
+
'range'?: string | undefined;
|
|
53
|
+
'referer'?: string | undefined;
|
|
54
|
+
'retry-after'?: string | undefined;
|
|
55
|
+
'sec-websocket-accept'?: string | undefined;
|
|
56
|
+
'sec-websocket-extensions'?: string | undefined;
|
|
57
|
+
'sec-websocket-key'?: string | undefined;
|
|
58
|
+
'sec-websocket-protocol'?: string | undefined;
|
|
59
|
+
'sec-websocket-version'?: string | undefined;
|
|
60
|
+
'set-cookie'?: string[] | undefined;
|
|
61
|
+
'strict-transport-security'?: string | undefined;
|
|
62
|
+
'tk'?: string | undefined;
|
|
63
|
+
'trailer'?: string | undefined;
|
|
64
|
+
'transfer-encoding'?: string | undefined;
|
|
65
|
+
'upgrade'?: string | undefined;
|
|
66
|
+
'user-agent'?: string | undefined;
|
|
67
|
+
'vary'?: string | undefined;
|
|
68
|
+
'via'?: string | undefined;
|
|
69
|
+
'warning'?: string | undefined;
|
|
70
|
+
'www-authenticate'?: string | undefined;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// outgoing headers allows numbers (as they are converted internally to strings)
|
|
@@ -77,55 +77,53 @@ declare module 'http' {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
interface ClientRequestArgs {
|
|
80
|
-
abort?: AbortSignal;
|
|
81
|
-
protocol?: string | null;
|
|
82
|
-
host?: string | null;
|
|
83
|
-
hostname?: string | null;
|
|
84
|
-
family?: number;
|
|
85
|
-
port?: number | string | null;
|
|
86
|
-
defaultPort?: number | string;
|
|
87
|
-
localAddress?: string;
|
|
88
|
-
socketPath?: string;
|
|
80
|
+
abort?: AbortSignal | undefined;
|
|
81
|
+
protocol?: string | null | undefined;
|
|
82
|
+
host?: string | null | undefined;
|
|
83
|
+
hostname?: string | null | undefined;
|
|
84
|
+
family?: number | undefined;
|
|
85
|
+
port?: number | string | null | undefined;
|
|
86
|
+
defaultPort?: number | string | undefined;
|
|
87
|
+
localAddress?: string | undefined;
|
|
88
|
+
socketPath?: string | undefined;
|
|
89
89
|
/**
|
|
90
90
|
* @default 8192
|
|
91
91
|
*/
|
|
92
|
-
maxHeaderSize?: number;
|
|
93
|
-
method?: string;
|
|
94
|
-
path?: string | null;
|
|
95
|
-
headers?: OutgoingHttpHeaders;
|
|
96
|
-
auth?: string | null;
|
|
97
|
-
agent?: Agent | boolean;
|
|
98
|
-
_defaultAgent?: Agent;
|
|
99
|
-
timeout?: number;
|
|
100
|
-
setHost?: boolean;
|
|
92
|
+
maxHeaderSize?: number | undefined;
|
|
93
|
+
method?: string | undefined;
|
|
94
|
+
path?: string | null | undefined;
|
|
95
|
+
headers?: OutgoingHttpHeaders | undefined;
|
|
96
|
+
auth?: string | null | undefined;
|
|
97
|
+
agent?: Agent | boolean | undefined;
|
|
98
|
+
_defaultAgent?: Agent | undefined;
|
|
99
|
+
timeout?: number | undefined;
|
|
100
|
+
setHost?: boolean | undefined;
|
|
101
101
|
// https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
|
|
102
|
-
createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
|
|
102
|
+
createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
interface ServerOptions {
|
|
106
|
-
IncomingMessage?: typeof IncomingMessage;
|
|
107
|
-
ServerResponse?: typeof ServerResponse;
|
|
106
|
+
IncomingMessage?: typeof IncomingMessage | undefined;
|
|
107
|
+
ServerResponse?: typeof ServerResponse | undefined;
|
|
108
108
|
/**
|
|
109
109
|
* Optionally overrides the value of
|
|
110
110
|
* `--max-http-header-size` for requests received by this server, i.e.
|
|
111
111
|
* the maximum length of request headers in bytes.
|
|
112
112
|
* @default 8192
|
|
113
113
|
*/
|
|
114
|
-
maxHeaderSize?: number;
|
|
114
|
+
maxHeaderSize?: number | undefined;
|
|
115
115
|
/**
|
|
116
116
|
* Use an insecure HTTP parser that accepts invalid HTTP headers when true.
|
|
117
117
|
* Using the insecure parser should be avoided.
|
|
118
118
|
* See --insecure-http-parser for more information.
|
|
119
119
|
* @default false
|
|
120
120
|
*/
|
|
121
|
-
insecureHTTPParser?: boolean;
|
|
121
|
+
insecureHTTPParser?: boolean | undefined;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
constructor(requestListener?: RequestListener);
|
|
128
|
-
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
126
|
+
interface HttpBase {
|
|
129
127
|
setTimeout(msecs?: number, callback?: () => void): this;
|
|
130
128
|
setTimeout(callback: () => void): this;
|
|
131
129
|
/**
|
|
@@ -148,72 +146,12 @@ declare module 'http' {
|
|
|
148
146
|
* {@link https://nodejs.org/api/http.html#http_server_requesttimeout}
|
|
149
147
|
*/
|
|
150
148
|
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;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface Server extends HttpBase {}
|
|
152
|
+
class Server extends NetServer {
|
|
153
|
+
constructor(requestListener?: RequestListener);
|
|
154
|
+
constructor(options: ServerOptions, requestListener?: RequestListener);
|
|
217
155
|
}
|
|
218
156
|
|
|
219
157
|
// https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
|
|
@@ -260,7 +198,7 @@ declare module 'http' {
|
|
|
260
198
|
// https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
|
|
261
199
|
// no args in writeContinue callback
|
|
262
200
|
writeContinue(callback?: () => void): void;
|
|
263
|
-
writeHead(statusCode: number,
|
|
201
|
+
writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
264
202
|
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this;
|
|
265
203
|
writeProcessing(): void;
|
|
266
204
|
}
|
|
@@ -399,19 +337,19 @@ declare module 'http' {
|
|
|
399
337
|
/**
|
|
400
338
|
* Only valid for request obtained from http.Server.
|
|
401
339
|
*/
|
|
402
|
-
method?: string;
|
|
340
|
+
method?: string | undefined;
|
|
403
341
|
/**
|
|
404
342
|
* Only valid for request obtained from http.Server.
|
|
405
343
|
*/
|
|
406
|
-
url?: string;
|
|
344
|
+
url?: string | undefined;
|
|
407
345
|
/**
|
|
408
346
|
* Only valid for response obtained from http.ClientRequest.
|
|
409
347
|
*/
|
|
410
|
-
statusCode?: number;
|
|
348
|
+
statusCode?: number | undefined;
|
|
411
349
|
/**
|
|
412
350
|
* Only valid for response obtained from http.ClientRequest.
|
|
413
351
|
*/
|
|
414
|
-
statusMessage?: string;
|
|
352
|
+
statusMessage?: string | undefined;
|
|
415
353
|
destroy(error?: Error): void;
|
|
416
354
|
}
|
|
417
355
|
|
|
@@ -419,33 +357,33 @@ declare module 'http' {
|
|
|
419
357
|
/**
|
|
420
358
|
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
|
421
359
|
*/
|
|
422
|
-
keepAlive?: boolean;
|
|
360
|
+
keepAlive?: boolean | undefined;
|
|
423
361
|
/**
|
|
424
362
|
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
|
|
425
363
|
* Only relevant if keepAlive is set to true.
|
|
426
364
|
*/
|
|
427
|
-
keepAliveMsecs?: number;
|
|
365
|
+
keepAliveMsecs?: number | undefined;
|
|
428
366
|
/**
|
|
429
367
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
|
430
368
|
*/
|
|
431
|
-
maxSockets?: number;
|
|
369
|
+
maxSockets?: number | undefined;
|
|
432
370
|
/**
|
|
433
371
|
* Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
|
|
434
372
|
*/
|
|
435
|
-
maxTotalSockets?: number;
|
|
373
|
+
maxTotalSockets?: number | undefined;
|
|
436
374
|
/**
|
|
437
375
|
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
|
438
376
|
*/
|
|
439
|
-
maxFreeSockets?: number;
|
|
377
|
+
maxFreeSockets?: number | undefined;
|
|
440
378
|
/**
|
|
441
379
|
* Socket timeout in milliseconds. This will set the timeout after the socket is connected.
|
|
442
380
|
*/
|
|
443
|
-
timeout?: number;
|
|
381
|
+
timeout?: number | undefined;
|
|
444
382
|
/**
|
|
445
383
|
* Scheduling strategy to apply when picking the next free socket to use.
|
|
446
384
|
* @default `lifo`
|
|
447
385
|
*/
|
|
448
|
-
scheduling?: 'fifo' | 'lifo';
|
|
386
|
+
scheduling?: 'fifo' | 'lifo' | undefined;
|
|
449
387
|
}
|
|
450
388
|
|
|
451
389
|
class Agent {
|
|
@@ -499,3 +437,7 @@ declare module 'http' {
|
|
|
499
437
|
*/
|
|
500
438
|
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
501
439
|
}
|
|
440
|
+
|
|
441
|
+
declare module 'node:http' {
|
|
442
|
+
export * from 'http';
|
|
443
|
+
}
|