@chainlink/external-adapter-framework 2.3.0 → 2.5.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 (193) hide show
  1. package/README.md +1 -1
  2. package/generator-adapter/node_modules/.yarn-integrity +3 -2
  3. package/generator-adapter/node_modules/@types/node/README.md +1 -1
  4. package/generator-adapter/node_modules/@types/node/fs.d.ts +28 -18
  5. package/generator-adapter/node_modules/@types/node/http.d.ts +2 -2
  6. package/generator-adapter/node_modules/@types/node/https.d.ts +3 -1
  7. package/generator-adapter/node_modules/@types/node/module.d.ts +50 -5
  8. package/generator-adapter/node_modules/@types/node/package.json +4 -4
  9. package/generator-adapter/node_modules/@types/node/process.d.ts +28 -0
  10. package/generator-adapter/node_modules/@types/node/sqlite.d.ts +63 -17
  11. package/generator-adapter/node_modules/@types/node/stream/consumers.d.ts +32 -6
  12. package/generator-adapter/node_modules/@types/node/test.d.ts +82 -0
  13. package/generator-adapter/node_modules/@types/node/timers/promises.d.ts +24 -13
  14. package/generator-adapter/node_modules/@types/node/timers.d.ts +159 -112
  15. package/generator-adapter/node_modules/@types/node/util.d.ts +11 -4
  16. package/generator-adapter/node_modules/@types/node/worker_threads.d.ts +1 -0
  17. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/LICENSE +21 -0
  18. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/README.md +6 -0
  19. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/agent.d.ts +31 -0
  20. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/api.d.ts +43 -0
  21. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/balanced-pool.d.ts +29 -0
  22. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/cache.d.ts +36 -0
  23. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/client.d.ts +108 -0
  24. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/connector.d.ts +34 -0
  25. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/content-type.d.ts +21 -0
  26. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/cookies.d.ts +28 -0
  27. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  28. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/dispatcher.d.ts +255 -0
  29. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  30. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/errors.d.ts +149 -0
  31. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/eventsource.d.ts +61 -0
  32. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/fetch.d.ts +209 -0
  33. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/file.d.ts +39 -0
  34. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/filereader.d.ts +54 -0
  35. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/formdata.d.ts +108 -0
  36. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  37. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/global-origin.d.ts +7 -0
  38. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/handlers.d.ts +15 -0
  39. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/header.d.ts +4 -0
  40. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/index.d.ts +71 -0
  41. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/interceptors.d.ts +17 -0
  42. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/mock-agent.d.ts +50 -0
  43. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/mock-client.d.ts +25 -0
  44. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/mock-errors.d.ts +12 -0
  45. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  46. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/mock-pool.d.ts +25 -0
  47. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/package.json +55 -0
  48. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/patch.d.ts +33 -0
  49. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/pool-stats.d.ts +19 -0
  50. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/pool.d.ts +39 -0
  51. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/proxy-agent.d.ts +28 -0
  52. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/readable.d.ts +60 -0
  53. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/retry-agent.d.ts +8 -0
  54. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/retry-handler.d.ts +116 -0
  55. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/util.d.ts +18 -0
  56. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/webidl.d.ts +222 -0
  57. package/generator-adapter/node_modules/@types/through/node_modules/undici-types/websocket.d.ts +150 -0
  58. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/LICENSE +21 -0
  59. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/README.md +6 -0
  60. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/agent.d.ts +31 -0
  61. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/api.d.ts +43 -0
  62. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/balanced-pool.d.ts +29 -0
  63. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/cache.d.ts +36 -0
  64. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/client.d.ts +108 -0
  65. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/connector.d.ts +34 -0
  66. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/content-type.d.ts +21 -0
  67. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/cookies.d.ts +28 -0
  68. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  69. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/dispatcher.d.ts +255 -0
  70. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  71. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/errors.d.ts +149 -0
  72. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/eventsource.d.ts +61 -0
  73. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/fetch.d.ts +209 -0
  74. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/file.d.ts +39 -0
  75. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/filereader.d.ts +54 -0
  76. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/formdata.d.ts +108 -0
  77. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  78. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/global-origin.d.ts +7 -0
  79. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/handlers.d.ts +15 -0
  80. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/header.d.ts +4 -0
  81. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/index.d.ts +71 -0
  82. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/interceptors.d.ts +17 -0
  83. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/mock-agent.d.ts +50 -0
  84. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/mock-client.d.ts +25 -0
  85. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/mock-errors.d.ts +12 -0
  86. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  87. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/mock-pool.d.ts +25 -0
  88. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/package.json +55 -0
  89. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/patch.d.ts +33 -0
  90. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/pool-stats.d.ts +19 -0
  91. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/pool.d.ts +39 -0
  92. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/proxy-agent.d.ts +28 -0
  93. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/readable.d.ts +60 -0
  94. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/retry-agent.d.ts +8 -0
  95. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/retry-handler.d.ts +116 -0
  96. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/util.d.ts +18 -0
  97. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/webidl.d.ts +222 -0
  98. package/generator-adapter/node_modules/@types/vinyl/node_modules/undici-types/websocket.d.ts +150 -0
  99. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/LICENSE +21 -0
  100. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/README.md +6 -0
  101. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/agent.d.ts +31 -0
  102. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/api.d.ts +43 -0
  103. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/balanced-pool.d.ts +29 -0
  104. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/cache.d.ts +36 -0
  105. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/client.d.ts +108 -0
  106. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/connector.d.ts +34 -0
  107. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/content-type.d.ts +21 -0
  108. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/cookies.d.ts +28 -0
  109. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  110. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/dispatcher.d.ts +255 -0
  111. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  112. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/errors.d.ts +149 -0
  113. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/eventsource.d.ts +61 -0
  114. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/fetch.d.ts +209 -0
  115. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/file.d.ts +39 -0
  116. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/filereader.d.ts +54 -0
  117. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/formdata.d.ts +108 -0
  118. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  119. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/global-origin.d.ts +7 -0
  120. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/handlers.d.ts +15 -0
  121. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/header.d.ts +4 -0
  122. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/index.d.ts +71 -0
  123. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/interceptors.d.ts +17 -0
  124. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/mock-agent.d.ts +50 -0
  125. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/mock-client.d.ts +25 -0
  126. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/mock-errors.d.ts +12 -0
  127. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  128. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/mock-pool.d.ts +25 -0
  129. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/package.json +55 -0
  130. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/patch.d.ts +33 -0
  131. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/pool-stats.d.ts +19 -0
  132. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/pool.d.ts +39 -0
  133. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/proxy-agent.d.ts +28 -0
  134. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/readable.d.ts +60 -0
  135. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/retry-agent.d.ts +8 -0
  136. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/retry-handler.d.ts +116 -0
  137. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/util.d.ts +18 -0
  138. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/webidl.d.ts +222 -0
  139. package/generator-adapter/node_modules/mem-fs/node_modules/undici-types/websocket.d.ts +150 -0
  140. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/LICENSE +21 -0
  141. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/README.md +6 -0
  142. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/agent.d.ts +31 -0
  143. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/api.d.ts +43 -0
  144. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/balanced-pool.d.ts +29 -0
  145. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/cache.d.ts +36 -0
  146. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/client.d.ts +108 -0
  147. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/connector.d.ts +34 -0
  148. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/content-type.d.ts +21 -0
  149. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/cookies.d.ts +28 -0
  150. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  151. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/dispatcher.d.ts +255 -0
  152. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  153. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/errors.d.ts +149 -0
  154. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/eventsource.d.ts +61 -0
  155. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/fetch.d.ts +209 -0
  156. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/file.d.ts +39 -0
  157. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/filereader.d.ts +54 -0
  158. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/formdata.d.ts +108 -0
  159. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  160. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/global-origin.d.ts +7 -0
  161. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/handlers.d.ts +15 -0
  162. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/header.d.ts +4 -0
  163. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/index.d.ts +71 -0
  164. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/interceptors.d.ts +17 -0
  165. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/mock-agent.d.ts +50 -0
  166. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/mock-client.d.ts +25 -0
  167. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/mock-errors.d.ts +12 -0
  168. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  169. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/mock-pool.d.ts +25 -0
  170. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/package.json +55 -0
  171. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/patch.d.ts +33 -0
  172. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/pool-stats.d.ts +19 -0
  173. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/pool.d.ts +39 -0
  174. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/proxy-agent.d.ts +28 -0
  175. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/readable.d.ts +60 -0
  176. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/retry-agent.d.ts +8 -0
  177. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/retry-handler.d.ts +116 -0
  178. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/util.d.ts +18 -0
  179. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/webidl.d.ts +222 -0
  180. package/generator-adapter/node_modules/mem-fs-editor/node_modules/undici-types/websocket.d.ts +150 -0
  181. package/generator-adapter/node_modules/undici-types/dispatcher.d.ts +1 -0
  182. package/generator-adapter/node_modules/undici-types/package.json +1 -1
  183. package/generator-adapter/node_modules/undici-types/readable.d.ts +5 -0
  184. package/generator-adapter/node_modules/undici-types/webidl.d.ts +6 -0
  185. package/generator-adapter/package.json +1 -1
  186. package/package.json +11 -11
  187. package/util/group-runner.d.ts +12 -0
  188. package/util/group-runner.js +67 -0
  189. package/util/group-runner.js.map +1 -0
  190. package/util/index.d.ts +1 -1
  191. package/util/testing-utils.d.ts +2 -0
  192. package/util/testing-utils.js +65 -1
  193. package/util/testing-utils.js.map +1 -1
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The `timers/promises` API provides an alternative set of timer functions
3
- * that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`.
3
+ * that return `Promise` objects. The API is accessible via
4
+ * `require('node:timers/promises')`.
4
5
  *
5
6
  * ```js
6
7
  * import {
@@ -10,6 +11,7 @@
10
11
  * } from 'node:timers/promises';
11
12
  * ```
12
13
  * @since v15.0.0
14
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/timers/promises.js)
13
15
  */
14
16
  declare module "timers/promises" {
15
17
  import { TimerOptions } from "node:timers";
@@ -24,7 +26,8 @@ declare module "timers/promises" {
24
26
  * console.log(res); // Prints 'result'
25
27
  * ```
26
28
  * @since v15.0.0
27
- * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
29
+ * @param delay The number of milliseconds to wait before fulfilling the
30
+ * promise. **Default:** `1`.
28
31
  * @param value A value with which the promise is fulfilled.
29
32
  */
30
33
  function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
@@ -62,33 +65,41 @@ declare module "timers/promises" {
62
65
  * console.log(Date.now());
63
66
  * ```
64
67
  * @since v15.9.0
68
+ * @param delay The number of milliseconds to wait between iterations.
69
+ * **Default:** `1`.
70
+ * @param value A value with which the iterator returns.
65
71
  */
66
- function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
72
+ function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): NodeJS.AsyncIterator<T>;
67
73
  interface Scheduler {
68
74
  /**
69
- * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification being developed as a standard Web Platform API.
75
+ * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
76
+ * being developed as a standard Web Platform API.
70
77
  *
71
- * Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent to calling `timersPromises.setTimeout(delay, undefined, options)` except that the `ref`
72
- * option is not supported.
78
+ * Calling `timersPromises.scheduler.wait(delay, options)` is roughly equivalent
79
+ * to calling `timersPromises.setTimeout(delay, undefined, options)` except that
80
+ * the `ref` option is not supported.
73
81
  *
74
82
  * ```js
75
83
  * import { scheduler } from 'node:timers/promises';
76
84
  *
77
85
  * await scheduler.wait(1000); // Wait one second before continuing
78
86
  * ```
79
- * @since v16.14.0
87
+ * @since v17.3.0, v16.14.0
80
88
  * @experimental
81
- * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
89
+ * @param delay The number of milliseconds to wait before resolving the
90
+ * promise.
82
91
  */
83
- wait: (delay?: number, options?: TimerOptions) => Promise<void>;
92
+ wait(delay: number, options?: { signal?: AbortSignal }): Promise<void>;
84
93
  /**
85
- * An experimental API defined by the [Scheduling APIs](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking) draft specification
94
+ * An experimental API defined by the [Scheduling APIs](https://github.com/WICG/scheduling-apis) draft specification
86
95
  * being developed as a standard Web Platform API.
87
- * Calling `timersPromises.scheduler.yield()` is equivalent to calling `timersPromises.setImmediate()` with no arguments.
88
- * @since v16.14.0
96
+ *
97
+ * Calling `timersPromises.scheduler.yield()` is equivalent to calling
98
+ * `timersPromises.setImmediate()` with no arguments.
99
+ * @since v17.3.0, v16.14.0
89
100
  * @experimental
90
101
  */
91
- yield: () => Promise<void>;
102
+ yield(): Promise<void>;
92
103
  }
93
104
  const scheduler: Scheduler;
94
105
  }
@@ -10,12 +10,8 @@
10
10
  */
11
11
  declare module "timers" {
12
12
  import { Abortable } from "node:events";
13
- import {
14
- setImmediate as setImmediatePromise,
15
- setInterval as setIntervalPromise,
16
- setTimeout as setTimeoutPromise,
17
- } from "node:timers/promises";
18
- interface TimerOptions extends Abortable {
13
+ import * as promises from "node:timers/promises";
14
+ export interface TimerOptions extends Abortable {
19
15
  /**
20
16
  * Set to `false` to indicate that the scheduled `Timeout`
21
17
  * should not require the Node.js event loop to remain active.
@@ -23,38 +19,33 @@ declare module "timers" {
23
19
  */
24
20
  ref?: boolean | undefined;
25
21
  }
26
- let setTimeout: typeof global.setTimeout;
27
- let clearTimeout: typeof global.clearTimeout;
28
- let setInterval: typeof global.setInterval;
29
- let clearInterval: typeof global.clearInterval;
30
- let setImmediate: typeof global.setImmediate;
31
- let clearImmediate: typeof global.clearImmediate;
32
22
  global {
33
23
  namespace NodeJS {
34
- // compatibility with older typings
35
- interface Timer extends RefCounted {
36
- hasRef(): boolean;
37
- refresh(): this;
38
- [Symbol.toPrimitive](): number;
39
- }
40
24
  /**
41
25
  * This object is created internally and is returned from `setImmediate()`. It
42
26
  * can be passed to `clearImmediate()` in order to cancel the scheduled
43
27
  * actions.
44
28
  *
45
29
  * By default, when an immediate is scheduled, the Node.js event loop will continue
46
- * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()` functions that can be used to
47
- * control this default behavior.
30
+ * running as long as the immediate is active. The `Immediate` object returned by
31
+ * `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`
32
+ * functions that can be used to control this default behavior.
48
33
  */
49
- class Immediate implements RefCounted {
34
+ interface Immediate extends RefCounted, Disposable {
35
+ /**
36
+ * If true, the `Immediate` object will keep the Node.js event loop active.
37
+ * @since v11.0.0
38
+ */
39
+ hasRef(): boolean;
50
40
  /**
51
- * When called, requests that the Node.js event loop _not_ exit so long as the `Immediate` is active. Calling `immediate.ref()` multiple times will have no
41
+ * When called, requests that the Node.js event loop _not_ exit so long as the
42
+ * `Immediate` is active. Calling `immediate.ref()` multiple times will have no
52
43
  * effect.
53
44
  *
54
45
  * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
55
46
  * to call `immediate.ref()` unless `immediate.unref()` had been called previously.
56
47
  * @since v9.7.0
57
- * @return a reference to `immediate`
48
+ * @returns a reference to `immediate`
58
49
  */
59
50
  ref(): this;
60
51
  /**
@@ -63,53 +54,59 @@ declare module "timers" {
63
54
  * running, the process may exit before the `Immediate` object's callback is
64
55
  * invoked. Calling `immediate.unref()` multiple times will have no effect.
65
56
  * @since v9.7.0
66
- * @return a reference to `immediate`
57
+ * @returns a reference to `immediate`
67
58
  */
68
59
  unref(): this;
69
- /**
70
- * If true, the `Immediate` object will keep the Node.js event loop active.
71
- * @since v11.0.0
72
- */
73
- hasRef(): boolean;
74
- _onImmediate: Function; // to distinguish it from the Timeout class
75
60
  /**
76
61
  * Cancels the immediate. This is similar to calling `clearImmediate()`.
77
- * @since v20.5.0
62
+ * @since v20.5.0, v18.18.0
63
+ * @experimental
78
64
  */
79
65
  [Symbol.dispose](): void;
66
+ _onImmediate(...args: any[]): void;
67
+ }
68
+ // Legacy interface used in Node.js v9 and prior
69
+ // TODO: remove in a future major version bump
70
+ /** @deprecated Use `NodeJS.Timeout` instead. */
71
+ interface Timer extends RefCounted {
72
+ hasRef(): boolean;
73
+ refresh(): this;
74
+ [Symbol.toPrimitive](): number;
80
75
  }
81
76
  /**
82
- * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the
83
- * scheduled actions.
77
+ * This object is created internally and is returned from `setTimeout()` and
78
+ * `setInterval()`. It can be passed to either `clearTimeout()` or
79
+ * `clearInterval()` in order to cancel the scheduled actions.
84
80
  *
85
- * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the
81
+ * By default, when a timer is scheduled using either `setTimeout()` or
82
+ * `setInterval()`, the Node.js event loop will continue running as long as the
86
83
  * timer is active. Each of the `Timeout` objects returned by these functions
87
84
  * export both `timeout.ref()` and `timeout.unref()` functions that can be used to
88
85
  * control this default behavior.
89
86
  */
90
- class Timeout implements Timer {
91
- /**
92
- * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
93
- *
94
- * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
95
- * to call `timeout.ref()` unless `timeout.unref()` had been called previously.
96
- * @since v0.9.1
97
- * @return a reference to `timeout`
98
- */
99
- ref(): this;
87
+ interface Timeout extends RefCounted, Disposable, Timer {
100
88
  /**
101
- * When called, the active `Timeout` object will not require the Node.js event loop
102
- * to remain active. If there is no other activity keeping the event loop running,
103
- * the process may exit before the `Timeout` object's callback is invoked. Calling `timeout.unref()` multiple times will have no effect.
89
+ * Cancels the timeout.
104
90
  * @since v0.9.1
105
- * @return a reference to `timeout`
91
+ * @legacy Use `clearTimeout()` instead.
92
+ * @returns a reference to `timeout`
106
93
  */
107
- unref(): this;
94
+ close(): this;
108
95
  /**
109
96
  * If true, the `Timeout` object will keep the Node.js event loop active.
110
97
  * @since v11.0.0
111
98
  */
112
99
  hasRef(): boolean;
100
+ /**
101
+ * When called, requests that the Node.js event loop _not_ exit so long as the
102
+ * `Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
103
+ *
104
+ * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
105
+ * to call `timeout.ref()` unless `timeout.unref()` had been called previously.
106
+ * @since v0.9.1
107
+ * @returns a reference to `timeout`
108
+ */
109
+ ref(): this;
113
110
  /**
114
111
  * Sets the timer's start time to the current time, and reschedules the timer to
115
112
  * call its callback at the previously specified duration adjusted to the current
@@ -119,121 +116,171 @@ declare module "timers" {
119
116
  * Using this on a timer that has already called its callback will reactivate the
120
117
  * timer.
121
118
  * @since v10.2.0
122
- * @return a reference to `timeout`
119
+ * @returns a reference to `timeout`
123
120
  */
124
121
  refresh(): this;
122
+ /**
123
+ * When called, the active `Timeout` object will not require the Node.js event loop
124
+ * to remain active. If there is no other activity keeping the event loop running,
125
+ * the process may exit before the `Timeout` object's callback is invoked. Calling
126
+ * `timeout.unref()` multiple times will have no effect.
127
+ * @since v0.9.1
128
+ * @returns a reference to `timeout`
129
+ */
130
+ unref(): this;
131
+ /**
132
+ * Coerce a `Timeout` to a primitive. The primitive can be used to
133
+ * clear the `Timeout`. The primitive can only be used in the
134
+ * same thread where the timeout was created. Therefore, to use it
135
+ * across `worker_threads` it must first be passed to the correct
136
+ * thread. This allows enhanced compatibility with browser
137
+ * `setTimeout()` and `setInterval()` implementations.
138
+ * @since v14.9.0, v12.19.0
139
+ */
125
140
  [Symbol.toPrimitive](): number;
126
141
  /**
127
142
  * Cancels the timeout.
128
- * @since v20.5.0
143
+ * @since v20.5.0, v18.18.0
144
+ * @experimental
129
145
  */
130
146
  [Symbol.dispose](): void;
147
+ _onTimeout(...args: any[]): void;
131
148
  }
132
149
  }
133
150
  /**
134
- * Schedules execution of a one-time `callback` after `delay` milliseconds.
135
- *
136
- * The `callback` will likely not be invoked in precisely `delay` milliseconds.
137
- * Node.js makes no guarantees about the exact timing of when callbacks will fire,
138
- * nor of their ordering. The callback will be called as close as possible to the
139
- * time specified.
151
+ * Schedules the "immediate" execution of the `callback` after I/O events'
152
+ * callbacks.
140
153
  *
141
- * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be set to `1`. Non-integer delays are truncated to an integer.
154
+ * When multiple calls to `setImmediate()` are made, the `callback` functions are
155
+ * queued for execution in the order in which they are created. The entire callback
156
+ * queue is processed every event loop iteration. If an immediate timer is queued
157
+ * from inside an executing callback, that timer will not be triggered until the
158
+ * next event loop iteration.
142
159
  *
143
160
  * If `callback` is not a function, a `TypeError` will be thrown.
144
161
  *
145
- * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`.
146
- * @since v0.0.1
147
- * @param callback The function to call when the timer elapses.
148
- * @param [delay=1] The number of milliseconds to wait before calling the `callback`.
162
+ * This method has a custom variant for promises that is available using
163
+ * `timersPromises.setImmediate()`.
164
+ * @since v0.9.1
165
+ * @param callback The function to call at the end of this turn of
166
+ * the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout)
149
167
  * @param args Optional arguments to pass when the `callback` is called.
150
- * @return for use with {@link clearTimeout}
168
+ * @returns for use with `clearImmediate()`
151
169
  */
152
- function setTimeout<TArgs extends any[]>(
170
+ function setImmediate<TArgs extends any[]>(
153
171
  callback: (...args: TArgs) => void,
154
- ms?: number,
155
172
  ...args: TArgs
156
- ): NodeJS.Timeout;
157
- // util.promisify no rest args compability
173
+ ): NodeJS.Immediate;
174
+ // Allow a single void-accepting argument to be optional in arguments lists.
175
+ // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
158
176
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
159
- function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
160
- namespace setTimeout {
161
- const __promisify__: typeof setTimeoutPromise;
177
+ function setImmediate(callback: (_: void) => void): NodeJS.Immediate;
178
+ namespace setImmediate {
179
+ import __promisify__ = promises.setImmediate;
180
+ export { __promisify__ };
162
181
  }
163
- /**
164
- * Cancels a `Timeout` object created by `setTimeout()`.
165
- * @since v0.0.1
166
- * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number.
167
- */
168
- function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
169
182
  /**
170
183
  * Schedules repeated execution of `callback` every `delay` milliseconds.
171
184
  *
172
- * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be
173
- * set to `1`. Non-integer delays are truncated to an integer.
185
+ * When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
186
+ * will be set to `1`. Non-integer delays are truncated to an integer.
174
187
  *
175
188
  * If `callback` is not a function, a `TypeError` will be thrown.
176
189
  *
177
- * This method has a custom variant for promises that is available using `timersPromises.setInterval()`.
190
+ * This method has a custom variant for promises that is available using
191
+ * `timersPromises.setInterval()`.
178
192
  * @since v0.0.1
179
193
  * @param callback The function to call when the timer elapses.
180
- * @param [delay=1] The number of milliseconds to wait before calling the `callback`.
194
+ * @param delay The number of milliseconds to wait before calling the
195
+ * `callback`. **Default:** `1`.
181
196
  * @param args Optional arguments to pass when the `callback` is called.
182
- * @return for use with {@link clearInterval}
197
+ * @returns for use with `clearInterval()`
183
198
  */
184
199
  function setInterval<TArgs extends any[]>(
185
200
  callback: (...args: TArgs) => void,
186
- ms?: number,
201
+ delay?: number,
187
202
  ...args: TArgs
188
203
  ): NodeJS.Timeout;
189
- // util.promisify no rest args compability
204
+ // Allow a single void-accepting argument to be optional in arguments lists.
205
+ // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
190
206
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
191
- function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
192
- namespace setInterval {
193
- const __promisify__: typeof setIntervalPromise;
194
- }
195
- /**
196
- * Cancels a `Timeout` object created by `setInterval()`.
197
- * @since v0.0.1
198
- * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number.
199
- */
200
- function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
207
+ function setInterval(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
201
208
  /**
202
- * Schedules the "immediate" execution of the `callback` after I/O events'
203
- * callbacks.
209
+ * Schedules execution of a one-time `callback` after `delay` milliseconds.
204
210
  *
205
- * When multiple calls to `setImmediate()` are made, the `callback` functions are
206
- * queued for execution in the order in which they are created. The entire callback
207
- * queue is processed every event loop iteration. If an immediate timer is queued
208
- * from inside an executing callback, that timer will not be triggered until the
209
- * next event loop iteration.
211
+ * The `callback` will likely not be invoked in precisely `delay` milliseconds.
212
+ * Node.js makes no guarantees about the exact timing of when callbacks will fire,
213
+ * nor of their ordering. The callback will be called as close as possible to the
214
+ * time specified.
215
+ *
216
+ * When `delay` is larger than `2147483647` or less than `1` or `NaN`, the `delay`
217
+ * will be set to `1`. Non-integer delays are truncated to an integer.
210
218
  *
211
219
  * If `callback` is not a function, a `TypeError` will be thrown.
212
220
  *
213
- * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`.
214
- * @since v0.9.1
215
- * @param callback The function to call at the end of this turn of the Node.js `Event Loop`
221
+ * This method has a custom variant for promises that is available using
222
+ * `timersPromises.setTimeout()`.
223
+ * @since v0.0.1
224
+ * @param callback The function to call when the timer elapses.
225
+ * @param delay The number of milliseconds to wait before calling the
226
+ * `callback`. **Default:** `1`.
216
227
  * @param args Optional arguments to pass when the `callback` is called.
217
- * @return for use with {@link clearImmediate}
228
+ * @returns for use with `clearTimeout()`
218
229
  */
219
- function setImmediate<TArgs extends any[]>(
230
+ function setTimeout<TArgs extends any[]>(
220
231
  callback: (...args: TArgs) => void,
232
+ delay?: number,
221
233
  ...args: TArgs
222
- ): NodeJS.Immediate;
223
- // util.promisify no rest args compability
234
+ ): NodeJS.Timeout;
235
+ // Allow a single void-accepting argument to be optional in arguments lists.
236
+ // Allows usage such as `new Promise(resolve => setTimeout(resolve, ms))` (#54258)
224
237
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
225
- function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
226
- namespace setImmediate {
227
- const __promisify__: typeof setImmediatePromise;
238
+ function setTimeout(callback: (_: void) => void, delay?: number): NodeJS.Timeout;
239
+ namespace setTimeout {
240
+ import __promisify__ = promises.setTimeout;
241
+ export { __promisify__ };
228
242
  }
229
243
  /**
230
244
  * Cancels an `Immediate` object created by `setImmediate()`.
231
245
  * @since v0.9.1
232
- * @param immediate An `Immediate` object as returned by {@link setImmediate}.
246
+ * @param immediate An `Immediate` object as returned by `setImmediate()`.
247
+ */
248
+ function clearImmediate(immediate: NodeJS.Immediate | undefined): void;
249
+ /**
250
+ * Cancels a `Timeout` object created by `setInterval()`.
251
+ * @since v0.0.1
252
+ * @param timeout A `Timeout` object as returned by `setInterval()`
253
+ * or the primitive of the `Timeout` object as a string or a number.
254
+ */
255
+ function clearInterval(timeout: NodeJS.Timeout | string | number | undefined): void;
256
+ /**
257
+ * Cancels a `Timeout` object created by `setTimeout()`.
258
+ * @since v0.0.1
259
+ * @param timeout A `Timeout` object as returned by `setTimeout()`
260
+ * or the primitive of the `Timeout` object as a string or a number.
261
+ */
262
+ function clearTimeout(timeout: NodeJS.Timeout | string | number | undefined): void;
263
+ /**
264
+ * The `queueMicrotask()` method queues a microtask to invoke `callback`. If
265
+ * `callback` throws an exception, the `process` object `'uncaughtException'`
266
+ * event will be emitted.
267
+ *
268
+ * The microtask queue is managed by V8 and may be used in a similar manner to
269
+ * the `process.nextTick()` queue, which is managed by Node.js. The
270
+ * `process.nextTick()` queue is always processed before the microtask queue
271
+ * within each turn of the Node.js event loop.
272
+ * @since v11.0.0
273
+ * @param callback Function to be queued.
233
274
  */
234
- function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
235
275
  function queueMicrotask(callback: () => void): void;
236
276
  }
277
+ import clearImmediate = globalThis.clearImmediate;
278
+ import clearInterval = globalThis.clearInterval;
279
+ import clearTimeout = globalThis.clearTimeout;
280
+ import setImmediate = globalThis.setImmediate;
281
+ import setInterval = globalThis.setInterval;
282
+ import setTimeout = globalThis.setTimeout;
283
+ export { clearImmediate, clearInterval, clearTimeout, promises, setImmediate, setInterval, setTimeout };
237
284
  }
238
285
  declare module "node:timers" {
239
286
  export * from "timers";
@@ -118,6 +118,12 @@ declare module "util" {
118
118
  * function for this call site.
119
119
  */
120
120
  scriptName: string;
121
+ /**
122
+ * Returns the unique id of the script, as in Chrome DevTools protocol
123
+ * [`Runtime.ScriptId`](https://chromedevtools.github.io/devtools-protocol/1-3/Runtime/#type-ScriptId).
124
+ * @since v22.14.0
125
+ */
126
+ scriptId: string;
121
127
  /**
122
128
  * Returns the number, 1-based, of the line for the associate function call.
123
129
  */
@@ -125,7 +131,7 @@ declare module "util" {
125
131
  /**
126
132
  * Returns the 1-based column offset on the line for the associated function call.
127
133
  */
128
- column: number;
134
+ columnNumber: number;
129
135
  }
130
136
  /**
131
137
  * The `util.format()` method returns a formatted string using the first argument
@@ -1572,9 +1578,10 @@ declare module "util" {
1572
1578
  */
1573
1579
  short?: string | undefined;
1574
1580
  /**
1575
- * The default option value when it is not set by args.
1576
- * It must be of the same type as the the `type` property.
1577
- * When `multiple` is `true`, it must be an array.
1581
+ * The default value to
1582
+ * be used if (and only if) the option does not appear in the arguments to be
1583
+ * parsed. It must be of the same type as the `type` property. When `multiple`
1584
+ * is `true`, it must be an array.
1578
1585
  * @since v18.11.0
1579
1586
  */
1580
1587
  default?: string | boolean | string[] | boolean[] | undefined;
@@ -60,6 +60,7 @@ declare module "worker_threads" {
60
60
  import { Readable, Writable } from "node:stream";
61
61
  import { URL } from "node:url";
62
62
  import { X509Certificate } from "node:crypto";
63
+ const isInternalThread: boolean;
63
64
  const isMainThread: boolean;
64
65
  const parentPort: null | MessagePort;
65
66
  const resourceLimits: ResourceLimits;
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Matteo Collina and Undici contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # undici-types
2
+
3
+ This package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version.
4
+
5
+ - [GitHub nodejs/undici](https://github.com/nodejs/undici)
6
+ - [Undici Documentation](https://undici.nodejs.org/#/)
@@ -0,0 +1,31 @@
1
+ import { URL } from 'url'
2
+ import Pool from './pool'
3
+ import Dispatcher from "./dispatcher";
4
+
5
+ export default Agent
6
+
7
+ declare class Agent extends Dispatcher{
8
+ constructor(opts?: Agent.Options)
9
+ /** `true` after `dispatcher.close()` has been called. */
10
+ closed: boolean;
11
+ /** `true` after `dispatcher.destroyed()` has been called or `dispatcher.close()` has been called and the dispatcher shutdown has completed. */
12
+ destroyed: boolean;
13
+ /** Dispatches a request. */
14
+ dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
15
+ }
16
+
17
+ declare namespace Agent {
18
+ export interface Options extends Pool.Options {
19
+ /** Default: `(origin, opts) => new Pool(origin, opts)`. */
20
+ factory?(origin: string | URL, opts: Object): Dispatcher;
21
+ /** Integer. Default: `0` */
22
+ maxRedirections?: number;
23
+
24
+ interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options["interceptors"]
25
+ }
26
+
27
+ export interface DispatchOptions extends Dispatcher.DispatchOptions {
28
+ /** Integer. */
29
+ maxRedirections?: number;
30
+ }
31
+ }
@@ -0,0 +1,43 @@
1
+ import { URL, UrlObject } from 'url'
2
+ import { Duplex } from 'stream'
3
+ import Dispatcher from './dispatcher'
4
+
5
+ export {
6
+ request,
7
+ stream,
8
+ pipeline,
9
+ connect,
10
+ upgrade,
11
+ }
12
+
13
+ /** Performs an HTTP request. */
14
+ declare function request(
15
+ url: string | URL | UrlObject,
16
+ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
17
+ ): Promise<Dispatcher.ResponseData>;
18
+
19
+ /** A faster version of `request`. */
20
+ declare function stream(
21
+ url: string | URL | UrlObject,
22
+ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path'>,
23
+ factory: Dispatcher.StreamFactory
24
+ ): Promise<Dispatcher.StreamData>;
25
+
26
+ /** For easy use with `stream.pipeline`. */
27
+ declare function pipeline(
28
+ url: string | URL | UrlObject,
29
+ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.PipelineOptions, 'origin' | 'path'>,
30
+ handler: Dispatcher.PipelineHandler
31
+ ): Duplex;
32
+
33
+ /** Starts two-way communications with the requested resource. */
34
+ declare function connect(
35
+ url: string | URL | UrlObject,
36
+ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.ConnectOptions, 'origin' | 'path'>
37
+ ): Promise<Dispatcher.ConnectData>;
38
+
39
+ /** Upgrade to a different protocol. */
40
+ declare function upgrade(
41
+ url: string | URL | UrlObject,
42
+ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.UpgradeOptions, 'origin' | 'path'>
43
+ ): Promise<Dispatcher.UpgradeData>;
@@ -0,0 +1,29 @@
1
+ import Pool from './pool'
2
+ import Dispatcher from './dispatcher'
3
+ import { URL } from 'url'
4
+
5
+ export default BalancedPool
6
+
7
+ type BalancedPoolConnectOptions = Omit<Dispatcher.ConnectOptions, "origin">;
8
+
9
+ declare class BalancedPool extends Dispatcher {
10
+ constructor(url: string | string[] | URL | URL[], options?: Pool.Options);
11
+
12
+ addUpstream(upstream: string | URL): BalancedPool;
13
+ removeUpstream(upstream: string | URL): BalancedPool;
14
+ upstreams: Array<string>;
15
+
16
+ /** `true` after `pool.close()` has been called. */
17
+ closed: boolean;
18
+ /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
19
+ destroyed: boolean;
20
+
21
+ // Override dispatcher APIs.
22
+ override connect(
23
+ options: BalancedPoolConnectOptions
24
+ ): Promise<Dispatcher.ConnectData>;
25
+ override connect(
26
+ options: BalancedPoolConnectOptions,
27
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
28
+ ): void;
29
+ }