cdk-common 2.0.1201 → 2.0.1203

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 (217) hide show
  1. package/.jsii +3 -3
  2. package/lib/main.js +1 -1
  3. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  4. package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +5 -5
  5. package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +26 -6
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +1 -2
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +2 -2
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +15 -15
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +17 -17
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +35 -28
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +1 -1
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +16 -16
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +1 -1
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +1 -2
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +16 -9
  17. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +28 -19
  18. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +7 -6
  19. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.typedarray.d.ts +1 -0
  20. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +2 -2
  21. package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +6 -3
  22. package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +1 -1
  23. package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +7 -5
  24. package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +3 -7
  25. package/node_modules/@types/concat-stream/node_modules/@types/node/module.d.ts +63 -29
  26. package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +2 -5
  27. package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +8 -7
  28. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +13 -3
  29. package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +1 -1
  30. package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +8 -8
  31. package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +21 -11
  32. package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +1 -1
  33. package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +1 -1
  34. package/node_modules/@types/concat-stream/node_modules/@types/node/readline/promises.d.ts +0 -1
  35. package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +13 -13
  36. package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +14 -16
  37. package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +1 -1
  38. package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +182 -2
  39. package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +8 -19
  40. package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +1 -1
  41. package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +53 -15
  42. package/node_modules/@types/concat-stream/node_modules/@types/node/timers/promises.d.ts +1 -1
  43. package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +1 -1
  44. package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +2 -48
  45. package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +6 -6
  46. package/node_modules/@types/concat-stream/node_modules/@types/node/{compatibility → ts5.1/compatibility}/disposable.d.ts +0 -4
  47. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.1/index.d.ts +98 -0
  48. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  49. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +1 -0
  50. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/index.d.ts +9 -5
  51. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  52. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.7/index.d.ts +96 -0
  53. package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +1 -1
  54. package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +52 -19
  55. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +16 -295
  56. package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +29 -32
  57. package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +17 -10
  58. package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +1 -1
  59. package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +34 -18
  60. package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +5 -7
  61. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/agent.d.ts +7 -7
  62. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/api.d.ts +24 -24
  63. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/balanced-pool.d.ts +11 -11
  64. package/node_modules/@types/concat-stream/node_modules/undici-types/cache-interceptor.d.ts +172 -0
  65. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/client.d.ts +12 -13
  66. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/cookies.d.ts +2 -0
  67. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/diagnostics-channel.d.ts +10 -10
  68. package/node_modules/@types/concat-stream/node_modules/undici-types/dispatcher.d.ts +281 -0
  69. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/env-http-proxy-agent.d.ts +2 -2
  70. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/errors.d.ts +69 -47
  71. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/fetch.d.ts +17 -16
  72. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/formdata.d.ts +7 -7
  73. package/node_modules/@types/concat-stream/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  74. package/node_modules/@types/concat-stream/node_modules/undici-types/global-origin.d.ts +7 -0
  75. package/node_modules/@types/concat-stream/node_modules/undici-types/h2c-client.d.ts +75 -0
  76. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/handlers.d.ts +7 -7
  77. package/node_modules/@types/concat-stream/node_modules/undici-types/header.d.ts +160 -0
  78. package/node_modules/@types/concat-stream/node_modules/undici-types/index.d.ts +75 -0
  79. package/node_modules/@types/concat-stream/node_modules/undici-types/interceptors.d.ts +34 -0
  80. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/mock-agent.d.ts +33 -18
  81. package/node_modules/@types/concat-stream/node_modules/undici-types/mock-call-history.d.ts +111 -0
  82. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/mock-client.d.ts +4 -4
  83. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/mock-errors.d.ts +3 -3
  84. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/mock-interceptor.d.ts +19 -19
  85. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/mock-pool.d.ts +4 -4
  86. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/package.json +1 -1
  87. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/patch.d.ts +0 -4
  88. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/pool-stats.d.ts +8 -8
  89. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/pool.d.ts +12 -12
  90. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/proxy-agent.d.ts +4 -4
  91. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/readable.d.ts +18 -15
  92. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/retry-agent.d.ts +1 -1
  93. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/retry-handler.d.ts +10 -10
  94. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/util.d.ts +3 -3
  95. package/node_modules/@types/concat-stream/node_modules/undici-types/utility.d.ts +7 -0
  96. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/webidl.d.ts +44 -6
  97. package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/websocket.d.ts +35 -1
  98. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  99. package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +5 -5
  100. package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +26 -6
  101. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +1 -2
  102. package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +2 -2
  103. package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +15 -15
  104. package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +17 -17
  105. package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +35 -28
  106. package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +1 -1
  107. package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  108. package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +16 -16
  109. package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +1 -1
  110. package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +1 -2
  111. package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +16 -9
  112. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +28 -19
  113. package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +7 -6
  114. package/node_modules/@types/form-data/node_modules/@types/node/globals.typedarray.d.ts +1 -0
  115. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +2 -2
  116. package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +6 -3
  117. package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +1 -1
  118. package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +7 -5
  119. package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +3 -7
  120. package/node_modules/@types/form-data/node_modules/@types/node/module.d.ts +63 -29
  121. package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +2 -5
  122. package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +8 -7
  123. package/node_modules/@types/form-data/node_modules/@types/node/package.json +13 -3
  124. package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +1 -1
  125. package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +8 -8
  126. package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +21 -11
  127. package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +1 -1
  128. package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +1 -1
  129. package/node_modules/@types/form-data/node_modules/@types/node/readline/promises.d.ts +0 -1
  130. package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +13 -13
  131. package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +14 -16
  132. package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +1 -1
  133. package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +182 -2
  134. package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +8 -19
  135. package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +1 -1
  136. package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +53 -15
  137. package/node_modules/@types/form-data/node_modules/@types/node/timers/promises.d.ts +1 -1
  138. package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +1 -1
  139. package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +2 -48
  140. package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +6 -6
  141. package/node_modules/@types/form-data/node_modules/@types/node/{compatibility → ts5.1/compatibility}/disposable.d.ts +0 -4
  142. package/node_modules/@types/form-data/node_modules/@types/node/ts5.1/index.d.ts +98 -0
  143. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  144. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +1 -0
  145. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/index.d.ts +9 -5
  146. package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  147. package/node_modules/@types/form-data/node_modules/@types/node/ts5.7/index.d.ts +96 -0
  148. package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +1 -1
  149. package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +52 -19
  150. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +16 -295
  151. package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +29 -32
  152. package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +17 -10
  153. package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +1 -1
  154. package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +34 -18
  155. package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +5 -7
  156. package/node_modules/@types/form-data/node_modules/undici-types/LICENSE +21 -0
  157. package/node_modules/@types/form-data/node_modules/undici-types/README.md +6 -0
  158. package/node_modules/@types/form-data/node_modules/undici-types/agent.d.ts +31 -0
  159. package/node_modules/@types/form-data/node_modules/undici-types/api.d.ts +43 -0
  160. package/node_modules/@types/form-data/node_modules/undici-types/balanced-pool.d.ts +29 -0
  161. package/node_modules/@types/form-data/node_modules/undici-types/cache-interceptor.d.ts +172 -0
  162. package/node_modules/@types/form-data/node_modules/undici-types/cache.d.ts +36 -0
  163. package/node_modules/@types/form-data/node_modules/undici-types/client.d.ts +107 -0
  164. package/node_modules/@types/form-data/node_modules/undici-types/connector.d.ts +34 -0
  165. package/node_modules/@types/form-data/node_modules/undici-types/content-type.d.ts +21 -0
  166. package/node_modules/@types/form-data/node_modules/undici-types/cookies.d.ts +30 -0
  167. package/node_modules/@types/form-data/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  168. package/node_modules/@types/form-data/node_modules/undici-types/dispatcher.d.ts +281 -0
  169. package/node_modules/@types/form-data/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  170. package/node_modules/@types/form-data/node_modules/undici-types/errors.d.ts +171 -0
  171. package/node_modules/@types/form-data/node_modules/undici-types/eventsource.d.ts +61 -0
  172. package/node_modules/@types/form-data/node_modules/undici-types/fetch.d.ts +210 -0
  173. package/node_modules/@types/form-data/node_modules/undici-types/formdata.d.ts +108 -0
  174. package/node_modules/@types/form-data/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  175. package/node_modules/@types/form-data/node_modules/undici-types/global-origin.d.ts +7 -0
  176. package/node_modules/@types/form-data/node_modules/undici-types/h2c-client.d.ts +75 -0
  177. package/node_modules/@types/form-data/node_modules/undici-types/handlers.d.ts +15 -0
  178. package/node_modules/@types/form-data/node_modules/undici-types/header.d.ts +160 -0
  179. package/node_modules/@types/form-data/node_modules/undici-types/index.d.ts +75 -0
  180. package/node_modules/@types/form-data/node_modules/undici-types/interceptors.d.ts +34 -0
  181. package/node_modules/@types/form-data/node_modules/undici-types/mock-agent.d.ts +65 -0
  182. package/node_modules/@types/form-data/node_modules/undici-types/mock-call-history.d.ts +111 -0
  183. package/node_modules/@types/form-data/node_modules/undici-types/mock-client.d.ts +25 -0
  184. package/node_modules/@types/form-data/node_modules/undici-types/mock-errors.d.ts +12 -0
  185. package/node_modules/@types/form-data/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  186. package/node_modules/@types/form-data/node_modules/undici-types/mock-pool.d.ts +25 -0
  187. package/node_modules/@types/form-data/node_modules/undici-types/package.json +55 -0
  188. package/node_modules/@types/form-data/node_modules/undici-types/patch.d.ts +29 -0
  189. package/node_modules/@types/form-data/node_modules/undici-types/pool-stats.d.ts +19 -0
  190. package/node_modules/@types/form-data/node_modules/undici-types/pool.d.ts +39 -0
  191. package/node_modules/@types/form-data/node_modules/undici-types/proxy-agent.d.ts +28 -0
  192. package/node_modules/@types/form-data/node_modules/undici-types/readable.d.ts +68 -0
  193. package/node_modules/@types/form-data/node_modules/undici-types/retry-agent.d.ts +8 -0
  194. package/node_modules/@types/form-data/node_modules/undici-types/retry-handler.d.ts +116 -0
  195. package/node_modules/@types/form-data/node_modules/undici-types/util.d.ts +18 -0
  196. package/node_modules/@types/form-data/node_modules/undici-types/utility.d.ts +7 -0
  197. package/node_modules/@types/form-data/node_modules/undici-types/webidl.d.ts +266 -0
  198. package/node_modules/@types/form-data/node_modules/undici-types/websocket.d.ts +184 -0
  199. package/package.json +2 -2
  200. package/node_modules/@types/concat-stream/node_modules/@types/node/compatibility/index.d.ts +0 -9
  201. package/node_modules/@types/concat-stream/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  202. package/node_modules/@types/form-data/node_modules/@types/node/compatibility/index.d.ts +0 -9
  203. package/node_modules/@types/form-data/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  204. package/node_modules/undici-types/dispatcher.d.ts +0 -256
  205. package/node_modules/undici-types/file.d.ts +0 -39
  206. package/node_modules/undici-types/filereader.d.ts +0 -54
  207. package/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  208. package/node_modules/undici-types/global-origin.d.ts +0 -7
  209. package/node_modules/undici-types/header.d.ts +0 -4
  210. package/node_modules/undici-types/index.d.ts +0 -71
  211. package/node_modules/undici-types/interceptors.d.ts +0 -17
  212. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/LICENSE +0 -0
  213. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/README.md +0 -0
  214. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/cache.d.ts +0 -0
  215. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/connector.d.ts +0 -0
  216. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/content-type.d.ts +0 -0
  217. /package/node_modules/{undici-types → @types/concat-stream/node_modules/undici-types}/eventsource.d.ts +0 -0
@@ -0,0 +1,281 @@
1
+ import { URL } from 'url'
2
+ import { Duplex, Readable, Writable } from 'stream'
3
+ import { EventEmitter } from 'events'
4
+ import { Blob } from 'buffer'
5
+ import { IncomingHttpHeaders } from './header'
6
+ import BodyReadable from './readable'
7
+ import { FormData } from './formdata'
8
+ import Errors from './errors'
9
+ import { Autocomplete } from './utility'
10
+
11
+ type AbortSignal = unknown
12
+
13
+ export default Dispatcher
14
+
15
+ export type UndiciHeaders = Record<string, string | string[]> | IncomingHttpHeaders | string[] | Iterable<[string, string | string[] | undefined]> | null
16
+
17
+ /** Dispatcher is the core API used to dispatch requests. */
18
+ declare class Dispatcher extends EventEmitter {
19
+ /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
20
+ dispatch (options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
21
+ /** Starts two-way communications with the requested resource. */
22
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>): Promise<Dispatcher.ConnectData<TOpaque>>
23
+ connect<TOpaque = null>(options: Dispatcher.ConnectOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ConnectData<TOpaque>) => void): void
24
+ /** Compose a chain of dispatchers */
25
+ compose (dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
26
+ compose (...dispatchers: Dispatcher.DispatcherComposeInterceptor[]): Dispatcher.ComposedDispatcher
27
+ /** Performs an HTTP request. */
28
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>): Promise<Dispatcher.ResponseData<TOpaque>>
29
+ request<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, callback: (err: Error | null, data: Dispatcher.ResponseData<TOpaque>) => void): void
30
+ /** For easy use with `stream.pipeline`. */
31
+ pipeline<TOpaque = null>(options: Dispatcher.PipelineOptions<TOpaque>, handler: Dispatcher.PipelineHandler<TOpaque>): Duplex
32
+ /** A faster version of `Dispatcher.request`. */
33
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>): Promise<Dispatcher.StreamData<TOpaque>>
34
+ stream<TOpaque = null>(options: Dispatcher.RequestOptions<TOpaque>, factory: Dispatcher.StreamFactory<TOpaque>, callback: (err: Error | null, data: Dispatcher.StreamData<TOpaque>) => void): void
35
+ /** Upgrade to a different protocol. */
36
+ upgrade (options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>
37
+ upgrade (options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void
38
+ /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
39
+ close (): Promise<void>
40
+ close (callback: () => void): void
41
+ /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
42
+ destroy (): Promise<void>
43
+ destroy (err: Error | null): Promise<void>
44
+ destroy (callback: () => void): void
45
+ destroy (err: Error | null, callback: () => void): void
46
+
47
+ on (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
48
+ on (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
49
+ on (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
50
+ on (eventName: 'drain', callback: (origin: URL) => void): this
51
+
52
+ once (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
53
+ once (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
54
+ once (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
55
+ once (eventName: 'drain', callback: (origin: URL) => void): this
56
+
57
+ off (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
58
+ off (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
59
+ off (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
60
+ off (eventName: 'drain', callback: (origin: URL) => void): this
61
+
62
+ addListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
63
+ addListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
64
+ addListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
65
+ addListener (eventName: 'drain', callback: (origin: URL) => void): this
66
+
67
+ removeListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
68
+ removeListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
69
+ removeListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
70
+ removeListener (eventName: 'drain', callback: (origin: URL) => void): this
71
+
72
+ prependListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
73
+ prependListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
74
+ prependListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
75
+ prependListener (eventName: 'drain', callback: (origin: URL) => void): this
76
+
77
+ prependOnceListener (eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this
78
+ prependOnceListener (eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
79
+ prependOnceListener (eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this
80
+ prependOnceListener (eventName: 'drain', callback: (origin: URL) => void): this
81
+
82
+ listeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
83
+ listeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
84
+ listeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
85
+ listeners (eventName: 'drain'): ((origin: URL) => void)[]
86
+
87
+ rawListeners (eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[]
88
+ rawListeners (eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
89
+ rawListeners (eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]
90
+ rawListeners (eventName: 'drain'): ((origin: URL) => void)[]
91
+
92
+ emit (eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean
93
+ emit (eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
94
+ emit (eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean
95
+ emit (eventName: 'drain', origin: URL): boolean
96
+ }
97
+
98
+ declare namespace Dispatcher {
99
+ export interface ComposedDispatcher extends Dispatcher {}
100
+ export type DispatcherComposeInterceptor = (dispatch: Dispatcher['dispatch']) => Dispatcher['dispatch']
101
+ export interface DispatchOptions {
102
+ origin?: string | URL;
103
+ path: string;
104
+ method: HttpMethod;
105
+ /** Default: `null` */
106
+ body?: string | Buffer | Uint8Array | Readable | null | FormData;
107
+ /** Default: `null` */
108
+ headers?: UndiciHeaders;
109
+ /** Query string params to be embedded in the request URL. Default: `null` */
110
+ query?: Record<string, any>;
111
+ /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
112
+ idempotent?: boolean;
113
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. Defaults to `method !== 'HEAD'`. */
114
+ blocking?: boolean;
115
+ /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
116
+ upgrade?: boolean | string | null;
117
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
118
+ headersTimeout?: number | null;
119
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
120
+ bodyTimeout?: number | null;
121
+ /** Whether the request should stablish a keep-alive or not. Default `false` */
122
+ reset?: boolean;
123
+ /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
124
+ throwOnError?: boolean;
125
+ /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server */
126
+ expectContinue?: boolean;
127
+ }
128
+ export interface ConnectOptions<TOpaque = null> {
129
+ origin: string | URL;
130
+ path: string;
131
+ /** Default: `null` */
132
+ headers?: UndiciHeaders;
133
+ /** Default: `null` */
134
+ signal?: AbortSignal | EventEmitter | null;
135
+ /** This argument parameter is passed through to `ConnectData` */
136
+ opaque?: TOpaque;
137
+ /** Default: 0 */
138
+ maxRedirections?: number;
139
+ /** Default: false */
140
+ redirectionLimitReached?: boolean;
141
+ /** Default: `null` */
142
+ responseHeaders?: 'raw' | null;
143
+ }
144
+ export interface RequestOptions<TOpaque = null> extends DispatchOptions {
145
+ /** Default: `null` */
146
+ opaque?: TOpaque;
147
+ /** Default: `null` */
148
+ signal?: AbortSignal | EventEmitter | null;
149
+ /** Default: 0 */
150
+ maxRedirections?: number;
151
+ /** Default: false */
152
+ redirectionLimitReached?: boolean;
153
+ /** Default: `null` */
154
+ onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
155
+ /** Default: `null` */
156
+ responseHeaders?: 'raw' | null;
157
+ /** Default: `64 KiB` */
158
+ highWaterMark?: number;
159
+ }
160
+ export interface PipelineOptions<TOpaque = null> extends RequestOptions<TOpaque> {
161
+ /** `true` if the `handler` will return an object stream. Default: `false` */
162
+ objectMode?: boolean;
163
+ }
164
+ export interface UpgradeOptions {
165
+ path: string;
166
+ /** Default: `'GET'` */
167
+ method?: string;
168
+ /** Default: `null` */
169
+ headers?: UndiciHeaders;
170
+ /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
171
+ protocol?: string;
172
+ /** Default: `null` */
173
+ signal?: AbortSignal | EventEmitter | null;
174
+ /** Default: 0 */
175
+ maxRedirections?: number;
176
+ /** Default: false */
177
+ redirectionLimitReached?: boolean;
178
+ /** Default: `null` */
179
+ responseHeaders?: 'raw' | null;
180
+ }
181
+ export interface ConnectData<TOpaque = null> {
182
+ statusCode: number;
183
+ headers: IncomingHttpHeaders;
184
+ socket: Duplex;
185
+ opaque: TOpaque;
186
+ }
187
+ export interface ResponseData<TOpaque = null> {
188
+ statusCode: number;
189
+ headers: IncomingHttpHeaders;
190
+ body: BodyReadable & BodyMixin;
191
+ trailers: Record<string, string>;
192
+ opaque: TOpaque;
193
+ context: object;
194
+ }
195
+ export interface PipelineHandlerData<TOpaque = null> {
196
+ statusCode: number;
197
+ headers: IncomingHttpHeaders;
198
+ opaque: TOpaque;
199
+ body: BodyReadable;
200
+ context: object;
201
+ }
202
+ export interface StreamData<TOpaque = null> {
203
+ opaque: TOpaque;
204
+ trailers: Record<string, string>;
205
+ }
206
+ export interface UpgradeData<TOpaque = null> {
207
+ headers: IncomingHttpHeaders;
208
+ socket: Duplex;
209
+ opaque: TOpaque;
210
+ }
211
+ export interface StreamFactoryData<TOpaque = null> {
212
+ statusCode: number;
213
+ headers: IncomingHttpHeaders;
214
+ opaque: TOpaque;
215
+ context: object;
216
+ }
217
+ export type StreamFactory<TOpaque = null> = (data: StreamFactoryData<TOpaque>) => Writable
218
+
219
+ export interface DispatchController {
220
+ get aborted () : boolean
221
+ get paused () : boolean
222
+ get reason () : Error | null
223
+ abort (reason: Error): void
224
+ pause(): void
225
+ resume(): void
226
+ }
227
+
228
+ export interface DispatchHandler {
229
+ onRequestStart?(controller: DispatchController, context: any): void;
230
+ onRequestUpgrade?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, socket: Duplex): void;
231
+ onResponseStart?(controller: DispatchController, statusCode: number, headers: IncomingHttpHeaders, statusMessage?: string): void;
232
+ onResponseData?(controller: DispatchController, chunk: Buffer): void;
233
+ onResponseEnd?(controller: DispatchController, trailers: IncomingHttpHeaders): void;
234
+ onResponseError?(controller: DispatchController, error: Error): void;
235
+
236
+ /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
237
+ /** @deprecated */
238
+ onConnect?(abort: (err?: Error) => void): void;
239
+ /** Invoked when an error has occurred. */
240
+ /** @deprecated */
241
+ onError?(err: Error): void;
242
+ /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
243
+ /** @deprecated */
244
+ onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
245
+ /** Invoked when response is received, before headers have been read. **/
246
+ /** @deprecated */
247
+ onResponseStarted?(): void;
248
+ /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
249
+ /** @deprecated */
250
+ onHeaders?(statusCode: number, headers: Buffer[], resume: () => void, statusText: string): boolean;
251
+ /** Invoked when response payload data is received. */
252
+ /** @deprecated */
253
+ onData?(chunk: Buffer): boolean;
254
+ /** Invoked when response payload and trailers have been received and the request has completed. */
255
+ /** @deprecated */
256
+ onComplete?(trailers: string[] | null): void;
257
+ /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
258
+ /** @deprecated */
259
+ onBodySent?(chunkSize: number, totalBytesSent: number): void;
260
+ }
261
+ export type PipelineHandler<TOpaque = null> = (data: PipelineHandlerData<TOpaque>) => Readable
262
+ export type HttpMethod = Autocomplete<'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'>
263
+
264
+ /**
265
+ * @link https://fetch.spec.whatwg.org/#body-mixin
266
+ */
267
+ interface BodyMixin {
268
+ readonly body?: never;
269
+ readonly bodyUsed: boolean;
270
+ arrayBuffer(): Promise<ArrayBuffer>;
271
+ blob(): Promise<Blob>;
272
+ bytes(): Promise<Uint8Array>;
273
+ formData(): Promise<never>;
274
+ json(): Promise<unknown>;
275
+ text(): Promise<string>;
276
+ }
277
+
278
+ export interface DispatchInterceptor {
279
+ (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
280
+ }
281
+ }
@@ -4,9 +4,9 @@ import Dispatcher from './dispatcher'
4
4
  export default EnvHttpProxyAgent
5
5
 
6
6
  declare class EnvHttpProxyAgent extends Dispatcher {
7
- constructor(opts?: EnvHttpProxyAgent.Options)
7
+ constructor (opts?: EnvHttpProxyAgent.Options)
8
8
 
9
- dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
9
+ dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
10
10
  }
11
11
 
12
12
  declare namespace EnvHttpProxyAgent {
@@ -1,24 +1,24 @@
1
- import { IncomingHttpHeaders } from "./header";
1
+ import { IncomingHttpHeaders } from './header'
2
2
  import Client from './client'
3
3
 
4
4
  export default Errors
5
5
 
6
6
  declare namespace Errors {
7
7
  export class UndiciError extends Error {
8
- name: string;
9
- code: string;
8
+ name: string
9
+ code: string
10
10
  }
11
11
 
12
12
  /** Connect timeout error. */
13
13
  export class ConnectTimeoutError extends UndiciError {
14
- name: 'ConnectTimeoutError';
15
- code: 'UND_ERR_CONNECT_TIMEOUT';
14
+ name: 'ConnectTimeoutError'
15
+ code: 'UND_ERR_CONNECT_TIMEOUT'
16
16
  }
17
17
 
18
18
  /** A header exceeds the `headersTimeout` option. */
19
19
  export class HeadersTimeoutError extends UndiciError {
20
- name: 'HeadersTimeoutError';
21
- code: 'UND_ERR_HEADERS_TIMEOUT';
20
+ name: 'HeadersTimeoutError'
21
+ code: 'UND_ERR_HEADERS_TIMEOUT'
22
22
  }
23
23
 
24
24
  /** Headers overflow error. */
@@ -29,8 +29,24 @@ declare namespace Errors {
29
29
 
30
30
  /** A body exceeds the `bodyTimeout` option. */
31
31
  export class BodyTimeoutError extends UndiciError {
32
- name: 'BodyTimeoutError';
33
- code: 'UND_ERR_BODY_TIMEOUT';
32
+ name: 'BodyTimeoutError'
33
+ code: 'UND_ERR_BODY_TIMEOUT'
34
+ }
35
+
36
+ export class ResponseError extends UndiciError {
37
+ constructor (
38
+ message: string,
39
+ code: number,
40
+ options: {
41
+ headers?: IncomingHttpHeaders | string[] | null,
42
+ body?: null | Record<string, any> | string
43
+ }
44
+ )
45
+ name: 'ResponseError'
46
+ code: 'UND_ERR_RESPONSE'
47
+ statusCode: number
48
+ body: null | Record<string, any> | string
49
+ headers: IncomingHttpHeaders | string[] | null
34
50
  }
35
51
 
36
52
  export class ResponseStatusCodeError extends UndiciError {
@@ -39,91 +55,91 @@ declare namespace Errors {
39
55
  statusCode?: number,
40
56
  headers?: IncomingHttpHeaders | string[] | null,
41
57
  body?: null | Record<string, any> | string
42
- );
43
- name: 'ResponseStatusCodeError';
44
- code: 'UND_ERR_RESPONSE_STATUS_CODE';
58
+ )
59
+ name: 'ResponseStatusCodeError'
60
+ code: 'UND_ERR_RESPONSE_STATUS_CODE'
45
61
  body: null | Record<string, any> | string
46
62
  status: number
47
63
  statusCode: number
48
- headers: IncomingHttpHeaders | string[] | null;
64
+ headers: IncomingHttpHeaders | string[] | null
49
65
  }
50
66
 
51
67
  /** Passed an invalid argument. */
52
68
  export class InvalidArgumentError extends UndiciError {
53
- name: 'InvalidArgumentError';
54
- code: 'UND_ERR_INVALID_ARG';
69
+ name: 'InvalidArgumentError'
70
+ code: 'UND_ERR_INVALID_ARG'
55
71
  }
56
72
 
57
73
  /** Returned an invalid value. */
58
74
  export class InvalidReturnValueError extends UndiciError {
59
- name: 'InvalidReturnValueError';
60
- code: 'UND_ERR_INVALID_RETURN_VALUE';
75
+ name: 'InvalidReturnValueError'
76
+ code: 'UND_ERR_INVALID_RETURN_VALUE'
61
77
  }
62
78
 
63
79
  /** The request has been aborted by the user. */
64
80
  export class RequestAbortedError extends UndiciError {
65
- name: 'AbortError';
66
- code: 'UND_ERR_ABORTED';
81
+ name: 'AbortError'
82
+ code: 'UND_ERR_ABORTED'
67
83
  }
68
84
 
69
85
  /** Expected error with reason. */
70
86
  export class InformationalError extends UndiciError {
71
- name: 'InformationalError';
72
- code: 'UND_ERR_INFO';
87
+ name: 'InformationalError'
88
+ code: 'UND_ERR_INFO'
73
89
  }
74
90
 
75
91
  /** Request body length does not match content-length header. */
76
92
  export class RequestContentLengthMismatchError extends UndiciError {
77
- name: 'RequestContentLengthMismatchError';
78
- code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
93
+ name: 'RequestContentLengthMismatchError'
94
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'
79
95
  }
80
96
 
81
97
  /** Response body length does not match content-length header. */
82
98
  export class ResponseContentLengthMismatchError extends UndiciError {
83
- name: 'ResponseContentLengthMismatchError';
84
- code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
99
+ name: 'ResponseContentLengthMismatchError'
100
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'
85
101
  }
86
102
 
87
103
  /** Trying to use a destroyed client. */
88
104
  export class ClientDestroyedError extends UndiciError {
89
- name: 'ClientDestroyedError';
90
- code: 'UND_ERR_DESTROYED';
105
+ name: 'ClientDestroyedError'
106
+ code: 'UND_ERR_DESTROYED'
91
107
  }
92
108
 
93
109
  /** Trying to use a closed client. */
94
110
  export class ClientClosedError extends UndiciError {
95
- name: 'ClientClosedError';
96
- code: 'UND_ERR_CLOSED';
111
+ name: 'ClientClosedError'
112
+ code: 'UND_ERR_CLOSED'
97
113
  }
98
114
 
99
115
  /** There is an error with the socket. */
100
116
  export class SocketError extends UndiciError {
101
- name: 'SocketError';
102
- code: 'UND_ERR_SOCKET';
117
+ name: 'SocketError'
118
+ code: 'UND_ERR_SOCKET'
103
119
  socket: Client.SocketInfo | null
104
120
  }
105
121
 
106
122
  /** Encountered unsupported functionality. */
107
123
  export class NotSupportedError extends UndiciError {
108
- name: 'NotSupportedError';
109
- code: 'UND_ERR_NOT_SUPPORTED';
124
+ name: 'NotSupportedError'
125
+ code: 'UND_ERR_NOT_SUPPORTED'
110
126
  }
111
127
 
112
128
  /** No upstream has been added to the BalancedPool. */
113
129
  export class BalancedPoolMissingUpstreamError extends UndiciError {
114
- name: 'MissingUpstreamError';
115
- code: 'UND_ERR_BPL_MISSING_UPSTREAM';
130
+ name: 'MissingUpstreamError'
131
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM'
116
132
  }
117
133
 
118
134
  export class HTTPParserError extends UndiciError {
119
- name: 'HTTPParserError';
120
- code: string;
135
+ name: 'HTTPParserError'
136
+ code: string
121
137
  }
122
138
 
123
139
  /** The response exceed the length allowed. */
124
140
  export class ResponseExceededMaxSizeError extends UndiciError {
125
- name: 'ResponseExceededMaxSizeError';
126
- code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
141
+ name: 'ResponseExceededMaxSizeError'
142
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'
127
143
  }
128
144
 
129
145
  export class RequestRetryError extends UndiciError {
@@ -132,18 +148,24 @@ declare namespace Errors {
132
148
  statusCode: number,
133
149
  headers?: IncomingHttpHeaders | string[] | null,
134
150
  body?: null | Record<string, any> | string
135
- );
136
- name: 'RequestRetryError';
137
- code: 'UND_ERR_REQ_RETRY';
138
- statusCode: number;
151
+ )
152
+ name: 'RequestRetryError'
153
+ code: 'UND_ERR_REQ_RETRY'
154
+ statusCode: number
139
155
  data: {
140
156
  count: number;
141
- };
142
- headers: Record<string, string | string[]>;
157
+ }
158
+
159
+ headers: Record<string, string | string[]>
143
160
  }
144
161
 
145
162
  export class SecureProxyConnectionError extends UndiciError {
146
- name: 'SecureProxyConnectionError';
147
- code: 'UND_ERR_PRX_TLS';
163
+ constructor (
164
+ cause?: Error,
165
+ message?: string,
166
+ options?: Record<any, any>
167
+ )
168
+ name: 'SecureProxyConnectionError'
169
+ code: 'UND_ERR_PRX_TLS'
148
170
  }
149
171
  }
@@ -6,7 +6,7 @@ import { Blob } from 'buffer'
6
6
  import { URL, URLSearchParams } from 'url'
7
7
  import { ReadableStream } from 'stream/web'
8
8
  import { FormData } from './formdata'
9
-
9
+ import { HeaderRecord } from './header'
10
10
  import Dispatcher from './dispatcher'
11
11
 
12
12
  export type RequestInfo = string | URL | Request
@@ -36,17 +36,17 @@ export class BodyMixin {
36
36
  /**
37
37
  * @deprecated This method is not recommended for parsing multipart/form-data bodies in server environments.
38
38
  * It is recommended to use a library such as [@fastify/busboy](https://www.npmjs.com/package/@fastify/busboy) as follows:
39
- *
39
+ *
40
40
  * @example
41
41
  * ```js
42
42
  * import { Busboy } from '@fastify/busboy'
43
43
  * import { Readable } from 'node:stream'
44
- *
44
+ *
45
45
  * const response = await fetch('...')
46
46
  * const busboy = new Busboy({ headers: { 'content-type': response.headers.get('content-type') } })
47
- *
47
+ *
48
48
  * // handle events emitted from `busboy`
49
- *
49
+ *
50
50
  * Readable.fromWeb(response.body).pipe(busboy)
51
51
  * ```
52
52
  */
@@ -67,7 +67,7 @@ export interface SpecIterable<T> {
67
67
  [Symbol.iterator](): SpecIterator<T>;
68
68
  }
69
69
 
70
- export type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
70
+ export type HeadersInit = [string, string][] | HeaderRecord | Headers
71
71
 
72
72
  export declare class Headers implements SpecIterable<[string, string]> {
73
73
  constructor (init?: HeadersInit)
@@ -119,20 +119,21 @@ type RequestDestination =
119
119
  | 'xslt'
120
120
 
121
121
  export interface RequestInit {
122
- method?: string
123
- keepalive?: boolean
124
- headers?: HeadersInit
125
122
  body?: BodyInit | null
126
- redirect?: RequestRedirect
127
- integrity?: string
128
- signal?: AbortSignal | null
123
+ cache?: RequestCache
129
124
  credentials?: RequestCredentials
125
+ dispatcher?: Dispatcher
126
+ duplex?: RequestDuplex
127
+ headers?: HeadersInit
128
+ integrity?: string
129
+ keepalive?: boolean
130
+ method?: string
130
131
  mode?: RequestMode
132
+ redirect?: RequestRedirect
131
133
  referrer?: string
132
134
  referrerPolicy?: ReferrerPolicy
135
+ signal?: AbortSignal | null
133
136
  window?: null
134
- dispatcher?: Dispatcher
135
- duplex?: RequestDuplex
136
137
  }
137
138
 
138
139
  export type ReferrerPolicy =
@@ -144,7 +145,7 @@ export type ReferrerPolicy =
144
145
  | 'same-origin'
145
146
  | 'strict-origin'
146
147
  | 'strict-origin-when-cross-origin'
147
- | 'unsafe-url';
148
+ | 'unsafe-url'
148
149
 
149
150
  export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
150
151
 
@@ -204,6 +205,6 @@ export declare class Response extends BodyMixin {
204
205
  readonly clone: () => Response
205
206
 
206
207
  static error (): Response
207
- static json(data: any, init?: ResponseInit): Response
208
+ static json (data: any, init?: ResponseInit): Response
208
209
  static redirect (url: string | URL, status: ResponseRedirectStatus): Response
209
210
  }
@@ -1,7 +1,7 @@
1
1
  // Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT)
2
2
  /// <reference types="node" />
3
3
 
4
- import { File } from './file'
4
+ import { File } from 'buffer'
5
5
  import { SpecIterableIterator } from './fetch'
6
6
 
7
7
  /**
@@ -24,7 +24,7 @@ export declare class FormData {
24
24
  or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
25
25
  * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
26
26
  */
27
- append(name: string, value: unknown, fileName?: string): void
27
+ append (name: string, value: unknown, fileName?: string): void
28
28
 
29
29
  /**
30
30
  * Set a new value for an existing key inside FormData,
@@ -36,7 +36,7 @@ export declare class FormData {
36
36
  * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
37
37
  *
38
38
  */
39
- set(name: string, value: unknown, fileName?: string): void
39
+ set (name: string, value: unknown, fileName?: string): void
40
40
 
41
41
  /**
42
42
  * Returns the first value associated with a given key from within a `FormData` object.
@@ -46,7 +46,7 @@ export declare class FormData {
46
46
  *
47
47
  * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
48
48
  */
49
- get(name: string): FormDataEntryValue | null
49
+ get (name: string): FormDataEntryValue | null
50
50
 
51
51
  /**
52
52
  * Returns all the values associated with a given key from within a `FormData` object.
@@ -55,7 +55,7 @@ export declare class FormData {
55
55
  *
56
56
  * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
57
57
  */
58
- getAll(name: string): FormDataEntryValue[]
58
+ getAll (name: string): FormDataEntryValue[]
59
59
 
60
60
  /**
61
61
  * Returns a boolean stating whether a `FormData` object contains a certain key.
@@ -64,14 +64,14 @@ export declare class FormData {
64
64
  *
65
65
  * @return A boolean value.
66
66
  */
67
- has(name: string): boolean
67
+ has (name: string): boolean
68
68
 
69
69
  /**
70
70
  * Deletes a key and its value(s) from a `FormData` object.
71
71
  *
72
72
  * @param name The name of the key you want to delete.
73
73
  */
74
- delete(name: string): void
74
+ delete (name: string): void
75
75
 
76
76
  /**
77
77
  * Executes given callback function for each field of the FormData instance
@@ -0,0 +1,9 @@
1
+ import Dispatcher from './dispatcher'
2
+
3
+ declare function setGlobalDispatcher<DispatcherImplementation extends Dispatcher> (dispatcher: DispatcherImplementation): void
4
+ declare function getGlobalDispatcher (): Dispatcher
5
+
6
+ export {
7
+ getGlobalDispatcher,
8
+ setGlobalDispatcher
9
+ }
@@ -0,0 +1,7 @@
1
+ declare function setGlobalOrigin (origin: string | URL | undefined): void
2
+ declare function getGlobalOrigin (): URL | undefined
3
+
4
+ export {
5
+ setGlobalOrigin,
6
+ getGlobalOrigin
7
+ }