@types/node 22.15.21 → 22.18.10

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 (76) hide show
  1. node v22.18/README.md +15 -0
  2. node/assert.d.ts → node v22.18/assert.d.ts +19 -0
  3. node/buffer.d.ts → node v22.18/buffer.d.ts +6 -2
  4. node/child_process.d.ts → node v22.18/child_process.d.ts +41 -131
  5. node/cluster.d.ts → node v22.18/cluster.d.ts +3 -4
  6. node/compatibility/disposable.d.ts → node v22.18/compatibility/disposable.d.ts +0 -2
  7. node/compatibility/indexable.d.ts → node v22.18/compatibility/indexable.d.ts +0 -3
  8. node/compatibility/iterators.d.ts → node v22.18/compatibility/iterators.d.ts +0 -1
  9. node/crypto.d.ts → node v22.18/crypto.d.ts +52 -36
  10. node/diagnostics_channel.d.ts → node v22.18/diagnostics_channel.d.ts +17 -12
  11. node/dns/promises.d.ts → node v22.18/dns/promises.d.ts +36 -9
  12. node/dns.d.ts → node v22.18/dns.d.ts +74 -21
  13. node/events.d.ts → node v22.18/events.d.ts +80 -35
  14. node/fs/promises.d.ts → node v22.18/fs/promises.d.ts +44 -39
  15. node/fs.d.ts → node v22.18/fs.d.ts +67 -56
  16. node v22.18/globals.d.ts +172 -0
  17. node/http.d.ts → node v22.18/http.d.ts +71 -10
  18. node/http2.d.ts → node v22.18/http2.d.ts +85 -5
  19. node/https.d.ts → node v22.18/https.d.ts +14 -12
  20. node/index.d.ts → node v22.18/index.d.ts +7 -3
  21. node/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
  22. node/module.d.ts → node v22.18/module.d.ts +136 -17
  23. node/net.d.ts → node v22.18/net.d.ts +5 -5
  24. node/os.d.ts → node v22.18/os.d.ts +13 -3
  25. node/package.json → node v22.18/package.json +3 -83
  26. node/perf_hooks.d.ts → node v22.18/perf_hooks.d.ts +8 -10
  27. node/process.d.ts → node v22.18/process.d.ts +10 -23
  28. node/readline/promises.d.ts → node v22.18/readline/promises.d.ts +1 -2
  29. node/repl.d.ts → node v22.18/repl.d.ts +3 -5
  30. node/sqlite.d.ts → node v22.18/sqlite.d.ts +207 -0
  31. node/stream/web.d.ts → node v22.18/stream/web.d.ts +8 -0
  32. node/stream.d.ts → node v22.18/stream.d.ts +34 -32
  33. node v22.18/test.d.ts +2162 -0
  34. node/tls.d.ts → node v22.18/tls.d.ts +2 -2
  35. node/ts5.6/index.d.ts → node v22.18/ts5.6/index.d.ts +7 -3
  36. node/url.d.ts → node v22.18/url.d.ts +12 -3
  37. node/util.d.ts → node v22.18/util.d.ts +20 -5
  38. node/v8.d.ts → node v22.18/v8.d.ts +62 -32
  39. node/vm.d.ts → node v22.18/vm.d.ts +62 -54
  40. node v22.18/web-globals/abortcontroller.d.ts +34 -0
  41. node v22.18/web-globals/domexception.d.ts +68 -0
  42. node v22.18/web-globals/events.d.ts +97 -0
  43. node v22.18/web-globals/fetch.d.ts +46 -0
  44. node v22.18/web-globals/navigator.d.ts +22 -0
  45. node v22.18/web-globals/storage.d.ts +24 -0
  46. node/worker_threads.d.ts → node v22.18/worker_threads.d.ts +105 -74
  47. node/zlib.d.ts → node v22.18/zlib.d.ts +8 -2
  48. node/README.md +0 -15
  49. node/dom-events.d.ts +0 -124
  50. node/globals.d.ts +0 -371
  51. node/test.d.ts +0 -2280
  52. {node → node v22.18}/LICENSE +0 -0
  53. {node → node v22.18}/assert/strict.d.ts +0 -0
  54. node/async_hooks.d.ts → node v22.18/async_hooks.d.ts +1 -1
  55. {node → node v22.18}/buffer.buffer.d.ts +0 -0
  56. {node → node v22.18}/compatibility/index.d.ts +0 -0
  57. {node → node v22.18}/console.d.ts +0 -0
  58. {node → node v22.18}/constants.d.ts +0 -0
  59. {node → node v22.18}/dgram.d.ts +0 -0
  60. {node → node v22.18}/domain.d.ts +0 -0
  61. {node → node v22.18}/globals.typedarray.d.ts +0 -0
  62. {node → node v22.18}/path.d.ts +0 -0
  63. {node → node v22.18}/punycode.d.ts +0 -0
  64. {node → node v22.18}/querystring.d.ts +0 -0
  65. {node → node v22.18}/readline.d.ts +0 -0
  66. {node → node v22.18}/sea.d.ts +0 -0
  67. {node → node v22.18}/stream/consumers.d.ts +0 -0
  68. {node → node v22.18}/stream/promises.d.ts +0 -0
  69. {node → node v22.18}/string_decoder.d.ts +0 -0
  70. {node → node v22.18}/timers/promises.d.ts +0 -0
  71. {node → node v22.18}/timers.d.ts +0 -0
  72. {node → node v22.18}/trace_events.d.ts +0 -0
  73. {node → node v22.18}/ts5.6/buffer.buffer.d.ts +0 -0
  74. {node → node v22.18}/ts5.6/globals.typedarray.d.ts +0 -0
  75. {node → node v22.18}/tty.d.ts +0 -0
  76. {node → node v22.18}/wasi.d.ts +0 -0
@@ -200,7 +200,7 @@ declare module "http" {
200
200
  "x-frame-options"?: string | undefined;
201
201
  "x-xss-protection"?: string | undefined;
202
202
  }
203
- interface ClientRequestArgs {
203
+ interface ClientRequestArgs extends Pick<LookupOptions, "hints"> {
204
204
  _defaultAgent?: Agent | undefined;
205
205
  agent?: Agent | boolean | undefined;
206
206
  auth?: string | null | undefined;
@@ -213,7 +213,6 @@ declare module "http" {
213
213
  defaultPort?: number | string | undefined;
214
214
  family?: number | undefined;
215
215
  headers?: OutgoingHttpHeaders | readonly string[] | undefined;
216
- hints?: LookupOptions["hints"];
217
216
  host?: string | null | undefined;
218
217
  hostname?: string | null | undefined;
219
218
  insecureHTTPParser?: boolean | undefined;
@@ -234,7 +233,7 @@ declare module "http" {
234
233
  socketPath?: string | undefined;
235
234
  timeout?: number | undefined;
236
235
  uniqueHeaders?: Array<string | string[]> | undefined;
237
- joinDuplicateHeaders?: boolean;
236
+ joinDuplicateHeaders?: boolean | undefined;
238
237
  }
239
238
  interface ServerOptions<
240
239
  Request extends typeof IncomingMessage = typeof IncomingMessage,
@@ -260,7 +259,7 @@ declare module "http" {
260
259
  * @default false
261
260
  * @since v18.14.0
262
261
  */
263
- joinDuplicateHeaders?: boolean;
262
+ joinDuplicateHeaders?: boolean | undefined;
264
263
  /**
265
264
  * The number of milliseconds of inactivity a server needs to wait for additional incoming data,
266
265
  * after it has finished writing the last response, before a socket will be destroyed.
@@ -911,7 +910,7 @@ declare module "http" {
911
910
  * the request body should be sent.
912
911
  * @since v10.0.0
913
912
  */
914
- writeProcessing(): void;
913
+ writeProcessing(callback?: () => void): void;
915
914
  }
916
915
  interface InformationEvent {
917
916
  statusCode: number;
@@ -1419,7 +1418,7 @@ declare module "http" {
1419
1418
  */
1420
1419
  destroy(error?: Error): this;
1421
1420
  }
1422
- interface AgentOptions extends Partial<TcpSocketConnectOpts> {
1421
+ interface AgentOptions extends NodeJS.PartialOptions<TcpSocketConnectOpts> {
1423
1422
  /**
1424
1423
  * Keep sockets around in a pool to be used by other requests in the future. Default = false
1425
1424
  */
@@ -1570,6 +1569,68 @@ declare module "http" {
1570
1569
  * @since v0.11.4
1571
1570
  */
1572
1571
  destroy(): void;
1572
+ /**
1573
+ * Produces a socket/stream to be used for HTTP requests.
1574
+ *
1575
+ * By default, this function is the same as `net.createConnection()`. However,
1576
+ * custom agents may override this method in case greater flexibility is desired.
1577
+ *
1578
+ * A socket/stream can be supplied in one of two ways: by returning the
1579
+ * socket/stream from this function, or by passing the socket/stream to `callback`.
1580
+ *
1581
+ * This method is guaranteed to return an instance of the `net.Socket` class,
1582
+ * a subclass of `stream.Duplex`, unless the user specifies a socket
1583
+ * type other than `net.Socket`.
1584
+ *
1585
+ * `callback` has a signature of `(err, stream)`.
1586
+ * @since v0.11.4
1587
+ * @param options Options containing connection details. Check `createConnection` for the format of the options
1588
+ * @param callback Callback function that receives the created socket
1589
+ */
1590
+ createConnection(
1591
+ options: ClientRequestArgs,
1592
+ callback?: (err: Error | null, stream: stream.Duplex) => void,
1593
+ ): stream.Duplex | null | undefined;
1594
+ /**
1595
+ * Called when `socket` is detached from a request and could be persisted by the`Agent`. Default behavior is to:
1596
+ *
1597
+ * ```js
1598
+ * socket.setKeepAlive(true, this.keepAliveMsecs);
1599
+ * socket.unref();
1600
+ * return true;
1601
+ * ```
1602
+ *
1603
+ * This method can be overridden by a particular `Agent` subclass. If this
1604
+ * method returns a falsy value, the socket will be destroyed instead of persisting
1605
+ * it for use with the next request.
1606
+ *
1607
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1608
+ * @since v8.1.0
1609
+ */
1610
+ keepSocketAlive(socket: stream.Duplex): void;
1611
+ /**
1612
+ * Called when `socket` is attached to `request` after being persisted because of
1613
+ * the keep-alive options. Default behavior is to:
1614
+ *
1615
+ * ```js
1616
+ * socket.ref();
1617
+ * ```
1618
+ *
1619
+ * This method can be overridden by a particular `Agent` subclass.
1620
+ *
1621
+ * The `socket` argument can be an instance of `net.Socket`, a subclass of `stream.Duplex`.
1622
+ * @since v8.1.0
1623
+ */
1624
+ reuseSocket(socket: stream.Duplex, request: ClientRequest): void;
1625
+ /**
1626
+ * Get a unique name for a set of request options, to determine whether a
1627
+ * connection can be reused. For an HTTP agent, this returns`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent,
1628
+ * the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options
1629
+ * that determine socket reusability.
1630
+ * @since v0.11.4
1631
+ * @param options A set of options providing information for name generation
1632
+ */
1633
+ getName(options?: ClientRequestArgs): string;
1573
1634
  }
1574
1635
  const METHODS: string[];
1575
1636
  const STATUS_CODES: {
@@ -1966,18 +2027,18 @@ declare module "http" {
1966
2027
  */
1967
2028
  const maxHeaderSize: number;
1968
2029
  /**
1969
- * A browser-compatible implementation of [WebSocket](https://nodejs.org/docs/latest/api/http.html#websocket).
2030
+ * A browser-compatible implementation of `WebSocket`.
1970
2031
  * @since v22.5.0
1971
2032
  */
1972
- const WebSocket: import("undici-types").WebSocket;
2033
+ const WebSocket: typeof import("undici-types").WebSocket;
1973
2034
  /**
1974
2035
  * @since v22.5.0
1975
2036
  */
1976
- const CloseEvent: import("undici-types").CloseEvent;
2037
+ const CloseEvent: typeof import("undici-types").CloseEvent;
1977
2038
  /**
1978
2039
  * @since v22.5.0
1979
2040
  */
1980
- const MessageEvent: import("undici-types").MessageEvent;
2041
+ const MessageEvent: typeof import("undici-types").MessageEvent;
1981
2042
  }
1982
2043
  declare module "node:http" {
1983
2044
  export * from "http";
@@ -55,14 +55,15 @@ declare module "http2" {
55
55
  length: number;
56
56
  }
57
57
  export interface ServerStreamFileResponseOptions {
58
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
59
- statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
58
+ statCheck?:
59
+ | ((stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void)
60
+ | undefined;
60
61
  waitForTrailers?: boolean | undefined;
61
62
  offset?: number | undefined;
62
63
  length?: number | undefined;
63
64
  }
64
65
  export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
65
- onError?(err: NodeJS.ErrnoException): void;
66
+ onError?: ((err: NodeJS.ErrnoException) => void) | undefined;
66
67
  }
67
68
  export interface Http2Stream extends stream.Duplex {
68
69
  /**
@@ -965,7 +966,10 @@ declare module "http2" {
965
966
  * * `:path` \= `/`
966
967
  * @since v8.4.0
967
968
  */
968
- request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
969
+ request(
970
+ headers?: OutgoingHttpHeaders | readonly string[],
971
+ options?: ClientSessionRequestOptions,
972
+ ): ClientHttp2Stream;
969
973
  addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
970
974
  addListener(event: "origin", listener: (origins: string[]) => void): this;
971
975
  addListener(
@@ -1223,14 +1227,66 @@ declare module "http2" {
1223
1227
  }
1224
1228
  // Http2Server
1225
1229
  export interface SessionOptions {
1230
+ /**
1231
+ * Sets the maximum dynamic table size for deflating header fields.
1232
+ * @default 4Kib
1233
+ */
1226
1234
  maxDeflateDynamicTableSize?: number | undefined;
1235
+ /**
1236
+ * Sets the maximum number of settings entries per `SETTINGS` frame.
1237
+ * The minimum value allowed is `1`.
1238
+ * @default 32
1239
+ */
1240
+ maxSettings?: number | undefined;
1241
+ /**
1242
+ * Sets the maximum memory that the `Http2Session` is permitted to use.
1243
+ * The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte.
1244
+ * The minimum value allowed is `1`.
1245
+ * This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded,
1246
+ * but new `Http2Stream` instances will be rejected while this limit is exceeded.
1247
+ * The current number of `Http2Stream` sessions, the current memory use of the header compression tables,
1248
+ * current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit.
1249
+ * @default 10
1250
+ */
1227
1251
  maxSessionMemory?: number | undefined;
1252
+ /**
1253
+ * Sets the maximum number of header entries.
1254
+ * This is similar to `server.maxHeadersCount` or `request.maxHeadersCount` in the `node:http` module.
1255
+ * The minimum value is `1`.
1256
+ * @default 128
1257
+ */
1228
1258
  maxHeaderListPairs?: number | undefined;
1259
+ /**
1260
+ * Sets the maximum number of outstanding, unacknowledged pings.
1261
+ * @default 10
1262
+ */
1229
1263
  maxOutstandingPings?: number | undefined;
1264
+ /**
1265
+ * Sets the maximum allowed size for a serialized, compressed block of headers.
1266
+ * Attempts to send headers that exceed this limit will result in
1267
+ * a `'frameError'` event being emitted and the stream being closed and destroyed.
1268
+ */
1230
1269
  maxSendHeaderBlockLength?: number | undefined;
1270
+ /**
1271
+ * Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames.
1272
+ * @default http2.constants.PADDING_STRATEGY_NONE
1273
+ */
1231
1274
  paddingStrategy?: number | undefined;
1275
+ /**
1276
+ * Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received.
1277
+ * Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`.
1278
+ * @default 100
1279
+ */
1232
1280
  peerMaxConcurrentStreams?: number | undefined;
1281
+ /**
1282
+ * The initial settings to send to the remote peer upon connection.
1283
+ */
1233
1284
  settings?: Settings | undefined;
1285
+ /**
1286
+ * The array of integer values determines the settings types,
1287
+ * which are included in the `CustomSettings`-property of the received remoteSettings.
1288
+ * Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types.
1289
+ */
1234
1290
  remoteCustomSettings?: number[] | undefined;
1235
1291
  /**
1236
1292
  * Specifies a timeout in milliseconds that
@@ -1239,11 +1295,35 @@ declare module "http2" {
1239
1295
  * @default 100000
1240
1296
  */
1241
1297
  unknownProtocolTimeout?: number | undefined;
1242
- selectPadding?(frameLen: number, maxFrameLen: number): number;
1298
+ /**
1299
+ * If `true`, it turns on strict leading
1300
+ * and trailing whitespace validation for HTTP/2 header field names and values
1301
+ * as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1).
1302
+ * @since v24.2.0
1303
+ * @default true
1304
+ */
1305
+ strictFieldWhitespaceValidation?: boolean | undefined;
1243
1306
  }
1244
1307
  export interface ClientSessionOptions extends SessionOptions {
1308
+ /**
1309
+ * Sets the maximum number of reserved push streams the client will accept at any given time.
1310
+ * Once the current number of currently reserved push streams exceeds reaches this limit,
1311
+ * new push streams sent by the server will be automatically rejected.
1312
+ * The minimum allowed value is 0. The maximum allowed value is 2<sup>32</sup>-1.
1313
+ * A negative value sets this option to the maximum allowed value.
1314
+ * @default 200
1315
+ */
1245
1316
  maxReservedRemoteStreams?: number | undefined;
1317
+ /**
1318
+ * An optional callback that receives the `URL` instance passed to `connect` and the `options` object,
1319
+ * and returns any `Duplex` stream that is to be used as the connection for this session.
1320
+ */
1246
1321
  createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined;
1322
+ /**
1323
+ * The protocol to connect with, if not set in the `authority`.
1324
+ * Value may be either `'http:'` or `'https:'`.
1325
+ * @default 'https:'
1326
+ */
1247
1327
  protocol?: "http:" | "https:" | undefined;
1248
1328
  }
1249
1329
  export interface ServerSessionOptions<
@@ -8,20 +8,17 @@ declare module "https" {
8
8
  import * as tls from "node:tls";
9
9
  import * as http from "node:http";
10
10
  import { URL } from "node:url";
11
- type ServerOptions<
11
+ interface ServerOptions<
12
12
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
13
  Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
14
- > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
- type RequestOptions =
16
- & http.RequestOptions
17
- & tls.SecureContextOptions
18
- & {
19
- checkServerIdentity?:
20
- | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
21
- | undefined;
22
- rejectUnauthorized?: boolean | undefined; // Defaults to true
23
- servername?: string | undefined; // SNI TLS Extension
24
- };
14
+ > extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
15
+ interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
16
+ checkServerIdentity?:
17
+ | ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
18
+ | undefined;
19
+ rejectUnauthorized?: boolean | undefined; // Defaults to true
20
+ servername?: string | undefined; // SNI TLS Extension
21
+ }
25
22
  interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
26
23
  maxCachedSessions?: number | undefined;
27
24
  }
@@ -32,6 +29,11 @@ declare module "https" {
32
29
  class Agent extends http.Agent {
33
30
  constructor(options?: AgentOptions);
34
31
  options: AgentOptions;
32
+ createConnection(
33
+ options: RequestOptions,
34
+ callback?: (err: Error | null, stream: Duplex) => void,
35
+ ): Duplex | null | undefined;
36
+ getName(options?: RequestOptions): string;
35
37
  }
36
38
  interface Server<
37
39
  Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
@@ -36,6 +36,12 @@
36
36
 
37
37
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
38
38
  /// <reference path="globals.d.ts" />
39
+ /// <reference path="web-globals/abortcontroller.d.ts" />
40
+ /// <reference path="web-globals/domexception.d.ts" />
41
+ /// <reference path="web-globals/events.d.ts" />
42
+ /// <reference path="web-globals/fetch.d.ts" />
43
+ /// <reference path="web-globals/navigator.d.ts" />
44
+ /// <reference path="web-globals/storage.d.ts" />
39
45
  /// <reference path="assert.d.ts" />
40
46
  /// <reference path="assert/strict.d.ts" />
41
47
  /// <reference path="async_hooks.d.ts" />
@@ -49,16 +55,14 @@
49
55
  /// <reference path="diagnostics_channel.d.ts" />
50
56
  /// <reference path="dns.d.ts" />
51
57
  /// <reference path="dns/promises.d.ts" />
52
- /// <reference path="dns/promises.d.ts" />
53
58
  /// <reference path="domain.d.ts" />
54
- /// <reference path="dom-events.d.ts" />
55
59
  /// <reference path="events.d.ts" />
56
60
  /// <reference path="fs.d.ts" />
57
61
  /// <reference path="fs/promises.d.ts" />
58
62
  /// <reference path="http.d.ts" />
59
63
  /// <reference path="http2.d.ts" />
60
64
  /// <reference path="https.d.ts" />
61
- /// <reference path="inspector.d.ts" />
65
+ /// <reference path="inspector.generated.d.ts" />
62
66
  /// <reference path="module.d.ts" />
63
67
  /// <reference path="net.d.ts" />
64
68
  /// <reference path="os.d.ts" />