@node-red/editor-client 3.0.2 → 3.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/de/infotips.json +0 -0
  3. package/locales/de/jsonata.json +0 -0
  4. package/locales/en-US/editor.json +37 -6
  5. package/locales/en-US/infotips.json +0 -0
  6. package/locales/en-US/jsonata.json +0 -0
  7. package/locales/fr/editor.json +1238 -0
  8. package/locales/fr/infotips.json +23 -0
  9. package/locales/fr/jsonata.json +274 -0
  10. package/locales/ja/editor.json +48 -9
  11. package/locales/ko/editor.json +233 -31
  12. package/locales/ko/infotips.json +0 -0
  13. package/locales/ko/jsonata.json +0 -0
  14. package/locales/pt-BR/editor.json +1208 -0
  15. package/locales/pt-BR/infotips.json +23 -0
  16. package/locales/pt-BR/jsonata.json +274 -0
  17. package/locales/ru/editor.json +2 -0
  18. package/locales/ru/infotips.json +0 -0
  19. package/locales/ru/jsonata.json +0 -0
  20. package/locales/zh-CN/editor.json +1175 -1049
  21. package/locales/zh-TW/editor.json +3 -0
  22. package/package.json +1 -1
  23. package/public/red/about +140 -0
  24. package/public/red/red.js +2699 -1397
  25. package/public/red/red.min.js +4 -3
  26. package/public/red/style.min.css +1 -1
  27. package/public/red/tours/3.0/images/context-menu.png +0 -0
  28. package/public/red/tours/3.0/welcome.js +155 -0
  29. package/public/red/tours/images/context-menu.png +0 -0
  30. package/public/red/tours/images/global-env-vars.png +0 -0
  31. package/public/red/tours/images/hiding-flows.png +0 -0
  32. package/public/red/tours/images/locking-flows.png +0 -0
  33. package/public/red/tours/images/mermaid.png +0 -0
  34. package/public/red/tours/images/node-help.png +0 -0
  35. package/public/red/tours/images/tab-changes.png +0 -0
  36. package/public/red/tours/welcome.js +111 -94
  37. package/public/types/node/assert/strict.d.ts +11 -0
  38. package/public/types/node/assert.d.ts +898 -64
  39. package/public/types/node/async_hooks.d.ts +362 -94
  40. package/public/types/node/buffer.d.ts +2158 -14
  41. package/public/types/node/child_process.d.ts +1109 -257
  42. package/public/types/node/cluster.d.ts +349 -200
  43. package/public/types/node/console.d.ts +313 -43
  44. package/public/types/node/crypto.d.ts +3329 -656
  45. package/public/types/node/dgram.d.ts +459 -58
  46. package/public/types/node/diagnostics_channel.d.ts +155 -0
  47. package/public/types/node/dns/promises.d.ts +371 -0
  48. package/public/types/node/dns.d.ts +532 -265
  49. package/public/types/node/domain.d.ts +159 -16
  50. package/public/types/node/events.d.ts +589 -30
  51. package/public/types/node/fs/promises.d.ts +1097 -0
  52. package/public/types/node/fs.d.ts +2484 -958
  53. package/public/types/node/globals.d.ts +43 -503
  54. package/public/types/node/http.d.ts +1156 -145
  55. package/public/types/node/http2.d.ts +1610 -470
  56. package/public/types/node/https.d.ts +462 -72
  57. package/public/types/node/module.d.ts +72 -13
  58. package/public/types/node/net.d.ts +663 -131
  59. package/public/types/node/os.d.ts +238 -25
  60. package/public/types/node/path.d.ts +57 -23
  61. package/public/types/node/perf_hooks.d.ts +424 -112
  62. package/public/types/node/process.d.ts +1261 -193
  63. package/public/types/node/querystring.d.ts +107 -7
  64. package/public/types/node/readline.d.ts +443 -74
  65. package/public/types/node/stream/consumers.d.ts +15 -0
  66. package/public/types/node/stream/promises.d.ts +45 -0
  67. package/public/types/node/stream/web.d.ts +395 -0
  68. package/public/types/node/stream.d.ts +1081 -177
  69. package/public/types/node/string_decoder.d.ts +57 -0
  70. package/public/types/node/test.d.ts +193 -0
  71. package/public/types/node/timers/promises.d.ts +96 -0
  72. package/public/types/node/timers.d.ts +87 -12
  73. package/public/types/node/tls.d.ts +457 -222
  74. package/public/types/node/trace_events.d.ts +107 -10
  75. package/public/types/node/tty.d.ts +158 -23
  76. package/public/types/node/url.d.ts +734 -28
  77. package/public/types/node/util.d.ts +1542 -164
  78. package/public/types/node/v8.d.ts +261 -73
  79. package/public/types/node/vm.d.ts +384 -32
  80. package/public/types/node/wasi.d.ts +92 -23
  81. package/public/types/node/worker_threads.d.ts +531 -123
  82. package/public/types/node/zlib.d.ts +216 -63
  83. package/public/types/node-red/func.d.ts +3 -0
  84. package/public/vendor/jquery/css/base/images/ui-icons_444444_256x240.png +0 -0
  85. package/public/vendor/jquery/css/base/images/ui-icons_555555_256x240.png +0 -0
  86. package/public/vendor/jquery/css/base/images/ui-icons_777620_256x240.png +0 -0
  87. package/public/vendor/jquery/css/base/images/ui-icons_777777_256x240.png +0 -0
  88. package/public/vendor/jquery/css/base/images/ui-icons_cc0000_256x240.png +0 -0
  89. package/public/vendor/jquery/css/base/images/ui-icons_ffffff_256x240.png +0 -0
  90. package/public/vendor/jquery/css/base/jquery-ui.min.css +4 -4
  91. package/public/vendor/mermaid/mermaid.min.js +1284 -0
  92. package/public/vendor/monaco/dist/{ade705761eb7e702770d.ttf → 7064e66c3890a12c47b4.ttf} +0 -0
  93. package/public/vendor/monaco/dist/css.worker.js +1 -1
  94. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  95. package/public/vendor/monaco/dist/editor.js +1 -1
  96. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +5 -1
  97. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  98. package/public/vendor/monaco/dist/html.worker.js +1 -1
  99. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  100. package/public/vendor/monaco/dist/json.worker.js +1 -1
  101. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  102. package/public/vendor/monaco/dist/locale/cs.js +319 -71
  103. package/public/vendor/monaco/dist/locale/de.js +323 -75
  104. package/public/vendor/monaco/dist/locale/es.js +318 -70
  105. package/public/vendor/monaco/dist/locale/fr.js +327 -79
  106. package/public/vendor/monaco/dist/locale/it.js +325 -77
  107. package/public/vendor/monaco/dist/locale/ja.js +337 -89
  108. package/public/vendor/monaco/dist/locale/ko.js +324 -76
  109. package/public/vendor/monaco/dist/locale/pl.js +322 -74
  110. package/public/vendor/monaco/dist/locale/pt-br.js +321 -73
  111. package/public/vendor/monaco/dist/locale/qps-ploc.js +1580 -1332
  112. package/public/vendor/monaco/dist/locale/ru.js +324 -76
  113. package/public/vendor/monaco/dist/locale/tr.js +326 -78
  114. package/public/vendor/monaco/dist/locale/zh-hans.js +328 -80
  115. package/public/vendor/monaco/dist/locale/zh-hant.js +321 -73
  116. package/public/vendor/monaco/dist/theme/forge.json +236 -0
  117. package/public/vendor/monaco/dist/theme/github-dark.json +348 -0
  118. package/public/vendor/monaco/dist/theme/github-light.json +348 -0
  119. package/public/vendor/monaco/dist/theme/nord.json +93 -0
  120. package/public/vendor/monaco/dist/ts.worker.js +1 -1
  121. package/public/vendor/monaco/dist/ts.worker.js.LICENSE.txt +14 -6
  122. package/public/vendor/vendor.js +9 -15
  123. /package/public/red/tours/{images → 3.0/images}/continuous-search.png +0 -0
  124. /package/public/red/tours/{images → 3.0/images}/debug-path-tooltip.png +0 -0
  125. /package/public/red/tours/{images → 3.0/images}/junction-quick-add.png +0 -0
  126. /package/public/red/tours/{images → 3.0/images}/junction-slice.gif +0 -0
  127. /package/public/red/tours/{images → 3.0/images}/split-wire-with-links.gif +0 -0
@@ -1,89 +1,194 @@
1
1
 
2
2
  /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
3
3
 
4
+ /**
5
+ * The `dns` module enables name resolution. For example, use it to look up IP
6
+ * addresses of host names.
7
+ *
8
+ * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
9
+ * DNS protocol for lookups. {@link lookup} uses the operating system
10
+ * facilities to perform name resolution. It may not need to perform any network
11
+ * communication. To perform name resolution the way other applications on the same
12
+ * system do, use {@link lookup}.
13
+ *
14
+ * ```js
15
+ * const dns = require('dns');
16
+ *
17
+ * dns.lookup('example.org', (err, address, family) => {
18
+ * console.log('address: %j family: IPv%s', address, family);
19
+ * });
20
+ * // address: "93.184.216.34" family: IPv4
21
+ * ```
22
+ *
23
+ * All other functions in the `dns` module connect to an actual DNS server to
24
+ * perform name resolution. They will always use the network to perform DNS
25
+ * 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
26
+ * DNS queries, bypassing other name-resolution facilities.
27
+ *
28
+ * ```js
29
+ * const dns = require('dns');
30
+ *
31
+ * dns.resolve4('archive.org', (err, addresses) => {
32
+ * if (err) throw err;
33
+ *
34
+ * console.log(`addresses: ${JSON.stringify(addresses)}`);
35
+ *
36
+ * addresses.forEach((a) => {
37
+ * dns.reverse(a, (err, hostnames) => {
38
+ * if (err) {
39
+ * throw err;
40
+ * }
41
+ * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
42
+ * });
43
+ * });
44
+ * });
45
+ * ```
46
+ *
47
+ * See the `Implementation considerations section` for more information.
48
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dns.js)
49
+ */
4
50
  declare module 'dns' {
51
+ import * as dnsPromises from 'node:dns/promises';
5
52
  // Supported getaddrinfo flags.
6
- const ADDRCONFIG: number;
7
- const V4MAPPED: number;
53
+ export const ADDRCONFIG: number;
54
+ export const V4MAPPED: number;
8
55
  /**
9
56
  * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
10
57
  * well as IPv4 mapped IPv6 addresses.
11
58
  */
12
- const ALL: number;
13
-
14
- interface LookupOptions {
59
+ export const ALL: number;
60
+ export interface LookupOptions {
15
61
  family?: number | undefined;
16
62
  hints?: number | undefined;
17
63
  all?: boolean | undefined;
18
64
  verbatim?: boolean | undefined;
19
65
  }
20
-
21
- interface LookupOneOptions extends LookupOptions {
66
+ export interface LookupOneOptions extends LookupOptions {
22
67
  all?: false | undefined;
23
68
  }
24
-
25
- interface LookupAllOptions extends LookupOptions {
69
+ export interface LookupAllOptions extends LookupOptions {
26
70
  all: true;
27
71
  }
28
-
29
- interface LookupAddress {
72
+ export interface LookupAddress {
30
73
  address: string;
31
74
  family: number;
32
75
  }
33
-
34
- function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
35
- function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
36
- function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
37
- function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
38
- function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
39
-
40
- // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
41
- namespace lookup {
76
+ /**
77
+ * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
78
+ * 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.
81
+ *
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
83
+ * properties `address` and `family`.
84
+ *
85
+ * On error, `err` is an `Error` object, where `err.code` is the error code.
86
+ * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
87
+ * the host name does not exist but also when the lookup fails in other ways
88
+ * such as no available file descriptors.
89
+ *
90
+ * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
91
+ * The implementation uses an operating system facility that can associate names
92
+ * with addresses, and vice versa. This implementation can have subtle but
93
+ * 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()`.
95
+ *
96
+ * Example usage:
97
+ *
98
+ * ```js
99
+ * const dns = require('dns');
100
+ * const options = {
101
+ * family: 6,
102
+ * hints: dns.ADDRCONFIG | dns.V4MAPPED,
103
+ * };
104
+ * dns.lookup('example.com', options, (err, address, family) =>
105
+ * console.log('address: %j family: IPv%s', address, family));
106
+ * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
107
+ *
108
+ * // When options.all is true, the result will be an Array.
109
+ * options.all = true;
110
+ * dns.lookup('example.com', options, (err, addresses) =>
111
+ * console.log('addresses: %j', addresses));
112
+ * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
113
+ * ```
114
+ *
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.
116
+ * @since v0.1.90
117
+ */
118
+ export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
119
+ export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
120
+ export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
121
+ export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
122
+ export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
123
+ export namespace lookup {
42
124
  function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
43
125
  function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
44
126
  function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
45
127
  }
46
-
47
- function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
48
-
49
- namespace lookupService {
50
- function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
51
- }
52
-
53
- interface ResolveOptions {
128
+ /**
129
+ * Resolves the given `address` and `port` into a host name and service using
130
+ * the operating system's underlying `getnameinfo` implementation.
131
+ *
132
+ * If `address` is not a valid IP address, a `TypeError` will be thrown.
133
+ * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
134
+ *
135
+ * On an error, `err` is an `Error` object, where `err.code` is the error code.
136
+ *
137
+ * ```js
138
+ * const dns = require('dns');
139
+ * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
140
+ * console.log(hostname, service);
141
+ * // Prints: localhost ssh
142
+ * });
143
+ * ```
144
+ *
145
+ * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
146
+ * @since v0.11.14
147
+ */
148
+ export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
149
+ export namespace lookupService {
150
+ function __promisify__(
151
+ address: string,
152
+ port: number
153
+ ): Promise<{
154
+ hostname: string;
155
+ service: string;
156
+ }>;
157
+ }
158
+ export interface ResolveOptions {
54
159
  ttl: boolean;
55
160
  }
56
-
57
- interface ResolveWithTtlOptions extends ResolveOptions {
161
+ export interface ResolveWithTtlOptions extends ResolveOptions {
58
162
  ttl: true;
59
163
  }
60
-
61
- interface RecordWithTtl {
164
+ export interface RecordWithTtl {
62
165
  address: string;
63
166
  ttl: number;
64
167
  }
65
-
66
168
  /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
67
- type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
68
-
69
- interface AnyARecord extends RecordWithTtl {
70
- type: "A";
71
- }
72
-
73
- interface AnyAaaaRecord extends RecordWithTtl {
74
- type: "AAAA";
75
- }
76
-
77
- interface MxRecord {
169
+ export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
170
+ export interface AnyARecord extends RecordWithTtl {
171
+ type: 'A';
172
+ }
173
+ export interface AnyAaaaRecord extends RecordWithTtl {
174
+ type: 'AAAA';
175
+ }
176
+ export interface CaaRecord {
177
+ critial: number;
178
+ issue?: string | undefined;
179
+ issuewild?: string | undefined;
180
+ iodef?: string | undefined;
181
+ contactemail?: string | undefined;
182
+ contactphone?: string | undefined;
183
+ }
184
+ export interface MxRecord {
78
185
  priority: number;
79
186
  exchange: string;
80
187
  }
81
-
82
- interface AnyMxRecord extends MxRecord {
83
- type: "MX";
188
+ export interface AnyMxRecord extends MxRecord {
189
+ type: 'MX';
84
190
  }
85
-
86
- interface NaptrRecord {
191
+ export interface NaptrRecord {
87
192
  flags: string;
88
193
  service: string;
89
194
  regexp: string;
@@ -91,12 +196,10 @@ declare module 'dns' {
91
196
  order: number;
92
197
  preference: number;
93
198
  }
94
-
95
- interface AnyNaptrRecord extends NaptrRecord {
96
- type: "NAPTR";
199
+ export interface AnyNaptrRecord extends NaptrRecord {
200
+ type: 'NAPTR';
97
201
  }
98
-
99
- interface SoaRecord {
202
+ export interface SoaRecord {
100
203
  nsname: string;
101
204
  hostmaster: string;
102
205
  serial: number;
@@ -105,188 +208,415 @@ declare module 'dns' {
105
208
  expire: number;
106
209
  minttl: number;
107
210
  }
108
-
109
- interface AnySoaRecord extends SoaRecord {
110
- type: "SOA";
211
+ export interface AnySoaRecord extends SoaRecord {
212
+ type: 'SOA';
111
213
  }
112
-
113
- interface SrvRecord {
214
+ export interface SrvRecord {
114
215
  priority: number;
115
216
  weight: number;
116
217
  port: number;
117
218
  name: string;
118
219
  }
119
-
120
- interface AnySrvRecord extends SrvRecord {
121
- type: "SRV";
220
+ export interface AnySrvRecord extends SrvRecord {
221
+ type: 'SRV';
122
222
  }
123
-
124
- interface AnyTxtRecord {
125
- type: "TXT";
223
+ export interface AnyTxtRecord {
224
+ type: 'TXT';
126
225
  entries: string[];
127
226
  }
128
-
129
- interface AnyNsRecord {
130
- type: "NS";
227
+ export interface AnyNsRecord {
228
+ type: 'NS';
131
229
  value: string;
132
230
  }
133
-
134
- interface AnyPtrRecord {
135
- type: "PTR";
231
+ export interface AnyPtrRecord {
232
+ type: 'PTR';
136
233
  value: string;
137
234
  }
138
-
139
- interface AnyCnameRecord {
140
- type: "CNAME";
235
+ export interface AnyCnameRecord {
236
+ type: 'CNAME';
141
237
  value: string;
142
238
  }
143
-
144
- type AnyRecord = AnyARecord |
145
- AnyAaaaRecord |
146
- AnyCnameRecord |
147
- AnyMxRecord |
148
- AnyNaptrRecord |
149
- AnyNsRecord |
150
- AnyPtrRecord |
151
- AnySoaRecord |
152
- AnySrvRecord |
153
- AnyTxtRecord;
154
-
155
- function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
156
- function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
157
- function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
158
- function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
159
- function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
160
- function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
161
- function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
162
- function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
163
- function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
164
- function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
165
- function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
166
- function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
167
- function resolve(
239
+ export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
240
+ /**
241
+ * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
242
+ * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
243
+ * records. The type and structure of individual results varies based on `rrtype`:
244
+ *
245
+ * <omitted>
246
+ *
247
+ * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
248
+ * @since v0.1.27
249
+ * @param hostname Host name to resolve.
250
+ * @param [rrtype='A'] Resource record type.
251
+ */
252
+ export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
253
+ export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
254
+ export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
255
+ export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
256
+ export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
257
+ export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
258
+ export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
259
+ export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
260
+ export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
261
+ export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
262
+ export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
263
+ export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
264
+ export function resolve(
168
265
  hostname: string,
169
266
  rrtype: string,
170
- callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
267
+ callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
171
268
  ): void;
172
-
173
- // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
174
- namespace resolve {
175
- function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
176
- function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
177
- function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
178
- function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
179
- function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
180
- function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
181
- function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
269
+ export namespace resolve {
270
+ function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
271
+ function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
272
+ function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
273
+ function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
274
+ function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
275
+ function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
276
+ function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
182
277
  function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
183
278
  }
184
-
185
- function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
186
- function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
187
- function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
188
-
189
- // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
190
- namespace resolve4 {
279
+ /**
280
+ * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
281
+ * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
282
+ * @since v0.1.16
283
+ * @param hostname Host name to resolve.
284
+ */
285
+ export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
286
+ export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
287
+ export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
288
+ export namespace resolve4 {
191
289
  function __promisify__(hostname: string): Promise<string[]>;
192
290
  function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
193
291
  function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
194
292
  }
195
-
196
- function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
197
- function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
198
- function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
199
-
200
- // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
201
- namespace resolve6 {
293
+ /**
294
+ * Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
295
+ * will contain an array of IPv6 addresses.
296
+ * @since v0.1.16
297
+ * @param hostname Host name to resolve.
298
+ */
299
+ export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
300
+ export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
301
+ export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
302
+ export namespace resolve6 {
202
303
  function __promisify__(hostname: string): Promise<string[]>;
203
304
  function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
204
305
  function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
205
306
  }
206
-
207
- function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
208
- namespace resolveCname {
307
+ /**
308
+ * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
309
+ * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
310
+ * @since v0.3.2
311
+ */
312
+ export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
313
+ export namespace resolveCname {
209
314
  function __promisify__(hostname: string): Promise<string[]>;
210
315
  }
211
-
212
- function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
213
- namespace resolveMx {
316
+ /**
317
+ * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
318
+ * will contain an array of certification authority authorization records
319
+ * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
320
+ * @since v15.0.0
321
+ */
322
+ export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
323
+ export namespace resolveCaa {
324
+ function __promisify__(hostname: string): Promise<CaaRecord[]>;
325
+ }
326
+ /**
327
+ * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
328
+ * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
329
+ * @since v0.1.27
330
+ */
331
+ export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
332
+ export namespace resolveMx {
214
333
  function __promisify__(hostname: string): Promise<MxRecord[]>;
215
334
  }
216
-
217
- function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
218
- namespace resolveNaptr {
335
+ /**
336
+ * 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
337
+ * objects with the following properties:
338
+ *
339
+ * * `flags`
340
+ * * `service`
341
+ * * `regexp`
342
+ * * `replacement`
343
+ * * `order`
344
+ * * `preference`
345
+ *
346
+ * ```js
347
+ * {
348
+ * flags: 's',
349
+ * service: 'SIP+D2U',
350
+ * regexp: '',
351
+ * replacement: '_sip._udp.example.com',
352
+ * order: 30,
353
+ * preference: 100
354
+ * }
355
+ * ```
356
+ * @since v0.9.12
357
+ */
358
+ export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
359
+ export namespace resolveNaptr {
219
360
  function __promisify__(hostname: string): Promise<NaptrRecord[]>;
220
361
  }
221
-
222
- function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
223
- namespace resolveNs {
362
+ /**
363
+ * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
364
+ * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
365
+ * @since v0.1.90
366
+ */
367
+ export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
368
+ export namespace resolveNs {
224
369
  function __promisify__(hostname: string): Promise<string[]>;
225
370
  }
226
-
227
- function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
228
- namespace resolvePtr {
371
+ /**
372
+ * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
373
+ * be an array of strings containing the reply records.
374
+ * @since v6.0.0
375
+ */
376
+ export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
377
+ export namespace resolvePtr {
229
378
  function __promisify__(hostname: string): Promise<string[]>;
230
379
  }
231
-
232
- function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
233
- namespace resolveSoa {
380
+ /**
381
+ * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
382
+ * the `hostname`. The `address` argument passed to the `callback` function will
383
+ * be an object with the following properties:
384
+ *
385
+ * * `nsname`
386
+ * * `hostmaster`
387
+ * * `serial`
388
+ * * `refresh`
389
+ * * `retry`
390
+ * * `expire`
391
+ * * `minttl`
392
+ *
393
+ * ```js
394
+ * {
395
+ * nsname: 'ns.example.com',
396
+ * hostmaster: 'root.example.com',
397
+ * serial: 2013101809,
398
+ * refresh: 10000,
399
+ * retry: 2400,
400
+ * expire: 604800,
401
+ * minttl: 3600
402
+ * }
403
+ * ```
404
+ * @since v0.11.10
405
+ */
406
+ export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
407
+ export namespace resolveSoa {
234
408
  function __promisify__(hostname: string): Promise<SoaRecord>;
235
409
  }
236
-
237
- function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
238
- namespace resolveSrv {
410
+ /**
411
+ * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
412
+ * be an array of objects with the following properties:
413
+ *
414
+ * * `priority`
415
+ * * `weight`
416
+ * * `port`
417
+ * * `name`
418
+ *
419
+ * ```js
420
+ * {
421
+ * priority: 10,
422
+ * weight: 5,
423
+ * port: 21223,
424
+ * name: 'service.example.com'
425
+ * }
426
+ * ```
427
+ * @since v0.1.27
428
+ */
429
+ export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
430
+ export namespace resolveSrv {
239
431
  function __promisify__(hostname: string): Promise<SrvRecord[]>;
240
432
  }
241
-
242
- function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
243
- namespace resolveTxt {
433
+ /**
434
+ * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
435
+ * 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
436
+ * one record. Depending on the use case, these could be either joined together or
437
+ * treated separately.
438
+ * @since v0.1.27
439
+ */
440
+ export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
441
+ export namespace resolveTxt {
244
442
  function __promisify__(hostname: string): Promise<string[][]>;
245
443
  }
246
-
247
- function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
248
- namespace resolveAny {
444
+ /**
445
+ * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
446
+ * The `ret` argument passed to the `callback` function will be an array containing
447
+ * various types of records. Each object has a property `type` that indicates the
448
+ * type of the current record. And depending on the `type`, additional properties
449
+ * will be present on the object:
450
+ *
451
+ * <omitted>
452
+ *
453
+ * Here is an example of the `ret` object passed to the callback:
454
+ *
455
+ * ```js
456
+ * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
457
+ * { type: 'CNAME', value: 'example.com' },
458
+ * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
459
+ * { type: 'NS', value: 'ns1.example.com' },
460
+ * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
461
+ * { type: 'SOA',
462
+ * nsname: 'ns1.example.com',
463
+ * hostmaster: 'admin.example.com',
464
+ * serial: 156696742,
465
+ * refresh: 900,
466
+ * retry: 900,
467
+ * expire: 1800,
468
+ * minttl: 60 } ]
469
+ * ```
470
+ *
471
+ * 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
472
+ * 8482](https://tools.ietf.org/html/rfc8482).
473
+ */
474
+ export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
475
+ export namespace resolveAny {
249
476
  function __promisify__(hostname: string): Promise<AnyRecord[]>;
250
477
  }
251
-
252
- function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
253
- function setServers(servers: ReadonlyArray<string>): void;
254
- function getServers(): string[];
255
-
256
- function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
257
-
478
+ /**
479
+ * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
480
+ * array of host names.
481
+ *
482
+ * On error, `err` is an `Error` object, where `err.code` is
483
+ * one of the `DNS error codes`.
484
+ * @since v0.1.16
485
+ */
486
+ export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
487
+ /**
488
+ * Sets the IP address and port of servers to be used when performing DNS
489
+ * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
490
+ * addresses. If the port is the IANA default DNS port (53) it can be omitted.
491
+ *
492
+ * ```js
493
+ * dns.setServers([
494
+ * '4.4.4.4',
495
+ * '[2001:4860:4860::8888]',
496
+ * '4.4.4.4:1053',
497
+ * '[2001:4860:4860::8888]:1053',
498
+ * ]);
499
+ * ```
500
+ *
501
+ * An error will be thrown if an invalid address is provided.
502
+ *
503
+ * The `dns.setServers()` method must not be called while a DNS query is in
504
+ * progress.
505
+ *
506
+ * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
507
+ *
508
+ * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
509
+ * 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
510
+ * subsequent servers provided. Fallback DNS servers will only be used if the
511
+ * earlier ones time out or result in some other error.
512
+ * @since v0.11.3
513
+ * @param servers array of `RFC 5952` formatted addresses
514
+ */
515
+ export function setServers(servers: ReadonlyArray<string>): void;
516
+ /**
517
+ * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
518
+ * that are currently configured for DNS resolution. A string will include a port
519
+ * section if a custom port is used.
520
+ *
521
+ * ```js
522
+ * [
523
+ * '4.4.4.4',
524
+ * '2001:4860:4860::8888',
525
+ * '4.4.4.4:1053',
526
+ * '[2001:4860:4860::8888]:1053',
527
+ * ]
528
+ * ```
529
+ * @since v0.11.3
530
+ */
531
+ export function getServers(): string[];
532
+ /**
533
+ * Set the default value of `verbatim` in {@link lookup}. The value could be:
534
+ * - `ipv4first`: sets default `verbatim` `false`.
535
+ * - `verbatim`: sets default `verbatim` `true`.
536
+ *
537
+ * The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
538
+ * When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
539
+ * @since v14.18.0
540
+ * @param order must be 'ipv4first' or 'verbatim'.
541
+ */
542
+ export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
258
543
  // Error codes
259
- const NODATA: string;
260
- const FORMERR: string;
261
- const SERVFAIL: string;
262
- const NOTFOUND: string;
263
- const NOTIMP: string;
264
- const REFUSED: string;
265
- const BADQUERY: string;
266
- const BADNAME: string;
267
- const BADFAMILY: string;
268
- const BADRESP: string;
269
- const CONNREFUSED: string;
270
- const TIMEOUT: string;
271
- const EOF: string;
272
- const FILE: string;
273
- const NOMEM: string;
274
- const DESTRUCTION: string;
275
- const BADSTR: string;
276
- const BADFLAGS: string;
277
- const NONAME: string;
278
- const BADHINTS: string;
279
- const NOTINITIALIZED: string;
280
- const LOADIPHLPAPI: string;
281
- const ADDRGETNETWORKPARAMS: string;
282
- const CANCELLED: string;
283
-
284
- interface ResolverOptions {
544
+ export const NODATA: string;
545
+ export const FORMERR: string;
546
+ export const SERVFAIL: string;
547
+ export const NOTFOUND: string;
548
+ export const NOTIMP: string;
549
+ export const REFUSED: string;
550
+ export const BADQUERY: string;
551
+ export const BADNAME: string;
552
+ export const BADFAMILY: string;
553
+ export const BADRESP: string;
554
+ export const CONNREFUSED: string;
555
+ export const TIMEOUT: string;
556
+ export const EOF: string;
557
+ export const FILE: string;
558
+ export const NOMEM: string;
559
+ export const DESTRUCTION: string;
560
+ export const BADSTR: string;
561
+ export const BADFLAGS: string;
562
+ export const NONAME: string;
563
+ export const BADHINTS: string;
564
+ export const NOTINITIALIZED: string;
565
+ export const LOADIPHLPAPI: string;
566
+ export const ADDRGETNETWORKPARAMS: string;
567
+ export const CANCELLED: string;
568
+ export interface ResolverOptions {
285
569
  timeout?: number | undefined;
570
+ /**
571
+ * @default 4
572
+ */
573
+ tries?: number;
286
574
  }
287
-
288
- class Resolver {
575
+ /**
576
+ * An independent resolver for DNS requests.
577
+ *
578
+ * Creating a new resolver uses the default server settings. Setting
579
+ * the servers used for a resolver using `resolver.setServers()` does not affect
580
+ * other resolvers:
581
+ *
582
+ * ```js
583
+ * const { Resolver } = require('dns');
584
+ * const resolver = new Resolver();
585
+ * resolver.setServers(['4.4.4.4']);
586
+ *
587
+ * // This request will use the server at 4.4.4.4, independent of global settings.
588
+ * resolver.resolve4('example.org', (err, addresses) => {
589
+ * // ...
590
+ * });
591
+ * ```
592
+ *
593
+ * The following methods from the `dns` module are available:
594
+ *
595
+ * * `resolver.getServers()`
596
+ * * `resolver.resolve()`
597
+ * * `resolver.resolve4()`
598
+ * * `resolver.resolve6()`
599
+ * * `resolver.resolveAny()`
600
+ * * `resolver.resolveCaa()`
601
+ * * `resolver.resolveCname()`
602
+ * * `resolver.resolveMx()`
603
+ * * `resolver.resolveNaptr()`
604
+ * * `resolver.resolveNs()`
605
+ * * `resolver.resolvePtr()`
606
+ * * `resolver.resolveSoa()`
607
+ * * `resolver.resolveSrv()`
608
+ * * `resolver.resolveTxt()`
609
+ * * `resolver.reverse()`
610
+ * * `resolver.setServers()`
611
+ * @since v8.3.0
612
+ */
613
+ export class Resolver {
289
614
  constructor(options?: ResolverOptions);
615
+ /**
616
+ * Cancel all outstanding DNS queries made by this resolver. The corresponding
617
+ * callbacks will be called with an error with code `ECANCELLED`.
618
+ * @since v8.3.0
619
+ */
290
620
  cancel(): void;
291
621
  getServers: typeof getServers;
292
622
  resolve: typeof resolve;
@@ -302,88 +632,25 @@ declare module 'dns' {
302
632
  resolveSrv: typeof resolveSrv;
303
633
  resolveTxt: typeof resolveTxt;
304
634
  reverse: typeof reverse;
635
+ /**
636
+ * The resolver instance will send its requests from the specified IP address.
637
+ * This allows programs to specify outbound interfaces when used on multi-homed
638
+ * systems.
639
+ *
640
+ * If a v4 or v6 address is not specified, it is set to the default, and the
641
+ * operating system will choose a local address automatically.
642
+ *
643
+ * The resolver will use the v4 local address when making requests to IPv4 DNS
644
+ * servers, and the v6 local address when making requests to IPv6 DNS servers.
645
+ * The `rrtype` of resolution requests has no impact on the local address used.
646
+ * @since v15.1.0
647
+ * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
648
+ * @param [ipv6='::0'] A string representation of an IPv6 address.
649
+ */
305
650
  setLocalAddress(ipv4?: string, ipv6?: string): void;
306
651
  setServers: typeof setServers;
307
652
  }
308
-
309
- namespace promises {
310
- function getServers(): string[];
311
-
312
- function lookup(hostname: string, family: number): Promise<LookupAddress>;
313
- function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
314
- function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
315
- function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
316
- function lookup(hostname: string): Promise<LookupAddress>;
317
-
318
- function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>;
319
-
320
- function resolve(hostname: string): Promise<string[]>;
321
- function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
322
- function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
323
- function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
324
- function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
325
- function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
326
- function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
327
- function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
328
- function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
329
- function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
330
- function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
331
- function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
332
- function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
333
-
334
- function resolve4(hostname: string): Promise<string[]>;
335
- function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
336
- function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
337
-
338
- function resolve6(hostname: string): Promise<string[]>;
339
- function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
340
- function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
341
-
342
- function resolveAny(hostname: string): Promise<AnyRecord[]>;
343
-
344
- function resolveCname(hostname: string): Promise<string[]>;
345
-
346
- function resolveMx(hostname: string): Promise<MxRecord[]>;
347
-
348
- function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
349
-
350
- function resolveNs(hostname: string): Promise<string[]>;
351
-
352
- function resolvePtr(hostname: string): Promise<string[]>;
353
-
354
- function resolveSoa(hostname: string): Promise<SoaRecord>;
355
-
356
- function resolveSrv(hostname: string): Promise<SrvRecord[]>;
357
-
358
- function resolveTxt(hostname: string): Promise<string[][]>;
359
-
360
- function reverse(ip: string): Promise<string[]>;
361
-
362
- function setServers(servers: ReadonlyArray<string>): void;
363
-
364
- function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
365
-
366
- class Resolver {
367
- constructor(options?: ResolverOptions);
368
- cancel(): void;
369
- getServers: typeof getServers;
370
- resolve: typeof resolve;
371
- resolve4: typeof resolve4;
372
- resolve6: typeof resolve6;
373
- resolveAny: typeof resolveAny;
374
- resolveCname: typeof resolveCname;
375
- resolveMx: typeof resolveMx;
376
- resolveNaptr: typeof resolveNaptr;
377
- resolveNs: typeof resolveNs;
378
- resolvePtr: typeof resolvePtr;
379
- resolveSoa: typeof resolveSoa;
380
- resolveSrv: typeof resolveSrv;
381
- resolveTxt: typeof resolveTxt;
382
- reverse: typeof reverse;
383
- setLocalAddress(ipv4?: string, ipv6?: string): void;
384
- setServers: typeof setServers;
385
- }
386
- }
653
+ export { dnsPromises as promises };
387
654
  }
388
655
  declare module 'node:dns' {
389
656
  export * from 'dns';