@anhdhbn/9router 0.5.116 → 0.5.119

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 (738) hide show
  1. package/README.md +19 -47
  2. package/app/.next-cli-build/BUILD_ID +1 -1
  3. package/app/.next-cli-build/app-path-routes-manifest.json +15 -15
  4. package/app/.next-cli-build/build-manifest.json +2 -2
  5. package/app/.next-cli-build/prerender-manifest.json +6 -6
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +12 -12
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +3 -3
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  75. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  76. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  77. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  78. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  79. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  80. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  81. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  82. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  83. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  86. package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
  87. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
  88. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  89. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  90. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  91. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  92. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  94. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  95. package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
  97. package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
  98. package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
  100. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  101. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
  102. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  103. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
  104. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
  106. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
  107. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
  109. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  110. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
  111. package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
  112. package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
  113. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
  115. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  116. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
  117. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  118. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
  119. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  121. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  122. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
  123. package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
  124. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
  125. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
  127. package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
  128. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
  129. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  130. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
  131. package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
  133. package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
  134. package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +1 -1
  136. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  137. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
  138. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  139. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
  140. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
  142. package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
  143. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
  144. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  145. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
  146. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
  148. package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
  149. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
  150. package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
  151. package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
  152. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
  154. package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  156. package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
  157. package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
  158. package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
  159. package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
  160. package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
  161. package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
  162. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  163. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  164. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  165. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  167. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  168. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  169. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  170. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
  171. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  172. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  173. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  174. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js +1 -1
  175. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
  179. package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
  181. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  186. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  187. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  188. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
  190. package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  192. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/oauth/commandcode/auto-import/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  200. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
  201. package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
  204. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
  207. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  208. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
  209. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
  212. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
  217. package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
  221. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  224. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
  226. package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
  228. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  230. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  237. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  240. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  242. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/providers/web-login/route.js +1 -1
  244. package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
  245. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  248. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
  250. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
  264. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  266. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  274. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  275. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  276. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  277. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js +1 -1
  278. package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
  280. package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
  288. package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  296. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  298. package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
  299. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  300. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  302. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  303. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  304. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  305. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  306. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  307. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  308. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +4 -4
  309. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  310. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
  311. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  312. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  313. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  314. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  315. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +3 -3
  317. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  319. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  320. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js +1 -1
  322. package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  324. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  326. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  327. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  328. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  332. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  334. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/v1/systemone/route.js +1 -1
  336. package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
  337. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
  338. package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
  344. package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  346. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  348. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  350. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  351. package/app/.next-cli-build/server/app/api/version/route.js +1 -1
  352. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  353. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  354. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  356. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  358. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  359. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  360. package/app/.next-cli-build/server/app/callback.html +1 -1
  361. package/app/.next-cli-build/server/app/callback.rsc +3 -3
  362. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
  363. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  364. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +3 -3
  365. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  366. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +3 -3
  367. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +3 -3
  368. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +3 -3
  369. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  370. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  371. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  372. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
  373. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  374. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  375. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  376. package/app/.next-cli-build/server/app/dashboard/combos.rsc +3 -3
  377. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +3 -3
  378. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +3 -3
  379. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  380. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  381. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +3 -3
  382. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +3 -3
  383. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +3 -3
  384. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  385. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  386. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +3 -3
  387. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +3 -3
  388. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +3 -3
  389. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  390. package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  391. package/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  392. package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
  393. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  394. package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
  395. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  396. package/app/.next-cli-build/server/app/dashboard/profile.rsc +3 -3
  397. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +3 -3
  398. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +3 -3
  399. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  400. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  401. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +3 -3
  402. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +3 -3
  403. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +3 -3
  404. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  405. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  406. package/app/.next-cli-build/server/app/dashboard/providers.rsc +3 -3
  407. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +3 -3
  408. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +3 -3
  409. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  410. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  411. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
  412. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +5 -5
  413. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
  414. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  415. package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  416. package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +3 -3
  417. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +3 -3
  418. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +3 -3
  419. package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
  420. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  421. package/app/.next-cli-build/server/app/dashboard/quota.rsc +4 -4
  422. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +4 -4
  423. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +4 -4
  424. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  425. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +1 -1
  426. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
  427. package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  428. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  429. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
  430. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
  431. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  432. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +3 -3
  433. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  434. package/app/.next-cli-build/server/app/dashboard/skills.rsc +3 -3
  435. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +3 -3
  436. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +3 -3
  437. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  438. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  439. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +3 -3
  440. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +3 -3
  441. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +3 -3
  442. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  443. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  444. package/app/.next-cli-build/server/app/dashboard/translator.rsc +3 -3
  445. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +3 -3
  446. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +3 -3
  447. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  448. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  449. package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
  450. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
  451. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
  452. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  453. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  454. package/app/.next-cli-build/server/app/dashboard.rsc +3 -3
  455. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +3 -3
  456. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +3 -3
  457. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  458. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  459. package/app/.next-cli-build/server/app/index.html +1 -1
  460. package/app/.next-cli-build/server/app/index.rsc +3 -3
  461. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  462. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
  463. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  464. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  465. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  466. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  467. package/app/.next-cli-build/server/app/landing.html +1 -1
  468. package/app/.next-cli-build/server/app/landing.rsc +3 -3
  469. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
  470. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  471. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +3 -3
  472. package/app/.next-cli-build/server/app/login/page.js +1 -1
  473. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  474. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  475. package/app/.next-cli-build/server/app/login.html +1 -1
  476. package/app/.next-cli-build/server/app/login.rsc +3 -3
  477. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +3 -3
  478. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  479. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  480. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  481. package/app/.next-cli-build/server/app/page.js +1 -1
  482. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  483. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  484. package/app/.next-cli-build/server/app-paths-manifest.json +15 -15
  485. package/app/.next-cli-build/server/chunks/1051.js +1 -1
  486. package/app/.next-cli-build/server/chunks/{9999.js → 1297.js} +2 -2
  487. package/app/.next-cli-build/server/chunks/1350.js +1 -1
  488. package/app/.next-cli-build/server/chunks/{4597.js → 1568.js} +1 -1
  489. package/app/.next-cli-build/server/chunks/1757.js +1 -1
  490. package/app/.next-cli-build/server/chunks/24.js +1 -1
  491. package/app/.next-cli-build/server/chunks/2840.js +1 -0
  492. package/app/.next-cli-build/server/chunks/3225.js +1 -1
  493. package/app/.next-cli-build/server/chunks/3697.js +1 -1
  494. package/app/.next-cli-build/server/chunks/3885.js +1 -1
  495. package/app/.next-cli-build/server/chunks/3943.js +1 -1
  496. package/app/.next-cli-build/server/chunks/412.js +5 -5
  497. package/app/.next-cli-build/server/chunks/4123.js +1 -1
  498. package/app/.next-cli-build/server/chunks/4882.js +1 -1
  499. package/app/.next-cli-build/server/chunks/{3783.js → 5299.js} +4 -4
  500. package/app/.next-cli-build/server/chunks/5330.js +34 -34
  501. package/app/.next-cli-build/server/chunks/5485.js +1 -1
  502. package/app/.next-cli-build/server/chunks/5615.js +1 -1
  503. package/app/.next-cli-build/server/chunks/5932.js +1 -0
  504. package/app/.next-cli-build/server/chunks/6054.js +1 -1
  505. package/app/.next-cli-build/server/chunks/6070.js +1 -1
  506. package/app/.next-cli-build/server/chunks/615.js +1 -1
  507. package/app/.next-cli-build/server/chunks/6297.js +1 -0
  508. package/app/.next-cli-build/server/chunks/6513.js +1 -1
  509. package/app/.next-cli-build/server/chunks/6576.js +1 -0
  510. package/app/.next-cli-build/server/chunks/6690.js +1 -1
  511. package/app/.next-cli-build/server/chunks/6724.js +1 -1
  512. package/app/.next-cli-build/server/chunks/6763.js +1 -1
  513. package/app/.next-cli-build/server/chunks/7114.js +1 -1
  514. package/app/.next-cli-build/server/chunks/7187.js +1 -1
  515. package/app/.next-cli-build/server/chunks/7247.js +1 -1
  516. package/app/.next-cli-build/server/chunks/7373.js +1 -1
  517. package/app/.next-cli-build/server/chunks/7525.js +1 -1
  518. package/app/.next-cli-build/server/chunks/7552.js +1 -1
  519. package/app/.next-cli-build/server/chunks/7716.js +1 -1
  520. package/app/.next-cli-build/server/chunks/778.js +1 -1
  521. package/app/.next-cli-build/server/chunks/7843.js +51 -0
  522. package/app/.next-cli-build/server/chunks/8251.js +1 -1
  523. package/app/.next-cli-build/server/chunks/8402.js +1 -1
  524. package/app/.next-cli-build/server/chunks/8623.js +1 -1
  525. package/app/.next-cli-build/server/chunks/866.js +1 -0
  526. package/app/.next-cli-build/server/chunks/869.js +1 -1
  527. package/app/.next-cli-build/server/chunks/8895.js +3 -3
  528. package/app/.next-cli-build/server/chunks/8896.js +1 -1
  529. package/app/.next-cli-build/server/chunks/8920.js +1 -1
  530. package/app/.next-cli-build/server/chunks/8994.js +1 -1
  531. package/app/.next-cli-build/server/chunks/9198.js +1 -0
  532. package/app/.next-cli-build/server/chunks/9609.js +1 -1
  533. package/app/.next-cli-build/server/chunks/9927.js +1 -1
  534. package/app/.next-cli-build/server/instrumentation.js +1 -1
  535. package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
  536. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  537. package/app/.next-cli-build/server/middleware.js +3 -3
  538. package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
  539. package/app/.next-cli-build/server/pages/404.html +1 -1
  540. package/app/.next-cli-build/server/pages/500.html +1 -1
  541. package/app/.next-cli-build/server/preview-props.json +3 -3
  542. package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
  543. package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
  544. package/app/.next-cli-build/static/chunks/1321-2fde166305caeddb.js +1 -0
  545. package/app/.next-cli-build/static/chunks/5497-832391bf809808e3.js +7 -0
  546. package/app/.next-cli-build/static/chunks/{9134-dce513bebf49f409.js → 761-32ad2b1ee5ca216d.js} +10 -10
  547. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-a1c51b0c7ad758ad.js → page-6abc904471ca5d9e.js} +1 -1
  548. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-407f76834b37cd6c.js → page-1f2d3a8531261f5a.js} +1 -1
  549. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-a09d4b437dec0273.js → page-624cd614b7bc1f8c.js} +11 -11
  550. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/mitm/{page-f9f9e895a365e8d3.js → page-9ee6ec1d1ae265b8.js} +1 -1
  551. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-efdb4d5aacfda8a6.js +27 -0
  552. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-371203e00dbb386a.js +4 -0
  553. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-cb6752cc71bde85f.js → page-98e943d2e0230bb1.js} +1 -1
  554. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-9121f5a9bc6ae4d6.js +1 -0
  555. package/app/node_modules/undici/README.md +29 -116
  556. package/app/node_modules/undici/docs/docs/api/Agent.md +42 -249
  557. package/app/node_modules/undici/docs/docs/api/BalancedPool.md +48 -246
  558. package/app/node_modules/undici/docs/docs/api/CacheStorage.md +13 -171
  559. package/app/node_modules/undici/docs/docs/api/CacheStore.md +98 -309
  560. package/app/node_modules/undici/docs/docs/api/Client.md +164 -412
  561. package/app/node_modules/undici/docs/docs/api/ClientStats.md +14 -80
  562. package/app/node_modules/undici/docs/docs/api/Connector.md +35 -118
  563. package/app/node_modules/undici/docs/docs/api/ContentType.md +25 -65
  564. package/app/node_modules/undici/docs/docs/api/Cookies.md +71 -122
  565. package/app/node_modules/undici/docs/docs/api/Debug.md +18 -34
  566. package/app/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +167 -368
  567. package/app/node_modules/undici/docs/docs/api/Dispatcher.md +1056 -505
  568. package/app/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +93 -105
  569. package/app/node_modules/undici/docs/docs/api/Errors.md +28 -603
  570. package/app/node_modules/undici/docs/docs/api/EventSource.md +13 -326
  571. package/app/node_modules/undici/docs/docs/api/Fetch.md +30 -691
  572. package/app/node_modules/undici/docs/docs/api/GlobalInstallation.md +96 -78
  573. package/app/node_modules/undici/docs/docs/api/H2CClient.md +176 -299
  574. package/app/node_modules/undici/docs/docs/api/MockAgent.md +314 -333
  575. package/app/node_modules/undici/docs/docs/api/MockCallHistory.md +98 -272
  576. package/app/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +26 -189
  577. package/app/node_modules/undici/docs/docs/api/MockClient.md +33 -151
  578. package/app/node_modules/undici/docs/docs/api/MockErrors.md +5 -56
  579. package/app/node_modules/undici/docs/docs/api/MockPool.md +258 -321
  580. package/app/node_modules/undici/docs/docs/api/Pool.md +41 -235
  581. package/app/node_modules/undici/docs/docs/api/PoolStats.md +13 -119
  582. package/app/node_modules/undici/docs/docs/api/ProxyAgent.md +160 -179
  583. package/app/node_modules/undici/docs/docs/api/RedirectHandler.md +55 -241
  584. package/app/node_modules/undici/docs/docs/api/RetryAgent.md +27 -113
  585. package/app/node_modules/undici/docs/docs/api/RetryHandler.md +79 -161
  586. package/app/node_modules/undici/docs/docs/api/RoundRobinPool.md +72 -166
  587. package/app/node_modules/undici/docs/docs/api/SnapshotAgent.md +517 -262
  588. package/app/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +196 -177
  589. package/app/node_modules/undici/docs/docs/api/Util.md +11 -68
  590. package/app/node_modules/undici/docs/docs/api/WebSocket.md +80 -475
  591. package/app/node_modules/undici/docs/docs/api/api-lifecycle.md +32 -100
  592. package/app/node_modules/undici/docs/docs/best-practices/client-certificate.md +0 -2
  593. package/app/node_modules/undici/docs/docs/best-practices/crawling.md +1 -3
  594. package/app/node_modules/undici/docs/docs/best-practices/mocking-request.md +7 -9
  595. package/app/node_modules/undici/docs/docs/best-practices/proxy.md +1 -3
  596. package/app/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +8 -10
  597. package/app/node_modules/undici/docs/docs/best-practices/writing-tests.md +0 -2
  598. package/app/node_modules/undici/index.js +2 -4
  599. package/app/node_modules/undici/lib/api/api-connect.js +11 -13
  600. package/app/node_modules/undici/lib/api/api-pipeline.js +13 -26
  601. package/app/node_modules/undici/lib/api/api-request.js +21 -51
  602. package/app/node_modules/undici/lib/api/api-stream.js +20 -81
  603. package/app/node_modules/undici/lib/api/api-upgrade.js +11 -21
  604. package/app/node_modules/undici/lib/api/readable.js +11 -46
  605. package/app/node_modules/undici/lib/cache/memory-cache-store.js +15 -50
  606. package/app/node_modules/undici/lib/cache/sqlite-cache-store.js +18 -142
  607. package/app/node_modules/undici/lib/core/connect.js +7 -46
  608. package/app/node_modules/undici/lib/core/constants.js +23 -11
  609. package/app/node_modules/undici/lib/core/errors.js +3 -60
  610. package/app/node_modules/undici/lib/core/request.js +19 -116
  611. package/app/node_modules/undici/lib/core/symbols.js +0 -5
  612. package/app/node_modules/undici/lib/core/util.js +88 -110
  613. package/app/node_modules/undici/lib/dispatcher/agent.js +32 -51
  614. package/app/node_modules/undici/lib/dispatcher/balanced-pool.js +27 -23
  615. package/app/node_modules/undici/lib/dispatcher/client-h1.js +89 -166
  616. package/app/node_modules/undici/lib/dispatcher/client-h2.js +373 -1306
  617. package/app/node_modules/undici/lib/dispatcher/client.js +34 -114
  618. package/app/node_modules/undici/lib/dispatcher/dispatcher-base.js +8 -10
  619. package/app/node_modules/undici/lib/dispatcher/dispatcher.js +5 -15
  620. package/app/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +13 -57
  621. package/app/node_modules/undici/lib/dispatcher/h2c-client.js +4 -4
  622. package/app/node_modules/undici/lib/dispatcher/pool-base.js +27 -160
  623. package/app/node_modules/undici/lib/dispatcher/pool.js +16 -127
  624. package/app/node_modules/undici/lib/dispatcher/proxy-agent.js +29 -128
  625. package/app/node_modules/undici/lib/dispatcher/retry-agent.js +0 -13
  626. package/app/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -47
  627. package/app/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +63 -153
  628. package/app/node_modules/undici/lib/global.js +14 -37
  629. package/app/node_modules/undici/lib/handler/cache-handler.js +60 -101
  630. package/app/node_modules/undici/lib/handler/cache-revalidation-handler.js +0 -10
  631. package/app/node_modules/undici/lib/handler/decorator-handler.js +5 -14
  632. package/app/node_modules/undici/lib/handler/deduplication-handler.js +38 -74
  633. package/app/node_modules/undici/lib/handler/redirect-handler.js +72 -83
  634. package/app/node_modules/undici/lib/handler/retry-handler.js +45 -227
  635. package/app/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
  636. package/app/node_modules/undici/lib/handler/wrap-handler.js +105 -0
  637. package/app/node_modules/undici/lib/interceptor/cache.js +28 -53
  638. package/app/node_modules/undici/lib/interceptor/decompress.js +5 -12
  639. package/app/node_modules/undici/lib/interceptor/deduplicate.js +4 -5
  640. package/app/node_modules/undici/lib/interceptor/dns.js +1 -23
  641. package/app/node_modules/undici/lib/interceptor/redirect.js +3 -3
  642. package/app/node_modules/undici/lib/interceptor/response-error.js +28 -72
  643. package/app/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  644. package/app/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
  645. package/app/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
  646. package/app/node_modules/undici/lib/mock/mock-agent.js +9 -32
  647. package/app/node_modules/undici/lib/mock/mock-call-history.js +1 -1
  648. package/app/node_modules/undici/lib/mock/mock-interceptor.js +7 -25
  649. package/app/node_modules/undici/lib/mock/mock-utils.js +48 -292
  650. package/app/node_modules/undici/lib/mock/snapshot-agent.js +7 -25
  651. package/app/node_modules/undici/lib/mock/snapshot-recorder.js +5 -41
  652. package/app/node_modules/undici/lib/mock/snapshot-utils.js +2 -3
  653. package/app/node_modules/undici/lib/util/cache.js +14 -69
  654. package/app/node_modules/undici/lib/util/promise.js +28 -0
  655. package/app/node_modules/undici/lib/util/runtime-features.js +34 -3
  656. package/app/node_modules/undici/lib/web/cache/cache.js +16 -23
  657. package/app/node_modules/undici/lib/web/cache/cachestorage.js +5 -11
  658. package/app/node_modules/undici/lib/web/cookies/index.js +6 -16
  659. package/app/node_modules/undici/lib/web/cookies/parse.js +4 -7
  660. package/app/node_modules/undici/lib/web/cookies/util.js +1 -1
  661. package/app/node_modules/undici/lib/web/eventsource/eventsource.js +23 -66
  662. package/app/node_modules/undici/lib/web/eventsource/util.js +1 -32
  663. package/app/node_modules/undici/lib/web/fetch/body.js +25 -90
  664. package/app/node_modules/undici/lib/web/fetch/constants.js +1 -1
  665. package/app/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  666. package/app/node_modules/undici/lib/web/fetch/formdata-parser.js +4 -12
  667. package/app/node_modules/undici/lib/web/fetch/formdata.js +26 -39
  668. package/app/node_modules/undici/lib/web/fetch/headers.js +33 -36
  669. package/app/node_modules/undici/lib/web/fetch/index.js +259 -297
  670. package/app/node_modules/undici/lib/web/fetch/request.js +170 -172
  671. package/app/node_modules/undici/lib/web/fetch/response.js +47 -44
  672. package/app/node_modules/undici/lib/web/fetch/util.js +9 -17
  673. package/app/node_modules/undici/lib/web/infra/index.js +14 -15
  674. package/app/node_modules/undici/lib/web/webidl/index.js +21 -7
  675. package/app/node_modules/undici/lib/web/websocket/connection.js +5 -16
  676. package/app/node_modules/undici/lib/web/websocket/events.js +26 -43
  677. package/app/node_modules/undici/lib/web/websocket/frame.js +7 -1
  678. package/app/node_modules/undici/lib/web/websocket/receiver.js +3 -13
  679. package/app/node_modules/undici/lib/web/websocket/stream/websocketerror.js +10 -13
  680. package/app/node_modules/undici/lib/web/websocket/stream/websocketstream.js +14 -29
  681. package/app/node_modules/undici/lib/web/websocket/websocket.js +40 -65
  682. package/app/node_modules/undici/package.json +13 -15
  683. package/app/node_modules/undici/types/agent.d.ts +2 -0
  684. package/app/node_modules/undici/types/api.d.ts +1 -1
  685. package/app/node_modules/undici/types/cache-interceptor.d.ts +0 -10
  686. package/app/node_modules/undici/types/client.d.ts +27 -64
  687. package/app/node_modules/undici/types/connector.d.ts +0 -1
  688. package/app/node_modules/undici/types/cookies.d.ts +1 -1
  689. package/app/node_modules/undici/types/diagnostics-channel.d.ts +1 -2
  690. package/app/node_modules/undici/types/dispatcher.d.ts +30 -8
  691. package/app/node_modules/undici/types/errors.d.ts +1 -26
  692. package/app/node_modules/undici/types/fetch.d.ts +1 -5
  693. package/app/node_modules/undici/types/formdata.d.ts +12 -6
  694. package/app/node_modules/undici/types/h2c-client.d.ts +7 -7
  695. package/app/node_modules/undici/types/handlers.d.ts +0 -2
  696. package/app/node_modules/undici/types/header.d.ts +0 -5
  697. package/app/node_modules/undici/types/index.d.ts +1 -3
  698. package/app/node_modules/undici/types/interceptors.d.ts +2 -7
  699. package/app/node_modules/undici/types/mock-agent.d.ts +10 -11
  700. package/app/node_modules/undici/types/mock-interceptor.d.ts +1 -5
  701. package/app/node_modules/undici/types/pool.d.ts +2 -0
  702. package/app/node_modules/undici/types/proxy-agent.d.ts +2 -9
  703. package/app/node_modules/undici/types/retry-handler.d.ts +3 -3
  704. package/app/node_modules/undici/types/round-robin-pool.d.ts +2 -0
  705. package/app/node_modules/undici/types/snapshot-agent.d.ts +0 -4
  706. package/app/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -4
  707. package/app/node_modules/undici/types/utility.d.ts +4 -4
  708. package/app/node_modules/undici/types/webidl.d.ts +8 -13
  709. package/app/package.json +5 -2
  710. package/app/public/providers/sensenova-intl.png +0 -0
  711. package/app/src/shared/services/quotaAutoPing.js +17 -2
  712. package/package.json +2 -2
  713. package/app/.next-cli-build/server/chunks/1004.js +0 -1
  714. package/app/.next-cli-build/server/chunks/4480.js +0 -1
  715. package/app/.next-cli-build/server/chunks/4811.js +0 -51
  716. package/app/.next-cli-build/server/chunks/547.js +0 -1
  717. package/app/.next-cli-build/server/chunks/7573.js +0 -1
  718. package/app/.next-cli-build/server/chunks/8499.js +0 -1
  719. package/app/.next-cli-build/server/chunks/9102.js +0 -1
  720. package/app/.next-cli-build/static/chunks/1321-93eb6ca56f8fcb1e.js +0 -1
  721. package/app/.next-cli-build/static/chunks/5497-02b05d77d17bcdc3.js +0 -7
  722. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-74ca3f1d4f1ec046.js +0 -27
  723. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/page-b44167799c6c673a.js +0 -4
  724. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/page-f16fd9091b7ae81c.js +0 -1
  725. package/app/node_modules/undici/docs/docs/api/Interceptors.md +0 -439
  726. package/app/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +0 -233
  727. package/app/node_modules/undici/docs/docs/getting-started.md +0 -281
  728. package/app/node_modules/undici/docs/docs/index.md +0 -793
  729. package/app/node_modules/undici/docs/docs/site.json +0 -125
  730. package/app/node_modules/undici/docs/docs/type-map.json +0 -79
  731. package/app/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -127
  732. package/app/node_modules/undici/lib/dispatcher/parser-h1.js +0 -1065
  733. package/app/node_modules/undici/lib/milo/LICENSE.md +0 -7
  734. package/app/node_modules/undici/lib/milo/no-simd.js +0 -1002
  735. package/app/node_modules/undici/lib/milo/simd.js +0 -1002
  736. package/app/node_modules/undici/types/dispatcher1-wrapper.d.ts +0 -7
  737. /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_buildManifest.js +0 -0
  738. /package/app/.next-cli-build/static/{erY6mcU6WqDeuYANqpCwQ → mEL-faV-rpAwzfhUdVe-c}/_ssgManifest.js +0 -0
@@ -1,61 +1,34 @@
1
1
  # Dispatcher
2
2
 
3
- <!--introduced_in=v4.0.0-->
3
+ Extends: `events.EventEmitter`
4
4
 
5
- <!--type=module-->
5
+ Dispatcher is the core API used to dispatch requests.
6
6
 
7
- <!-- source_link=lib/dispatcher/dispatcher.js -->
7
+ Requests are not guaranteed to be dispatched in order of invocation.
8
8
 
9
- > Stability: 2 - Stable
9
+ ## Instance Methods
10
10
 
11
- `Dispatcher` is the core abstraction used to dispatch HTTP requests in undici.
12
- It extends [`EventEmitter`][] and defines the low-level [`dispatch()`][] contract
13
- along with the higher-level [`request()`][], [`stream()`][], [`pipeline()`][],
14
- [`connect()`][], and [`upgrade()`][] methods that every concrete dispatcher
15
- provides.
11
+ ### `Dispatcher.close([callback]): Promise`
16
12
 
17
- `Dispatcher` itself is abstract: its [`dispatch()`][], [`close()`][], and
18
- [`destroy()`][] methods throw `Error: not implemented`. Concrete dispatchers such
19
- as [`Client`][], [`Pool`][], [`BalancedPool`][], and [`Agent`][] implement the
20
- contract and are what application code instantiates. Requests are not guaranteed
21
- to be dispatched in the order in which they are invoked.
13
+ Closes the dispatcher and gracefully waits for enqueued requests to complete before resolving.
22
14
 
23
- ```mjs
24
- import { Dispatcher, Agent } from 'undici'
15
+ Arguments:
25
16
 
26
- const dispatcher = new Agent()
27
- console.log(dispatcher instanceof Dispatcher) // true
28
- ```
29
-
30
- ## Class: `Dispatcher`
31
-
32
- <!-- YAML
33
- added: v4.0.0
34
- -->
35
-
36
- * Extends: {EventEmitter}
37
-
38
- Base dispatcher class. Concrete dispatchers extend it and implement the
39
- [`dispatch()`][] method on which the other request helpers are built.
40
-
41
- ### `dispatcher.close([callback])`
17
+ * **callback** `(error: Error | null, data: null) => void` (optional)
42
18
 
43
- <!-- YAML
44
- added: v4.0.0
45
- -->
19
+ Returns: `void | Promise<null>` - Only returns a `Promise` if no `callback` argument was passed
46
20
 
47
- * `callback` {Function} (optional) Invoked once the dispatcher is closed.
48
- * `error` {Error|null}
49
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
50
- resolves with `void` once the dispatcher is closed.
21
+ ```js
22
+ dispatcher.close() // -> Promise
23
+ dispatcher.close(() => {}) // -> void
24
+ ```
51
25
 
52
- Closes the dispatcher and gracefully waits for enqueued requests to complete
53
- before resolving or invoking `callback`.
26
+ #### Example - Request resolves before Client closes
54
27
 
55
- ```mjs
56
- import { createServer } from 'node:http'
28
+ ```js
29
+ import { createServer } from 'http'
57
30
  import { Client } from 'undici'
58
- import { once } from 'node:events'
31
+ import { once } from 'events'
59
32
 
60
33
  const server = createServer((request, response) => {
61
34
  response.end('undici')
@@ -66,7 +39,10 @@ await once(server, 'listening')
66
39
  const client = new Client(`http://localhost:${server.address().port}`)
67
40
 
68
41
  try {
69
- const { body } = await client.request({ path: '/', method: 'GET' })
42
+ const { body } = await client.request({
43
+ path: '/',
44
+ method: 'GET'
45
+ })
70
46
  body.setEncoding('utf8')
71
47
  body.on('data', console.log)
72
48
  } catch (error) {}
@@ -77,41 +53,40 @@ console.log('Client closed')
77
53
  server.close()
78
54
  ```
79
55
 
80
- ### `dispatcher.connect(options[, callback])`
81
-
82
- <!-- YAML
83
- added: v4.0.0
84
- -->
85
-
86
- * `options` {Object}
87
- * `origin` {string|URL} The origin to connect to.
88
- * `path` {string} The request path.
89
- * `headers` {UndiciHeaders} Request headers. **Default:** `null`.
90
- * `signal` {AbortSignal|EventEmitter|null} A signal used to abort the request.
91
- **Default:** `null`.
92
- * `opaque` {any} An opaque value passed through to the returned `ConnectData`.
93
- * `responseHeaders` {string|null} Set to `'raw'` to return the response headers
94
- as a raw array instead of an object. **Default:** `null`.
95
- * `callback` {Function} (optional) Invoked when the connection is established.
96
- * `error` {Error|null}
97
- * `data` {Object}
98
- * `statusCode` {number}
99
- * `headers` {Object} The response headers.
100
- * `socket` {Duplex} The established socket.
101
- * `opaque` {any} The `opaque` value passed in `options`.
102
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
103
- resolves with the `data` object described above.
104
-
105
- Starts two-way communications with the requested resource using the
106
- [HTTP `CONNECT`][] method.
107
-
108
- ```mjs
109
- import { createServer } from 'node:http'
56
+ ### `Dispatcher.connect(options[, callback])`
57
+
58
+ Starts two-way communications with the requested resource using [HTTP CONNECT](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT).
59
+
60
+ Arguments:
61
+
62
+ * **options** `ConnectOptions`
63
+ * **callback** `(err: Error | null, data: ConnectData | null) => void` (optional)
64
+
65
+ Returns: `void | Promise<ConnectData>` - Only returns a `Promise` if no `callback` argument was passed
66
+
67
+ #### Parameter: `ConnectOptions`
68
+
69
+ * **path** `string`
70
+ * **headers** `UndiciHeaders` (optional) - Default: `null`
71
+ * **signal** `AbortSignal | events.EventEmitter | null` (optional) - Default: `null`
72
+ * **opaque** `unknown` (optional) - This argument parameter is passed through to `ConnectData`
73
+
74
+ #### Parameter: `ConnectData`
75
+
76
+ * **statusCode** `number`
77
+ * **headers** `Record<string, string | string[] | undefined>`
78
+ * **socket** `stream.Duplex`
79
+ * **opaque** `unknown`
80
+
81
+ #### Example - Connect request with echo
82
+
83
+ ```js
84
+ import { createServer } from 'http'
110
85
  import { Client } from 'undici'
111
- import { once } from 'node:events'
86
+ import { once } from 'events'
112
87
 
113
88
  const server = createServer((request, response) => {
114
- throw new Error('should never get here')
89
+ throw Error('should never get here')
115
90
  }).listen()
116
91
 
117
92
  server.on('connect', (req, socket, head) => {
@@ -132,7 +107,9 @@ await once(server, 'listening')
132
107
  const client = new Client(`http://localhost:${server.address().port}`)
133
108
 
134
109
  try {
135
- const { socket } = await client.connect({ path: '/' })
110
+ const { socket } = await client.connect({
111
+ path: '/'
112
+ })
136
113
  const wanted = 'Body'
137
114
  let data = ''
138
115
  socket.on('data', d => { data += d })
@@ -143,39 +120,35 @@ try {
143
120
  })
144
121
  socket.write(wanted)
145
122
  socket.end()
146
- } catch (error) {}
123
+ } catch (error) { }
147
124
  ```
148
125
 
149
- ### `dispatcher.destroy([error[, callback]])`
126
+ ### `Dispatcher.destroy([error, callback]): Promise`
127
+
128
+ Destroy the dispatcher abruptly with the given error. All the pending and running requests will be asynchronously aborted and error. Since this operation is asynchronously dispatched there might still be some progress on dispatched requests.
150
129
 
151
- <!-- YAML
152
- added: v4.0.0
153
- -->
130
+ Both arguments are optional; the method can be called in four different ways:
154
131
 
155
- * `error` {Error|null} (optional) The error with which pending requests are
156
- rejected. **Default:** `null`.
157
- * `callback` {Function} (optional) Invoked once the socket is closed.
158
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
159
- resolves with `void` once the dispatcher is destroyed.
132
+ Arguments:
160
133
 
161
- Destroys the dispatcher abruptly with the given `error`. All pending and running
162
- requests are asynchronously aborted and rejected. Because the operation is
163
- dispatched asynchronously, dispatched requests may still make some progress
164
- before being aborted.
134
+ * **error** `Error | null` (optional)
135
+ * **callback** `(error: Error | null, data: null) => void` (optional)
165
136
 
166
- Both arguments are optional, so the method can be called in four ways:
137
+ Returns: `void | Promise<void>` - Only returns a `Promise` if no `callback` argument was passed
167
138
 
168
- ```mjs
139
+ ```js
169
140
  dispatcher.destroy() // -> Promise
170
141
  dispatcher.destroy(new Error()) // -> Promise
171
142
  dispatcher.destroy(() => {}) // -> void
172
143
  dispatcher.destroy(new Error(), () => {}) // -> void
173
144
  ```
174
145
 
175
- ```mjs
176
- import { createServer } from 'node:http'
146
+ #### Example - Request is aborted when Client is destroyed
147
+
148
+ ```js
149
+ import { createServer } from 'http'
177
150
  import { Client } from 'undici'
178
- import { once } from 'node:events'
151
+ import { once } from 'events'
179
152
 
180
153
  const server = createServer((request, response) => {
181
154
  response.end()
@@ -186,7 +159,10 @@ await once(server, 'listening')
186
159
  const client = new Client(`http://localhost:${server.address().port}`)
187
160
 
188
161
  try {
189
- const request = client.request({ path: '/', method: 'GET' })
162
+ const request = client.request({
163
+ path: '/',
164
+ method: 'GET'
165
+ })
190
166
  client.destroy()
191
167
  .then(() => {
192
168
  console.log('Client destroyed')
@@ -198,117 +174,50 @@ try {
198
174
  }
199
175
  ```
200
176
 
201
- ### `dispatcher.dispatch(options, handler)`
202
-
203
- <!-- YAML
204
- added: v4.0.0
205
- -->
206
-
207
- * `options` {Object}
208
- * `origin` {string|URL} The origin to dispatch the request to. Optional for a
209
- dispatcher that is already bound to a single origin, such as `Client` or
210
- `Pool`, which then use their own origin. Required on `Agent`, which is not
211
- bound to one origin and throws an `InvalidArgumentError` when it is missing.
212
- * `path` {string} The request path.
213
- * `method` {string} The HTTP method, e.g. `'GET'` or `'POST'`.
214
- * `body` {string|Buffer|Uint8Array|Readable|FormData|null} The request body.
215
- Undici's network clients require a `FormData` body created by the same
216
- undici package instance. A body from another source, including Node.js's
217
- built-in `FormData`, is rejected with an `InvalidArgumentError`.
218
- **Default:** `null`.
219
- * `headers` {UndiciHeaders} Request headers. **Default:** `null`.
220
- * `query` {Object} Query string parameters embedded into the request URL. Both
221
- keys and values are encoded with `encodeURIComponent`. **Default:** `null`.
222
- * `idempotent` {boolean} Whether the request can be safely retried. If `false`,
223
- the request is not sent until all preceding requests in the pipeline have
224
- completed. **Default:** `true` when `method` is `'HEAD'` or `'GET'`.
225
- * `blocking` {boolean} Whether the response is expected to block the pipeline.
226
- When `true`, further pipelining on the same connection is avoided until
227
- headers have been received. **Default:** `method !== 'HEAD'`.
228
- * `typeOfService` {number|null} The IP Type of Service (ToS) value for the
229
- request socket. Must be an integer between `0` and `255`. **Default:** `0`.
230
- * `upgrade` {boolean|string|null} Upgrades the request, e.g. to `'Websocket'`.
231
- **Default:** `null`, or the request method when it is `'CONNECT'`.
232
- * `headersTimeout` {number|null} The time, in milliseconds, the parser waits to
233
- receive the complete HTTP headers. Defaults to 300 seconds.
234
- * `bodyTimeout` {number|null} The time, in milliseconds, after which the request
235
- times out while receiving body data. Monitors the time between body chunks.
236
- Use `0` to disable it entirely. Defaults to 300 seconds.
237
- HTTP/1.1 headers/body parser timeouts are not guaranteed to fire with exact
238
- millisecond precision: delays up to 1000ms use native timers, while larger
239
- delays use undici's lower-overhead fast timers with a target resolution
240
- around 500ms.
241
- * `reset` {boolean} Whether the request should establish a keep-alive
242
- connection. **Default:** `false`.
243
- * `expectContinue` {boolean} For HTTP/2, appends the `expect: 100-continue`
244
- header and halts the request body until a `100 Continue` is received from the
245
- remote server. **Default:** `false`.
246
- * `handler` {Object} A set of callbacks invoked over the request lifecycle.
247
- * `onRequestStart` {Function} Invoked before the request is dispatched on the
248
- socket. May be invoked multiple times when the request is retried.
249
- * `controller` {DispatchController}
250
- * `context` {any}
251
- * `onRequestUpgrade` {Function} (optional) Invoked when the request is upgraded.
252
- Required when `options.upgrade` is set or `options.method` is `'CONNECT'`.
253
- * `controller` {DispatchController}
254
- * `statusCode` {number}
255
- * `headers` {Object}
256
- * `socket` {Duplex}
257
- * `onResponseStart` {Function} (optional) Invoked when the status code and
258
- headers have been received. May be invoked multiple times for 1xx
259
- informational responses. Not used for `upgrade` requests.
260
- * `controller` {DispatchController}
261
- * `statusCode` {number}
262
- * `headers` {Object}
263
- * `statusMessage` {string} (optional)
264
- * `onResponseData` {Function} (optional) Invoked when response payload data is
265
- received. Not used for `upgrade` requests.
266
- * `controller` {DispatchController}
267
- * `chunk` {Buffer}
268
- * `onResponseEnd` {Function} (optional) Invoked when the response payload and
269
- trailers have been received and the request has completed. Not used for
270
- `upgrade` requests.
271
- * `controller` {DispatchController}
272
- * `trailers` {Object}
273
- * `onResponseError` {Function} (optional) Invoked when an error occurs. Must not
274
- throw.
275
- * `controller` {DispatchController}
276
- * `error` {Error}
277
- * `onResponseStarted` {Function} (optional) Invoked when the response is
278
- received, before headers have been read.
279
- * `onBodySent` {Function} (optional) Invoked when a chunk of the request body is
280
- sent. May be invoked multiple times for chunked requests.
281
- * `chunk` {Buffer}
282
- * `onRequestSent` {Function} (optional) Invoked after the request body is fully
283
- sent.
284
- * Returns: {boolean} `false` when the dispatcher is busy and further `dispatch()`
285
- calls will make no progress until the [`'drain'`][] event is emitted.
286
-
287
- This is the low-level API on which all the higher-level methods are built. This
288
- API is expected to evolve through semver-major versions and is less stable than
289
- the higher-level methods. It is primarily intended for library developers who
290
- implement higher-level APIs on top of it.
291
-
292
- The `controller` passed to each handler is a `DispatchController` with the
293
- following shape:
294
-
295
- * `aborted` {boolean} Whether the request has been aborted.
296
- * `paused` {boolean} Whether the request is paused.
297
- * `reason` {Error|null} The reason the request was aborted, if any.
298
- * `rawHeaders` {Buffer[]|string[]|Object|null} The raw response headers,
299
- preserving duplicates and casing.
300
- * `rawTrailers` {Buffer[]|string[]|Object|null} The raw response trailers.
301
- * `abort(reason)` Aborts the request with the given `reason`.
302
- * `pause()` Pauses the response stream.
303
- * `resume()` Resumes the response stream.
304
-
305
- Call `controller.pause()` and `controller.resume()` to apply backpressure rather
306
- than returning `false` from a handler.
307
-
308
- ```mjs
309
- import { createServer } from 'node:http'
177
+ ### `Dispatcher.dispatch(options, handler)`
178
+
179
+ This is the low level API which all the preceding APIs are implemented on top of.
180
+ This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs.
181
+ It is primarily intended for library developers who implement higher level APIs on top of this.
182
+
183
+ Arguments:
184
+
185
+ * **options** `DispatchOptions`
186
+ * **handler** `DispatchHandler`
187
+
188
+ Returns: `Boolean` - `false` if dispatcher is busy and further dispatch calls won't make any progress until the `'drain'` event has been emitted.
189
+
190
+ #### Parameter: `DispatchOptions`
191
+
192
+ * **origin** `string | URL`
193
+ * **path** `string`
194
+ * **method** `string`
195
+ * **reset** `boolean` (optional) - Default: `false` - If `false`, the request will attempt to create a long-living connection by sending the `connection: keep-alive` header,otherwise will attempt to close it immediately after response by sending `connection: close` within the request and closing the socket afterwards.
196
+ * **body** `string | Buffer | Uint8Array | stream.Readable | Iterable | AsyncIterable | null` (optional) - Default: `null`
197
+ * **headers** `UndiciHeaders` (optional) - Default: `null`.
198
+ * **query** `Record<string, any> | null` (optional) - Default: `null` - Query string params to be embedded in the request URL. Note that both keys and values of query are encoded using `encodeURIComponent`. If for some reason you need to send them unencoded, embed query params into path directly instead.
199
+ * **idempotent** `boolean` (optional) - Default: `true` if `method` is `'HEAD'` or `'GET'` - Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline has completed.
200
+ * **blocking** `boolean` (optional) - Default: `method !== 'HEAD'` - 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.
201
+ * **upgrade** `string | null` (optional) - Default: `null` - Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`.
202
+ * **bodyTimeout** `number | null` (optional) - 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.
203
+ * **headersTimeout** `number | null` (optional) - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
204
+ * **expectContinue** `boolean` (optional) - Default: `false` - For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server
205
+
206
+ #### Parameter: `DispatchHandler`
207
+
208
+ * **onRequestStart** `(controller: DispatchController, context: object) => void` - 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.
209
+ * **onRequestUpgrade** `(controller: DispatchController, statusCode: number, headers: Record<string, string | string[]>, socket: Duplex) => void` (optional) - Invoked when request is upgraded. Required if `DispatchOptions.upgrade` is defined or `DispatchOptions.method === 'CONNECT'`.
210
+ * **onResponseStart** `(controller: DispatchController, statusCode: number, headers: Record<string, string | string []>, statusMessage?: string) => void` - Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. Not required for `upgrade` requests. Any return value is ignored.
211
+ * **onResponseData** `(controller: DispatchController, chunk: Buffer) => void` - Invoked when response payload data is received. Not required for `upgrade` requests.
212
+ * **onResponseEnd** `(controller: DispatchController, trailers: Record<string, string | string[]>) => void` - Invoked when response payload and trailers have been received and the request has completed. Not required for `upgrade` requests.
213
+ * **onResponseError** `(controller: DispatchController, error: Error) => void` - Invoked when an error has occurred. May not throw.
214
+
215
+ #### Example 1 - Dispatch GET request
216
+
217
+ ```js
218
+ import { createServer } from 'http'
310
219
  import { Client } from 'undici'
311
- import { once } from 'node:events'
220
+ import { once } from 'events'
312
221
 
313
222
  const server = createServer((request, response) => {
314
223
  response.end('Hello, World!')
@@ -323,61 +232,169 @@ const data = []
323
232
  client.dispatch({
324
233
  path: '/',
325
234
  method: 'GET',
326
- headers: { 'x-foo': 'bar' }
235
+ headers: {
236
+ 'x-foo': 'bar'
237
+ }
327
238
  }, {
328
- onRequestStart: () => {
239
+ onConnect: () => {
329
240
  console.log('Connected!')
330
241
  },
331
- onResponseError: (_controller, error) => {
242
+ onError: (error) => {
332
243
  console.error(error)
333
244
  },
334
- onResponseStart: (_controller, statusCode, headers) => {
335
- console.log(`statusCode: ${statusCode} | headers: ${JSON.stringify(headers)}`)
245
+ onHeaders: (statusCode, headers) => {
246
+ console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`)
336
247
  },
337
- onResponseData: (_controller, chunk) => {
248
+ onData: (chunk) => {
249
+ console.log('onData: chunk received')
338
250
  data.push(chunk)
339
251
  },
340
- onResponseEnd: (_controller, trailers) => {
341
- console.log(`trailers: ${JSON.stringify(trailers)}`)
342
- console.log(`Data: ${Buffer.concat(data).toString('utf8')}`)
252
+ onComplete: (trailers) => {
253
+ console.log(`onComplete | trailers: ${trailers}`)
254
+ const res = Buffer.concat(data).toString('utf8')
255
+ console.log(`Data: ${res}`)
343
256
  client.close()
344
257
  server.close()
345
258
  }
346
259
  })
347
260
  ```
348
261
 
349
- ### `dispatcher.pipeline(options, handler)`
350
-
351
- <!-- YAML
352
- added: v4.0.0
353
- -->
354
-
355
- * `options` {Object} Accepts every field of [`dispatcher.request()`][]'s
356
- `options`, plus:
357
- * `objectMode` {boolean} Set to `true` when `handler` returns an object stream.
358
- **Default:** `false`.
359
- * `handler` {Function} Returns a `Readable` from which the result is read.
360
- * `data` {Object}
361
- * `statusCode` {number}
362
- * `headers` {Object} The response headers.
363
- * `opaque` {any} The `opaque` value passed in `options`.
364
- * `body` {Readable} The response body.
365
- * `context` {Object}
366
- * Returns: {Readable}
367
- * Returns: {Duplex} A duplex stream that writes to the request and reads from the
368
- response.
369
-
370
- For easy use with [`stream.pipeline()`][]. The `handler` should return a
371
- `Readable` from which the result is read. Usually it returns the `body` directly,
372
- unless a transformation is needed based on, for example, `headers` or
373
- `statusCode`. The `handler` should validate the response and save any required
374
- state; if there is an error, it should be thrown.
375
-
376
- ```mjs
377
- import { Readable, Writable, PassThrough, pipeline } from 'node:stream'
378
- import { createServer } from 'node:http'
262
+ #### Example 2 - Dispatch Upgrade Request
263
+
264
+ ```js
265
+ import { createServer } from 'http'
379
266
  import { Client } from 'undici'
380
- import { once } from 'node:events'
267
+ import { once } from 'events'
268
+
269
+ const server = createServer((request, response) => {
270
+ response.end()
271
+ }).listen()
272
+
273
+ await once(server, 'listening')
274
+
275
+ server.on('upgrade', (request, socket, head) => {
276
+ console.log('Node.js Server - upgrade event')
277
+ socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n')
278
+ socket.write('Upgrade: WebSocket\r\n')
279
+ socket.write('Connection: Upgrade\r\n')
280
+ socket.write('\r\n')
281
+ socket.end()
282
+ })
283
+
284
+ const client = new Client(`http://localhost:${server.address().port}`)
285
+
286
+ client.dispatch({
287
+ path: '/',
288
+ method: 'GET',
289
+ upgrade: 'websocket'
290
+ }, {
291
+ onConnect: () => {
292
+ console.log('Undici Client - onConnect')
293
+ },
294
+ onError: (error) => {
295
+ console.log('onError') // shouldn't print
296
+ },
297
+ onUpgrade: (statusCode, headers, socket) => {
298
+ console.log('Undici Client - onUpgrade')
299
+ console.log(`onUpgrade Headers: ${headers}`)
300
+ socket.on('data', buffer => {
301
+ console.log(buffer.toString('utf8'))
302
+ })
303
+ socket.on('end', () => {
304
+ client.close()
305
+ server.close()
306
+ })
307
+ socket.end()
308
+ }
309
+ })
310
+ ```
311
+
312
+ #### Example 3 - Dispatch POST request
313
+
314
+ ```js
315
+ import { createServer } from 'http'
316
+ import { Client } from 'undici'
317
+ import { once } from 'events'
318
+
319
+ const server = createServer((request, response) => {
320
+ request.on('data', (data) => {
321
+ console.log(`Request Data: ${data.toString('utf8')}`)
322
+ const body = JSON.parse(data)
323
+ body.message = 'World'
324
+ response.end(JSON.stringify(body))
325
+ })
326
+ }).listen()
327
+
328
+ await once(server, 'listening')
329
+
330
+ const client = new Client(`http://localhost:${server.address().port}`)
331
+
332
+ const data = []
333
+
334
+ client.dispatch({
335
+ path: '/',
336
+ method: 'POST',
337
+ headers: {
338
+ 'content-type': 'application/json'
339
+ },
340
+ body: JSON.stringify({ message: 'Hello' })
341
+ }, {
342
+ onConnect: () => {
343
+ console.log('Connected!')
344
+ },
345
+ onError: (error) => {
346
+ console.error(error)
347
+ },
348
+ onHeaders: (statusCode, headers) => {
349
+ console.log(`onHeaders | statusCode: ${statusCode} | headers: ${headers}`)
350
+ },
351
+ onData: (chunk) => {
352
+ console.log('onData: chunk received')
353
+ data.push(chunk)
354
+ },
355
+ onComplete: (trailers) => {
356
+ console.log(`onComplete | trailers: ${trailers}`)
357
+ const res = Buffer.concat(data).toString('utf8')
358
+ console.log(`Response Data: ${res}`)
359
+ client.close()
360
+ server.close()
361
+ }
362
+ })
363
+ ```
364
+
365
+ ### `Dispatcher.pipeline(options, handler)`
366
+
367
+ For easy use with [stream.pipeline](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options). The `handler` argument should return a `Readable` from which the result will be read. Usually it should just return the `body` argument unless some kind of transformation needs to be performed based on e.g. `headers` or `statusCode`. The `handler` should validate the response and save any required state. If there is an error, it should be thrown. The function returns a `Duplex` which writes to the request and reads from the response.
368
+
369
+ Arguments:
370
+
371
+ * **options** `PipelineOptions`
372
+ * **handler** `(data: PipelineHandlerData) => stream.Readable`
373
+
374
+ Returns: `stream.Duplex`
375
+
376
+ #### Parameter: PipelineOptions
377
+
378
+ Extends: [`RequestOptions`](/docs/docs/api/Dispatcher.md#parameter-requestoptions)
379
+
380
+ * **objectMode** `boolean` (optional) - Default: `false` - Set to `true` if the `handler` will return an object stream.
381
+
382
+ #### Parameter: PipelineHandlerData
383
+
384
+ * **statusCode** `number`
385
+ * **headers** `Record<string, string | string[] | undefined>`
386
+ * **opaque** `unknown`
387
+ * **body** `stream.Readable`
388
+ * **context** `object`
389
+ * **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
390
+
391
+ #### Example 1 - Pipeline Echo
392
+
393
+ ```js
394
+ import { Readable, Writable, PassThrough, pipeline } from 'stream'
395
+ import { createServer } from 'http'
396
+ import { Client } from 'undici'
397
+ import { once } from 'events'
381
398
 
382
399
  const server = createServer((request, response) => {
383
400
  request.pipe(response)
@@ -396,7 +413,10 @@ pipeline(
396
413
  this.push(null)
397
414
  }
398
415
  }),
399
- client.pipeline({ path: '/', method: 'GET' }, ({ statusCode, headers, body }) => {
416
+ client.pipeline({
417
+ path: '/',
418
+ method: 'GET'
419
+ }, ({ statusCode, headers, body }) => {
400
420
  console.log(`response received ${statusCode}`)
401
421
  console.log('headers', headers)
402
422
  return pipeline(body, new PassThrough(), () => {})
@@ -415,81 +435,79 @@ pipeline(
415
435
  if (error) {
416
436
  console.error(error)
417
437
  }
438
+
418
439
  client.close()
419
440
  server.close()
420
441
  }
421
442
  )
422
443
  ```
423
444
 
424
- ### `dispatcher.request(options[, callback])`
425
-
426
- <!-- YAML
427
- added: v4.0.0
428
- -->
429
-
430
- * `options` {Object} Accepts every field of [`dispatcher.dispatch()`][]'s
431
- `options`, plus:
432
- * `opaque` {any} A value passed through to the returned response data.
433
- **Default:** `null`.
434
- * `signal` {AbortSignal|EventEmitter|null} A signal used to abort the request.
435
- **Default:** `null`.
436
- * `onInfo` {Function|null} Invoked for each informational (1xx) response
437
- received. **Default:** `null`.
438
- * `info` {Object}
439
- * `statusCode` {number}
440
- * `headers` {Object}
441
- * `responseHeaders` {string|null} Set to `'raw'` to return the response headers
442
- as a raw array. **Default:** `null`.
443
- * `highWaterMark` {number} The high water mark of the response body stream.
444
- **Default:** `65536` (64 KiB).
445
- * `callback` {Function} (optional) Invoked when the response is received.
446
- * `error` {Error|null}
447
- * `data` {Object}
448
- * `statusCode` {number}
449
- * `statusText` {string} The status message, e.g. `'OK'` or `'Not Found'`.
450
- * `headers` {Object} The response headers. All keys are lower-cased.
451
- * `body` {Readable} The response body, which also implements the
452
- [body mixin][] from the Fetch Standard.
453
- * `trailers` {Object} Starts out empty and is mutated to contain the trailers
454
- after `body` emits `'end'`.
455
- * `opaque` {any} The `opaque` value passed in `options`.
456
- * `context` {Object}
457
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
458
- resolves with the `data` object described above.
459
-
460
- Performs an HTTP request. `options.method` must not be `'CONNECT'`.
461
-
462
- Non-idempotent requests are not pipelined, to avoid indirect failures. Idempotent
463
- requests are automatically retried if they fail due to an indirect failure from
464
- the request at the head of the pipeline; this does not apply to idempotent
465
- requests with a stream request body. All response bodies must always be fully
466
- consumed or destroyed.
467
-
468
- The `body` exposes the following [body mixin][] methods and properties:
469
- [`.arrayBuffer()`][], [`.blob()`][], [`.bytes()`][], [`.json()`][],
470
- [`.text()`][], `body`, and `bodyUsed`. A body cannot be consumed twice; for
471
- example, calling `text()` after `json()` throws a `TypeError`. The body also
472
- provides `dump({ limit })`, which discards up to `limit` bytes (default
473
- `131072`) without destroying the socket.
474
-
475
- > [!WARNING]
476
- > The `arrayBuffer()`, `blob()`, `bytes()`, `json()`, and `text()` methods buffer
477
- > the entire body in memory before returning. Where applicable, they also decode
478
- > or parse the payload and retain that representation in memory. Calling these
479
- > methods therefore means trusting that the body is small enough to fit in the
480
- > available memory. Do not use them for bodies received from untrusted or
481
- > user-controlled sources. Instead, process `body` as a `Readable` stream and
482
- > enforce an application-specific size limit.
483
-
484
- The body is always a `Readable`, even when empty. Deserializing an empty body
485
- with `json()` throws. To guard against this, verify the status code is not `204`
486
- and the `content-type` header starts with `application/json` before calling
487
- `json()`.
488
-
489
- ```mjs
490
- import { createServer } from 'node:http'
445
+ ### `Dispatcher.request(options[, callback])`
446
+
447
+ Performs a HTTP request.
448
+
449
+ Non-idempotent requests will not be pipelined in order
450
+ to avoid indirect failures.
451
+
452
+ Idempotent requests will be automatically retried if
453
+ they fail due to indirect failure from the request
454
+ at the head of the pipeline. This does not apply to
455
+ idempotent requests with a stream request body.
456
+
457
+ All response bodies must always be fully consumed or destroyed.
458
+
459
+ Arguments:
460
+
461
+ * **options** `RequestOptions`
462
+ * **callback** `(error: Error | null, data: ResponseData) => void` (optional)
463
+
464
+ Returns: `void | Promise<ResponseData>` - Only returns a `Promise` if no `callback` argument was passed.
465
+
466
+ #### Parameter: `RequestOptions`
467
+
468
+ Extends: [`DispatchOptions`](/docs/docs/api/Dispatcher.md#parameter-dispatchoptions)
469
+
470
+ * **opaque** `unknown` (optional) - Default: `null` - Used for passing through context to `ResponseData`.
471
+ * **signal** `AbortSignal | events.EventEmitter | null` (optional) - Default: `null`.
472
+ * **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
473
+
474
+ The `RequestOptions.method` property should not be value `'CONNECT'`.
475
+
476
+ #### Parameter: `ResponseData`
477
+
478
+ * **statusCode** `number`
479
+ * **statusText** `string` - The status message from the response (e.g., "OK", "Not Found").
480
+ * **headers** `Record<string, string | string[]>` - Note that all header keys are lower-cased, e.g. `content-type`.
481
+ * **body** `stream.Readable` which also implements [the body mixin from the Fetch Standard](https://fetch.spec.whatwg.org/#body-mixin).
482
+ * **trailers** `Record<string, string>` - This object starts out
483
+ as empty and will be mutated to contain trailers after `body` has emitted `'end'`.
484
+ * **opaque** `unknown`
485
+ * **context** `object`
486
+
487
+ `body` contains the following additional [body mixin](https://fetch.spec.whatwg.org/#body-mixin) methods and properties:
488
+
489
+ * [`.arrayBuffer()`](https://fetch.spec.whatwg.org/#dom-body-arraybuffer)
490
+ * [`.blob()`](https://fetch.spec.whatwg.org/#dom-body-blob)
491
+ * [`.bytes()`](https://fetch.spec.whatwg.org/#dom-body-bytes)
492
+ * [`.json()`](https://fetch.spec.whatwg.org/#dom-body-json)
493
+ * [`.text()`](https://fetch.spec.whatwg.org/#dom-body-text)
494
+ * `body`
495
+ * `bodyUsed`
496
+
497
+ `body` can not be consumed twice. For example, calling `text()` after `json()` throws `TypeError`.
498
+
499
+ `body` contains the following additional extensions:
500
+
501
+ - `dump({ limit: Integer })`, dump the response by reading up to `limit` bytes without killing the socket (optional) - Default: 262144.
502
+
503
+ Note that body will still be a `Readable` even if it is empty, but attempting to deserialize it with `json()` will result in an exception. Recommended way to ensure there is a body to deserialize is to check if status code is not 204, and `content-type` header starts with `application/json`.
504
+
505
+ #### Example 1 - Basic GET Request
506
+
507
+ ```js
508
+ import { createServer } from 'http'
491
509
  import { Client } from 'undici'
492
- import { once } from 'node:events'
510
+ import { once } from 'events'
493
511
 
494
512
  const server = createServer((request, response) => {
495
513
  response.end('Hello, World!')
@@ -520,28 +538,107 @@ try {
520
538
  }
521
539
  ```
522
540
 
523
- A request can be aborted with an `AbortSignal`, with any `EventEmitter` that
524
- emits an `'abort'` event, or by destroying the response body:
541
+ #### Example 2 - Aborting a request
525
542
 
526
- ```mjs
543
+ > Node.js v15+ is required to run this example
544
+
545
+ ```js
546
+ import { createServer } from 'http'
527
547
  import { Client } from 'undici'
548
+ import { once } from 'events'
528
549
 
529
- const client = new Client('http://localhost:3000')
550
+ const server = createServer((request, response) => {
551
+ response.end('Hello, World!')
552
+ }).listen()
553
+
554
+ await once(server, 'listening')
555
+
556
+ const client = new Client(`http://localhost:${server.address().port}`)
530
557
  const abortController = new AbortController()
531
558
 
532
559
  try {
533
- client.request({ path: '/', method: 'GET', signal: abortController.signal })
560
+ client.request({
561
+ path: '/',
562
+ method: 'GET',
563
+ signal: abortController.signal
564
+ })
534
565
  } catch (error) {
535
- console.error(error) // RequestAbortedError
566
+ console.error(error) // should print an RequestAbortedError
567
+ client.close()
568
+ server.close()
536
569
  }
537
570
 
538
571
  abortController.abort()
539
572
  ```
540
573
 
541
- When the response body is conditionally read, always fully consume it otherwise:
574
+ Alternatively, any `EventEmitter` that emits an `'abort'` event may be used as an abort controller:
542
575
 
543
- ```mjs
544
- const { body, statusCode } = await client.request({ path: '/', method: 'GET' })
576
+ ```js
577
+ import { createServer } from 'http'
578
+ import { Client } from 'undici'
579
+ import EventEmitter, { once } from 'events'
580
+
581
+ const server = createServer((request, response) => {
582
+ response.end('Hello, World!')
583
+ }).listen()
584
+
585
+ await once(server, 'listening')
586
+
587
+ const client = new Client(`http://localhost:${server.address().port}`)
588
+ const ee = new EventEmitter()
589
+
590
+ try {
591
+ client.request({
592
+ path: '/',
593
+ method: 'GET',
594
+ signal: ee
595
+ })
596
+ } catch (error) {
597
+ console.error(error) // should print an RequestAbortedError
598
+ client.close()
599
+ server.close()
600
+ }
601
+
602
+ ee.emit('abort')
603
+ ```
604
+
605
+ Destroying the request or response body will have the same effect.
606
+
607
+ ```js
608
+ import { createServer } from 'http'
609
+ import { Client } from 'undici'
610
+ import { once } from 'events'
611
+
612
+ const server = createServer((request, response) => {
613
+ response.end('Hello, World!')
614
+ }).listen()
615
+
616
+ await once(server, 'listening')
617
+
618
+ const client = new Client(`http://localhost:${server.address().port}`)
619
+
620
+ try {
621
+ const { body } = await client.request({
622
+ path: '/',
623
+ method: 'GET'
624
+ })
625
+ body.destroy()
626
+ } catch (error) {
627
+ console.error(error) // should print an RequestAbortedError
628
+ client.close()
629
+ server.close()
630
+ }
631
+ ```
632
+
633
+ #### Example 3 - Conditionally reading the body
634
+
635
+ Remember to fully consume the body even in the case when it is not read.
636
+
637
+ ```js
638
+ const { body, statusCode } = await client.request({
639
+ path: '/',
640
+ method: 'GET'
641
+ })
545
642
 
546
643
  if (statusCode === 200) {
547
644
  return await body.arrayBuffer()
@@ -552,42 +649,40 @@ await body.dump()
552
649
  return null
553
650
  ```
554
651
 
555
- ### `dispatcher.stream(options, factory[, callback])`
556
-
557
- <!-- YAML
558
- added: v4.0.0
559
- -->
560
-
561
- * `options` {Object} Accepts the same fields as [`dispatcher.request()`][]'s
562
- `options`.
563
- * `factory` {Function} Returns the `Writable` to which the response is written.
564
- * `data` {Object}
565
- * `statusCode` {number}
566
- * `headers` {Object} The response headers.
567
- * `opaque` {any} The `opaque` value passed in `options`.
568
- * `context` {Object}
569
- * Returns: {Writable}
570
- * `callback` {Function} (optional) Invoked when the request has completed.
571
- * `error` {Error|null}
572
- * `data` {Object}
573
- * `opaque` {any} The `opaque` value passed in `options`.
574
- * `trailers` {Object}
575
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
576
- resolves with the `data` object described above.
577
-
578
- A faster version of [`dispatcher.request()`][]. The `factory` returns a
579
- [`Writable`][] to which the response is written, which avoids creating an
580
- intermediate [`Readable`][] when the caller intends to pipe the response body
581
- directly to a `Writable`.
582
-
583
- Use `options.opaque` to avoid creating a closure for the `factory` method. This
584
- pattern works well with Node.js web frameworks such as [Fastify][].
585
-
586
- ```mjs
587
- import { createServer } from 'node:http'
652
+ ### `Dispatcher.stream(options, factory[, callback])`
653
+
654
+ A faster version of `Dispatcher.request`. This method expects the second argument `factory` to return a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream which the response will be written to. This improves performance by avoiding creating an intermediate [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) stream when the user expects to directly pipe the response body to a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable) stream.
655
+
656
+ As demonstrated in [Example 1 - Basic GET stream request](/docs/docs/api/Dispatcher.md#example-1-basic-get-stream-request), it is recommended to use the `option.opaque` property to avoid creating a closure for the `factory` method. This pattern works well with Node.js Web Frameworks such as [Fastify](https://fastify.io). See [Example 2 - Stream to Fastify Response](/docs/docs/api/Dispatch.md#example-2-stream-to-fastify-response) for more details.
657
+
658
+ Arguments:
659
+
660
+ * **options** `RequestOptions`
661
+ * **factory** `(data: StreamFactoryData) => stream.Writable`
662
+ * **callback** `(error: Error | null, data: StreamData) => void` (optional)
663
+
664
+ Returns: `void | Promise<StreamData>` - Only returns a `Promise` if no `callback` argument was passed
665
+
666
+ #### Parameter: `StreamFactoryData`
667
+
668
+ * **statusCode** `number`
669
+ * **headers** `Record<string, string | string[] | undefined>`
670
+ * **opaque** `unknown`
671
+ * **onInfo** `({statusCode: number, headers: Record<string, string | string[]>}) => void | null` (optional) - Default: `null` - Callback collecting all the info headers (HTTP 100-199) received.
672
+
673
+ #### Parameter: `StreamData`
674
+
675
+ * **opaque** `unknown`
676
+ * **trailers** `Record<string, string>`
677
+ * **context** `object`
678
+
679
+ #### Example 1 - Basic GET stream request
680
+
681
+ ```js
682
+ import { createServer } from 'http'
588
683
  import { Client } from 'undici'
589
- import { once } from 'node:events'
590
- import { Writable } from 'node:stream'
684
+ import { once } from 'events'
685
+ import { Writable } from 'stream'
591
686
 
592
687
  const server = createServer((request, response) => {
593
688
  response.end('Hello, World!')
@@ -624,38 +719,95 @@ try {
624
719
  }
625
720
  ```
626
721
 
627
- ### `dispatcher.upgrade(options[, callback])`
628
-
629
- <!-- YAML
630
- added: v4.0.0
631
- -->
632
-
633
- * `options` {Object}
634
- * `path` {string} The request path.
635
- * `method` {string} The HTTP method. **Default:** `'GET'`.
636
- * `headers` {UndiciHeaders} Request headers. **Default:** `null`.
637
- * `protocol` {string} A comma-separated list of protocols, in descending
638
- preference order. **Default:** `'Websocket'`.
639
- * `signal` {AbortSignal|EventEmitter|null} A signal used to abort the request.
640
- **Default:** `null`.
641
- * `responseHeaders` {string|null} Set to `'raw'` to return the response headers
642
- as a raw array. **Default:** `null`.
643
- * `callback` {Function} (optional) Invoked when the upgrade completes.
644
- * `error` {Error|null}
645
- * `data` {Object}
646
- * `headers` {Object} The response headers.
647
- * `socket` {Duplex} The upgraded socket.
648
- * `opaque` {any}
649
- * Returns: {Promise} A `Promise` is returned only when `callback` is omitted. It
650
- resolves with the `data` object described above.
651
-
652
- Upgrades to a different protocol. See
653
- [MDN: Protocol upgrade mechanism][] for more details.
654
-
655
- ```mjs
656
- import { createServer } from 'node:http'
722
+ #### Example 2 - Stream to Fastify Response
723
+
724
+ In this example, a (fake) request is made to the fastify server using `fastify.inject()`. This request then executes the fastify route handler which makes a subsequent request to the raw Node.js http server using `undici.dispatcher.stream()`. The fastify response is passed to the `opaque` option so that undici can tap into the underlying writable stream using `response.raw`. This methodology demonstrates how one could use undici and fastify together to create fast-as-possible requests from one backend server to another.
725
+
726
+ ```js
727
+ import { createServer } from 'http'
728
+ import { Client } from 'undici'
729
+ import { once } from 'events'
730
+ import fastify from 'fastify'
731
+
732
+ const nodeServer = createServer((request, response) => {
733
+ response.end('Hello, World! From Node.js HTTP Server')
734
+ }).listen()
735
+
736
+ await once(nodeServer, 'listening')
737
+
738
+ console.log('Node Server listening')
739
+
740
+ const nodeServerUndiciClient = new Client(`http://localhost:${nodeServer.address().port}`)
741
+
742
+ const fastifyServer = fastify()
743
+
744
+ fastifyServer.route({
745
+ url: '/',
746
+ method: 'GET',
747
+ handler: (request, response) => {
748
+ nodeServerUndiciClient.stream({
749
+ path: '/',
750
+ method: 'GET',
751
+ opaque: response
752
+ }, ({ opaque }) => opaque.raw)
753
+ }
754
+ })
755
+
756
+ await fastifyServer.listen()
757
+
758
+ console.log('Fastify Server listening')
759
+
760
+ const fastifyServerUndiciClient = new Client(`http://localhost:${fastifyServer.server.address().port}`)
761
+
762
+ try {
763
+ const { statusCode, body } = await fastifyServerUndiciClient.request({
764
+ path: '/',
765
+ method: 'GET'
766
+ })
767
+
768
+ console.log(`response received ${statusCode}`)
769
+ body.setEncoding('utf8')
770
+ body.on('data', console.log)
771
+
772
+ nodeServerUndiciClient.close()
773
+ fastifyServerUndiciClient.close()
774
+ fastifyServer.close()
775
+ nodeServer.close()
776
+ } catch (error) { }
777
+ ```
778
+
779
+ ### `Dispatcher.upgrade(options[, callback])`
780
+
781
+ Upgrade to a different protocol. Visit [MDN - HTTP - Protocol upgrade mechanism](https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism) for more details.
782
+
783
+ Arguments:
784
+
785
+ * **options** `UpgradeOptions`
786
+
787
+ * **callback** `(error: Error | null, data: UpgradeData) => void` (optional)
788
+
789
+ Returns: `void | Promise<UpgradeData>` - Only returns a `Promise` if no `callback` argument was passed
790
+
791
+ #### Parameter: `UpgradeOptions`
792
+
793
+ * **path** `string`
794
+ * **method** `string` (optional) - Default: `'GET'`
795
+ * **headers** `UndiciHeaders` (optional) - Default: `null`
796
+ * **protocol** `string` (optional) - Default: `'Websocket'` - A string of comma separated protocols, in descending preference order.
797
+ * **signal** `AbortSignal | EventEmitter | null` (optional) - Default: `null`
798
+
799
+ #### Parameter: `UpgradeData`
800
+
801
+ * **headers** `http.IncomingHeaders`
802
+ * **socket** `stream.Duplex`
803
+ * **opaque** `unknown`
804
+
805
+ #### Example 1 - Basic Upgrade Request
806
+
807
+ ```js
808
+ import { createServer } from 'http'
657
809
  import { Client } from 'undici'
658
- import { once } from 'node:events'
810
+ import { once } from 'events'
659
811
 
660
812
  const server = createServer((request, response) => {
661
813
  response.statusCode = 101
@@ -669,7 +821,9 @@ await once(server, 'listening')
669
821
  const client = new Client(`http://localhost:${server.address().port}`)
670
822
 
671
823
  try {
672
- const { headers, socket } = await client.upgrade({ path: '/' })
824
+ const { headers, socket } = await client.upgrade({
825
+ path: '/',
826
+ })
673
827
  socket.on('end', () => {
674
828
  console.log(`upgrade: ${headers.upgrade}`) // upgrade: Websocket
675
829
  client.close()
@@ -683,62 +837,109 @@ try {
683
837
  }
684
838
  ```
685
839
 
686
- ### `dispatcher.compose(interceptors[, interceptor])`
840
+ ### `Dispatcher.compose(interceptors[, interceptor])`
687
841
 
688
- <!-- YAML
689
- added: v6.9.0
690
- -->
842
+ Compose a new dispatcher from the current dispatcher and the given interceptors.
691
843
 
692
- * `interceptors` {Array|Function} An array of interceptor functions, or the first
693
- of several interceptors passed as separate arguments.
694
- * `...interceptor` {Function} Additional interceptors when passed as separate
695
- arguments.
696
- * Returns: {Dispatcher} A new dispatcher that applies the interceptors over the
697
- current dispatcher's [`dispatch()`][] method.
844
+ > _Notes_:
845
+ > - The order of the interceptors matters. The last interceptor will be the first to be called.
846
+ > - It is important to note that the `interceptor` function should return a function that follows the `Dispatcher.dispatch` signature.
847
+ > - Any fork of the chain of `interceptors` can lead to unexpected results.
848
+ >
849
+ > **Interceptor Stack Visualization:**
850
+ > ```
851
+ > compose([interceptor1, interceptor2, interceptor3])
852
+ >
853
+ > Request Flow:
854
+ > ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
855
+ > │ Request │───▶│interceptor3 │───▶│interceptor2 │───▶│interceptor1 │───▶│ dispatcher │
856
+ > └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ .dispatch │
857
+ > ▲ ▲ ▲ └─────────────┘
858
+ > │ │ │ ▲
859
+ > (called first) (called second) (called last) │
860
+ > │
861
+ > ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
862
+ > │ Response │◀───│interceptor3 │◀───│interceptor2 │◀───│interceptor1 │◀─────────┘
863
+ > └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
864
+ >
865
+ > The interceptors are composed in reverse order due to function composition.
866
+ > ```
698
867
 
699
- Composes a new dispatcher from the current dispatcher and the given
700
- interceptors. Each interceptor is a function that takes a `dispatch` method and
701
- returns a `dispatch`-like function with the same signature
702
- (`(options, handler)`).
868
+ Arguments:
703
869
 
704
- The order of the interceptors matters: the last interceptor in the chain is the
705
- first to be called. Forking the chain of interceptors can lead to unexpected
706
- results.
870
+ * **interceptors** `Interceptor[interceptor[]]`: It is an array of `Interceptor` functions passed as only argument, or several interceptors passed as separate arguments.
707
871
 
708
- ```text
709
- compose([interceptor1, interceptor2, interceptor3])
872
+ Returns: `Dispatcher`.
710
873
 
711
- Request flow:
712
- Request -> interceptor3 -> interceptor2 -> interceptor1 -> dispatcher.dispatch
713
- (called first) (called second) (called last)
714
- ```
874
+ #### Parameter: `Interceptor`
875
+
876
+ A function that takes a `dispatch` method and returns a `dispatch`-like function.
715
877
 
716
- ```mjs
717
- import { Client, RedirectHandler } from 'undici'
878
+ #### Example 1 - Basic Compose
879
+
880
+ ```js
881
+ const { Client, RedirectHandler } = require('undici')
718
882
 
719
883
  const redirectInterceptor = dispatch => {
720
- return (opts, handler) => {
721
- const { maxRedirections } = opts
884
+ return (opts, handler) => {
885
+ const { maxRedirections } = opts
722
886
 
723
- if (!maxRedirections) {
724
- return dispatch(opts, handler)
725
- }
887
+ if (!maxRedirections) {
888
+ return dispatch(opts, handler)
889
+ }
726
890
 
727
- const redirectHandler = new RedirectHandler(dispatch, maxRedirections, opts, handler)
728
- opts = { ...opts, maxRedirections: 0 } // Stop the sub-dispatcher from also redirecting.
729
- return dispatch(opts, redirectHandler)
730
- }
891
+ const redirectHandler = new RedirectHandler(
892
+ dispatch,
893
+ maxRedirections,
894
+ opts,
895
+ handler
896
+ )
897
+ opts = { ...opts, maxRedirections: 0 } // Stop sub dispatcher from also redirecting.
898
+ return dispatch(opts, redirectHandler)
899
+ }
731
900
  }
732
901
 
733
- const client = new Client('http://localhost:3000').compose(redirectInterceptor)
902
+ const client = new Client('http://localhost:3000')
903
+ .compose(redirectInterceptor)
734
904
 
735
905
  await client.request({ path: '/', method: 'GET' })
736
906
  ```
737
907
 
738
- Interceptors can be chained by calling `compose()` repeatedly:
908
+ #### Example 2 - Chained Compose
739
909
 
740
- ```mjs
741
- import { Client } from 'undici'
910
+ ```js
911
+ const { Client, RedirectHandler, RetryHandler } = require('undici')
912
+
913
+ const redirectInterceptor = dispatch => {
914
+ return (opts, handler) => {
915
+ const { maxRedirections } = opts
916
+
917
+ if (!maxRedirections) {
918
+ return dispatch(opts, handler)
919
+ }
920
+
921
+ const redirectHandler = new RedirectHandler(
922
+ dispatch,
923
+ maxRedirections,
924
+ opts,
925
+ handler
926
+ )
927
+ opts = { ...opts, maxRedirections: 0 }
928
+ return dispatch(opts, redirectHandler)
929
+ }
930
+ }
931
+
932
+ const retryInterceptor = dispatch => {
933
+ return function retryInterceptor (opts, handler) {
934
+ return dispatch(
935
+ opts,
936
+ new RetryHandler(opts, {
937
+ handler,
938
+ dispatch
939
+ })
940
+ )
941
+ }
942
+ }
742
943
 
743
944
  const client = new Client('http://localhost:3000')
744
945
  .compose(redirectInterceptor)
@@ -747,96 +948,446 @@ const client = new Client('http://localhost:3000')
747
948
  await client.request({ path: '/', method: 'GET' })
748
949
  ```
749
950
 
750
- For the full list of built-in interceptors provided by undici, see [Interceptors](Interceptors.md).
751
- For an example of a custom interceptor that wraps handler callbacks, see
752
- [Custom interceptors](Interceptors.md#custom-interceptors).
951
+ #### Pre-built interceptors
753
952
 
754
- ### Event: `'connect'`
953
+ ##### `redirect`
954
+
955
+ The `redirect` interceptor allows you to customize the way your dispatcher handles redirects.
956
+
957
+ It accepts the same arguments as the [`RedirectHandler` constructor](/docs/docs/api/RedirectHandler.md).
958
+
959
+ **Example - Basic Redirect Interceptor**
960
+
961
+ ```js
962
+ const { Client, interceptors } = require("undici");
963
+ const { redirect } = interceptors;
964
+
965
+ const client = new Client("http://service.example").compose(
966
+ redirect({ maxRedirections: 3, throwOnMaxRedirect: true })
967
+ );
968
+ client.request({ path: "/" })
969
+ ```
970
+
971
+ ##### `retry`
972
+
973
+ The `retry` interceptor allows you to customize the way your dispatcher handles retries.
974
+
975
+ It accepts the same arguments as the [`RetryHandler` constructor](/docs/docs/api/RetryHandler.md).
976
+
977
+ **Example - Basic Redirect Interceptor**
978
+
979
+ ```js
980
+ const { Client, interceptors } = require("undici");
981
+ const { retry } = interceptors;
982
+
983
+ const client = new Client("http://service.example").compose(
984
+ retry({
985
+ maxRetries: 3,
986
+ minTimeout: 1000,
987
+ maxTimeout: 10000,
988
+ timeoutFactor: 2,
989
+ retryAfter: true,
990
+ })
991
+ );
992
+ ```
993
+
994
+ ##### `dump`
995
+
996
+ The `dump` interceptor enables you to dump the response body from a request upon a given limit.
997
+
998
+ **Options**
999
+ - `maxSize` - The maximum size (in bytes) of the response body to dump. If the size of the request's body exceeds this value then the connection will be closed. Default: `1048576`.
1000
+
1001
+ > The `Dispatcher#options` also gets extended with the options `dumpMaxSize`, `abortOnDumped`, and `waitForTrailers` which can be used to configure the interceptor at a request-per-request basis.
1002
+
1003
+ **Example - Basic Dump Interceptor**
1004
+
1005
+ ```js
1006
+ const { Client, interceptors } = require("undici");
1007
+ const { dump } = interceptors;
1008
+
1009
+ const client = new Client("http://service.example").compose(
1010
+ dump({
1011
+ maxSize: 1024,
1012
+ })
1013
+ );
1014
+
1015
+ // or
1016
+ client.dispatch(
1017
+ {
1018
+ path: "/",
1019
+ method: "GET",
1020
+ dumpMaxSize: 1024,
1021
+ },
1022
+ handler
1023
+ );
1024
+ ```
1025
+
1026
+ ##### `dns`
1027
+
1028
+ The `dns` interceptor enables you to cache DNS lookups for a given duration, per origin.
1029
+
1030
+ >It is well suited for scenarios where you want to cache DNS lookups to avoid the overhead of resolving the same domain multiple times
1031
+
1032
+ **Options**
1033
+ - `maxTTL` - The maximum time-to-live (in milliseconds) of the DNS cache. It should be a positive integer. Default: `10000`.
1034
+ - Set `0` to disable TTL.
1035
+ - `maxItems` - The maximum number of items to cache. It should be a positive integer. Default: `Infinity`.
1036
+ - `dualStack` - Whether to resolve both IPv4 and IPv6 addresses. Default: `true`.
1037
+ - It will also attempt a happy-eyeballs-like approach to connect to the available addresses in case of a connection failure.
1038
+ - `affinity` - Whether to use IPv4 or IPv6 addresses. Default: `4`.
1039
+ - It can be either `4` or `6`.
1040
+ - It will only take effect if `dualStack` is `false`.
1041
+ - `lookup: (hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, addresses: DNSInterceptorRecord[]) => void) => void` - Custom lookup function. Default: `dns.lookup`.
1042
+ - For more info see [dns.lookup](https://nodejs.org/api/dns.html#dnslookuphostname-options-callback).
1043
+ - `pick: (origin: URL, records: DNSInterceptorRecords, affinity: 4 | 6) => DNSInterceptorRecord` - Custom pick function. Default: `RoundRobin`.
1044
+ - The function should return a single record from the records array.
1045
+ - By default a simplified version of Round Robin is used.
1046
+ - The `records` property can be mutated to store the state of the balancing algorithm.
1047
+ - `storage: DNSStorage` - Custom storage for resolved DNS records
1048
+
1049
+ > The `Dispatcher#options` also gets extended with the options `dns.affinity`, `dns.dualStack`, `dns.lookup` and `dns.pick` which can be used to configure the interceptor at a request-per-request basis.
1050
+
1051
+
1052
+ **DNSInterceptorRecord**
1053
+ It represents a DNS record.
1054
+ - `family` - (`number`) The IP family of the address. It can be either `4` or `6`.
1055
+ - `address` - (`string`) The IP address.
1056
+
1057
+ **DNSInterceptorOriginRecords**
1058
+ It represents a map of DNS IP addresses records for a single origin.
1059
+ - `4.ips` - (`DNSInterceptorRecord[] | null`) The IPv4 addresses.
1060
+ - `6.ips` - (`DNSInterceptorRecord[] | null`) The IPv6 addresses.
1061
+
1062
+ **DNSStorage**
1063
+ It represents a storage object for resolved DNS records.
1064
+ - `size` - (`number`) current size of the storage.
1065
+ - `get` - (`(origin: string) => DNSInterceptorOriginRecords | null`) method to get the records for a given origin.
1066
+ - `set` - (`(origin: string, records: DNSInterceptorOriginRecords | null, options: { ttl: number }) => void`) method to set the records for a given origin.
1067
+ - `delete` - (`(origin: string) => void`) method to delete records for a given origin.
1068
+ - `full` - (`() => boolean`) method to check if the storage is full, if returns `true`, DNS lookup will be skipped in this interceptor and new records will not be stored.
1069
+
1070
+ **Example - Basic DNS Interceptor**
1071
+
1072
+ ```js
1073
+ const { Client, interceptors } = require("undici");
1074
+ const { dns } = interceptors;
1075
+
1076
+ const client = new Agent().compose([
1077
+ dns({ ...opts })
1078
+ ])
1079
+
1080
+ const response = await client.request({
1081
+ origin: `http://localhost:3030`,
1082
+ ...requestOpts
1083
+ })
1084
+ ```
1085
+
1086
+ **Example - DNS Interceptor and LRU cache as a storage**
1087
+
1088
+ ```js
1089
+ const { Client, interceptors } = require("undici");
1090
+ const QuickLRU = require("quick-lru");
1091
+ const { dns } = interceptors;
1092
+
1093
+ const lru = new QuickLRU({ maxSize: 100 });
1094
+
1095
+ const lruAdapter = {
1096
+ get size() {
1097
+ return lru.size;
1098
+ },
1099
+ get(origin) {
1100
+ return lru.get(origin);
1101
+ },
1102
+ set(origin, records, { ttl }) {
1103
+ lru.set(origin, records, { maxAge: ttl });
1104
+ },
1105
+ delete(origin) {
1106
+ lru.delete(origin);
1107
+ },
1108
+ full() {
1109
+ // For LRU cache, we can always store new records,
1110
+ // old records will be evicted automatically
1111
+ return false;
1112
+ }
1113
+ }
1114
+
1115
+ const client = new Agent().compose([
1116
+ dns({ storage: lruAdapter })
1117
+ ])
1118
+
1119
+ const response = await client.request({
1120
+ origin: `http://localhost:3030`,
1121
+ ...requestOpts
1122
+ })
1123
+ ```
1124
+
1125
+ ##### `responseError`
1126
+
1127
+ The `responseError` interceptor throws an error for responses with status code errors (>= 400).
1128
+
1129
+ **Example**
1130
+
1131
+ ```js
1132
+ const { Client, interceptors } = require("undici");
1133
+ const { responseError } = interceptors;
1134
+
1135
+ const client = new Client("http://service.example").compose(
1136
+ responseError()
1137
+ );
1138
+
1139
+ // Will throw a ResponseError for status codes >= 400
1140
+ await client.request({
1141
+ method: "GET",
1142
+ path: "/"
1143
+ });
1144
+ ```
1145
+
1146
+ ##### `decompress`
1147
+
1148
+ ⚠️ The decompress interceptor is experimental and subject to change.
1149
+
1150
+ The `decompress` interceptor automatically decompresses response bodies that are compressed with gzip, deflate, brotli, or zstd compression. It removes the `content-encoding` and `content-length` headers from decompressed responses and supports RFC-9110 compliant multiple encodings.
1151
+
1152
+ **Options**
1153
+
1154
+ - `skipErrorResponses` - Whether to skip decompression for error responses (status codes >= 400). Default: `true`.
1155
+ - `skipStatusCodes` - Array of status codes to skip decompression for. Default: `[204, 304]`.
1156
+ - `maxSize` - Maximum decompressed response size in bytes for each decompression stage. Set to `0` to disable the limit. Default: `0`.
1157
+
1158
+ **Example - Basic Decompress Interceptor**
1159
+
1160
+ ```js
1161
+ const { Client, interceptors } = require("undici");
1162
+ const { decompress } = interceptors;
1163
+
1164
+ const client = new Client("http://service.example").compose(
1165
+ decompress()
1166
+ );
1167
+
1168
+ // Automatically decompresses gzip/deflate/brotli/zstd responses
1169
+ const response = await client.request({
1170
+ method: "GET",
1171
+ path: "/"
1172
+ });
1173
+ ```
1174
+
1175
+ **Example - Custom Options**
1176
+
1177
+ ```js
1178
+ const { Client, interceptors } = require("undici");
1179
+ const { decompress } = interceptors;
1180
+
1181
+ const client = new Client("http://service.example").compose(
1182
+ decompress({
1183
+ skipErrorResponses: false, // Decompress 5xx responses
1184
+ skipStatusCodes: [204, 304, 201] // Skip these status codes
1185
+ })
1186
+ );
1187
+ ```
1188
+
1189
+ **Supported Encodings**
1190
+
1191
+ - `gzip` / `x-gzip` - GZIP compression
1192
+ - `deflate` / `x-compress` - DEFLATE compression
1193
+ - `br` - Brotli compression
1194
+ - `zstd` - Zstandard compression
1195
+ - Multiple encodings (e.g., `gzip, deflate`) are supported per RFC-9110
1196
+
1197
+ **Behavior**
1198
+
1199
+ - Skips decompression for status codes < 200 or >= 400 (configurable)
1200
+ - Skips decompression for 204 No Content and 304 Not Modified by default
1201
+ - Removes `content-encoding` and `content-length` headers when decompressing
1202
+ - Passes through unsupported encodings unchanged
1203
+ - Handles case-insensitive encoding names
1204
+ - Supports streaming decompression without buffering
1205
+
1206
+ ##### `Cache Interceptor`
1207
+
1208
+ The `cache` interceptor implements client-side response caching as described in
1209
+ [RFC9111](https://www.rfc-editor.org/rfc/rfc9111.html).
755
1210
 
756
- <!-- YAML
757
- added: v4.0.0
758
- -->
1211
+ **Options**
759
1212
 
760
- * `origin` {URL}
761
- * `targets` {Array<Dispatcher>}
1213
+ - `store` - The [`CacheStore`](/docs/docs/api/CacheStore.md) to store and retrieve responses from. Default is [`MemoryCacheStore`](/docs/docs/api/CacheStore.md#memorycachestore).
1214
+ - `methods` - The [**safe** HTTP methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1) to cache the response of.
1215
+ - `cacheByDefault` - The default expiration time to cache responses by if they don't have an explicit expiration and cannot have an heuristic expiry computed. If this isn't present, responses neither with an explicit expiration nor heuristically cacheable will not be cached. Default `undefined`.
1216
+ - `type` - The [type of cache](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching#types_of_caches) for Undici to act as. Can be `shared` or `private`. Default `shared`. `private` implies privately cacheable responses will be cached and potentially shared with other users of your application.
762
1217
 
763
- Emitted when the dispatcher has connected to the origin.
1218
+ **Usage with `fetch`**
1219
+
1220
+ ```js
1221
+ const { Agent, cacheStores, interceptors, setGlobalDispatcher } = require('undici')
1222
+
1223
+ const client = new Agent().compose(interceptors.cache({
1224
+ store: new cacheStores.MemoryCacheStore({
1225
+ maxSize: 100 * 1024 * 1024, // 100MB
1226
+ maxCount: 1000,
1227
+ maxEntrySize: 5 * 1024 * 1024 // 5MB
1228
+ })
1229
+ }))
1230
+
1231
+ setGlobalDispatcher(client)
1232
+
1233
+ // First request goes to the network and is cached when cache headers allow it.
1234
+ const first = await fetch('https://example.com/data')
1235
+
1236
+ // Second request can be served from cache according to RFC9111 rules.
1237
+ const second = await fetch('https://example.com/data')
1238
+ ```
1239
+
1240
+ ##### `Deduplicate Interceptor`
1241
+
1242
+ The `deduplicate` interceptor deduplicates concurrent identical requests. When multiple identical requests are made while one is already in-flight, only one request is sent to the origin server, and all waiting handlers receive the same response. This reduces server load and improves performance.
1243
+
1244
+ **Options**
1245
+
1246
+ - `methods` - The [**safe** HTTP methods](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.1) to deduplicate. Default `['GET']`.
1247
+ - `skipHeaderNames` - Header names that, if present in a request, will cause the request to skip deduplication entirely. Useful for headers like `idempotency-key` where presence indicates unique processing. Header name matching is case-insensitive. Default `[]`.
1248
+ - `excludeHeaderNames` - Header names to exclude from the deduplication key. Requests with different values for these headers will still be deduplicated together. Useful for headers like `x-request-id` that vary per request but shouldn't affect deduplication. Header name matching is case-insensitive. Default `[]`.
1249
+ - `maxBufferSize` - Maximum bytes buffered per paused waiting deduplicated handler. If a waiting handler remains paused and exceeds this threshold, it is failed with an abort error to prevent unbounded memory growth. Default `5 * 1024 * 1024`.
1250
+
1251
+ **Usage**
1252
+
1253
+ ```js
1254
+ const { Client, interceptors } = require("undici");
1255
+ const { deduplicate, cache } = interceptors;
1256
+
1257
+ // Deduplicate only
1258
+ const client = new Client("http://service.example").compose(
1259
+ deduplicate()
1260
+ );
1261
+
1262
+ // Deduplicate with caching
1263
+ const clientWithCache = new Client("http://service.example").compose(
1264
+ deduplicate(),
1265
+ cache()
1266
+ );
1267
+ ```
1268
+
1269
+ Requests are considered identical if they have the same:
1270
+ - Origin
1271
+ - HTTP method
1272
+ - Path
1273
+ - Request headers (excluding any headers specified in `excludeHeaderNames`)
1274
+
1275
+ All deduplicated requests receive the complete response including status code, headers, and body.
1276
+
1277
+ For observability, request deduplication events are published to the `undici:request:pending-requests` [diagnostic channel](/docs/docs/api/DiagnosticsChannel.md#undicirequestpending-requests).
1278
+
1279
+ ## Instance Events
1280
+
1281
+ ### Event: `'connect'`
1282
+
1283
+ Parameters:
1284
+
1285
+ * **origin** `URL`
1286
+ * **targets** `Array<Dispatcher>`
764
1287
 
765
1288
  ### Event: `'disconnect'`
766
1289
 
767
- <!-- YAML
768
- added: v4.0.0
769
- -->
1290
+ Parameters:
770
1291
 
771
- * `origin` {URL}
772
- * `targets` {Array<Dispatcher>}
773
- * `error` {Error}
1292
+ * **origin** `URL`
1293
+ * **targets** `Array<Dispatcher>`
1294
+ * **error** `Error`
774
1295
 
775
1296
  Emitted when the dispatcher has been disconnected from the origin.
776
1297
 
777
- For HTTP/2, this event is also emitted when the dispatcher receives a
778
- [GOAWAY frame][], with an error whose message is `HTTP/2: "GOAWAY" frame received`
779
- and whose code is `UND_ERR_INFO`. Because of the binary-framing nature of the
780
- protocol, a request may hang if a frame is received between the `HEADER` and
781
- `DATA` frames. It is recommended to handle this event and close the dispatcher to
782
- create a new HTTP/2 session.
1298
+ > **Note**: For HTTP/2, this event is also emitted when the dispatcher has received the [GOAWAY Frame](https://webconcepts.info/concepts/http2-frame-type/0x7) with an Error with the message `HTTP/2: "GOAWAY" frame received` and the code `UND_ERR_INFO`.
1299
+ > Due to nature of the protocol of using binary frames, it is possible that requests gets hanging as a frame can be received between the `HEADER` and `DATA` frames.
1300
+ > It is recommended to handle this event and close the dispatcher to create a new HTTP/2 session.
783
1301
 
784
1302
  ### Event: `'connectionError'`
785
1303
 
786
- <!-- YAML
787
- added: v4.0.0
788
- -->
1304
+ Parameters:
789
1305
 
790
- * `origin` {URL}
791
- * `targets` {Array<Dispatcher>}
792
- * `error` {Error}
1306
+ * **origin** `URL`
1307
+ * **targets** `Array<Dispatcher>`
1308
+ * **error** `Error`
793
1309
 
794
- Emitted when the dispatcher fails to connect to the origin.
1310
+ Emitted when dispatcher fails to connect to
1311
+ origin.
795
1312
 
796
1313
  ### Event: `'drain'`
797
1314
 
798
- <!-- YAML
799
- added: v4.0.0
800
- -->
801
-
802
- * `origin` {URL}
803
-
804
- Emitted when the dispatcher is no longer busy and further [`dispatch()`][] calls
805
- can make progress.
806
-
807
- ## Pre-built interceptors
808
-
809
- For the full reference of built-in interceptors (`dump`, `retry`, `redirect`,
810
- `decompress`, `responseError`, `dns`, `cache`, `deduplicate`) and their options,
811
- see [Interceptors](Interceptors.md).
812
-
813
- [Fastify]: https://fastify.dev
814
- [GOAWAY frame]: https://webconcepts.info/concepts/http2-frame-type/0x7
815
- [HTTP `CONNECT`]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT
816
- [MDN: Protocol upgrade mechanism]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
817
- [`.arrayBuffer()`]: https://fetch.spec.whatwg.org/#dom-body-arraybuffer
818
- [`.blob()`]: https://fetch.spec.whatwg.org/#dom-body-blob
819
- [`.bytes()`]: https://fetch.spec.whatwg.org/#dom-body-bytes
820
- [`.json()`]: https://fetch.spec.whatwg.org/#dom-body-json
821
- [`.text()`]: https://fetch.spec.whatwg.org/#dom-body-text
822
- [`'drain'`]: #event-drain
823
- [`Agent`]: Agent.md#class-agent
824
- [`BalancedPool`]: BalancedPool.md#class-balancedpool
825
- [`Client`]: Client.md#class-client
826
- [`EventEmitter`]: https://nodejs.org/api/events.html#class-eventemitter
827
- [`Pool`]: Pool.md#class-pool
828
- [`Readable`]: https://nodejs.org/api/stream.html#class-streamreadable
829
- [`Writable`]: https://nodejs.org/api/stream.html#class-streamwritable
830
- [`close()`]: #dispatcherclosecallback
831
- [`connect()`]: #dispatcherconnectoptions-callback
832
- [`destroy()`]: #dispatcherdestroyerror-callback
833
- [`dispatch()`]: #dispatcherdispatchoptions-handler
834
- [`dispatcher.compose()`]: #dispatchercomposeinterceptors-interceptor
835
- [`dispatcher.dispatch()`]: #dispatcherdispatchoptions-handler
836
- [`dispatcher.request()`]: #dispatcherrequestoptions-callback
837
- [`pipeline()`]: #dispatcherpipelineoptions-handler
838
- [`request()`]: #dispatcherrequestoptions-callback
839
- [`stream()`]: #dispatcherstreamoptions-factory-callback
840
- [`stream.pipeline()`]: https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options
841
- [`upgrade()`]: #dispatcherupgradeoptions-callback
842
- [body mixin]: https://fetch.spec.whatwg.org/#body-mixin
1315
+ Parameters:
1316
+
1317
+ * **origin** `URL`
1318
+
1319
+ Emitted when dispatcher is no longer busy.
1320
+
1321
+ ## Parameter: `UndiciHeaders`
1322
+
1323
+ * `Record<string, string | string[] | undefined> | string[] | Iterable<[string, string | string[] | undefined]> | null`
1324
+
1325
+ Header arguments such as `options.headers` in [`Client.dispatch`](/docs/docs/api/Client.md#clientdispatchoptions-handlers) can be specified in three forms:
1326
+ * As an object specified by the `Record<string, string | string[] | undefined>` (`IncomingHttpHeaders`) type.
1327
+ * As an array of strings. An array representation of a header list must have an even length, or an `InvalidArgumentError` will be thrown.
1328
+ * As an iterable that can encompass `Headers`, `Map`, or a custom iterator returning key-value pairs.
1329
+ Keys are lowercase and values are not modified.
1330
+
1331
+ Undici validates header syntax at the protocol level (for example, invalid header names and invalid control characters in string values), but it does not sanitize untrusted application input. Validate and sanitize any user-provided header names and values before passing them to Undici to prevent header/body injection vulnerabilities.
1332
+
1333
+ When using the array header format (`string[]`), Undici processes only indexed elements. Additional properties assigned to the array object are ignored.
1334
+
1335
+ Response headers will derive a `host` from the `url` of the [Client](/docs/docs/api/Client.md#class-client) instance if no `host` header was previously specified.
1336
+
1337
+ ### Example 1 - Object
1338
+
1339
+ ```js
1340
+ {
1341
+ 'content-length': '123',
1342
+ 'content-type': 'text/plain',
1343
+ connection: 'keep-alive',
1344
+ host: 'mysite.com',
1345
+ accept: '*/*'
1346
+ }
1347
+ ```
1348
+
1349
+ ### Example 2 - Array
1350
+
1351
+ ```js
1352
+ [
1353
+ 'content-length', '123',
1354
+ 'content-type', 'text/plain',
1355
+ 'connection', 'keep-alive',
1356
+ 'host', 'mysite.com',
1357
+ 'accept', '*/*'
1358
+ ]
1359
+ ```
1360
+
1361
+ ### Example 3 - Iterable
1362
+
1363
+ ```js
1364
+ new Headers({
1365
+ 'content-length': '123',
1366
+ 'content-type': 'text/plain',
1367
+ connection: 'keep-alive',
1368
+ host: 'mysite.com',
1369
+ accept: '*/*'
1370
+ })
1371
+ ```
1372
+ or
1373
+ ```js
1374
+ new Map([
1375
+ ['content-length', '123'],
1376
+ ['content-type', 'text/plain'],
1377
+ ['connection', 'keep-alive'],
1378
+ ['host', 'mysite.com'],
1379
+ ['accept', '*/*']
1380
+ ])
1381
+ ```
1382
+ or
1383
+ ```js
1384
+ {
1385
+ *[Symbol.iterator] () {
1386
+ yield ['content-length', '123']
1387
+ yield ['content-type', 'text/plain']
1388
+ yield ['connection', 'keep-alive']
1389
+ yield ['host', 'mysite.com']
1390
+ yield ['accept', '*/*']
1391
+ }
1392
+ }
1393
+ ```