@semiont/frontend 0.4.4 → 0.4.5
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.
- package/package.json +1 -1
- package/standalone/apps/frontend/.next/BUILD_ID +1 -1
- package/standalone/apps/frontend/.next/app-path-routes-manifest.json +3 -4
- package/standalone/apps/frontend/.next/build-manifest.json +7 -7
- package/standalone/apps/frontend/.next/prerender-manifest.json +3 -3
- package/standalone/apps/frontend/.next/react-loadable-manifest.json +58 -62
- package/standalone/apps/frontend/.next/routes-manifest.json +0 -8
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js +12 -18
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/about/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js +1911 -2010
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/devops/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js +543 -543
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/exchange/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js +8 -115
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js +257 -257
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/security/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js +121 -220
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/admin/users/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js +190 -190
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js +14 -122
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/mcp-setup/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js +58 -69
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signin/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js +247 -251
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/signup/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js +108 -105
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/auth/welcome/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js +751 -254
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/compose/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js +897 -400
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/discover/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js +1147 -658
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js +535 -38
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/know/resource/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js +1860 -1959
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/entity-tags/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js +1173 -1272
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/linked-data/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js +359 -466
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js +940 -1039
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/recent/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js +327 -426
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/moderate/tag-schemas/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js +17 -20
- package/standalone/apps/frontend/.next/server/app/[locale]/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js +793 -793
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/privacy/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js +354 -354
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/[locale]/terms/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error/page.js +169 -169
- package/standalone/apps/frontend/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.html +1 -1
- package/standalone/apps/frontend/.next/server/app/_global-error.rsc +7 -7
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +2 -2
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_global-error.segment.rsc +2 -2
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/standalone/apps/frontend/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found/page.js +98 -98
- package/standalone/apps/frontend/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.html +1 -1
- package/standalone/apps/frontend/.next/server/app/_not-found.rsc +7 -7
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_head.segment.rsc +3 -3
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_not-found.segment.rsc +2 -2
- package/standalone/apps/frontend/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js +24 -180
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/consent/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js +39 -177
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/cookies/export/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js +31 -214
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route.js.nft.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/resources/[id]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/app-paths-manifest.json +3 -4
- package/standalone/apps/frontend/.next/server/chunks/{5866.js → 1515.js} +9015 -219
- package/standalone/apps/frontend/.next/server/chunks/1974.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/2245.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/2686.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/2978.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/3266.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/3451.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/3533.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/355.js +2 -2
- package/standalone/apps/frontend/.next/server/chunks/4378.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4546.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4622.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4654.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4750.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4771.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4962.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4968.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/4997.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/501.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5245.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5248.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5343.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5493.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5660.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/5956.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6135.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6315.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6324.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/{7873.js → 6380.js} +99 -2
- package/standalone/apps/frontend/.next/server/chunks/6791.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6806.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6832.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6937.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/695.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/6961.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7012.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7020.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7041.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7100.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7143.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7318.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/736.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7368.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7374.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7465.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7466.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/7571.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/766.js +1196 -0
- package/standalone/apps/frontend/.next/server/chunks/7839.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/8012.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/{8569.js → 8103.js} +2 -395
- package/standalone/apps/frontend/.next/server/chunks/8255.js +70988 -1585
- package/standalone/apps/frontend/.next/server/chunks/857.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/8599.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/{8394.js → 8712.js} +43 -142
- package/standalone/apps/frontend/.next/server/chunks/8829.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/{730.js → 8835.js} +53 -264
- package/standalone/apps/frontend/.next/server/chunks/8930.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/9059.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/9080.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/9378.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/9552.js +1 -1
- package/standalone/apps/frontend/.next/server/chunks/9927.js +393 -0
- package/standalone/apps/frontend/.next/server/middleware-build-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/standalone/apps/frontend/.next/server/middleware.js +791 -7146
- package/standalone/apps/frontend/.next/server/pages/404.html +1 -1
- package/standalone/apps/frontend/.next/server/pages/500.html +1 -1
- package/standalone/apps/frontend/.next/server/server-reference-manifest.json +1 -1
- package/standalone/apps/frontend/.next/server/webpack-runtime.js +1 -1
- package/standalone/apps/frontend/.next/static/{xsHlHXJGPdnc3A27riOy4 → 5dXfbPlvt4Js0PhZwYimS}/_buildManifest.js +1 -1
- package/standalone/apps/frontend/.next/static/chunks/1581.d346066f42ea32d9.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/21.80f630720ce5d399.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/2313.5a58bc49f794dfde.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/2770.a1153fa286f807ca.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/285.4bd38bfe3c47a475.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/317.7f0ece1099484cf9.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/3885.d9113939596bf3b8.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/389.7b458ffc7d516ddd.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/3990.c48a657c9ea9a44b.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4051.c3994d6f4abcd0e0.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4068.78ea607d67bd65a0.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4081.46ad40b822c6916b.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4543.9278b6d01ee036e1.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4601.d0fc1677704c70b4.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4697.bc616cfc8e811e73.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4775.71ae21f85cb5e145.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/4803.45597c5e81cd3c13.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/5334.1744c780cc556f06.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/5477.2d0f1564203fb566.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/5910.100100966869410e.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/6760.026c5949f3586091.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/6833.dca4879e8a220b69.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/6871.ac58d649278c1506.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/694.43f1b5ec2406a34d.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/6955.f7c9ff28ee7a7499.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/7249.2e31fa450a01a1df.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/7869.675d538426cfcbe9.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/8109.a87a8b9713f2b52e.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/8627.7bb9aaab1ac2f553.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/8637.8d938ed221c34fef.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/87c73c54-6dc57a387011e0eb.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/891cff7f-b4b276af3a3ec6c2.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/about/page-8c95ed651c95e81d.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/devops/page-07c243823806d9cd.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/exchange/page-c4ae2acead0589a5.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/layout-321849d614eeeb37.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/page-d354c931ccf79f83.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/security/page-fc375342b3cfc441.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/users/page-e7b49e8716c71d4c.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/error/page-84bb543b60f14a75.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/mcp-setup/route-a94925dc93ffbc79.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/signin/page-7f3c48236f101729.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/signup/page-c9f2dcf33b613491.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/welcome/page-829aa2aa53d10c09.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/compose/page-de72d045de6a35c6.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/discover/page-c3a797806c29fb1d.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/layout-d6130394cfcdf0b3.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/page-1c71e6c5852e4fd1.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/resource/[id]/page-28cd0a52dc5eb7f7.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/layout-892c0aed3b6305e6.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/entity-tags/page-2570acd78d5ba365.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/layout-ed8fba196193bb78.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/linked-data/page-121dae57df4247e6.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/page-4977a31fd59bad74.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/recent/page-f8157849c4259b2d.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/tag-schemas/{page-1921481bb19f07dd.js → page-8d93cbbc2103ce33.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/not-found-4a7239a613e6318d.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/page-5401abd4b8b5a660.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/privacy/page-c8debdc896fbfb18.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/terms/page-5352a1dd1485f780.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/_global-error/page-654d20a65a117618.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/_not-found/page-4b6ea20c964f88d7.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/api/cookies/consent/route-c9e8d6dd4d9f06a4.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/api/cookies/export/route-a4ab2ad0938d4aa9.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/api/resources/[id]/route-197cf90408a76c83.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/error-9aba7afd30c62d53.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/global-error-eda57df3f34f3fea.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/layout-0449f9303123dcff.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/app/not-found-c9bc183da50381ee.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/common-39e39b31d7e98d78.js +63 -0
- package/standalone/apps/frontend/.next/static/chunks/framework-7bb6ccfe56e756bc.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/main-app-c035ceb9711489b6.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/{main-7bae9c8a170f1f27.js → main-d9a52d294ecf5b0a.js} +1 -1
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/app-error-c9c4d6e710ccaf49.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/forbidden-e477fd7b191df4de.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/unauthorized-9f5fef6300d812a3.js +1 -0
- package/standalone/apps/frontend/.next/static/chunks/vendors-f8fa4fd7e9983288.js +40 -0
- package/standalone/apps/frontend/.next/static/chunks/webpack-89d7a897970cded3.js +1 -0
- package/standalone/apps/frontend/.next/static/css/4d11af642686d027.css +1 -0
- package/standalone/apps/frontend/package.json +6 -8
- package/standalone/package.json +1 -1
- package/standalone/packages/core/package.json +1 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js +0 -659
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +0 -1
- package/standalone/apps/frontend/.next/server/app/api/auth/[...nextauth]/route_client-reference-manifest.js +0 -1
- package/standalone/apps/frontend/.next/server/chunks/5015.js +0 -641
- package/standalone/apps/frontend/.next/server/chunks/5056.js +0 -23345
- package/standalone/apps/frontend/.next/server/chunks/6227.js +0 -69225
- package/standalone/apps/frontend/.next/server/chunks/7420.js +0 -10476
- package/standalone/apps/frontend/.next/static/chunks/1581.9c00fa05ef016079.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/21.cadfe7d447baaf8f.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/2313.5ece3917b2d82c52.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/2770.d88fb94851c31577.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/285.f124efe319b2316d.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/317.c282894feb2bb948.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/3885.71662e3b4eb6ce12.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/389.4c5cd30ad01cf37e.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/3990.fa7477a5ba03d0bc.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4051.0e87f9127cd2c31f.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4068.41484640675f93f0.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4081.878b3b67a478c4fa.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4543.96102c11176b19c1.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4601.9274c16dad33bfe6.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4697.5d8ccc03d695da34.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4775.010868a8c1a2943b.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/4803.40a11fd76326593b.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/5334.ad420886c635c3ee.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/5477.0b798404054d501e.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/5910.e212d563d3b878a9.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/6760.d141be0482153efb.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/6833.73a30c5f0157f2a2.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/6871.e056383efa45339a.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/694.ded5b1c66d7670a1.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/6955.3b53377abee2a6b0.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/7249.90de9d0b8e58d1fd.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/7869.d9d191bce75f1b2a.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/8109.b13d865731309b04.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/8627.fef6a5f250f150d5.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/8637.57f3546fc0eb2079.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/87c73c54-e11922cda838f8cc.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/891cff7f-d7677a8f46c597cc.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/about/page-e03664a12ee61f80.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/devops/page-1c2f5b07b0402f9c.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/exchange/page-0dfa3d7647b7ef09.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/layout-956ba0ffa1199bff.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/page-08a07c949ef237ab.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/security/page-4e5d04a8e68e59c6.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/admin/users/page-25060ea686677626.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/error/page-537537dd20744388.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/mcp-setup/route-3d9d880043f60fda.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/signin/page-929ede03975c315e.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/signup/page-269b67edfc6dc580.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/auth/welcome/page-9b80378faffbf190.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/compose/page-3bd439895ad850bd.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/discover/page-ed10f464c8f5f275.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/layout-e1b5e37e34724485.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/page-2b5d147fc5b43912.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/know/resource/[id]/page-0b864afd9a2b8987.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/layout-78d0c39216964130.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/entity-tags/page-5e7a5b5e3b109aa4.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/layout-b60605082e447f42.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/linked-data/page-4ce90d9f262c3f58.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/page-4204b564011168b0.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/moderate/recent/page-7899f7ec4cacd6f1.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/not-found-543e4c2e7b362566.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/page-0e3199581027f547.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/privacy/page-61b871e076d3b1e1.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/[locale]/terms/page-95ce3054883c38ba.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/_global-error/page-79e9db846cb5b1b0.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/_not-found/page-919e7c64c5003035.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/api/auth/[...nextauth]/route-a0e1a9709b37316f.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/api/cookies/consent/route-7fe48e1a8a111543.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/api/cookies/export/route-32b06db0feb2e923.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/api/resources/[id]/route-d30a52945e1daab7.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/error-b7b996fcd4c281e1.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/global-error-9a4752b9d60178d7.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/layout-9c385c22b6e7c3bc.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/app/not-found-6c69bcb3b64a5d23.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/common-415057465e35ca56.js +0 -63
- package/standalone/apps/frontend/.next/static/chunks/framework-b879567b90d34fb5.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/main-app-094b6e4e5016338b.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/app-error-bc9b50e65cc512f7.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/forbidden-02b63044bb72788d.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8922e7db57470d2a.js +0 -1
- package/standalone/apps/frontend/.next/static/chunks/vendors-63213253c18580f4.js +0 -40
- package/standalone/apps/frontend/.next/static/chunks/webpack-acca3b9109e0d48f.js +0 -1
- package/standalone/apps/frontend/.next/static/css/21dd77b6b1f7d2f3.css +0 -1
- /package/standalone/apps/frontend/.next/static/{xsHlHXJGPdnc3A27riOy4 → 5dXfbPlvt4Js0PhZwYimS}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,1196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 766;
|
|
3
|
+
exports.ids = [766];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 30766:
|
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// EXPORTS
|
|
11
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
Ay: () => (/* binding */ distribution)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// UNUSED EXPORTS: ForceRetryError, HTTPError, TimeoutError, isForceRetryError, isHTTPError, isKyError, isTimeoutError
|
|
16
|
+
|
|
17
|
+
;// ../../node_modules/ky/distribution/errors/HTTPError.js
|
|
18
|
+
class HTTPError extends Error {
|
|
19
|
+
response;
|
|
20
|
+
request;
|
|
21
|
+
options;
|
|
22
|
+
constructor(response, request, options) {
|
|
23
|
+
const code = (response.status || response.status === 0) ? response.status : '';
|
|
24
|
+
const title = response.statusText ?? '';
|
|
25
|
+
const status = `${code} ${title}`.trim();
|
|
26
|
+
const reason = status ? `status code ${status}` : 'an unknown error';
|
|
27
|
+
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
28
|
+
this.name = 'HTTPError';
|
|
29
|
+
this.response = response;
|
|
30
|
+
this.request = request;
|
|
31
|
+
this.options = options;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=HTTPError.js.map
|
|
35
|
+
;// ../../node_modules/ky/distribution/errors/NonError.js
|
|
36
|
+
/**
|
|
37
|
+
Wrapper for non-Error values that were thrown.
|
|
38
|
+
|
|
39
|
+
In JavaScript, any value can be thrown (not just Error instances). This class wraps such values to ensure consistent error handling.
|
|
40
|
+
*/
|
|
41
|
+
class NonError extends Error {
|
|
42
|
+
name = 'NonError';
|
|
43
|
+
value;
|
|
44
|
+
constructor(value) {
|
|
45
|
+
let message = 'Non-error value was thrown';
|
|
46
|
+
// Intentionally minimal as this error is just an edge-case.
|
|
47
|
+
try {
|
|
48
|
+
if (typeof value === 'string') {
|
|
49
|
+
message = value;
|
|
50
|
+
}
|
|
51
|
+
else if (value && typeof value === 'object' && 'message' in value && typeof value.message === 'string') {
|
|
52
|
+
message = value.message;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Use default message if accessing properties throws
|
|
57
|
+
}
|
|
58
|
+
super(message);
|
|
59
|
+
this.value = value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=NonError.js.map
|
|
63
|
+
;// ../../node_modules/ky/distribution/errors/ForceRetryError.js
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Internal error used to signal a forced retry from afterResponse hooks.
|
|
67
|
+
This is thrown when a user returns ky.retry() from an afterResponse hook.
|
|
68
|
+
*/
|
|
69
|
+
class ForceRetryError_ForceRetryError extends Error {
|
|
70
|
+
name = 'ForceRetryError';
|
|
71
|
+
customDelay;
|
|
72
|
+
code;
|
|
73
|
+
customRequest;
|
|
74
|
+
constructor(options) {
|
|
75
|
+
// Runtime protection: wrap non-Error causes in NonError
|
|
76
|
+
// TypeScript type is Error for guidance, but JS users can pass anything
|
|
77
|
+
const cause = options?.cause
|
|
78
|
+
? (options.cause instanceof Error ? options.cause : new NonError(options.cause))
|
|
79
|
+
: undefined;
|
|
80
|
+
super(options?.code ? `Forced retry: ${options.code}` : 'Forced retry', cause ? { cause } : undefined);
|
|
81
|
+
this.customDelay = options?.delay;
|
|
82
|
+
this.code = options?.code;
|
|
83
|
+
this.customRequest = options?.request;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=ForceRetryError.js.map
|
|
87
|
+
;// ../../node_modules/ky/distribution/core/constants.js
|
|
88
|
+
const supportsRequestStreams = (() => {
|
|
89
|
+
let duplexAccessed = false;
|
|
90
|
+
let hasContentType = false;
|
|
91
|
+
const supportsReadableStream = typeof globalThis.ReadableStream === 'function';
|
|
92
|
+
const supportsRequest = typeof globalThis.Request === 'function';
|
|
93
|
+
if (supportsReadableStream && supportsRequest) {
|
|
94
|
+
try {
|
|
95
|
+
hasContentType = new globalThis.Request('https://empty.invalid', {
|
|
96
|
+
body: new globalThis.ReadableStream(),
|
|
97
|
+
method: 'POST',
|
|
98
|
+
// @ts-expect-error - Types are outdated.
|
|
99
|
+
get duplex() {
|
|
100
|
+
duplexAccessed = true;
|
|
101
|
+
return 'half';
|
|
102
|
+
},
|
|
103
|
+
}).headers.has('Content-Type');
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
// QQBrowser on iOS throws "unsupported BodyInit type" error (see issue #581)
|
|
107
|
+
if (error instanceof Error && error.message === 'unsupported BodyInit type') {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return duplexAccessed && !hasContentType;
|
|
114
|
+
})();
|
|
115
|
+
const supportsAbortController = typeof globalThis.AbortController === 'function';
|
|
116
|
+
const supportsAbortSignal = typeof globalThis.AbortSignal === 'function' && typeof globalThis.AbortSignal.any === 'function';
|
|
117
|
+
const supportsResponseStreams = typeof globalThis.ReadableStream === 'function';
|
|
118
|
+
const supportsFormData = typeof globalThis.FormData === 'function';
|
|
119
|
+
const requestMethods = ['get', 'post', 'put', 'patch', 'head', 'delete'];
|
|
120
|
+
const validate = () => undefined;
|
|
121
|
+
validate();
|
|
122
|
+
const responseTypes = {
|
|
123
|
+
json: 'application/json',
|
|
124
|
+
text: 'text/*',
|
|
125
|
+
formData: 'multipart/form-data',
|
|
126
|
+
arrayBuffer: '*/*',
|
|
127
|
+
blob: '*/*',
|
|
128
|
+
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
129
|
+
// We still feature-check at runtime before exposing the shortcut.
|
|
130
|
+
bytes: '*/*',
|
|
131
|
+
};
|
|
132
|
+
// The maximum value of a 32bit int (see issue #117)
|
|
133
|
+
const maxSafeTimeout = 2_147_483_647;
|
|
134
|
+
// Size in bytes of a typical form boundary, used to help estimate upload size
|
|
135
|
+
const usualFormBoundarySize = new TextEncoder().encode('------WebKitFormBoundaryaxpyiPgbbPti10Rw').length;
|
|
136
|
+
const stop = Symbol('stop');
|
|
137
|
+
/**
|
|
138
|
+
Marker returned by ky.retry() to signal a forced retry from afterResponse hooks.
|
|
139
|
+
*/
|
|
140
|
+
class RetryMarker {
|
|
141
|
+
options;
|
|
142
|
+
constructor(options) {
|
|
143
|
+
this.options = options;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
Force a retry from an `afterResponse` hook.
|
|
148
|
+
|
|
149
|
+
This allows you to retry a request based on the response content, even if the response has a successful status code. The retry will respect the `retry.limit` option and skip the `shouldRetry` check. The forced retry is observable in `beforeRetry` hooks, where the error will be a `ForceRetryError`.
|
|
150
|
+
|
|
151
|
+
@param options - Optional configuration for the retry.
|
|
152
|
+
|
|
153
|
+
@example
|
|
154
|
+
```
|
|
155
|
+
import ky, {isForceRetryError} from 'ky';
|
|
156
|
+
|
|
157
|
+
const api = ky.extend({
|
|
158
|
+
hooks: {
|
|
159
|
+
afterResponse: [
|
|
160
|
+
async (request, options, response) => {
|
|
161
|
+
// Retry based on response body content
|
|
162
|
+
if (response.status === 200) {
|
|
163
|
+
const data = await response.clone().json();
|
|
164
|
+
|
|
165
|
+
// Simple retry with default delay
|
|
166
|
+
if (data.error?.code === 'TEMPORARY_ERROR') {
|
|
167
|
+
return ky.retry();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Retry with custom delay from API response
|
|
171
|
+
if (data.error?.code === 'RATE_LIMIT') {
|
|
172
|
+
return ky.retry({
|
|
173
|
+
delay: data.error.retryAfter * 1000,
|
|
174
|
+
code: 'RATE_LIMIT'
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Retry with a modified request (e.g., fallback endpoint)
|
|
179
|
+
if (data.error?.code === 'FALLBACK_TO_BACKUP') {
|
|
180
|
+
return ky.retry({
|
|
181
|
+
request: new Request('https://backup-api.com/endpoint', {
|
|
182
|
+
method: request.method,
|
|
183
|
+
headers: request.headers,
|
|
184
|
+
}),
|
|
185
|
+
code: 'BACKUP_ENDPOINT'
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Retry with refreshed authentication
|
|
190
|
+
if (data.error?.code === 'TOKEN_REFRESH' && data.newToken) {
|
|
191
|
+
return ky.retry({
|
|
192
|
+
request: new Request(request, {
|
|
193
|
+
headers: {
|
|
194
|
+
...Object.fromEntries(request.headers),
|
|
195
|
+
'Authorization': `Bearer ${data.newToken}`
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
code: 'TOKEN_REFRESHED'
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Retry with cause to preserve error chain
|
|
203
|
+
try {
|
|
204
|
+
validateResponse(data);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return ky.retry({
|
|
207
|
+
code: 'VALIDATION_FAILED',
|
|
208
|
+
cause: error
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
beforeRetry: [
|
|
215
|
+
({error, retryCount}) => {
|
|
216
|
+
// Observable in beforeRetry hooks
|
|
217
|
+
if (isForceRetryError(error)) {
|
|
218
|
+
console.log(`Forced retry #${retryCount}: ${error.message}`);
|
|
219
|
+
// Example output: "Forced retry #1: Forced retry: RATE_LIMIT"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
const response = await api.get('https://example.com/api');
|
|
227
|
+
```
|
|
228
|
+
*/
|
|
229
|
+
const retry = (options) => new RetryMarker(options);
|
|
230
|
+
const kyOptionKeys = {
|
|
231
|
+
json: true,
|
|
232
|
+
parseJson: true,
|
|
233
|
+
stringifyJson: true,
|
|
234
|
+
searchParams: true,
|
|
235
|
+
prefixUrl: true,
|
|
236
|
+
retry: true,
|
|
237
|
+
timeout: true,
|
|
238
|
+
hooks: true,
|
|
239
|
+
throwHttpErrors: true,
|
|
240
|
+
onDownloadProgress: true,
|
|
241
|
+
onUploadProgress: true,
|
|
242
|
+
fetch: true,
|
|
243
|
+
context: true,
|
|
244
|
+
};
|
|
245
|
+
// Vendor-specific fetch options that should always be passed to fetch()
|
|
246
|
+
// even if they appear on the Request object due to vendor patching.
|
|
247
|
+
// See: https://github.com/sindresorhus/ky/issues/541
|
|
248
|
+
const vendorSpecificOptions = {
|
|
249
|
+
next: true, // Next.js cache revalidation (revalidate, tags)
|
|
250
|
+
};
|
|
251
|
+
// Standard RequestInit options that should NOT be passed separately to fetch()
|
|
252
|
+
// because they're already applied to the Request object.
|
|
253
|
+
// Note: `dispatcher` and `priority` are NOT included here - they're fetch-only
|
|
254
|
+
// options that the Request constructor doesn't accept, so they need to be passed
|
|
255
|
+
// separately to fetch().
|
|
256
|
+
const requestOptionsRegistry = {
|
|
257
|
+
method: true,
|
|
258
|
+
headers: true,
|
|
259
|
+
body: true,
|
|
260
|
+
mode: true,
|
|
261
|
+
credentials: true,
|
|
262
|
+
cache: true,
|
|
263
|
+
redirect: true,
|
|
264
|
+
referrer: true,
|
|
265
|
+
referrerPolicy: true,
|
|
266
|
+
integrity: true,
|
|
267
|
+
keepalive: true,
|
|
268
|
+
signal: true,
|
|
269
|
+
window: true,
|
|
270
|
+
duplex: true,
|
|
271
|
+
};
|
|
272
|
+
//# sourceMappingURL=constants.js.map
|
|
273
|
+
;// ../../node_modules/ky/distribution/utils/body.js
|
|
274
|
+
|
|
275
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
276
|
+
const getBodySize = (body) => {
|
|
277
|
+
if (!body) {
|
|
278
|
+
return 0;
|
|
279
|
+
}
|
|
280
|
+
if (body instanceof FormData) {
|
|
281
|
+
// This is an approximation, as FormData size calculation is not straightforward
|
|
282
|
+
let size = 0;
|
|
283
|
+
for (const [key, value] of body) {
|
|
284
|
+
size += usualFormBoundarySize;
|
|
285
|
+
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
286
|
+
size += typeof value === 'string'
|
|
287
|
+
? new TextEncoder().encode(value).length
|
|
288
|
+
: value.size;
|
|
289
|
+
}
|
|
290
|
+
return size;
|
|
291
|
+
}
|
|
292
|
+
if (body instanceof Blob) {
|
|
293
|
+
return body.size;
|
|
294
|
+
}
|
|
295
|
+
if (body instanceof ArrayBuffer) {
|
|
296
|
+
return body.byteLength;
|
|
297
|
+
}
|
|
298
|
+
if (typeof body === 'string') {
|
|
299
|
+
return new TextEncoder().encode(body).length;
|
|
300
|
+
}
|
|
301
|
+
if (body instanceof URLSearchParams) {
|
|
302
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
303
|
+
}
|
|
304
|
+
if ('byteLength' in body) {
|
|
305
|
+
return (body).byteLength;
|
|
306
|
+
}
|
|
307
|
+
if (typeof body === 'object' && body !== null) {
|
|
308
|
+
try {
|
|
309
|
+
const jsonString = JSON.stringify(body);
|
|
310
|
+
return new TextEncoder().encode(jsonString).length;
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return 0;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return 0; // Default case, unable to determine size
|
|
317
|
+
};
|
|
318
|
+
const withProgress = (stream, totalBytes, onProgress) => {
|
|
319
|
+
let previousChunk;
|
|
320
|
+
let transferredBytes = 0;
|
|
321
|
+
return stream.pipeThrough(new TransformStream({
|
|
322
|
+
transform(currentChunk, controller) {
|
|
323
|
+
controller.enqueue(currentChunk);
|
|
324
|
+
if (previousChunk) {
|
|
325
|
+
transferredBytes += previousChunk.byteLength;
|
|
326
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
327
|
+
// Avoid reporting 100% progress before the stream is actually finished (in case totalBytes is inaccurate)
|
|
328
|
+
if (percent >= 1) {
|
|
329
|
+
// Epsilon is used here to get as close as possible to 100% without reaching it.
|
|
330
|
+
// If we were to use 0.99 here, percent could potentially go backwards.
|
|
331
|
+
percent = 1 - Number.EPSILON;
|
|
332
|
+
}
|
|
333
|
+
onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
334
|
+
}
|
|
335
|
+
previousChunk = currentChunk;
|
|
336
|
+
},
|
|
337
|
+
flush() {
|
|
338
|
+
if (previousChunk) {
|
|
339
|
+
transferredBytes += previousChunk.byteLength;
|
|
340
|
+
onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
}));
|
|
344
|
+
};
|
|
345
|
+
const streamResponse = (response, onDownloadProgress) => {
|
|
346
|
+
if (!response.body) {
|
|
347
|
+
return response;
|
|
348
|
+
}
|
|
349
|
+
if (response.status === 204) {
|
|
350
|
+
return new Response(null, {
|
|
351
|
+
status: response.status,
|
|
352
|
+
statusText: response.statusText,
|
|
353
|
+
headers: response.headers,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
const totalBytes = Math.max(0, Number(response.headers.get('content-length')) || 0);
|
|
357
|
+
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
358
|
+
status: response.status,
|
|
359
|
+
statusText: response.statusText,
|
|
360
|
+
headers: response.headers,
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
364
|
+
const streamRequest = (request, onUploadProgress, originalBody) => {
|
|
365
|
+
if (!request.body) {
|
|
366
|
+
return request;
|
|
367
|
+
}
|
|
368
|
+
// Use original body for size calculation since request.body is already a stream
|
|
369
|
+
const totalBytes = getBodySize(originalBody ?? request.body);
|
|
370
|
+
return new Request(request, {
|
|
371
|
+
// @ts-expect-error - Types are outdated.
|
|
372
|
+
duplex: 'half',
|
|
373
|
+
body: withProgress(request.body, totalBytes, onUploadProgress),
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
//# sourceMappingURL=body.js.map
|
|
377
|
+
;// ../../node_modules/ky/distribution/utils/is.js
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
379
|
+
const isObject = (value) => value !== null && typeof value === 'object';
|
|
380
|
+
//# sourceMappingURL=is.js.map
|
|
381
|
+
;// ../../node_modules/ky/distribution/utils/merge.js
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
const validateAndMerge = (...sources) => {
|
|
385
|
+
for (const source of sources) {
|
|
386
|
+
if ((!isObject(source) || Array.isArray(source)) && source !== undefined) {
|
|
387
|
+
throw new TypeError('The `options` argument must be an object');
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return deepMerge({}, ...sources);
|
|
391
|
+
};
|
|
392
|
+
const mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
393
|
+
const result = new globalThis.Headers(source1);
|
|
394
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
395
|
+
const source = new globalThis.Headers(source2);
|
|
396
|
+
for (const [key, value] of source.entries()) {
|
|
397
|
+
if ((isHeadersInstance && value === 'undefined') || value === undefined) {
|
|
398
|
+
result.delete(key);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
result.set(key, value);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return result;
|
|
405
|
+
};
|
|
406
|
+
function newHookValue(original, incoming, property) {
|
|
407
|
+
return (Object.hasOwn(incoming, property) && incoming[property] === undefined)
|
|
408
|
+
? []
|
|
409
|
+
: deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
410
|
+
}
|
|
411
|
+
const mergeHooks = (original = {}, incoming = {}) => ({
|
|
412
|
+
beforeRequest: newHookValue(original, incoming, 'beforeRequest'),
|
|
413
|
+
beforeRetry: newHookValue(original, incoming, 'beforeRetry'),
|
|
414
|
+
afterResponse: newHookValue(original, incoming, 'afterResponse'),
|
|
415
|
+
beforeError: newHookValue(original, incoming, 'beforeError'),
|
|
416
|
+
});
|
|
417
|
+
const appendSearchParameters = (target, source) => {
|
|
418
|
+
const result = new URLSearchParams();
|
|
419
|
+
for (const input of [target, source]) {
|
|
420
|
+
if (input === undefined) {
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (input instanceof URLSearchParams) {
|
|
424
|
+
for (const [key, value] of input.entries()) {
|
|
425
|
+
result.append(key, value);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
else if (Array.isArray(input)) {
|
|
429
|
+
for (const pair of input) {
|
|
430
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
431
|
+
throw new TypeError('Array search parameters must be provided in [[key, value], ...] format');
|
|
432
|
+
}
|
|
433
|
+
result.append(String(pair[0]), String(pair[1]));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
else if (isObject(input)) {
|
|
437
|
+
for (const [key, value] of Object.entries(input)) {
|
|
438
|
+
if (value !== undefined) {
|
|
439
|
+
result.append(key, String(value));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
// String
|
|
445
|
+
const parameters = new URLSearchParams(input);
|
|
446
|
+
for (const [key, value] of parameters.entries()) {
|
|
447
|
+
result.append(key, value);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return result;
|
|
452
|
+
};
|
|
453
|
+
// TODO: Make this strongly-typed (no `any`).
|
|
454
|
+
const deepMerge = (...sources) => {
|
|
455
|
+
let returnValue = {};
|
|
456
|
+
let headers = {};
|
|
457
|
+
let hooks = {};
|
|
458
|
+
let searchParameters;
|
|
459
|
+
const signals = [];
|
|
460
|
+
for (const source of sources) {
|
|
461
|
+
if (Array.isArray(source)) {
|
|
462
|
+
if (!Array.isArray(returnValue)) {
|
|
463
|
+
returnValue = [];
|
|
464
|
+
}
|
|
465
|
+
returnValue = [...returnValue, ...source];
|
|
466
|
+
}
|
|
467
|
+
else if (isObject(source)) {
|
|
468
|
+
for (let [key, value] of Object.entries(source)) {
|
|
469
|
+
// Special handling for AbortSignal instances
|
|
470
|
+
if (key === 'signal' && value instanceof globalThis.AbortSignal) {
|
|
471
|
+
signals.push(value);
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
// Special handling for context - shallow merge only
|
|
475
|
+
if (key === 'context') {
|
|
476
|
+
if (value !== undefined && value !== null && (!isObject(value) || Array.isArray(value))) {
|
|
477
|
+
throw new TypeError('The `context` option must be an object');
|
|
478
|
+
}
|
|
479
|
+
// Shallow merge: always create a new object to prevent mutation bugs
|
|
480
|
+
returnValue = {
|
|
481
|
+
...returnValue,
|
|
482
|
+
context: (value === undefined || value === null)
|
|
483
|
+
? {}
|
|
484
|
+
: { ...returnValue.context, ...value },
|
|
485
|
+
};
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
// Special handling for searchParams
|
|
489
|
+
if (key === 'searchParams') {
|
|
490
|
+
if (value === undefined || value === null) {
|
|
491
|
+
// Explicit undefined or null removes searchParams
|
|
492
|
+
searchParameters = undefined;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
// First source: keep as-is to preserve type (string/object/URLSearchParams)
|
|
496
|
+
// Subsequent sources: merge and convert to URLSearchParams
|
|
497
|
+
searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
|
|
498
|
+
}
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
if (isObject(value) && key in returnValue) {
|
|
502
|
+
value = deepMerge(returnValue[key], value);
|
|
503
|
+
}
|
|
504
|
+
returnValue = { ...returnValue, [key]: value };
|
|
505
|
+
}
|
|
506
|
+
if (isObject(source.hooks)) {
|
|
507
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
508
|
+
returnValue.hooks = hooks;
|
|
509
|
+
}
|
|
510
|
+
if (isObject(source.headers)) {
|
|
511
|
+
headers = mergeHeaders(headers, source.headers);
|
|
512
|
+
returnValue.headers = headers;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (searchParameters !== undefined) {
|
|
517
|
+
returnValue.searchParams = searchParameters;
|
|
518
|
+
}
|
|
519
|
+
if (signals.length > 0) {
|
|
520
|
+
if (signals.length === 1) {
|
|
521
|
+
returnValue.signal = signals[0];
|
|
522
|
+
}
|
|
523
|
+
else if (supportsAbortSignal) {
|
|
524
|
+
returnValue.signal = AbortSignal.any(signals);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
// When AbortSignal.any is not available, use the last signal
|
|
528
|
+
// This maintains the previous behavior before signal merging was added
|
|
529
|
+
// This can be remove when the `supportsAbortSignal` check is removed.`
|
|
530
|
+
returnValue.signal = signals.at(-1);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return returnValue;
|
|
534
|
+
};
|
|
535
|
+
//# sourceMappingURL=merge.js.map
|
|
536
|
+
;// ../../node_modules/ky/distribution/utils/normalize.js
|
|
537
|
+
|
|
538
|
+
const normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
539
|
+
const retryMethods = ['get', 'put', 'head', 'delete', 'options', 'trace'];
|
|
540
|
+
const retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
541
|
+
const retryAfterStatusCodes = [413, 429, 503];
|
|
542
|
+
const defaultRetryOptions = {
|
|
543
|
+
limit: 2,
|
|
544
|
+
methods: retryMethods,
|
|
545
|
+
statusCodes: retryStatusCodes,
|
|
546
|
+
afterStatusCodes: retryAfterStatusCodes,
|
|
547
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
548
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
549
|
+
delay: attemptCount => 0.3 * (2 ** (attemptCount - 1)) * 1000,
|
|
550
|
+
jitter: undefined,
|
|
551
|
+
retryOnTimeout: false,
|
|
552
|
+
};
|
|
553
|
+
const normalizeRetryOptions = (retry = {}) => {
|
|
554
|
+
if (typeof retry === 'number') {
|
|
555
|
+
return {
|
|
556
|
+
...defaultRetryOptions,
|
|
557
|
+
limit: retry,
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
if (retry.methods && !Array.isArray(retry.methods)) {
|
|
561
|
+
throw new Error('retry.methods must be an array');
|
|
562
|
+
}
|
|
563
|
+
retry.methods &&= retry.methods.map(method => method.toLowerCase());
|
|
564
|
+
if (retry.statusCodes && !Array.isArray(retry.statusCodes)) {
|
|
565
|
+
throw new Error('retry.statusCodes must be an array');
|
|
566
|
+
}
|
|
567
|
+
const normalizedRetry = Object.fromEntries(Object.entries(retry).filter(([, value]) => value !== undefined));
|
|
568
|
+
return {
|
|
569
|
+
...defaultRetryOptions,
|
|
570
|
+
...normalizedRetry,
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
//# sourceMappingURL=normalize.js.map
|
|
574
|
+
;// ../../node_modules/ky/distribution/errors/TimeoutError.js
|
|
575
|
+
class TimeoutError extends Error {
|
|
576
|
+
request;
|
|
577
|
+
constructor(request) {
|
|
578
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
579
|
+
this.name = 'TimeoutError';
|
|
580
|
+
this.request = request;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
//# sourceMappingURL=TimeoutError.js.map
|
|
584
|
+
;// ../../node_modules/ky/distribution/utils/timeout.js
|
|
585
|
+
|
|
586
|
+
// `Promise.race()` workaround (#91)
|
|
587
|
+
async function timeout(request, init, abortController, options) {
|
|
588
|
+
return new Promise((resolve, reject) => {
|
|
589
|
+
const timeoutId = setTimeout(() => {
|
|
590
|
+
if (abortController) {
|
|
591
|
+
abortController.abort();
|
|
592
|
+
}
|
|
593
|
+
reject(new TimeoutError(request));
|
|
594
|
+
}, options.timeout);
|
|
595
|
+
void options
|
|
596
|
+
.fetch(request, init)
|
|
597
|
+
.then(resolve)
|
|
598
|
+
.catch(reject)
|
|
599
|
+
.then(() => {
|
|
600
|
+
clearTimeout(timeoutId);
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
//# sourceMappingURL=timeout.js.map
|
|
605
|
+
;// ../../node_modules/ky/distribution/utils/delay.js
|
|
606
|
+
// https://github.com/sindresorhus/delay/tree/ab98ae8dfcb38e1593286c94d934e70d14a4e111
|
|
607
|
+
async function delay(ms, { signal }) {
|
|
608
|
+
return new Promise((resolve, reject) => {
|
|
609
|
+
if (signal) {
|
|
610
|
+
signal.throwIfAborted();
|
|
611
|
+
signal.addEventListener('abort', abortHandler, { once: true });
|
|
612
|
+
}
|
|
613
|
+
function abortHandler() {
|
|
614
|
+
clearTimeout(timeoutId);
|
|
615
|
+
reject(signal.reason);
|
|
616
|
+
}
|
|
617
|
+
const timeoutId = setTimeout(() => {
|
|
618
|
+
signal?.removeEventListener('abort', abortHandler);
|
|
619
|
+
resolve();
|
|
620
|
+
}, ms);
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
//# sourceMappingURL=delay.js.map
|
|
624
|
+
;// ../../node_modules/ky/distribution/utils/options.js
|
|
625
|
+
|
|
626
|
+
const findUnknownOptions = (request, options) => {
|
|
627
|
+
const unknownOptions = {};
|
|
628
|
+
for (const key in options) {
|
|
629
|
+
// Skip inherited properties
|
|
630
|
+
if (!Object.hasOwn(options, key)) {
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
// An option is passed to fetch() if:
|
|
634
|
+
// 1. It's not a standard RequestInit option (not in requestOptionsRegistry)
|
|
635
|
+
// 2. It's not a ky-specific option (not in kyOptionKeys)
|
|
636
|
+
// 3. Either:
|
|
637
|
+
// a. It's not on the Request object, OR
|
|
638
|
+
// b. It's a vendor-specific option that should always be passed (in vendorSpecificOptions)
|
|
639
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || key in vendorSpecificOptions)) {
|
|
640
|
+
unknownOptions[key] = options[key];
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return unknownOptions;
|
|
644
|
+
};
|
|
645
|
+
const hasSearchParameters = (search) => {
|
|
646
|
+
if (search === undefined) {
|
|
647
|
+
return false;
|
|
648
|
+
}
|
|
649
|
+
// The `typeof array` still gives "object", so we need different checking for array.
|
|
650
|
+
if (Array.isArray(search)) {
|
|
651
|
+
return search.length > 0;
|
|
652
|
+
}
|
|
653
|
+
if (search instanceof URLSearchParams) {
|
|
654
|
+
return search.size > 0;
|
|
655
|
+
}
|
|
656
|
+
// Record
|
|
657
|
+
if (typeof search === 'object') {
|
|
658
|
+
return Object.keys(search).length > 0;
|
|
659
|
+
}
|
|
660
|
+
if (typeof search === 'string') {
|
|
661
|
+
return search.trim().length > 0;
|
|
662
|
+
}
|
|
663
|
+
return Boolean(search);
|
|
664
|
+
};
|
|
665
|
+
//# sourceMappingURL=options.js.map
|
|
666
|
+
;// ../../node_modules/ky/distribution/utils/type-guards.js
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
Type guard to check if an error is a Ky error.
|
|
672
|
+
|
|
673
|
+
@param error - The error to check
|
|
674
|
+
@returns `true` if the error is a Ky error, `false` otherwise
|
|
675
|
+
|
|
676
|
+
@example
|
|
677
|
+
```
|
|
678
|
+
import ky, {isKyError} from 'ky';
|
|
679
|
+
try {
|
|
680
|
+
const response = await ky.get('/api/data');
|
|
681
|
+
} catch (error) {
|
|
682
|
+
if (isKyError(error)) {
|
|
683
|
+
// Handle Ky-specific errors
|
|
684
|
+
console.log('Ky error occurred:', error.message);
|
|
685
|
+
} else {
|
|
686
|
+
// Handle other errors
|
|
687
|
+
console.log('Unknown error:', error);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
```
|
|
691
|
+
*/
|
|
692
|
+
function isKyError(error) {
|
|
693
|
+
return isHTTPError(error) || isTimeoutError(error) || isForceRetryError(error);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
Type guard to check if an error is an HTTPError.
|
|
697
|
+
|
|
698
|
+
@param error - The error to check
|
|
699
|
+
@returns `true` if the error is an HTTPError, `false` otherwise
|
|
700
|
+
|
|
701
|
+
@example
|
|
702
|
+
```
|
|
703
|
+
import ky, {isHTTPError} from 'ky';
|
|
704
|
+
try {
|
|
705
|
+
const response = await ky.get('/api/data');
|
|
706
|
+
} catch (error) {
|
|
707
|
+
if (isHTTPError(error)) {
|
|
708
|
+
console.log('HTTP error status:', error.response.status);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
*/
|
|
713
|
+
function isHTTPError(error) {
|
|
714
|
+
return error instanceof HTTPError || (error?.name === HTTPError.name);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
Type guard to check if an error is a TimeoutError.
|
|
718
|
+
|
|
719
|
+
@param error - The error to check
|
|
720
|
+
@returns `true` if the error is a TimeoutError, `false` otherwise
|
|
721
|
+
|
|
722
|
+
@example
|
|
723
|
+
```
|
|
724
|
+
import ky, {isTimeoutError} from 'ky';
|
|
725
|
+
try {
|
|
726
|
+
const response = await ky.get('/api/data', { timeout: 1000 });
|
|
727
|
+
} catch (error) {
|
|
728
|
+
if (isTimeoutError(error)) {
|
|
729
|
+
console.log('Request timed out:', error.request.url);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
*/
|
|
734
|
+
function isTimeoutError(error) {
|
|
735
|
+
return error instanceof TimeoutError || (error?.name === TimeoutError.name);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
Type guard to check if an error is a ForceRetryError.
|
|
739
|
+
|
|
740
|
+
@param error - The error to check
|
|
741
|
+
@returns `true` if the error is a ForceRetryError, `false` otherwise
|
|
742
|
+
|
|
743
|
+
@example
|
|
744
|
+
```
|
|
745
|
+
import ky, {isForceRetryError} from 'ky';
|
|
746
|
+
|
|
747
|
+
const api = ky.extend({
|
|
748
|
+
hooks: {
|
|
749
|
+
beforeRetry: [
|
|
750
|
+
({error, retryCount}) => {
|
|
751
|
+
if (isForceRetryError(error)) {
|
|
752
|
+
console.log(`Forced retry #${retryCount}: ${error.code}`);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
]
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
```
|
|
759
|
+
*/
|
|
760
|
+
function isForceRetryError(error) {
|
|
761
|
+
return error instanceof ForceRetryError || (error?.name === ForceRetryError.name);
|
|
762
|
+
}
|
|
763
|
+
//# sourceMappingURL=type-guards.js.map
|
|
764
|
+
;// ../../node_modules/ky/distribution/core/Ky.js
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
class Ky {
|
|
777
|
+
static create(input, options) {
|
|
778
|
+
const ky = new Ky(input, options);
|
|
779
|
+
const function_ = async () => {
|
|
780
|
+
if (typeof ky.#options.timeout === 'number' && ky.#options.timeout > maxSafeTimeout) {
|
|
781
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
782
|
+
}
|
|
783
|
+
// Delay the fetch so that body method shortcuts can set the Accept header
|
|
784
|
+
await Promise.resolve();
|
|
785
|
+
// Before using ky.request, _fetch clones it and saves the clone for future retries to use.
|
|
786
|
+
// If retry is not needed, close the cloned request's ReadableStream for memory safety.
|
|
787
|
+
let response = await ky.#fetch();
|
|
788
|
+
for (const hook of ky.#options.hooks.afterResponse) {
|
|
789
|
+
// Clone the response before passing to hook so we can cancel it if needed
|
|
790
|
+
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
791
|
+
let modifiedResponse;
|
|
792
|
+
try {
|
|
793
|
+
// eslint-disable-next-line no-await-in-loop
|
|
794
|
+
modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
795
|
+
}
|
|
796
|
+
catch (error) {
|
|
797
|
+
// Cancel both responses to prevent memory leaks when hook throws
|
|
798
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
799
|
+
ky.#cancelResponseBody(response);
|
|
800
|
+
throw error;
|
|
801
|
+
}
|
|
802
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
803
|
+
// Cancel both the cloned response passed to the hook and the current response to prevent resource leaks (especially important in Deno/Bun).
|
|
804
|
+
// Do not await cancellation since hooks can clone the response, leaving extra tee branches that keep cancel promises pending per the Streams spec.
|
|
805
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
806
|
+
ky.#cancelResponseBody(response);
|
|
807
|
+
throw new ForceRetryError_ForceRetryError(modifiedResponse.options);
|
|
808
|
+
}
|
|
809
|
+
// Determine which response to use going forward
|
|
810
|
+
const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
|
|
811
|
+
// Cancel any response bodies we won't use to prevent memory leaks.
|
|
812
|
+
// Uses fire-and-forget since hooks may have cloned the response, creating tee branches that block cancellation.
|
|
813
|
+
if (clonedResponse !== nextResponse) {
|
|
814
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
815
|
+
}
|
|
816
|
+
if (response !== nextResponse) {
|
|
817
|
+
ky.#cancelResponseBody(response);
|
|
818
|
+
}
|
|
819
|
+
response = nextResponse;
|
|
820
|
+
}
|
|
821
|
+
ky.#decorateResponse(response);
|
|
822
|
+
if (!response.ok && (typeof ky.#options.throwHttpErrors === 'function'
|
|
823
|
+
? ky.#options.throwHttpErrors(response.status)
|
|
824
|
+
: ky.#options.throwHttpErrors)) {
|
|
825
|
+
let error = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
826
|
+
for (const hook of ky.#options.hooks.beforeError) {
|
|
827
|
+
// eslint-disable-next-line no-await-in-loop
|
|
828
|
+
error = await hook(error, { retryCount: ky.#retryCount });
|
|
829
|
+
}
|
|
830
|
+
throw error;
|
|
831
|
+
}
|
|
832
|
+
// If `onDownloadProgress` is passed, it uses the stream API internally
|
|
833
|
+
if (ky.#options.onDownloadProgress) {
|
|
834
|
+
if (typeof ky.#options.onDownloadProgress !== 'function') {
|
|
835
|
+
throw new TypeError('The `onDownloadProgress` option must be a function');
|
|
836
|
+
}
|
|
837
|
+
if (!supportsResponseStreams) {
|
|
838
|
+
throw new Error('Streams are not supported in your environment. `ReadableStream` is missing.');
|
|
839
|
+
}
|
|
840
|
+
const progressResponse = response.clone();
|
|
841
|
+
ky.#cancelResponseBody(response);
|
|
842
|
+
return streamResponse(progressResponse, ky.#options.onDownloadProgress);
|
|
843
|
+
}
|
|
844
|
+
return response;
|
|
845
|
+
};
|
|
846
|
+
// Always wrap in #retry to catch forced retries from afterResponse hooks
|
|
847
|
+
// Method retriability is checked in #calculateRetryDelay for non-forced retries
|
|
848
|
+
const result = ky.#retry(function_)
|
|
849
|
+
.finally(() => {
|
|
850
|
+
const originalRequest = ky.#originalRequest;
|
|
851
|
+
// Ignore cancellation errors from already-locked or already-consumed streams.
|
|
852
|
+
ky.#cancelBody(originalRequest?.body ?? undefined);
|
|
853
|
+
ky.#cancelBody(ky.request.body ?? undefined);
|
|
854
|
+
});
|
|
855
|
+
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
856
|
+
// Only expose `.bytes()` when the environment implements it.
|
|
857
|
+
if (type === 'bytes'
|
|
858
|
+
&& typeof globalThis.Response?.prototype?.bytes !== 'function') {
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
result[type] = async () => {
|
|
862
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
863
|
+
ky.request.headers.set('accept', ky.request.headers.get('accept') || mimeType);
|
|
864
|
+
const response = await result;
|
|
865
|
+
if (type === 'json') {
|
|
866
|
+
if (response.status === 204) {
|
|
867
|
+
return '';
|
|
868
|
+
}
|
|
869
|
+
const text = await response.text();
|
|
870
|
+
if (text === '') {
|
|
871
|
+
return '';
|
|
872
|
+
}
|
|
873
|
+
if (options.parseJson) {
|
|
874
|
+
return options.parseJson(text);
|
|
875
|
+
}
|
|
876
|
+
return JSON.parse(text);
|
|
877
|
+
}
|
|
878
|
+
return response[type]();
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
return result;
|
|
882
|
+
}
|
|
883
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
884
|
+
static #normalizeSearchParams(searchParams) {
|
|
885
|
+
// Filter out undefined values from plain objects
|
|
886
|
+
if (searchParams && typeof searchParams === 'object' && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
|
|
887
|
+
return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== undefined));
|
|
888
|
+
}
|
|
889
|
+
return searchParams;
|
|
890
|
+
}
|
|
891
|
+
request;
|
|
892
|
+
#abortController;
|
|
893
|
+
#retryCount = 0;
|
|
894
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly -- False positive: #input is reassigned on line 202
|
|
895
|
+
#input;
|
|
896
|
+
#options;
|
|
897
|
+
#originalRequest;
|
|
898
|
+
#userProvidedAbortSignal;
|
|
899
|
+
#cachedNormalizedOptions;
|
|
900
|
+
// eslint-disable-next-line complexity
|
|
901
|
+
constructor(input, options = {}) {
|
|
902
|
+
this.#input = input;
|
|
903
|
+
this.#options = {
|
|
904
|
+
...options,
|
|
905
|
+
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
906
|
+
hooks: mergeHooks({
|
|
907
|
+
beforeRequest: [],
|
|
908
|
+
beforeRetry: [],
|
|
909
|
+
beforeError: [],
|
|
910
|
+
afterResponse: [],
|
|
911
|
+
}, options.hooks),
|
|
912
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? 'GET'),
|
|
913
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
914
|
+
prefixUrl: String(options.prefixUrl || ''),
|
|
915
|
+
retry: normalizeRetryOptions(options.retry),
|
|
916
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
917
|
+
timeout: options.timeout ?? 10_000,
|
|
918
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
919
|
+
context: options.context ?? {},
|
|
920
|
+
};
|
|
921
|
+
if (typeof this.#input !== 'string' && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
922
|
+
throw new TypeError('`input` must be a string, URL, or Request');
|
|
923
|
+
}
|
|
924
|
+
if (this.#options.prefixUrl && typeof this.#input === 'string') {
|
|
925
|
+
if (this.#input.startsWith('/')) {
|
|
926
|
+
throw new Error('`input` must not begin with a slash when using `prefixUrl`');
|
|
927
|
+
}
|
|
928
|
+
if (!this.#options.prefixUrl.endsWith('/')) {
|
|
929
|
+
this.#options.prefixUrl += '/';
|
|
930
|
+
}
|
|
931
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
932
|
+
}
|
|
933
|
+
if (supportsAbortController && supportsAbortSignal) {
|
|
934
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
935
|
+
this.#abortController = new globalThis.AbortController();
|
|
936
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
937
|
+
}
|
|
938
|
+
if (supportsRequestStreams) {
|
|
939
|
+
// @ts-expect-error - Types are outdated.
|
|
940
|
+
this.#options.duplex = 'half';
|
|
941
|
+
}
|
|
942
|
+
if (this.#options.json !== undefined) {
|
|
943
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
944
|
+
this.#options.headers.set('content-type', this.#options.headers.get('content-type') ?? 'application/json');
|
|
945
|
+
}
|
|
946
|
+
// To provide correct form boundary, Content-Type header should be deleted when creating Request from another Request with FormData/URLSearchParams body
|
|
947
|
+
// Only delete if user didn't explicitly provide a custom content-type
|
|
948
|
+
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has('content-type');
|
|
949
|
+
if (this.#input instanceof globalThis.Request
|
|
950
|
+
&& ((supportsFormData && this.#options.body instanceof globalThis.FormData) || this.#options.body instanceof URLSearchParams)
|
|
951
|
+
&& !userProvidedContentType) {
|
|
952
|
+
this.#options.headers.delete('content-type');
|
|
953
|
+
}
|
|
954
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
955
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
956
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
957
|
+
const textSearchParams = typeof this.#options.searchParams === 'string'
|
|
958
|
+
? this.#options.searchParams.replace(/^\?/, '')
|
|
959
|
+
: new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
960
|
+
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
961
|
+
const searchParams = '?' + textSearchParams;
|
|
962
|
+
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
963
|
+
// Recreate request with the updated URL. We already have all options in this.#options, including duplex.
|
|
964
|
+
this.request = new globalThis.Request(url, this.#options);
|
|
965
|
+
}
|
|
966
|
+
// If `onUploadProgress` is passed, it uses the stream API internally
|
|
967
|
+
if (this.#options.onUploadProgress) {
|
|
968
|
+
if (typeof this.#options.onUploadProgress !== 'function') {
|
|
969
|
+
throw new TypeError('The `onUploadProgress` option must be a function');
|
|
970
|
+
}
|
|
971
|
+
if (!supportsRequestStreams) {
|
|
972
|
+
throw new Error('Request streams are not supported in your environment. The `duplex` option for `Request` is not available.');
|
|
973
|
+
}
|
|
974
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
#calculateDelay() {
|
|
978
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
979
|
+
let jitteredDelay = retryDelay;
|
|
980
|
+
if (this.#options.retry.jitter === true) {
|
|
981
|
+
jitteredDelay = Math.random() * retryDelay;
|
|
982
|
+
}
|
|
983
|
+
else if (typeof this.#options.retry.jitter === 'function') {
|
|
984
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
985
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
986
|
+
jitteredDelay = retryDelay;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
// Handle undefined backoffLimit by treating it as no limit (Infinity)
|
|
990
|
+
const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
|
|
991
|
+
return Math.min(backoffLimit, jitteredDelay);
|
|
992
|
+
}
|
|
993
|
+
async #calculateRetryDelay(error) {
|
|
994
|
+
this.#retryCount++;
|
|
995
|
+
if (this.#retryCount > this.#options.retry.limit) {
|
|
996
|
+
throw error;
|
|
997
|
+
}
|
|
998
|
+
// Wrap non-Error throws to ensure consistent error handling
|
|
999
|
+
const errorObject = error instanceof Error ? error : new NonError(error);
|
|
1000
|
+
// Handle forced retry from afterResponse hook - skip method check and shouldRetry
|
|
1001
|
+
if (errorObject instanceof ForceRetryError_ForceRetryError) {
|
|
1002
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
1003
|
+
}
|
|
1004
|
+
// Check if method is retriable for non-forced retries
|
|
1005
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
1006
|
+
throw error;
|
|
1007
|
+
}
|
|
1008
|
+
// User-provided shouldRetry function takes precedence over all other checks
|
|
1009
|
+
if (this.#options.retry.shouldRetry !== undefined) {
|
|
1010
|
+
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
1011
|
+
// Strict boolean checking - only exact true/false are handled specially
|
|
1012
|
+
if (result === false) {
|
|
1013
|
+
throw error;
|
|
1014
|
+
}
|
|
1015
|
+
if (result === true) {
|
|
1016
|
+
// Force retry - skip all other validation and return delay
|
|
1017
|
+
return this.#calculateDelay();
|
|
1018
|
+
}
|
|
1019
|
+
// If undefined or any other value, fall through to default behavior
|
|
1020
|
+
}
|
|
1021
|
+
// Default timeout behavior
|
|
1022
|
+
if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) {
|
|
1023
|
+
throw error;
|
|
1024
|
+
}
|
|
1025
|
+
if (isHTTPError(error)) {
|
|
1026
|
+
if (!this.#options.retry.statusCodes.includes(error.response.status)) {
|
|
1027
|
+
throw error;
|
|
1028
|
+
}
|
|
1029
|
+
const retryAfter = error.response.headers.get('Retry-After')
|
|
1030
|
+
?? error.response.headers.get('RateLimit-Reset')
|
|
1031
|
+
?? error.response.headers.get('X-RateLimit-Retry-After') // Symfony-based services
|
|
1032
|
+
?? error.response.headers.get('X-RateLimit-Reset') // GitHub
|
|
1033
|
+
?? error.response.headers.get('X-Rate-Limit-Reset'); // Twitter
|
|
1034
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
1035
|
+
let after = Number(retryAfter) * 1000;
|
|
1036
|
+
if (Number.isNaN(after)) {
|
|
1037
|
+
after = Date.parse(retryAfter) - Date.now();
|
|
1038
|
+
}
|
|
1039
|
+
else if (after >= Date.parse('2024-01-01')) {
|
|
1040
|
+
// A large number is treated as a timestamp (fixed threshold protects against clock skew)
|
|
1041
|
+
after -= Date.now();
|
|
1042
|
+
}
|
|
1043
|
+
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
1044
|
+
// Don't apply jitter when server provides explicit retry timing
|
|
1045
|
+
return after < max ? after : max;
|
|
1046
|
+
}
|
|
1047
|
+
if (error.response.status === 413) {
|
|
1048
|
+
throw error;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
return this.#calculateDelay();
|
|
1052
|
+
}
|
|
1053
|
+
#decorateResponse(response) {
|
|
1054
|
+
if (this.#options.parseJson) {
|
|
1055
|
+
response.json = async () => this.#options.parseJson(await response.text());
|
|
1056
|
+
}
|
|
1057
|
+
return response;
|
|
1058
|
+
}
|
|
1059
|
+
#cancelBody(body) {
|
|
1060
|
+
if (!body) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
// Ignore cancellation failures from already-locked or already-consumed streams.
|
|
1064
|
+
void body.cancel().catch(() => undefined);
|
|
1065
|
+
}
|
|
1066
|
+
#cancelResponseBody(response) {
|
|
1067
|
+
// Ignore cancellation failures from already-locked or already-consumed streams.
|
|
1068
|
+
this.#cancelBody(response.body ?? undefined);
|
|
1069
|
+
}
|
|
1070
|
+
async #retry(function_) {
|
|
1071
|
+
try {
|
|
1072
|
+
return await function_();
|
|
1073
|
+
}
|
|
1074
|
+
catch (error) {
|
|
1075
|
+
const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
|
|
1076
|
+
if (this.#retryCount < 1) {
|
|
1077
|
+
throw error;
|
|
1078
|
+
}
|
|
1079
|
+
// Only use user-provided signal for delay, not our internal abortController
|
|
1080
|
+
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
1081
|
+
// Apply custom request from forced retry before beforeRetry hooks
|
|
1082
|
+
// Ensure the custom request has the correct managed signal for timeouts and user aborts
|
|
1083
|
+
if (error instanceof ForceRetryError_ForceRetryError && error.customRequest) {
|
|
1084
|
+
const managedRequest = this.#options.signal
|
|
1085
|
+
? new globalThis.Request(error.customRequest, { signal: this.#options.signal })
|
|
1086
|
+
: new globalThis.Request(error.customRequest);
|
|
1087
|
+
this.#assignRequest(managedRequest);
|
|
1088
|
+
}
|
|
1089
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
1090
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1091
|
+
const hookResult = await hook({
|
|
1092
|
+
request: this.request,
|
|
1093
|
+
options: this.#getNormalizedOptions(),
|
|
1094
|
+
error: error,
|
|
1095
|
+
retryCount: this.#retryCount,
|
|
1096
|
+
});
|
|
1097
|
+
if (hookResult instanceof globalThis.Request) {
|
|
1098
|
+
this.#assignRequest(hookResult);
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
// If a Response is returned, use it and skip the retry
|
|
1102
|
+
if (hookResult instanceof globalThis.Response) {
|
|
1103
|
+
return hookResult;
|
|
1104
|
+
}
|
|
1105
|
+
// If `stop` is returned from the hook, the retry process is stopped
|
|
1106
|
+
if (hookResult === stop) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return this.#retry(function_);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
async #fetch() {
|
|
1114
|
+
// Reset abortController if it was aborted (happens on timeout retry)
|
|
1115
|
+
if (this.#abortController?.signal.aborted) {
|
|
1116
|
+
this.#abortController = new globalThis.AbortController();
|
|
1117
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
1118
|
+
// Recreate request with new signal
|
|
1119
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
1120
|
+
}
|
|
1121
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
1122
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1123
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
1124
|
+
if (result instanceof Response) {
|
|
1125
|
+
return result;
|
|
1126
|
+
}
|
|
1127
|
+
if (result instanceof globalThis.Request) {
|
|
1128
|
+
this.#assignRequest(result);
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
1133
|
+
// Cloning is done here to prepare in advance for retries
|
|
1134
|
+
this.#originalRequest = this.request;
|
|
1135
|
+
this.request = this.#originalRequest.clone();
|
|
1136
|
+
if (this.#options.timeout === false) {
|
|
1137
|
+
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
1138
|
+
}
|
|
1139
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
1140
|
+
}
|
|
1141
|
+
#getNormalizedOptions() {
|
|
1142
|
+
if (!this.#cachedNormalizedOptions) {
|
|
1143
|
+
const { hooks, ...normalizedOptions } = this.#options;
|
|
1144
|
+
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
1145
|
+
}
|
|
1146
|
+
return this.#cachedNormalizedOptions;
|
|
1147
|
+
}
|
|
1148
|
+
#assignRequest(request) {
|
|
1149
|
+
this.#cachedNormalizedOptions = undefined;
|
|
1150
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
1151
|
+
}
|
|
1152
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
1153
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
1154
|
+
return request;
|
|
1155
|
+
}
|
|
1156
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
//# sourceMappingURL=Ky.js.map
|
|
1160
|
+
;// ../../node_modules/ky/distribution/index.js
|
|
1161
|
+
/*! MIT License © Sindre Sorhus */
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
const createInstance = (defaults) => {
|
|
1166
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1167
|
+
const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
1168
|
+
for (const method of requestMethods) {
|
|
1169
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1170
|
+
ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
1171
|
+
}
|
|
1172
|
+
ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
1173
|
+
ky.extend = (newDefaults) => {
|
|
1174
|
+
if (typeof newDefaults === 'function') {
|
|
1175
|
+
newDefaults = newDefaults(defaults ?? {});
|
|
1176
|
+
}
|
|
1177
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
1178
|
+
};
|
|
1179
|
+
ky.stop = stop;
|
|
1180
|
+
ky.retry = retry;
|
|
1181
|
+
return ky;
|
|
1182
|
+
};
|
|
1183
|
+
const ky = createInstance();
|
|
1184
|
+
/* harmony default export */ const distribution = (ky);
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
// Intentionally not exporting this for now as it's just an implementation detail and we don't want to commit to a certain API yet at least.
|
|
1190
|
+
// export {NonError} from './errors/NonError.js';
|
|
1191
|
+
//# sourceMappingURL=index.js.map
|
|
1192
|
+
|
|
1193
|
+
/***/ })
|
|
1194
|
+
|
|
1195
|
+
};
|
|
1196
|
+
;
|