cdk-common 2.0.1202 → 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 +2 -2
  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 +1 -1
  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,75 @@
1
+ import { URL } from 'url'
2
+ import Dispatcher from './dispatcher'
3
+ import buildConnector from './connector'
4
+
5
+ type H2ClientOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
6
+
7
+ /**
8
+ * A basic H2C client, mapped on top a single TCP connection. Pipelining is disabled by default.
9
+ */
10
+ export class H2CClient extends Dispatcher {
11
+ constructor (url: string | URL, options?: H2CClient.Options)
12
+ /** Property to get and set the pipelining factor. */
13
+ pipelining: number
14
+ /** `true` after `client.close()` has been called. */
15
+ closed: boolean
16
+ /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
17
+ destroyed: boolean
18
+
19
+ // Override dispatcher APIs.
20
+ override connect (
21
+ options: H2ClientOptions
22
+ ): Promise<Dispatcher.ConnectData>
23
+ override connect (
24
+ options: H2ClientOptions,
25
+ callback: (err: Error | null, data: Dispatcher.ConnectData) => void
26
+ ): void
27
+ }
28
+
29
+ export declare namespace H2CClient {
30
+ export interface Options {
31
+ /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
32
+ maxHeaderSize?: number;
33
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
34
+ headersTimeout?: number;
35
+ /** TODO */
36
+ connectTimeout?: number;
37
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
38
+ bodyTimeout?: number;
39
+ /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
40
+ keepAliveTimeout?: number;
41
+ /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
42
+ keepAliveMaxTimeout?: number;
43
+ /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
44
+ keepAliveTimeoutThreshold?: number;
45
+ /** TODO */
46
+ socketPath?: string;
47
+ /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
48
+ pipelining?: number;
49
+ /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
50
+ strictContentLength?: boolean;
51
+ /** TODO */
52
+ maxCachedSessions?: number;
53
+ /** TODO */
54
+ maxRedirections?: number;
55
+ /** TODO */
56
+ connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
57
+ /** TODO */
58
+ maxRequestsPerClient?: number;
59
+ /** TODO */
60
+ localAddress?: string;
61
+ /** Max response body size in bytes, -1 is disabled */
62
+ maxResponseSize?: number;
63
+ /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
64
+ autoSelectFamily?: boolean;
65
+ /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
66
+ autoSelectFamilyAttemptTimeout?: number;
67
+ /**
68
+ * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
69
+ * @default 100
70
+ */
71
+ maxConcurrentStreams?: number
72
+ }
73
+ }
74
+
75
+ export default H2CClient
@@ -1,15 +1,15 @@
1
- import Dispatcher from "./dispatcher";
1
+ import Dispatcher from './dispatcher'
2
2
 
3
- export declare class RedirectHandler implements Dispatcher.DispatchHandlers {
4
- constructor(
3
+ export declare class RedirectHandler implements Dispatcher.DispatchHandler {
4
+ constructor (
5
5
  dispatch: Dispatcher,
6
6
  maxRedirections: number,
7
7
  opts: Dispatcher.DispatchOptions,
8
- handler: Dispatcher.DispatchHandlers,
8
+ handler: Dispatcher.DispatchHandler,
9
9
  redirectionLimitReached: boolean
10
- );
10
+ )
11
11
  }
12
12
 
13
- export declare class DecoratorHandler implements Dispatcher.DispatchHandlers {
14
- constructor(handler: Dispatcher.DispatchHandlers);
13
+ export declare class DecoratorHandler implements Dispatcher.DispatchHandler {
14
+ constructor (handler: Dispatcher.DispatchHandler)
15
15
  }
@@ -0,0 +1,160 @@
1
+ import { Autocomplete } from './utility'
2
+
3
+ /**
4
+ * The header type declaration of `undici`.
5
+ */
6
+ export type IncomingHttpHeaders = Record<string, string | string[] | undefined>
7
+
8
+ type HeaderNames = Autocomplete<
9
+ | 'Accept'
10
+ | 'Accept-CH'
11
+ | 'Accept-Charset'
12
+ | 'Accept-Encoding'
13
+ | 'Accept-Language'
14
+ | 'Accept-Patch'
15
+ | 'Accept-Post'
16
+ | 'Accept-Ranges'
17
+ | 'Access-Control-Allow-Credentials'
18
+ | 'Access-Control-Allow-Headers'
19
+ | 'Access-Control-Allow-Methods'
20
+ | 'Access-Control-Allow-Origin'
21
+ | 'Access-Control-Expose-Headers'
22
+ | 'Access-Control-Max-Age'
23
+ | 'Access-Control-Request-Headers'
24
+ | 'Access-Control-Request-Method'
25
+ | 'Age'
26
+ | 'Allow'
27
+ | 'Alt-Svc'
28
+ | 'Alt-Used'
29
+ | 'Authorization'
30
+ | 'Cache-Control'
31
+ | 'Clear-Site-Data'
32
+ | 'Connection'
33
+ | 'Content-Disposition'
34
+ | 'Content-Encoding'
35
+ | 'Content-Language'
36
+ | 'Content-Length'
37
+ | 'Content-Location'
38
+ | 'Content-Range'
39
+ | 'Content-Security-Policy'
40
+ | 'Content-Security-Policy-Report-Only'
41
+ | 'Content-Type'
42
+ | 'Cookie'
43
+ | 'Cross-Origin-Embedder-Policy'
44
+ | 'Cross-Origin-Opener-Policy'
45
+ | 'Cross-Origin-Resource-Policy'
46
+ | 'Date'
47
+ | 'Device-Memory'
48
+ | 'ETag'
49
+ | 'Expect'
50
+ | 'Expect-CT'
51
+ | 'Expires'
52
+ | 'Forwarded'
53
+ | 'From'
54
+ | 'Host'
55
+ | 'If-Match'
56
+ | 'If-Modified-Since'
57
+ | 'If-None-Match'
58
+ | 'If-Range'
59
+ | 'If-Unmodified-Since'
60
+ | 'Keep-Alive'
61
+ | 'Last-Modified'
62
+ | 'Link'
63
+ | 'Location'
64
+ | 'Max-Forwards'
65
+ | 'Origin'
66
+ | 'Permissions-Policy'
67
+ | 'Priority'
68
+ | 'Proxy-Authenticate'
69
+ | 'Proxy-Authorization'
70
+ | 'Range'
71
+ | 'Referer'
72
+ | 'Referrer-Policy'
73
+ | 'Retry-After'
74
+ | 'Sec-Fetch-Dest'
75
+ | 'Sec-Fetch-Mode'
76
+ | 'Sec-Fetch-Site'
77
+ | 'Sec-Fetch-User'
78
+ | 'Sec-Purpose'
79
+ | 'Sec-WebSocket-Accept'
80
+ | 'Server'
81
+ | 'Server-Timing'
82
+ | 'Service-Worker-Navigation-Preload'
83
+ | 'Set-Cookie'
84
+ | 'SourceMap'
85
+ | 'Strict-Transport-Security'
86
+ | 'TE'
87
+ | 'Timing-Allow-Origin'
88
+ | 'Trailer'
89
+ | 'Transfer-Encoding'
90
+ | 'Upgrade'
91
+ | 'Upgrade-Insecure-Requests'
92
+ | 'User-Agent'
93
+ | 'Vary'
94
+ | 'Via'
95
+ | 'WWW-Authenticate'
96
+ | 'X-Content-Type-Options'
97
+ | 'X-Frame-Options'
98
+ >
99
+
100
+ type IANARegisteredMimeType = Autocomplete<
101
+ | 'audio/aac'
102
+ | 'video/x-msvideo'
103
+ | 'image/avif'
104
+ | 'video/av1'
105
+ | 'application/octet-stream'
106
+ | 'image/bmp'
107
+ | 'text/css'
108
+ | 'text/csv'
109
+ | 'application/vnd.ms-fontobject'
110
+ | 'application/epub+zip'
111
+ | 'image/gif'
112
+ | 'application/gzip'
113
+ | 'text/html'
114
+ | 'image/x-icon'
115
+ | 'text/calendar'
116
+ | 'image/jpeg'
117
+ | 'text/javascript'
118
+ | 'application/json'
119
+ | 'application/ld+json'
120
+ | 'audio/x-midi'
121
+ | 'audio/mpeg'
122
+ | 'video/mp4'
123
+ | 'video/mpeg'
124
+ | 'audio/ogg'
125
+ | 'video/ogg'
126
+ | 'application/ogg'
127
+ | 'audio/opus'
128
+ | 'font/otf'
129
+ | 'application/pdf'
130
+ | 'image/png'
131
+ | 'application/rtf'
132
+ | 'image/svg+xml'
133
+ | 'image/tiff'
134
+ | 'video/mp2t'
135
+ | 'font/ttf'
136
+ | 'text/plain'
137
+ | 'application/wasm'
138
+ | 'video/webm'
139
+ | 'audio/webm'
140
+ | 'image/webp'
141
+ | 'font/woff'
142
+ | 'font/woff2'
143
+ | 'application/xhtml+xml'
144
+ | 'application/xml'
145
+ | 'application/zip'
146
+ | 'video/3gpp'
147
+ | 'video/3gpp2'
148
+ | 'model/gltf+json'
149
+ | 'model/gltf-binary'
150
+ >
151
+
152
+ type KnownHeaderValues = {
153
+ 'content-type': IANARegisteredMimeType
154
+ }
155
+
156
+ export type HeaderRecord = {
157
+ [K in HeaderNames | Lowercase<HeaderNames>]?: Lowercase<K> extends keyof KnownHeaderValues
158
+ ? KnownHeaderValues[Lowercase<K>]
159
+ : string
160
+ }
@@ -0,0 +1,75 @@
1
+ import Dispatcher from './dispatcher'
2
+ import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher'
3
+ import { setGlobalOrigin, getGlobalOrigin } from './global-origin'
4
+ import Pool from './pool'
5
+ import { RedirectHandler, DecoratorHandler } from './handlers'
6
+
7
+ import BalancedPool from './balanced-pool'
8
+ import Client from './client'
9
+ import H2CClient from './h2c-client'
10
+ import buildConnector from './connector'
11
+ import errors from './errors'
12
+ import Agent from './agent'
13
+ import MockClient from './mock-client'
14
+ import MockPool from './mock-pool'
15
+ import MockAgent from './mock-agent'
16
+ import { MockCallHistory, MockCallHistoryLog } from './mock-call-history'
17
+ import mockErrors from './mock-errors'
18
+ import ProxyAgent from './proxy-agent'
19
+ import EnvHttpProxyAgent from './env-http-proxy-agent'
20
+ import RetryHandler from './retry-handler'
21
+ import RetryAgent from './retry-agent'
22
+ import { request, pipeline, stream, connect, upgrade } from './api'
23
+ import interceptors from './interceptors'
24
+
25
+ export * from './util'
26
+ export * from './cookies'
27
+ export * from './eventsource'
28
+ export * from './fetch'
29
+ export * from './formdata'
30
+ export * from './diagnostics-channel'
31
+ export * from './websocket'
32
+ export * from './content-type'
33
+ export * from './cache'
34
+ export { Interceptable } from './mock-interceptor'
35
+
36
+ export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, interceptors, MockClient, MockPool, MockAgent, MockCallHistory, MockCallHistoryLog, mockErrors, ProxyAgent, EnvHttpProxyAgent, RedirectHandler, DecoratorHandler, RetryHandler, RetryAgent, H2CClient }
37
+ export default Undici
38
+
39
+ declare namespace Undici {
40
+ const Dispatcher: typeof import('./dispatcher').default
41
+ const Pool: typeof import('./pool').default
42
+ const RedirectHandler: typeof import ('./handlers').RedirectHandler
43
+ const DecoratorHandler: typeof import ('./handlers').DecoratorHandler
44
+ const RetryHandler: typeof import ('./retry-handler').default
45
+ const BalancedPool: typeof import('./balanced-pool').default
46
+ const Client: typeof import('./client').default
47
+ const H2CClient: typeof import('./h2c-client').default
48
+ const buildConnector: typeof import('./connector').default
49
+ const errors: typeof import('./errors').default
50
+ const Agent: typeof import('./agent').default
51
+ const setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher
52
+ const getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher
53
+ const request: typeof import('./api').request
54
+ const stream: typeof import('./api').stream
55
+ const pipeline: typeof import('./api').pipeline
56
+ const connect: typeof import('./api').connect
57
+ const upgrade: typeof import('./api').upgrade
58
+ const MockClient: typeof import('./mock-client').default
59
+ const MockPool: typeof import('./mock-pool').default
60
+ const MockAgent: typeof import('./mock-agent').default
61
+ const MockCallHistory: typeof import('./mock-call-history').MockCallHistory
62
+ const MockCallHistoryLog: typeof import('./mock-call-history').MockCallHistoryLog
63
+ const mockErrors: typeof import('./mock-errors').default
64
+ const fetch: typeof import('./fetch').fetch
65
+ const Headers: typeof import('./fetch').Headers
66
+ const Response: typeof import('./fetch').Response
67
+ const Request: typeof import('./fetch').Request
68
+ const FormData: typeof import('./formdata').FormData
69
+ const caches: typeof import('./cache').caches
70
+ const interceptors: typeof import('./interceptors').default
71
+ const cacheStores: {
72
+ MemoryCacheStore: typeof import('./cache-interceptor').default.MemoryCacheStore,
73
+ SqliteCacheStore: typeof import('./cache-interceptor').default.SqliteCacheStore
74
+ }
75
+ }
@@ -0,0 +1,34 @@
1
+ import CacheHandler from './cache-interceptor'
2
+ import Dispatcher from './dispatcher'
3
+ import RetryHandler from './retry-handler'
4
+ import { LookupOptions } from 'node:dns'
5
+
6
+ export default Interceptors
7
+
8
+ declare namespace Interceptors {
9
+ export type DumpInterceptorOpts = { maxSize?: number }
10
+ export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
+ export type RedirectInterceptorOpts = { maxRedirections?: number }
12
+
13
+ export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
14
+ export type CacheInterceptorOpts = CacheHandler.CacheOptions
15
+
16
+ // DNS interceptor
17
+ export type DNSInterceptorRecord = { address: string, ttl: number, family: 4 | 6 }
18
+ export type DNSInterceptorOriginRecords = { 4: { ips: DNSInterceptorRecord[] } | null, 6: { ips: DNSInterceptorRecord[] } | null }
19
+ export type DNSInterceptorOpts = {
20
+ maxTTL?: number
21
+ maxItems?: number
22
+ lookup?: (hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void
23
+ pick?: (origin: URL, records: DNSInterceptorOriginRecords, affinity: 4 | 6) => DNSInterceptorRecord
24
+ dualStack?: boolean
25
+ affinity?: 4 | 6
26
+ }
27
+
28
+ export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
29
+ export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
30
+ export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31
+ export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
32
+ export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
33
+ export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
34
+ }
@@ -1,7 +1,8 @@
1
1
  import Agent from './agent'
2
2
  import Dispatcher from './dispatcher'
3
3
  import { Interceptable, MockInterceptor } from './mock-interceptor'
4
- import MockDispatch = MockInterceptor.MockDispatch;
4
+ import MockDispatch = MockInterceptor.MockDispatch
5
+ import { MockCallHistory } from './mock-call-history'
5
6
 
6
7
  export default MockAgent
7
8
 
@@ -11,30 +12,38 @@ interface PendingInterceptor extends MockDispatch {
11
12
 
12
13
  /** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */
13
14
  declare class MockAgent<TMockAgentOptions extends MockAgent.Options = MockAgent.Options> extends Dispatcher {
14
- constructor(options?: MockAgent.Options)
15
+ constructor (options?: TMockAgentOptions)
15
16
  /** Creates and retrieves mock Dispatcher instances which can then be used to intercept HTTP requests. If the number of connections on the mock agent is set to 1, a MockClient instance is returned. Otherwise a MockPool instance is returned. */
16
- get<TInterceptable extends Interceptable>(origin: string): TInterceptable;
17
- get<TInterceptable extends Interceptable>(origin: RegExp): TInterceptable;
18
- get<TInterceptable extends Interceptable>(origin: ((origin: string) => boolean)): TInterceptable;
17
+ get<TInterceptable extends Interceptable>(origin: string): TInterceptable
18
+ get<TInterceptable extends Interceptable>(origin: RegExp): TInterceptable
19
+ get<TInterceptable extends Interceptable>(origin: ((origin: string) => boolean)): TInterceptable
19
20
  /** Dispatches a mocked request. */
20
- dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
21
+ dispatch (options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandler): boolean
21
22
  /** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */
22
- close(): Promise<void>;
23
+ close (): Promise<void>
23
24
  /** Disables mocking in MockAgent. */
24
- deactivate(): void;
25
+ deactivate (): void
25
26
  /** Enables mocking in a MockAgent instance. When instantiated, a MockAgent is automatically activated. Therefore, this method is only effective after `MockAgent.deactivate` has been called. */
26
- activate(): void;
27
+ activate (): void
27
28
  /** Define host matchers so only matching requests that aren't intercepted by the mock dispatchers will be attempted. */
28
- enableNetConnect(): void;
29
- enableNetConnect(host: string): void;
30
- enableNetConnect(host: RegExp): void;
31
- enableNetConnect(host: ((host: string) => boolean)): void;
29
+ enableNetConnect (): void
30
+ enableNetConnect (host: string): void
31
+ enableNetConnect (host: RegExp): void
32
+ enableNetConnect (host: ((host: string) => boolean)): void
32
33
  /** Causes all requests to throw when requests are not matched in a MockAgent intercept. */
33
- disableNetConnect(): void;
34
- pendingInterceptors(): PendingInterceptor[];
35
- assertNoPendingInterceptors(options?: {
34
+ disableNetConnect (): void
35
+ /** get call history. returns the MockAgent call history or undefined if the option is not enabled. */
36
+ getCallHistory (): MockCallHistory | undefined
37
+ /** clear every call history. Any MockCallHistoryLog will be deleted on the MockCallHistory instance */
38
+ clearCallHistory (): void
39
+ /** Enable call history. Any subsequence calls will then be registered. */
40
+ enableCallHistory (): this
41
+ /** Disable call history. Any subsequence calls will then not be registered. */
42
+ disableCallHistory (): this
43
+ pendingInterceptors (): PendingInterceptor[]
44
+ assertNoPendingInterceptors (options?: {
36
45
  pendingInterceptorsFormatter?: PendingInterceptorsFormatter;
37
- }): void;
46
+ }): void
38
47
  }
39
48
 
40
49
  interface PendingInterceptorsFormatter {
@@ -45,6 +54,12 @@ declare namespace MockAgent {
45
54
  /** MockAgent options. */
46
55
  export interface Options extends Agent.Options {
47
56
  /** A custom agent to be encapsulated by the MockAgent. */
48
- agent?: Agent;
57
+ agent?: Dispatcher;
58
+
59
+ /** Ignore trailing slashes in the path */
60
+ ignoreTrailingSlash?: boolean;
61
+
62
+ /** Enable call history. you can either call MockAgent.enableCallHistory(). default false */
63
+ enableCallHistory?: boolean
49
64
  }
50
65
  }
@@ -0,0 +1,111 @@
1
+ import Dispatcher from './dispatcher'
2
+
3
+ declare namespace MockCallHistoryLog {
4
+ /** request's configuration properties */
5
+ export type MockCallHistoryLogProperties = 'protocol' | 'host' | 'port' | 'origin' | 'path' | 'hash' | 'fullUrl' | 'method' | 'searchParams' | 'body' | 'headers'
6
+ }
7
+
8
+ /** a log reflecting request configuration */
9
+ declare class MockCallHistoryLog {
10
+ constructor (requestInit: Dispatcher.DispatchOptions)
11
+ /** protocol used. ie. 'https:' or 'http:' etc... */
12
+ protocol: string
13
+ /** request's host. */
14
+ host: string
15
+ /** request's port. */
16
+ port: string
17
+ /** request's origin. ie. https://localhost:3000. */
18
+ origin: string
19
+ /** path. never contains searchParams. */
20
+ path: string
21
+ /** request's hash. */
22
+ hash: string
23
+ /** the full url requested. */
24
+ fullUrl: string
25
+ /** request's method. */
26
+ method: string
27
+ /** search params. */
28
+ searchParams: Record<string, string>
29
+ /** request's body */
30
+ body: string | null | undefined
31
+ /** request's headers */
32
+ headers: Record<string, string | string[]> | null | undefined
33
+
34
+ /** returns an Map of property / value pair */
35
+ toMap (): Map<MockCallHistoryLog.MockCallHistoryLogProperties, string | Record<string, string | string[]> | null | undefined>
36
+
37
+ /** returns a string computed with all key value pair */
38
+ toString (): string
39
+ }
40
+
41
+ declare namespace MockCallHistory {
42
+ export type FilterCallsOperator = 'AND' | 'OR'
43
+
44
+ /** modify the filtering behavior */
45
+ export interface FilterCallsOptions {
46
+ /** the operator to apply when filtering. 'OR' will adds any MockCallHistoryLog matching any criteria given. 'AND' will adds only MockCallHistoryLog matching every criteria given. (default 'OR') */
47
+ operator?: FilterCallsOperator | Lowercase<FilterCallsOperator>
48
+ }
49
+ /** a function to be executed for filtering MockCallHistoryLog */
50
+ export type FilterCallsFunctionCriteria = (log: MockCallHistoryLog) => boolean
51
+
52
+ /** parameter to filter MockCallHistoryLog */
53
+ export type FilterCallsParameter = string | RegExp | undefined | null
54
+
55
+ /** an object to execute multiple filtering at once */
56
+ export interface FilterCallsObjectCriteria extends Record<string, FilterCallsParameter> {
57
+ /** filter by request protocol. ie https: */
58
+ protocol?: FilterCallsParameter;
59
+ /** filter by request host. */
60
+ host?: FilterCallsParameter;
61
+ /** filter by request port. */
62
+ port?: FilterCallsParameter;
63
+ /** filter by request origin. */
64
+ origin?: FilterCallsParameter;
65
+ /** filter by request path. */
66
+ path?: FilterCallsParameter;
67
+ /** filter by request hash. */
68
+ hash?: FilterCallsParameter;
69
+ /** filter by request fullUrl. */
70
+ fullUrl?: FilterCallsParameter;
71
+ /** filter by request method. */
72
+ method?: FilterCallsParameter;
73
+ }
74
+ }
75
+
76
+ /** a call history to track requests configuration */
77
+ declare class MockCallHistory {
78
+ constructor (name: string)
79
+ /** returns an array of MockCallHistoryLog. */
80
+ calls (): Array<MockCallHistoryLog>
81
+ /** returns the first MockCallHistoryLog */
82
+ firstCall (): MockCallHistoryLog | undefined
83
+ /** returns the last MockCallHistoryLog. */
84
+ lastCall (): MockCallHistoryLog | undefined
85
+ /** returns the nth MockCallHistoryLog. */
86
+ nthCall (position: number): MockCallHistoryLog | undefined
87
+ /** return all MockCallHistoryLog matching any of criteria given. if an object is used with multiple properties, you can change the operator to apply during filtering on options */
88
+ filterCalls (criteria: MockCallHistory.FilterCallsFunctionCriteria | MockCallHistory.FilterCallsObjectCriteria | RegExp, options?: MockCallHistory.FilterCallsOptions): Array<MockCallHistoryLog>
89
+ /** return all MockCallHistoryLog matching the given protocol. if a string is given, it is matched with includes */
90
+ filterCallsByProtocol (protocol: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
91
+ /** return all MockCallHistoryLog matching the given host. if a string is given, it is matched with includes */
92
+ filterCallsByHost (host: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
93
+ /** return all MockCallHistoryLog matching the given port. if a string is given, it is matched with includes */
94
+ filterCallsByPort (port: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
95
+ /** return all MockCallHistoryLog matching the given origin. if a string is given, it is matched with includes */
96
+ filterCallsByOrigin (origin: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
97
+ /** return all MockCallHistoryLog matching the given path. if a string is given, it is matched with includes */
98
+ filterCallsByPath (path: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
99
+ /** return all MockCallHistoryLog matching the given hash. if a string is given, it is matched with includes */
100
+ filterCallsByHash (hash: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
101
+ /** return all MockCallHistoryLog matching the given fullUrl. if a string is given, it is matched with includes */
102
+ filterCallsByFullUrl (fullUrl: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
103
+ /** return all MockCallHistoryLog matching the given method. if a string is given, it is matched with includes */
104
+ filterCallsByMethod (method: MockCallHistory.FilterCallsParameter): Array<MockCallHistoryLog>
105
+ /** clear all MockCallHistoryLog on this MockCallHistory. */
106
+ clear (): void
107
+ /** use it with for..of loop or spread operator */
108
+ [Symbol.iterator]: () => Generator<MockCallHistoryLog>
109
+ }
110
+
111
+ export { MockCallHistoryLog, MockCallHistory }
@@ -7,13 +7,13 @@ export default MockClient
7
7
 
8
8
  /** MockClient extends the Client API and allows one to mock requests. */
9
9
  declare class MockClient extends Client implements Interceptable {
10
- constructor(origin: string, options: MockClient.Options);
10
+ constructor (origin: string, options: MockClient.Options)
11
11
  /** Intercepts any matching requests that use the same origin as this mock client. */
12
- intercept(options: MockInterceptor.Options): MockInterceptor;
12
+ intercept (options: MockInterceptor.Options): MockInterceptor
13
13
  /** Dispatches a mocked request. */
14
- dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean;
14
+ dispatch (options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandler): boolean
15
15
  /** Closes the mock client and gracefully waits for enqueued requests to complete. */
16
- close(): Promise<void>;
16
+ close (): Promise<void>
17
17
  }
18
18
 
19
19
  declare namespace MockClient {
@@ -5,8 +5,8 @@ export default MockErrors
5
5
  declare namespace MockErrors {
6
6
  /** The request does not match any registered mock dispatches. */
7
7
  export class MockNotMatchedError extends Errors.UndiciError {
8
- constructor(message?: string);
9
- name: 'MockNotMatchedError';
10
- code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED';
8
+ constructor (message?: string)
9
+ name: 'MockNotMatchedError'
10
+ code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'
11
11
  }
12
12
  }
@@ -1,42 +1,36 @@
1
1
  import { IncomingHttpHeaders } from './header'
2
- import Dispatcher from './dispatcher';
2
+ import Dispatcher from './dispatcher'
3
3
  import { BodyInit, Headers } from './fetch'
4
4
 
5
- export {
6
- Interceptable,
7
- MockInterceptor,
8
- MockScope
9
- }
10
-
11
5
  /** The scope associated with a mock dispatch. */
12
6
  declare class MockScope<TData extends object = object> {
13
- constructor(mockDispatch: MockInterceptor.MockDispatch<TData>);
7
+ constructor (mockDispatch: MockInterceptor.MockDispatch<TData>)
14
8
  /** Delay a reply by a set amount of time in ms. */
15
- delay(waitInMs: number): MockScope<TData>;
9
+ delay (waitInMs: number): MockScope<TData>
16
10
  /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
17
- persist(): MockScope<TData>;
11
+ persist (): MockScope<TData>
18
12
  /** Define a reply for a set amount of matching requests. */
19
- times(repeatTimes: number): MockScope<TData>;
13
+ times (repeatTimes: number): MockScope<TData>
20
14
  }
21
15
 
22
16
  /** The interceptor for a Mock. */
23
17
  declare class MockInterceptor {
24
- constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]);
18
+ constructor (options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
25
19
  /** Mock an undici request with the defined reply. */
26
- reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>;
20
+ reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>
27
21
  reply<TData extends object = object>(
28
22
  statusCode: number,
29
23
  data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
30
24
  responseOptions?: MockInterceptor.MockResponseOptions
31
- ): MockScope<TData>;
25
+ ): MockScope<TData>
32
26
  /** Mock an undici request by throwing the defined reply error. */
33
- replyWithError<TError extends Error = Error>(error: TError): MockScope;
27
+ replyWithError<TError extends Error = Error>(error: TError): MockScope
34
28
  /** Set default reply headers on the interceptor for subsequent mocked replies. */
35
- defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor;
29
+ defaultReplyHeaders (headers: IncomingHttpHeaders): MockInterceptor
36
30
  /** Set default reply trailers on the interceptor for subsequent mocked replies. */
37
- defaultReplyTrailers(trailers: Record<string, string>): MockInterceptor;
31
+ defaultReplyTrailers (trailers: Record<string, string>): MockInterceptor
38
32
  /** Set automatically calculated content-length header on subsequent mocked replies. */
39
- replyContentLength(): MockInterceptor;
33
+ replyContentLength (): MockInterceptor
40
34
  }
41
35
 
42
36
  declare namespace MockInterceptor {
@@ -80,7 +74,7 @@ declare namespace MockInterceptor {
80
74
 
81
75
  export type MockResponseDataHandler<TData extends object = object> = (
82
76
  opts: MockResponseCallbackOptions
83
- ) => TData | Buffer | string;
77
+ ) => TData | Buffer | string
84
78
 
85
79
  export type MockReplyOptionsCallback<TData extends object = object> = (
86
80
  opts: MockResponseCallbackOptions
@@ -91,3 +85,9 @@ interface Interceptable extends Dispatcher {
91
85
  /** Intercepts any matching requests that use the same origin as this mock client. */
92
86
  intercept(options: MockInterceptor.Options): MockInterceptor;
93
87
  }
88
+
89
+ export {
90
+ Interceptable,
91
+ MockInterceptor,
92
+ MockScope
93
+ }