@types/node 18.19.23 → 18.19.25

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 v18.19/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 11 Mar 2024 22:06:43 GMT
11
+ * Last updated: Mon, 18 Mar 2024 19:35:28 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node v18.19/crypto.d.ts CHANGED
@@ -103,7 +103,7 @@ declare module "crypto" {
103
103
  const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
104
104
  /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
105
105
  const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
106
- /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
106
+ /** Instructs OpenSSL to use Cisco's version identifier of DTLS_BAD_VER. */
107
107
  const SSL_OP_CISCO_ANYCONNECT: number;
108
108
  /** Instructs OpenSSL to turn on cookie exchange. */
109
109
  const SSL_OP_COOKIE_EXCHANGE: number;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The `dns.promises` API provides an alternative set of asynchronous DNS methods
3
3
  * that return `Promise` objects rather than using callbacks. The API is accessible
4
- * via `require('dns').promises` or `require('dns/promises')`.
4
+ * via `require('node:dns').promises` or `require('node:dns/promises')`.
5
5
  * @since v10.6.0
6
6
  */
7
7
  declare module "dns/promises" {
@@ -43,24 +43,24 @@ declare module "dns/promises" {
43
43
  * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
44
44
  * and IPv6 addresses are both returned if found.
45
45
  *
46
- * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`.
46
+ * With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`.
47
47
  *
48
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
48
+ * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is the error code.
49
49
  * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
50
50
  * the host name does not exist but also when the lookup fails in other ways
51
51
  * such as no available file descriptors.
52
52
  *
53
- * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
53
+ * [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS
54
54
  * protocol. The implementation uses an operating system facility that can
55
- * associate names with addresses, and vice versa. This implementation can have
55
+ * associate names with addresses and vice versa. This implementation can have
56
56
  * subtle but important consequences on the behavior of any Node.js program. Please
57
- * take some time to consult the `Implementation considerations section` before
57
+ * take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations) before
58
58
  * using `dnsPromises.lookup()`.
59
59
  *
60
60
  * Example usage:
61
61
  *
62
62
  * ```js
63
- * const dns = require('dns');
63
+ * const dns = require('node:dns');
64
64
  * const dnsPromises = dns.promises;
65
65
  * const options = {
66
66
  * family: 6,
@@ -91,12 +91,12 @@ declare module "dns/promises" {
91
91
  * the operating system's underlying `getnameinfo` implementation.
92
92
  *
93
93
  * If `address` is not a valid IP address, a `TypeError` will be thrown.
94
- * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
94
+ * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
95
95
  *
96
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
96
+ * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is the error code.
97
97
  *
98
98
  * ```js
99
- * const dnsPromises = require('dns').promises;
99
+ * const dnsPromises = require('node:dns').promises;
100
100
  * dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
101
101
  * console.log(result.hostname, result.service);
102
102
  * // Prints: localhost ssh
@@ -119,7 +119,8 @@ declare module "dns/promises" {
119
119
  *
120
120
  * <omitted>
121
121
  *
122
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
122
+ * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code`
123
+ * is one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes).
123
124
  * @since v10.6.0
124
125
  * @param hostname Host name to resolve.
125
126
  * @param [rrtype='A'] Resource record type.
@@ -142,7 +143,7 @@ declare module "dns/promises" {
142
143
  rrtype: string,
143
144
  ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
144
145
  /**
145
- * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
146
+ * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
146
147
  * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
147
148
  * @since v10.6.0
148
149
  * @param hostname Host name to resolve.
@@ -151,7 +152,7 @@ declare module "dns/promises" {
151
152
  function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
152
153
  function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
153
154
  /**
154
- * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6
155
+ * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6
155
156
  * addresses.
156
157
  * @since v10.6.0
157
158
  * @param hostname Host name to resolve.
@@ -191,7 +192,7 @@ declare module "dns/promises" {
191
192
  /**
192
193
  * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
193
194
  * the `Promise` is resolved with an array of objects containing available
194
- * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
195
+ * certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
195
196
  * @since v15.0.0, v14.17.0
196
197
  */
197
198
  function resolveCaa(hostname: string): Promise<CaaRecord[]>;
@@ -203,13 +204,13 @@ declare module "dns/promises" {
203
204
  */
204
205
  function resolveCname(hostname: string): Promise<string[]>;
205
206
  /**
206
- * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects
207
+ * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects
207
208
  * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
208
209
  * @since v10.6.0
209
210
  */
210
211
  function resolveMx(hostname: string): Promise<MxRecord[]>;
211
212
  /**
212
- * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
213
+ * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array
213
214
  * of objects with the following properties:
214
215
  *
215
216
  * * `flags`
@@ -233,13 +234,13 @@ declare module "dns/promises" {
233
234
  */
234
235
  function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
235
236
  /**
236
- * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server
237
+ * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server
237
238
  * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
238
239
  * @since v10.6.0
239
240
  */
240
241
  function resolveNs(hostname: string): Promise<string[]>;
241
242
  /**
242
- * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings
243
+ * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings
243
244
  * containing the reply records.
244
245
  * @since v10.6.0
245
246
  */
@@ -272,7 +273,7 @@ declare module "dns/promises" {
272
273
  */
273
274
  function resolveSoa(hostname: string): Promise<SoaRecord>;
274
275
  /**
275
- * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with
276
+ * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with
276
277
  * the following properties:
277
278
  *
278
279
  * * `priority`
@@ -292,7 +293,7 @@ declare module "dns/promises" {
292
293
  */
293
294
  function resolveSrv(hostname: string): Promise<SrvRecord[]>;
294
295
  /**
295
- * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array
296
+ * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
296
297
  * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
297
298
  * one record. Depending on the use case, these could be either joined together or
298
299
  * treated separately.
@@ -303,12 +304,14 @@ declare module "dns/promises" {
303
304
  * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
304
305
  * array of host names.
305
306
  *
306
- * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
307
+ * On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code`
308
+ * is one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes).
307
309
  * @since v10.6.0
308
310
  */
309
311
  function reverse(ip: string): Promise<string[]>;
310
312
  /**
311
- * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
313
+ * Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options).
314
+ * The value could be:
312
315
  *
313
316
  * * `ipv4first`: for `verbatim` defaulting to `false`.
314
317
  * * `verbatim`: for `verbatim` defaulting to `true`.
@@ -348,21 +351,95 @@ declare module "dns/promises" {
348
351
  * * `ipv4first`: sets default `verbatim` `false`.
349
352
  * * `verbatim`: sets default `verbatim` `true`.
350
353
  *
351
- * The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have
352
- * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
353
- * default dns orders in workers.
354
+ * The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetdefaultresultorderorder)
355
+ * have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder).
356
+ * When using [worker threads](https://nodejs.org/docs/latest-v18.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetdefaultresultorderorder)
357
+ * from the main thread won't affect the default dns orders in workers.
354
358
  * @since v16.4.0, v14.18.0
355
359
  * @param order must be `'ipv4first'` or `'verbatim'`.
356
360
  */
357
361
  function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
362
+ const NODATA: "NODATA";
363
+ const FORMERR: "FORMERR";
364
+ const SERVFAIL: "SERVFAIL";
365
+ const NOTFOUND: "NOTFOUND";
366
+ const NOTIMP: "NOTIMP";
367
+ const REFUSED: "REFUSED";
368
+ const BADQUERY: "BADQUERY";
369
+ const BADNAME: "BADNAME";
370
+ const BADFAMILY: "BADFAMILY";
371
+ const BADRESP: "BADRESP";
372
+ const CONNREFUSED: "TIMEOUT";
373
+ const TIMEOUT: "TIMEOUT";
374
+ const EOF: "EOF";
375
+ const FILE: "FILE";
376
+ const NOMEM: "NOMEM";
377
+ const DESTRUCTION: "DESTRUCTION";
378
+ const BADSTR: "BADSTR";
379
+ const BADFLAGS: "BADFLAGS";
380
+ const NONAME: "NONAME";
381
+ const BADHINTS: "BADHINTS";
382
+ const NOTINITIALIZED: "NOTINITIALIZED";
383
+ const LOADIPHLPAPI: "LOADIPHLPAPI";
384
+ const ADDRGETNETWORKPARAMS: "ADDRGETNETWORKPARAMS";
385
+ const CANCELLED: "CANCELLED";
386
+ /**
387
+ * An independent resolver for DNS requests.
388
+ *
389
+ * Creating a new resolver uses the default server settings. Setting
390
+ * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetserversservers) does not affect
391
+ * other resolvers:
392
+ *
393
+ * ```js
394
+ * const { Resolver } = require('node:dns').promises;
395
+ * const resolver = new Resolver();
396
+ * resolver.setServers(['4.4.4.4']);
397
+ *
398
+ * // This request will use the server at 4.4.4.4, independent of global settings.
399
+ * resolver.resolve4('example.org').then((addresses) => {
400
+ * // ...
401
+ * });
402
+ *
403
+ * // Alternatively, the same code can be written using async-await style.
404
+ * (async function() {
405
+ * const addresses = await resolver.resolve4('example.org');
406
+ * })();
407
+ * ```
408
+ *
409
+ * The following methods from the `dnsPromises` API are available:
410
+ *
411
+ * * `resolver.getServers()`
412
+ * * `resolver.resolve()`
413
+ * * `resolver.resolve4()`
414
+ * * `resolver.resolve6()`
415
+ * * `resolver.resolveAny()`
416
+ * * `resolver.resolveCaa()`
417
+ * * `resolver.resolveCname()`
418
+ * * `resolver.resolveMx()`
419
+ * * `resolver.resolveNaptr()`
420
+ * * `resolver.resolveNs()`
421
+ * * `resolver.resolvePtr()`
422
+ * * `resolver.resolveSoa()`
423
+ * * `resolver.resolveSrv()`
424
+ * * `resolver.resolveTxt()`
425
+ * * `resolver.reverse()`
426
+ * * `resolver.setServers()`
427
+ * @since v10.6.0
428
+ */
358
429
  class Resolver {
359
430
  constructor(options?: ResolverOptions);
431
+ /**
432
+ * Cancel all outstanding DNS queries made by this resolver. The corresponding
433
+ * callbacks will be called with an error with code `ECANCELLED`.
434
+ * @since v8.3.0
435
+ */
360
436
  cancel(): void;
361
437
  getServers: typeof getServers;
362
438
  resolve: typeof resolve;
363
439
  resolve4: typeof resolve4;
364
440
  resolve6: typeof resolve6;
365
441
  resolveAny: typeof resolveAny;
442
+ resolveCaa: typeof resolveCaa;
366
443
  resolveCname: typeof resolveCname;
367
444
  resolveMx: typeof resolveMx;
368
445
  resolveNaptr: typeof resolveNaptr;
@@ -372,6 +449,21 @@ declare module "dns/promises" {
372
449
  resolveSrv: typeof resolveSrv;
373
450
  resolveTxt: typeof resolveTxt;
374
451
  reverse: typeof reverse;
452
+ /**
453
+ * The resolver instance will send its requests from the specified IP address.
454
+ * This allows programs to specify outbound interfaces when used on multi-homed
455
+ * systems.
456
+ *
457
+ * If a v4 or v6 address is not specified, it is set to the default and the
458
+ * operating system will choose a local address automatically.
459
+ *
460
+ * The resolver will use the v4 local address when making requests to IPv4 DNS
461
+ * servers, and the v6 local address when making requests to IPv6 DNS servers.
462
+ * The `rrtype` of resolution requests has no impact on the local address used.
463
+ * @since v15.1.0, v14.17.0
464
+ * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
465
+ * @param [ipv6='::0'] A string representation of an IPv6 address.
466
+ */
375
467
  setLocalAddress(ipv4?: string, ipv6?: string): void;
376
468
  setServers: typeof setServers;
377
469
  }
node v18.19/dns.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The `dns` module enables name resolution. For example, use it to look up IP
2
+ * The `node:dns` module enables name resolution. For example, use it to look up IP
3
3
  * addresses of host names.
4
4
  *
5
5
  * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
@@ -9,7 +9,7 @@
9
9
  * system do, use {@link lookup}.
10
10
  *
11
11
  * ```js
12
- * const dns = require('dns');
12
+ * const dns = require('node:dns');
13
13
  *
14
14
  * dns.lookup('example.org', (err, address, family) => {
15
15
  * console.log('address: %j family: IPv%s', address, family);
@@ -17,13 +17,13 @@
17
17
  * // address: "93.184.216.34" family: IPv4
18
18
  * ```
19
19
  *
20
- * All other functions in the `dns` module connect to an actual DNS server to
20
+ * All other functions in the `node:dns` module connect to an actual DNS server to
21
21
  * perform name resolution. They will always use the network to perform DNS
22
22
  * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
23
23
  * DNS queries, bypassing other name-resolution facilities.
24
24
  *
25
25
  * ```js
26
- * const dns = require('dns');
26
+ * const dns = require('node:dns');
27
27
  *
28
28
  * dns.resolve4('archive.org', (err, addresses) => {
29
29
  * if (err) throw err;
@@ -41,13 +41,21 @@
41
41
  * });
42
42
  * ```
43
43
  *
44
- * See the `Implementation considerations section` for more information.
45
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
44
+ * See the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations) for more information.
45
+ * @see [source](https://github.com/nodejs/node/blob/v18.19.1/lib/dns.js)
46
46
  */
47
47
  declare module "dns" {
48
48
  import * as dnsPromises from "node:dns/promises";
49
49
  // Supported getaddrinfo flags.
50
+ /**
51
+ * Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
52
+ * only returned if the current system has at least one IPv4 address configured.
53
+ */
50
54
  export const ADDRCONFIG: number;
55
+ /**
56
+ * If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
57
+ * on some operating systems (e.g. FreeBSD 10.1).
58
+ */
51
59
  export const V4MAPPED: number;
52
60
  /**
53
61
  * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
@@ -55,11 +63,28 @@ declare module "dns" {
55
63
  */
56
64
  export const ALL: number;
57
65
  export interface LookupOptions {
58
- family?: number | undefined;
66
+ /**
67
+ * The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons,`'IPv4'` and `'IPv6'` are interpreted
68
+ * as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
69
+ * with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
70
+ * @default 0
71
+ */
72
+ family?: number | "IPv4" | "IPv6" | undefined;
73
+ /**
74
+ * One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v18.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
75
+ * passed by bitwise `OR`ing their values.
76
+ */
59
77
  hints?: number | undefined;
78
+ /**
79
+ * When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
80
+ * @default false
81
+ */
60
82
  all?: boolean | undefined;
61
83
  /**
62
- * @default true
84
+ * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
85
+ * addresses are placed before IPv6 addresses. Default value is configurable using {@link setDefaultResultOrder()}
86
+ * or [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder).
87
+ * @default true (addresses are not reordered)
63
88
  */
64
89
  verbatim?: boolean | undefined;
65
90
  }
@@ -70,16 +95,23 @@ declare module "dns" {
70
95
  all: true;
71
96
  }
72
97
  export interface LookupAddress {
98
+ /**
99
+ * A string representation of an IPv4 or IPv6 address.
100
+ */
73
101
  address: string;
102
+ /**
103
+ * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
104
+ * bug in the name resolution service used by the operating system.
105
+ */
74
106
  family: number;
75
107
  }
76
108
  /**
77
109
  * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
78
110
  * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
79
- * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
80
- * and IPv6 addresses are both returned if found.
111
+ * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
112
+ * IPv4 and IPv6 addresses are both returned if found.
81
113
  *
82
- * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
114
+ * With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the
83
115
  * properties `address` and `family`.
84
116
  *
85
117
  * On error, `err` is an `Error` object, where `err.code` is the error code.
@@ -89,14 +121,15 @@ declare module "dns" {
89
121
  *
90
122
  * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
91
123
  * The implementation uses an operating system facility that can associate names
92
- * with addresses, and vice versa. This implementation can have subtle but
124
+ * with addresses and vice versa. This implementation can have subtle but
93
125
  * important consequences on the behavior of any Node.js program. Please take some
94
- * time to consult the `Implementation considerations section` before using`dns.lookup()`.
126
+ * time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations)
127
+ * before using `dns.lookup()`.
95
128
  *
96
129
  * Example usage:
97
130
  *
98
131
  * ```js
99
- * const dns = require('dns');
132
+ * const dns = require('node:dns');
100
133
  * const options = {
101
134
  * family: 6,
102
135
  * hints: dns.ADDRCONFIG | dns.V4MAPPED,
@@ -112,7 +145,8 @@ declare module "dns" {
112
145
  * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
113
146
  * ```
114
147
  *
115
- * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
148
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v18.x/api/util.html#utilpromisifyoriginal) ed
149
+ * version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
116
150
  * @since v0.1.90
117
151
  */
118
152
  export function lookup(
@@ -149,19 +183,21 @@ declare module "dns" {
149
183
  * the operating system's underlying `getnameinfo` implementation.
150
184
  *
151
185
  * If `address` is not a valid IP address, a `TypeError` will be thrown.
152
- * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
186
+ * The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
153
187
  *
154
- * On an error, `err` is an `Error` object, where `err.code` is the error code.
188
+ * On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object,
189
+ * where `err.code` is the error code.
155
190
  *
156
191
  * ```js
157
- * const dns = require('dns');
192
+ * const dns = require('node:dns');
158
193
  * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
159
194
  * console.log(hostname, service);
160
195
  * // Prints: localhost ssh
161
196
  * });
162
197
  * ```
163
198
  *
164
- * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
199
+ * If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v18.x/api/util.html#utilpromisifyoriginal) ed
200
+ * version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
165
201
  * @since v0.11.14
166
202
  */
167
203
  export function lookupService(
@@ -272,12 +308,13 @@ declare module "dns" {
272
308
  | AnyTxtRecord;
273
309
  /**
274
310
  * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
275
- * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
311
+ * of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource
276
312
  * records. The type and structure of individual results varies based on `rrtype`:
277
313
  *
278
314
  * <omitted>
279
315
  *
280
- * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
316
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object,
317
+ * where `err.code` is one of the `DNS error codes`.
281
318
  * @since v0.1.27
282
319
  * @param hostname Host name to resolve.
283
320
  * @param [rrtype='A'] Resource record type.
@@ -363,7 +400,7 @@ declare module "dns" {
363
400
  ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
364
401
  }
365
402
  /**
366
- * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
403
+ * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
367
404
  * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
368
405
  * @since v0.1.16
369
406
  * @param hostname Host name to resolve.
@@ -388,7 +425,7 @@ declare module "dns" {
388
425
  function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
389
426
  }
390
427
  /**
391
- * Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
428
+ * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function
392
429
  * will contain an array of IPv6 addresses.
393
430
  * @since v0.1.16
394
431
  * @param hostname Host name to resolve.
@@ -413,8 +450,8 @@ declare module "dns" {
413
450
  function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
414
451
  }
415
452
  /**
416
- * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
417
- * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
453
+ * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
454
+ * will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
418
455
  * @since v0.3.2
419
456
  */
420
457
  export function resolveCname(
@@ -425,7 +462,7 @@ declare module "dns" {
425
462
  function __promisify__(hostname: string): Promise<string[]>;
426
463
  }
427
464
  /**
428
- * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
465
+ * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function
429
466
  * will contain an array of certification authority authorization records
430
467
  * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
431
468
  * @since v15.0.0, v14.17.0
@@ -438,8 +475,8 @@ declare module "dns" {
438
475
  function __promisify__(hostname: string): Promise<CaaRecord[]>;
439
476
  }
440
477
  /**
441
- * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
442
- * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
478
+ * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
479
+ * contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
443
480
  * @since v0.1.27
444
481
  */
445
482
  export function resolveMx(
@@ -450,7 +487,7 @@ declare module "dns" {
450
487
  function __promisify__(hostname: string): Promise<MxRecord[]>;
451
488
  }
452
489
  /**
453
- * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
490
+ * Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of
454
491
  * objects with the following properties:
455
492
  *
456
493
  * * `flags`
@@ -480,8 +517,8 @@ declare module "dns" {
480
517
  function __promisify__(hostname: string): Promise<NaptrRecord[]>;
481
518
  }
482
519
  /**
483
- * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
484
- * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
520
+ * Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
521
+ * contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
485
522
  * @since v0.1.90
486
523
  */
487
524
  export function resolveNs(
@@ -492,7 +529,7 @@ declare module "dns" {
492
529
  function __promisify__(hostname: string): Promise<string[]>;
493
530
  }
494
531
  /**
495
- * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
532
+ * Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
496
533
  * be an array of strings containing the reply records.
497
534
  * @since v6.0.0
498
535
  */
@@ -537,7 +574,7 @@ declare module "dns" {
537
574
  function __promisify__(hostname: string): Promise<SoaRecord>;
538
575
  }
539
576
  /**
540
- * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
577
+ * Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
541
578
  * be an array of objects with the following properties:
542
579
  *
543
580
  * * `priority`
@@ -563,7 +600,7 @@ declare module "dns" {
563
600
  function __promisify__(hostname: string): Promise<SrvRecord[]>;
564
601
  }
565
602
  /**
566
- * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
603
+ * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
567
604
  * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
568
605
  * one record. Depending on the use case, these could be either joined together or
569
606
  * treated separately.
@@ -603,8 +640,8 @@ declare module "dns" {
603
640
  * minttl: 60 } ]
604
641
  * ```
605
642
  *
606
- * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
607
- * 8482](https://tools.ietf.org/html/rfc8482).
643
+ * DNS server operators may choose not to respond to `ANY` queries. It may be better to call individual methods like {@link resolve4}, {@link resolveMx}, and so on. For more details, see
644
+ * [RFC 8482](https://tools.ietf.org/html/rfc8482).
608
645
  */
609
646
  export function resolveAny(
610
647
  hostname: string,
@@ -617,8 +654,8 @@ declare module "dns" {
617
654
  * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
618
655
  * array of host names.
619
656
  *
620
- * On error, `err` is an `Error` object, where `err.code` is
621
- * one of the `DNS error codes`.
657
+ * On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is
658
+ * one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes).
622
659
  * @since v0.1.16
623
660
  */
624
661
  export function reverse(
@@ -626,7 +663,8 @@ declare module "dns" {
626
663
  callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
627
664
  ): void;
628
665
  /**
629
- * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
666
+ * Get the default value for `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options).
667
+ * The value could be:
630
668
  *
631
669
  * * `ipv4first`: for `verbatim` defaulting to `false`.
632
670
  * * `verbatim`: for `verbatim` defaulting to `true`.
@@ -652,14 +690,14 @@ declare module "dns" {
652
690
  * The `dns.setServers()` method must not be called while a DNS query is in
653
691
  * progress.
654
692
  *
655
- * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
693
+ * The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
656
694
  *
657
695
  * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
658
- * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
696
+ * That is, if attempting to resolve with the first server provided results in a `NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
659
697
  * subsequent servers provided. Fallback DNS servers will only be used if the
660
698
  * earlier ones time out or result in some other error.
661
699
  * @since v0.11.3
662
- * @param servers array of `RFC 5952` formatted addresses
700
+ * @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
663
701
  */
664
702
  export function setServers(servers: readonly string[]): void;
665
703
  /**
@@ -679,46 +717,52 @@ declare module "dns" {
679
717
  */
680
718
  export function getServers(): string[];
681
719
  /**
682
- * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
720
+ * Set the default value of `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options).
721
+ * The value could be:
683
722
  *
684
723
  * * `ipv4first`: sets default `verbatim` `false`.
685
724
  * * `verbatim`: sets default `verbatim` `true`.
686
725
  *
687
- * The default is `ipv4first` and {@link setDefaultResultOrder} have higher
688
- * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
689
- * dns orders in workers.
726
+ * The default is `verbatim` and {@link setDefaultResultOrder} have higher
727
+ * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder). When using
728
+ * [worker threads](https://nodejs.org/docs/latest-v18.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
729
+ * thread won't affect the default dns orders in workers.
690
730
  * @since v16.4.0, v14.18.0
691
731
  * @param order must be `'ipv4first'` or `'verbatim'`.
692
732
  */
693
733
  export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
694
734
  // Error codes
695
- export const NODATA: string;
696
- export const FORMERR: string;
697
- export const SERVFAIL: string;
698
- export const NOTFOUND: string;
699
- export const NOTIMP: string;
700
- export const REFUSED: string;
701
- export const BADQUERY: string;
702
- export const BADNAME: string;
703
- export const BADFAMILY: string;
704
- export const BADRESP: string;
705
- export const CONNREFUSED: string;
706
- export const TIMEOUT: string;
707
- export const EOF: string;
708
- export const FILE: string;
709
- export const NOMEM: string;
710
- export const DESTRUCTION: string;
711
- export const BADSTR: string;
712
- export const BADFLAGS: string;
713
- export const NONAME: string;
714
- export const BADHINTS: string;
715
- export const NOTINITIALIZED: string;
716
- export const LOADIPHLPAPI: string;
717
- export const ADDRGETNETWORKPARAMS: string;
718
- export const CANCELLED: string;
735
+ export const NODATA: "NODATA";
736
+ export const FORMERR: "FORMERR";
737
+ export const SERVFAIL: "SERVFAIL";
738
+ export const NOTFOUND: "NOTFOUND";
739
+ export const NOTIMP: "NOTIMP";
740
+ export const REFUSED: "REFUSED";
741
+ export const BADQUERY: "BADQUERY";
742
+ export const BADNAME: "BADNAME";
743
+ export const BADFAMILY: "BADFAMILY";
744
+ export const BADRESP: "BADRESP";
745
+ export const CONNREFUSED: "TIMEOUT";
746
+ export const TIMEOUT: "TIMEOUT";
747
+ export const EOF: "EOF";
748
+ export const FILE: "FILE";
749
+ export const NOMEM: "NOMEM";
750
+ export const DESTRUCTION: "DESTRUCTION";
751
+ export const BADSTR: "BADSTR";
752
+ export const BADFLAGS: "BADFLAGS";
753
+ export const NONAME: "NONAME";
754
+ export const BADHINTS: "BADHINTS";
755
+ export const NOTINITIALIZED: "NOTINITIALIZED";
756
+ export const LOADIPHLPAPI: "LOADIPHLPAPI";
757
+ export const ADDRGETNETWORKPARAMS: "ADDRGETNETWORKPARAMS";
758
+ export const CANCELLED: "CANCELLED";
719
759
  export interface ResolverOptions {
760
+ /**
761
+ * Query timeout in milliseconds, or `-1` to use the default timeout.
762
+ */
720
763
  timeout?: number | undefined;
721
764
  /**
765
+ * The number of tries the resolver will try contacting each name server before giving up.
722
766
  * @default 4
723
767
  */
724
768
  tries?: number;
@@ -727,11 +771,11 @@ declare module "dns" {
727
771
  * An independent resolver for DNS requests.
728
772
  *
729
773
  * Creating a new resolver uses the default server settings. Setting
730
- * the servers used for a resolver using `resolver.setServers()` does not affect
774
+ * the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnssetserversservers) does not affect
731
775
  * other resolvers:
732
776
  *
733
777
  * ```js
734
- * const { Resolver } = require('dns');
778
+ * const { Resolver } = require('node:dns');
735
779
  * const resolver = new Resolver();
736
780
  * resolver.setServers(['4.4.4.4']);
737
781
  *
@@ -741,7 +785,7 @@ declare module "dns" {
741
785
  * });
742
786
  * ```
743
787
  *
744
- * The following methods from the `dns` module are available:
788
+ * The following methods from the `node:dns` module are available:
745
789
  *
746
790
  * * `resolver.getServers()`
747
791
  * * `resolver.resolve()`
@@ -789,7 +833,7 @@ declare module "dns" {
789
833
  * This allows programs to specify outbound interfaces when used on multi-homed
790
834
  * systems.
791
835
  *
792
- * If a v4 or v6 address is not specified, it is set to the default, and the
836
+ * If a v4 or v6 address is not specified, it is set to the default and the
793
837
  * operating system will choose a local address automatically.
794
838
  *
795
839
  * The resolver will use the v4 local address when making requests to IPv4 DNS
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.23",
3
+ "version": "18.19.25",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -217,6 +217,6 @@
217
217
  "dependencies": {
218
218
  "undici-types": "~5.26.4"
219
219
  },
220
- "typesPublisherContentHash": "ac6f5cdc191f1ebc39dafe9d86220e04ad0aadaf3cdf15213ae436fe324e0c84",
220
+ "typesPublisherContentHash": "d8e1b681bf4c7b28e70179727f6248e1a63660e126e5c4743f8f44b29df3f323",
221
221
  "typeScriptVersion": "4.7"
222
222
  }