@types/node 12.0.12 → 12.6.3

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: Wed, 03 Jul 2019 17:20:32 GMT
11
+ * Last updated: Mon, 15 Jul 2019 16:49:55 GMT
12
12
  * Dependencies: none
13
13
  * Global values: Buffer, NodeJS, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, queueMicrotask, require, setImmediate, setInterval, setTimeout
14
14
 
node/child_process.d.ts CHANGED
@@ -177,13 +177,17 @@ declare module "child_process" {
177
177
  callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
178
178
  ): ChildProcess;
179
179
 
180
+ interface PromiseWithChild<T> extends Promise<T> {
181
+ child: ChildProcess;
182
+ }
183
+
180
184
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
181
185
  namespace exec {
182
- function __promisify__(command: string): Promise<{ stdout: string, stderr: string }>;
183
- function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<{ stdout: Buffer, stderr: Buffer }>;
184
- function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<{ stdout: string, stderr: string }>;
185
- function __promisify__(command: string, options: ExecOptions): Promise<{ stdout: string, stderr: string }>;
186
- function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
186
+ function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
187
+ function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
188
+ function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
189
+ function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
190
+ function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
187
191
  }
188
192
 
189
193
  interface ExecFileOptions extends CommonOptions {
@@ -262,22 +266,22 @@ declare module "child_process" {
262
266
 
263
267
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
264
268
  namespace execFile {
265
- function __promisify__(file: string): Promise<{ stdout: string, stderr: string }>;
266
- function __promisify__(file: string, args: string[] | undefined | null): Promise<{ stdout: string, stderr: string }>;
267
- function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
268
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>;
269
- function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
270
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>;
271
- function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
272
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
273
- function __promisify__(file: string, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
274
- function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>;
275
- function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
269
+ function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
270
+ function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
271
+ function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
272
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
273
+ function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
274
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
275
+ function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
276
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
277
+ function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
278
+ function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
279
+ function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
276
280
  function __promisify__(
277
281
  file: string,
278
282
  args: string[] | undefined | null,
279
283
  options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
280
- ): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>;
284
+ ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
281
285
  }
282
286
 
283
287
  interface ForkOptions extends ProcessEnvOptions {
node/constants.d.ts CHANGED
@@ -193,7 +193,6 @@ declare module "constants" {
193
193
  const DH_CHECK_P_NOT_PRIME: number;
194
194
  const DH_UNABLE_TO_CHECK_GENERATOR: number;
195
195
  const DH_NOT_SUITABLE_GENERATOR: number;
196
- const NPN_ENABLED: number;
197
196
  const RSA_PKCS1_PADDING: number;
198
197
  const RSA_SSLV23_PADDING: number;
199
198
  const RSA_NO_PADDING: number;
node/globals.d.ts CHANGED
@@ -154,6 +154,10 @@ interface String {
154
154
  trimRight(): string;
155
155
  }
156
156
 
157
+ interface ImportMeta {
158
+ url: string;
159
+ }
160
+
157
161
  /*-----------------------------------------------*
158
162
  * *
159
163
  * GLOBAL *
@@ -324,21 +328,21 @@ declare const Buffer: {
324
328
  * @param encoding encoding to use, optional. Default is 'utf8'
325
329
  * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
326
330
  */
327
- new(str: string, encoding?: BufferEncoding): Buffer;
331
+ new (str: string, encoding?: BufferEncoding): Buffer;
328
332
  /**
329
333
  * Allocates a new buffer of {size} octets.
330
334
  *
331
335
  * @param size count of octets to allocate.
332
336
  * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
333
337
  */
334
- new(size: number): Buffer;
338
+ new (size: number): Buffer;
335
339
  /**
336
340
  * Allocates a new buffer containing the given {array} of octets.
337
341
  *
338
342
  * @param array The octets to store.
339
343
  * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
340
344
  */
341
- new(array: Uint8Array): Buffer;
345
+ new (array: Uint8Array): Buffer;
342
346
  /**
343
347
  * Produces a Buffer backed by the same allocated memory as
344
348
  * the given {ArrayBuffer}/{SharedArrayBuffer}.
@@ -347,21 +351,21 @@ declare const Buffer: {
347
351
  * @param arrayBuffer The ArrayBuffer with which to share memory.
348
352
  * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
349
353
  */
350
- new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
354
+ new (arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
351
355
  /**
352
356
  * Allocates a new buffer containing the given {array} of octets.
353
357
  *
354
358
  * @param array The octets to store.
355
359
  * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
356
360
  */
357
- new(array: any[]): Buffer;
361
+ new (array: any[]): Buffer;
358
362
  /**
359
363
  * Copies the passed {buffer} data onto a new {Buffer} instance.
360
364
  *
361
365
  * @param buffer The buffer to copy.
362
366
  * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
363
367
  */
364
- new(buffer: Buffer): Buffer;
368
+ new (buffer: Buffer): Buffer;
365
369
  prototype: Buffer;
366
370
  /**
367
371
  * When passed a reference to the .buffer property of a TypedArray instance,
@@ -401,7 +405,7 @@ declare const Buffer: {
401
405
  *
402
406
  * @param encoding string to test.
403
407
  */
404
- isEncoding(encoding: string): encoding is BufferEncoding
408
+ isEncoding(encoding: string): encoding is BufferEncoding;
405
409
  /**
406
410
  * Gives the actual byte length of a string. encoding defaults to 'utf8'.
407
411
  * This is not the same as String.prototype.length since that returns the number of characters in a string.
@@ -409,7 +413,10 @@ declare const Buffer: {
409
413
  * @param string string to test.
410
414
  * @param encoding encoding used to evaluate (defaults to 'utf8')
411
415
  */
412
- byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
416
+ byteLength(
417
+ string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
418
+ encoding?: BufferEncoding
419
+ ): number;
413
420
  /**
414
421
  * Returns a buffer which is the result of concatenating all the buffers in the list together.
415
422
  *
@@ -619,7 +626,7 @@ declare namespace NodeJS {
619
626
  isPaused(): boolean;
620
627
  pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
621
628
  unpipe(destination?: WritableStream): this;
622
- unshift(chunk: string | Buffer | Uint8Array): void;
629
+ unshift(chunk: string | Buffer | Uint8Array, encoding?: BufferEncoding): void;
623
630
  wrap(oldStream: ReadableStream): this;
624
631
  [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
625
632
  }
@@ -722,6 +729,7 @@ declare namespace NodeJS {
722
729
  }
723
730
 
724
731
  interface WriteStream extends Socket {
732
+ readonly writableFinished: boolean;
725
733
  readonly writableHighWaterMark: number;
726
734
  readonly writableLength: number;
727
735
  columns?: number;
@@ -814,6 +822,25 @@ declare namespace NodeJS {
814
822
  writeReport(fileName?: string, err?: Error): string;
815
823
  }
816
824
 
825
+ interface ResourceUsage {
826
+ fsRead: number;
827
+ fsWrite: number;
828
+ involuntaryContextSwitches: number;
829
+ ipcReceived: number;
830
+ ipcSent: number;
831
+ majorPageFault: number;
832
+ maxRSS: number;
833
+ minorPageFault: number;
834
+ sharedMemorySize: number;
835
+ signalsCount: number;
836
+ swappedOut: number;
837
+ systemCPUTime: number;
838
+ unsharedDataSize: number;
839
+ unsharedStackSize: number;
840
+ userCPUTime: number;
841
+ voluntaryContextSwitches: number;
842
+ }
843
+
817
844
  interface Process extends EventEmitter {
818
845
  /**
819
846
  * Can also be a tty.WriteStream, not typed due to limitation.s
@@ -923,6 +950,8 @@ declare namespace NodeJS {
923
950
  */
924
951
  report?: ProcessReport;
925
952
 
953
+ resourceUsage(): ResourceUsage;
954
+
926
955
  /**
927
956
  * EventEmitter
928
957
  * 1. beforeExit
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 12.0
1
+ // Type definitions for non-npm package Node.js 12.6
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -68,6 +68,7 @@ interface Map<K, V> {}
68
68
  interface ReadonlySet<T> {}
69
69
  interface IteratorResult<T> { }
70
70
  interface Iterable<T> { }
71
+ interface AsyncIterable<T> { }
71
72
  interface Iterator<T> {
72
73
  next(value?: any): IteratorResult<T>;
73
74
  }
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "12.0.12",
3
+ "version": "12.6.3",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -206,6 +206,6 @@
206
206
  },
207
207
  "scripts": {},
208
208
  "dependencies": {},
209
- "typesPublisherContentHash": "cc75eca51c8dce0d5f071563237151d150523b634dd552a954f5ba7f693beaba",
209
+ "typesPublisherContentHash": "128e795452367cc7c19bd361d04ea03fa71718fb800872e964ac44cb1e6c742b",
210
210
  "typeScriptVersion": "2.0"
211
211
  }
node/stream.d.ts CHANGED
@@ -18,6 +18,11 @@ declare module "stream" {
18
18
  }
19
19
 
20
20
  class Readable extends Stream implements NodeJS.ReadableStream {
21
+ /**
22
+ * A utility method for creating Readable Streams out of iterators.
23
+ */
24
+ static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
25
+
21
26
  readable: boolean;
22
27
  readonly readableHighWaterMark: number;
23
28
  readonly readableLength: number;
@@ -29,7 +34,7 @@ declare module "stream" {
29
34
  resume(): this;
30
35
  isPaused(): boolean;
31
36
  unpipe(destination?: NodeJS.WritableStream): this;
32
- unshift(chunk: any): void;
37
+ unshift(chunk: any, encoding?: BufferEncoding): void;
33
38
  wrap(oldStream: NodeJS.ReadableStream): this;
34
39
  push(chunk: any, encoding?: string): boolean;
35
40
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
@@ -110,7 +115,8 @@ declare module "stream" {
110
115
  }
111
116
 
112
117
  class Writable extends Stream implements NodeJS.WritableStream {
113
- writable: boolean;
118
+ readonly writable: boolean;
119
+ readonly writableFinished: boolean;
114
120
  readonly writableHighWaterMark: number;
115
121
  readonly writableLength: number;
116
122
  constructor(opts?: WritableOptions);
@@ -208,7 +214,8 @@ declare module "stream" {
208
214
 
209
215
  // Note: Duplex extends both Readable and Writable.
210
216
  class Duplex extends Readable implements Writable {
211
- writable: boolean;
217
+ readonly writable: boolean;
218
+ readonly writableFinished: boolean;
212
219
  readonly writableHighWaterMark: number;
213
220
  readonly writableLength: number;
214
221
  constructor(opts?: DuplexOptions);
node/tls.d.ts CHANGED
@@ -64,70 +64,34 @@ declare module "tls" {
64
64
  version: string;
65
65
  }
66
66
 
67
+ export interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
68
+ /**
69
+ * If true the TLS socket will be instantiated in server-mode.
70
+ * Defaults to false.
71
+ */
72
+ isServer?: boolean;
73
+ /**
74
+ * An optional net.Server instance.
75
+ */
76
+ server?: net.Server;
77
+
78
+ /**
79
+ * An optional Buffer instance containing a TLS session.
80
+ */
81
+ session?: Buffer;
82
+ /**
83
+ * If true, specifies that the OCSP status request extension will be
84
+ * added to the client hello and an 'OCSPResponse' event will be
85
+ * emitted on the socket before establishing a secure communication
86
+ */
87
+ requestOCSP?: boolean;
88
+ }
89
+
67
90
  class TLSSocket extends net.Socket {
68
91
  /**
69
92
  * Construct a new tls.TLSSocket object from an existing TCP socket.
70
93
  */
71
- constructor(socket: net.Socket, options?: {
72
- /**
73
- * An optional TLS context object from tls.createSecureContext()
74
- */
75
- secureContext?: SecureContext,
76
- /**
77
- * If true the TLS socket will be instantiated in server-mode.
78
- * Defaults to false.
79
- */
80
- isServer?: boolean,
81
- /**
82
- * An optional net.Server instance.
83
- */
84
- server?: net.Server,
85
- /**
86
- * If true the server will request a certificate from clients that
87
- * connect and attempt to verify that certificate. Defaults to
88
- * false.
89
- */
90
- requestCert?: boolean,
91
- /**
92
- * If true the server will reject any connection which is not
93
- * authorized with the list of supplied CAs. This option only has an
94
- * effect if requestCert is true. Defaults to false.
95
- */
96
- rejectUnauthorized?: boolean,
97
- /**
98
- * An array of strings or a Buffer naming possible NPN protocols.
99
- * (Protocols should be ordered by their priority.)
100
- */
101
- NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
102
- /**
103
- * An array of strings or a Buffer naming possible ALPN protocols.
104
- * (Protocols should be ordered by their priority.) When the server
105
- * receives both NPN and ALPN extensions from the client, ALPN takes
106
- * precedence over NPN and the server does not send an NPN extension
107
- * to the client.
108
- */
109
- ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
110
- /**
111
- * SNICallback(servername, cb) <Function> A function that will be
112
- * called if the client supports SNI TLS extension. Two arguments
113
- * will be passed when called: servername and cb. SNICallback should
114
- * invoke cb(null, ctx), where ctx is a SecureContext instance.
115
- * (tls.createSecureContext(...) can be used to get a proper
116
- * SecureContext.) If SNICallback wasn't provided the default callback
117
- * with high-level API will be used (see below).
118
- */
119
- SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void,
120
- /**
121
- * An optional Buffer instance containing a TLS session.
122
- */
123
- session?: Buffer,
124
- /**
125
- * If true, specifies that the OCSP status request extension will be
126
- * added to the client hello and an 'OCSPResponse' event will be
127
- * emitted on the socket before establishing a secure communication
128
- */
129
- requestOCSP?: boolean
130
- });
94
+ constructor(socket: net.Socket, options?: TLSSocketOptions);
131
95
 
132
96
  /**
133
97
  * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
@@ -212,65 +176,110 @@ declare module "tls" {
212
176
  setMaxSendFragment(size: number): boolean;
213
177
 
214
178
  /**
215
- * events.EventEmitter
216
- * 1. OCSPResponse
217
- * 2. secureConnect
179
+ * When enabled, TLS packet trace information is written to `stderr`. This can be
180
+ * used to debug TLS connection problems.
181
+ *
182
+ * Note: The format of the output is identical to the output of `openssl s_client
183
+ * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's
184
+ * `SSL_trace()` function, the format is undocumented, can change without notice,
185
+ * and should not be relied on.
218
186
  */
187
+ enableTrace(): void;
188
+
219
189
  addListener(event: string, listener: (...args: any[]) => void): this;
220
190
  addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
221
191
  addListener(event: "secureConnect", listener: () => void): this;
222
192
  addListener(event: "session", listener: (session: Buffer) => void): this;
193
+ addListener(event: "keylog", listener: (line: Buffer) => void): this;
223
194
 
224
195
  emit(event: string | symbol, ...args: any[]): boolean;
225
196
  emit(event: "OCSPResponse", response: Buffer): boolean;
226
197
  emit(event: "secureConnect"): boolean;
227
198
  emit(event: "session", session: Buffer): boolean;
199
+ emit(event: "keylog", line: Buffer): boolean;
228
200
 
229
201
  on(event: string, listener: (...args: any[]) => void): this;
230
202
  on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
231
203
  on(event: "secureConnect", listener: () => void): this;
232
204
  on(event: "session", listener: (session: Buffer) => void): this;
205
+ on(event: "keylog", listener: (line: Buffer) => void): this;
233
206
 
234
207
  once(event: string, listener: (...args: any[]) => void): this;
235
208
  once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
236
209
  once(event: "secureConnect", listener: () => void): this;
237
210
  once(event: "session", listener: (session: Buffer) => void): this;
211
+ once(event: "keylog", listener: (line: Buffer) => void): this;
238
212
 
239
213
  prependListener(event: string, listener: (...args: any[]) => void): this;
240
214
  prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
241
215
  prependListener(event: "secureConnect", listener: () => void): this;
242
216
  prependListener(event: "session", listener: (session: Buffer) => void): this;
217
+ prependListener(event: "keylog", listener: (line: Buffer) => void): this;
243
218
 
244
219
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
245
220
  prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
246
221
  prependOnceListener(event: "secureConnect", listener: () => void): this;
247
222
  prependOnceListener(event: "session", listener: (session: Buffer) => void): this;
223
+ prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this;
248
224
  }
249
225
 
250
- interface TlsOptions extends SecureContextOptions {
251
- handshakeTimeout?: number;
226
+ interface CommonConnectionOptions {
227
+ /**
228
+ * An optional TLS context object from tls.createSecureContext()
229
+ */
230
+ secureContext?: SecureContext;
231
+
232
+ /**
233
+ * When enabled, TLS packet trace information is written to `stderr`. This can be
234
+ * used to debug TLS connection problems.
235
+ * @default false
236
+ */
237
+ enableTrace?: boolean;
238
+ /**
239
+ * If true the server will request a certificate from clients that
240
+ * connect and attempt to verify that certificate. Defaults to
241
+ * false.
242
+ */
252
243
  requestCert?: boolean;
253
- rejectUnauthorized?: boolean;
254
- NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
244
+ /**
245
+ * An array of strings or a Buffer naming possible ALPN protocols.
246
+ * (Protocols should be ordered by their priority.)
247
+ */
255
248
  ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
249
+ /**
250
+ * SNICallback(servername, cb) <Function> A function that will be
251
+ * called if the client supports SNI TLS extension. Two arguments
252
+ * will be passed when called: servername and cb. SNICallback should
253
+ * invoke cb(null, ctx), where ctx is a SecureContext instance.
254
+ * (tls.createSecureContext(...) can be used to get a proper
255
+ * SecureContext.) If SNICallback wasn't provided the default callback
256
+ * with high-level API will be used (see below).
257
+ */
256
258
  SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void;
259
+ /**
260
+ * If true the server will reject any connection which is not
261
+ * authorized with the list of supplied CAs. This option only has an
262
+ * effect if requestCert is true.
263
+ * @default true
264
+ */
265
+ rejectUnauthorized?: boolean; // Defaults to true
266
+ }
267
+
268
+ interface TlsOptions extends SecureContextOptions, CommonConnectionOptions {
269
+ handshakeTimeout?: number;
257
270
  sessionTimeout?: number;
258
271
  ticketKeys?: Buffer;
259
272
  }
260
273
 
261
- interface ConnectionOptions extends SecureContextOptions {
274
+ interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
262
275
  host?: string;
263
276
  port?: number;
264
277
  path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
265
278
  socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket
266
- rejectUnauthorized?: boolean; // Defaults to true
267
- NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
268
- ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
269
279
  checkServerIdentity?: typeof checkServerIdentity;
270
280
  servername?: string; // SNI TLS Extension
271
281
  session?: Buffer;
272
282
  minDHSize?: number;
273
- secureContext?: SecureContext; // If not provided, the entire ConnectionOptions object will be passed to tls.createSecureContext()
274
283
  lookup?: net.LookupFunction;
275
284
  timeout?: number;
276
285
  }
@@ -292,6 +301,7 @@ declare module "tls" {
292
301
  addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
293
302
  addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
294
303
  addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
304
+ addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
295
305
 
296
306
  emit(event: string | symbol, ...args: any[]): boolean;
297
307
  emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
@@ -299,6 +309,7 @@ declare module "tls" {
299
309
  emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
300
310
  emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
301
311
  emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
312
+ emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean;
302
313
 
303
314
  on(event: string, listener: (...args: any[]) => void): this;
304
315
  on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
@@ -306,6 +317,7 @@ declare module "tls" {
306
317
  on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
307
318
  on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
308
319
  on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
320
+ on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
309
321
 
310
322
  once(event: string, listener: (...args: any[]) => void): this;
311
323
  once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
@@ -313,6 +325,7 @@ declare module "tls" {
313
325
  once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
314
326
  once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
315
327
  once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
328
+ once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
316
329
 
317
330
  prependListener(event: string, listener: (...args: any[]) => void): this;
318
331
  prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
@@ -320,6 +333,7 @@ declare module "tls" {
320
333
  prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
321
334
  prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
322
335
  prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
336
+ prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
323
337
 
324
338
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
325
339
  prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
@@ -327,6 +341,7 @@ declare module "tls" {
327
341
  prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
328
342
  prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
329
343
  prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
344
+ prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
330
345
  }
331
346
 
332
347
  interface SecurePair {
@@ -398,4 +413,6 @@ declare module "tls" {
398
413
  function getCiphers(): string[];
399
414
 
400
415
  const DEFAULT_ECDH_CURVE: string;
416
+
417
+ const rootCertificates: ReadonlyArray<string>;
401
418
  }
node/v8.d.ts CHANGED
@@ -22,6 +22,8 @@ declare module "v8" {
22
22
  malloced_memory: number;
23
23
  peak_malloced_memory: number;
24
24
  does_zap_garbage: DoesZapCodeSpaceFlag;
25
+ number_of_native_contexts: number;
26
+ number_of_detached_contexts: number;
25
27
  }
26
28
 
27
29
  function getHeapStatistics(): HeapInfo;
node/vm.d.ts CHANGED
@@ -49,13 +49,44 @@ declare module "vm" {
49
49
  */
50
50
  contextExtensions?: Object[];
51
51
  }
52
+
53
+ interface CreateContextOptions {
54
+ /**
55
+ * Human-readable name of the newly created context.
56
+ * @default 'VM Context i' Where i is an ascending numerical index of the created context.
57
+ */
58
+ name?: string;
59
+ /**
60
+ * Corresponds to the newly created context for display purposes.
61
+ * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary),
62
+ * like the value of the `url.origin` property of a URL object.
63
+ * Most notably, this string should omit the trailing slash, as that denotes a path.
64
+ * @default ''
65
+ */
66
+ origin?: string;
67
+ codeGeneration?: {
68
+ /**
69
+ * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
70
+ * will throw an EvalError.
71
+ * @default true
72
+ */
73
+ strings?: boolean;
74
+ /**
75
+ * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
76
+ * @default true
77
+ */
78
+ wasm?: boolean;
79
+ };
80
+ }
81
+
52
82
  class Script {
53
83
  constructor(code: string, options?: ScriptOptions);
54
84
  runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
55
85
  runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
56
86
  runInThisContext(options?: RunningScriptOptions): any;
87
+ createCachedData(): Buffer;
57
88
  }
58
- function createContext(sandbox?: Context): Context;
89
+ function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
59
90
  function isContext(sandbox: Context): boolean;
60
91
  function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
61
92
  function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
node/worker_threads.d.ts CHANGED
@@ -73,7 +73,11 @@ declare module "worker_threads" {
73
73
  postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
74
74
  ref(): void;
75
75
  unref(): void;
76
- terminate(callback?: (err: Error, exitCode: number) => void): void;
76
+ /**
77
+ * Stop all JavaScript execution in the worker thread as soon as possible.
78
+ * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted.
79
+ */
80
+ terminate(): Promise<number>;
77
81
  /**
78
82
  * Transfer a `MessagePort` to a different `vm` Context. The original `port`
79
83
  * object will be rendered unusable, and the returned `MessagePort` instance will
@@ -90,6 +94,14 @@ declare module "worker_threads" {
90
94
  */
91
95
  moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
92
96
 
97
+ /**
98
+ * Receive a single message from a given `MessagePort`. If no message is available,
99
+ * `undefined` is returned, otherwise an object with a single `message` property
100
+ * that contains the message payload, corresponding to the oldest message in the
101
+ * `MessagePort`’s queue.
102
+ */
103
+ receiveMessageOnPort(port: MessagePort): {} | undefined;
104
+
93
105
  addListener(event: "error", listener: (err: Error) => void): this;
94
106
  addListener(event: "exit", listener: (exitCode: number) => void): this;
95
107
  addListener(event: "message", listener: (value: any) => void): this;