@types/node 12.20.41 → 13.1.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.
Files changed (64) hide show
  1. node v12.20/LICENSE → node/LICENSE +21 -21
  2. node/README.md +16 -0
  3. node/assert.d.ts +50 -0
  4. node/async_hooks.d.ts +132 -0
  5. node/base.d.ts +41 -0
  6. node v12.20/buffer.d.ts → node/buffer.d.ts +1 -1
  7. node v12.20/child_process.d.ts → node/child_process.d.ts +111 -113
  8. node v12.20/cluster.d.ts → node/cluster.d.ts +25 -19
  9. node/console.d.ts +3 -0
  10. node/constants.d.ts +8 -0
  11. node/crypto.d.ts +615 -0
  12. node v12.20/dgram.d.ts → node/dgram.d.ts +48 -25
  13. node v12.20/dns.d.ts → node/dns.d.ts +6 -12
  14. node v12.20/domain.d.ts → node/domain.d.ts +2 -2
  15. node/events.d.ts +40 -0
  16. node v12.20/fs.d.ts → node/fs.d.ts +162 -262
  17. node v12.20/globals.d.ts → node/globals.d.ts +104 -260
  18. node v12.20/http.d.ts → node/http.d.ts +102 -177
  19. node v12.20/http2.d.ts → node/http2.d.ts +82 -87
  20. node/https.d.ts +53 -0
  21. node/index.d.ts +83 -0
  22. node v12.20/inspector.d.ts → node/inspector.d.ts +153 -159
  23. node/module.d.ts +20 -0
  24. node v12.20/net.d.ts → node/net.d.ts +37 -47
  25. node/os.d.ts +231 -0
  26. node v12.20/package.json → node/package.json +45 -9
  27. node/path.d.ts +153 -0
  28. node v12.20/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -31
  29. node v12.20/process.d.ts → node/process.d.ts +2 -2
  30. node/punycode.d.ts +12 -0
  31. node v12.20/querystring.d.ts → node/querystring.d.ts +5 -5
  32. node v12.20/readline.d.ts → node/readline.d.ts +16 -17
  33. node v12.20/repl.d.ts → node/repl.d.ts +24 -32
  34. node v12.20/stream.d.ts → node/stream.d.ts +33 -43
  35. node v12.20/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
  36. node v12.20/timers.d.ts → node/timers.d.ts +1 -1
  37. node v12.20/tls.d.ts → node/tls.d.ts +54 -65
  38. node v12.20/trace_events.d.ts → node/trace_events.d.ts +1 -1
  39. node/ts3.2/fs.d.ts +33 -0
  40. node/ts3.2/globals.d.ts +19 -0
  41. node/ts3.2/index.d.ts +16 -0
  42. node/ts3.2/util.d.ts +9 -0
  43. node v12.20/tty.d.ts → node/tty.d.ts +3 -3
  44. node v12.20/url.d.ts → node/url.d.ts +17 -24
  45. node v12.20/util.d.ts → node/util.d.ts +22 -37
  46. node v12.20/v8.d.ts → node/v8.d.ts +2 -12
  47. node v12.20/vm.d.ts → node/vm.d.ts +22 -24
  48. node v12.20/worker_threads.d.ts → node/worker_threads.d.ts +39 -85
  49. node v12.20/zlib.d.ts → node/zlib.d.ts +134 -138
  50. node v12.20/README.md +0 -16
  51. node v12.20/assert.d.ts +0 -117
  52. node v12.20/async_hooks.d.ts +0 -246
  53. node v12.20/console.d.ts +0 -3
  54. node v12.20/constants.d.ts +0 -448
  55. node v12.20/crypto.d.ts +0 -1159
  56. node v12.20/events.d.ts +0 -47
  57. node v12.20/globals.global.d.ts +0 -1
  58. node v12.20/https.d.ts +0 -156
  59. node v12.20/index.d.ts +0 -91
  60. node v12.20/module.d.ts +0 -3
  61. node v12.20/os.d.ts +0 -263
  62. node v12.20/path.d.ts +0 -159
  63. node v12.20/punycode.d.ts +0 -75
  64. node v12.20/wasi.d.ts +0 -55
@@ -1,68 +1,65 @@
1
- declare module 'http' {
2
- import * as stream from 'stream';
3
- import { URL } from 'url';
4
- import { Socket, Server as NetServer, LookupFunction } from 'net';
1
+ declare module "http" {
2
+ import * as events from "events";
3
+ import * as stream from "stream";
4
+ import { URL } from "url";
5
+ import { Socket, Server as NetServer } from "net";
5
6
 
6
7
  // incoming headers will never contain number
7
8
  interface IncomingHttpHeaders {
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
- 'set-cookie'?: string[] | undefined;
56
- 'strict-transport-security'?: string | undefined;
57
- 'tk'?: string | undefined;
58
- 'trailer'?: string | undefined;
59
- 'transfer-encoding'?: string | undefined;
60
- 'upgrade'?: string | undefined;
61
- 'user-agent'?: string | undefined;
62
- 'vary'?: string | undefined;
63
- 'via'?: string | undefined;
64
- 'warning'?: string | undefined;
65
- 'www-authenticate'?: string | undefined;
9
+ 'accept'?: string;
10
+ 'accept-language'?: string;
11
+ 'accept-patch'?: string;
12
+ 'accept-ranges'?: string;
13
+ 'access-control-allow-credentials'?: string;
14
+ 'access-control-allow-headers'?: string;
15
+ 'access-control-allow-methods'?: string;
16
+ 'access-control-allow-origin'?: string;
17
+ 'access-control-expose-headers'?: string;
18
+ 'access-control-max-age'?: string;
19
+ 'age'?: string;
20
+ 'allow'?: string;
21
+ 'alt-svc'?: string;
22
+ 'authorization'?: string;
23
+ 'cache-control'?: string;
24
+ 'connection'?: string;
25
+ 'content-disposition'?: string;
26
+ 'content-encoding'?: string;
27
+ 'content-language'?: string;
28
+ 'content-length'?: string;
29
+ 'content-location'?: string;
30
+ 'content-range'?: string;
31
+ 'content-type'?: string;
32
+ 'cookie'?: string;
33
+ 'date'?: string;
34
+ 'expect'?: string;
35
+ 'expires'?: string;
36
+ 'forwarded'?: string;
37
+ 'from'?: string;
38
+ 'host'?: string;
39
+ 'if-match'?: string;
40
+ 'if-modified-since'?: string;
41
+ 'if-none-match'?: string;
42
+ 'if-unmodified-since'?: string;
43
+ 'last-modified'?: string;
44
+ 'location'?: string;
45
+ 'pragma'?: string;
46
+ 'proxy-authenticate'?: string;
47
+ 'proxy-authorization'?: string;
48
+ 'public-key-pins'?: string;
49
+ 'range'?: string;
50
+ 'referer'?: string;
51
+ 'retry-after'?: string;
52
+ 'set-cookie'?: string[];
53
+ 'strict-transport-security'?: string;
54
+ 'tk'?: string;
55
+ 'trailer'?: string;
56
+ 'transfer-encoding'?: string;
57
+ 'upgrade'?: string;
58
+ 'user-agent'?: string;
59
+ 'vary'?: string;
60
+ 'via'?: string;
61
+ 'warning'?: string;
62
+ 'www-authenticate'?: string;
66
63
  [header: string]: string | string[] | undefined;
67
64
  }
68
65
 
@@ -72,30 +69,29 @@ declare module 'http' {
72
69
  }
73
70
 
74
71
  interface ClientRequestArgs {
75
- protocol?: string | null | undefined;
76
- host?: string | null | undefined;
77
- hostname?: string | null | undefined;
78
- family?: number | undefined;
79
- port?: number | string | null | undefined;
80
- defaultPort?: number | string | undefined;
81
- localAddress?: string | undefined;
82
- socketPath?: string | undefined;
83
- method?: string | undefined;
84
- path?: string | null | undefined;
85
- headers?: OutgoingHttpHeaders | undefined;
86
- auth?: string | null | undefined;
87
- agent?: Agent | boolean | undefined;
88
- _defaultAgent?: Agent | undefined;
89
- timeout?: number | undefined;
90
- setHost?: boolean | undefined;
72
+ protocol?: string | null;
73
+ host?: string | null;
74
+ hostname?: string | null;
75
+ family?: number;
76
+ port?: number | string | null;
77
+ defaultPort?: number | string;
78
+ localAddress?: string;
79
+ socketPath?: string;
80
+ method?: string;
81
+ path?: string | null;
82
+ headers?: OutgoingHttpHeaders;
83
+ auth?: string | null;
84
+ agent?: Agent | boolean;
85
+ _defaultAgent?: Agent;
86
+ timeout?: number;
87
+ setHost?: boolean;
91
88
  // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278
92
- createConnection?: ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) | undefined;
93
- lookup?: LookupFunction | undefined;
89
+ createConnection?: (options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket;
94
90
  }
95
91
 
96
92
  interface ServerOptions {
97
- IncomingMessage?: typeof IncomingMessage | undefined;
98
- ServerResponse?: typeof ServerResponse | undefined;
93
+ IncomingMessage?: typeof IncomingMessage;
94
+ ServerResponse?: typeof ServerResponse;
99
95
  }
100
96
 
101
97
  type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
@@ -120,72 +116,6 @@ declare module 'http' {
120
116
  */
121
117
  headersTimeout: number;
122
118
  keepAliveTimeout: number;
123
- addListener(event: string, listener: (...args: any[]) => void): this;
124
- addListener(event: 'close', listener: () => void): this;
125
- addListener(event: 'connection', listener: (socket: Socket) => void): this;
126
- addListener(event: 'error', listener: (err: Error) => void): this;
127
- addListener(event: 'listening', listener: () => void): this;
128
- addListener(event: 'checkContinue', listener: RequestListener): this;
129
- addListener(event: 'checkExpectation', listener: RequestListener): this;
130
- addListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
131
- addListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
132
- addListener(event: 'request', listener: RequestListener): this;
133
- addListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
134
- emit(event: string, ...args: any[]): boolean;
135
- emit(event: 'close'): boolean;
136
- emit(event: 'connection', socket: Socket): boolean;
137
- emit(event: 'error', err: Error): boolean;
138
- emit(event: 'listening'): boolean;
139
- emit(event: 'checkContinue', req: IncomingMessage, res: ServerResponse): boolean;
140
- emit(event: 'checkExpectation', req: IncomingMessage, res: ServerResponse): boolean;
141
- emit(event: 'clientError', err: Error, socket: stream.Duplex): boolean;
142
- emit(event: 'connect', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
143
- emit(event: 'request', req: IncomingMessage, res: ServerResponse): boolean;
144
- emit(event: 'upgrade', req: IncomingMessage, socket: stream.Duplex, head: Buffer): boolean;
145
- on(event: string, listener: (...args: any[]) => void): this;
146
- on(event: 'close', listener: () => void): this;
147
- on(event: 'connection', listener: (socket: Socket) => void): this;
148
- on(event: 'error', listener: (err: Error) => void): this;
149
- on(event: 'listening', listener: () => void): this;
150
- on(event: 'checkContinue', listener: RequestListener): this;
151
- on(event: 'checkExpectation', listener: RequestListener): this;
152
- on(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
153
- on(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
154
- on(event: 'request', listener: RequestListener): this;
155
- on(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
156
- once(event: string, listener: (...args: any[]) => void): this;
157
- once(event: 'close', listener: () => void): this;
158
- once(event: 'connection', listener: (socket: Socket) => void): this;
159
- once(event: 'error', listener: (err: Error) => void): this;
160
- once(event: 'listening', listener: () => void): this;
161
- once(event: 'checkContinue', listener: RequestListener): this;
162
- once(event: 'checkExpectation', listener: RequestListener): this;
163
- once(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
164
- once(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
165
- once(event: 'request', listener: RequestListener): this;
166
- once(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
167
- prependListener(event: string, listener: (...args: any[]) => void): this;
168
- prependListener(event: 'close', listener: () => void): this;
169
- prependListener(event: 'connection', listener: (socket: Socket) => void): this;
170
- prependListener(event: 'error', listener: (err: Error) => void): this;
171
- prependListener(event: 'listening', listener: () => void): this;
172
- prependListener(event: 'checkContinue', listener: RequestListener): this;
173
- prependListener(event: 'checkExpectation', listener: RequestListener): this;
174
- prependListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
175
- prependListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
176
- prependListener(event: 'request', listener: RequestListener): this;
177
- prependListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
178
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
179
- prependOnceListener(event: 'close', listener: () => void): this;
180
- prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
181
- prependOnceListener(event: 'error', listener: (err: Error) => void): this;
182
- prependOnceListener(event: 'listening', listener: () => void): this;
183
- prependOnceListener(event: 'checkContinue', listener: RequestListener): this;
184
- prependOnceListener(event: 'checkExpectation', listener: RequestListener): this;
185
- prependOnceListener(event: 'clientError', listener: (err: Error, socket: stream.Duplex) => void): this;
186
- prependOnceListener(event: 'connect', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
187
- prependOnceListener(event: 'request', listener: RequestListener): this;
188
- prependOnceListener(event: 'upgrade', listener: (req: IncomingMessage, socket: stream.Duplex, head: Buffer) => void): this;
189
119
  }
190
120
 
191
121
  // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
@@ -197,18 +127,22 @@ declare module 'http' {
197
127
  sendDate: boolean;
198
128
  finished: boolean;
199
129
  headersSent: boolean;
130
+ /**
131
+ * @deprecate Use `socket` instead.
132
+ */
200
133
  connection: Socket;
134
+ socket: Socket;
201
135
 
202
136
  constructor();
203
137
 
204
138
  setTimeout(msecs: number, callback?: () => void): this;
205
- setHeader(name: string, value: number | string | ReadonlyArray<string>): void;
139
+ setHeader(name: string, value: number | string | string[]): void;
206
140
  getHeader(name: string): number | string | string[] | undefined;
207
141
  getHeaders(): OutgoingHttpHeaders;
208
142
  getHeaderNames(): string[];
209
143
  hasHeader(name: string): boolean;
210
144
  removeHeader(name: string): void;
211
- addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void;
145
+ addTrailers(headers: OutgoingHttpHeaders | Array<[string, string]>): void;
212
146
  flushHeaders(): void;
213
147
  }
214
148
 
@@ -225,7 +159,7 @@ declare module 'http' {
225
159
  // https://github.com/nodejs/node/blob/master/test/parallel/test-http-write-callbacks.js#L53
226
160
  // no args in writeContinue callback
227
161
  writeContinue(callback?: () => void): void;
228
- writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): this;
162
+ writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this;
229
163
  writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
230
164
  writeProcessing(): void;
231
165
  }
@@ -240,18 +174,16 @@ declare module 'http' {
240
174
  rawHeaders: string[];
241
175
  }
242
176
 
243
- // https://github.com/nodejs/node/blob/v12.20.0/lib/_http_client.js#L85
177
+ // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
244
178
  class ClientRequest extends OutgoingMessage {
245
179
  connection: Socket;
246
180
  socket: Socket;
247
- aborted: boolean;
248
- host: string;
249
- protocol: string;
181
+ aborted: number;
250
182
 
251
183
  constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
252
184
 
253
185
  method: string;
254
- readonly path: string;
186
+ path: string;
255
187
  abort(): void;
256
188
  onSocket(socket: Socket): void;
257
189
  setTimeout(timeout: number, callback?: () => void): this;
@@ -342,12 +274,15 @@ declare module 'http' {
342
274
  class IncomingMessage extends stream.Readable {
343
275
  constructor(socket: Socket);
344
276
 
345
- aborted: boolean;
346
277
  httpVersion: string;
347
278
  httpVersionMajor: number;
348
279
  httpVersionMinor: number;
349
280
  complete: boolean;
281
+ /**
282
+ * @deprecate Use `socket` instead.
283
+ */
350
284
  connection: Socket;
285
+ socket: Socket;
351
286
  headers: IncomingHttpHeaders;
352
287
  rawHeaders: string[];
353
288
  trailers: { [key: string]: string | undefined };
@@ -356,59 +291,49 @@ declare module 'http' {
356
291
  /**
357
292
  * Only valid for request obtained from http.Server.
358
293
  */
359
- method?: string | undefined;
294
+ method?: string;
360
295
  /**
361
296
  * Only valid for request obtained from http.Server.
362
297
  */
363
- url?: string | undefined;
298
+ url?: string;
364
299
  /**
365
300
  * Only valid for response obtained from http.ClientRequest.
366
301
  */
367
- statusCode?: number | undefined;
302
+ statusCode?: number;
368
303
  /**
369
304
  * Only valid for response obtained from http.ClientRequest.
370
305
  */
371
- statusMessage?: string | undefined;
372
- socket: Socket;
373
- destroy(error?: Error): this;
306
+ statusMessage?: string;
307
+ destroy(error?: Error): void;
374
308
  }
375
309
 
376
310
  interface AgentOptions {
377
311
  /**
378
312
  * Keep sockets around in a pool to be used by other requests in the future. Default = false
379
313
  */
380
- keepAlive?: boolean | undefined;
314
+ keepAlive?: boolean;
381
315
  /**
382
316
  * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
383
317
  * Only relevant if keepAlive is set to true.
384
318
  */
385
- keepAliveMsecs?: number | undefined;
319
+ keepAliveMsecs?: number;
386
320
  /**
387
321
  * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
388
322
  */
389
- maxSockets?: number | undefined;
390
- /**
391
- * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
392
- */
393
- maxTotalSockets?: number | undefined;
323
+ maxSockets?: number;
394
324
  /**
395
325
  * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
396
326
  */
397
- maxFreeSockets?: number | undefined;
327
+ maxFreeSockets?: number;
398
328
  /**
399
329
  * Socket timeout in milliseconds. This will set the timeout after the socket is connected.
400
330
  */
401
- timeout?: number | undefined;
402
- /**
403
- * Scheduling strategy to apply when picking the next free socket to use. Default: 'fifo'.
404
- */
405
- scheduling?: 'fifo' | 'lifo' | undefined;
331
+ timeout?: number;
406
332
  }
407
333
 
408
334
  class Agent {
409
335
  maxFreeSockets: number;
410
336
  maxSockets: number;
411
- maxTotalSockets: number;
412
337
  readonly sockets: {
413
338
  readonly [key: string]: Socket[];
414
339
  };