cf 1.0.0-beta.28 → 1.0.0-beta.29

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 (328) hide show
  1. package/README.md +10 -3
  2. package/dist/_meta/commands.json +2240 -3181
  3. package/dist/_meta/hand-written-commands.json +38 -8
  4. package/dist/_meta/schemas.json +1683 -2505
  5. package/dist/{abuse-reports-D9edOyag.mjs → abuse-reports-DqXYX_6F.mjs} +10 -10
  6. package/dist/{access-CKCCSrrU.mjs → access-Cte4yyIz.mjs} +1 -1
  7. package/dist/{accounts-CNb9U9bK.mjs → accounts-G-x-_cEx.mjs} +58 -57
  8. package/dist/{acm-CdKTAToZ.mjs → acm-Bg3HqMGG.mjs} +7 -7
  9. package/dist/{addressing-eZI_C-b0.mjs → addressing-BwEofGEm.mjs} +46 -46
  10. package/dist/{agent-memory-BBHCEE7h.mjs → agent-memory-DhwZ2KRw.mjs} +15 -15
  11. package/dist/{ai-Csl_QNwv.mjs → ai-DWWRIQIt.mjs} +16 -16
  12. package/dist/{ai-audit-DlqWsQi-.mjs → ai-audit-CMEBz6ZP.mjs} +3 -3
  13. package/dist/ai-gateway-D2s0isU-.mjs +76 -0
  14. package/dist/ai-search-a0uqr9yJ.mjs +74 -0
  15. package/dist/{ai-security-DvU2iYkY.mjs → ai-security-H_RqjRoL.mjs} +4 -4
  16. package/dist/alerting-Bgp9rE4I.mjs +52 -0
  17. package/dist/analytics-CFYM82FD.mjs +17 -0
  18. package/dist/{analytics-engine-BlIecoOe.mjs → analytics-engine-BLiEaLxb.mjs} +2 -2
  19. package/dist/{api-security-DZ7GWOqD.mjs → api-security-B0YtHglt.mjs} +63 -63
  20. package/dist/{argo-Bh0_cj49.mjs → argo-BPwbzHY7.mjs} +7 -7
  21. package/dist/{artifacts-VZJWVq_6.mjs → artifacts-B6UwC2PH.mjs} +20 -20
  22. package/dist/{audit-logs-B8cGL4B9.mjs → audit-logs-kG97iEnI.mjs} +2 -2
  23. package/dist/auth-Czr8ChBB.mjs +2 -0
  24. package/dist/auth-DA1PHaHi.mjs +2 -0
  25. package/dist/auth-Dwfa4S3h.mjs +7 -0
  26. package/dist/{auth-token-DW4dJVdj.mjs → auth-token-CE3Wa5-b.mjs} +1 -1
  27. package/dist/{autoconfig-C0ynlGHf.mjs → autoconfig-B4tFR6ua.mjs} +120 -116
  28. package/dist/{basin-catalog-TehR1sKZ.mjs → basin-catalog-DzVEPupy.mjs} +17 -17
  29. package/dist/{billing-B2KusU6g.mjs → billing-TERxOuLR.mjs} +11 -11
  30. package/dist/{blocks-BFulF68V.mjs → blocks-C3Im7AT0.mjs} +1 -1
  31. package/dist/body-parser-HN91kAf0.mjs +2 -0
  32. package/dist/{body-unions-DNs981Ia.mjs → body-unions-D9OSaf4M.mjs} +1 -1
  33. package/dist/{bot-management-CXHXgrQC.mjs → bot-management-SZw9jTOC.mjs} +4 -4
  34. package/dist/{botnet-feed-UyK7Rfp6.mjs → botnet-feed-DjdAeUtb.mjs} +5 -5
  35. package/dist/brand-protection-BpA7Gmf1.mjs +18 -0
  36. package/dist/browser-run-BvjfMK3f.mjs +40 -0
  37. package/dist/build-CCwo_ydV.mjs +2 -0
  38. package/dist/{build-FFxzigo4.mjs → build-yQOzZg6Z.mjs} +1 -1
  39. package/dist/builds-tMa3sbQU.mjs +62 -0
  40. package/dist/{cache-BacNNtLu.mjs → cache-b_EPh6Is.mjs} +18 -18
  41. package/dist/cf-DmvZ2L51.mjs +18 -0
  42. package/dist/{chunk-DSGVRFIS-BaNZNW-M.mjs → chunk-DSGVRFIS-Cj7pO-YQ.mjs} +1 -1
  43. package/dist/chunk-Q5KVZMHK-WOCEMyET.mjs +363 -0
  44. package/dist/cli-Cc7ujzAy.mjs +4 -0
  45. package/dist/{client-side-security-bzB9JosR.mjs → client-side-security-DVkeCzcC.mjs} +14 -14
  46. package/dist/{cloud-connector-BHtf37R5.mjs → cloud-connector-MVf4acRR.mjs} +3 -3
  47. package/dist/{cloudflared-QDdHMUEY.mjs → cloudflared-BOkMl8Gm.mjs} +1 -1
  48. package/dist/cloudforce-one-KrCfQbRx.mjs +318 -0
  49. package/dist/{command-D895kdlh.mjs → command-BQbZw4Kx.mjs} +1 -1
  50. package/dist/command-BVct0Dvr.mjs +2 -0
  51. package/dist/{command-DeutqL1n.mjs → command-C4_lMRkw.mjs} +1 -1
  52. package/dist/command-CJ3ldWrA.mjs +2 -0
  53. package/dist/command-CyOdBNur.mjs +2 -0
  54. package/dist/command-D2XkyO1e.mjs +2 -0
  55. package/dist/command-DHODgfFZ.mjs +2 -0
  56. package/dist/command-DIIaZx_f.mjs +2 -0
  57. package/dist/command-DONwHpqZ.mjs +2 -0
  58. package/dist/command-DdYnSf-8.mjs +2 -0
  59. package/dist/command-DqOU7Ql2.mjs +2 -0
  60. package/dist/{command-CbxXc5IW.mjs → command-HW7k43qu.mjs} +1 -1
  61. package/dist/command-NqM0lo4a.mjs +2 -0
  62. package/dist/command-bwVDyMv4.mjs +2 -0
  63. package/dist/command-yzqs4m83.mjs +2 -0
  64. package/dist/{completions-BvdKtzsX.mjs → completions-0YKvIyBT.mjs} +2 -2
  65. package/dist/{connector-interrupts-dUPW6Ya_.mjs → connector-interrupts-CsunbRsr.mjs} +3 -3
  66. package/dist/{connector-telemetry-events-DWVCqnhn.mjs → connector-telemetry-events-DmQPD7xC.mjs} +3 -3
  67. package/dist/{connector-telemetry-snapshots-CeMP3qeI.mjs → connector-telemetry-snapshots-C62iHjC9.mjs} +3 -3
  68. package/dist/{connectors-DZFGNw3i.mjs → connectors-Bg0MU6ZT.mjs} +7 -7
  69. package/dist/{containers-DCzQCo79.mjs → containers-BiA_bpPR.mjs} +22 -21
  70. package/dist/{content-scan-XhnNJqXf.mjs → content-scan-4SA2nacB.mjs} +6 -6
  71. package/dist/{context-BY1Eh_Qe.mjs → context-BGm5_wTT.mjs} +1 -1
  72. package/dist/{cps-CohlxvuN.mjs → cps-WDmD3V5I.mjs} +3 -3
  73. package/dist/csam-scanner-Rmy-hBEA.mjs +8 -0
  74. package/dist/{custom-csrs-BVdMQjYq.mjs → custom-csrs-D-lvkyRV.mjs} +5 -5
  75. package/dist/{custom-hostnames-r-CxhSa1.mjs → custom-hostnames-B5BQX5m6.mjs} +12 -12
  76. package/dist/{custom-nameservers-CapMDyly.mjs → custom-nameservers-CZrRjcjx.mjs} +4 -4
  77. package/dist/{custom-pages-BVIniWfq.mjs → custom-pages-CWwjtfbj.mjs} +10 -10
  78. package/dist/d1-N81q-FAr.mjs +50 -0
  79. package/dist/{delegate-CcL6RoGw.mjs → delegate-livNdiwK.mjs} +1 -1
  80. package/dist/delegate.mjs +1 -1
  81. package/dist/deploy-Ok4ncy06.mjs +2 -0
  82. package/dist/deploy-context-B_lLfxt7.mjs +55 -0
  83. package/dist/deploy-input-JZlEJwKB.mjs +2 -0
  84. package/dist/dev-DxbkJkzc.mjs +4 -0
  85. package/dist/{diagnostics-C3nqxsAO.mjs → diagnostics-DlJzpO8b.mjs} +7 -7
  86. package/dist/dialog-CD94-Kzw.mjs +2 -0
  87. package/dist/discover-D9FNaCDK.mjs +2 -0
  88. package/dist/discover-DGsMj9ZN.mjs +2 -0
  89. package/dist/{dist-D-ihn_mV.mjs → dist-BxhwE-W1.mjs} +193 -193
  90. package/dist/{dls-N1x8sAK3.mjs → dls-5OXuxLAB.mjs} +8 -8
  91. package/dist/{dns-DATWP-PF.mjs → dns-Burep9O7.mjs} +59 -69
  92. package/dist/{dns-firewall-n3Y2ui6W.mjs → dns-firewall-hUHaQ0DE.mjs} +8 -8
  93. package/dist/docs-BFVK88kB.mjs +3 -0
  94. package/dist/{dry-run-kJbjn4kG.mjs → dry-run-qsnRlRk6.mjs} +1 -1
  95. package/dist/{durable-objects-DHK9w-vO.mjs → durable-objects-D6R8S2Dk.mjs} +3 -3
  96. package/dist/email-auth--2KCzZNA.mjs +6 -0
  97. package/dist/email-routing-DzaExfVf.mjs +44 -0
  98. package/dist/{email-security-DK_SJ0yi.mjs → email-security-DwQJszzy.mjs} +71 -71
  99. package/dist/{email-sending-CTQafGec.mjs → email-sending-mQd2qB-o.mjs} +21 -21
  100. package/dist/errors-C_bGcR0X.mjs +11 -0
  101. package/dist/field-extractors-MVOizTlB.mjs +8 -0
  102. package/dist/{firewall-CW-fAI9m.mjs → firewall-DtSIlkfL.mjs} +19 -19
  103. package/dist/{flagship-RiLnDwfJ.mjs → flagship-9E5gwNki.mjs} +12 -12
  104. package/dist/{fraud-DvfBBTe8.mjs → fraud-DjqhVJdf.mjs} +3 -3
  105. package/dist/generate-BzOnRBij.mjs +2 -0
  106. package/dist/generate-DfxZtpn9.mjs +2 -0
  107. package/dist/{global-options-DiKj2cQy.mjs → global-options-4pyD17hd.mjs} +1 -1
  108. package/dist/{google-tag-gateway-C5WYsSXv.mjs → google-tag-gateway-BM5GmCZa.mjs} +3 -3
  109. package/dist/gt-BV-jij5q.mjs +4 -0
  110. package/dist/healthchecks-CEZ5f3XJ.mjs +20 -0
  111. package/dist/{hyperdrive-Ch6klUp3.mjs → hyperdrive-Da8hCcUw.mjs} +12 -12
  112. package/dist/{iam-LlGEzRCq.mjs → iam-BK6N7NdQ.mjs} +31 -31
  113. package/dist/{images-C5WqUXkK.mjs → images-3bCWE6Ml.mjs} +33 -33
  114. package/dist/index.mjs +1 -1
  115. package/dist/init-BgCF9K8h.mjs +43 -0
  116. package/dist/{intel-vcWyslaX.mjs → intel-BQ58CJLt.mjs} +30 -30
  117. package/dist/{interactive-BCDFSPtq.mjs → interactive-JBA3qOUa.mjs} +9 -9
  118. package/dist/{internal-BhV9WjLp.mjs → internal-CWPz0sBF.mjs} +2 -2
  119. package/dist/{ips-CqHjVsqd.mjs → ips-3WYegiVW.mjs} +2 -2
  120. package/dist/{k2-CZT2Pd5J.mjs → k2-Bc_hjmiv.mjs} +5 -5
  121. package/dist/{kv-Ipa7dnvF.mjs → kv-DbShBhhg.mjs} +6 -6
  122. package/dist/{lazy-command-DbKVgdGT.mjs → lazy-command-CbGyEqFK.mjs} +1 -1
  123. package/dist/leaked-credential-checks-DgPefxP9.mjs +16 -0
  124. package/dist/{live-C9L1bNuE.mjs → live-BTtMv1a6.mjs} +2 -2
  125. package/dist/load-balancers-C2hg52WA.mjs +84 -0
  126. package/dist/{local-DIJ7SIKC.mjs → local-B3zt9PXR.mjs} +1 -1
  127. package/dist/local-DRxctCh9.mjs +2 -0
  128. package/dist/local-runtime-BOnDiMDc.mjs +2 -0
  129. package/dist/{log-BWdaOGOW.mjs → log-Brx-wjJW.mjs} +3 -3
  130. package/dist/log-DBAHla_W.mjs +2 -0
  131. package/dist/login-CK3nn9a5.mjs +2 -0
  132. package/dist/{login-DG5ebyab.mjs → login-DiR-buzS.mjs} +3 -3
  133. package/dist/{logpush-C5Gw7F_9.mjs → logpush-CitvUX-J.mjs} +22 -22
  134. package/dist/{logs-y3REfHbb.mjs → logs-CfWHu4Ir.mjs} +14 -16
  135. package/dist/{magic-network-monitoring-BZBGZB6M.mjs → magic-network-monitoring-gU6yzzML.mjs} +17 -17
  136. package/dist/{magic-transit-BPV_POf5.mjs → magic-transit-B3JY9u5o.mjs} +139 -139
  137. package/dist/{managed-defense-BaUBSUcz.mjs → managed-defense-C_EQ-NYp.mjs} +9 -9
  138. package/dist/managed-transforms-DIGl6JkM.mjs +8 -0
  139. package/dist/{mcp-RPtrISTy.mjs → mcp-DqhQJVaz.mjs} +15 -15
  140. package/dist/{mesh-DZ4QHBPE.mjs → mesh-DXVZBNDC.mjs} +12 -12
  141. package/dist/{migrate-CRIUqGi2.mjs → migrate-CmXyk9vX.mjs} +1 -1
  142. package/dist/{monetization-CVZqM8Xo.mjs → monetization-CWg-mySr.mjs} +9 -9
  143. package/dist/{network-interconnects-9nS5jL__.mjs → network-interconnects-DhfKL5tG.mjs} +17 -19
  144. package/dist/{network-DLt2JUo1.mjs → network-jtgq5eb4.mjs} +24 -24
  145. package/dist/o11y-eYYs59X9.mjs +88 -0
  146. package/dist/oauth-BgDZMd72.mjs +5 -0
  147. package/dist/{oauth-Cidoyxfp.mjs → oauth-V37G-PaV.mjs} +1 -1
  148. package/dist/{observability-C-KNh__y.mjs → observability-CB72eC4T.mjs} +2 -2
  149. package/dist/{ohttp-gateway-B5nCl4s3.mjs → ohttp-gateway-K9ToEft8.mjs} +4 -4
  150. package/dist/{organizations-DbeeWUL4.mjs → organizations-BllV7l_c.mjs} +18 -19
  151. package/dist/output-hFMAotFl.mjs +2 -0
  152. package/dist/package-oNVeacC9.mjs +2 -0
  153. package/dist/page-rules-BVmi-ZFW.mjs +35 -0
  154. package/dist/pages-5spcBpX1.mjs +48 -0
  155. package/dist/{pay-per-crawl-EHYtSKxX.mjs → pay-per-crawl-BgsdGcBi.mjs} +18 -18
  156. package/dist/{pay-per-use-wdEhl8k4.mjs → pay-per-use-CzmI1kEA.mjs} +16 -16
  157. package/dist/pipelines-CbtmLRxt.mjs +40 -0
  158. package/dist/{precursor-Dx8lN4UJ.mjs → precursor-Dk8YOKf_.mjs} +2 -2
  159. package/dist/previews-Bv1HMMtO.mjs +6 -0
  160. package/dist/progress-DE_G09u2.mjs +2 -0
  161. package/dist/project-settings-D_S-UC8I.mjs +3 -0
  162. package/dist/prompt-D274Im1O.mjs +4 -0
  163. package/dist/{queues-DgMc7Z6A.mjs → queues-DGCYUr4g.mjs} +26 -26
  164. package/dist/{r2-BpTVicIq.mjs → r2-DtCk-Nfi.mjs} +51 -51
  165. package/dist/{radar-DW-S1VUh.mjs → radar-1CwqOsMZ.mjs} +150 -150
  166. package/dist/raw-fetch-DhlyWQtk.mjs +2 -0
  167. package/dist/{ready-d0li0X6r.mjs → ready-CcoEA7M7.mjs} +2 -2
  168. package/dist/{realtime-DMKHLYF4.mjs → realtime-DFUxwIG5.mjs} +80 -81
  169. package/dist/registrar-Cl1snz8z.mjs +43 -0
  170. package/dist/{registrar-sandbox-lVLB1-mC.mjs → registrar-sandbox-Cne9BVCZ.mjs} +9 -9
  171. package/dist/{reporting-WX8P3Y0k.mjs → reporting-D9FC-Z-3.mjs} +7 -7
  172. package/dist/request-headers-Bopp5lH_.mjs +2 -0
  173. package/dist/request-tracers-CSSB9_aW.mjs +4 -0
  174. package/dist/{resource-sharing-B2ZSt_cA.mjs → resource-sharing-D8yuzJm7.mjs} +18 -18
  175. package/dist/{rules-CB0QQTB3.mjs → rules-DzmOQ3MB.mjs} +8 -8
  176. package/dist/rulesets-DsTGcgbc.mjs +42 -0
  177. package/dist/{rum-BZ_24qZU.mjs → rum-DrJLI93T.mjs} +14 -14
  178. package/dist/run-C5yPsiO2.mjs +2 -0
  179. package/dist/run-CXWkMU3x.mjs +2 -0
  180. package/dist/schema-CfZOW8Zw.mjs +2 -0
  181. package/dist/{schema-cache-5NkOj7Y3.mjs → schema-cache-CtqAs0PP.mjs} +1 -1
  182. package/dist/schema-flags-DO3kLYBu.mjs +4 -0
  183. package/dist/{scim-DchxaJfE.mjs → scim-0OufLKru.mjs} +8 -8
  184. package/dist/{secrets-store-oAft1cFE.mjs → secrets-store-BQeLzFxv.mjs} +11 -11
  185. package/dist/{security-insights-DMm0qg_m.mjs → security-insights-D2pj8-O-.mjs} +20 -20
  186. package/dist/{security-txt-CIt0494b.mjs → security-txt-SKtgW4n-.mjs} +4 -4
  187. package/dist/session-COdP8BXD.mjs +2 -0
  188. package/dist/shared-D_2KLpP3.mjs +2 -0
  189. package/dist/{signed-url-gNangfwc.mjs → signed-url-CcE2zQ4Y.mjs} +2 -2
  190. package/dist/smart-shield-Dod9Gs6T.mjs +22 -0
  191. package/dist/snippets-DrrdpLnS.mjs +18 -0
  192. package/dist/spawn-DNf-Ge8d.mjs +5 -0
  193. package/dist/{spectrum-DLYIHelC.mjs → spectrum-CHBGZbZF.mjs} +11 -11
  194. package/dist/{speed-DugG9Tm9.mjs → speed-vOlHyG3v.mjs} +11 -11
  195. package/dist/sql-BCuLxGSf.mjs +4 -0
  196. package/dist/src-ByCoEqOw.mjs +133 -0
  197. package/dist/{ssl-Bg4X3WGk.mjs → ssl-BA_dcVwF.mjs} +60 -62
  198. package/dist/startup-profile-CyQk_f_L.mjs +2 -0
  199. package/dist/{startup-profile-DZL2DC44.mjs → startup-profile-uh-F0HRS.mjs} +3 -3
  200. package/dist/state-B6r-b_-d.mjs +2 -0
  201. package/dist/{state-mr5ux1Nb.mjs → state-CTLznbVs.mjs} +1 -1
  202. package/dist/static-assets-DGDoaJf1.mjs +386 -0
  203. package/dist/stream-CzlqY8hq.mjs +89 -0
  204. package/dist/{tags-SKz2odE_.mjs → tags-BLeaslAb.mjs} +8 -8
  205. package/dist/telemetry-COlodX5Z.mjs +2 -0
  206. package/dist/{telemetry-B4zmCpT0.mjs → telemetry-DF7A5Bpk.mjs} +1 -1
  207. package/dist/{tenant-custom-nameservers-BhkhBerL.mjs → tenant-custom-nameservers-C5rh6jPf.mjs} +4 -4
  208. package/dist/{tenants-DD-GMq0K.mjs → tenants-CRirmhxS.mjs} +3 -3
  209. package/dist/{tools-KW_4hvzY.mjs → tools-BRjRgZnj.mjs} +1 -1
  210. package/dist/tunnels-nLfIWPYT.mjs +27 -0
  211. package/dist/{turnstile-DhSU_Xar.mjs → turnstile-CZjXtBCr.mjs} +10 -10
  212. package/dist/ui-dWsVmFCG.mjs +2 -0
  213. package/dist/{update-check-HltjTMDE.mjs → update-check-CXMdVBhW.mjs} +1 -1
  214. package/dist/{update-check-CRttabfu.mjs → update-check-D_Oky9-u.mjs} +1 -1
  215. package/dist/update-check-worker.mjs +1 -1
  216. package/dist/{url-normalization-K7gkmPvG.mjs → url-normalization-DTKgJHE8.mjs} +4 -4
  217. package/dist/url-scanner-9XW3zLaU.mjs +16 -0
  218. package/dist/user-Bk1BIqZ5.mjs +103 -0
  219. package/dist/{vectorize-BTBerJME.mjs → vectorize-CgOfmWYq.mjs} +15 -15
  220. package/dist/version-CcuBNjqg.mjs +2 -0
  221. package/dist/waiting-rooms-C3nTKfK9.mjs +52 -0
  222. package/dist/{web-assets-LHPQsrnY.mjs → web-assets-CWU3jrit.mjs} +29 -29
  223. package/dist/{web3-BsOio0Ae.mjs → web3-CRpQ5sl4.mjs} +13 -13
  224. package/dist/workers-BZMvamn0.mjs +39 -0
  225. package/dist/{workers-for-platforms-BGp6yr6P.mjs → workers-for-platforms-C7F2ev-5.mjs} +18 -18
  226. package/dist/{workers-vpc-D8lefWDo.mjs → workers-vpc-ztEKvWmq.mjs} +6 -6
  227. package/dist/{workflows-B-ZIG3y7.mjs → workflows-Dd88_Nqc.mjs} +24 -24
  228. package/dist/{wrangler-migration-6E6wT_LZ.mjs → wrangler-migration-BzMTJPdI.mjs} +294 -294
  229. package/dist/zaraz-BFK0p28R.mjs +22 -0
  230. package/dist/{zero-trust-BZDXM5r6.mjs → zero-trust-Cdjfp0Ie.mjs} +441 -455
  231. package/dist/{zones-B-UV_DGE.mjs → zones-DDn5jk6I.mjs} +51 -51
  232. package/package.json +19 -19
  233. package/dist/ai-gateway-Lj4On37s.mjs +0 -74
  234. package/dist/ai-search-BxyhS3X7.mjs +0 -74
  235. package/dist/alerting-r0G2X9y9.mjs +0 -52
  236. package/dist/analytics-C6bfqm-W.mjs +0 -17
  237. package/dist/auth-B-h0BHg7.mjs +0 -2
  238. package/dist/auth-B6tswVxH.mjs +0 -2
  239. package/dist/auth-clmqFEWU.mjs +0 -7
  240. package/dist/body-parser-DoewLePl.mjs +0 -2
  241. package/dist/brand-protection-kv1ba80i.mjs +0 -14
  242. package/dist/browser-run-D-vRoZmf.mjs +0 -40
  243. package/dist/build-BzJGqb2o.mjs +0 -2
  244. package/dist/builds-BbxINHRP.mjs +0 -64
  245. package/dist/cf-BQ_LRiut.mjs +0 -18
  246. package/dist/chunk-SOBRPAPT-QTjnHSNs.mjs +0 -363
  247. package/dist/cli-B7vslRfu.mjs +0 -4
  248. package/dist/cloudforce-one-DWBPQDA3.mjs +0 -318
  249. package/dist/command-AVwd7XjE.mjs +0 -2
  250. package/dist/command-B87T_f2f.mjs +0 -2
  251. package/dist/command-CEHhi3t0.mjs +0 -2
  252. package/dist/command-CYmQE79n.mjs +0 -2
  253. package/dist/command-Ce8CVLth.mjs +0 -2
  254. package/dist/command-CqDudQZs.mjs +0 -2
  255. package/dist/command-D4YcwpVp.mjs +0 -2
  256. package/dist/command-D9Qyi1B0.mjs +0 -2
  257. package/dist/command-Dl9ICrRK.mjs +0 -2
  258. package/dist/command-DtCSe8Hy.mjs +0 -2
  259. package/dist/command-DwzVtmb3.mjs +0 -2
  260. package/dist/command-wtBubtZ4.mjs +0 -2
  261. package/dist/containers-B06OGOEB.mjs +0 -380
  262. package/dist/csam-scanner-BV4bHq8v.mjs +0 -8
  263. package/dist/d1-nJCOJZb8.mjs +0 -50
  264. package/dist/deploy-DJMnWFNk.mjs +0 -2
  265. package/dist/deploy-context-YCW3eqP1.mjs +0 -56
  266. package/dist/deploy-input-CQLBXFEB.mjs +0 -2
  267. package/dist/dev-GsYHvMah.mjs +0 -4
  268. package/dist/dialog-D5lus4M4.mjs +0 -2
  269. package/dist/discover-6kAmVMPp.mjs +0 -2
  270. package/dist/discover-C06Syc2B.mjs +0 -2
  271. package/dist/docs-CRc_WOXh.mjs +0 -3
  272. package/dist/email-auth-ptdqNSTZ.mjs +0 -6
  273. package/dist/email-domains-uL22-zRY.mjs +0 -14
  274. package/dist/email-routing-CV43rMJC.mjs +0 -44
  275. package/dist/errors-VG1mgwJl.mjs +0 -11
  276. package/dist/field-extractors-jcZ_bAGc.mjs +0 -8
  277. package/dist/generate-CeeWW3eX.mjs +0 -3
  278. package/dist/generate-D6V4Q58z.mjs +0 -2
  279. package/dist/gt-BQkaDQDq.mjs +0 -3
  280. package/dist/healthchecks-BA1fmzTm.mjs +0 -20
  281. package/dist/init-EVsjBrOz.mjs +0 -43
  282. package/dist/leaked-credential-checks-EzT4TTjO.mjs +0 -16
  283. package/dist/load-balancers-Cb3VkSfc.mjs +0 -84
  284. package/dist/local-D5Vq6ooZ.mjs +0 -2
  285. package/dist/local-runtime-BZjgkacr.mjs +0 -2
  286. package/dist/log-DZfik9Jk.mjs +0 -2
  287. package/dist/login-DRJugxya.mjs +0 -2
  288. package/dist/managed-transforms-CjkjLzMC.mjs +0 -8
  289. package/dist/o11y-ySxrnP1Z.mjs +0 -88
  290. package/dist/oauth-CFVUl-Wv.mjs +0 -4
  291. package/dist/output-BZQEl3mK.mjs +0 -2
  292. package/dist/package-B7RgwuFR.mjs +0 -2
  293. package/dist/page-rules-DRw763O1.mjs +0 -38
  294. package/dist/pages-DfQnxiTk.mjs +0 -48
  295. package/dist/pipelines-DbyrI6F4.mjs +0 -40
  296. package/dist/previews-DEVNSip2.mjs +0 -6
  297. package/dist/progress-yvPscjYg.mjs +0 -2
  298. package/dist/project-settings-nBMEx1f-.mjs +0 -3
  299. package/dist/prompt-CEpZ-lQZ.mjs +0 -4
  300. package/dist/raw-fetch-Cl5spWC3.mjs +0 -2
  301. package/dist/registrar-D23gfKBi.mjs +0 -43
  302. package/dist/request-headers-C0FpeBhz.mjs +0 -2
  303. package/dist/request-tracers-qd7XOAka.mjs +0 -4
  304. package/dist/rulesets-DmqwixUC.mjs +0 -42
  305. package/dist/run-BOKI1uWa.mjs +0 -2
  306. package/dist/run-DBqOjD1P.mjs +0 -2
  307. package/dist/schema-Dj9STsWI.mjs +0 -2
  308. package/dist/schema-flags-CXm9iIv6.mjs +0 -4
  309. package/dist/session-vzNfUhPl.mjs +0 -2
  310. package/dist/shared-MK-_lkbn.mjs +0 -2
  311. package/dist/smart-shield-Boy_qbqd.mjs +0 -22
  312. package/dist/snippets-DdoDYXW-.mjs +0 -18
  313. package/dist/spawn-B5F4OIHG.mjs +0 -5
  314. package/dist/sql-Bb56llsb.mjs +0 -4
  315. package/dist/src-BoSDeQ9m.mjs +0 -133
  316. package/dist/startup-profile-DQVkZZpb.mjs +0 -2
  317. package/dist/state-DW3QZtfh.mjs +0 -2
  318. package/dist/stream-BuZYDbNR.mjs +0 -89
  319. package/dist/telemetry-DkDUr4KK.mjs +0 -2
  320. package/dist/tunnels-D90ztENM.mjs +0 -27
  321. package/dist/ui-xjCox-gU.mjs +0 -2
  322. package/dist/url-scanner-BRdWwka4.mjs +0 -16
  323. package/dist/user-Cmb1_Wu5.mjs +0 -103
  324. package/dist/version-6Bpy6Bgt.mjs +0 -2
  325. package/dist/waiting-rooms-LymmKIGr.mjs +0 -52
  326. package/dist/workers-BnLiOjZf.mjs +0 -39
  327. package/dist/workers-builds-sKpITeRk.mjs +0 -14
  328. package/dist/zaraz-BBKki5WS.mjs +0 -22
@@ -1,363 +0,0 @@
1
- #!/usr/bin/env node
2
- import{B as e,H as t,J as n,K as r,it as i,k as a,nt as o,q as s}from"./dist-D-ihn_mV.mjs";import{E as c,M as l,N as u,O as d}from"./chunk-AAQI36FL-e6E5HW1g.mjs";import{createRequire as f}from"node:module";import{chmodSync as p,existsSync as m,mkdirSync as h,rmSync as g,writeFileSync as _}from"node:fs";import v from"node:path";import ee from"node:url";import y from"node:assert";import{TextEncoder as te}from"node:util";import ne from"node:http";import{createCipheriv as re,createDecipheriv as ie,createHash as ae,randomBytes as b,webcrypto as x}from"node:crypto";import{spawn as oe,spawnSync as S}from"node:child_process";f(import.meta.url||(typeof __filename==`string`?__filename:`/`));var se=Object.defineProperty,C=(e,t)=>se(e,`name`,{value:t,configurable:!0}),w=e();f(import.meta.url||(typeof __filename==`string`?__filename:`/`));var ce=!1;function T(e){let{configOverride:t,warningLogger:n,storage:r}=e,{oauth_token:i,refresh_token:a,expiration_time:o,scopes:s,api_token:c}=t??r.read()??{};return i?{accessToken:{value:i,expiry:o??`2000-01-01:00:00:00+00:00`},refreshToken:{value:a??``},scopes:s}:c?(!ce&&n&&(ce=!0,n.warn(`It looks like you have used Wrangler v1's \`config\` command to login with an API token
3
- from ${t===void 0?r.path():`in-memory config`}.
4
- This is no longer supported in the current version of Wrangler.
5
- If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable.`)),{deprecatedApiToken:c}):{}}C(T,`readStoredAuthState`);var le=i({variableName:`CLOUDFLARE_API_TOKEN`,deprecatedName:`CF_API_TOKEN`}),ue=i({variableName:`CLOUDFLARE_API_KEY`,deprecatedName:`CF_API_KEY`}),de=i({variableName:`CLOUDFLARE_EMAIL`,deprecatedName:`CF_EMAIL`});function fe(e){if(e?.allowGlobalAuthKey??!0){let e=ue(),t=de();if(e&&t)return{authKey:e,authEmail:t}}let t=le();if(t)return{apiToken:t}}C(fe,`getAuthFromEnv`);function pe(e){let t=fe(e);if(t)return t;let n=T({storage:e.storage,warningLogger:e.warningLogger});if(n.deprecatedApiToken)return{apiToken:n.deprecatedApiToken};if(n.accessToken?.value)return{apiToken:n.accessToken.value}}C(pe,`getAPIToken`);function me(e){let t=pe(e);if(!t)throw new u(`No API token found.`,{telemetryMessage:`user auth missing api token`});return t}C(me,`requireApiToken`);var he=/^[A-Za-z0-9_-]+$/;function ge(e,t){if(!he.test(e))throw new u(`Invalid account ID "${e}" ${t}. Account IDs may only contain alphanumeric characters, hyphens, and underscores.`,{telemetryMessage:`user account id invalid characters`});return e}C(ge,`validateAccountId`);var E=i({variableName:`WRANGLER_AUTH_DOMAIN`,defaultValue:/* @__PURE__ */ C(()=>s()===`staging`?`dash.staging.cloudflare.com`:`dash.cloudflare.com`,`defaultValue`)}),_e=i({variableName:`WRANGLER_AUTH_URL`,defaultValue:/* @__PURE__ */ C(()=>`https://${E()}/oauth2/auth`,`defaultValue`)}),ve=i({variableName:`WRANGLER_TOKEN_URL`,defaultValue:/* @__PURE__ */ C(()=>`https://${E()}/oauth2/token`,`defaultValue`)}),ye=i({variableName:`WRANGLER_REVOKE_URL`,defaultValue:/* @__PURE__ */ C(()=>`https://${E()}/oauth2/revoke`,`defaultValue`)}),be=i({variableName:`CLOUDFLARE_ACCOUNT_ID`,deprecatedName:`CF_ACCOUNT_ID`});function xe(){let e=be();if(e)return ge(e,"set in the `CLOUDFLARE_ACCOUNT_ID` environment variable")}C(xe,`getCloudflareAccountIdFromEnv`);var Se=`/oauth2/device/auth`;function Ce(){return`https://${E()}${Se}`}C(Ce,`getDeviceAuthUrl`);var we=i({variableName:`CLOUDFLARE_ACCESS_CLIENT_ID`}),Te=i({variableName:`CLOUDFLARE_ACCESS_CLIENT_SECRET`}),Ee=i({variableName:`WRANGLER_CF_AUTHORIZATION_TOKEN`}),De=o({variableName:`CLOUDFLARE_AUTH_USE_KEYRING`}),D={},O=/* @__PURE__ */ new Map;function Oe(e,t){let n=new URL(`https://${e}`);return t&&n.searchParams.set(`cf_workers_preview_token`,t),n.toString()}C(Oe,`buildProbeUrl`);function ke(){for(let e of Object.keys(D))delete D[e];O.clear()}C(ke,`clearAccessCaches`);async function k(e,t,n){t.debug(`Checking if domain has Access enabled:`,e);let r=JSON.stringify([e,!!n]);if(O.has(r))return t.debug(`Using cached Access switch for:`,e,O.get(r)),O.get(r)??!1;t.debug(`Access switch not cached for:`,e);try{let i=new AbortController,a=setTimeout(()=>{i.abort()},1e3),o=await(0,w.fetch)(Oe(e,n),{redirect:`manual`,signal:i.signal});clearTimeout(a);let s=!!(o.status===302&&o.headers.get(`location`)?.includes(`cloudflareaccess.com`));return(s||!n)&&(t.debug(`Caching access switch for:`,e),O.set(r,s)),s}catch{return t.debug(`Access probe failed for:`,e),!1}}C(k,`domainUsesAccess`);async function Ae(e,t){let n=t.logger,r=we(),i=Te();if(r&&i)return n.debug(`Using Access Service Token headers for domain:`,e),{"CF-Access-Client-Id":r,"CF-Access-Client-Secret":i};if((r!==void 0||i!==void 0)&&n.warn(`Both CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET must be set to use Access Service Token authentication. Only ${r===void 0?`CLOUDFLARE_ACCESS_CLIENT_SECRET`:`CLOUDFLARE_ACCESS_CLIENT_ID`} was found.`),!await k(e,n,t.previewToken))return{};if(n.debug(`Getting Access headers for domain:`,e),D[e])return n.debug(`Using cached Access headers for domain:`,e),D[e];if((t.isNonInteractiveOrCI??a)())throw new u(`The domain "${e}" is behind Cloudflare Access, but no Access Service Token credentials were found and the current environment is non-interactive.
6
- Set the CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET environment variables to authenticate with an Access Service Token.
7
- See https://developers.cloudflare.com/cloudflare-one/access-controls/service-credentials/service-tokens/`,{telemetryMessage:`user access missing service token non interactive`});n.debug(`Spawning cloudflared to get Access token for domain:`);let o=await je(Oe(e,t.previewToken),t.signal);if(o.error)throw new u(`To use ${t.cliDisplayName} with Cloudflare Access, please install \`cloudflared\` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation`,{telemetryMessage:`user access missing cloudflared`});let s=o.stdout;n.debug(`cloudflared output:`,s);let c=s.match(/fetched your token:\n\n(.*)/m);if(c&&c.length>=2){let t={Cookie:`CF_Authorization=${c[1]}`};return D[e]=t,n.debug(`Caching Access headers for domain:`,e),t}throw Error(`Failed to authenticate with Cloudflare Access`)}C(Ae,`getAccessHeaders`);function je(e,t){return new Promise((n,r)=>{let i=oe(`cloudflared`,[`access`,`login`,e],{signal:t}),a=[];i.stdout.on(`data`,e=>a.push(e)),i.stderr.resume();let o=/* @__PURE__ */ C(()=>i.kill(),`killChild`);process.once(`exit`,o),i.on(`error`,e=>{process.removeListener(`exit`,o),t?.aborted?r(e):n({error:e,stdout:``})}),i.on(`close`,()=>{process.removeListener(`exit`,o),t?.aborted?r(t.reason??/* @__PURE__ */ Error(`The operation was aborted`)):n({stdout:Buffer.concat(a).toString()})})})}C(je,`spawnCloudflaredAccessLogin`);async function Me(e){let t=Ee();return t===void 0?Ae(E(),e):(e.logger.debug(`Using WRANGLER_CF_AUTHORIZATION_TOKEN from environment`),{Cookie:`CF_Authorization=${t}`})}C(Me,`getCloudflareAccessHeaders`);var Ne=96,Pe=32,Fe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`;function Ie(e){let t=btoa(e);return t=t.replace(/\+/g,`-`),t=t.replace(/\//g,`_`),t=t.replace(/=/g,``),t}C(Ie,`base64urlEncode`);async function Le(){let e=new Uint32Array(Ne);x.getRandomValues(e);let t=Ie(Array.from(e).map(e=>Fe[e%Fe.length]).join(``)),n=await x.subtle.digest(`SHA-256`,new te().encode(t)),r=new Uint8Array(n),i=``,a=r.byteLength;for(let e=0;e<a;e++)i+=String.fromCharCode(r[e]);return{codeChallenge:Ie(i),codeVerifier:t}}C(Le,`generatePKCECodes`);var Re=/* @__PURE__ */ C(({verificationUri:e,userCode:t})=>{let n=new URL(e);return n.searchParams.set(`user_code`,t),n.toString()},`generateVerificationUrl`);function ze(e){try{return new URL(e)}catch{return}}C(ze,`parseUrl`);function Be(e,t){let n=ze(e),r=ze(`https://${t.authDomain}`);if(n===void 0||r===void 0||n.protocol!==`https:`||n.username!==``||n.password!==``||n.host!==r.host)throw new u(`The authorization server returned an untrusted \`${t.field}\`: ${e}
8
- Expected an \`https\` URL on \`${t.authDomain}\`. Refusing to display or open it.`,{telemetryMessage:`user device-flow untrusted verification url`})}C(Be,`assertTrustedVerificationUrl`);var Ve=/* @__PURE__ */ C(({authUrl:e,clientId:t,scopes:n,stateQueryParam:r,codeChallenge:i,redirectUri:a})=>e+`?response_type=code&client_id=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(a)}&scope=${encodeURIComponent([...n,`offline_access`].join(` `))}&state=${r}&code_challenge=${encodeURIComponent(i)}&code_challenge_method=S256`,`generateAuthUrl`);function He(e){let t=new Uint32Array(e);return x.getRandomValues(t),Array.from(t).map(e=>Fe[e%Fe.length]).join(``)}C(He,`generateRandomState`);var Ue=64e6;function We(e,t,n){let r=Array(t+1),i=ae(`sha256`).update(e).digest();r[0]=i;for(let e=0;e<t;e++){for(let e=0;e<n;e++)i=ae(`sha256`).update(i).digest();r[e+1]=i}return r}C(We,`solvePow`);function Ge(e){return Buffer.concat(e).toString(`base64`)}C(Ge,`encodeCheckpoints`);function Ke(e){let t=We(Buffer.from(e.seed,`base64url`),e.k,e.g);return{challengeToken:e.challengeToken,solution:{checkpoints:Ge(t)}}}C(Ke,`solveChallenge`);var qe=`--temporary-account`,A={termsOfService:`https://www.cloudflare.com/terms/`,privacyPolicy:`https://www.cloudflare.com/privacypolicy/`},Je=`You must accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}) in order to continue. By typing "yes", you agree to these terms. Type "yes" to continue.`,Ye=`Continuing means you accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}).`,Xe=/* @__PURE__ */ new Map([[1035,{message:`The event code is malformed. Check it and try again.`,telemetryMessage:`deploy temporary event code invalid`}],[1036,{message:`The event code was not found. Check it and try again.`,telemetryMessage:`deploy temporary event not found`}],[1037,{message:`This event has not started yet.`,telemetryMessage:`deploy temporary event not started`}],[1038,{message:`This event has ended.`,telemetryMessage:`deploy temporary event expired`}],[1039,{message:`This event is disabled. Contact the event organizer.`,telemetryMessage:`deploy temporary event disabled`}],[1040,{message:`This event has no temporary accounts remaining.`,telemetryMessage:`deploy temporary event exhausted`}],[1041,{message:`The event account could not be prepared. Try again later or contact the event organizer.`,telemetryMessage:`deploy temporary event provisioning unavailable`,fatal:!0}]]);function Ze(e){if(typeof e!=`object`||!e||!(`errors`in e))return;let{errors:t}=e;if(!Array.isArray(t)||t.length===0)return;let[n]=t;if(typeof n==`object`&&n&&`code`in n)return typeof n.code==`number`?n.code:void 0}C(Ze,`getResponseErrorCode`);async function Qe(e){let t;try{t=await e.json()}catch{return}let n=Ze(t);if(n===void 0)return;let r=Xe.get(n);if(!r)return;let i={telemetryMessage:r.telemetryMessage};return r.fatal?new l(r.message,i):new u(r.message,i)}C(Qe,`getEventAccountError`);function $e(){return`${r(t)}/provisioning/previews`}C($e,`getTemporaryPreviewUrl`);function et(){return`${$e()}/challenge`}C(et,`getTemporaryPreviewChallengeUrl`);function tt(e){let t=Date.parse(e);return!Number.isNaN(t)&&t>Date.now()}C(tt,`isFutureTimestamp`);function nt(e){let t=e.read();if(t&&t.account?.id&&t.account?.apiToken&&t.account?.name&&t.claim?.url&&tt(t.account?.expiresAt??``)&&tt(t.claim?.expiresAt??``))return t}C(nt,`getCachedTemporaryPreviewAccount`);async function rt(e,t){let n=await(0,w.fetch)(et(),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!n.ok)throw new l(`Failed to request a proof-of-work challenge (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account challenge failed`});let r;try{r=await n.json()}catch{throw new l(`Failed to request a proof-of-work challenge. Received an invalid response (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account challenge invalid response`})}let{challengeToken:i,seed:a,k:o,g:s}=r.result??{};if(i===void 0||a===void 0||o===void 0||s===void 0)throw new l(`Failed to request a proof-of-work challenge because the response was missing required fields.`,{telemetryMessage:`deploy temporary account challenge incomplete`});if(!Number.isInteger(o)||!Number.isInteger(s)||o<=0||s<=0||o*s>Ue||Buffer.from(a,`base64url`).length!==32)throw new l(`The proof-of-work challenge is not supported by this version of ${t}.`,{telemetryMessage:`deploy temporary account challenge difficulty unsupported`});return e.log(`Solving proof-of-work challenge…`),Ke({challengeToken:i,seed:a,k:o,g:s})}C(rt,`requestPowSolution`);async function it(e,t,n=`Wrangler`){let r=await rt(e,n),i=await(0,w.fetch)($e(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({termsOfService:A.termsOfService,privacyPolicy:A.privacyPolicy,acceptTermsOfService:`yes`,challengeToken:r.challengeToken,solution:r.solution,...t?.eventCode?{eventCode:t.eventCode}:{}})});if(!i.ok){if(t?.eventCode){let e=await Qe(i);if(e)throw e}throw new l(`Failed to create a temporary preview account (${i.status} ${i.statusText}).`,{telemetryMessage:`deploy temporary account create failed`})}let a;try{a=await i.json()}catch{throw new l(`Failed to create a temporary preview account. Received an invalid response (${i.status} ${i.statusText}).`,{telemetryMessage:`deploy temporary account invalid response`})}let o=a.result,s=o?.account?.id,c=o?.account?.name,u=o?.account?.apiToken,d=o?.account?.expiresAt,f=o?.claim?.url,p=o?.claim?.expiresAt,m=o?.eventCodeAccepted;if(s===void 0||c===void 0||u===void 0||d===void 0||f===void 0||p===void 0)throw new l(`Failed to create a temporary preview account because the response was missing required fields.`,{telemetryMessage:`deploy temporary account response incomplete`});if(t?.eventCode&&m!==!0)throw new l(`Failed to create a temporary preview account because the response did not acknowledge the event code.`,{telemetryMessage:`deploy temporary event acknowledgement missing`});return{account:{id:s,name:c,apiToken:u,expiresAt:d},claim:{url:f,expiresAt:p}}}C(it,`createTemporaryPreviewAccount`);async function at(e){let t=nt(e.storage);if(t){if(e.request?.eventCode)throw new u(`A temporary account is already cached. Rerun without --event-code to reuse it, or run \`${e.logoutCommand??`wrangler logout`}\` and retry to create an account for this event.`,{telemetryMessage:`deploy temporary event cache conflict`});return{account:t,cached:!0}}if(!await e.prompt(Je,Ye))throw new u(`You must accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}) to use ${e.temporaryAccountFlag??`--temporary-account`}.`,{telemetryMessage:`user temporary terms not accepted`});let n=await it(e.temporaryAccountLogger,e.request,e.cliDisplayName);return e.storage.write(n),{account:n,cached:!1}}C(at,`getOrCreateTemporaryPreviewAccount`);function ot(e){var t=[...arguments].slice(1),n=Array.from(typeof e==`string`?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,``);var r=n.reduce(function(e,t){var n=t.match(/\n([\t ]+|(?!\s).)/g);return n?e.concat(n.map(function(e){return e.match(/[\t ]/g)?.length??0})):e},[]);if(r.length){var i=RegExp(`
9
- [ ]{`+Math.min.apply(Math,r)+`}`,`g`);n=n.map(function(e){return e.replace(i,`
10
- `)})}n[0]=n[0].replace(/^\r?\n/,``);var a=n[0];return t.forEach(function(e,t){var r=a.match(/(?:^|\n)( *)$/),i=r?r[1]:``,o=e;typeof e==`string`&&e.includes(`
11
- `)&&(o=String(e).split(`
12
- `).map(function(e,t){return t===0?e:``+i+e}).join(`
13
- `)),a+=o+n[t+1]}),a}C(ot,`dedent`);var st=ot,j=class extends u{static{C(this,`ErrorOAuth2`)}code;description;uri;toString(){return`ErrorOAuth2`}},ct=class extends j{static{C(this,`ErrorUnknown`)}toString(){return`ErrorUnknown`}},lt=class extends j{static{C(this,`ErrorAuthServerUnreachable`)}toString(){return`ErrorAuthServerUnreachable`}},ut=class extends j{static{C(this,`ErrorNoAuthCode`)}toString(){return`ErrorNoAuthCode`}},dt=class extends j{static{C(this,`ErrorInvalidReturnedStateParam`)}toString(){return`ErrorInvalidReturnedStateParam`}},ft=class extends j{static{C(this,`ErrorInvalidJson`)}toString(){return`ErrorInvalidJson`}},pt=class extends j{static{C(this,`ErrorInvalidScope`)}toString(){return`ErrorInvalidScope`}},mt=class extends j{static{C(this,`ErrorInvalidRequest`)}toString(){return`ErrorInvalidRequest`}},ht=class extends j{static{C(this,`ErrorInvalidToken`)}toString(){return`ErrorInvalidToken`}},M=class extends j{static{C(this,`ErrorAuthenticationGrant`)}toString(){return`ErrorAuthenticationGrant`}},gt=class extends M{static{C(this,`ErrorUnauthorizedClient`)}toString(){return`ErrorUnauthorizedClient`}},_t=class extends M{static{C(this,`ErrorAccessDenied`)}toString(){return`ErrorAccessDenied`}},vt=class extends M{static{C(this,`ErrorUnsupportedResponseType`)}toString(){return`ErrorUnsupportedResponseType`}},yt=class extends M{static{C(this,`ErrorServerError`)}toString(){return`ErrorServerError`}},bt=class extends M{static{C(this,`ErrorTemporarilyUnavailable`)}toString(){return`ErrorTemporarilyUnavailable`}},xt=class extends j{static{C(this,`ErrorAccessTokenResponse`)}toString(){return`ErrorAccessTokenResponse`}},St=class extends xt{static{C(this,`ErrorInvalidClient`)}toString(){return`ErrorInvalidClient`}},Ct=class extends xt{static{C(this,`ErrorInvalidGrant`)}toString(){return`ErrorInvalidGrant`}},wt=class extends xt{static{C(this,`ErrorUnsupportedGrantType`)}toString(){return`ErrorUnsupportedGrantType`}};function Tt(e,t,n){let r=`OAuth error: ${N(e)}`;return t&&(r+=`
14
- ${N(t)}`),n&&(r+=`
15
- See: ${N(n)}`),r}C(Tt,`formatOAuthErrorMessage`);function N(e){return e.replace(/[\u0000-\u001f\u007f-\u009f]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}C(N,`escapeOAuthErrorText`);function P(e,t,n){let r=Tt(e,t,n),i;switch(e){case`invalid_request`:i=new mt(r,{telemetryMessage:`user oauth invalid request`});break;case`invalid_grant`:i=new Ct(r,{telemetryMessage:`user oauth invalid grant`});break;case`unauthorized_client`:i=new gt(r,{telemetryMessage:`user oauth unauthorized client`});break;case`access_denied`:i=new _t(r,{telemetryMessage:`user oauth access denied`});break;case`unsupported_response_type`:i=new vt(r,{telemetryMessage:`user oauth unsupported response type`});break;case`invalid_scope`:i=new pt(r,{telemetryMessage:`user oauth invalid scope`});break;case`server_error`:i=new yt(r,{telemetryMessage:`user oauth server error`});break;case`temporarily_unavailable`:i=new bt(r,{telemetryMessage:`user oauth temporarily unavailable`});break;case`invalid_client`:i=new St(r,{telemetryMessage:`user oauth invalid client`});break;case`unsupported_grant_type`:i=new wt(r,{telemetryMessage:`user oauth unsupported grant type`});break;case`invalid_json`:i=new ft(r,{telemetryMessage:`user oauth invalid json`});break;case`invalid_token`:i=new ht(r,{telemetryMessage:`user oauth invalid token`});break;default:i=new ct(r,{telemetryMessage:`user oauth unknown error`})}return i.code=e,i.description=t,i.uri=n,i}C(P,`toErrorClass`);var Et=3e4;function Dt(e,t,n){let r=e.state;if(!t.stateQueryParam||r!==t.stateQueryParam)throw n.warn(`Received query string parameter doesn't match the one sent! Possible malicious activity somewhere.`),new dt(``,{telemetryMessage:`user oauth invalid returned state`});if(e.error)throw P(Array.isArray(e.error)?e.error[0]:e.error,Array.isArray(e.error_description)?e.error_description[0]:e.error_description,Array.isArray(e.error_uri)?e.error_uri[0]:e.error_uri);let i=e.code;return i?(y(!Array.isArray(i)),t.authorizationCode=i,t.hasAuthCodeBeenExchangedForAccessToken=!1,!0):!1}C(Dt,`isReturningFromAuthServer`);async function Ot(e,t,n,r,i){let{codeChallenge:a,codeVerifier:o}=await Le(),s=i.generateRandomState(Pe);return Object.assign(r,{codeChallenge:a,codeVerifier:o,stateQueryParam:s}),i.generateAuthUrl({authUrl:_e(),clientId:t,scopes:e,stateQueryParam:s,codeChallenge:a,redirectUri:n})}C(Ot,`getAuthURL`);async function kt(e,t,n,r,i){let a=T({warningLogger:e,storage:r}).refreshToken;a||e.warn(`No refresh token is present.`);let o=await F(new URLSearchParams({grant_type:`refresh_token`,refresh_token:a?.value??``,client_id:n}),e,t,i);if(o.status>=400){let t;try{t=await I(o,e)}catch(t){e.error(t)}throw t===void 0?new ct(`Failed to parse Error from exchangeRefreshTokenForAccessToken`,{telemetryMessage:`user oauth refresh token exchange parse error`}):typeof t==`string`?Error(t):t}try{let t=await I(o,e);if(`error`in t)throw t.error;let{access_token:n,expires_in:r,refresh_token:i,scope:s}=t;return{token:{value:n,expiry:new Date(Date.now()+r*1e3).toISOString()},scopes:s?s.split(` `):[],refreshToken:i?{value:i}:a}}catch(e){throw typeof e==`string`?P(e):e}}C(kt,`exchangeRefreshTokenForAccessToken`);async function At(e,t,n,r,i,a){let{authorizationCode:o,codeVerifier:s=``}=e;s?o||t.warn(`No authorization grant code is being passed.`):t.warn(`No code verifier is being sent.`);let c=await F(new URLSearchParams({grant_type:`authorization_code`,code:o??``,redirect_uri:i,client_id:r,code_verifier:s}),t,n,a);if(!c.ok){let{error:e}=await I(c,t);throw e===`invalid_grant`&&t.log(`Expired! Auth code or refresh token needs to be renewed.`),P(e)}let l=await I(c,t);if(`error`in l)throw P(l.error);let{access_token:u,expires_in:d,refresh_token:f,scope:p}=l;return e.hasAuthCodeBeenExchangedForAccessToken=!0,{token:{value:u,expiry:new Date(Date.now()+d*1e3).toISOString()},scopes:p?p.split(` `):[],refreshToken:f?{value:f}:void 0}}C(At,`exchangeAuthCodeForAccessToken`);async function F(e,t,n,r){let i={"Content-Type":`application/x-www-form-urlencoded`};if(t.debug(`fetching auth token`,`grant_type=${e.get(`grant_type`)??`<unknown>`}`),await k(E(),t)){t.debug(`Using Cloudflare Access to get an access token for the auth request`);let e=await Me({logger:t,isNonInteractiveOrCI:n,cliDisplayName:r});Object.assign(i,e)}t.debug(`Fetching auth token from`,ve());try{let n=await(0,w.fetch)(ve(),{method:`POST`,body:e.toString(),headers:i,signal:AbortSignal.timeout(Et)});return n.ok||t.debug(`Failed to fetch auth token:`,n.status,n.statusText),n}catch(e){t.debug(`Failed to fetch auth token:`,e);let n=e?.cause,r=e?.name===`TimeoutError`?` (timed out after ${Et/1e3} seconds)`:typeof n?.code==`string`?` (${n.code})`:``;throw new lt(`Could not reach the Cloudflare auth server at ${ve()}${r}.`,{cause:e,telemetryMessage:`user oauth token endpoint unreachable`})}}C(F,`fetchAuthToken`);async function I(e,t){let n=await e.text();try{return JSON.parse(n)}catch(r){throw n.match(/<!DOCTYPE html>/)&&(t.error(`The body of the response was HTML rather than JSON. Check the debug logs to see the full body of the response.`),n.match(/challenge-platform/)&&t.error(`It looks like you might have hit a bot challenge page. This may be transient but if not, please contact Cloudflare to find out what can be done. When you contact Cloudflare, please provide your Ray ID: ${e.headers.get(`cf-ray`)}`)),t.debug(`Full body of response
16
-
17
- `,n),Error(`Invalid JSON in response: status: ${e.status} ${e.statusText}`,{cause:r})}}C(I,`getJSONFromResponse`);function jt(e,t){let n=/* @__PURE__ */ C(e=>e.replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e]),`escape`),r=t.code?`<p>Code: <code>${n(t.code)}</code></p>`:``,i=t.description?`<p class="detail">${n(t.description)}</p>`:``,a=n(e);return st`
18
- <!doctype html>
19
- <html lang="en">
20
- <head>
21
- <meta charset="utf-8" />
22
- <title>${a} login failed</title>
23
- <style>
24
- body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 720px; margin: 4rem auto; padding: 0 1rem; color: #1f2933; line-height: 1.5; }
25
- h1 { color: #c12d3f; }
26
- code { background: #f5f7fa; padding: 0.15em 0.3em; border-radius: 3px; }
27
- p.detail { background: #f5f7fa; padding: 1rem; border-radius: 4px; white-space: pre-wrap; }
28
- </style>
29
- </head>
30
- <body>
31
- <h1>${a} login failed</h1>
32
- <p>The Cloudflare OAuth provider returned an error.</p>
33
- ${r}
34
- ${i}
35
- <p>You can close this tab and return to your terminal for more details.</p>
36
- </body>
37
- </html>
38
- `}C(jt,`renderOauthErrorPage`);async function Mt(e,t,n,r){let i=await Ot(e.scopes,e.clientId,e.redirectUri,t,r),a=new URL(e.redirectUri).pathname,o,s,c=new Promise((e,t)=>{s=setTimeout(()=>{o.close(),clearTimeout(s),t(new u(`Timed out waiting for authorization code, please try again.`,{telemetryMessage:`user oauth authorization timeout`}))},12e4)}),l=new Promise((r,i)=>{o=ne.createServer(async(c,l)=>{function d(e,t){clearTimeout(s),l.writableEnded||l.end(),o.close(n=>{t||n?i(t||n):(y(e),r(e))})}C(d,`finish`);function f(e){l.writeHead(400,{"Content-Type":`text/html; charset=utf-8`}),l.end(jt(n.cliDisplayName,e))}C(f,`renderErrorPage`),y(c.url,`This request doesn't have a URL`);let{pathname:p,query:m}=ee.parse(c.url,!0);if(c.method!==`GET`)return l.end(`OK`);switch(p){case a:{let r=!1;try{r=Dt(m,t,n.logger)}catch(t){if(t instanceof dt){f({description:`This callback does not match the pending login. Return to the authorization page to continue.`});return}if(t instanceof _t){l.writeHead(307,{Location:e.denied.url}),l.end(()=>{d(null,new u(e.denied.error,{telemetryMessage:`user oauth consent denied`}))});return}let n=t;f({code:n.code,description:n.description??n.message}),d(null,n);return}if(!r){let e=`The Cloudflare OAuth provider did not return an authorisation code.`;f({description:e}),d(null,new ut(e,{telemetryMessage:`user oauth missing auth code`}));return}try{let r=await At(t,n.logger,n.isNonInteractiveOrCI,e.clientId,e.redirectUri,n.cliDisplayName);l.writeHead(307,{Location:e.granted.url}),l.end(()=>{d(r)})}catch(e){let t=e,n=t instanceof j;f({code:n?t.code:void 0,description:(n?t.description:void 0)??t.message??`Failed to exchange the authorisation code for an access token.`}),d(null,t)}return}}});let c=new URL(e.redirectUri),l=Number(c.port||(c.protocol===`https:`?443:80));(c.hostname!==e.callbackHost||l!==e.callbackPort)&&(n.logger.log(`Temporary login server listening on ${e.callbackHost}:${e.callbackPort}`),n.logger.log(`Note that the OAuth login page will always redirect to \`${e.redirectUri}\`.
39
- If you have changed the callback host or port because you are running in a container, then ensure that you have port forwarding set up correctly.`)),o.once(`error`,t=>{clearTimeout(s),t.code===`EADDRINUSE`?i(new u(`The OAuth callback server could not bind to ${e.callbackHost}:${e.callbackPort} because the port is already in use. Stop the process using that port or pass a different \`--callback-port\`.`,{telemetryMessage:`user oauth callback port in use`})):i(t)}),o.listen(e.callbackPort,e.callbackHost)});return e.browser?(n.logger.log(`Opening a link in your default browser: ${i}`),await n.openInBrowser(i)):n.logger.log(`Visit this link to authenticate: ${i}`),Promise.race([c,l])}C(Mt,`getOauthToken`);var Nt=300,Pt=1;function L(e,t){if(typeof e!=`object`||!e)return;let n=e[t];return typeof n==`string`&&n!==``?n:void 0}C(L,`getStringMember`);function Ft(e,t){if(typeof e!=`object`||!e)return;let n=e[t];return typeof n==`number`&&Number.isFinite(n)&&n>0?n:void 0}C(Ft,`getPositiveNumberMember`);function It(e,t){let n=`HTTP ${e.status} ${e.statusText}`.trim(),r=L(t,`error_description`);return r?`${n}: ${r}`:n}C(It,`describeUnusableResponse`);function Lt(e){return e>=500||e===429}C(Lt,`isRetryableStatus`);function Rt(e){let t=L(e,`device_code`),n=L(e,`user_code`),r=L(e,`verification_uri`),i=Ft(e,`expires_in`);if(t&&n&&r&&i!==void 0)return{device_code:t,user_code:n,verification_uri:r,verification_uri_complete:L(e,`verification_uri_complete`),expires_in:i,interval:Ft(e,`interval`)}}C(Rt,`asDeviceAuthorizationResponse`);async function zt(e,t){let n=await e.text();try{return JSON.parse(n)}catch(r){throw n.match(/<!DOCTYPE html>/)&&(t.debug(`The body of the response was HTML rather than JSON. Check the debug logs to see the full body of the response.`),n.match(/challenge-platform/)&&t.debug(`It looks like you might have hit a bot challenge page. This may be transient but if not, please contact Cloudflare to find out what can be done. When you contact Cloudflare, please provide your Ray ID: ${e.headers.get(`cf-ray`)}`)),t.debug(`Full body of response
40
-
41
- `,n),Error(`Invalid JSON in response: status: ${e.status} ${e.statusText}`,{cause:r})}}C(zt,`readJson`);async function Bt(e,t,n){let r={"Content-Type":`application/x-www-form-urlencoded`};return await k(E(),e)&&(e.debug(`Using Cloudflare Access to get an access token for the device authorization request`),Object.assign(r,await Me({logger:e,isNonInteractiveOrCI:t,cliDisplayName:n}))),r}C(Bt,`buildDeviceAuthHeaders`);async function Vt(e,t,n,r,i){let a=new URLSearchParams({client_id:t,scope:[...e,`offline_access`].join(` `)}),o=await Bt(n,r,i),s=Ce();n.debug(`Fetching device authorization from`,s);let c=await(0,w.fetch)(s,{method:`POST`,body:a.toString(),headers:o});if(!c.ok){let e=await zt(c,n).catch(()=>void 0);throw P(e&&typeof e==`object`&&`error`in e?String(e.error):`HTTP ${c.status} ${c.statusText}`)}let l=await zt(c,n),d=Rt(l);if(d===void 0)throw n.debug(`Unusable device authorization response body:`,l),new u(`The device authorization endpoint returned a response that could not be interpreted (${It(c,l)}).
42
- Enable debug logging to see the full response.`,{telemetryMessage:`user device-flow unusable device authorization response`});return d}C(Vt,`requestDeviceAuthorization`);async function Ht(e,t,n,r,i){let a=await F(new URLSearchParams({grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:e,client_id:t}),n,r,i),o=await zt(a,n),s=L(o,`error`);if(s!==void 0)return{kind:`oauth-error`,error:s};let c=L(o,`access_token`),l=Ft(o,`expires_in`);return!a.ok||c===void 0||l===void 0?(n.debug(`Unusable token response body:`,o),{kind:`unexpected`,detail:It(a,o),retryable:!a.ok&&Lt(a.status)}):{kind:`token`,grant:{access_token:c,expires_in:l,refresh_token:L(o,`refresh_token`),scope:L(o,`scope`)}}}C(Ht,`pollDeviceToken`);function Ut(e){return new Promise(t=>setTimeout(t,e*1e3))}C(Ut,`sleep`);async function Wt(e,t){let{logger:n,openInBrowser:r,isNonInteractiveOrCI:i}=t,a=await Vt(e.scopes,e.clientId,n,i,t.cliDisplayName),o=E();Be(a.verification_uri,{field:`verification_uri`,authDomain:o}),a.verification_uri_complete!==void 0&&Be(a.verification_uri_complete,{field:`verification_uri_complete`,authDomain:o});let s=a.verification_uri_complete??Re({verificationUri:a.verification_uri,userCode:a.user_code}),c=Math.min(a.expires_in,Nt);n.log(st`
43
- To authorize ${t.cliDisplayName}, please visit:
44
-
45
- ${a.verification_uri}
46
-
47
- and enter the code:
48
-
49
- ${a.user_code}
50
-
51
- You have ${Gt(c)} to approve this request.
52
- `),e.browser&&(n.log(`
53
- Opening a link in your default browser: ${s}`),await r(s));let l=Date.now()+c*1e3,d=Math.max(a.interval??Pt,Pt),f=!0,p;for(;Date.now()<l;){f||await Ut(d),f=!1;let r;try{r=await Ht(a.device_code,e.clientId,n,i,t.cliDisplayName)}catch(e){n.debug(`Ignoring transient error while polling for token:`,e),p=e instanceof Error?e.message:String(e);continue}if(r.kind===`unexpected`){if(!r.retryable)throw new u(`The token endpoint returned a response that could not be interpreted (${r.detail}).
54
- Enable debug logging to see the full response.`,{telemetryMessage:`user device-flow unusable token response`});n.debug(`Ignoring transient response while polling for token:`,r.detail),p=r.detail;continue}if(p=void 0,r.kind===`oauth-error`)switch(r.error){case`authorization_pending`:continue;case`slow_down`:d+=5;continue;case`access_denied`:throw new u(`Consent denied. You must grant consent to ${t.cliDisplayName} in order to login.
55
- If you don't want to do this consider passing an API token via the \`CLOUDFLARE_API_TOKEN\` environment variable.`,{telemetryMessage:`user device-flow consent denied`});case`expired_token`:throw new u(`Device code expired before the request was approved. Please run \`${t.deviceLoginCommand}\` again to obtain a new code.`,{telemetryMessage:`user device-flow code expired`});default:throw P(r.error)}let{grant:o}=r;return{token:{value:o.access_token,expiry:new Date(Date.now()+o.expires_in*1e3).toISOString()},scopes:o.scope?o.scope.split(` `):[],refreshToken:o.refresh_token?{value:o.refresh_token}:void 0}}throw p===void 0?new u(`Device authorization timed out after ${Gt(c)}. Please run \`${t.deviceLoginCommand}\` again to obtain a new code.`,{telemetryMessage:`user device-flow authorization timeout`}):new u(`Gave up waiting for device authorization: the token endpoint kept returning responses that could not be interpreted (last: ${p}).
56
- Enable debug logging to see the full response, then run \`${t.deviceLoginCommand}\` to try again.`,{telemetryMessage:`user device-flow poll failed`})}C(Wt,`getOauthTokenViaDeviceFlow`);function Gt(e){if(e<60)return`${e} seconds`;let t=Math.floor(e/60),n=t===1?`minute`:`minutes`,r=e%60;return r===0?`${t} ${n}`:r==59?`${t+1} ${n}`:`${t} ${n} and ${r} ${r===1?`second`:`seconds`}`}C(Gt,`toHumanPeriod`);function Kt(e){let t={},r={generateAuthUrl:e.generateAuthUrl??Ve,generateRandomState:e.generateRandomState??He},i=`default`;function a(t){return e.storageFactory(t??i)}C(a,`getStorage`);let o=/* @__PURE__ */ C(()=>typeof e.clientId==`function`?e.clientId():e.clientId,`getClientId`),s=e.consent,c,l,d=new URL(e.redirectUri),f=d.hostname,p=Number(d.port);async function m(i){if(e.hasEnvCredentials())return e.logger.error(`You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.`),!1;let c=n(i.complianceConfig);if(c===`fedramp_high`){let e=i.complianceConfig?.compliance_region?"`compliance_region` configuration property":"`CLOUDFLARE_API_ENVIRONMENT` environment variable";throw new u(st`
57
- OAuth login is not supported in the \`${c}\` compliance region.
58
- Please use a Cloudflare API token (\`CLOUDFLARE_API_TOKEN\` environment variable) or remove the ${e}.
59
- `,{telemetryMessage:`user login unsupported compliance region`})}let l;return i.device?(e.logger.log(`Attempting to login via OAuth Device Authorization Grant...`),l=await Wt({browser:i.browser??!0,scopes:i.scopes,clientId:o()},e)):(e.logger.log(`Attempting to login via OAuth...`),l=await Mt({browser:i.browser??!0,scopes:i.scopes,clientId:o(),redirectUri:e.redirectUri,denied:s.denied,granted:s.granted,callbackHost:i.callbackHost??f,callbackPort:i.callbackPort??p},t,e,r)),a(i.profile).write({oauth_token:l.token?.value??``,expiration_time:l.token?.expiry,refresh_token:l.refreshToken?.value,scopes:l.scopes}),e.logger.log(`Successfully logged in.`),b(),e.purgeOnLoginOrLogout?.(),!0}C(m,`login`);function h(t){if(e.hasEnvCredentials())return!1;let{accessToken:n}=T({warningLogger:e.logger,storage:a(t)});return!!(n&&/* @__PURE__ */ new Date>=new Date(n.expiry))}C(h,`isRefreshNeeded`);async function g(t){let n=a(t);try{let{token:{value:t,expiry:r}={value:``,expiry:``},refreshToken:{value:i}={},scopes:a}=await kt(e.logger,e.isNonInteractiveOrCI,o(),n,e.cliDisplayName);return n.write({oauth_token:t,expiration_time:r,refresh_token:i,scopes:a}),`refreshed`}catch(t){return e.logger.debug(`Token refresh failed: ${t instanceof Error?t.message:String(t)}`),t instanceof lt||t instanceof Error&&t.name===`TimeoutError`?`unreachable`:`rejected`}}C(g,`refreshToken`);async function _(t){if(e.hasEnvCredentials())return{loggedIn:!0};let n=T({warningLogger:e.logger,storage:a(t.profile)});if(!n.accessToken&&!n.deprecatedApiToken)return e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`no-credentials-non-interactive`}:await m(t)?{loggedIn:!0}:{loggedIn:!1,reason:`no-credentials-login-failed`};if(h(t.profile)){let n=await g(t.profile);return n===`refreshed`?{loggedIn:!0}:n===`unreachable`?{loggedIn:!1,reason:`token-refresh-unreachable`}:e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`token-expired-non-interactive`}:await m(t)?{loggedIn:!0}:{loggedIn:!1,reason:`token-expired-login-failed`}}return{loggedIn:!0}}C(_,`loginOrRefreshIfRequired`);async function v(t){let n=b();if(e.hasEnvCredentials()){e.logger.log(`You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log out.`);return}let r=T({warningLogger:e.logger,storage:a(t)}).refreshToken;if(!r){e.logger.log(n?`Cleared temporary preview account.`:`Not logged in, exiting...`);return}let i=`client_id=${encodeURIComponent(o())}&token_type_hint=refresh_token&token=${encodeURIComponent(r.value||``)}`;await(await(0,w.fetch)(ye(),{method:`POST`,body:i,headers:{"Content-Type":`application/x-www-form-urlencoded`}})).text(),a(t).clear(),e.logger.log(`Successfully logged out.`),e.purgeOnLoginOrLogout?.()}C(v,`logout`);async function ee(){let t=T({warningLogger:e.logger,storage:a()});if(t.accessToken){if(t.accessToken&&/* @__PURE__ */ new Date>=new Date(t.accessToken.expiry)){if(await g()!==`refreshed`)return;t=T({warningLogger:e.logger,storage:a()})}return t.accessToken?.value}}C(ee,`getOAuthTokenFromLocalState`);function y(){return l?{apiToken:l.account.apiToken}:pe({storage:a(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}C(y,`getAPITokenInternal`);function te(){return l?{apiToken:l.account.apiToken}:me({storage:a(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}C(te,`requireApiTokenInternal`);function ne(t,n){c=t&&e.temporary!==void 0?n??{}:void 0,l=void 0}C(ne,`setTemporaryAllowed`);function re(){return c!==void 0}C(re,`isTemporaryAllowed`);function ie(){return l}C(ie,`getActiveTemporaryAccount`);async function ae(){if(!e.temporary)throw new u(`Temporary preview accounts are not supported by ${e.cliDisplayName}.`,{telemetryMessage:`user temporary account unsupported`});let t=await at({...e.temporary,...c?{request:c}:{}});return l=t.account,t}C(ae,`activateTemporaryAccount`);function b(){return l=void 0,e.temporary?.storage.clear()??!1}C(b,`clearTemporaryAccount`);function x(e){i=e}C(x,`setProfile`);function oe(){return i}C(oe,`getActiveProfile`);function S(){return T({warningLogger:e.logger,storage:a()}).scopes}return C(S,`getScopes`),{setProfile:x,getActiveProfile:oe,login:m,logout:v,loginOrRefreshIfRequired:_,getOAuthTokenFromLocalState:ee,getAPIToken:y,requireApiToken:te,getScopes:S,setTemporaryAllowed:ne,isTemporaryAllowed:re,getActiveTemporaryAccount:ie,activateTemporaryAccount:ae}}C(Kt,`createOAuthFlow`);var qt=[`default`,`staging`];function Jt(e){let t={read(){return e.bindings.read()},write(t){e.bindings.write(t)},activate(t,n){let r=v.resolve(n),i=e.bindings.read();i[r]=t,e.bindings.write(i)},deactivate(t){let n=v.resolve(t),r=e.bindings.read(),i=r[n];if(i===void 0){let e=z(n,r);throw e?new u(`No profile is directly bound to "${R(n)}". The active profile "${e.profile}" is bound at "${R(e.dir)}". Run the deactivate command from that directory instead.`,{telemetryMessage:`auth deactivate wrong directory`}):new u(`No profile is bound to "${R(n)}". Nothing to deactivate.`,{telemetryMessage:`auth deactivate no binding`})}delete r[n],e.bindings.write(r);let a=z(n,r);return a?{removedProfile:i,newResolution:{profile:a.profile,source:`inherited from ${a.dir}`}}:e.configs.exists(`default`)?{removedProfile:i,newResolution:{profile:`default`,source:`default profile`}}:{removedProfile:i,newResolution:{profile:void 0,source:`no profile`}}},getProfileForDirectory(t){return z(t,e.bindings.read())?.profile},getBindingsForProfile(t){return Object.entries(e.bindings.read()).filter(([,e])=>e===t).map(([e])=>e)},removeAllBindingsForProfile(t){let n=e.bindings.read(),r=[];for(let[e,i]of Object.entries(n))i===t&&(r.push(e),delete n[e]);return r.length>0&&e.bindings.write(n),r}};return{configs:e.configs,bindings:t,resolve(e){return e.profile?e.profile==="default"?`default`:(Yt(e.profile),e.profile):t.getProfileForDirectory(e.cwd)||`default`}}}C(Jt,`createProfileStore`);function Yt(e){if(qt.includes(e.toLowerCase()))throw new u(`"${e}" is a reserved profile name. Use the login and logout commands to manage the default profile, which applies as a global fallback.`,{telemetryMessage:`auth profile reserved name`});if(!/^[a-zA-Z0-9_-]+$/.test(e))throw new u(`Invalid profile name "${e}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`,{telemetryMessage:`auth profile invalid name`})}C(Yt,`validateProfileName`);function R(e){return v.relative(process.cwd(),e)||`.`}C(R,`formatDirectoryForUserError`);function z(e,t){let n=v.resolve(e),r=Object.entries(t).sort(([e],[t])=>t.length-e.length);for(let[e,t]of r)if(n===e||n.startsWith(e)&&n[e.length]===v.sep)return{profile:t,dir:e}}C(z,`getProfileForDirectoryFromBindings`);var Xt=/^[a-z0-9-_]+$/i,Zt=!!``.isWellFormed;function B(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(typeof e.getUTCDate==`function`&&e instanceof Date)return`date`;if(globalThis.Temporal){if(e.until){if(e instanceof Temporal.ZonedDateTime)return`temporal/tz+uc`;if(e instanceof Temporal.PlainDateTime||e instanceof Temporal.PlainDate)return`temporal/uc`;if(e instanceof Temporal.PlainTime||e instanceof Temporal.Instant)return`temporal`;if(e instanceof Temporal.PlainYearMonth)return`temporal/x`}else if(e.toPlainDate&&e instanceof Temporal.PlainMonthDay||e.negated&&e instanceof Temporal.Duration)return`temporal/x`}}return t}C(B,`extendedTypeOf`);function Qt(e){for(let t=0;t<e.length;t++)if(B(e[t])!==`object`)return!1;return e.length!=0}C(Qt,`isArrayOfTables`);function $t(e){return JSON.stringify(e).replaceAll(``,`\\u007f`)}C($t,`formatWellFormedStringUnchecked`);function en(e){return $t(Zt?e.toWellFormed():e)}C(en,`formatString`);function tn(e){if(Xt.test(e))return e;if(Zt&&!e.isWellFormed())throw RangeError(`key contains illegal lone surrogates`);return $t(e)}C(tn,`formatKey`);function V(e,t,n,r,i){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);switch(t){case`number`:if(isNaN(e))return`nan`;if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Number.isInteger(e)&&(r||!Number.isSafeInteger(e)))return e.toFixed(1);case`bigint`:case`boolean`:case`temporal`:return e.toString();case`string`:return en(e);case`date`:if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString();case`object`:return nn(e,n,r,i);case`array`:return rn(e,n,r,i);case`temporal/tz+uc`:if(i){let t=e.timeZoneId,n=t.charCodeAt(0);if(n!==43&&n!==45&&(n!==85&&n!==71&&n!==90&&n!==69||t!==`UTC`&&t!==`UCT`&&t!==`Universal`&&t!==`Zulu`&&!t.startsWith(`GMT`)&&t!==`Greenwich`&&!t.startsWith(`Etc/`)))throw TypeError(`Temporal objects with an IANA timezone are not allowed in Temporal strict mode`)}case`temporal/uc`:if(i&&e.calendarId!==`iso8601`)throw TypeError(`Temporal objects with a non-default calendar are not allowed in Temporal strict mode`);return e.toString({calendarName:`never`,timeZoneName:`never`});case`temporal/x`:throw TypeError(`Unsupported `+e[Symbol.toStringTag])}}C(V,`stringifyValue`);function nn(e,t,n,r){let i=Object.keys(e);if(i.length===0)return`{}`;let a=`{ `;for(let o=0;o<i.length;o++){let s=i[o];o&&(a+=`, `),a+=tn(s)+` = `+V(e[s],B(e[s]),t-1,n,r)}return a+` }`}C(nn,`stringifyInlineTable`);function rn(e,t,n,r){if(e.length===0)return`[]`;let i=`[ `;for(let a=0;a<e.length;a++){if(a&&(i+=`, `),e[a]===null||e[a]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);i+=V(e[a],B(e[a]),t-1,n,r)}return i+` ]`}C(rn,`stringifyArray`);function an(e,t,n,r,i){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``;for(let o=0;o<e.length;o++)a+=`${a&&`
60
- `}[[${t}]]
61
- `,a+=H(0,e[o],t,n,r,i);return a}C(an,`stringifyArrayTable`);function H(e,t,n,r,i,a){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let o=``,s=``,c=Object.keys(t);for(let e=0;e<c.length;e++){let l=c[e];if(t[l]!==null&&t[l]!==void 0){let e=B(t[l]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let c=tn(l);if(e===`array`&&Qt(t[l]))s+=(s&&`
62
- `)+an(t[l],n?`${n}.${c}`:c,r-1,i,a);else if(e===`object`){let e=n?`${n}.${c}`:c;s+=(s&&`
63
- `)+H(e,t[l],e,r-1,i,a)}else o+=c,o+=` = `,o+=V(t[l],e,r,i,a),o+=`
64
- `}}return e&&(o||!s)&&(o=o?`[${e}]
65
- ${o}`:`[${e}]`),o&&s?`${o}
66
- ${s}`:o||s}C(H,`stringifyTable`);function on(e,{maxDepth:t=1e3,numbersAsFloat:n=!1,strictTemporal:r=!1}={}){if(B(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let i=H(0,e,``,t,n,r);return i[i.length-1]===`
67
- `?i:i+`
68
- `}C(on,`stringify`);var sn={toml:{parse:/* @__PURE__ */ C(e=>c(e),`parse`),stringify:/* @__PURE__ */ C(e=>on(e),`stringify`)},json:{parse:/* @__PURE__ */ C(e=>JSON.parse(e),`parse`),stringify:/* @__PURE__ */ C(e=>JSON.stringify(e,null,` `),`stringify`)}};function U(e,t){return sn[e].parse(t)}C(U,`parseFile`);function W(e,t){return sn[e].stringify(t)}C(W,`stringifyFile`);var cn=`config`;function G(e){if(e===void 0||e==="default"){let e=s();return e===`production`?`default`:e}return Yt(e),e}C(G,`resolveAuthProfileBaseName`);function K(e,t,n=`toml`){return v.join(e,cn,`${G(t)}.${n}`)}C(K,`getAuthConfigFilePath`);var q=class{constructor(e,t,n=`toml`){this.configPath=e,this.profile=t,this.format=n}static{C(this,`FileCredentialStore`)}kind=`file`;filePath(){return K(this.configPath,this.profile,this.format)}read(){let e=this.filePath();if(m(e))return U(this.format,d(e))}write(e){let t=this.filePath();h(v.dirname(t),{recursive:!0}),_(t,W(this.format,e),{encoding:`utf-8`,mode:384}),p(t,384)}clear(){let e=this.filePath(),t=m(e);return t&&g(e),t}path(){return this.filePath()}describe(){return this.filePath()}},J=32,ln=12,un=16,dn=`AES-256-GCM`,fn=`aes-256-gcm`;function pn(){return new Uint8Array(b(J))}C(pn,`generateKey`);function mn(e,t){if(t.length!==J)throw Error(`AES-256-GCM requires a ${J}-byte key (got ${t.length} bytes).`);let n=b(ln),r=re(fn,t,n),i=Buffer.concat([r.update(e,`utf-8`),r.final()]),a=r.getAuthTag();return{v:1,alg:dn,iv:n.toString(`base64`),tag:a.toString(`base64`),ciphertext:i.toString(`base64`)}}C(mn,`encryptString`);function hn(e,t){if(t.length!==J)throw Error(`AES-256-GCM requires a ${J}-byte key (got ${t.length} bytes).`);if(e.v!==1)throw Error(`Unsupported encrypted envelope version: ${e.v}.`);let n=Buffer.from(e.iv,`base64`),r=Buffer.from(e.tag,`base64`),i=Buffer.from(e.ciphertext,`base64`);if(n.length!==ln)throw Error(`Expected ${ln}-byte IV in envelope (got ${n.length} bytes).`);if(r.length!==un)throw Error(`Expected ${un}-byte auth tag in envelope (got ${r.length} bytes).`);let a=ie(fn,t,n);return a.setAuthTag(r),Buffer.concat([a.update(i),a.final()]).toString(`utf-8`)}C(hn,`decryptString`);function gn(e){if(typeof e!=`object`||!e)return;let t=e;if(t.v===1&&t.alg===dn&&typeof t.iv==`string`&&typeof t.tag==`string`&&typeof t.ciphertext==`string`)return t}C(gn,`parseEncryptedEnvelope`);function Y(e,t){return v.join(e,`config`,`${G(t)}.enc`)}C(Y,`getEncryptedAuthConfigFilePath`);var _n=class{constructor(e,t,n,r,i=`toml`){this.configPath=e,this.keyProvider=t,this.onPlaintextMigration=n,this.profile=r,this.format=i}static{C(this,`EncryptedFileCredentialStore`)}kind=`encrypted-file`;plaintextPath(){return K(this.configPath,this.profile,this.format)}read(){let e=Y(this.configPath,this.profile);if(m(e))return this.readEncryptedFile(e);let t=this.plaintextPath();if(m(t))return this.migrateFromPlaintext(t,e)}write(e){let t=this.ensureKey(),n=mn(W(this.format,e),t),r=Y(this.configPath,this.profile);h(v.dirname(r),{recursive:!0}),_(r,JSON.stringify(n,null,` `),{encoding:`utf-8`,mode:384}),p(r,384);let i=this.plaintextPath();m(i)&&g(i)}clear(){let e=Y(this.configPath,this.profile),t=this.plaintextPath(),n=!1;m(e)&&(g(e),n=!0),m(t)&&(g(t),n=!0);try{this.keyProvider.deleteKey()}catch{}return n}path(){return Y(this.configPath,this.profile)}describe(){return`Encrypted file (${Y(this.configPath,this.profile)}) with key in ${this.keyProvider.describe()}`}readEncryptedFile(e){let t=this.keyProvider.getKey();if(t===void 0)return;let n=d(e),r;try{r=gn(JSON.parse(n))}catch{return}if(r===void 0)return;let i;try{i=hn(r,t)}catch{return}try{return U(this.format,i)}catch{return}}migrateFromPlaintext(e,t){let n=d(e),r;try{r=U(this.format,n)}catch{return}return this.write(r),this.onPlaintextMigration?.({plaintextPath:e,encryptedPath:t,keyProviderDescription:this.keyProvider.describe()}),r}ensureKey(){let e=this.keyProvider.getKey();if(e!==void 0)return e;let t=pn();return this.keyProvider.setKey(t),t}},X=`1.3.0`;function vn(e){let t={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`]};if(process.platform===`win32`){let n={...process.env},r=[`npm`,...e.map((e,t)=>{let r=`WORKERS_AUTH_NPM_ARG_${t}`;return n[r]=e,`"%${r}%"`})].join(` `);return S(r,{...t,env:n,shell:!0})}return S(`npm`,e,t)}C(vn,`defaultNpmRunner`);var yn=vn,Z=/* @__PURE__ */ new Map;function bn(e){yn=e??vn,Z.clear()}C(bn,`setNpmRunner`);function xn(e){return v.join(e,`native`,`keyring`)}C(xn,`getKeyringInstallDir`);function Sn(e){return v.join(e,`node_modules`,`@napi-rs`,`keyring`)}C(Sn,`getInstalledBindingPath`);function Cn(e){try{return f(e)(e),!0}catch{return!1}}C(Cn,`canLoadKeyringBinding`);function wn(e){let t=Z.get(e);if(t!==void 0)return t;let n=Sn(e);if(m(v.join(n,`index.js`))&&Cn(n))return Z.set(e,n),n;try{let t=yn([`root`,`-g`]);if(t.status===0){let n=v.join(t.stdout.trim(),`@napi-rs`,`keyring`);if(m(v.join(n,`index.js`))&&Cn(n))return Z.set(e,n),n}}catch{}return Z.set(e,null),null}C(wn,`findKeyringBinding`);function Tn(e){let t=e;h(t,{recursive:!0});let n=v.join(t,`package.json`);m(n)||_(n,JSON.stringify({private:!0,name:`cloudflare-auth-keyring-host`},null,` `),`utf-8`);let r;try{r=yn([`install`,`@napi-rs/keyring@${X}`,`--prefix`,t,`--no-save`,`--no-audit`,`--no-fund`,`--no-package-lock`,`--loglevel=error`])}catch(e){throw new u(`Failed to spawn \`npm\` to install the keyring backend: ${e instanceof Error?e.message:String(e)}
69
-
70
- Install \`npm\` and retry, or install the binding globally:
71
- npm install -g @napi-rs/keyring@${X}`,{telemetryMessage:`workers-auth keyring npm spawn failed`})}if(r.status!==0)throw new u(`Failed to install \`@napi-rs/keyring\` (npm exited ${r.status}):
72
- ${r.stderr?.trim()??`(no stderr)`}
73
-
74
- Retry once the underlying issue is fixed, or install the binding globally:
75
- npm install -g @napi-rs/keyring@${X}`,{telemetryMessage:`workers-auth keyring npm install failed`});if(Z.delete(e),wn(e)===null)throw new u(`\`npm\` reported success but the \`@napi-rs/keyring\` native binding still cannot be loaded.
76
-
77
- Its platform-specific binary ships as a separate optional package, so a download that was skipped or interrupted leaves the binding unusable.
78
-
79
- Retry once the underlying issue is fixed, or install the binding globally:
80
- npm install -g @napi-rs/keyring@${X}`,{telemetryMessage:`workers-auth keyring install incomplete`})}C(Tn,`installKeyringBindingSync`);var En;function Dn(e){En=e}C(Dn,`setKeyringEntryFactory`);function On(e){if(En!==void 0)return En;let t=wn(e);if(t===null)throw new u(`The \`@napi-rs/keyring\` native binding is not available.
81
-
82
- Retry the command, or install the binding globally:
83
- npm install -g @napi-rs/keyring@${X}`,{telemetryMessage:`workers-auth keyring binding not loadable`});let n=f(t)(t);return(e,t)=>new n.Entry(e,t)}C(On,`resolveKeyringEntryFactory`);function Q(e){return G(e)}C(Q,`getKeyringAccountName`);function kn(e){let t={v:1,key:Buffer.from(e).toString(`base64`),created:(/* @__PURE__ */ new Date()).toISOString()};return JSON.stringify(t)}C(kn,`encodeKeyEnvelope`);function An(e){if(e===``)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t==`object`&&t&&t.v===1&&typeof t.key==`string`)try{let e=Buffer.from(t.key,`base64`);return e.length===32?new Uint8Array(e):void 0}catch{return}}C(An,`decodeKeyEnvelope`);function jn(e,t={}){return S(`secret-tool`,e,{encoding:`utf-8`,input:t.input})}C(jn,`defaultRunner`);var $=jn,Mn=void 0;function Nn(e){$=e??jn,Mn=void 0}C(Nn,`setLinuxSecretToolRunner`);function Pn(){if(Mn!==void 0)return Mn;let e;try{e=$([`--version`]).error===void 0}catch{e=!1}return Mn=e,e}C(Pn,`probeSecretTool`);var Fn=class{constructor(e,t){this.serviceName=e,this.profile=t}static{C(this,`LinuxSecretToolKeyProvider`)}getKey(){let e=$([`lookup`,`service`,this.serviceName,`account`,Q(this.profile)]);if(e.status!==1){if(e.status!==0)throw Error(`Failed to read key via secret-tool (exit ${e.status}): ${e.stderr?.trim()??`(no stderr)`}`);return An(e.stdout.trim())}}setKey(e){let t=$([`store`,`--label=Cloudflare credentials key`,`service`,this.serviceName,`account`,Q(this.profile)],{input:kn(e)});if(t.status!==0)throw Error(`Failed to write key via secret-tool (exit ${t.status}): ${t.stderr?.trim()??`(no stderr)`}`)}deleteKey(){let e=$([`clear`,`service`,this.serviceName,`account`,Q(this.profile)]);if(e.status!==0)throw Error(`Failed to delete key via secret-tool (exit ${e.status}): ${e.stderr?.trim()??`(no stderr)`}`)}describe(){return`Linux secret-tool (service=${this.serviceName}, account=${Q(this.profile)})`}},In=44;function Ln(e,t={}){return S(`/usr/bin/security`,e,{encoding:`utf-8`,input:t.input})}C(Ln,`defaultRunner`);var Rn=Ln;function zn(e){Rn=e??Ln}C(zn,`setMacSecurityCommandRunner`);var Bn=class{constructor(e,t){this.serviceName=e,this.profile=t}static{C(this,`MacSecurityKeyProvider`)}getKey(){let e=Rn([`find-generic-password`,`-s`,this.serviceName,`-a`,Q(this.profile),`-w`]);if(e.status!==In){if(e.status!==0)throw Error(`Failed to read key from macOS Keychain (exit ${e.status}): ${e.stderr?.trim()??`(no stderr)`}`);return An(e.stdout.trim())}}setKey(e){let t=Rn([`add-generic-password`,`-s`,this.serviceName,`-a`,Q(this.profile),`-w`,kn(e),`-U`]);if(t.status!==0)throw Error(`Failed to write key to macOS Keychain (exit ${t.status}): ${t.stderr?.trim()??`(no stderr)`}`)}deleteKey(){let e=Rn([`delete-generic-password`,`-s`,this.serviceName,`-a`,Q(this.profile)]);if(e.status!==0&&e.status!==In)throw Error(`Failed to delete key from macOS Keychain (exit ${e.status}): ${e.stderr?.trim()??`(no stderr)`}`)}describe(){return`macOS Keychain (service=${this.serviceName}, account=${Q(this.profile)})`}},Vn=class{constructor(e,t,n){this.serviceName=e,this.installDir=t,this.profile=n}static{C(this,`NapiKeyringKeyProvider`)}entry(){return On(this.installDir)(this.serviceName,Q(this.profile))}getKey(){let e=this.entry().getPassword();if(e!==null&&e!==``)return An(e)}setKey(e){this.entry().setPassword(kn(e))}deleteKey(){try{this.entry().deletePassword()}catch{}}describe(){return`${process.platform===`win32`?`Windows Credential Manager`:`OS keyring`} via @napi-rs/keyring (service=${this.serviceName}, account=${Q(this.profile)})`}},Hn;function Un(e){Hn=e}C(Un,`setKeyProviderFactoryForTesting`);function Wn(e,t,n){if(Hn!==void 0)return{kind:`available`,provider:Hn(e,t)};switch(process.platform){case`darwin`:return{kind:`available`,provider:new Bn(e,t)};case`linux`:return Pn()?{kind:`available`,provider:new Fn(e,t)}:{kind:`unsupported`};case`win32`:{let r=xn(n);return wn(r)===null?{kind:`needs-install`,install:/* @__PURE__ */ C(()=>Tn(r),`install`),afterInstall:/* @__PURE__ */ C(()=>new Vn(e,r,t),`afterInstall`)}:{kind:`available`,provider:new Vn(e,r,t)}}default:return{kind:`unsupported`}}}C(Wn,`resolveKeyProvider`);var Gn={installFailedThisSession:!1,hasWarnedAboutKeyringFallback:!1,hasWarnedAboutSecretToolMissing:!1};function Kn(){return Gn}C(Kn,`getResolverSessionFlags`);function qn(){Gn.installFailedThisSession=!1,Gn.hasWarnedAboutKeyringFallback=!1,Gn.hasWarnedAboutSecretToolMissing=!1}C(qn,`resetCredentialStorageState`);function Jn(e){let t={...e,loginCommand:e.loginCommand??`your CLI login`,format:e.format??`toml`};function n(e){return Yn(t,e)}C(n,`getActiveStore`);function r(e){return{read:/* @__PURE__ */ C(()=>n(e).read(),`read`),write:/* @__PURE__ */ C(t=>n(e).write(t),`write`),clear:/* @__PURE__ */ C(()=>n(e).clear(),`clear`),path:/* @__PURE__ */ C(()=>n(e).path(),`path`)}}return C(r,`storageFactory`),{storageFactory:r,getActiveStore:n}}C(Jn,`createCredentialStorageContext`);function Yn(e,t){let n=De(),r=e.getConfigPath();if(n===!1)return new q(r,t,e.format);let i=n===!0;if(!(n??e.isKeyringEnabled()??!1))return new q(r,t,e.format);let a=Wn(e.serviceName,t,r);switch(a.kind){case`available`:return new _n(r,a.provider,Xn(e),t,e.format);case`needs-install`:return Zn(a,i,e,t);case`unsupported`:return Qn(i,e,t)}}C(Yn,`resolveActiveCredentialStore`);function Xn(e){return t=>{e.logger.warn(`Migrated credentials from ${t.plaintextPath} into ${t.encryptedPath} (key in ${t.keyProviderDescription}). The plaintext file has been deleted.`)}}C(Xn,`buildMigrationLogger`);function Zn(e,t,n,r){let i=Kn();if(i.installFailedThisSession){if(t)throw new u(`CLOUDFLARE_AUTH_USE_KEYRING is set but the keyring backend could not be installed earlier this session.`,{telemetryMessage:`workers-auth keyring install previously failed`});return $n(`The keyring backend could not be installed earlier this session; using the plaintext credentials file.`,n,r)}if(n.isNonInteractiveOrCI())throw new u(tr(n.loginCommand),{telemetryMessage:`workers-auth keyring binding not installed`});try{n.logger.log(`🔐 Installing keyring backend (one-time, ~2 MB)…`),e.install()}catch(e){if(i.installFailedThisSession=!0,t)throw e instanceof u?e:new u(`Failed to install the keyring backend: ${e instanceof Error?e.message:String(e)}`,{telemetryMessage:`workers-auth keyring install threw`});return $n(`Failed to install the keyring backend (${e instanceof Error?e.message:String(e)}); falling back to the plaintext credentials file.`,n,r)}return new _n(n.getConfigPath(),e.afterInstall(),Xn(n),r,n.format)}C(Zn,`handleNeedsInstall`);function Qn(e,t,n){let r=process.platform,i=r===`linux`,a=i?er(t.loginCommand):`OS keyring storage is not supported on \`${r}\`; falling back to the plaintext credentials file.`;if(e)throw new u(i?`CLOUDFLARE_AUTH_USE_KEYRING is set but ${a}`:`CLOUDFLARE_AUTH_USE_KEYRING is set but no keyring backend is available on \`${r}\`.`,{telemetryMessage:i?`workers-auth keyring secret tool missing`:`workers-auth keyring unsupported platform`});if(i&&t.isNonInteractiveOrCI())throw new u(a,{telemetryMessage:`workers-auth keyring secret tool missing`});let o=Kn();return i?(o.hasWarnedAboutSecretToolMissing||(o.hasWarnedAboutSecretToolMissing=!0,t.logger.warn(`${a}
84
-
85
- Falling back to the plaintext credentials file for this session.`)),new q(t.getConfigPath(),n,t.format)):$n(a,t,n)}C(Qn,`handleUnsupported`);function $n(e,t,n){let r=Kn();return r.hasWarnedAboutKeyringFallback||(r.hasWarnedAboutKeyringFallback=!0,t.logger.warn(e)),new q(t.getConfigPath(),n,t.format)}C($n,`fallbackToFileWithWarning`);function er(e){return`\`secret-tool\` is required for OS keyring storage on Linux but is not installed.
86
-
87
- Install it via your package manager:
88
- Debian/Ubuntu: sudo apt-get install libsecret-tools
89
- Fedora/RHEL: sudo dnf install libsecret
90
- Arch: sudo pacman -S libsecret
91
- Alpine: apk add libsecret
92
-
93
- Or disable keyring storage: \`${e} --no-use-keyring\`.`}C(er,`secretToolMissingMessage`);function tr(e){return`\`@napi-rs/keyring\` is required for OS keyring storage on Windows but is not installed.
94
-
95
- Run \`${e} --use-keyring\` interactively to install it automatically, or install it globally for CI:
96
-
97
- npm install -g @napi-rs/keyring@${X}
98
-
99
- Or disable keyring storage: \`${e} --no-use-keyring\`.`}C(tr,`windowsBindingMissingMessage`);function nr(e){let t=Y(e.configPath,e.profile),n=m(t),r=Wn(e.serviceName,e.profile,e.configPath);return r.kind===`available`?(new _n(e.configPath,r.provider,void 0,e.profile,e.format??`toml`).clear(),{backendAvailable:!0,encryptedFileExisted:n}):(n&&g(t),{backendAvailable:!1,encryptedFileExisted:n})}C(nr,`scrubEncryptedCredentials`);var rr=class extends u{constructor(e,t,n){super(e,{telemetryMessage:n}),this.reason=t}static{C(this,`AuthenticationError`)}};
100
- /*! Bundled license information:
101
-
102
- smol-toml/dist/error.js:
103
- (*!
104
- * Copyright (c) Squirrel Chat et al., All rights reserved.
105
- * SPDX-License-Identifier: BSD-3-Clause
106
- *
107
- * Redistribution and use in source and binary forms, with or without
108
- * modification, are permitted provided that the following conditions are met:
109
- *
110
- * 1. Redistributions of source code must retain the above copyright notice, this
111
- * list of conditions and the following disclaimer.
112
- * 2. Redistributions in binary form must reproduce the above copyright notice,
113
- * this list of conditions and the following disclaimer in the
114
- * documentation and/or other materials provided with the distribution.
115
- * 3. Neither the name of the copyright holder nor the names of its contributors
116
- * may be used to endorse or promote products derived from this software without
117
- * specific prior written permission.
118
- *
119
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
120
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
121
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
122
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
123
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
124
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
125
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
126
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
127
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
128
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129
- *)
130
-
131
- smol-toml/dist/primitive.js:
132
- (*!
133
- * Copyright (c) Squirrel Chat et al., All rights reserved.
134
- * SPDX-License-Identifier: BSD-3-Clause
135
- *
136
- * Redistribution and use in source and binary forms, with or without
137
- * modification, are permitted provided that the following conditions are met:
138
- *
139
- * 1. Redistributions of source code must retain the above copyright notice, this
140
- * list of conditions and the following disclaimer.
141
- * 2. Redistributions in binary form must reproduce the above copyright notice,
142
- * this list of conditions and the following disclaimer in the
143
- * documentation and/or other materials provided with the distribution.
144
- * 3. Neither the name of the copyright holder nor the names of its contributors
145
- * may be used to endorse or promote products derived from this software without
146
- * specific prior written permission.
147
- *
148
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
149
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
150
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
151
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
152
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
153
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
154
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
155
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
156
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
157
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
158
- *)
159
-
160
- smol-toml/dist/date.js:
161
- (*!
162
- * Copyright (c) Squirrel Chat et al., All rights reserved.
163
- * SPDX-License-Identifier: BSD-3-Clause
164
- *
165
- * Redistribution and use in source and binary forms, with or without
166
- * modification, are permitted provided that the following conditions are met:
167
- *
168
- * 1. Redistributions of source code must retain the above copyright notice, this
169
- * list of conditions and the following disclaimer.
170
- * 2. Redistributions in binary form must reproduce the above copyright notice,
171
- * this list of conditions and the following disclaimer in the
172
- * documentation and/or other materials provided with the distribution.
173
- * 3. Neither the name of the copyright holder nor the names of its contributors
174
- * may be used to endorse or promote products derived from this software without
175
- * specific prior written permission.
176
- *
177
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
178
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
179
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
180
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
181
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
182
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
183
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
184
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
185
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
186
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
187
- *)
188
-
189
- smol-toml/dist/extract.js:
190
- (*!
191
- * Copyright (c) Squirrel Chat et al., All rights reserved.
192
- * SPDX-License-Identifier: BSD-3-Clause
193
- *
194
- * Redistribution and use in source and binary forms, with or without
195
- * modification, are permitted provided that the following conditions are met:
196
- *
197
- * 1. Redistributions of source code must retain the above copyright notice, this
198
- * list of conditions and the following disclaimer.
199
- * 2. Redistributions in binary form must reproduce the above copyright notice,
200
- * this list of conditions and the following disclaimer in the
201
- * documentation and/or other materials provided with the distribution.
202
- * 3. Neither the name of the copyright holder nor the names of its contributors
203
- * may be used to endorse or promote products derived from this software without
204
- * specific prior written permission.
205
- *
206
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
207
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
208
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
209
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
210
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
211
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
212
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
213
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
214
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
215
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
216
- *)
217
-
218
- smol-toml/dist/util.js:
219
- (*!
220
- * Copyright (c) Squirrel Chat et al., All rights reserved.
221
- * SPDX-License-Identifier: BSD-3-Clause
222
- *
223
- * Redistribution and use in source and binary forms, with or without
224
- * modification, are permitted provided that the following conditions are met:
225
- *
226
- * 1. Redistributions of source code must retain the above copyright notice, this
227
- * list of conditions and the following disclaimer.
228
- * 2. Redistributions in binary form must reproduce the above copyright notice,
229
- * this list of conditions and the following disclaimer in the
230
- * documentation and/or other materials provided with the distribution.
231
- * 3. Neither the name of the copyright holder nor the names of its contributors
232
- * may be used to endorse or promote products derived from this software without
233
- * specific prior written permission.
234
- *
235
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
236
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
237
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
238
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
239
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
240
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
241
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
242
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
243
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
244
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
245
- *)
246
-
247
- smol-toml/dist/struct.js:
248
- (*!
249
- * Copyright (c) Squirrel Chat et al., All rights reserved.
250
- * SPDX-License-Identifier: BSD-3-Clause
251
- *
252
- * Redistribution and use in source and binary forms, with or without
253
- * modification, are permitted provided that the following conditions are met:
254
- *
255
- * 1. Redistributions of source code must retain the above copyright notice, this
256
- * list of conditions and the following disclaimer.
257
- * 2. Redistributions in binary form must reproduce the above copyright notice,
258
- * this list of conditions and the following disclaimer in the
259
- * documentation and/or other materials provided with the distribution.
260
- * 3. Neither the name of the copyright holder nor the names of its contributors
261
- * may be used to endorse or promote products derived from this software without
262
- * specific prior written permission.
263
- *
264
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
265
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
266
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
267
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
268
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
269
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
270
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
271
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
272
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
273
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274
- *)
275
-
276
- smol-toml/dist/parse.js:
277
- (*!
278
- * Copyright (c) Squirrel Chat et al., All rights reserved.
279
- * SPDX-License-Identifier: BSD-3-Clause
280
- *
281
- * Redistribution and use in source and binary forms, with or without
282
- * modification, are permitted provided that the following conditions are met:
283
- *
284
- * 1. Redistributions of source code must retain the above copyright notice, this
285
- * list of conditions and the following disclaimer.
286
- * 2. Redistributions in binary form must reproduce the above copyright notice,
287
- * this list of conditions and the following disclaimer in the
288
- * documentation and/or other materials provided with the distribution.
289
- * 3. Neither the name of the copyright holder nor the names of its contributors
290
- * may be used to endorse or promote products derived from this software without
291
- * specific prior written permission.
292
- *
293
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
294
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
295
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
296
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
297
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
298
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
299
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
300
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
301
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
302
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
303
- *)
304
-
305
- smol-toml/dist/stringify.js:
306
- (*!
307
- * Copyright (c) Squirrel Chat et al., All rights reserved.
308
- * SPDX-License-Identifier: BSD-3-Clause
309
- *
310
- * Redistribution and use in source and binary forms, with or without
311
- * modification, are permitted provided that the following conditions are met:
312
- *
313
- * 1. Redistributions of source code must retain the above copyright notice, this
314
- * list of conditions and the following disclaimer.
315
- * 2. Redistributions in binary form must reproduce the above copyright notice,
316
- * this list of conditions and the following disclaimer in the
317
- * documentation and/or other materials provided with the distribution.
318
- * 3. Neither the name of the copyright holder nor the names of its contributors
319
- * may be used to endorse or promote products derived from this software without
320
- * specific prior written permission.
321
- *
322
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
323
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
324
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
325
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
326
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
327
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
328
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
329
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
330
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
331
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
332
- *)
333
-
334
- smol-toml/dist/index.js:
335
- (*!
336
- * Copyright (c) Squirrel Chat et al., All rights reserved.
337
- * SPDX-License-Identifier: BSD-3-Clause
338
- *
339
- * Redistribution and use in source and binary forms, with or without
340
- * modification, are permitted provided that the following conditions are met:
341
- *
342
- * 1. Redistributions of source code must retain the above copyright notice, this
343
- * list of conditions and the following disclaimer.
344
- * 2. Redistributions in binary form must reproduce the above copyright notice,
345
- * this list of conditions and the following disclaimer in the
346
- * documentation and/or other materials provided with the distribution.
347
- * 3. Neither the name of the copyright holder nor the names of its contributors
348
- * may be used to endorse or promote products derived from this software without
349
- * specific prior written permission.
350
- *
351
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
352
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
353
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
354
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
355
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
356
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
357
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
358
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
359
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
360
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
361
- *)
362
- */
363
- export{C as _,Jt as a,fe as c,Y as d,U as f,Yt as g,ge as h,Kt as i,xe as l,W as m,qe as n,ot as o,nr as p,Jn as r,K as s,rr as t,De as u};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e,t}from"./metadata-Df5kCWJv.mjs";import{r as n}from"./theme-BGHWSKCw.mjs";import{t as r}from"./cli-exit-CstFZ1eJ.mjs";import"./ui-xjCox-gU.mjs";import{t as i}from"./log-BWdaOGOW.mjs";import{n as a,t as o}from"./output-BZQEl3mK.mjs";import{d as s,i as c,l,p as u,t as d}from"./run-BOKI1uWa.mjs";const f={command:`disable`,describe:`Disable cf telemetry collection`,handler:()=>{u(!1);let{enabled:e,source:t}=s();if(e){let e=`${l(t)}=true`;i.warn(`cf is collecting usage telemetry because ${n.code(e)} overrides this setting.`)}else a(`cf is no longer collecting usage telemetry.`)}},p={command:`enable`,describe:`Enable cf telemetry collection`,handler:()=>{u(!0);let{enabled:e,source:t}=s();if(e)a(`cf is now collecting anonymous usage telemetry. Thank you for helping make cf better.`);else{let e=`${l(t)}${t===`env`||t===`wrangler-env`?`=false`:``}`;i.warn(`cf is not collecting usage telemetry because ${n.code(e)} overrides this setting.`)}}};function m({enabled:e,source:t}){let r=e?n.success(`Enabled`):n.error(`Disabled`),i=l(t);return`Status: ${r}${i?` (set by ${i})`:``}\n`}const h={command:`status`,describe:`Check whether cf telemetry collection is enabled`,handler:()=>{console.log(m(s())),console.log(n.muted(`Configure on this machine: \`cf cli telemetry enable\` / \`cf cli telemetry disable\`.
3
- Override per invocation with ${c}=true/false. DO_NOT_TRACK is also honored.\nLearn more: https://github.com/cloudflare/cf/blob/main/packages/cli/telemetry.md`))}},g={command:`telemetry`,describe:`Configure whether cf collects anonymous usage telemetry`,builder:e=>e.command(h).command(p).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_=`KEYS`,v=`VALUES`;var y=class{constructor(e,t){let n=e._tree,r=Array.from(n.keys());this.set=e,this._type=t,this._path=r.length>0?[{node:n,keys:r}]:[]}next(){let e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};let{node:e,keys:t}=b(this._path);if(b(t)===``)return{done:!1,value:this.result()};let n=e.get(b(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=b(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>b(e)).filter(e=>e!==``).join(``)}value(){return b(this._path).node.get(``)}result(){switch(this._type){case v:return this.value();case _:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}};const b=e=>e[e.length-1],x=(e,t,n)=>{let r=/* @__PURE__ */ new Map;if(t===void 0)return r;let i=t.length+1,a=i+n,o=new Uint8Array(a*i).fill(n+1);for(let e=0;e<i;++e)o[e]=e;for(let e=1;e<a;++e)o[e*i]=e;return S(e,t,n,r,o,1,i,``),r},S=(e,t,n,r,i,a,o,s)=>{let c=a*o;key:for(let l of e.keys())if(l===``){let t=i[c-1];t<=n&&r.set(s,[e.get(l),t])}else{let c=a;for(let e=0;e<l.length;++e,++c){let r=l[e],a=o*c,s=a-o,u=i[a],d=Math.max(0,c-n-1),f=Math.min(o-1,c+n);for(let e=d;e<f;++e){let n=r!==t[e],o=i[s+e]+ +n,c=i[s+e+1]+1,l=i[a+e]+1,d=i[a+e+1]=Math.min(o,c,l);d<u&&(u=d)}if(u>n)continue key}S(e.get(l),t,n,r,i,c,o,s+l)}};var C=class e{constructor(e=/* @__PURE__ */ new Map,t=``){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(t){if(!t.startsWith(this._prefix))throw Error(`Mismatched prefix`);let[n,r]=w(this._tree,t.slice(this._prefix.length));if(n===void 0){let[n,i]=A(r);for(let r of n.keys())if(r!==``&&r.startsWith(i)){let a=/* @__PURE__ */ new Map;return a.set(r.slice(i.length),n.get(r)),new e(a,t)}}return new e(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,D(this._tree,e)}entries(){return new y(this,`ENTRIES`)}forEach(e){for(let[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return x(this._tree,e,t)}get(e){let t=T(this._tree,e);return t===void 0?void 0:t.get(``)}has(e){let t=T(this._tree,e);return t!==void 0&&t.has(``)}keys(){return new y(this,_)}set(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);return this._size=void 0,E(this._tree,e).set(``,t),this}get size(){if(this._size)return this._size;this._size=0;let e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=E(this._tree,e);return n.set(``,t(n.get(``))),this}fetch(e,t){if(typeof e!=`string`)throw Error(`key must be a string`);this._size=void 0;let n=E(this._tree,e),r=n.get(``);return r===void 0&&n.set(``,r=t()),r}values(){return new y(this,v)}[Symbol.iterator](){return this.entries()}static from(t){let n=new e;for(let[e,r]of t)n.set(e,r);return n}static fromObject(t){return e.from(Object.entries(t))}};const w=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(let r of e.keys())if(r!==``&&t.startsWith(r))return n.push([e,r]),w(e.get(r),t.slice(r.length),n);return n.push([e,t]),w(void 0,``,n)},T=(e,t)=>{if(t.length===0||e==null)return e;for(let n of e.keys())if(n!==``&&t.startsWith(n))return T(e.get(n),t.slice(n.length))},E=(e,t)=>{let n=t.length;outer:for(let r=0;e&&r<n;){for(let i of e.keys())if(i!==``&&t[r]===i[0]){let a=Math.min(n-r,i.length),o=1;for(;o<a&&t[r+o]===i[o];)++o;let s=e.get(i);if(o===i.length)e=s;else{let n=/* @__PURE__ */ new Map;n.set(i.slice(o),s),e.set(t.slice(r,r+o),n),e.delete(i),e=n}r+=o;continue outer}let i=/* @__PURE__ */ new Map;return e.set(t.slice(r),i),i}return e},D=(e,t)=>{let[n,r]=w(e,t);if(n!==void 0){if(n.delete(``),n.size===0)O(r);else if(n.size===1){let[e,t]=n.entries().next().value;k(r,e,t)}}},O=e=>{if(e.length===0)return;let[t,n]=A(e);if(t.delete(n),t.size===0)O(e.slice(0,-1));else if(t.size===1){let[n,r]=t.entries().next().value;n!==``&&k(e.slice(0,-1),n,r)}},k=(e,t,n)=>{if(e.length===0)return;let[r,i]=A(e);r.set(i+t,n),r.delete(i)},A=e=>e[e.length-1];var j=class e{constructor(e){if(e?.fields==null)throw Error(`MiniSearch: option "fields" must be provided`);let t=e.autoVacuum==null||e.autoVacuum===!0?H:e.autoVacuum;this._options={...L,...e,autoVacuum:t,searchOptions:{...R,...e.searchOptions||{}},autoSuggestOptions:{...z,...e.autoSuggestOptions||{}}},this._index=new C,this._documentCount=0,this._documentIds=/* @__PURE__ */ new Map,this._idToShortId=/* @__PURE__ */ new Map,this._fieldIds={},this._fieldLength=/* @__PURE__ */ new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=/* @__PURE__ */ new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=V,this.addFields(this._options.fields)}add(e){let{extractField:t,stringifyField:n,tokenize:r,processTerm:i,fields:a,idField:o}=this._options,s=t(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(s))throw Error(`MiniSearch: duplicate ID ${s}`);let c=this.addDocumentId(s);this.saveStoredFields(c,e);for(let o of a){let a=t(e,o);if(a==null)continue;let s=r(n(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.addFieldLength(c,l,this._documentCount-1,u);for(let e of s){let t=i(e,o);if(Array.isArray(t))for(let e of t)this.addTerm(l,c,e);else t&&this.addTerm(l,c,t)}}}addAll(e){for(let t of e)this.add(t)}addAllAsync(e,t={}){let{chunkSize:n=10}=t,r={chunk:[],promise:Promise.resolve()},{chunk:i,promise:a}=e.reduce(({chunk:e,promise:t},r,i)=>(e.push(r),(i+1)%n===0?{chunk:[],promise:t.then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.addAll(e))}:{chunk:e,promise:t}),r);return a.then(()=>this.addAll(i))}remove(e){let{tokenize:t,processTerm:n,extractField:r,stringifyField:i,fields:a,idField:o}=this._options,s=r(e,o);if(s==null)throw Error(`MiniSearch: document does not have ID field "${o}"`);let c=this._idToShortId.get(s);if(c==null)throw Error(`MiniSearch: cannot remove document with ID ${s}: it is not in the index`);for(let o of a){let a=r(e,o);if(a==null)continue;let s=t(i(a,o),o),l=this._fieldIds[o],u=new Set(s).size;this.removeFieldLength(c,l,this._documentCount,u);for(let e of s){let t=n(e,o);if(Array.isArray(t))for(let e of t)this.removeTerm(l,c,e);else t&&this.removeTerm(l,c,t)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(s),this._fieldLength.delete(c),--this._documentCount}removeAll(e){if(e)for(let t of e)this.remove(t);else if(arguments.length>0)throw Error(`Expected documents to be present. Omit the argument to remove all documents.`);else this._index=new C,this._documentCount=0,this._documentIds=/* @__PURE__ */ new Map,this._idToShortId=/* @__PURE__ */ new Map,this._fieldLength=/* @__PURE__ */ new Map,this._avgFieldLength=[],this._storedFields=/* @__PURE__ */ new Map,this._nextId=0}discard(e){let t=this._idToShortId.get(e);if(t==null)throw Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((e,n)=>{this.removeFieldLength(t,n,this._documentCount,e)}),this._fieldLength.delete(t),--this._documentCount,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;let{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:r}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:r},{minDirtCount:t,minDirtFactor:e})}discardAll(e){let t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(let t of e)this.discard(t)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){let{idField:t,extractField:n}=this._options,r=n(e,t);this.discard(r),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum??=this._currentVacuum.then(()=>{let t=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=V,this.performVacuuming(e,t)}),this._enqueuedVacuum):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){let n=this._dirtCount;if(this.vacuumConditionsMet(t)){let t=e.batchSize||B.batchSize,r=e.batchWait||B.batchWait,i=1;for(let[e,n]of this._index){for(let[e,t]of n)for(let[r]of t)this._documentIds.has(r)||(t.size<=1?n.delete(e):t.delete(r));this._index.get(e).size===0&&this._index.delete(e),i%t===0&&await new Promise(e=>setTimeout(e,r)),i+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t||=H.minDirtCount,n||=H.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){let t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(t,n={}){let{searchOptions:r}=this._options,i={...r,...n},a=this.executeQuery(t,n),o=[];for(let[e,{score:t,terms:n,match:r}]of a){let a=n.length||1,s={id:this._documentIds.get(e),score:t*a,terms:Object.keys(r),queryTerms:n,match:r};Object.assign(s,this._storedFields.get(e)),(i.filter==null||i.filter(s))&&o.push(s)}return t===e.wildcard&&i.boostDocument==null||o.sort(G),o}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};let n=/* @__PURE__ */ new Map;for(let{score:r,terms:i}of this.search(e,t)){let e=i.join(` `),t=n.get(e);t==null?n.set(e,{score:r,terms:i,count:1}):(t.score+=r,t.count+=1)}let r=[];for(let[e,{score:t,terms:i,count:a}]of n)r.push({suggestion:e,terms:i,score:t/a});return r.sort(G),r}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJS(JSON.parse(e),t)}static async loadJSONAsync(e,t){if(t==null)throw Error(`MiniSearch: loadJSON should be given the same options used when serializing the index`);return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(L.hasOwnProperty(e))return M(L,e);throw Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=q(r),s._fieldLength=q(i),s._storedFields=q(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);for(let[e,t]of n){let n=/* @__PURE__ */ new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),q(r))}s._index.set(e,n)}return s}static async loadJSAsync(e,t){let{index:n,documentIds:r,fieldLength:i,storedFields:a,serializationVersion:o}=e,s=this.instantiateMiniSearch(e,t);s._documentIds=await J(r),s._fieldLength=await J(i),s._storedFields=await J(a);for(let[e,t]of s._documentIds)s._idToShortId.set(t,e);let c=0;for(let[e,t]of n){let n=/* @__PURE__ */ new Map;for(let e of Object.keys(t)){let r=t[e];o===1&&(r=r.ds),n.set(parseInt(e,10),await J(r))}++c%1e3==0&&await Y(0),s._index.set(e,n)}return s}static instantiateMiniSearch(t,n){let{documentCount:r,nextId:i,fieldIds:a,averageFieldLength:o,dirtCount:s,serializationVersion:c}=t;if(c!==1&&c!==2)throw Error(`MiniSearch: cannot deserialize an index created with an incompatible version`);let l=new e(n);return l._documentCount=r,l._nextId=i,l._idToShortId=/* @__PURE__ */ new Map,l._fieldIds=a,l._avgFieldLength=o,l._dirtCount=s||0,l._index=new C,l}executeQuery(t,n={}){if(t===e.wildcard)return this.executeWildcardQuery(n);if(typeof t!=`string`){let e={...n,...t,queries:void 0},r=t.queries.map(t=>this.executeQuery(t,e));return this.combineResults(r,e.combineWith)}let{tokenize:r,processTerm:i,searchOptions:a}=this._options,o={tokenize:r,processTerm:i,...a,...n},{tokenize:s,processTerm:c}=o,l=s(t).flatMap(e=>c(e)).filter(e=>!!e).map(I(o)).map(e=>this.executeQuerySpec(e,o));return this.combineResults(l,o.combineWith)}executeQuerySpec(e,t){let n={...this._options.searchOptions,...t},r=(n.fields||this._options.fields).reduce((e,t)=>({...e,[t]:M(n.boost,t)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:o,bm25:s}=n,{fuzzy:c,prefix:l}={...R.weights,...a},u=this._index.get(e.term),d=this.termResults(e.term,e.term,1,e.termBoost,u,r,i,s),f,p;if(e.prefix&&(f=this._index.atPrefix(e.term)),e.fuzzy){let t=e.fuzzy===!0?.2:e.fuzzy,n=t<1?Math.min(o,Math.round(e.term.length*t)):t;n&&(p=this._index.fuzzyGet(e.term,n))}if(f)for(let[t,n]of f){let a=t.length-e.term.length;if(!a)continue;p?.delete(t);let o=l*t.length/(t.length+.3*a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}if(p)for(let t of p.keys()){let[n,a]=p.get(t);if(!a)continue;let o=c*t.length/(t.length+a);this.termResults(e.term,t,o,e.termBoost,n,r,i,s,d)}return d}executeWildcardQuery(e){let t=/* @__PURE__ */ new Map,n={...this._options.searchOptions,...e};for(let[e,r]of this._documentIds){let i=n.boostDocument?n.boostDocument(r,``,this._storedFields.get(e)):1;t.set(e,{score:i,terms:[],match:{}})}return t}combineResults(e,t=`or`){if(e.length===0)return/* @__PURE__ */ new Map;let n=t.toLowerCase(),r=N[n];if(!r)throw Error(`Invalid combination operator: ${t}`);return e.reduce(r)||/* @__PURE__ */ new Map}toJSON(){let e=[];for(let[t,n]of this._index){let r={};for(let[e,t]of n)r[e]=Object.fromEntries(t);e.push([t,r])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,t,n,r,i,a,o,s,c=/* @__PURE__ */ new Map){if(i==null)return c;for(let l of Object.keys(a)){let u=a[l],d=this._fieldIds[l],f=i.get(d);if(f==null)continue;let p=f.size,m=this._avgFieldLength[d];for(let i of f.keys()){if(!this._documentIds.has(i)){this.removeTerm(d,i,t),--p;continue}let a=o?o(this._documentIds.get(i),t,this._storedFields.get(i)):1;if(!a)continue;let h=f.get(i),g=this._fieldLength.get(i)[d],_=F(h,p,this._documentCount,g,m,s),v=n*r*u*a*_,y=c.get(i);if(y){y.score+=v,U(y.terms,e);let n=M(y.match,t);n?n.push(l):y.match[t]=[l]}else c.set(i,{score:v,terms:[e],match:{[t]:[l]}})}}return c}addTerm(e,t,n){let r=this._index.fetch(n,K),i=r.get(e);if(i==null)i=/* @__PURE__ */ new Map,i.set(t,1),r.set(e,i);else{let e=i.get(t);i.set(t,(e||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}let r=this._index.fetch(n,K),i=r.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,n):i.get(t)<=1?i.size<=1?r.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(let r of Object.keys(this._fieldIds))if(this._fieldIds[r]===t){this._options.logger(`warn`,`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${r}". Removing a document after it has changed can corrupt the index!`,`version_conflict`);return}}addDocumentId(e){let t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,r){let i=this._fieldLength.get(e);i??this._fieldLength.set(e,i=[]),i[t]=r;let a=(this._avgFieldLength[t]||0)*n+r;this._avgFieldLength[t]=a/(n+1)}removeFieldLength(e,t,n,r){if(n===1){this._avgFieldLength[t]=0;return}let i=this._avgFieldLength[t]*n-r;this._avgFieldLength[t]=i/(n-1)}saveStoredFields(e,t){let{storeFields:n,extractField:r}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i??this._storedFields.set(e,i={});for(let e of n){let n=r(t,e);n!==void 0&&(i[e]=n)}}};j.wildcard=Symbol(`*`);const M=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,N={or:(e,t)=>{for(let n of t.keys()){let r=e.get(n);if(r==null)e.set(n,t.get(n));else{let{score:e,terms:i,match:a}=t.get(n);r.score+=e,r.match=Object.assign(r.match,a),W(r.terms,i)}}return e},and:(e,t)=>{let n=/* @__PURE__ */ new Map;for(let r of t.keys()){let i=e.get(r);if(i==null)continue;let{score:a,terms:o,match:s}=t.get(r);W(i.terms,o),n.set(r,{score:i.score+a,terms:i.terms,match:Object.assign(i.match,s)})}return n},and_not:(e,t)=>{for(let n of t.keys())e.delete(n);return e}},P={k:1.2,b:.7,d:.5},F=(e,t,n,r,i,a)=>{let{k:o,b:s,d:c}=a;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(o+1)/(e+o*(1-s+s*r/i)))},I=e=>(t,n,r)=>({term:t,fuzzy:typeof e.fuzzy==`function`?e.fuzzy(t,n,r):e.fuzzy||!1,prefix:typeof e.prefix==`function`?e.prefix(t,n,r):e.prefix===!0,termBoost:typeof e.boostTerm==`function`?e.boostTerm(t,n,r):1}),L={idField:`id`,extractField:(e,t)=>e[t],stringifyField:(e,t)=>e.toString(),tokenize:e=>e.split(X),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])==`function`&&console[e](t)},autoVacuum:!0},R={combineWith:`or`,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:P},z={combineWith:`and`,prefix:(e,t,n)=>t===n.length-1},B={batchSize:1e3,batchWait:10},V={minDirtFactor:.1,minDirtCount:20},H={...B,...V},U=(e,t)=>{e.includes(t)||e.push(t)},W=(e,t)=>{for(let n of t)e.includes(n)||e.push(n)},G=({score:e},{score:t})=>t-e,K=()=>/* @__PURE__ */ new Map,q=e=>{let t=/* @__PURE__ */ new Map;for(let n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},J=async e=>{let t=/* @__PURE__ */ new Map,n=0;for(let r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3==0&&await Y(0);return t},Y=e=>new Promise(t=>setTimeout(t,e)),X=/[\n\r\p{Z}\p{P}]+/u;function Z(e){return!e.hideCommand&&!e.search?.exclude}function Q(e,t){let n=e.fullPath.slice(0,-1).map((t,n)=>e.fullPath.slice(0,n+1).join(` `));return{command:e.command,summary:e.summary||e.description.split(`
4
- `)[0]||``,description:e.description,keywords:e.search?.keywords?.join(` `)??``,context:[...n.map(e=>t[e]??``),...e.arguments.map(e=>`${e.name} ${e.description}`),...e.options.map(e=>`${e.name} ${e.description}`)].join(` `)}}function $(e,t){let n=e.commands.filter(Z).map(t=>Q(t,e.descriptions??{})),r=new j({fields:[`command`,`summary`,`description`,`keywords`,`context`],storeFields:[`command`,`summary`],idField:`command`});return r.addAll(n),r.search(t,{prefix:!0,fuzzy:.2,boost:{command:8,summary:5,description:2,keywords:5,context:.5}}).slice(0,5).map(({command:e,summary:t})=>({command:e,summary:t}))}const ee={command:`search <query>`,describe:`Search all CLI commands by intent`,builder:e=>e.positional(`query`,{describe:`Search terms or a description of what you want to do`,type:`string`,demandOption:!0}),handler:n=>d({command:`cli search`,recordArgs:!1,searchQuery:n.query},n,()=>{let i=e(import.meta.url,`commands.json`,t);if(!i)throw console.error(`Error: Could not load commands.json.`),new r(1);o($(i,n.query))})},te={command:`cli`,describe:`Discover commands and configure the cf CLI`,builder:e=>e.command(ee).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{te as default};