@chainlink/external-adapter-framework 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/adapter/types.d.ts +1 -1
  3. package/config/index.d.ts +4 -0
  4. package/config/index.js +4 -0
  5. package/config/index.js.map +1 -1
  6. package/debug/router.js +7 -36
  7. package/debug/router.js.map +1 -1
  8. package/debug/settings-page.d.ts +1 -7
  9. package/debug/settings-page.js +0 -22
  10. package/debug/settings-page.js.map +1 -1
  11. package/generator-adapter/generators/app/index.js +11 -5
  12. package/generator-adapter/node_modules/.yarn-integrity +2 -2
  13. package/generator-adapter/node_modules/@types/node/README.md +2 -2
  14. package/generator-adapter/node_modules/@types/node/async_hooks.d.ts +65 -1
  15. package/generator-adapter/node_modules/@types/node/buffer.buffer.d.ts +2 -0
  16. package/generator-adapter/node_modules/@types/node/buffer.d.ts +7 -2
  17. package/generator-adapter/node_modules/@types/node/cluster.d.ts +1 -1
  18. package/generator-adapter/node_modules/@types/node/compatibility/disposable.d.ts +0 -2
  19. package/generator-adapter/node_modules/@types/node/compatibility/indexable.d.ts +0 -3
  20. package/generator-adapter/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  21. package/generator-adapter/node_modules/@types/node/diagnostics_channel.d.ts +37 -13
  22. package/generator-adapter/node_modules/@types/node/dns/promises.d.ts +36 -9
  23. package/generator-adapter/node_modules/@types/node/dns.d.ts +73 -20
  24. package/generator-adapter/node_modules/@types/node/dom-events.d.ts +60 -85
  25. package/generator-adapter/node_modules/@types/node/events.d.ts +0 -1
  26. package/generator-adapter/node_modules/@types/node/fs/promises.d.ts +21 -17
  27. package/generator-adapter/node_modules/@types/node/fs.d.ts +94 -10
  28. package/generator-adapter/node_modules/@types/node/globals.d.ts +136 -283
  29. package/generator-adapter/node_modules/@types/node/http.d.ts +88 -1
  30. package/generator-adapter/node_modules/@types/node/http2.d.ts +69 -1
  31. package/generator-adapter/node_modules/@types/node/module.d.ts +113 -18
  32. package/generator-adapter/node_modules/@types/node/net.d.ts +15 -9
  33. package/generator-adapter/node_modules/@types/node/package.json +2 -2
  34. package/generator-adapter/node_modules/@types/node/perf_hooks.d.ts +2 -2
  35. package/generator-adapter/node_modules/@types/node/process.d.ts +0 -2
  36. package/generator-adapter/node_modules/@types/node/querystring.d.ts +2 -3
  37. package/generator-adapter/node_modules/@types/node/repl.d.ts +3 -5
  38. package/generator-adapter/node_modules/@types/node/sqlite.d.ts +172 -0
  39. package/generator-adapter/node_modules/@types/node/stream/web.d.ts +7 -3
  40. package/generator-adapter/node_modules/@types/node/stream.d.ts +6 -0
  41. package/generator-adapter/node_modules/@types/node/test.d.ts +1865 -1970
  42. package/generator-adapter/node_modules/@types/node/tls.d.ts +1 -1
  43. package/generator-adapter/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -0
  44. package/generator-adapter/node_modules/@types/node/util.d.ts +28 -3
  45. package/generator-adapter/node_modules/@types/node/v8.d.ts +33 -0
  46. package/generator-adapter/node_modules/@types/node/vm.d.ts +61 -8
  47. package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +48 -25
  48. package/generator-adapter/package.json +1 -1
  49. package/index.js +3 -0
  50. package/index.js.map +1 -1
  51. package/package.json +14 -15
  52. package/status/router.d.ts +49 -0
  53. package/status/router.js +55 -0
  54. package/status/router.js.map +1 -0
  55. package/transports/sse.d.ts +2 -2
  56. package/transports/sse.js +2 -5
  57. package/transports/sse.js.map +1 -1
  58. package/util/settings.d.ts +11 -0
  59. package/util/settings.js +29 -0
  60. package/util/settings.js.map +1 -0
@@ -20,6 +20,7 @@ declare module "dns/promises" {
20
20
  ResolveWithTtlOptions,
21
21
  SoaRecord,
22
22
  SrvRecord,
23
+ TlsaRecord,
23
24
  } from "node:dns";
24
25
  /**
25
26
  * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
@@ -126,22 +127,26 @@ declare module "dns/promises" {
126
127
  * @param [rrtype='A'] Resource record type.
127
128
  */
128
129
  function resolve(hostname: string): Promise<string[]>;
129
- function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
130
- function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
130
+ function resolve(hostname: string, rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
131
131
  function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
132
132
  function resolve(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
133
- function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
134
133
  function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
135
134
  function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
136
- function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
137
- function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
138
135
  function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
139
136
  function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
137
+ function resolve(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
140
138
  function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
141
- function resolve(
142
- hostname: string,
143
- rrtype: string,
144
- ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
139
+ function resolve(hostname: string, rrtype: string): Promise<
140
+ | string[]
141
+ | CaaRecord[]
142
+ | MxRecord[]
143
+ | NaptrRecord[]
144
+ | SoaRecord
145
+ | SrvRecord[]
146
+ | TlsaRecord[]
147
+ | string[][]
148
+ | AnyRecord[]
149
+ >;
145
150
  /**
146
151
  * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4
147
152
  * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
@@ -292,6 +297,27 @@ declare module "dns/promises" {
292
297
  * @since v10.6.0
293
298
  */
294
299
  function resolveSrv(hostname: string): Promise<SrvRecord[]>;
300
+ /**
301
+ * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
302
+ * the `hostname`. On success, the `Promise` is resolved with an array of objectsAdd commentMore actions
303
+ * with these properties:
304
+ *
305
+ * * `certUsage`
306
+ * * `selector`
307
+ * * `match`
308
+ * * `data`
309
+ *
310
+ * ```js
311
+ * {
312
+ * certUsage: 3,
313
+ * selector: 1,
314
+ * match: 1,
315
+ * data: [ArrayBuffer]
316
+ * }
317
+ * ```
318
+ * @since v22.15.0
319
+ */
320
+ function resolveTlsa(hostname: string): Promise<TlsaRecord[]>;
295
321
  /**
296
322
  * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a two-dimensional array
297
323
  * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
@@ -450,6 +476,7 @@ declare module "dns/promises" {
450
476
  resolvePtr: typeof resolvePtr;
451
477
  resolveSoa: typeof resolveSoa;
452
478
  resolveSrv: typeof resolveSrv;
479
+ resolveTlsa: typeof resolveTlsa;
453
480
  resolveTxt: typeof resolveTxt;
454
481
  reverse: typeof reverse;
455
482
  /**
@@ -250,6 +250,9 @@ declare module "dns" {
250
250
  contactemail?: string | undefined;
251
251
  contactphone?: string | undefined;
252
252
  }
253
+ export interface AnyCaaRecord extends CaaRecord {
254
+ type: "CAA";
255
+ }
253
256
  export interface MxRecord {
254
257
  priority: number;
255
258
  exchange: string;
@@ -289,6 +292,15 @@ declare module "dns" {
289
292
  export interface AnySrvRecord extends SrvRecord {
290
293
  type: "SRV";
291
294
  }
295
+ export interface TlsaRecord {
296
+ certUsage: number;
297
+ selector: number;
298
+ match: number;
299
+ data: ArrayBuffer;
300
+ }
301
+ export interface AnyTlsaRecord extends TlsaRecord {
302
+ type: "TLSA";
303
+ }
292
304
  export interface AnyTxtRecord {
293
305
  type: "TXT";
294
306
  entries: string[];
@@ -308,6 +320,7 @@ declare module "dns" {
308
320
  export type AnyRecord =
309
321
  | AnyARecord
310
322
  | AnyAaaaRecord
323
+ | AnyCaaRecord
311
324
  | AnyCnameRecord
312
325
  | AnyMxRecord
313
326
  | AnyNaptrRecord
@@ -315,6 +328,7 @@ declare module "dns" {
315
328
  | AnyPtrRecord
316
329
  | AnySoaRecord
317
330
  | AnySrvRecord
331
+ | AnyTlsaRecord
318
332
  | AnyTxtRecord;
319
333
  /**
320
334
  * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
@@ -335,12 +349,7 @@ declare module "dns" {
335
349
  ): void;
336
350
  export function resolve(
337
351
  hostname: string,
338
- rrtype: "A",
339
- callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
340
- ): void;
341
- export function resolve(
342
- hostname: string,
343
- rrtype: "AAAA",
352
+ rrtype: "A" | "AAAA" | "CNAME" | "NS" | "PTR",
344
353
  callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
345
354
  ): void;
346
355
  export function resolve(
@@ -350,8 +359,8 @@ declare module "dns" {
350
359
  ): void;
351
360
  export function resolve(
352
361
  hostname: string,
353
- rrtype: "CNAME",
354
- callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
362
+ rrtype: "CAA",
363
+ callback: (err: NodeJS.ErrnoException | null, address: CaaRecord[]) => void,
355
364
  ): void;
356
365
  export function resolve(
357
366
  hostname: string,
@@ -363,16 +372,6 @@ declare module "dns" {
363
372
  rrtype: "NAPTR",
364
373
  callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
365
374
  ): void;
366
- export function resolve(
367
- hostname: string,
368
- rrtype: "NS",
369
- callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
370
- ): void;
371
- export function resolve(
372
- hostname: string,
373
- rrtype: "PTR",
374
- callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
375
- ): void;
376
375
  export function resolve(
377
376
  hostname: string,
378
377
  rrtype: "SOA",
@@ -383,6 +382,11 @@ declare module "dns" {
383
382
  rrtype: "SRV",
384
383
  callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
385
384
  ): void;
385
+ export function resolve(
386
+ hostname: string,
387
+ rrtype: "TLSA",
388
+ callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
389
+ ): void;
386
390
  export function resolve(
387
391
  hostname: string,
388
392
  rrtype: "TXT",
@@ -393,21 +397,42 @@ declare module "dns" {
393
397
  rrtype: string,
394
398
  callback: (
395
399
  err: NodeJS.ErrnoException | null,
396
- addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
400
+ addresses:
401
+ | string[]
402
+ | CaaRecord[]
403
+ | MxRecord[]
404
+ | NaptrRecord[]
405
+ | SoaRecord
406
+ | SrvRecord[]
407
+ | TlsaRecord[]
408
+ | string[][]
409
+ | AnyRecord[],
397
410
  ) => void,
398
411
  ): void;
399
412
  export namespace resolve {
400
413
  function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
401
414
  function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
415
+ function __promisify__(hostname: string, rrtype: "CAA"): Promise<CaaRecord[]>;
402
416
  function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
403
417
  function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
404
418
  function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
405
419
  function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
420
+ function __promisify__(hostname: string, rrtype: "TLSA"): Promise<TlsaRecord[]>;
406
421
  function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
407
422
  function __promisify__(
408
423
  hostname: string,
409
424
  rrtype: string,
410
- ): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
425
+ ): Promise<
426
+ | string[]
427
+ | CaaRecord[]
428
+ | MxRecord[]
429
+ | NaptrRecord[]
430
+ | SoaRecord
431
+ | SrvRecord[]
432
+ | TlsaRecord[]
433
+ | string[][]
434
+ | AnyRecord[]
435
+ >;
411
436
  }
412
437
  /**
413
438
  * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
@@ -609,6 +634,33 @@ declare module "dns" {
609
634
  export namespace resolveSrv {
610
635
  function __promisify__(hostname: string): Promise<SrvRecord[]>;
611
636
  }
637
+ /**
638
+ * Uses the DNS protocol to resolve certificate associations (`TLSA` records) for
639
+ * the `hostname`. The `records` argument passed to the `callback` function is an
640
+ * array of objects with these properties:
641
+ *
642
+ * * `certUsage`
643
+ * * `selector`
644
+ * * `match`
645
+ * * `data`
646
+ *
647
+ * ```js
648
+ * {
649
+ * certUsage: 3,
650
+ * selector: 1,
651
+ * match: 1,
652
+ * data: [ArrayBuffer]
653
+ * }
654
+ * ```
655
+ * @since v22.15.0
656
+ */
657
+ export function resolveTlsa(
658
+ hostname: string,
659
+ callback: (err: NodeJS.ErrnoException | null, addresses: TlsaRecord[]) => void,
660
+ ): void;
661
+ export namespace resolveTlsa {
662
+ function __promisify__(hostname: string): Promise<TlsaRecord[]>;
663
+ }
612
664
  /**
613
665
  * Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
614
666
  * 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
@@ -838,6 +890,7 @@ declare module "dns" {
838
890
  resolvePtr: typeof resolvePtr;
839
891
  resolveSoa: typeof resolveSoa;
840
892
  resolveSrv: typeof resolveSrv;
893
+ resolveTlsa: typeof resolveTlsa;
841
894
  resolveTxt: typeof resolveTxt;
842
895
  reverse: typeof reverse;
843
896
  /**
@@ -1,77 +1,50 @@
1
- export {}; // Don't export anything!
1
+ // Make this a module
2
+ export {};
2
3
 
3
- //// DOM-like Events
4
- // NB: The Event / EventTarget / EventListener implementations below were copied
5
- // from lib.dom.d.ts, then edited to reflect Node's documentation at
6
- // https://nodejs.org/api/events.html#class-eventtarget.
7
- // Please read that link to understand important implementation differences.
4
+ // Conditional type aliases, which are later merged into the global scope.
5
+ // Will either be empty if the relevant web library is already present, or the @types/node definition otherwise.
8
6
 
9
- // This conditional type will be the existing global Event in a browser, or
10
- // the copy below in a Node environment.
11
- type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {}
12
- : {
13
- /** This is not used in Node.js and is provided purely for completeness. */
14
- readonly bubbles: boolean;
15
- /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
16
- cancelBubble: () => void;
17
- /** True if the event was created with the cancelable option */
18
- readonly cancelable: boolean;
19
- /** This is not used in Node.js and is provided purely for completeness. */
20
- readonly composed: boolean;
21
- /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
22
- composedPath(): [EventTarget?];
23
- /** Alias for event.target. */
24
- readonly currentTarget: EventTarget | null;
25
- /** Is true if cancelable is true and event.preventDefault() has been called. */
26
- readonly defaultPrevented: boolean;
27
- /** This is not used in Node.js and is provided purely for completeness. */
28
- readonly eventPhase: 0 | 2;
29
- /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
30
- readonly isTrusted: boolean;
31
- /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
32
- preventDefault(): void;
33
- /** This is not used in Node.js and is provided purely for completeness. */
34
- returnValue: boolean;
35
- /** Alias for event.target. */
36
- readonly srcElement: EventTarget | null;
37
- /** Stops the invocation of event listeners after the current one completes. */
38
- stopImmediatePropagation(): void;
39
- /** This is not used in Node.js and is provided purely for completeness. */
40
- stopPropagation(): void;
41
- /** The `EventTarget` dispatching the event */
42
- readonly target: EventTarget | null;
43
- /** The millisecond timestamp when the Event object was created. */
44
- readonly timeStamp: number;
45
- /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
46
- readonly type: string;
47
- };
7
+ type __Event = typeof globalThis extends { onmessage: any } ? {} : Event;
8
+ interface Event {
9
+ readonly bubbles: boolean;
10
+ cancelBubble: boolean;
11
+ readonly cancelable: boolean;
12
+ readonly composed: boolean;
13
+ composedPath(): [EventTarget?];
14
+ readonly currentTarget: EventTarget | null;
15
+ readonly defaultPrevented: boolean;
16
+ readonly eventPhase: 0 | 2;
17
+ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
18
+ readonly isTrusted: boolean;
19
+ preventDefault(): void;
20
+ readonly returnValue: boolean;
21
+ readonly srcElement: EventTarget | null;
22
+ stopImmediatePropagation(): void;
23
+ stopPropagation(): void;
24
+ readonly target: EventTarget | null;
25
+ readonly timeStamp: number;
26
+ readonly type: string;
27
+ }
48
28
 
49
- // See comment above explaining conditional type
50
- type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {}
51
- : {
52
- /**
53
- * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
54
- *
55
- * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
56
- *
57
- * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
58
- * Specifically, the `capture` option is used as part of the key when registering a `listener`.
59
- * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
60
- */
61
- addEventListener(
62
- type: string,
63
- listener: EventListener | EventListenerObject,
64
- options?: AddEventListenerOptions | boolean,
65
- ): void;
66
- /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
67
- dispatchEvent(event: Event): boolean;
68
- /** Removes the event listener in target's event listener list with the same type, callback, and options. */
69
- removeEventListener(
70
- type: string,
71
- listener: EventListener | EventListenerObject,
72
- options?: EventListenerOptions | boolean,
73
- ): void;
74
- };
29
+ type __CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
30
+ interface CustomEvent<T = any> extends Event {
31
+ readonly detail: T;
32
+ }
33
+
34
+ type __EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
35
+ interface EventTarget {
36
+ addEventListener(
37
+ type: string,
38
+ listener: EventListener | EventListenerObject,
39
+ options?: AddEventListenerOptions | boolean,
40
+ ): void;
41
+ dispatchEvent(event: Event): boolean;
42
+ removeEventListener(
43
+ type: string,
44
+ listener: EventListener | EventListenerObject,
45
+ options?: EventListenerOptions | boolean,
46
+ ): void;
47
+ }
75
48
 
76
49
  interface EventInit {
77
50
  bubbles?: boolean;
@@ -79,17 +52,17 @@ interface EventInit {
79
52
  composed?: boolean;
80
53
  }
81
54
 
55
+ interface CustomEventInit<T = any> extends EventInit {
56
+ detail?: T;
57
+ }
58
+
82
59
  interface EventListenerOptions {
83
- /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
84
60
  capture?: boolean;
85
61
  }
86
62
 
87
63
  interface AddEventListenerOptions extends EventListenerOptions {
88
- /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
89
64
  once?: boolean;
90
- /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
91
65
  passive?: boolean;
92
- /** The listener will be removed when the given AbortSignal object's `abort()` method is called. */
93
66
  signal?: AbortSignal;
94
67
  }
95
68
 
@@ -101,24 +74,26 @@ interface EventListenerObject {
101
74
  handleEvent(object: Event): void;
102
75
  }
103
76
 
104
- import {} from "events"; // Make this an ambient declaration
77
+ // Merge conditional interfaces into global scope, and conditionally declare global constructors.
105
78
  declare global {
106
- /** An event which takes place in the DOM. */
107
79
  interface Event extends __Event {}
108
80
  var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
109
81
  : {
110
- prototype: __Event;
111
- new(type: string, eventInitDict?: EventInit): __Event;
82
+ prototype: Event;
83
+ new(type: string, eventInitDict?: EventInit): Event;
84
+ };
85
+
86
+ interface CustomEvent<T = any> extends __CustomEvent<T> {}
87
+ var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
88
+ : {
89
+ prototype: CustomEvent;
90
+ new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
112
91
  };
113
92
 
114
- /**
115
- * EventTarget is a DOM interface implemented by objects that can
116
- * receive events and may have listeners for them.
117
- */
118
93
  interface EventTarget extends __EventTarget {}
119
94
  var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
120
95
  : {
121
- prototype: __EventTarget;
122
- new(): __EventTarget;
96
+ prototype: EventTarget;
97
+ new(): EventTarget;
123
98
  };
124
99
  }
@@ -431,7 +431,6 @@ declare module "events" {
431
431
  * }
432
432
  * ```
433
433
  * @since v20.5.0
434
- * @experimental
435
434
  * @return Disposable that removes the `abort` listener.
436
435
  */
437
436
  static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
@@ -29,6 +29,7 @@ declare module "fs/promises" {
29
29
  OpenDirOptions,
30
30
  OpenMode,
31
31
  PathLike,
32
+ ReadPosition,
32
33
  ReadStream,
33
34
  ReadVResult,
34
35
  RmDirOptions,
@@ -69,7 +70,7 @@ declare module "fs/promises" {
69
70
  * @default `buffer.byteLength`
70
71
  */
71
72
  length?: number | null;
72
- position?: number | null;
73
+ position?: ReadPosition | null;
73
74
  }
74
75
  interface CreateReadStreamOptions extends Abortable {
75
76
  encoding?: BufferEncoding | null | undefined;
@@ -229,7 +230,7 @@ declare module "fs/promises" {
229
230
  buffer: T,
230
231
  offset?: number | null,
231
232
  length?: number | null,
232
- position?: number | null,
233
+ position?: ReadPosition | null,
233
234
  ): Promise<FileReadResult<T>>;
234
235
  read<T extends NodeJS.ArrayBufferView = Buffer>(
235
236
  buffer: T,
@@ -277,36 +278,26 @@ declare module "fs/promises" {
277
278
  * data will be a string.
278
279
  */
279
280
  readFile(
280
- options?: {
281
- encoding?: null | undefined;
282
- flag?: OpenMode | undefined;
283
- } | null,
281
+ options?:
282
+ | ({ encoding?: null | undefined } & Abortable)
283
+ | null,
284
284
  ): Promise<Buffer>;
285
285
  /**
286
286
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
287
287
  * The `FileHandle` must have been opened for reading.
288
- * @param options An object that may contain an optional flag.
289
- * If a flag is not provided, it defaults to `'r'`.
290
288
  */
291
289
  readFile(
292
290
  options:
293
- | {
294
- encoding: BufferEncoding;
295
- flag?: OpenMode | undefined;
296
- }
291
+ | ({ encoding: BufferEncoding } & Abortable)
297
292
  | BufferEncoding,
298
293
  ): Promise<string>;
299
294
  /**
300
295
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
301
296
  * The `FileHandle` must have been opened for reading.
302
- * @param options An object that may contain an optional flag.
303
- * If a flag is not provided, it defaults to `'r'`.
304
297
  */
305
298
  readFile(
306
299
  options?:
307
- | (ObjectEncodingOptions & {
308
- flag?: OpenMode | undefined;
309
- })
300
+ | (ObjectEncodingOptions & Abortable)
310
301
  | BufferEncoding
311
302
  | null,
312
303
  ): Promise<string | Buffer>;
@@ -728,6 +719,19 @@ declare module "fs/promises" {
728
719
  recursive?: boolean | undefined;
729
720
  },
730
721
  ): Promise<Dirent[]>;
722
+ /**
723
+ * Asynchronous readdir(3) - read a directory.
724
+ * @param path A path to a directory. If a URL is provided, it must use the `file:` protocol.
725
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
726
+ */
727
+ function readdir(
728
+ path: PathLike,
729
+ options: {
730
+ encoding: "buffer";
731
+ withFileTypes: true;
732
+ recursive?: boolean | undefined;
733
+ },
734
+ ): Promise<Dirent<Buffer>[]>;
731
735
  /**
732
736
  * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
733
737
  * fulfilled with the`linkString` upon success.