@types/node 13.1.8 → 13.5.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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 17 Jan 2020 18:31:08 GMT
11
+ * Last updated: Thu, 23 Jan 2020 18:24:38 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/assert.d.ts CHANGED
@@ -43,6 +43,9 @@ declare module "assert" {
43
43
  function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
44
44
  function doesNotReject(block: (() => Promise<any>) | Promise<any>, error: RegExp | Function, message?: string | Error): Promise<void>;
45
45
 
46
+ function match(value: string, regExp: RegExp, message?: string | Error): void;
47
+ function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
48
+
46
49
  const strict: typeof internal;
47
50
  }
48
51
 
node/events.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  declare module "events" {
2
- interface internal extends NodeJS.EventEmitter {}
3
- class internal { }
2
+ interface EventEmitterOptions {
3
+ /**
4
+ * Enables automatic capturing of promise rejection.
5
+ */
6
+ captureRejections?: boolean;
7
+ }
4
8
 
5
9
  interface NodeEventTarget {
6
10
  once(event: string | symbol, listener: (...args: any[]) => void): this;
@@ -10,31 +14,37 @@ declare module "events" {
10
14
  addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
11
15
  }
12
16
 
13
- namespace internal {
17
+ namespace EventEmitter {
14
18
  function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
15
19
  function once(emitter: DOMEventTarget, event: string): Promise<any[]>;
16
- class EventEmitter extends internal {
20
+ function on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>;
21
+ const captureRejectionSymbol: unique symbol;
22
+
23
+ /**
24
+ * This symbol shall be used to install a listener for only monitoring `'error'`
25
+ * events. Listeners installed using this symbol are called before the regular
26
+ * `'error'` listeners are called.
27
+ *
28
+ * Installing a listener using this symbol does not change the behavior once an
29
+ * `'error'` event is emitted, therefore the process will still crash if no
30
+ * regular `'error'` listener is installed.
31
+ */
32
+ const errorMonitor: unique symbol;
33
+ /**
34
+ * Sets or gets the default captureRejection value for all emitters.
35
+ */
36
+ let captureRejections: boolean;
37
+
38
+ interface EventEmitter extends NodeJS.EventEmitter {
39
+ }
40
+
41
+ class EventEmitter {
42
+ constructor(options?: EventEmitterOptions);
17
43
  /** @deprecated since v4.0.0 */
18
44
  static listenerCount(emitter: EventEmitter, event: string | symbol): number;
19
45
  static defaultMaxListeners: number;
20
-
21
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
22
- on(event: string | symbol, listener: (...args: any[]) => void): this;
23
- once(event: string | symbol, listener: (...args: any[]) => void): this;
24
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
25
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
26
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
27
- off(event: string | symbol, listener: (...args: any[]) => void): this;
28
- removeAllListeners(event?: string | symbol): this;
29
- setMaxListeners(n: number): this;
30
- getMaxListeners(): number;
31
- listeners(event: string | symbol): Function[];
32
- rawListeners(event: string | symbol): Function[];
33
- emit(event: string | symbol, ...args: any[]): boolean;
34
- eventNames(): Array<string | symbol>;
35
- listenerCount(type: string | symbol): number;
36
46
  }
37
47
  }
38
48
 
39
- export = internal;
49
+ export = EventEmitter;
40
50
  }
node/fs.d.ts CHANGED
@@ -745,21 +745,20 @@ declare module "fs" {
745
745
 
746
746
  interface RmDirAsyncOptions extends RmDirOptions {
747
747
  /**
748
- * If an `EMFILE` error is encountered, Node.js will
749
- * retry the operation with a linear backoff of 1ms longer on each try until the
750
- * timeout duration passes this limit. This option is ignored if the `recursive`
751
- * option is not `true`.
752
- * @default 1000
748
+ * The amount of time in milliseconds to wait between retries.
749
+ * This option is ignored if the `recursive` option is not `true`.
750
+ * @default 100
753
751
  */
754
- emfileWait?: number;
752
+ retryDelay?: number;
755
753
  /**
756
- * If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
757
- * encountered, Node.js will retry the operation with a linear backoff wait of
758
- * 100ms longer on each try. This option represents the number of retries. This
759
- * option is ignored if the `recursive` option is not `true`.
760
- * @default 3
754
+ * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
755
+ * `EPERM` error is encountered, Node.js will retry the operation with a linear
756
+ * backoff wait of `retryDelay` ms longer on each try. This option represents the
757
+ * number of retries. This option is ignored if the `recursive` option is not
758
+ * `true`.
759
+ * @default 0
761
760
  */
762
- maxBusyTries?: number;
761
+ maxRetries?: number;
763
762
  }
764
763
 
765
764
  /**
node/http.d.ts CHANGED
@@ -77,6 +77,10 @@ declare module "http" {
77
77
  defaultPort?: number | string;
78
78
  localAddress?: string;
79
79
  socketPath?: string;
80
+ /**
81
+ * @default 8192
82
+ */
83
+ maxHeaderSize?: number;
80
84
  method?: string;
81
85
  path?: string | null;
82
86
  headers?: OutgoingHttpHeaders;
@@ -92,14 +96,18 @@ declare module "http" {
92
96
  interface ServerOptions {
93
97
  IncomingMessage?: typeof IncomingMessage;
94
98
  ServerResponse?: typeof ServerResponse;
99
+ /**
100
+ * Optionally overrides the value of
101
+ * [`--max-http-header-size`][] for requests received by this server, i.e.
102
+ * the maximum length of request headers in bytes.
103
+ * @default 8192
104
+ */
105
+ maxHeaderSize?: number;
95
106
  }
96
107
 
97
108
  type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
98
109
 
99
- class Server extends NetServer {
100
- constructor(requestListener?: RequestListener);
101
- constructor(options: ServerOptions, requestListener?: RequestListener);
102
-
110
+ interface HttpBase {
103
111
  setTimeout(msecs?: number, callback?: () => void): this;
104
112
  setTimeout(callback: () => void): this;
105
113
  /**
@@ -111,13 +119,19 @@ declare module "http" {
111
119
  timeout: number;
112
120
  /**
113
121
  * Limit the amount of time the parser will wait to receive the complete HTTP headers.
114
- * @default 40000
122
+ * @default 60000
115
123
  * {@link https://nodejs.org/api/http.html#http_server_headerstimeout}
116
124
  */
117
125
  headersTimeout: number;
118
126
  keepAliveTimeout: number;
119
127
  }
120
128
 
129
+ interface Server extends HttpBase {}
130
+ class Server extends NetServer {
131
+ constructor(requestListener?: RequestListener);
132
+ constructor(options: ServerOptions, requestListener?: RequestListener);
133
+ }
134
+
121
135
  // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
122
136
  class OutgoingMessage extends stream.Writable {
123
137
  upgrading: boolean;
@@ -125,6 +139,9 @@ declare module "http" {
125
139
  shouldKeepAlive: boolean;
126
140
  useChunkedEncodingByDefault: boolean;
127
141
  sendDate: boolean;
142
+ /**
143
+ * @deprecated Use `writableEnded` instead.
144
+ */
128
145
  finished: boolean;
129
146
  headersSent: boolean;
130
147
  /**
@@ -150,7 +167,6 @@ declare module "http" {
150
167
  class ServerResponse extends OutgoingMessage {
151
168
  statusCode: number;
152
169
  statusMessage: string;
153
- writableFinished: boolean;
154
170
 
155
171
  constructor(req: IncomingMessage);
156
172
 
node/https.d.ts CHANGED
@@ -21,26 +21,10 @@ declare module "https" {
21
21
  options: AgentOptions;
22
22
  }
23
23
 
24
+ interface Server extends http.HttpBase {}
24
25
  class Server extends tls.Server {
25
26
  constructor(requestListener?: http.RequestListener);
26
27
  constructor(options: ServerOptions, requestListener?: http.RequestListener);
27
-
28
- setTimeout(callback: () => void): this;
29
- setTimeout(msecs?: number, callback?: () => void): this;
30
- /**
31
- * Limits maximum incoming headers count. If set to 0, no limit will be applied.
32
- * @default 2000
33
- * {@link https://nodejs.org/api/http.html#http_server_maxheaderscount}
34
- */
35
- maxHeadersCount: number | null;
36
- timeout: number;
37
- /**
38
- * Limit the amount of time the parser will wait to receive the complete HTTP headers.
39
- * @default 40000
40
- * {@link https://nodejs.org/api/http.html#http_server_headerstimeout}
41
- */
42
- headersTimeout: number;
43
- keepAliveTimeout: number;
44
28
  }
45
29
 
46
30
  function createServer(requestListener?: http.RequestListener): Server;
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 13.1
1
+ // Type definitions for non-npm package Node.js 13.5
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -43,16 +43,16 @@
43
43
  // Ilia Baryshnikov <https://github.com/qwelias>
44
44
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45
45
 
46
- // NOTE: These definitions support NodeJS and TypeScript 3.2.
46
+ // NOTE: These definitions support NodeJS and TypeScript 3.5.
47
47
 
48
48
  // NOTE: TypeScript version-specific augmentations can be found in the following paths:
49
49
  // - ~/base.d.ts - Shared definitions common to all TypeScript versions
50
50
  // - ~/index.d.ts - Definitions specific to TypeScript 2.8
51
- // - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2
51
+ // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
52
52
 
53
- // NOTE: Augmentations for TypeScript 3.2 and later should use individual files for overrides
54
- // within the respective ~/ts3.2 (or later) folder. However, this is disallowed for versions
55
- // prior to TypeScript 3.2, so the older definitions will be found here.
53
+ // NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
54
+ // within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
55
+ // prior to TypeScript 3.5, so the older definitions will be found here.
56
56
 
57
57
  // Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
58
58
  /// <reference path="base.d.ts" />
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "13.1.8",
3
+ "version": "13.5.0",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -213,9 +213,9 @@
213
213
  "main": "",
214
214
  "types": "index.d.ts",
215
215
  "typesVersions": {
216
- ">=3.2.0-0": {
216
+ ">=3.5.0-0": {
217
217
  "*": [
218
- "ts3.2/*"
218
+ "ts3.5/*"
219
219
  ]
220
220
  }
221
221
  },
@@ -226,6 +226,6 @@
226
226
  },
227
227
  "scripts": {},
228
228
  "dependencies": {},
229
- "typesPublisherContentHash": "0badd9e8c83ca280ae46f1520423742e02143c5a86c6b97568ebe3cecbf37efe",
229
+ "typesPublisherContentHash": "6fd15378eb4504bfccae2734fa32cb3c5edc23f7a020cc4c39019714b3e0e5db",
230
230
  "typeScriptVersion": "2.8"
231
231
  }
node/readline.d.ts CHANGED
@@ -47,6 +47,13 @@ declare module "readline" {
47
47
  close(): void;
48
48
  write(data: string | Buffer, key?: Key): void;
49
49
 
50
+ /**
51
+ * Returns the real position of the cursor in relation to the input
52
+ * prompt + string. Long input (wrapping) strings, as well as multiple
53
+ * line prompts are included in the calculations.
54
+ */
55
+ getCursorPos(): CursorPos;
56
+
50
57
  /**
51
58
  * events.EventEmitter
52
59
  * 1. close
@@ -138,6 +145,11 @@ declare module "readline" {
138
145
 
139
146
  type Direction = -1 | 0 | 1;
140
147
 
148
+ interface CursorPos {
149
+ rows: number;
150
+ cols: number;
151
+ }
152
+
141
153
  /**
142
154
  * Clears the current line of this WriteStream in a direction identified by `dir`.
143
155
  */
node/repl.d.ts CHANGED
@@ -36,6 +36,11 @@ declare module "repl" {
36
36
  * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
37
37
  */
38
38
  eval?: REPLEval;
39
+ /**
40
+ * Defines if the repl prints output previews or not.
41
+ * @default `true` Always `false` in case `terminal` is falsy.
42
+ */
43
+ preview?: boolean;
39
44
  /**
40
45
  * If `true`, specifies that the default `writer` function should include ANSI color
41
46
  * styling to REPL output. If a custom `writer` function is provided then this has no
node/stream.d.ts CHANGED
@@ -6,7 +6,9 @@ declare module "stream" {
6
6
  }
7
7
 
8
8
  namespace internal {
9
- class Stream extends internal { }
9
+ class Stream extends internal {
10
+ constructor(opts?: ReadableOptions);
11
+ }
10
12
 
11
13
  interface ReadableOptions {
12
14
  highWaterMark?: number;
node/tls.d.ts CHANGED
@@ -62,6 +62,11 @@ declare module "tls" {
62
62
  * SSL/TLS protocol version.
63
63
  */
64
64
  version: string;
65
+
66
+ /**
67
+ * IETF name for the cipher suite.
68
+ */
69
+ standardName: string;
65
70
  }
66
71
 
67
72
  interface EphemeralKeyInfo {
@@ -389,6 +394,40 @@ declare module "tls" {
389
394
  * 48-bytes of cryptographically strong pseudo-random data.
390
395
  */
391
396
  ticketKeys?: Buffer;
397
+
398
+ /**
399
+ *
400
+ * @param socket
401
+ * @param identity identity parameter sent from the client.
402
+ * @return pre-shared key that must either be
403
+ * a buffer or `null` to stop the negotiation process. Returned PSK must be
404
+ * compatible with the selected cipher's digest.
405
+ *
406
+ * When negotiating TLS-PSK (pre-shared keys), this function is called
407
+ * with the identity provided by the client.
408
+ * If the return value is `null` the negotiation process will stop and an
409
+ * "unknown_psk_identity" alert message will be sent to the other party.
410
+ * If the server wishes to hide the fact that the PSK identity was not known,
411
+ * the callback must provide some random data as `psk` to make the connection
412
+ * fail with "decrypt_error" before negotiation is finished.
413
+ * PSK ciphers are disabled by default, and using TLS-PSK thus
414
+ * requires explicitly specifying a cipher suite with the `ciphers` option.
415
+ * More information can be found in the RFC 4279.
416
+ */
417
+
418
+ pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
419
+ /**
420
+ * hint to send to a client to help
421
+ * with selecting the identity during TLS-PSK negotiation. Will be ignored
422
+ * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be
423
+ * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code.
424
+ */
425
+ pskIdentityHint?: string;
426
+ }
427
+
428
+ interface PSKCallbackNegotation {
429
+ psk: DataView | NodeJS.TypedArray;
430
+ identitty: string;
392
431
  }
393
432
 
394
433
  interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
@@ -402,6 +441,24 @@ declare module "tls" {
402
441
  minDHSize?: number;
403
442
  lookup?: net.LookupFunction;
404
443
  timeout?: number;
444
+ /**
445
+ * When negotiating TLS-PSK (pre-shared keys), this function is called
446
+ * with optional identity `hint` provided by the server or `null`
447
+ * in case of TLS 1.3 where `hint` was removed.
448
+ * It will be necessary to provide a custom `tls.checkServerIdentity()`
449
+ * for the connection as the default one will try to check hostname/IP
450
+ * of the server against the certificate but that's not applicable for PSK
451
+ * because there won't be a certificate present.
452
+ * More information can be found in the RFC 4279.
453
+ *
454
+ * @param hint message sent from the server to help client
455
+ * decide which identity to use during negotiation.
456
+ * Always `null` if TLS 1.3 is used.
457
+ * @returns Return `null` to stop the negotiation process. `psk` must be
458
+ * compatible with the selected cipher's digest.
459
+ * `identity` must use UTF-8 encoding.
460
+ */
461
+ pskCallback?(hint: string | null): PSKCallbackNegotation | null;
405
462
  }
406
463
 
407
464
  class Server extends net.Server {
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- // NOTE: These definitions support NodeJS and TypeScript 3.2.
1
+ // NOTE: These definitions support NodeJS and TypeScript 3.5.
2
2
 
3
3
  // Reference required types from the default lib:
4
4
  /// <reference lib="es2018" />
@@ -10,7 +10,8 @@
10
10
  // tslint:disable-next-line:no-bad-reference
11
11
  /// <reference path="../base.d.ts" />
12
12
 
13
- // TypeScript 3.2-specific augmentations:
13
+ // TypeScript 3.5-specific augmentations:
14
14
  /// <reference path="fs.d.ts" />
15
15
  /// <reference path="util.d.ts" />
16
16
  /// <reference path="globals.d.ts" />
17
+ /// <reference path="wasi.d.ts" />
File without changes
node/ts3.5/wasi.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ declare module 'wasi' {
2
+ interface WASIOptions {
3
+ /**
4
+ * An array of strings that the WebAssembly application will
5
+ * see as command line arguments. The first argument is the virtual path to the
6
+ * WASI command itself.
7
+ */
8
+ args?: string[];
9
+ /**
10
+ * An object similar to `process.env` that the WebAssembly
11
+ * application will see as its environment.
12
+ */
13
+ env?: object;
14
+ /**
15
+ * This object represents the WebAssembly application's
16
+ * sandbox directory structure. The string keys of `preopens` are treated as
17
+ * directories within the sandbox. The corresponding values in `preopens` are
18
+ * the real paths to those directories on the host machine.
19
+ */
20
+ preopens?: {
21
+ [key: string]: string;
22
+ };
23
+ }
24
+
25
+ class WASI {
26
+ constructor(options?: WASIOptions);
27
+ /**
28
+ *
29
+ * Attempt to begin execution of `instance` by invoking its `_start()` export.
30
+ * If `instance` does not contain a `_start()` export, then `start()` attempts to
31
+ * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
32
+ * is present on `instance`, then `start()` does nothing.
33
+ *
34
+ * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
35
+ * `memory`. If `instance` does not have a `memory` export an exception is thrown.
36
+ */
37
+ start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
38
+ /**
39
+ * Is an object that implements the WASI system call API. This object
40
+ * should be passed as the `wasi_unstable` import during the instantiation of a
41
+ * [`WebAssembly.Instance`][].
42
+ */
43
+ readonly wasiImport: { [key: string]: any }; // TODO: Narrow to DOM types
44
+ }
45
+ }
node/util.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  declare module "util" {
2
2
  interface InspectOptions extends NodeJS.InspectOptions { }
3
+ type Style = 'special' | 'number' | 'bigint' | 'boolean' | 'undefined' | 'null' | 'string' | 'symbol' | 'date' | 'regexp' | 'module';
4
+ type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => string;
5
+ interface InspectOptionsStylized extends InspectOptions {
6
+ stylize(text: string, styleType: Style): string;
7
+ }
3
8
  function format(format: any, ...param: any[]): string;
4
9
  function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
5
10
  /** @deprecated since v0.11.3 - use a third party module instead. */
@@ -11,7 +16,7 @@ declare module "util" {
11
16
  [color: string]: [number, number] | undefined
12
17
  };
13
18
  let styles: {
14
- [style: string]: string | undefined
19
+ [K in Style]: string
15
20
  };
16
21
  let defaultOptions: InspectOptions;
17
22
  /**
node/worker_threads.d.ts CHANGED
@@ -54,6 +54,13 @@ declare module "worker_threads" {
54
54
  }
55
55
 
56
56
  interface WorkerOptions {
57
+ /**
58
+ * List of arguments which would be stringified and appended to
59
+ * `process.argv` in the worker. This is mostly similar to the `workerData`
60
+ * but the values will be available on the global `process.argv` as if they
61
+ * were passed as CLI options to the script.
62
+ */
63
+ argv?: any[];
57
64
  eval?: boolean;
58
65
  workerData?: any;
59
66
  stdin?: boolean;