cf 0.4.0 → 0.5.0

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 (220) hide show
  1. package/README.md +7 -1
  2. package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
  3. package/dist/{accounts-CjtZ8x1z.mjs → accounts-B_joQcMi.mjs} +9 -9
  4. package/dist/{acm-C2lYIWs1.mjs → acm-_kIHqYME.mjs} +2 -2
  5. package/dist/{addressing-CHFK6uxW.mjs → addressing-CaFlw8y1.mjs} +10 -10
  6. package/dist/{agent-context-CgGCT0xU.mjs → agent-context-DMPfi54f.mjs} +1 -1
  7. package/dist/ai-CqnhNb_c.mjs +2 -0
  8. package/dist/ai-gateway-pgYGI519.mjs +8 -0
  9. package/dist/ai-search-eqQMPQol.mjs +7 -0
  10. package/dist/ai_gateway--vuVLnOm.mjs +4 -0
  11. package/dist/{alerting-Bk85NNf5.mjs → alerting-CPxHiYHb.mjs} +5 -5
  12. package/dist/{analytics-CkhhhZWZ.mjs → analytics-DSSRDZz8.mjs} +1 -1
  13. package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
  14. package/dist/{api-gateway-CWdR4Ne7.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
  15. package/dist/argo-aC6A3JyX.mjs +2 -0
  16. package/dist/artifacts-HD4V2xpK.mjs +4 -0
  17. package/dist/audit-logs-BuExU_nz.mjs +2 -0
  18. package/dist/auth-CSC4yhEJ.mjs +9 -0
  19. package/dist/auth-D5hNsOFq.mjs +5 -0
  20. package/dist/billing-COaghyxl.mjs +2 -0
  21. package/dist/bot-management-DmEzeV1Y.mjs +5 -0
  22. package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
  23. package/dist/brand-protection-dPrGe8sL.mjs +3 -0
  24. package/dist/{browser-rendering-Rae0AUt0.mjs → browser-rendering-BiSGnpBf.mjs} +3 -3
  25. package/dist/{build-BE4o4imx.mjs → build-HuS9-R0V.mjs} +2 -2
  26. package/dist/{cache-B7pRbpTy.mjs → cache-CY-7Lt71.mjs} +4 -4
  27. package/dist/{calls-DXRWsZ8n.mjs → calls-wOQGDWPl.mjs} +3 -3
  28. package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
  29. package/dist/client-certificates-CRf41xLe.mjs +3 -0
  30. package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
  31. package/dist/{cloudforce-one-B6HYfk5Z.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
  32. package/dist/{completions-D_9WsLG7.mjs → completions-DOeHPdCG.mjs} +2 -2
  33. package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
  34. package/dist/connectivity-Bx3MgTHX.mjs +3 -0
  35. package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
  36. package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
  37. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
  38. package/dist/connectors-DRt4e6d_.mjs +3 -0
  39. package/dist/{content-scanning-CnW2A0pv.mjs → content-scanning-Cd2vy5Sz.mjs} +3 -3
  40. package/dist/context-jpewmual.mjs +2 -0
  41. package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
  42. package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
  43. package/dist/custom-nameservers-CWqA51in.mjs +3 -0
  44. package/dist/custom-pages-DeUKEFGe.mjs +4 -0
  45. package/dist/d1-DvWY9Gp4.mjs +4 -0
  46. package/dist/data-security-BPo6dIWu.mjs +6 -0
  47. package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
  48. package/dist/{deploy-KBRFIatG.mjs → deploy-dVrgDUOp.mjs} +1 -1
  49. package/dist/{dev-pPazzZvt.mjs → dev-C01_Lby6.mjs} +1 -1
  50. package/dist/diagnostics-6nKPmVgz.mjs +3 -0
  51. package/dist/{dispatch-namespaces-Cz2rajnP.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
  52. package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
  53. package/dist/{dist-DA54ZQu0.mjs → dist-t_YrL25p.mjs} +1 -1
  54. package/dist/{dns-62t95Xif.mjs → dns-ClciFGxx.mjs} +13 -13
  55. package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
  56. package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
  57. package/dist/{email-routing-BDUYYeV3.mjs → email-routing-CGXhFqF5.mjs} +9 -9
  58. package/dist/{email-security-ChHA6eqQ.mjs → email-security-D5viPq8S.mjs} +7 -7
  59. package/dist/email-sending-C2jpc3gh.mjs +3 -0
  60. package/dist/{filters-qJpU9uAS.mjs → filters-bzsFcWt0.mjs} +3 -3
  61. package/dist/{firewall-C3DDwfwh.mjs → firewall-DYZcTtIC.mjs} +10 -10
  62. package/dist/{fraud-DY3YXFVf.mjs → fraud-C03MtdZb.mjs} +1 -1
  63. package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
  64. package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
  65. package/dist/hostnames-CFgIVI3s.mjs +3 -0
  66. package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
  67. package/dist/iam-DqVPzGrb.mjs +6 -0
  68. package/dist/{images-D1jI3r3O.mjs → images-BYfl4YgR.mjs} +6 -6
  69. package/dist/index.mjs +1 -1
  70. package/dist/intel-duTEPIHc.mjs +3 -0
  71. package/dist/{ips-B6JETVOY.mjs → ips-nv9INuWZ.mjs} +1 -1
  72. package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
  73. package/dist/{kv-CSWoD9ks.mjs → kv-CZoV4tiv.mjs} +4 -4
  74. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
  75. package/dist/{load-balancers-Du1tNuUt.mjs → load-balancers--OMg0HNt.mjs} +5 -5
  76. package/dist/{logpush-SuJyO-uX.mjs → logpush-C0_lZTyY.mjs} +3 -3
  77. package/dist/{logs-DcDNRPRl.mjs → logs-BtpWZQfV.mjs} +2 -2
  78. package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
  79. package/dist/{magic-network-monitoring-CqtvOePQ.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
  80. package/dist/{magic-transit-BTbkhBtF.mjs → magic-transit-CLhMcJ_-.mjs} +32 -32
  81. package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
  82. package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
  83. package/dist/{network-interconnects-DsiNytOU.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
  84. package/dist/oauth-Bk-F-tIO.mjs +52 -0
  85. package/dist/{observability-CLqZ7OSi.mjs → observability-BynRbTF4.mjs} +3 -3
  86. package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
  87. package/dist/{organizations-aRi1bhFC.mjs → organizations-BqJHyvMK.mjs} +3 -3
  88. package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
  90. package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
  91. package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
  92. package/dist/{page-rules-CYqtPU1p.mjs → page-rules-EZHJePmn.mjs} +4 -4
  93. package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CXJioWPs.mjs} +5 -5
  94. package/dist/{pages-ChurJ2H7.mjs → pages-D4aYteKk.mjs} +8 -8
  95. package/dist/{pipelines-CeyujvRf.mjs → pipelines-G8Iusxq-.mjs} +5 -5
  96. package/dist/progress-DrDErV9w.mjs +2 -0
  97. package/dist/queues-DEkbKqZX.mjs +6 -0
  98. package/dist/{r2-BtuTO3vQ.mjs → r2-CV0IkCAW.mjs} +9 -9
  99. package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
  100. package/dist/{radar-CzGM92uM.mjs → radar-D986zPJr.mjs} +1 -1
  101. package/dist/{rate-limits-Bbk7HxP7.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
  102. package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
  103. package/dist/{realtime-kit-CivLpkpg.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
  104. package/dist/{registrar-8IeA5DKd.mjs → registrar-CDIwTz3G.mjs} +6 -6
  105. package/dist/request-tracers-D7SFMDik.mjs +2 -0
  106. package/dist/{resource-sharing-B-Pcto7-.mjs → resource-sharing-YIQ04jXE.mjs} +4 -4
  107. package/dist/{resource-tagging-Bpb6Qq1M.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
  108. package/dist/rules-DHjLP5Kx.mjs +4 -0
  109. package/dist/{rulesets-lYczEcJp.mjs → rulesets-q4QABpKs.mjs} +7 -7
  110. package/dist/rum-SmT4HZmM.mjs +4 -0
  111. package/dist/{schema-hefO-tzo.mjs → schema-BR31o4P6.mjs} +1 -1
  112. package/dist/{schema-validation-DTq517Em.mjs → schema-validation-vVetgC_P.mjs} +5 -5
  113. package/dist/{scim-BiLfOQ89.mjs → scim-ChOkZpNx.mjs} +2 -2
  114. package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
  115. package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-BAK9G12O.mjs} +12 -12
  116. package/dist/security-center-eScuYDKP.mjs +2 -0
  117. package/dist/security-txt-x7R4gmQu.mjs +3 -0
  118. package/dist/session-DHYCE-PM.mjs +93 -0
  119. package/dist/shared-BAjo72Lz.mjs +2 -0
  120. package/dist/{smart-shield-DblHIce0.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
  121. package/dist/snippets-DrlgYJYp.mjs +4 -0
  122. package/dist/{spawn-DK7pott_.mjs → spawn-CCGzKlC4.mjs} +1 -1
  123. package/dist/{spectrum-CnrG0jIC.mjs → spectrum-pVGxb7u5.mjs} +6 -6
  124. package/dist/speed-ZFrMWDgd.mjs +4 -0
  125. package/dist/src-DU7FBCOX.mjs +108 -0
  126. package/dist/ssl-9JY05sYt.mjs +15 -0
  127. package/dist/{stream-CGTRN4ZN.mjs → stream-tRU39b8K.mjs} +13 -13
  128. package/dist/{tenants-o_M62Y1n.mjs → tenants-HLGUazms.mjs} +1 -1
  129. package/dist/{token-validation-Ca5AGEns.mjs → token-validation-_VdamKpz.mjs} +4 -4
  130. package/dist/{tools-DtNNmO6l.mjs → tools-D_hfUU_Z.mjs} +1 -1
  131. package/dist/{turnstile-l7mo9BWL.mjs → turnstile-BRzXd28B.mjs} +4 -4
  132. package/dist/{ui-B97lRnOv.mjs → ui-erjBdVKL.mjs} +1 -1
  133. package/dist/url-normalization-D-NxuLtN.mjs +3 -0
  134. package/dist/url-scanner-BzzR6iDx.mjs +2 -0
  135. package/dist/{user-CiyYZ69X.mjs → user-C4omq__w.mjs} +1 -1
  136. package/dist/vectorize-By6EqcNR.mjs +4 -0
  137. package/dist/{versions-B6E8WQyA.mjs → versions-CBHwWPAM.mjs} +1 -1
  138. package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
  139. package/dist/{web3-DlHE0CZc.mjs → web3-DQ5dmE9W.mjs} +3 -3
  140. package/dist/{workers-DRAkU6YR.mjs → workers-D8Be7_as.mjs} +14 -14
  141. package/dist/workers-builds-BE3W3qNk.mjs +7 -0
  142. package/dist/{workflows-z6oapEJs.mjs → workflows-BWWufqFA.mjs} +3 -3
  143. package/dist/zaraz-Bsa9AvVL.mjs +2 -0
  144. package/dist/{zero-trust-fyyIelWx.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
  145. package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
  146. package/dist/{zones-MSULnDwW.mjs → zones-BXtdwt6E.mjs} +6 -6
  147. package/package.json +1 -1
  148. package/dist/ai-DS3i-I1a.mjs +0 -2
  149. package/dist/ai-gateway-RIsegO2x.mjs +0 -8
  150. package/dist/ai-search-Dcj4BauG.mjs +0 -7
  151. package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
  152. package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
  153. package/dist/argo-DnJRVnGX.mjs +0 -2
  154. package/dist/artifacts-BVWKiJUl.mjs +0 -4
  155. package/dist/audit-logs-DjTstbzL.mjs +0 -2
  156. package/dist/auth-BqDOIrKX.mjs +0 -150
  157. package/dist/auth-DKkSwnxh.mjs +0 -5
  158. package/dist/billing-3rEqF83h.mjs +0 -2
  159. package/dist/bot-management-CJxD1pqi.mjs +0 -5
  160. package/dist/botnet-feed-MG91D7BR.mjs +0 -3
  161. package/dist/brand-protection-CK7gJi06.mjs +0 -3
  162. package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
  163. package/dist/client-certificates-B0ebLJdk.mjs +0 -3
  164. package/dist/cloud-connector-BOjaggJk.mjs +0 -2
  165. package/dist/connectivity-welFvZ7X.mjs +0 -3
  166. package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
  167. package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
  168. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
  169. package/dist/connectors-3vjrdFLB.mjs +0 -3
  170. package/dist/context-CONbNKO-.mjs +0 -2
  171. package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
  172. package/dist/custom-pages-5fCSP8in.mjs +0 -4
  173. package/dist/d1-CyiRbZZn.mjs +0 -4
  174. package/dist/data-security-Casx4OS_.mjs +0 -6
  175. package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
  176. package/dist/diagnostics-BqYDoDfw.mjs +0 -3
  177. package/dist/dns-firewall-Coy8d47t.mjs +0 -57
  178. package/dist/durable-objects-BSuRERkw.mjs +0 -2
  179. package/dist/email-sending-CVrRqn6S.mjs +0 -3
  180. package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
  181. package/dist/hostnames-BdAQo1Mr.mjs +0 -3
  182. package/dist/hyperdrive-99OJV9nl.mjs +0 -18
  183. package/dist/iam-BRbpg3lN.mjs +0 -6
  184. package/dist/intel-C3ajLpXd.mjs +0 -3
  185. package/dist/keyless-certificates-C4MZ4xnf.mjs +0 -3
  186. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
  187. package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
  188. package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
  189. package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
  190. package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
  191. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
  192. package/dist/progress-Cent9Lsg.mjs +0 -2
  193. package/dist/queues-Rf_n11Cx.mjs +0 -6
  194. package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
  195. package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
  196. package/dist/request-tracers-D1aH4NmL.mjs +0 -2
  197. package/dist/rules-B10XWY10.mjs +0 -4
  198. package/dist/rum-B5GUKa4I.mjs +0 -4
  199. package/dist/security-center-AVpTOBK3.mjs +0 -2
  200. package/dist/security-txt-DVlh8y9l.mjs +0 -3
  201. package/dist/shared-0bwWVDLo.mjs +0 -2
  202. package/dist/snippets-DrpqSXYC.mjs +0 -4
  203. package/dist/speed-BzRY3Xlh.mjs +0 -4
  204. package/dist/src-D9_Gq68b.mjs +0 -108
  205. package/dist/ssl-Cp6tQkZH.mjs +0 -15
  206. package/dist/url-normalization-D1CogSIG.mjs +0 -3
  207. package/dist/url-scanner-BnJHJqcz.mjs +0 -2
  208. package/dist/vectorize-D3LgMLOn.mjs +0 -4
  209. package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
  210. package/dist/zaraz-CyzfYOEU.mjs +0 -2
  211. package/dist/zero_trust-BAhlNkjo.mjs +0 -3
  212. /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  213. /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
  214. /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-BeyOc81z.mjs} +0 -0
  215. /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
  216. /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
  217. /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
  218. /package/dist/{metadata-jh2EIan8.mjs → metadata-OOwvpR8m.mjs} +0 -0
  219. /package/dist/{resolve-D1mG0REg.mjs → resolve-C3h-mwp7.mjs} +0 -0
  220. /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env node
2
- import{o as e}from"./chunk-DH-VkVmc.mjs";import{a as t,i as n,o as r,r as i,s as a,t as o}from"./session-CsvPYFj8.mjs";import{$ as s,A as c,B as l,I as u,L as d,M as f,P as p,S as m,W as h,Z as ee,_ as g,a as te,et as _,g as v,j as ne,m as y,s as re,t as b,v as ie}from"./dist-DpDjsWWn.mjs";import{n as x,t as S}from"./theme-CFHr0Dh9.mjs";import{i as C,n as w,r as ae}from"./config-7CBz8Xm0.mjs";import{c as oe,f as se,h as T,i as E,m as D,o as ce,r as le,s as ue,t as de}from"./dist-DA54ZQu0.mjs";import{n as fe,t as pe}from"./resolve-D1mG0REg.mjs";import{createRequire as me}from"node:module";import{chmodSync as he,existsSync as O,mkdirSync as k,readFileSync as ge,readdirSync as _e,rmSync as A,unlinkSync as ve,writeFileSync as j}from"node:fs";import ye from"node:assert";import"node:os";import M,{dirname as be,join as xe}from"node:path";import{spawnSync as Se}from"node:child_process";import{createCipheriv as Ce,createDecipheriv as we,createHash as Te,randomBytes as Ee,webcrypto as De}from"node:crypto";import Oe from"node:http";import{TextEncoder as ke}from"node:util";import Ae,{URLSearchParams as je}from"node:url";import"node:process";import{execSync as Me}from"child_process";import Ne from"os";var Pe=Object.defineProperty,N=(e,t)=>Pe(e,`name`,{value:t,configurable:!0}),P=d(),Fe=!1;function F(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?(!Fe&&n&&(Fe=!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}):{}}N(F,`readStoredAuthState`);var Ie=m({variableName:`CLOUDFLARE_API_TOKEN`,deprecatedName:`CF_API_TOKEN`}),Le=m({variableName:`CLOUDFLARE_API_KEY`,deprecatedName:`CF_API_KEY`}),Re=m({variableName:`CLOUDFLARE_EMAIL`,deprecatedName:`CF_EMAIL`});function ze(e){if(e?.allowGlobalAuthKey??!0){let e=Le(),t=Re();if(e&&t)return{authKey:e,authEmail:t}}let t=Ie();if(t)return{apiToken:t}}N(ze,`getAuthFromEnv`);function Be(e){let t=ze(e);if(t)return t;let n=F({storage:e.storage,warningLogger:e.warningLogger});if(n.deprecatedApiToken)return{apiToken:n.deprecatedApiToken};if(n.accessToken?.value)return{apiToken:n.accessToken.value}}N(Be,`getAPIToken`);function Ve(e){let t=Be(e);if(!t)throw new h(`No API token found.`,{telemetryMessage:`user auth missing api token`});return t}N(Ve,`requireApiToken`);var I=m({variableName:`WRANGLER_AUTH_DOMAIN`,defaultValue:N(()=>g()===`staging`?`dash.staging.cloudflare.com`:`dash.cloudflare.com`,`defaultValue`)}),He=m({variableName:`WRANGLER_AUTH_URL`,defaultValue:N(()=>`https://${I()}/oauth2/auth`,`defaultValue`)}),Ue=m({variableName:`WRANGLER_TOKEN_URL`,defaultValue:N(()=>`https://${I()}/oauth2/token`,`defaultValue`)}),We=m({variableName:`WRANGLER_REVOKE_URL`,defaultValue:N(()=>`https://${I()}/oauth2/revoke`,`defaultValue`)}),Ge=m({variableName:`CLOUDFLARE_ACCOUNT_ID`,deprecatedName:`CF_ACCOUNT_ID`}),Ke=m({variableName:`CLOUDFLARE_ACCESS_CLIENT_ID`}),qe=m({variableName:`CLOUDFLARE_ACCESS_CLIENT_SECRET`}),Je=m({variableName:`WRANGLER_CF_AUTHORIZATION_TOKEN`}),Ye=y({variableName:`CLOUDFLARE_AUTH_USE_KEYRING`}),L={},R=new Map;function Xe(){for(let e of Object.keys(L))delete L[e];R.clear()}N(Xe,`clearAccessCaches`);async function Ze(e,t){if(t.debug(`Checking if domain has Access enabled:`,e),R.has(e))return t.debug(`Using cached Access switch for:`,e,R.get(e)),R.get(e)??!1;t.debug(`Access switch not cached for:`,e);try{let n=new AbortController,r=setTimeout(()=>{n.abort()},1e3),i=await(0,P.fetch)(`https://${e}`,{redirect:`manual`,signal:n.signal});clearTimeout(r);let a=!!(i.status===302&&i.headers.get(`location`)?.includes(`cloudflareaccess.com`));return t.debug(`Caching access switch for:`,e),R.set(e,a),a}catch{return R.set(e,!1),!1}}N(Ze,`domainUsesAccess`);async function Qe(e,t){let n=t.logger,r=t.isNonInteractiveOrCI,i=Ke(),a=qe();if(i&&a){n.debug(`Using Access Service Token headers for domain:`,e);let t={"CF-Access-Client-Id":i,"CF-Access-Client-Secret":a};return L[e]=t,t}if((i!==void 0||a!==void 0)&&n.warn(`Both CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET must be set to use Access Service Token authentication. Only ${i===void 0?`CLOUDFLARE_ACCESS_CLIENT_SECRET`:`CLOUDFLARE_ACCESS_CLIENT_ID`} was found.`),!await Ze(e,n))return{};if(n.debug(`Getting Access headers for domain:`,e),L[e])return n.debug(`Using cached Access headers for domain:`,e),L[e];if(r())throw new h(`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=Se(`cloudflared`,[`access`,`login`,e]);if(o.error)throw new h("To use Wrangler 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.toString();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 L[e]=t,n.debug(`Caching Access headers for domain:`,e),t}throw Error(`Failed to authenticate with Cloudflare Access`)}N(Qe,`getAccessHeaders`);async function $e(e){let t=Je();return t===void 0?Qe(I(),e):(e.logger.debug(`Using WRANGLER_CF_AUTHORIZATION_TOKEN from environment`),{Cookie:`CF_Authorization=${t}`})}N($e,`getCloudflareAccessHeaders`);var et=96,tt=32,nt=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`;function rt(e){let t=btoa(e);return t=t.replace(/\+/g,`-`),t=t.replace(/\//g,`_`),t=t.replace(/=/g,``),t}N(rt,`base64urlEncode`);async function it(){let e=new Uint32Array(et);De.getRandomValues(e);let t=rt(Array.from(e).map(e=>nt[e%nt.length]).join(``)),n=await De.subtle.digest(`SHA-256`,new ke().encode(t)),r=new Uint8Array(n),i=``,a=r.byteLength;for(let e=0;e<a;e++)i+=String.fromCharCode(r[e]);return{codeChallenge:rt(i),codeVerifier:t}}N(it,`generatePKCECodes`);var at=N(({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 ot(e){let t=new Uint32Array(e);return De.getRandomValues(t),Array.from(t).map(e=>nt[e%nt.length]).join(``)}N(ot,`generateRandomState`);var st=64e6;function ct(e,t,n){let r=Array(t+1),i=Te(`sha256`).update(e).digest();r[0]=i;for(let e=0;e<t;e++){for(let e=0;e<n;e++)i=Te(`sha256`).update(i).digest();r[e+1]=i}return r}N(ct,`solvePow`);function lt(e){return Buffer.concat(e).toString(`base64`)}N(lt,`encodeCheckpoints`);function ut(e){let t=ct(Buffer.from(e.seed,`base64url`),e.k,e.g);return{challengeToken:e.challengeToken,solution:{checkpoints:lt(t)}}}N(ut,`solveChallenge`);var z={termsOfService:`https://www.cloudflare.com/terms/`,privacyPolicy:`https://www.cloudflare.com/privacypolicy/`},dt=`You must accept Cloudflare's Terms of Service (${z.termsOfService}) and Privacy Policy (${z.privacyPolicy}) in order to continue. By typing "yes", you agree to these terms. Type "yes" to continue.`,ft=`Continuing means you accept Cloudflare's Terms of Service (${z.termsOfService}) and Privacy Policy (${z.privacyPolicy}).`,pt=`You must accept Cloudflare's Terms of Service (${z.termsOfService}) and Privacy Policy (${z.privacyPolicy}) to use --temporary.`;function mt(){return`${v(b)}/provisioning/previews`}N(mt,`getTemporaryPreviewUrl`);function ht(){return`${mt()}/challenge`}N(ht,`getTemporaryPreviewChallengeUrl`);function gt(e){let t=Date.parse(e);return!Number.isNaN(t)&&t>Date.now()}N(gt,`isFutureTimestamp`);function _t(e){let t=e.read();if(t&&!(!t.account?.id||!t.account?.apiToken||!t.account?.name||!t.claim?.url||!gt(t.account?.expiresAt??``)||!gt(t.claim?.expiresAt??``)))return t}N(_t,`getCachedTemporaryPreviewAccount`);async function vt(e){let t=await(0,P.fetch)(ht(),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok)throw new l(`Failed to request a proof-of-work challenge (${t.status} ${t.statusText}).`,{telemetryMessage:`deploy temporary account challenge failed`});let n;try{n=await t.json()}catch{throw new l(`Failed to request a proof-of-work challenge. Received an invalid response (${t.status} ${t.statusText}).`,{telemetryMessage:`deploy temporary account challenge invalid response`})}let{challengeToken:r,seed:i,k:a,g:o}=n.result??{};if(r===void 0||i===void 0||a===void 0||o===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(a)||!Number.isInteger(o)||a<=0||o<=0||a*o>st||Buffer.from(i,`base64url`).length!==32)throw new l(`The proof-of-work challenge is not supported by this version of Wrangler.`,{telemetryMessage:`deploy temporary account challenge difficulty unsupported`});return e.log(`Solving proof-of-work challenge…`),ut({challengeToken:r,seed:i,k:a,g:o})}N(vt,`requestPowSolution`);async function yt(e){let t=await vt(e),n=await(0,P.fetch)(mt(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({termsOfService:z.termsOfService,privacyPolicy:z.privacyPolicy,acceptTermsOfService:`yes`,challengeToken:t.challengeToken,solution:t.solution})});if(!n.ok)throw new l(`Failed to create a temporary preview account (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account create failed`});let r;try{r=await n.json()}catch{throw new l(`Failed to create a temporary preview account. Received an invalid response (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account invalid response`})}let i=r.result,a=i?.account?.id,o=i?.account?.name,s=i?.account?.apiToken,c=i?.account?.expiresAt,u=i?.claim?.url,d=i?.claim?.expiresAt;if(a===void 0||o===void 0||s===void 0||c===void 0||u===void 0||d===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`});return{account:{id:a,name:o,apiToken:s,expiresAt:c},claim:{url:u,expiresAt:d}}}N(yt,`createTemporaryPreviewAccount`);async function bt(e){let t=_t(e.storage);if(t)return{account:t,cached:!0};if(!await e.prompt(dt,ft))throw new h(pt,{telemetryMessage:`user temporary terms not accepted`});let n=await yt(e.logger);return e.storage.write(n),{account:n,cached:!1}}N(bt,`getOrCreateTemporaryPreviewAccount`);function xt(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(`
8
- [ ]{`+Math.min.apply(Math,r)+`}`,`g`);n=n.map(function(e){return e.replace(i,`
9
- `)})}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(`
10
- `)&&(o=String(e).split(`
11
- `).map(function(e,t){return t===0?e:``+i+e}).join(`
12
- `)),a+=o+n[t+1]}),a}N(xt,`dedent`);var St=xt,B=class extends h{static{N(this,`ErrorOAuth2`)}code;description;uri;toString(){return`ErrorOAuth2`}},Ct=class extends B{static{N(this,`ErrorUnknown`)}toString(){return`ErrorUnknown`}},wt=class extends B{static{N(this,`ErrorNoAuthCode`)}toString(){return`ErrorNoAuthCode`}},Tt=class extends B{static{N(this,`ErrorInvalidReturnedStateParam`)}toString(){return`ErrorInvalidReturnedStateParam`}},Et=class extends B{static{N(this,`ErrorInvalidJson`)}toString(){return`ErrorInvalidJson`}},Dt=class extends B{static{N(this,`ErrorInvalidScope`)}toString(){return`ErrorInvalidScope`}},Ot=class extends B{static{N(this,`ErrorInvalidRequest`)}toString(){return`ErrorInvalidRequest`}},kt=class extends B{static{N(this,`ErrorInvalidToken`)}toString(){return`ErrorInvalidToken`}},At=class extends B{static{N(this,`ErrorAuthenticationGrant`)}toString(){return`ErrorAuthenticationGrant`}},jt=class extends At{static{N(this,`ErrorUnauthorizedClient`)}toString(){return`ErrorUnauthorizedClient`}},Mt=class extends At{static{N(this,`ErrorAccessDenied`)}toString(){return`ErrorAccessDenied`}},Nt=class extends At{static{N(this,`ErrorUnsupportedResponseType`)}toString(){return`ErrorUnsupportedResponseType`}},Pt=class extends At{static{N(this,`ErrorServerError`)}toString(){return`ErrorServerError`}},Ft=class extends At{static{N(this,`ErrorTemporarilyUnavailable`)}toString(){return`ErrorTemporarilyUnavailable`}},It=class extends B{static{N(this,`ErrorAccessTokenResponse`)}toString(){return`ErrorAccessTokenResponse`}},Lt=class extends It{static{N(this,`ErrorInvalidClient`)}toString(){return`ErrorInvalidClient`}},Rt=class extends It{static{N(this,`ErrorInvalidGrant`)}toString(){return`ErrorInvalidGrant`}},zt=class extends It{static{N(this,`ErrorUnsupportedGrantType`)}toString(){return`ErrorUnsupportedGrantType`}};function Bt(e,t,n){let r=`OAuth error: ${e}`;return t&&(r+=`
13
- ${t}`),n&&(r+=`
14
- See: ${n}`),r}N(Bt,`formatOAuthErrorMessage`);function Vt(e,t,n){let r=Bt(e,t,n),i;switch(e){case`invalid_request`:i=new Ot(r,{telemetryMessage:`user oauth invalid request`});break;case`invalid_grant`:i=new Rt(r,{telemetryMessage:`user oauth invalid grant`});break;case`unauthorized_client`:i=new jt(r,{telemetryMessage:`user oauth unauthorized client`});break;case`access_denied`:i=new Mt(r,{telemetryMessage:`user oauth access denied`});break;case`unsupported_response_type`:i=new Nt(r,{telemetryMessage:`user oauth unsupported response type`});break;case`invalid_scope`:i=new Dt(r,{telemetryMessage:`user oauth invalid scope`});break;case`server_error`:i=new Pt(r,{telemetryMessage:`user oauth server error`});break;case`temporarily_unavailable`:i=new Ft(r,{telemetryMessage:`user oauth temporarily unavailable`});break;case`invalid_client`:i=new Lt(r,{telemetryMessage:`user oauth invalid client`});break;case`unsupported_grant_type`:i=new zt(r,{telemetryMessage:`user oauth unsupported grant type`});break;case`invalid_json`:i=new Et(r,{telemetryMessage:`user oauth invalid json`});break;case`invalid_token`:i=new kt(r,{telemetryMessage:`user oauth invalid token`});break;default:i=new Ct(r,{telemetryMessage:`user oauth unknown error`});break}return i.code=e,i.description=t,i.uri=n,i}N(Vt,`toErrorClass`);function Ht(e,t,n){if(e.error)throw Vt(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 r=e.code;if(!r)return!1;if(e.state!==t.stateQueryParam)throw n.warn(`Received query string parameter doesn't match the one sent! Possible malicious activity somewhere.`),new Tt(``,{telemetryMessage:`user oauth invalid returned state`});return ye(!Array.isArray(r)),t.authorizationCode=r,t.hasAuthCodeBeenExchangedForAccessToken=!1,!0}N(Ht,`isReturningFromAuthServer`);async function Ut(e,t,n,r,i){let{codeChallenge:a,codeVerifier:o}=await it(),s=i.generateRandomState(tt);return Object.assign(r,{codeChallenge:a,codeVerifier:o,stateQueryParam:s}),i.generateAuthUrl({authUrl:He(),clientId:t,scopes:e,stateQueryParam:s,codeChallenge:a,redirectUri:n})}N(Ut,`getAuthURL`);async function Wt(e,t,n,r){let i=F({warningLogger:e,storage:r}).refreshToken;i||e.warn(`No refresh token is present.`);let a=await Kt(new URLSearchParams({grant_type:`refresh_token`,refresh_token:i?.value??``,client_id:n}),e,t);if(a.status>=400){let t;try{t=await qt(a,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}else try{let t=await qt(a,e);if(`error`in t)throw t.error;let{access_token:n,expires_in:r,refresh_token:o,scope:s}=t;return{token:{value:n,expiry:new Date(Date.now()+r*1e3).toISOString()},scopes:s?s.split(` `):[],refreshToken:o?{value:o}:i}}catch(e){throw typeof e==`string`?Vt(e):e}}N(Wt,`exchangeRefreshTokenForAccessToken`);async function Gt(e,t,n,r,i){let{authorizationCode:a,codeVerifier:o=``}=e;o?a||t.warn(`No authorization grant code is being passed.`):t.warn(`No code verifier is being sent.`);let s=await Kt(new URLSearchParams({grant_type:`authorization_code`,code:a??``,redirect_uri:i,client_id:r,code_verifier:o}),t,n);if(!s.ok){let{error:e}=await qt(s,t);throw e===`invalid_grant`&&t.log(`Expired! Auth code or refresh token needs to be renewed.`),Vt(e)}let c=await qt(s,t);if(`error`in c)throw Vt(c.error);let{access_token:l,expires_in:u,refresh_token:d,scope:f}=c;return e.hasAuthCodeBeenExchangedForAccessToken=!0,{token:{value:l,expiry:new Date(Date.now()+u*1e3).toISOString()},scopes:f?f.split(` `):[],refreshToken:d?{value:d}:void 0}}N(Gt,`exchangeAuthCodeForAccessToken`);async function Kt(e,t,n){let r={"Content-Type":`application/x-www-form-urlencoded`};if(t.debug(`fetching auth token`,`grant_type=${e.get(`grant_type`)??`<unknown>`}`),await Ze(I(),t)){t.debug(`Using Cloudflare Access to get an access token for the auth request`);let e=await $e({logger:t,isNonInteractiveOrCI:n});Object.assign(r,e)}t.debug(`Fetching auth token from`,Ue());try{let n=await(0,P.fetch)(Ue(),{method:`POST`,body:e.toString(),headers:r});return n.ok||t.debug(`Failed to fetch auth token:`,n.status,n.statusText),n}catch(e){throw t.debug(`Failed to fetch auth token:`,e),e}}N(Kt,`fetchAuthToken`);async function qt(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
15
-
16
- `,n),Error(`Invalid JSON in response: status: ${e.status} ${e.statusText}`,{cause:r})}}N(qt,`getJSONFromResponse`);async function Jt(e,t,n,r){let i=await Ut(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 h(`Timed out waiting for authorization code, please try again.`,{telemetryMessage:`user oauth authorization timeout`}))},12e4)}),l=new Promise((r,i)=>{o=Oe.createServer(async(c,l)=>{function u(e,t){clearTimeout(s),l.writableEnded||l.end(),o.close(n=>{t||n?i(t||n):(ye(e),r(e))})}N(u,`finish`);function d(e){let t=N(e=>e.replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e]),`escape`),n=`<!doctype html>
17
- <html lang="en">
18
- <head>
19
- <meta charset="utf-8" />
20
- <title>Wrangler login failed</title>
21
- <style>
22
- 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; }
23
- h1 { color: #c12d3f; }
24
- code { background: #f5f7fa; padding: 0.15em 0.3em; border-radius: 3px; }
25
- p.detail { background: #f5f7fa; padding: 1rem; border-radius: 4px; white-space: pre-wrap; }
26
- </style>
27
- </head>
28
- <body>
29
- <h1>Wrangler login failed</h1>
30
- <p>The Cloudflare OAuth provider returned an error.</p>
31
- ${e.code?`<p>Code: <code>${t(e.code)}</code></p>`:``}
32
- ${e.description?`<p class="detail">${t(e.description)}</p>`:``}
33
- <p>You can close this tab and return to your terminal for more details.</p>
34
- </body>
35
- </html>`;l.writeHead(400,{"Content-Type":`text/html; charset=utf-8`}),l.end(n)}N(d,`renderErrorPage`),ye(c.url,`This request doesn't have a URL`);let{pathname:f,query:p}=Ae.parse(c.url,!0);if(c.method!==`GET`)return l.end(`OK`);switch(f){case a:{let r=!1;try{r=Ht(p,t,n.logger)}catch(t){if(t instanceof Mt){l.writeHead(307,{Location:e.denied.url}),l.end(()=>{u(null,new h(e.denied.error,{telemetryMessage:`user oauth consent denied`}))});return}let n=t;d({code:n.code,description:n.description??n.message}),u(null,n);return}if(!r){let e=`The Cloudflare OAuth provider did not return an authorisation code.`;d({description:e}),u(null,new wt(e,{telemetryMessage:`user oauth missing auth code`}));return}try{let r=await Gt(t,n.logger,n.isNonInteractiveOrCI,e.clientId,e.redirectUri);l.writeHead(307,{Location:e.granted.url}),l.end(()=>{u(r)})}catch(e){let t=e,n=t instanceof B;d({code:n?t.code:void 0,description:(n?t.description:void 0)??t.message??`Failed to exchange the authorisation code for an access token.`}),u(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}\`.
36
- 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 h(`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])}N(Jt,`getOauthToken`);function Yt(e){let t={},n={generateAuthUrl:e.generateAuthUrl??at,generateRandomState:e.generateRandomState??ot},r=`default`;function i(t){return e.storageFactory(t??r)}N(i,`getStorage`);let a=N(()=>typeof e.clientId==`function`?e.clientId():e.clientId,`getClientId`),o=e.consent,s=!1,c,l=new URL(e.redirectUri),u=l.hostname,d=Number(l.port);async function f(r){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 s=ie(r.complianceConfig);if(s===`fedramp_high`)throw new h(St`
37
- OAuth login is not supported in the \`${s}\` compliance region.
38
- Please use a Cloudflare API token (\`CLOUDFLARE_API_TOKEN\` environment variable) or remove the ${r.complianceConfig?.compliance_region?"`compliance_region` configuration property":"`CLOUDFLARE_API_ENVIRONMENT` environment variable"}.
39
- `,{telemetryMessage:`user login unsupported compliance region`});e.logger.log(`Attempting to login via OAuth...`);let c=await Jt({browser:r.browser??!0,scopes:r.scopes,clientId:a(),redirectUri:e.redirectUri,denied:o.denied,granted:o.granted,callbackHost:r.callbackHost??u,callbackPort:r.callbackPort??d},t,e,n);return i(r.profile).write({oauth_token:c.token?.value??``,expiration_time:c.token?.expiry,refresh_token:c.refreshToken?.value,scopes:c.scopes}),e.logger.log(`Successfully logged in.`),x(),e.purgeOnLoginOrLogout?.(),!0}N(f,`login`);function p(t){if(e.hasEnvCredentials())return!1;let{accessToken:n}=F({warningLogger:e.logger,storage:i(t)});return!!(n&&new Date>=new Date(n.expiry))}N(p,`isRefreshNeeded`);async function m(t){let n=i(t);try{let{token:{value:t,expiry:r}={value:``,expiry:``},refreshToken:{value:i}={},scopes:o}=await Wt(e.logger,e.isNonInteractiveOrCI,a(),n);return n.write({oauth_token:t,expiration_time:r,refresh_token:i,scopes:o}),!0}catch(t){return e.logger.debug(`Token refresh failed: ${t instanceof Error?t.message:String(t)}`),!1}}N(m,`refreshToken`);async function ee(t){if(e.hasEnvCredentials())return{loggedIn:!0};let n=F({warningLogger:e.logger,storage:i(t.profile)});return!n.accessToken&&!n.deprecatedApiToken?e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`no-credentials-non-interactive`}:await f(t)?{loggedIn:!0}:{loggedIn:!1,reason:`no-credentials-login-failed`}:p(t.profile)?await m(t.profile)?{loggedIn:!0}:e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`token-expired-non-interactive`}:await f(t)?{loggedIn:!0}:{loggedIn:!1,reason:`token-expired-login-failed`}:{loggedIn:!0}}N(ee,`loginOrRefreshIfRequired`);async function g(t){let n=x();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=F({warningLogger:e.logger,storage:i(t)}).refreshToken;if(!r){e.logger.log(n?`Cleared temporary preview account.`:`Not logged in, exiting...`);return}let o=`client_id=${encodeURIComponent(a())}&token_type_hint=refresh_token&token=${encodeURIComponent(r.value||``)}`;await(await(0,P.fetch)(We(),{method:`POST`,body:o,headers:{"Content-Type":`application/x-www-form-urlencoded`}})).text(),i(t).clear(),e.logger.log(`Successfully logged out.`),e.purgeOnLoginOrLogout?.()}N(g,`logout`);async function te(){let t=F({warningLogger:e.logger,storage:i()});if(t.accessToken){if(t.accessToken&&new Date>=new Date(t.accessToken.expiry)){if(!await m())return;t=F({warningLogger:e.logger,storage:i()})}return t.accessToken?.value}}N(te,`getOAuthTokenFromLocalState`);function _(){return c?{apiToken:c.account.apiToken}:Be({storage:i(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}N(_,`getAPITokenInternal`);function v(){return c?{apiToken:c.account.apiToken}:Ve({storage:i(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}N(v,`requireApiTokenInternal`);function ne(t){s=t&&e.temporary!==void 0,c=void 0}N(ne,`setTemporaryAllowed`);function y(){return s}N(y,`isTemporaryAllowed`);function re(){return c}N(re,`getActiveTemporaryAccount`);async function b(){if(!e.temporary)throw new h(`Temporary preview accounts are not supported by this CLI.`,{telemetryMessage:`user temporary account unsupported`});let t=await bt({...e.temporary,logger:e.logger});return c=t.account,t}N(b,`activateTemporaryAccount`);function x(){return c=void 0,e.temporary?.storage.clear()??!1}N(x,`clearTemporaryAccount`);function S(e){r=e}N(S,`setProfile`);function C(){return r}N(C,`getActiveProfile`);function w(){return F({warningLogger:e.logger,storage:i()}).scopes}return N(w,`getScopes`),{setProfile:S,getActiveProfile:C,login:f,logout:g,loginOrRefreshIfRequired:ee,getOAuthTokenFromLocalState:te,getAPIToken:_,requireApiToken:v,getScopes:w,setTemporaryAllowed:ne,isTemporaryAllowed:y,getActiveTemporaryAccount:re,activateTemporaryAccount:b}}N(Yt,`createOAuthFlow`);var Xt=[`default`,`staging`];function Zt(e){let t={read(){return e.bindings.read()},write(t){e.bindings.write(t)},activate(t,n){let r=M.resolve(n),i=e.bindings.read();i[r]=t,e.bindings.write(i)},deactivate(t){let n=M.resolve(t),r=e.bindings.read(),i=r[n];if(i===void 0){let e=en(n,r);throw e?new h(`No profile is directly bound to "${$t(n)}". The active profile "${e.profile}" is bound at "${$t(e.dir)}". Run \`wrangler auth deactivate\` from that directory instead.`,{telemetryMessage:`auth deactivate wrong directory`}):new h(`No profile is bound to "${$t(n)}". Nothing to deactivate.`,{telemetryMessage:`auth deactivate no binding`})}delete r[n],e.bindings.write(r);let a=en(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 en(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`:(Qt(e.profile),e.profile):t.getProfileForDirectory(e.cwd)||`default`}}}N(Zt,`createProfileStore`);function Qt(e){if(Xt.includes(e.toLowerCase()))throw new h(`"${e}" is a reserved profile name. Use \`wrangler login\` and \`wrangler logout\` 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 h(`Invalid profile name "${e}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`,{telemetryMessage:`auth profile invalid name`})}N(Qt,`validateProfileName`);function $t(e){return M.relative(process.cwd(),e)||`.`}N($t,`formatDirectoryForUserError`);function en(e,t){let n=M.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]===M.sep)return{profile:t,dir:e}}N(en,`getProfileForDirectoryFromBindings`);function tn(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}N(tn,`getLineColFromPtr`);function nn(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
40
- `,e===t&&(i+=` `.repeat(a+n+2),i+=`^
41
- `))}return i}N(nn,`makeCodeBlock`);var V=class extends Error{static{N(this,`TomlError`)}line;column;codeblock;constructor(e,t){let[n,r]=tn(t.toml,t.ptr),i=nn(t.toml,n,r);super(`Invalid TOML document: ${e}
42
-
43
- ${i}`,t),this.line=n,this.column=r,this.codeblock=i}};function rn(e,t){let n=0;for(;e[t-++n]===`\\`;);return--n&&n%2}N(rn,`isEscaped`);function an(e,t=0,n=e.length){let r=e.indexOf(`
44
- `,t);return e[r-1]===`\r`&&r--,r<=n?r:-1}N(an,`indexOfNewline`);function on(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r===`
45
- `)return n;if(r===`\r`&&e[n+1]===`
46
- `)return n+1;if(r<` `&&r!==` `||r===``)throw new V(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}N(on,`skipComment`);function H(e,t,n,r){let i;for(;(i=e[t])===` `||i===` `||!n&&(i===`
47
- `||i===`\r`&&e[t+1]===`
48
- `);)t++;return r||i!==`#`?t:H(e,on(e,t),n)}N(H,`skipVoid`);function sn(e,t,n,r,i=!1){if(!r)return t=an(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=an(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
49
- `||t===`\r`&&e[a+1]===`
50
- `))return a}throw new V(`cannot find end of structure`,{toml:e,ptr:t})}N(sn,`skipUntil`);function cn(e,t){let n=e[t],r=n===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):n;t+=r.length-1;do t=e.indexOf(r,++t);while(t>-1&&n!==`'`&&rn(e,t));return t>-1&&(t+=r.length,r.length>1&&(e[t]===n&&t++,e[t]===n&&t++)),t}N(cn,`getStringEnd`);var ln=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i,un=class e extends Date{static{N(this,`TomlDate`)}#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(ln);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}},dn=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,fn=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,pn=/^[+-]?0[0-9_]/,mn=/^[0-9a-f]{4,8}$/i,hn={b:`\b`,t:` `,n:`
51
- `,f:`\f`,r:`\r`,'"':`"`,"\\":`\\`};function gn(e,t=0,n=e.length){let r=e[t]===`'`,i=e[t++]===e[t]&&e[t]===e[t+1];i&&(n-=2,e[t+=2]===`\r`&&t++,e[t]===`
52
- `&&t++);let a=0,o,s=``,c=t;for(;t<n-1;){let n=e[t++];if(n===`
53
- `||n===`\r`&&e[t]===`
54
- `){if(!i)throw new V(`newlines are not allowed in strings`,{toml:e,ptr:t-1})}else if(n<` `&&n!==` `||n===``)throw new V(`control characters are not allowed in strings`,{toml:e,ptr:t-1});if(o){if(o=!1,n===`u`||n===`U`){let r=e.slice(t,t+=n===`u`?4:8);if(!mn.test(r))throw new V(`invalid unicode escape`,{toml:e,ptr:a});try{s+=String.fromCodePoint(parseInt(r,16))}catch{throw new V(`invalid unicode escape`,{toml:e,ptr:a})}}else if(i&&(n===`
55
- `||n===` `||n===` `||n===`\r`)){if(t=H(e,t-1,!0),e[t]!==`
56
- `&&e[t]!==`\r`)throw new V(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:a});t=H(e,t)}else if(n in hn)s+=hn[n];else throw new V(`unrecognized escape sequence`,{toml:e,ptr:a});c=t}else !r&&n===`\\`&&(a=t-1,o=!0,s+=e.slice(c,a))}return s+e.slice(c,n-1)}N(gn,`parseString`);function _n(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=dn.test(e);if(i||fn.test(e)){if(pn.test(e))throw new V(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new V(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new V(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new un(e);if(!a.isValid())throw new V(`invalid value`,{toml:t,ptr:n});return a}N(_n,`parseValue`);function vn(e,t,n,r){let i=e.slice(t,n),a=i.indexOf(`#`);a>-1&&(on(e,a),i=i.slice(0,a));let o=i.trimEnd();if(!r){let n=i.indexOf(`
57
- `,o.length);if(n>-1)throw new V(`newlines are not allowed in inline tables`,{toml:e,ptr:t+n})}return[o,a]}N(vn,`sliceAndTrimEndOf`);function yn(e,t,n,r,i){if(r===0)throw new V(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?Cn(e,t,r,i):Sn(e,t,r,i),c=n?sn(e,s,`,`,n):s;if(s-c&&n===`}`){let t=an(e,s,c);if(t>-1)throw new V(`newlines are not allowed in inline tables`,{toml:e,ptr:t})}return[o,c]}let o;if(a===`"`||a===`'`){o=cn(e,t);let r=gn(e,t,o);if(n){if(o=H(e,o,n!==`]`),e[o]&&e[o]!==`,`&&e[o]!==n&&e[o]!==`
58
- `&&e[o]!==`\r`)throw new V(`unexpected character encountered`,{toml:e,ptr:o});o+=+(e[o]===`,`)}return[r,o]}o=sn(e,t,`,`,n);let s=vn(e,t,o-+(e[o-1]===`,`),n===`]`);if(!s[0])throw new V(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=H(e,t+s[1]),o+=+(e[o]===`,`)),[_n(s[0],e,t,i),o]}N(yn,`extractValue`);var bn=/^[a-zA-Z0-9-_]+[ \t]*$/;function xn(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new V(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `)if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new V(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let s=cn(e,t);if(s<0)throw new V(`unfinished string encountered`,{toml:e,ptr:t});r=e.indexOf(`.`,s);let c=e.slice(s,r<0||r>a?a:r),l=an(c);if(l>-1)throw new V(`newlines are not allowed in keys`,{toml:e,ptr:t+r+l});if(c.trimStart())throw new V(`found extra tokens after the string part`,{toml:e,ptr:s});if(a<s&&(a=e.indexOf(n,s),a<0))throw new V(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(gn(e,t,s))}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!bn.test(n))throw new V(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}while(r+1&&r<a);return[i,H(e,a+1,!0,!0)]}N(xn,`parseKey`);function Sn(e,t,n,r){let i={},a=new Set,o,s=0;for(t++;(o=e[t++])!==`}`&&o;){let c={toml:e,ptr:t-1};if(o===`
59
- `)throw new V(`newlines are not allowed in inline tables`,c);if(o===`#`)throw new V(`inline tables cannot contain comments`,c);if(o===`,`)throw new V(`expected key-value, found comma`,c);if(o!==` `&&o!==` `){let o,c=i,l=!1,[u,d]=xn(e,t-1);for(let n=0;n<u.length;n++){if(n&&(c=l?c[o]:c[o]={}),o=u[n],(l=Object.hasOwn(c,o))&&(typeof c[o]!=`object`||a.has(c[o])))throw new V(`trying to redefine an already defined value`,{toml:e,ptr:t});!l&&o===`__proto__`&&Object.defineProperty(c,o,{enumerable:!0,configurable:!0,writable:!0})}if(l)throw new V(`trying to redefine an already defined value`,{toml:e,ptr:t});let[f,p]=yn(e,d,`}`,n-1,r);a.add(f),c[o]=f,t=p,s=e[t-1]===`,`?t-1:0}}if(s)throw new V(`trailing commas are not allowed in inline tables`,{toml:e,ptr:s});if(!o)throw new V(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}N(Sn,`parseInlineTable`);function Cn(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new V(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=on(e,t);else if(a!==` `&&a!==` `&&a!==`
60
- `&&a!==`\r`){let a=yn(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new V(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}N(Cn,`parseArray`);function wn(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}N(wn,`peekTable`);function Tn(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=H(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=xn(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new V(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=wn(n[0],r,i,t?2:1);if(!c)throw new V(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=xn(e,s),i=wn(r[0],a,o,0);if(!i)throw new V(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=yn(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=H(e,s,!0),e[s]&&e[s]!==`
61
- `&&e[s]!==`\r`)throw new V(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=H(e,s)}return r}N(Tn,`parse`);var En=/^[a-z0-9-_]+$/i;function U(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}N(U,`extendedTypeOf`);function Dn(e){for(let t=0;t<e.length;t++)if(U(e[t])!==`object`)return!1;return e.length!=0}N(Dn,`isArrayOfTables`);function On(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}N(On,`formatString`);function kn(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:r&&Number.isInteger(e)?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return On(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return An(e,n,r);if(t===`array`)return jn(e,n,r)}N(kn,`stringifyValue`);function An(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=En.test(o)?o:On(o),i+=` = `,i+=kn(e[o],U(e[o]),t-1,n)}return i+` }`}N(An,`stringifyInlineTable`);function jn(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=kn(e[i],U(e[i]),t-1,n)}return r+` ]`}N(jn,`stringifyArray`);function Mn(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
62
- `}[[${t}]]
63
- `,i+=Nn(0,e[a],t,n,r);return i}N(Mn,`stringifyArrayTable`);function Nn(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=U(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=En.test(c)?c:On(c);if(e===`array`&&Dn(t[c]))o+=(o&&`
64
- `)+Mn(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
65
- `)+Nn(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=kn(t[c],e,r,i),a+=`
66
- `}}return e&&(a||!o)&&(a=a?`[${e}]
67
- ${a}`:`[${e}]`),a&&o?`${a}
68
- ${o}`:a||o}N(Nn,`stringifyTable`);function Pn(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(U(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=Nn(0,e,``,t,n);return r[r.length-1]===`
69
- `?r:r+`
70
- `}N(Pn,`stringify`);var Fn={parse:Tn,stringify:Pn,TomlDate:un,TomlError:V},In={toml:{parse:N(e=>ee(e),`parse`),stringify:N(e=>Fn.stringify(e),`stringify`)},json:{parse:N(e=>JSON.parse(e),`parse`),stringify:N(e=>JSON.stringify(e,null,` `),`stringify`)}};function W(e,t){return In[e].parse(t)}N(W,`parseFile`);function Ln(e,t){return In[e].stringify(t)}N(Ln,`stringifyFile`);var Rn=`config`;function zn(e){if(e===void 0||e===`default`){let e=g();return e===`production`?`default`:e}return Qt(e),e}N(zn,`resolveAuthProfileBaseName`);function Bn(e,t,n=`toml`){return M.join(e,Rn,`${zn(t)}.${n}`)}N(Bn,`getAuthConfigFilePath`);var Vn=class{constructor(e,t,n=`toml`){this.configPath=e,this.profile=t,this.format=n}static{N(this,`FileCredentialStore`)}kind=`file`;filePath(){return Bn(this.configPath,this.profile,this.format)}read(){let e=this.filePath();if(O(e))return W(this.format,s(e))}write(e){let t=this.filePath();k(M.dirname(t),{recursive:!0}),j(t,Ln(this.format,e),{encoding:`utf-8`,mode:384}),he(t,384)}clear(){let e=this.filePath(),t=O(e);return t&&A(e),t}path(){return this.filePath()}describe(){return this.filePath()}},Hn=32,Un=12,Wn=16,Gn=`AES-256-GCM`,Kn=`aes-256-gcm`;function qn(){return new Uint8Array(Ee(Hn))}N(qn,`generateKey`);function Jn(e,t){if(t.length!==Hn)throw Error(`AES-256-GCM requires a ${Hn}-byte key (got ${t.length} bytes).`);let n=Ee(Un),r=Ce(Kn,t,n),i=Buffer.concat([r.update(e,`utf-8`),r.final()]),a=r.getAuthTag();return{v:1,alg:Gn,iv:n.toString(`base64`),tag:a.toString(`base64`),ciphertext:i.toString(`base64`)}}N(Jn,`encryptString`);function Yn(e,t){if(t.length!==Hn)throw Error(`AES-256-GCM requires a ${Hn}-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!==Un)throw Error(`Expected ${Un}-byte IV in envelope (got ${n.length} bytes).`);if(r.length!==Wn)throw Error(`Expected ${Wn}-byte auth tag in envelope (got ${r.length} bytes).`);let a=we(Kn,t,n);return a.setAuthTag(r),Buffer.concat([a.update(i),a.final()]).toString(`utf-8`)}N(Yn,`decryptString`);function Xn(e){if(typeof e!=`object`||!e)return;let t=e;if(!(t.v!==1||t.alg!==Gn||typeof t.iv!=`string`||typeof t.tag!=`string`||typeof t.ciphertext!=`string`))return t}N(Xn,`parseEncryptedEnvelope`);function G(e,t){return M.join(e,`config`,`${zn(t)}.enc`)}N(G,`getEncryptedAuthConfigFilePath`);var Zn=class{constructor(e,t,n,r,i=`toml`){this.configPath=e,this.keyProvider=t,this.onPlaintextMigration=n,this.profile=r,this.format=i}static{N(this,`EncryptedFileCredentialStore`)}kind=`encrypted-file`;plaintextPath(){return Bn(this.configPath,this.profile,this.format)}read(){let e=G(this.configPath,this.profile);if(O(e))return this.readEncryptedFile(e);let t=this.plaintextPath();if(O(t))return this.migrateFromPlaintext(t,e)}write(e){let t=this.ensureKey(),n=Jn(Ln(this.format,e),t),r=G(this.configPath,this.profile);k(M.dirname(r),{recursive:!0}),j(r,JSON.stringify(n,null,` `),{encoding:`utf-8`,mode:384}),he(r,384);let i=this.plaintextPath();O(i)&&A(i)}clear(){let e=G(this.configPath,this.profile),t=this.plaintextPath(),n=!1;O(e)&&(A(e),n=!0),O(t)&&(A(t),n=!0);try{this.keyProvider.deleteKey()}catch{}return n}path(){return G(this.configPath,this.profile)}describe(){return`Encrypted file (${G(this.configPath,this.profile)}) with key in ${this.keyProvider.describe()}`}readEncryptedFile(e){let t=this.keyProvider.getKey();if(t===void 0)return;let n=s(e),r;try{r=Xn(JSON.parse(n))}catch{return}if(r===void 0)return;let i;try{i=Yn(r,t)}catch{return}try{return W(this.format,i)}catch{return}}migrateFromPlaintext(e,t){let n=s(e),r;try{r=W(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=qn();return this.keyProvider.setKey(t),t}},Qn=`1.3.0`;function $n(e){return Se(`npm`,e,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],shell:process.platform===`win32`})}N($n,`defaultNpmRunner`);var er=$n,K=new Map;function tr(e){er=e??$n,K.clear()}N(tr,`setNpmRunner`);function nr(e){return M.join(e,`native`,`keyring`)}N(nr,`getKeyringInstallDir`);function rr(e){return M.join(e,`node_modules`,`@napi-rs`,`keyring`)}N(rr,`getInstalledBindingPath`);function ir(e){let t=K.get(e);if(t!==void 0)return t;let n=rr(e);if(O(M.join(n,`index.js`)))return K.set(e,n),n;try{let t=er([`root`,`-g`]);if(t.status===0){let n=M.join(t.stdout.trim(),`@napi-rs`,`keyring`);if(O(M.join(n,`index.js`)))return K.set(e,n),n}}catch{}return K.set(e,null),null}N(ir,`findKeyringBinding`);function ar(e){let t=e;k(t,{recursive:!0});let n=M.join(t,`package.json`);O(n)||j(n,JSON.stringify({private:!0,name:`cloudflare-auth-keyring-host`},null,` `),`utf-8`);let r;try{r=er([`install`,`@napi-rs/keyring@${Qn}`,`--prefix`,t,`--no-save`,`--no-audit`,`--no-fund`,`--no-package-lock`,`--loglevel=error`])}catch(e){throw new h(`Failed to spawn \`npm\` to install the keyring backend: ${e instanceof Error?e.message:String(e)}
71
-
72
- Install \`npm\` and retry, or install the binding globally:
73
- npm install -g @napi-rs/keyring@${Qn}`,{telemetryMessage:`workers-auth keyring npm spawn failed`})}if(r.status!==0)throw new h(`Failed to install \`@napi-rs/keyring\` (npm exited ${r.status}):
74
- ${r.stderr?.trim()??`(no stderr)`}
75
-
76
- Retry once the underlying issue is fixed, or install the binding globally:
77
- npm install -g @napi-rs/keyring@${Qn}`,{telemetryMessage:`workers-auth keyring npm install failed`});K.delete(e)}N(ar,`installKeyringBindingSync`);var or;function sr(e){or=e}N(sr,`setKeyringEntryFactory`);var cr=me(import.meta.url);function lr(e){if(or!==void 0)return or;let t=ir(e);if(t===null)throw Error("`@napi-rs/keyring` binding not found. Call `installKeyringBindingSync()` first.");let n=cr(t);return(e,t)=>new n.Entry(e,t)}N(lr,`resolveKeyringEntryFactory`);function q(e){return zn(e)}N(q,`getKeyringAccountName`);function ur(e){let t={v:1,key:Buffer.from(e).toString(`base64`),created:new Date().toISOString()};return JSON.stringify(t)}N(ur,`encodeKeyEnvelope`);function dr(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}}N(dr,`decodeKeyEnvelope`);function fr(e,t={}){return Se(`secret-tool`,e,{encoding:`utf-8`,input:t.input})}N(fr,`defaultRunner`);var pr=fr,mr=void 0;function hr(e){pr=e??fr,mr=void 0}N(hr,`setLinuxSecretToolRunner`);function gr(){if(mr!==void 0)return mr;let e;try{e=pr([`--version`]).status===0}catch{e=!1}return mr=e,e}N(gr,`probeSecretTool`);var _r=class{constructor(e,t){this.serviceName=e,this.profile=t}static{N(this,`LinuxSecretToolKeyProvider`)}getKey(){let e=pr([`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 dr(e.stdout.trim())}}setKey(e){let t=pr([`store`,`--label=Cloudflare credentials key`,`service`,this.serviceName,`account`,q(this.profile)],{input:ur(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=pr([`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)})`}},vr=44;function yr(e,t={}){return Se(`/usr/bin/security`,e,{encoding:`utf-8`,input:t.input})}N(yr,`defaultRunner`);var br=yr;function xr(e){br=e??yr}N(xr,`setMacSecurityCommandRunner`);var Sr=class{constructor(e,t){this.serviceName=e,this.profile=t}static{N(this,`MacSecurityKeyProvider`)}getKey(){let e=br([`find-generic-password`,`-s`,this.serviceName,`-a`,q(this.profile),`-w`]);if(e.status!==vr){if(e.status!==0)throw Error(`Failed to read key from macOS Keychain (exit ${e.status}): ${e.stderr?.trim()??`(no stderr)`}`);return dr(e.stdout.trim())}}setKey(e){let t=br([`add-generic-password`,`-s`,this.serviceName,`-a`,q(this.profile),`-w`,ur(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=br([`delete-generic-password`,`-s`,this.serviceName,`-a`,q(this.profile)]);if(!(e.status===0||e.status===vr))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)})`}},Cr=class{constructor(e,t,n){this.serviceName=e,this.installDir=t,this.profile=n}static{N(this,`NapiKeyringKeyProvider`)}entry(){return lr(this.installDir)(this.serviceName,q(this.profile))}getKey(){let e=this.entry().getPassword();if(!(e===null||e===``))return dr(e)}setKey(e){this.entry().setPassword(ur(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)})`}},wr;function Tr(e){wr=e}N(Tr,`setKeyProviderFactoryForTesting`);function Er(e,t,n){if(wr!==void 0)return{kind:`available`,provider:wr(e,t)};switch(process.platform){case`darwin`:return{kind:`available`,provider:new Sr(e,t)};case`linux`:return gr()?{kind:`available`,provider:new _r(e,t)}:{kind:`unsupported`};case`win32`:{let r=nr(n);return ir(r)===null?{kind:`needs-install`,install:N(()=>ar(r),`install`),afterInstall:N(()=>new Cr(e,r,t),`afterInstall`)}:{kind:`available`,provider:new Cr(e,r,t)}}default:return{kind:`unsupported`}}}N(Er,`resolveKeyProvider`);var Dr={installFailedThisSession:!1,hasWarnedAboutKeyringFallback:!1,hasWarnedAboutSecretToolMissing:!1};function Or(){return Dr}N(Or,`getResolverSessionFlags`);function kr(){Dr.installFailedThisSession=!1,Dr.hasWarnedAboutKeyringFallback=!1,Dr.hasWarnedAboutSecretToolMissing=!1}N(kr,`resetCredentialStorageState`);function Ar(e){let t={...e,loginCommand:e.loginCommand??`your CLI login`,format:e.format??`toml`};function n(e){return jr(t,e)}N(n,`getActiveStore`);function r(e){return{read:N(()=>n(e).read(),`read`),write:N(t=>n(e).write(t),`write`),clear:N(()=>n(e).clear(),`clear`),path:N(()=>n(e).path(),`path`)}}return N(r,`storageFactory`),{storageFactory:r,getActiveStore:n}}N(Ar,`createCredentialStorageContext`);function jr(e,t){let n=Ye(),r=e.getConfigPath();if(n===!1)return new Vn(r,t,e.format);let i=n===!0;if(!(n??e.isKeyringEnabled()??!1))return new Vn(r,t,e.format);let a=Er(e.serviceName,t,r);switch(a.kind){case`available`:return new Zn(r,a.provider,Mr(e),t,e.format);case`needs-install`:return Nr(a,i,e,t);case`unsupported`:return Pr(i,e,t)}}N(jr,`resolveActiveCredentialStore`);function Mr(e){return t=>{e.logger.warn(`Migrated credentials from ${t.plaintextPath} into ${t.encryptedPath} (key in ${t.keyProviderDescription}). The plaintext file has been deleted.`)}}N(Mr,`buildMigrationLogger`);function Nr(e,t,n,r){let i=Or();if(i.installFailedThisSession){if(t)throw new h(`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 Fr(`The keyring backend could not be installed earlier this session; using the plaintext credentials file.`,n,r)}if(n.isNonInteractiveOrCI())throw new h(Lr(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 h?e:new h(`Failed to install the keyring backend: ${e instanceof Error?e.message:String(e)}`,{telemetryMessage:`workers-auth keyring install threw`});return Fr(`Failed to install the keyring backend (${e instanceof Error?e.message:String(e)}); falling back to the plaintext credentials file.`,n,r)}return new Zn(n.getConfigPath(),e.afterInstall(),Mr(n),r,n.format)}N(Nr,`handleNeedsInstall`);function Pr(e,t,n){let r=process.platform,i=r===`linux`,a=i?Ir(t.loginCommand):`OS keyring storage is not supported on \`${r}\`; falling back to the plaintext credentials file.`;if(e)throw new h(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 h(a,{telemetryMessage:`workers-auth keyring secret tool missing`});let o=Or();return i?(o.hasWarnedAboutSecretToolMissing||(o.hasWarnedAboutSecretToolMissing=!0,t.logger.warn(`${a}
78
-
79
- Falling back to the plaintext credentials file for this session.`)),new Vn(t.getConfigPath(),n,t.format)):Fr(a,t,n)}N(Pr,`handleUnsupported`);function Fr(e,t,n){let r=Or();return r.hasWarnedAboutKeyringFallback||(r.hasWarnedAboutKeyringFallback=!0,t.logger.warn(e)),new Vn(t.getConfigPath(),n,t.format)}N(Fr,`fallbackToFileWithWarning`);function Ir(e){return`\`secret-tool\` is required for OS keyring storage on Linux but is not installed.
80
-
81
- Install it via your package manager:
82
- Debian/Ubuntu: sudo apt-get install libsecret-tools
83
- Fedora/RHEL: sudo dnf install libsecret
84
- Arch: sudo pacman -S libsecret
85
- Alpine: apk add libsecret
86
-
87
- Or disable keyring storage: \`${e} --no-use-keyring\`.`}N(Ir,`secretToolMissingMessage`);function Lr(e){return`\`@napi-rs/keyring\` is required for OS keyring storage on Windows but is not installed.
88
-
89
- Run \`${e} --use-keyring\` interactively to install it automatically, or install it globally for CI:
90
-
91
- npm install -g @napi-rs/keyring@${Qn}
92
-
93
- Or disable keyring storage: \`${e} --no-use-keyring\`.`}N(Lr,`windowsBindingMissingMessage`);function Rr(e){let t=G(e.configPath,e.profile),n=O(t),r=Er(e.serviceName,e.profile,e.configPath);return r.kind===`available`?(new Zn(e.configPath,r.provider,void 0,e.profile,e.format??`toml`).clear(),{backendAvailable:!0,encryptedFileExisted:n}):(n&&A(t),{backendAvailable:!1,encryptedFileExisted:n})}N(Rr,`scrubEncryptedCredentials`);const{white:zr,gray:Br,dim:Vr,hidden:Hr,bold:Ur,cyanBright:Wr,bgCyan:Gr}=T;T.hex(`#BD5B08`);const Kr=T.hex(`#111`);T.hex(`#0E838F`);const qr=Kr.bgHex(`#0E838F`);T.hex(`#AB2526`);const Jr=Kr.bgHex(`#AB2526`);T.hex(`#218529`);const Yr=Kr.bgHex(`#218529`);T.hex(`#7F7322`);const Xr=Kr.bgHex(`#7F7322`),Zr=process.stdout;process.stderr;var Qr=e(oe(),1);const $r={diamond:`◇`,dash:`─`,radioInactive:`○`,radioActive:`●`,backActive:`◀`,backInactive:`◁`,bar:`│`,leftT:`├`,rigthT:`┤`,arrows:{left:`‹`,right:`›`},corners:{tl:`╭`,bl:`╰`,tr:`╮`,br:`╯`}};Jr(` ERROR `),Xr(` WARNING `),qr(` INFO `),Yr(` SUCCESS `),zr.bgRed(` X `),ue(Zr),Br($r.bar),Br($r.corners.bl),Br($r.leftT);function ei(){try{return!!(process.stdin.isTTY&&process.stdout.isTTY)}catch{return!1}}function J(){return!ei()||Qr.isCI}const ti=Qr.isCI;function ni(){o(n)}async function ri(e){let t=x(),n=e.map(e=>({value:e,label:e.name})),r=await new se({options:n,initialValue:n[0]?.value,render(){let e=t.bold(`Select an account`),n=this.options.map((e,n)=>{let r=n===this.cursor,i=e.value,a=t.hex(S.muted)(`${i.id.slice(0,12)}...`);return r?` ${t.hex(S.orange)(`>`)} ${t.bold(i.name)} ${a}`:` ${t.dim(i.name)} ${a}`});return`${e} ${t.dim(`(use arrow keys, enter to confirm)`)}\n${n.join(`
94
- `)}`}}).prompt();return D(r)||!r?null:r}async function ii(){let e=[];for await(let t of process.stdin)e.push(Buffer.from(t));let t=Buffer.concat(e).toString(`utf-8`);return t.endsWith(`
95
- `)?t.slice(0,-1):t}async function ai(e,t,n){let r=n?.kind??`text`;if(J()){if(r===`secret`){let t=await ii();if(t.length>0)return t;throw Error(`--${e} is required. Pipe the value via stdin, pass --${e} <value>, or run interactively.`)}throw Error(`--${e} is required. Pass --${e} <value> or run interactively.`)}let i=`Enter value for --${e}`,a=t||n?.question||i;ni();let o=r===`secret`?await le({message:a,mask:`•`,validate:e=>e&&e.length>0?void 0:`Value cannot be empty`}):await ce({message:a,validate:e=>e&&e.length>0?void 0:`Value cannot be empty`});return(D(o)||typeof o!=`string`)&&process.exit(130),o}async function oi(e,t,n){if(J())throw Error(`--${e} is required (one of: ${n.join(`, `)}). Pass --${e} <value> or run interactively.`);let r=`Select value for --${e}`,i=t||r;ni();let a=await E({message:i,options:n.map(e=>({value:e,label:e}))});return(D(a)||typeof a!=`string`)&&process.exit(130),a}async function si(e={}){if(e.force===!0)return!0;let t=e.message?`${e.message} Continue?`:`This permanently deletes the resource. Continue?`;if(J()){let e=x();return process.stderr.write(`${e.hex(S.warning)(`?`)} ${t}\n ${e.dim(`(non-interactive; pass --force to confirm)`)}\n`),!1}ni();let n=await de({message:t,initialValue:!1});return D(n)&&process.exit(130),n===!0}const ci=`.cfrc`;function li(e){let t=e||process.cwd(),n=be(t);for(;t!==n;){let e=xe(t,ci);if(O(e))try{let t=ge(e,`utf-8`).replace(/^\s*\/\/.*$/gm,``);return{config:JSON.parse(t),path:e}}catch{}t=be(t)}let r=xe(t,ci);if(O(r))try{let e=ge(r,`utf-8`).replace(/^\s*\/\/.*$/gm,``);return{config:JSON.parse(e),path:r}}catch{}return null}function ui(e,t){j(xe(t||process.cwd(),ci),JSON.stringify(e,null,2)+`
96
- `,{mode:384})}function di(e){let t=xe(e||process.cwd(),ci);return O(t)?(ve(t),!0):!1}async function fi(e){let t={},n=Y(`accountId`,`CLOUDFLARE_ACCOUNT_ID`);n&&(t.accountId=n);let r=Y(`zone`,`CLOUDFLARE_ZONE_ID`,e?.zone);r&&(t.zone=r);let i=Y(`complianceRegion`,`CLOUDFLARE_COMPLIANCE_REGION`);return i&&(t.complianceRegion=i),t}function Y(e,t,n){if(n)return{value:n,source:`flag`};let r=process.env[t];if(r)return{value:r,source:`env`};let i=li(),a=i?.config[e];if(a)return{value:a,source:`project`,path:i.path};let o=ae().defaults?.[e];if(o)return{value:o,source:`config`,path:w()}}function pi(){return Y(`accountId`,`CLOUDFLARE_ACCOUNT_ID`)?.value}async function mi(e){let t=Y(`accountId`,`CLOUDFLARE_ACCOUNT_ID`);if(t)return hi(t.value,Ti(t,`accountId`)),t.value;if(e){let t=await gi(e);if(t)return t}throw Error(`No account ID found.
97
-
98
- Please provide one of the following:
99
- 1. CLOUDFLARE_ACCOUNT_ID environment variable
100
- 2. Run 'cf context set account-id <id>' to set a default
101
- 3. Create a .cfrc file in your project
102
-
103
- You can find your account ID in the Cloudflare dashboard URL:
104
- https://dash.cloudflare.com/<account-id>/...`)}function hi(e,t){if(!process.env.DEBUG)return;let n=e.length>12?e.slice(0,12)+`…`:e;process.stderr.write(`Using account: ${n} (${t})\n`)}async function gi(e){let t;try{t=await Oi(e)}catch{return}if(t.length===0)return;if(t.length===1&&t[0]){let n=t[0],{displayName:r}=await Ei(`accountId`,n.id,`user`,e);return hi(n.id,`auto-selected from token — ${r}`),n.id}if(J()){let e=t.map(e=>` ${e.id} ${e.name}`).join(`
105
- `);throw Error(`Multiple accounts available but running non-interactively.
106
-
107
- Available accounts:
108
- ${e}
109
-
110
- Set one with CLOUDFLARE_ACCOUNT_ID or 'cf context set account-id'.`)}let n=await ri(t);n||process.exit(130);let{displayName:r}=await Ei(`accountId`,n.id,`user`,e);return hi(n.id,`selected interactively — ${r}`),n.id}async function _i(e,t,n){if(e?.zoneId)return vi(e.zoneId,t);let r=Y(`zone`,`CLOUDFLARE_ZONE_ID`,e?.zone);if(r){if(!n?.quiet&&r.source!==`flag`){let e=Ti(r);console.error(`Using zone: ${r.value} (from ${e})`)}return vi(r.value,t)}throw Error(`No zone specified.
111
-
112
- Please provide one of the following:
113
- 1. Zone as a positional argument: cf dns records list <zone>
114
- 2. --zone flag (or -z): cf dns records list --zone example.com
115
- 3. CLOUDFLARE_ZONE_ID environment variable
116
- 4. Run 'cf context set zone <zone>' to set a default
117
- 5. Create a .cfrc file in your project with {"zone": "example.com"}`)}async function vi(e,t){if(pe(e)||!t)return e;let{resolveZoneId:n}=await import(`./resolve-D1mG0REg.mjs`).then(e=>e.r);return n(t,await mi(),e)}function yi(e){if(e?.scriptName)return e.scriptName;throw Error("Required Worker name missing. Please specify the Worker name with `--worker <name>`.")}const bi=[`public`,`fedramp_high`],xi={"account-id":`accountId`,zone:`zone`,"compliance-region":`complianceRegion`},Si=Object.keys(xi);function Ci(e){return bi.includes(e)}function wi(){let e=Y(`complianceRegion`,`CLOUDFLARE_COMPLIANCE_REGION`);if(!e)return`public`;if(!Ci(e.value))throw Error(`Invalid compliance region "${e.value}". Must be one of: ${bi.join(`, `)}`);return e.value}function Ti(e,t=`zone`){switch(e.source){case`flag`:return t===`zone`?`--zone flag`:`(flag)`;case`env`:return{accountId:`CLOUDFLARE_ACCOUNT_ID`,zone:`CLOUDFLARE_ZONE_ID`,complianceRegion:`CLOUDFLARE_COMPLIANCE_REGION`}[t];case`project`:return`.cfrc`;case`config`:return`~/.config/cf/config.json`}}async function Ei(e,t,n,r){let i=t,a=t;if(e===`accountId`){if(!r)throw Error(`Authentication required to validate account ID`);let{id:e,name:n}=await ki(t,r);i=e,a=n?`${e.slice(0,12)}... (${n})`:e}else if(e===`zone`){if(!r)throw Error(`Authentication required to validate zone`);let e=await Ai(t,r);i=t,a=e.name}else e===`complianceRegion`&&(i=t,a=t);if(n===`project`){let t=li()?.config||{};t[e]=i,ui(t)}else{let t=ae();t.defaults||={},t.defaults[e]=i,C(t)}return{resolvedValue:i,displayName:a}}function Di(e,t){if(t===`project`)if(e===`all`)di();else{let t=li();t&&(delete t.config[e],Object.keys(t.config).length===0?di(be(t.path)):ui(t.config,be(t.path)))}else{let t=ae();t.defaults&&(e===`all`?delete t.defaults:(delete t.defaults[e],Object.keys(t.defaults).length===0&&delete t.defaults),C(t))}}async function Oi(e){return(await e.accounts.list({})).result}async function ki(e,t){let n=await Oi(t),r=n.find(t=>t.id===e);if(r)return{id:r.id,name:r.name};let i=n.find(t=>t.name.toLowerCase()===e.toLowerCase());if(i)return{id:i.id,name:i.name};if(pe(e))return{id:e};throw Error(`Account not found: "${e}"
118
-
119
- Available accounts:
120
- ${n.map(e=>` ${e.id.slice(0,12)}... ${e.name}`).join(`
121
- `)}`)}async function Ai(e,t){let n=(await t.zones.list({})).result,r=n.find(t=>t.id===e);if(r)return{id:r.id,name:r.name};let i=n.find(t=>t.name.toLowerCase()===e.toLowerCase());if(i)return{id:i.id,name:i.name};throw fe(e)?Error(`Zone not found: "${e}"
122
-
123
- This zone either doesn't exist or you don't have access to it.
124
- Run 'cf zones list' to see available zones.`):Error(`Invalid zone: "${e}"
125
-
126
- Please provide a zone ID or domain name.
127
- Run 'cf zones list' to see available zones.`)}function ji(){return xe(process.cwd(),ci)}function Mi(e){function t(){return M.resolve(e(),`preferences.json`)}N(t,`getUserPreferencesPath`);function n(){try{let e=ge(t(),`utf8`),n=JSON.parse(e);return typeof n==`object`&&n?n:{}}catch{return{}}}N(n,`readUserPreferences`);function r(e){let r={...n(),...e},i=t();k(M.dirname(i),{recursive:!0}),j(i,JSON.stringify(r,null,` `),{encoding:`utf-8`})}return N(r,`updateUserPreferences`),{readUserPreferences:n,updateUserPreferences:r}}N(Mi,`createPreferences`);var Ni=6e4,Pi=525600,Fi=43200,Ii=1440,Li=Symbol.for(`constructDateFrom`);function Ri(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Li in e?e[Li](t):e instanceof Date?new e.constructor(t):new Date(t)}N(Ri,`constructFrom`);function zi(e,t){return Ri(t||e,e)}N(zi,`toDate`);var Bi={};function Vi(){return Bi}N(Vi,`getDefaultOptions`);function Hi(e){let t=zi(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}N(Hi,`getTimezoneOffsetInMilliseconds`);function Ui(e,...t){let n=Ri.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}N(Ui,`normalizeDates`);function Wi(e,t){let n=zi(e)-+zi(t);return n<0?-1:n>0?1:n}N(Wi,`compareAsc`);function Gi(e){return Ri(e,Date.now())}N(Gi,`constructNow`);function Ki(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}N(Ki,`getRoundingMethod`);var qi={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Ji=N((e,t,n)=>{let r,i=qi[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},`formatDistance`);function Yi(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}N(Yi,`buildFormatLongFn`);var Xi={date:Yi({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:Yi({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:Yi({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},Zi={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Qi=N((e,t,n,r)=>Zi[e],`formatRelative`);function X(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}N(X,`buildLocalizeFn`);var $i={ordinalNumber:N((e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},`ordinalNumber`),era:X({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:X({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:N(e=>e-1,`argumentCallback`)}),month:X({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:X({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:X({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Z(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ta(s,e=>e.test(o)):ea(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}N(Z,`buildMatchFn`);function ea(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}N(ea,`findKey`);function ta(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}N(ta,`findIndex`);function na(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}N(na,`buildMatchPatternFn`);var ra={code:`en-US`,formatDistance:Ji,formatLong:Xi,formatRelative:Qi,localize:$i,match:{ordinalNumber:na({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:N(e=>parseInt(e,10),`valueCallback`)}),era:Z({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Z({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:N(e=>e+1,`valueCallback`)}),month:Z({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Z({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Z({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ia(e,t,n){let r=Vi(),i=n?.locale??r.locale??ra,a=Wi(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Ui(n?.in,...a>0?[t,e]:[e,t]),l=Ki(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/Ni,f=(u-(Hi(c)-Hi(s)))/Ni,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<Ii?`hour`:f<Fi?`day`:f<Pi?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/Ii);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/Fi);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/Pi);return i.formatDistance(`xYears`,e,o)}}N(ia,`formatDistanceStrict`);function aa(e,t){return ia(e,Gi(e),t)}N(aa,`formatDistanceToNowStrict`);function oa(e,t){return{read:N(()=>{let n=t();if(!O(n))return;let r=s(n);try{return W(e,r)}catch{return}},`read`),write(n){let r=t();k(M.dirname(r),{recursive:!0}),j(r,Ln(e,n),{encoding:`utf-8`,mode:384}),he(r,384)},clear(){let e=t(),n=O(e);return A(e,{force:!0}),n},path:t}}N(oa,`createFileStorage`);function sa(e){let{logger:t,prompt:n}=e;return N(async function(e,r){if(f())return t.log(r),!0;let i=await n(e);return typeof i==`string`&&i.trim().toLowerCase()===`yes`},`ensureTemporaryTermsAccepted`)}N(sa,`createTemporaryTermsPrompt`);var ca=[9106,1e4];function la(e){return e?.code}N(la,`getErrorCode`);function ua(e){let t=la(e);return t!==void 0&&ca.includes(t)}N(ua,`isMembershipsInaccessible`);function da(e){return{"no-credentials-non-interactive":`Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${e}\` in an interactive terminal first.`,"no-credentials-login-failed":`No credentials were found and the login attempt was unsuccessful. Run \`${e}\` to try again.`,"token-expired-non-interactive":`Your auth token has expired and could not be refreshed, and the environment is non-interactive. Run \`${e}\` in an interactive terminal or set a CLOUDFLARE_API_TOKEN.`,"token-expired-login-failed":`Your auth token has expired and could not be refreshed, and the login attempt was unsuccessful. Run \`${e}\` to try again.`}}N(da,`notLoggedInErrorBodies`);function fa(e,t,n){let r=new Date(t.claim.expiresAt);e.log(xt`
128
- Temporary account ready:
129
- Account: ${t.account.name} (${n?`reused`:`created`})
130
- Claim within: ${aa(r)}
131
- Claim URL: ${t.claim.url}
132
- `)}N(fa,`logTemporaryPreviewAccount`);function pa(e,t){let{logger:n}=t,r=e.cliName,i=da(e.commands.login),a=`
133
- Run \`${e.commands.whoami}\` to check your current authentication status.`,o=Mi(e.getConfigPath),s=te(n,e.cacheNamespace?{namespace:e.cacheNamespace}:void 0),l=Ar({serviceName:e.keyringServiceName,getConfigPath:e.getConfigPath,isKeyringEnabled:N(()=>o.readUserPreferences().keyring_enabled===!0,`isKeyringEnabled`),logger:n,isNonInteractiveOrCI:f,loginCommand:e.commands.login,format:e.fileFormat}),d=e.allowGlobalAuthKey??!0,m=Yt({logger:n,isNonInteractiveOrCI:f,openInBrowser:N(e=>p(e,n),`openInBrowser`),hasEnvCredentials:N(()=>ze({allowGlobalAuthKey:d})!==void 0,`hasEnvCredentials`),purgeOnLoginOrLogout:s.purgeConfigCaches,clientId:e.clientId,consent:e.consent,redirectUri:e.redirectUri,storageFactory:l.storageFactory,allowGlobalAuthKey:d,temporary:{storage:oa(e.fileFormat,e.getTemporaryAccountConfigPath),prompt:sa({logger:n,prompt:t.prompt})}});function ee(e){m.setProfile(e)}N(ee,`setProfile`);function g(){return m.getActiveProfile()}N(g,`getActiveProfile`);function _(){return l.getActiveStore(m.getActiveProfile())}N(_,`getCredentialStore`);function v(e){m.setTemporaryAllowed(e)}N(v,`setTemporaryAllowed`);function y(){return m.getAPIToken()}N(y,`getAPIToken`);function b(){return m.requireApiToken()}N(b,`requireApiToken`);function x(t,n){return{complianceConfig:t,scopes:n?.scopes??e.getDefaultScopeKeys(),browser:n?.browser??!0,callbackHost:n?.callbackHost,callbackPort:n?.callbackPort,profile:n?.profile}}N(x,`withDefaultScopes`);async function S(e,t){return m.login(x(e,t))}N(S,`login`);async function C(e){return m.logout(e)}N(C,`logout`);async function w(e,t){return m.getActiveTemporaryAccount()?{loggedIn:!0}:m.loginOrRefreshIfRequired(x(e,t))}N(w,`loginOrRefreshIfRequired`);async function ae(){return m.getOAuthTokenFromLocalState()}N(ae,`getOAuthTokenFromLocalState`);function oe(){return m.getScopes()}N(oe,`getScopes`);function se(){return l.storageFactory(g()).read()}N(se,`readAuthCredentials`);function T(e){l.storageFactory(g()).write(e)}N(T,`writeAuthCredentials`);function E(){let t=m.getActiveProfile();return t===`default`?`${e.accountCachePrefix}.json`:`${e.accountCachePrefix}-${t}.json`}N(E,`getAccountCacheFileName`);function D(e){s.saveToConfigCache(E(),{account:e})}N(D,`saveAccountToCache`);function ce(){return s.getConfigCache(E()).account}N(ce,`getAccountFromCache`);async function le(e,r){let o=await w(e);if(!o.loggedIn)throw new h(`Not logged in. ${i[o.reason]}${a}`,{telemetryMessage:`cfetch auth login required`});let s=b(),l=[],d=!0,f=1,p;for(;d;){p=new je(p),p.set(`page`,String(f));let{response:i,status:a}=await re(e,r,{},t.userAgent,n,p,void 0,s);i.success?(l.push(...i.result),c(i.result_info)?f+=1:d=!1):u(r,i,a)}return l}N(le,`fetchAccountsPaged`);async function ue(t,n={}){let{throwOnEmpty:r=!0}=n,[i,a]=await Promise.allSettled([le(t,`/accounts`),le(t,`/memberships`)]);if(i.status===`rejected`)throw i.reason;if(a.status===`rejected`)if(ua(a.reason)){if(i.status===`fulfilled`&&i.value.length>0)return i.value;throw la(a.reason)===9106?new h(`Failed to automatically retrieve account IDs for the logged in user.
134
- You may have incorrect permissions on your API token, or an environment variable such as CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, or CLOUDFLARE_EMAIL may be set to an invalid value.
135
- Check your environment and unset or correct any Cloudflare credential variables, or run \`${e.commands.login}\` to re-authenticate.
136
- You can also skip this account check by adding an \`account_id\` in your ${e.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`}):new h(`Failed to automatically retrieve account IDs for the logged in user.
137
- You may have incorrect permissions on your API token, or your authentication may have expired. Try running \`${e.commands.login}\` to re-authenticate. You can also skip this account check by adding an \`account_id\` in your ${e.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`})}else throw a.reason;let o=new Set(a.value.map(e=>e.account.id)),s=i.value.filter(e=>o.has(e.id));if(s.length===0&&r)throw new h(`Failed to automatically retrieve account IDs for the logged in user.
138
- In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your ${e.getConfigFileLabel()} file.
139
- Alternatively, try running \`${e.commands.login}\` to re-authenticate.`,{telemetryMessage:`user account fetch empty`});return s}N(ue,`fetchAllAccounts`);function de(e){let t=m.getActiveTemporaryAccount();return t?t.account.id:e.account_id?e.account_id:Ge()||ce()?.id}N(de,`getActiveAccountId`);async function fe(n){let r=de(n);if(r)return r;let i=await ue(n);if(i.length===1)return D({id:i[0].id,name:i[0].name}),i[0].id;try{let e=await t.select(`Select an account`,{choices:i.map(e=>({title:e.name,value:e.id}))}),n=i.find(t=>t.id===e);if(!n)throw Error(`Selected account not found in accounts list`);return D({id:n.id,name:n.name}),e}catch(n){if(t.isNoDefaultValueProvidedError(n)){let t=ne();throw new h(`More than one account available but unable to select one in non-interactive mode.
140
- Please set the appropriate \`account_id\` in your ${e.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
141
- Available accounts are (\`<name>\`: \`<account_id>\`):
142
- ${i.map(e=>` \`${t?`(redacted)`:e.name}\`: \`${e.id}\``).join(`
143
- `)}`,{telemetryMessage:`user account selection unavailable`})}throw n}}N(fe,`getOrSelectAccountId`);async function pe(e){if(m.isTemporaryAllowed()){if(ie(e)!==`public`)throw new h(`Temporary accounts aren't available when the compliance region is not set to public.`,{telemetryMessage:`user temporary account unavailable in compliance region`});if(y())throw new h("You're already authenticated with Cloudflare, so `--temporary` can't be used. Temporary preview accounts are only for unauthenticated use. Either remove `--temporary` to use your existing account, or log out (and unset CLOUDFLARE_API_TOKEN) first.",{telemetryMessage:`user temporary account already authenticated`});let{account:t,cached:r}=await m.activateTemporaryAccount();return fa(n,t,r),t.account.id}let t=await w(e);if(!t.loggedIn)throw t.reason===`no-credentials-non-interactive`||t.reason===`token-expired-non-interactive`?new h(`In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for ${r} to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.`,{telemetryMessage:`user auth missing api token non interactive`}):new h(`Did not login, quitting...`,{telemetryMessage:`user login cancelled`});let i=await fe(e);if(!i)throw new h(`No account id found, quitting...`,{telemetryMessage:`user auth missing account id`});return i}return N(pe,`requireAuth`),{setProfile:ee,getActiveProfile:g,getCredentialStore:_,setTemporaryAllowed:v,getAPIToken:y,requireApiToken:b,login:S,logout:C,loginOrRefreshIfRequired:w,getOAuthTokenFromLocalState:ae,getScopes:oe,readAuthCredentials:se,writeAuthCredentials:T,getActiveAccountId:de,getOrSelectAccountId:fe,getAccountFromCache:ce,fetchAllAccounts:ue,requireAuth:pe}}N(pa,`createCloudflareAuth`);var ma=`profiles/directory-bindings.json`,ha=`.enc`;function ga(e){let{logger:t,getConfigPath:n,keyringServiceName:r,format:i}=e,a=`.${i}`;function o(e){return Bn(n(),e,i)}N(o,`plaintextPath`);function s(e){return G(n(),e)}N(s,`encryptedPath`);function c(){return M.dirname(o(`default`))}N(c,`getProfileConfigDirectory`);let l={exists(e){return O(o(e))||O(s(e))},list(){let e=c();if(!O(e))return[];let t=new Set;for(let n of _e(e))n.endsWith(a)?t.add(n.slice(0,-a.length)):n.endsWith(ha)&&t.add(n.slice(0,-ha.length));return[...t]},delete(e){let{backendAvailable:a,encryptedFileExisted:s}=Rr({serviceName:r,configPath:n(),profile:e,format:i});oa(i,()=>o(e)).clear(),s&&!a&&t.warn(`Removed the credential files for profile "${e}", but the keyring backend was not reachable on this host so its keyring entry could not be cleared. Clear it manually if it persists.`)}};function u(){return M.join(n(),ma)}return N(u,`getDirectoryBindingsPath`),Zt({configs:l,bindings:{read(){try{let e=ge(u(),`utf-8`);return JSON.parse(e)}catch{return{}}},write(e){let t=u();k(M.dirname(t),{recursive:!0}),j(t,JSON.stringify(e,null,` `),`utf-8`)}}})}N(ga,`createCloudflareProfileStore`);function _a(e){let{loginCommand:t,createProfileCommand:n,keyringServiceName:r,getConfigPath:i,format:a,preferences:o}=e,{readUserPreferences:s,updateUserPreferences:c}=o;function l(e){return e??`default`}N(l,`describeProfile`);function u(e){let t=[];O(G(i()))&&t.push(void 0);let n=ga({logger:e,getConfigPath:i,keyringServiceName:r,format:a});for(let e of n.configs.list()){try{Qt(e)}catch{continue}O(G(i(),e))&&t.push(e)}return t}N(u,`listEncryptedProfiles`);function d(e){let o=u(e);if(o.length===0)return;let s=[],c=[];for(let t of o)try{let{backendAvailable:e}=Rr({serviceName:r,configPath:i(),profile:t,format:a});s.push(l(t)),e||c.push(l(t))}catch(n){e.warn(`Failed to remove encrypted credentials for profile "${l(t)}": ${n instanceof Error?n.message:String(n)}. You may need to clear them manually.`)}if(s.length>0){let r=n?`Re-authenticate with \`${t}\` (default profile) or \`${n} <name>\` (named profiles).`:`Re-authenticate with \`${t}\`.`;e.log(`Removed encrypted credentials for ${s.map(e=>`"${e}"`).join(`, `)}. ${r}`)}c.length>0&&e.warn(`The keyring backend was not reachable on this host, so the keyring entry for ${c.map(e=>`"${e}"`).join(`, `)} could not be cleared. Clear it manually if it persists.`)}N(d,`scrubAllEncryptedProfiles`);function f(e,t){let{logger:n,getCredentialStore:r}=t,i=s().keyring_enabled===!0,a=Ye();if(a!==void 0&&a!==e&&n.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${a} overrides ${e?`enabling`:`disabling`} keyring storage for this command.`),!e&&a!==!0&&d(n),c({keyring_enabled:e}),e&&a!==!1)try{r().kind!==`encrypted-file`&&(c({keyring_enabled:i}),n.warn(`Keyring storage isn't available on this host (see warning above), so it was not enabled. Try again once the keyring backend is reachable.`))}catch(e){throw c({keyring_enabled:i}),e}return{enabled:s().keyring_enabled===!0}}return N(f,`setKeyringPreference`),{setKeyringPreference:f}}N(_a,`createKeyringPreference`);function va(e){let{getConfigPath:t,format:n}=e;function r(e){return Bn(t(),e,n)}N(r,`getAuthConfigFilePath`);function i(e){return G(t(),e)}N(i,`getEncryptedAuthConfigFilePath`);function a(e){return oa(n,()=>r(e))}N(a,`defaultAuthConfigStorage`);function o(e,t){a(t).write(e)}N(o,`writeAuthConfigFile`);function s(e){return a(e).read()}return N(s,`readAuthConfigFile`),{getAuthConfigFilePath:r,getEncryptedAuthConfigFilePath:i,defaultAuthConfigStorage:a,readAuthConfigFile:s,writeAuthConfigFile:o}}N(va,`createAuthConfigFileHelpers`);var ya=`cloudflare`,ba=`cf`,xa=`http://localhost:8877/oauth/callback`,Sa={granted:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-granted`},denied:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-denied`,error:"Error: Consent denied. You must grant consent to cf in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"}},Ca=m({variableName:`CLOUDFLARE_CLIENT_ID`,defaultValue:N(()=>`cbca97e7-c331-4cdd-8fd8-e25a451b98bf`,`defaultValue`)});function Q(){return _({appName:`cloudflare`,leadingDot:!1,useLegacyHomeDir:!1})}N(Q,`getCfConfigPath`);var wa=`openid.offline.user:read.account:read.access:read.access:write.agw:read.agw:run.agw:write.ai:read.ai:write.ai-search:read.ai-search:run.ai-search:write.aiaudit:read.aiaudit:write.aig:read.aig:write.auditlogs:read.browser:read.browser:write.cfone:read.cfone:write.cloudchamber:write.connectivity:admin.connectivity:bind.connectivity:read.constellation:write.containers:write.d1:write.dex:read.dex:write.dns_analytics:read.dns_records:edit.dns_records:read.dns_settings:read.firstpartytags:write.images:read.images:write.lb:edit.lb:read.logpush:read.logpush:write.mcp_portals:read.mcp_portals:write.notebook-examples:read.notification:read.notification:write.pages:read.pages:write.pipelines:read.pipelines:setup.pipelines:write.query_cache:write.queues:write.r2_catalog:write.radar:read.rag:read.rag:write.registrar:read.registrar:write.secrets_store:read.secrets_store:write.sso-connector:read.sso-connector:write.ssl_certs:write.teams:pii.teams:read.teams:secure_location.teams:write.url_scanner:read.url_scanner:write.vectorize:write.workers:read.workers:write.workers_builds:read.workers_builds:write.workers_deployments:read.workers_kv:write.workers_observability:read.workers_observability:write.workers_observability_telemetry:write.workers_routes:write.workers_scripts:write.workers_tail:read.zone:read`.split(`.`),Ta=[...wa];function Ea(e){Ta=e}N(Ea,`setLoginScopeKeys`);var Da=new Set(wa);function Oa(e){return e.every(e=>Da.has(e))}N(Oa,`validateScopeKeys`);function ka(){let e=g();return e===`production`?`cloudflare-temporary-account.json`:`cloudflare-temporary-account.${e}.json`}N(ka,`getTemporaryAccountConfigFile`);function Aa(){return M.join(Q(),ka())}N(Aa,`getCfTemporaryAccountConfigPath`);function ja(e){return oa(`json`,e)}N(ja,`createJsonFileStorage`);var{getAuthConfigFilePath:Ma,getEncryptedAuthConfigFilePath:Na,defaultAuthConfigStorage:Pa,readAuthConfigFile:Fa,writeAuthConfigFile:Ia}=va({getConfigPath:Q,format:`json`}),La={cliName:ba,commands:{login:`cf auth login`,whoami:`cf auth whoami`},keyringServiceName:ya,clientId:Ca,consent:Sa,redirectUri:xa,allowGlobalAuthKey:!1,getConfigPath:Q,getTemporaryAccountConfigPath:Aa,fileFormat:`json`,accountCachePrefix:`cloudflare-account`,cacheNamespace:`cloudflare`,getConfigFileLabel:N(()=>`cf config`,`getConfigFileLabel`),getDefaultScopeKeys:N(()=>Ta,`getDefaultScopeKeys`)},Ra=Mi(Q),{readUserPreferences:za,updateUserPreferences:Ba}=Ra;function Va(e){return pa(La,e)}N(Va,`createCfAuth`);function Ha(e){return ga({logger:e.logger,getConfigPath:Q,keyringServiceName:ya,format:`json`})}N(Ha,`createCfProfileStore`);var Ua=_a({loginCommand:La.commands.login,createProfileCommand:La.commands.createProfile,keyringServiceName:ya,getConfigPath:Q,format:`json`,preferences:Ra});function Wa(e,t){return Ua.setKeyringPreference(e,t)}N(Wa,`setKeyringPreference`);const Ga={debug:(...e)=>{process.env.DEBUG&&console.error(...e)},info:(...e)=>console.error(...e),log:(...e)=>console.error(...e),warn:(...e)=>console.error(...e),error:(...e)=>console.error(...e)};var Ka=class extends Error{};async function qa(e){if(J())throw new Ka;o(n);let t=await ce({message:e});return(D(t)||typeof t!=`string`)&&process.exit(130),t}async function Ja(e,t){if(J())throw new Ka;o(n);let r=await E({message:e,options:t.choices.map(({title:e,value:t})=>({label:e,value:t}))});return(D(r)||typeof r!=`string`)&&process.exit(130),r}const $=Va({logger:Ga,userAgent:i,prompt:qa,select:Ja,isNoDefaultValueProvidedError:e=>e instanceof Ka});function Ya(e){if(e?.scopes&&!Oa(e.scopes))throw Error(`One or more of the requested scopes are not valid cf OAuth scopes.`);return $.login({compliance_region:wi()},{browser:e?.browser??!0,...e?.scopes&&{scopes:e.scopes}})}function Xa(){return $.logout()}function Za(){return $.getOAuthTokenFromLocalState()}function Qa(){return $.readAuthCredentials()?.oauth_token!==void 0}function $a(){return $.readAuthCredentials()}function eo(){return $.getCredentialStore().path()}function to(e){try{let t=Me(`ps -p ${e} -o pid=,ppid=,command=`,{encoding:`utf8`,timeout:5e3}).trim();if(!t)return null;let[n,r,...i]=t.split(/\s+/),a=n?parseInt(n,10):NaN,o=r?parseInt(r,10):NaN;return isNaN(a)||isNaN(o)?null:{pid:a,ppid:o,command:i.join(` `)||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function no(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=to(r);if(!e||e.ppid===0||e.ppid===1)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function ro(e){try{let t=Me(`wmic process where (ProcessId=${e}) get ProcessId,ParentProcessId,CommandLine /format:csv`,{encoding:`utf8`,timeout:1e4});if(!t)return null;let n=t.split(`
144
- `).filter(e=>e.trim()&&!e.startsWith(`Node`)).pop()?.split(`,`);if(!n||n.length<4)return null;let[r,i,a,o]=n,s=o?parseInt(o.trim(),10):NaN,c=a?parseInt(a.trim(),10):NaN;return isNaN(s)||isNaN(c)?null:{pid:s,ppid:c,command:i?.trim()||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function io(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=ro(r);if(!e||e.ppid===0||e.ppid===4)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function ao(e=process.pid){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`PID must be a positive integer`);return Ne.platform()===`win32`?io(e):no(e)}const oo=[{id:`opencode`,name:`OpenCode`,type:`agent`,envVars:[{any:[`OPENCODE`,`OPENCODE_BIN_PATH`,`OPENCODE_SERVER`,`OPENCODE_APP_INFO`,`OPENCODE_MODES`]}]},{id:`jules`,name:`Jules`,type:`agent`,envVars:[{all:[[`HOME`,`/home/jules`],[`USER`,`swebot`]]}]},{id:`claude-code`,name:`Claude Code`,type:`agent`,envVars:[`CLAUDECODE`]},{id:`cursor-agent`,name:`Cursor Agent`,type:`agent`,envVars:[{all:[`CURSOR_TRACE_ID`,[`PAGER`,`head -n 10000 | cat`]]}]},{id:`cursor`,name:`Cursor`,type:`interactive`,envVars:[`CURSOR_TRACE_ID`]},{id:`gemini-agent`,name:`Gemini Agent`,type:`agent`,processChecks:[`gemini`]},{id:`codex`,name:`OpenAI Codex`,type:`agent`,processChecks:[`codex`]},{id:`replit`,name:`Replit`,type:`agent`,envVars:[`REPL_ID`]},{id:`aider`,name:`Aider`,type:`agent`,envVars:[`AIDER_API_KEY`],processChecks:[`aider`]},{id:`bolt-agent`,name:`Bolt.new Agent`,type:`agent`,envVars:[{all:[[`SHELL`,`/bin/jsh`],`npm_config_yes`]}]},{id:`bolt`,name:`Bolt.new`,type:`interactive`,envVars:[{all:[[`SHELL`,`/bin/jsh`]],none:[`npm_config_yes`]}]},{id:`zed-agent`,name:`Zed Agent`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`zed`],[`PAGER`,`cat`]]}]},{id:`zed`,name:`Zed`,type:`interactive`,envVars:[{all:[[`TERM_PROGRAM`,`zed`]],none:[[`PAGER`,`cat`]]}]},{id:`replit-assistant`,name:`Replit Assistant`,type:`agent`,envVars:[{all:[`REPL_ID`,[`REPLIT_MODE`,`assistant`]]}]},{id:`replit`,name:`Replit`,type:`interactive`,envVars:[{all:[`REPL_ID`],none:[[`REPLIT_MODE`,`assistant`]]}]},{id:`windsurf`,name:`Windsurf`,type:`agent`,envVars:[`CODEIUM_EDITOR_APP_ROOT`]},{id:`crush`,name:`Crush`,type:`agent`,processChecks:[`crush`]},{id:`vscode-copilot-agent`,name:`GitHub Copilot in VS Code`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`vscode`],[`GIT_PAGER`,`cat`]]}]},{id:`warp`,name:`Warp Terminal`,type:`hybrid`,envVars:[{all:[[`TERM_PROGRAM`,`WarpTerminal`]]}]},{id:`octofriend`,name:`Octofriend`,type:`agent`,processChecks:[`octofriend`]}];function so(e,t=process.env){let[n,r]=typeof e==`string`?[e,void 0]:e,i=t[n];return!!(i&&(!r||i===r))}function co(e,t){try{let n=t??ao();for(let t of n)if(t.command?.includes(e))return!0}catch{}return!1}function lo(e,t=process.env){if(typeof e==`string`||Array.isArray(e))return so(e,t);let{any:n,all:r,none:i}=e,a=!n?.length||n.some(e=>so(e,t)),o=!r?.length||r.every(e=>so(e,t)),s=!i?.length||!i.some(e=>so(e,t));return a&&o&&s}function uo(e){return e.customDetectors?.some(e=>{try{return e()}catch{return!1}})??!1}function fo(e){return{isAgentic:!0,id:e.id,name:e.name,type:e.type}}function po(e=process.env,t){for(let t of oo)if(t.envVars?.some(t=>lo(t,e)))return fo(t);let n=t,r=()=>{if(n===void 0)try{n=ao()}catch{n=[]}return n};for(let e of oo)if(e.processChecks?.some(e=>co(e,r())))return fo(e);for(let e of oo)if(uo(e))return fo(e);return{isAgentic:!1,id:null,name:null,type:null}}function mo(){return ti?`ci`:ei()?`interactive`:`non-interactive`}function ho(){let e=po(),t=e.isAgentic&&e.id!==null?{"X-CF-CLI-Agent":e.id}:{};return{"User-Agent":i,"X-CF-CLI-Mode":mo(),...t}}const go=3e4,_o=r.Default;function vo(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function yo(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function bo(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function xo(e,t,n){if(!(n==null||n===``)){if(Array.isArray(n)){for(let r of n)xo(e,t,r);return}e.append(t,String(n))}}function So(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))xo(t,n,r);return t.toString()}function Co(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=So(n??{});return a&&(i.search=a),i.toString()}const wo=new WeakMap;async function To(e,t,n,r={}){let i=Co(n,wo.get(e)??_o,r.query),o={...r.headers},s;r.body!==void 0&&(vo(r.body)||typeof r.body==`string`&&yo(o)?s=r.body:(o[`Content-Type`]??=`application/json`,s=JSON.stringify(r.body)));let c;try{c=await e.fetch(i,{method:t,headers:o,body:s,signal:r.signal},{timeoutInSeconds:r.timeout?r.timeout/1e3:void 0,abortSignal:r.signal})}catch(e){throw r.signal?.aborted?Error(`Request aborted`):e instanceof Error&&e.name===`AbortError`?Error(`Request timed out after ${r.timeout??go}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!c.ok)throw new a({statusCode:c.status,body:await bo(c),rawResponse:{status:c.status,statusText:c.statusText,url:c.url||i,headers:c.headers,redirected:c.redirected,type:c.type}});if(c.status===204)return null;let l=await c.text();if(l===``)return null;if(!(c.headers.get(`content-type`)??``).includes(`application/json`))return l;let u=JSON.parse(l);if(u.success===!1)throw new a({message:`API error: ${u.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`}`,statusCode:c.status,body:u});return`result`in u?u.result:u}function Eo(e){let n=e.baseURL??_o,r=new t({baseUrl:n,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??go)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch});return wo.set(r,n),r}async function Do(){let e=ze({allowGlobalAuthKey:!1});if(e&&`apiToken`in e)return e.apiToken;let t=await Za();if(t)return t;throw Error(`No authentication token found.
145
-
146
- Please set one of the following:
147
- 1. Set the CLOUDFLARE_API_TOKEN environment variable
148
- 2. Run 'cf auth login' to authenticate via OAuth
149
-
150
- For API tokens, visit: https://dash.cloudflare.com/profile/api-tokens`)}async function Oo(e){let t=v({compliance_region:wi()});if(e.local){if(!e.localEndpoint)throw Error(`--local requires --local-endpoint <url>; this should have been caught by the global middleware.`);let{createLocalFetch:n}=await import(`./local-D8bhHUMK.mjs`).then(e=>e.r);return Eo({apiToken:`cf-local-mode-no-auth`,baseURL:t,defaultHeaders:ho(),fetch:n({endpoint:e.localEndpoint})})}return Eo({apiToken:await Do(),baseURL:t,defaultHeaders:ho()})}export{pi as C,ai as D,oi as E,J as O,_i as S,si as T,mi as _,ho as a,ji as b,Qa as c,$a as d,Si as f,li as g,Di as h,To as i,Ya as l,bi as m,Oo as n,eo as o,xi as p,Do as r,Za as s,Eo as t,Xa as u,wi as v,Ei as w,yi as x,fi as y};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as e}from"./theme-CFHr0Dh9.mjs";import{i as t,n,t as r}from"./ui-B97lRnOv.mjs";import{c as i,d as a,l as o,o as s,r as c,s as l,t as u,u as d}from"./auth-BqDOIrKX.mjs";import{t as f}from"./output-CUxZRM5A.mjs";const p={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`force`,{type:`boolean`,alias:`f`,description:`Force re-authentication even if already logged in`,default:!1}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async c=>{if(!c.force&&i()){if(await l()){let t=a();console.log(n(`You are already logged in.`)),console.log(`${e.info(`Config file:`)} ${e.muted(s())}`),t?.expiration_time&&console.log(`${e.info(`Token expires:`)} ${new Date(t.expiration_time).toLocaleString()}`),console.log(r(`Run ${e.code(`cf auth login --force`)} to re-authenticate, or ${e.code(`cf auth logout`)} to log out.`));return}console.log(t(`Existing tokens are invalid or expired. Starting fresh login...
3
- `))}else c.force&&i()&&console.log(n(`Re-authenticating...
4
- `));if(console.log(n(`Starting OAuth login flow...
5
- `)),!await o({browser:c.browser,scopes:c.scopes})){console.log(t(`CLOUDFLARE_API_TOKEN is set and takes precedence. Unset it to log in via OAuth.`));return}let u=a();console.log(`${e.info(`Config file:`)} ${e.muted(s())}`),u?.scopes&&console.log(`${e.info(`Scopes:`)} ${u.scopes.join(`, `)}`),u?.expiration_time&&console.log(`${e.info(`Token expires:`)} ${new Date(u.expiration_time).toLocaleString()}`)}},m={command:`logout`,describe:`Log out and remove stored credentials`,handler:async()=>{let a=i(),o=!!process.env.CLOUDFLARE_API_TOKEN;if(!a){o?(console.log(n(`No cf OAuth credentials found, but CLOUDFLARE_API_TOKEN environment variable is set.`)),console.log(n(`Unset it with: unset CLOUDFLARE_API_TOKEN`))):(console.log(n(`You are not currently logged in.`)),console.log(r(`Run ${e.code(`cf auth login`)} to authenticate.`)));return}console.log(n(`Logging out...`)),await d(),console.log(`${e.info(`Removed:`)} OAuth tokens from ${e.muted(s())}`),o&&(console.log(``),console.log(t(`CLOUDFLARE_API_TOKEN environment variable is still set.`)),console.log(n(`You will remain authenticated via the env var. Unset it with: unset CLOUDFLARE_API_TOKEN`)))}},h={command:`whoami`,describe:`Show current user and authentication status`,builder:e=>e,handler:async e=>{let t=process.env.CLOUDFLARE_API_TOKEN,n=a(),r;r=t?`CLOUDFLARE_API_TOKEN environment variable`:n?.oauth_token?`OAuth token from ${s()}`:`none`;let i;try{i=await c()}catch{f({authenticated:!1,error:`Not logged in`});return}let o=u({apiToken:i}),l=!1,d;try{let e=await o.user.get();l=!0,e&&`email`in e&&typeof e.email==`string`&&(d=e.email)}catch(e){l=!1,process.env.DEBUG&&console.error(`Token verification error:`,e)}let p={authenticated:!0,authSource:r,tokenValid:l,...d&&{email:d}};n?.oauth_token&&(p.scopes=n.scopes,p.expiresAt=n.expiration_time),f(p)}},g={command:`auth`,describe:`Authentication commands (login, logout, whoami)`,builder:e=>e.command(p).command(m).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,_ as t,n}from"./auth-BqDOIrKX.mjs";import{t as r}from"./output-CUxZRM5A.mjs";import{n as i,t as a}from"./progress-Cent9Lsg.mjs";import{t as o}from"./local-D8bhHUMK.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`get`,describe:`Gets the current billing profile for the account.`,builder:s,handler:async s=>{if(s.dryRun){i({command:`cf billing profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/billing/profile`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.billing.profiles.get({account_id:l})),{successLabel:`Loaded`})}},l={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`from`,{type:`string`,description:`Start date for the usage query (ISO 8601).`}).option(`to`,{type:`string`,description:`End date for the usage query (ISO 8601).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`paygo`,describe:`Returns billable usage data for PayGo (self-serve) accounts. When no query parameters are provided, returns usage for the current billing period.`,builder:u,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage paygo`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/paygo-usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.paygo({account_id:u,...c})),{successLabel:`Loaded`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`paygo_info`,describe:`Returns high-level usage information for the account, including coverage, and subscription metadata.`,builder:f,handler:async s=>{if(s.dryRun){i({command:`cf billing usage paygo_info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/paygo-usage-info`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.billing.usage.paygoInfo({account_id:l})),{successLabel:`Loaded`})}},m={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},h={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(l).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{D as e,E as t,S as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";function u(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`expression`,{type:`string`,description:`Wirefilter expression describing the traffic being reported.`}).option(`first-request-seen-at`,{type:`string`,description:`The first_request_seen_at field`}).option(`last-request-seen-at`,{type:`string`,description:`The last_request_seen_at field`}).option(`requests`,{type:`number`,description:`The requests field`}).option(`subtype`,{type:`string`,description:`The subtype field`}).option(`type`,{type:`string`,description:`Type of feedback report.`,choices:[`false_positive`,`false_negative`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:"Submit a feedback report for the specified zone. Use `type` to indicate whether the report is a false positive (good traffic flagged as bot) or a false negative (bot traffic missed). Furthermore, you can also use `expression` as a wirefilter to identify the affected traffic sample. See more accepted API fields and expression types at https://developers.cloudflare.com/bots/concepts/feedback-loop/#api-fields and https://developers.cloudflare.com/bots/concepts/feedback-loop/#expression-fields, respectively.",builder:u,handler:async u=>{if(u.dryRun){s({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?a({description:l(u.description,`description`,`text`),expression:l(u.expression,`expression`,`text`),first_request_seen_at:l(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:l(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:l(u.subtype,`subtype`,`text`),type:l(u.type,`type`,`text`)}):i(u.body)});return}let d=await r(u),f=await n({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=i(u.body);o(await c(`Creating`,async()=>d.botManagement.feedback.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.description===void 0&&(u.description=await e(`description`,`The description field`)),u.expression===void 0&&(u.expression=await e(`expression`,`Wirefilter expression describing the traffic being reported.`)),u[`first-request-seen-at`]===void 0&&(u[`first-request-seen-at`]=await e(`first-request-seen-at`,`The first_request_seen_at field`)),u[`last-request-seen-at`]===void 0&&(u[`last-request-seen-at`]=await e(`last-request-seen-at`,`The last_request_seen_at field`)),u.requests===void 0)throw Error(`--requests is required (or pass --body with this field set).`);u.type===void 0&&(u.type=await t(`type`,`Type of feedback report.`,[`false_positive`,`false_negative`]));let p=a({description:l(u.description,`description`,`text`),expression:l(u.expression,`expression`,`text`),first_request_seen_at:l(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:l(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:l(u.subtype,`subtype`,`text`),type:l(u.type,`type`,`text`)});o(await c(`Creating`,async()=>d.botManagement.feedback.create({body:p,zone_id:f})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`list`,describe:`Returns all feedback reports previously submitted for the specified zone. Feedback reports help improve detection by sharing samples of traffic that were misclassified as bots or humans.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf bot-management feedback list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.botManagement.feedback.list({zone_id:i})),{successLabel:`Loaded`})}},m={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf bot-management get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.botManagement.get({zone_id:i})),{successLabel:`Loaded`})}};function _(e){return e.option(`ai-bots-protection`,{type:`string`,description:`Enable rule to block AI Scrapers and Crawlers.`,choices:[`block`,`disabled`,`only_on_ad_pages`]}).option(`cf-robots-variant`,{type:`string`,description:`Specifies the Robots Access Control License variant to use.`,choices:[`off`,`policy_only`]}).option(`content-bots-protection`,{type:`string`,description:`Enable rule to block content bots. When enabled, blocks automated traffic with low bot scores, excluding safe verified bot categories. Exceptions should be managed via skip rules.`,choices:[`block`,`disabled`]}).option(`crawler-protection`,{type:`string`,description:`Enable rule to punish AI Scrapers and Crawlers via a link maze.`,choices:[`enabled`,`disabled`]}).option(`enable-js`,{type:`boolean`,description:`Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).`}).option(`is-robots-txt-managed`,{type:`boolean`,description:`Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.`}).option(`fight-mode`,{type:`boolean`,description:`Whether to enable Bot Fight Mode.`}).option(`stale-zone-configuration-optimize-wordpress`,{type:`boolean`,description:`Indicates that the zone's wordpress optimization for SBFM is turned on.`}).option(`stale-zone-configuration-sbfm-definitely-automated`,{type:`string`,description:`Indicates that the zone's definitely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-likely-automated`,{type:`string`,description:`Indicates that the zone's likely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-static-resource-protection`,{type:`string`,description:`Indicates that the zone's static resource protection is turned on.`}).option(`stale-zone-configuration-sbfm-verified-bots`,{type:`string`,description:`Indicates that the zone's verified bot requests are being blocked.`}).option(`stale-zone-configuration-suppress-session-score`,{type:`boolean`,description:`Indicates that the zone's session score tracking is disabled.`}).option(`stale-zone-configuration-fight-mode`,{type:`boolean`,description:`Indicates that the zone's Bot Fight Mode is turned on.`}).option(`optimize-wordpress`,{type:`boolean`,description:`Whether to optimize Super Bot Fight Mode protections for Wordpress.`}).option(`sbfm-definitely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on definitely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`sbfm-static-resource-protection`,{type:`boolean`,description:`Super Bot Fight Mode (SBFM) to enable static resource protection.
3
- Enable if static resources on your application need bot protection.
4
- Note: Static resource protection can also result in legitimate traffic being blocked.
5
- `}).option(`sbfm-verified-bots`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on verified bots requests.`,choices:[`allow`,`block`]}).option(`sbfm-likely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on likely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`auto-update-model`,{type:`boolean`,description:`Automatically update to the newest bot detection models created by Cloudflare as they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)`}).option(`bm-cookie-enabled`,{type:`boolean`,description:`Indicates that the bot management cookie can be placed on end user devices accessing the site. Defaults to true`}).option(`suppress-session-score`,{type:`boolean`,description:`Whether to disable tracking the highest bot score for a session in the Bot Management cookie.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`update`,describe:'Updates the Bot Management configuration for a zone. This API is used to update: - **Bot Fight Mode** - **Super Bot Fight Mode** - **Bot Management for Enterprise** See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more information on the different plans \\ If you recently upgraded or downgraded your plan, refer to the following examples to clean up old configurations. Copy and paste the example body to remove old zone configurations based on your current plan. #### Clean up configuration for Bot Fight Mode plan ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "suppress_session_score": false } ``` #### Clean up configuration for SBFM Pro plan ```json { "sbfm_likely_automated": "allow", "fight_mode": false } ``` #### Clean up configuration for SBFM Biz plan ```json { "fight_mode": false } ``` #### Clean up configuration for BM Enterprise Subscription plan It is strongly recommended that you ensure you have [custom rules](https://developers.cloudflare.com/waf/custom-rules/) in place to protect your zone before disabling the SBFM rules. Without these protections, your zone is vulnerable to attacks. ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "fight_mode": false } ```',builder:_,handler:async e=>{if(e.dryRun){s({command:`cf bot-management update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({ai_bots_protection:l(e[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:l(e[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:l(e[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:l(e[`crawler-protection`],`crawler-protection`,`text`),enable_js:e[`enable-js`],is_robots_txt_managed:e[`is-robots-txt-managed`],fight_mode:e[`fight-mode`],stale_zone_configuration:{optimize_wordpress:e[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:l(e[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:l(e[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:l(e[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:l(e[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:e[`stale-zone-configuration-suppress-session-score`],fight_mode:e[`stale-zone-configuration-fight-mode`]},optimize_wordpress:e[`optimize-wordpress`],sbfm_definitely_automated:l(e[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:e[`sbfm-static-resource-protection`],sbfm_verified_bots:l(e[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:l(e[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:e[`auto-update-model`],bm_cookie_enabled:e[`bm-cookie-enabled`],suppress_session_score:e[`suppress-session-score`]}):i(e.body)});return}let t=await r(e),u=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=u,e.body){let n=i(e.body);o(await c(`Updating`,async()=>t.botManagement.update({body:n,zone_id:u})),{successLabel:`Updated`});return}let d=a({ai_bots_protection:l(e[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:l(e[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:l(e[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:l(e[`crawler-protection`],`crawler-protection`,`text`),enable_js:e[`enable-js`],is_robots_txt_managed:e[`is-robots-txt-managed`],fight_mode:e[`fight-mode`],stale_zone_configuration:{optimize_wordpress:e[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:l(e[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:l(e[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:l(e[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:l(e[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:e[`stale-zone-configuration-suppress-session-score`],fight_mode:e[`stale-zone-configuration-fight-mode`]},optimize_wordpress:e[`optimize-wordpress`],sbfm_definitely_automated:l(e[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:e[`sbfm-static-resource-protection`],sbfm_verified_bots:l(e[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:l(e[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:e[`auto-update-model`],bm_cookie_enabled:e[`bm-cookie-enabled`],suppress_session_score:e[`suppress-session-score`]});o(await c(`Updating`,async()=>t.botManagement.update({body:d,zone_id:u})),{successLabel:`Updated`})}},y={command:`bot-management`,describe:`Bot detection and mitigation settings — configure bot scores, JavaScript detections, and challenge behavior`,builder:e=>e.command(g).command(v).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,T as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{t as i}from"./output-CUxZRM5A.mjs";import{n as a,t as o}from"./progress-Cent9Lsg.mjs";import{t as s}from"./local-D8bhHUMK.mjs";import{t as c}from"./cli-types-CMNMD1V7.mjs";function l(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`day-report <asn-id>`,describe:`Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day.`,builder:c(l),handler:async t=>{let c={date:t.date};if(t.dryRun){a({command:`cf botnet-feed asn day-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/asn/${t[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(t[`asn-id`]))}/day_report`,pathParams:{"asn-id":String(t[`asn-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(t),u=t.local?s:await n(l);t.accountId=u,i(await o(`Loading`,async()=>l.botnetFeed.asn.dayReport({account_id:u,asn_id:t[`asn-id`],...c})),{successLabel:`Loaded`})}};function d(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`full-report <asn-id>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:c(d),handler:async t=>{if(t.dryRun){a({command:`cf botnet-feed asn full-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/asn/${t[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(t[`asn-id`]))}/full_report`,pathParams:{"asn-id":String(t[`asn-id`]??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.botnetFeed.asn.fullReport({account_id:l,asn_id:t[`asn-id`]})),{successLabel:`Loaded`})}},p={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <asn-id>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:c(m),handler:async c=>{if(c.dryRun){a({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/configs/asn/${c[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(c[`asn-id`]))}`,pathParams:{"asn-id":String(c[`asn-id`]??``)},bodyKind:`none`});return}let l=await r(c),u=c.local?s:await n(l);if(c.accountId=u,!await t({force:!!c.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting`,async()=>l.botnetFeed.configs.asn.delete({account_id:u,asn_id:c[`asn-id`]})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.`,builder:g,handler:async t=>{if(t.dryRun){a({command:`cf botnet-feed configs asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/configs/asn`,pathParams:{},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.botnetFeed.configs.asn.get({account_id:l})),{successLabel:`Loaded`})}},v={command:`asn`,describe:`Botnet feed subscription configuration and notification preferences`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`configs`,describe:`Operations for configs`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`botnet-feed`,describe:`Botnet threat intelligence feeds — IP and ASN-level data on known command-and-control infrastructure`,builder:e=>e.command(p).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";import{t as f}from"./cli-types-CMNMD1V7.mjs";function p(e){return e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:p,handler:async n=>{let f={showHistoric:n[`show-historic`],download:n.download};if(n.dryRun){c({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},query:f,bodyKind:`json`,body:n.body===void 0?o({image_data:u(n[`image-data`],`image-data`,`text`),score_threshold:n[`score-threshold`],top_k:n[`top-k`]}):a(n.body)});return}let p=await i(n),m=n.local?d:await r(p);if(n.accountId=m,n.body){let e=a(n.body);new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),s(await l(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...f})),{successLabel:`Created`});return}n[`image-data`]===void 0&&(n[`image-data`]=await t(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=o({image_data:u(n[`image-data`],`image-data`,`text`),score_threshold:n[`score-threshold`],top_k:n[`top-k`]});new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),s(await l(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...f})),{successLabel:`Created`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:h,handler:async t=>{if(t.dryRun){c({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.brandProtection.urlInfo({account_id:a})),{successLabel:`Loaded`})}};function _(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:f(_),handler:async t=>{let n={offset:t.offset,limit:t.limit,query_id:t[`query-id`],download:t.download,orderBy:t[`order-by`],order:t.order};if(t.dryRun){c({command:`cf brand-protection v2 logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.logoMatches.get({account_id:o,...n})),{successLabel:`Loaded`})}},y={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:b,handler:async n=>{if(n.dryRun){c({command:`cf brand-protection v2 logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({image_data:u(n[`image-data`],`image-data`,`text`),search_lookback:n[`search-lookback`],similarity_threshold:n[`similarity-threshold`],tag:u(n.tag,`tag`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.brandProtection.v2.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`image-data`]===void 0&&(n[`image-data`]=await t(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),n[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);n.tag===void 0&&(n.tag=await t(`tag`,`Unique identifier for the logo query`));let m=o({image_data:u(n[`image-data`],`image-data`,`text`),search_lookback:n[`search-lookback`],similarity_threshold:n[`similarity-threshold`],tag:u(n.tag,`tag`,`text`)});s(await l(`Creating`,async()=>f.brandProtection.v2.logos.create({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:S,handler:async t=>{if(t.dryRun){c({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${t[`query-id`]==null?`<query-id>`:encodeURIComponent(String(t[`query-id`]))}`,pathParams:{"query-id":String(t[`query-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}s(await l(`Deleting`,async()=>a.brandProtection.v2.logos.delete({account_id:o,query_id:t[`query-id`]})),{successLabel:`Deleted`})}};function w(e){return e.option(`id`,{type:`string`,description:`Optional query ID to retrieve a specific logo query`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data.`,builder:w,handler:async t=>{let n={id:t.id,download:t.download};if(t.dryRun){c({command:`cf brand-protection v2 logos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.logos.get({account_id:o,...n})),{successLabel:`Loaded`})}},E={command:`logos`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID or comma-separated list of Query IDs. When multiple IDs are provided, matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and dismissed state.`,demandOption:!0}).option(`include-domain-id`,{type:`string`,description:`Include domain ID`}).option(`include-dismissed`,{type:`string`,description:`Include dismissed`}).option(`domain-search`,{type:`string`,description:`Filter matches by domain name (substring match)`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'domain', 'first_seen', or 'registrar'`,choices:[`domain`,`first_seen`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get`,describe:`Get paginated list of domain matches for one or more brand protection queries. When multiple query_ids are provided (comma-separated), matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and individual dismissed state.`,builder:f(D),handler:async t=>{let n={offset:t.offset,limit:t.limit,query_id:t[`query-id`],include_domain_id:t[`include-domain-id`],include_dismissed:t[`include-dismissed`],domain_search:t[`domain-search`],orderBy:t[`order-by`],order:t.order};if(t.dryRun){c({command:`cf brand-protection v2 matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.matches.get({account_id:o,...n})),{successLabel:`Loaded`})}},k={command:`matches`,describe:`Detected brand abuse matches from monitoring queries with evidence downloads`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`id`,{type:`string`,description:`ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:A,handler:async t=>{let n={id:t.id};if(t.dryRun){c({command:`cf brand-protection v2 queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.queries.get({account_id:o,...n})),{successLabel:`Loaded`})}},M={command:`queries`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`v2`,describe:`Operations for v2`,builder:e=>e.command(y).command(E).command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`brand-protection`,describe:`Monitor the Internet for phishing sites, lookalike domains, and unauthorized use of your brand assets`,builder:e=>e.command(m).command(g).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{S as e,n as t}from"./auth-BqDOIrKX.mjs";import{n,t as r}from"./body-parser-CBpeIUns.mjs";import{t as i}from"./output-CUxZRM5A.mjs";import{n as a,t as o}from"./progress-Cent9Lsg.mjs";import{n as s}from"./input-validation-CTqtyiY9.mjs";function c(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`List Hostname Associations.`,builder:c,handler:async n=>{let r={mtls_certificate_id:n[`mtls-certificate-id`]};if(n.dryRun){a({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get({zone_id:c,...r})),{successLabel:`Loaded`})}};function u(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`update`,describe:`Replace Hostname Associations.`,builder:u,handler:async c=>{if(c.dryRun){a({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=r({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)});i(await o(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...d,zone_id:u})),{successLabel:`Updated`})}},f={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`certificate-authorities`,describe:`Map client certificates to specific hostnames for mTLS authentication`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{D as e,S as t,T as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./cli-types-CMNMD1V7.mjs";function d(e){return e.option(`csr`,{type:`string`,description:`The Certificate Signing Request (CSR). Must be newline-encoded.`}).option(`validity-days`,{type:`number`,description:`The number of days the Client Certificate will be valid after the issued_on date.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`create`,describe:`Create a new API Shield mTLS Client Certificate.`,builder:d,handler:async n=>{if(n.dryRun){s({command:`cf client-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({csr:l(n.csr,`csr`,`text`),validity_days:n[`validity-days`]}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.clientCertificates.create({...e,zone_id:d})),{successLabel:`Created`});return}if(n.csr===void 0&&(n.csr=await e(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),n[`validity-days`]===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let f=a({csr:l(n.csr,`csr`,`text`),validity_days:n[`validity-days`]});o(await c(`Creating`,async()=>u.clientCertificates.create({...f,zone_id:d})),{successLabel:`Created`})}};function p(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const m={command:`delete <client-certificate-id>`,describe:`Set a API Shield mTLS Client Certificate to pending_revocation status for processing to revoked status.`,builder:p,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>i.clientCertificates.delete({zone_id:a,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`reactivate`,{type:`boolean`,description:`The reactivate field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`edit <client-certificate-id>`,describe:`If a API Shield mTLS Client Certificate is in a pending_revocation state, you may reactivate it with this endpoint.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({reactivate:e.reactivate}):i(e.body)});return}let n=await r(e),l=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.clientCertificates.edit({...t,zone_id:l,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Updated`});return}let u=a({reactivate:e.reactivate});o(await c(`Updating`,async()=>n.clientCertificates.edit({...u,zone_id:l,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Updated`})}};function _(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <client-certificate-id>`,describe:`Get Details for a single mTLS API Shield Client Certificate.`,builder:_,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.clientCertificates.get({zone_id:i,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`status`,{type:`string`,description:`Client Certitifcate Status to filter results by.`,choices:[`all`,`active`,`pending_reactivation`,`pending_revocation`,`revoked`]}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of records per page.`}).option(`limit`,{type:`number`,description:`Limit to the number of records returned.`}).option(`offset`,{type:`number`,description:`Offset the results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`List all of your Zone's API Shield mTLS Client Certificates by Status and/or using Pagination.`,builder:u(y),handler:async e=>{let n={status:e.status,page:e.page,per_page:e[`per-page`],limit:e.limit,offset:e.offset};if(e.dryRun){s({command:`cf client-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.clientCertificates.list({zone_id:a,...n})),{successLabel:`Loaded`})}},x={command:`client-certificates`,describe:`Issue and manage client certificates for mutual TLS (mTLS) authentication on your zone`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{x as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{S as e,n as t}from"./auth-BqDOIrKX.mjs";import{n}from"./body-parser-CBpeIUns.mjs";import{t as r}from"./output-CUxZRM5A.mjs";import{n as i,t as a}from"./progress-Cent9Lsg.mjs";function o(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const s={command:`list`,describe:`Retrieves the Cloud Connector rules configured for a zone. Rules define how traffic is routed to cloud services.`,builder:o,handler:async n=>{if(n.dryRun){i({command:`cf cloud-connector rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/cloud_connector/rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(n),s=await e({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await a(`Loading`,async()=>o.cloudConnector.rules.list({zone_id:s})),{successLabel:`Loaded`})}};function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const l={command:`update`,describe:`Updates Cloud Connector rules for a zone, replacing the existing rule configuration.`,builder:c,handler:async o=>{if(o.dryRun){i({command:`cf cloud-connector rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/cloud_connector/rules`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:n(o.body)});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,o.body){let e=n(o.body);r(await a(`Updating`,async()=>s.cloudConnector.rules.update({body:e,zone_id:c})),{successLabel:`Updated`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},u={command:`rules`,describe:`Routing rules that map request patterns to cloud provider endpoints`,builder:e=>e.command(s).command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},d={command:`cloud-connector`,describe:`Route traffic from Cloudflare directly to cloud provider services (AWS, Azure, GCP) without origin servers`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{d as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(e){return e.option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0})}const h={command:`create`,describe:`Create Workers VPC connectivity service`,builder:m,handler:async r=>{if(r.dryRun){l({command:`cf connectivity directory services create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/connectivity/directory/services`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({host:{ipv4:d(r[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(r[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(r[`host-ipv6`],`host-ipv6`,`text`),hostname:d(r[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:r[`host-resolver-network-resolver-ips`],tunnel_id:d(r[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(r.name,`name`,`text`),tls_settings:{cert_verification_mode:d(r[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(r.type,`type`,`text`),http_port:r[`http-port`],https_port:r[`https-port`],app_protocol:d(r[`app-protocol`],`app-protocol`,`text`),tcp_port:r[`tcp-port`]}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.connectivity.directory.services.create({body:e,account_id:m})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await t(`name`,`The name field`)),r.type===void 0&&(r.type=await n(`type`,`The type field`,[`tcp`,`http`]));let h=s({host:{ipv4:d(r[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(r[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(r[`host-ipv6`],`host-ipv6`,`text`),hostname:d(r[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:r[`host-resolver-network-resolver-ips`],tunnel_id:d(r[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(r.name,`name`,`text`),tls_settings:{cert_verification_mode:d(r[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(r.type,`type`,`text`),http_port:r[`http-port`],https_port:r[`https-port`],app_protocol:d(r[`app-protocol`],`app-protocol`,`text`),tcp_port:r[`tcp-port`]});c(await u(`Creating`,async()=>p.connectivity.directory.services.create({body:h,account_id:m})),{successLabel:`Created`})}};function g(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <service-id>`,describe:`Delete Workers VPC connectivity service`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf connectivity directory services delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/connectivity/directory/services/${t[`service-id`]==null?`<service-id>`:encodeURIComponent(String(t[`service-id`]))}`,pathParams:{"service-id":String(t[`service-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>n.connectivity.directory.services.delete({account_id:o,service_id:t[`service-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <service-id>`,describe:`Get Workers VPC connectivity service`,builder:v,handler:async t=>{if(t.dryRun){l({command:`cf connectivity directory services get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/connectivity/directory/services/${t[`service-id`]==null?`<service-id>`:encodeURIComponent(String(t[`service-id`]))}`,pathParams:{"service-id":String(t[`service-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.connectivity.directory.services.get({account_id:r,service_id:t[`service-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`type`,{type:`string`,description:`Type`,choices:[`tcp`,`http`]}).option(`page`,{type:`number`,description:`Current page in the response`}).option(`per-page`,{type:`number`,description:`Max amount of entries returned per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`List Workers VPC connectivity services`,builder:p(b),handler:async t=>{let n={type:t.type,page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf connectivity directory services list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/connectivity/directory/services`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.connectivity.directory.services.list({account_id:o,...n})),{successLabel:`Loaded`})}};function S(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all',choices:[`verify_full`,`verify_ca`,`disabled`]}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0})}const C={command:`update <service-id>`,describe:`Update Workers VPC connectivity service`,builder:S,handler:async t=>{if(t.dryRun){l({command:`cf connectivity directory services update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/connectivity/directory/services/${t[`service-id`]==null?`<service-id>`:encodeURIComponent(String(t[`service-id`]))}`,pathParams:{"service-id":String(t[`service-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({host:{ipv4:d(t[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(t[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(t[`host-ipv6`],`host-ipv6`,`text`),hostname:d(t[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:t[`host-resolver-network-resolver-ips`],tunnel_id:d(t[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(t.name,`name`,`text`),tls_settings:{cert_verification_mode:d(t[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(t.type,`type`,`text`),http_port:t[`http-port`],https_port:t[`https-port`],app_protocol:d(t[`app-protocol`],`app-protocol`,`text`),tcp_port:t[`tcp-port`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.connectivity.directory.services.update({body:e,account_id:r,service_id:t[`service-id`]})),{successLabel:`Updated`});return}let p=s({host:{ipv4:d(t[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:d(t[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:d(t[`host-ipv6`],`host-ipv6`,`text`),hostname:d(t[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:t[`host-resolver-network-resolver-ips`],tunnel_id:d(t[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:d(t.name,`name`,`text`),tls_settings:{cert_verification_mode:d(t[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:d(t.type,`type`,`text`),http_port:t[`http-port`],https_port:t[`https-port`],app_protocol:d(t[`app-protocol`],`app-protocol`,`text`),tcp_port:t[`tcp-port`]});c(await u(`Updating`,async()=>n.connectivity.directory.services.update({body:p,account_id:r,service_id:t[`service-id`]})),{successLabel:`Updated`})}},w={command:`services`,describe:`Connectivity service entries that define available network endpoints and their properties`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},T={command:`directory`,describe:`Operations for directory`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`connectivity`,describe:`Service directory for network connectivity endpoints and their configurations`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{E as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,_ as t,n}from"./auth-BqDOIrKX.mjs";import{n as r,t as i}from"./body-parser-CBpeIUns.mjs";import{t as a}from"./output-CUxZRM5A.mjs";import{n as o,t as s}from"./progress-Cent9Lsg.mjs";import{t as c}from"./local-D8bhHUMK.mjs";function l(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`reboot-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`restart-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`shutdown-purge`,{type:`boolean`,description:`Purge connector state.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Interrupt action for a connector.`})}const u={command:`create <connector-id>`,describe:`Creates an interrupt for a Magic WAN Connector.`,builder:l,handler:async l=>{if(l.dryRun){o({command:`cf connector-interrupts create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${l[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(l[`connector-id`]))}/interrupts`,pathParams:{"connector-id":String(l[`connector-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({reboot:{purge:l[`reboot-purge`]},restart:{purge:l[`restart-purge`]},shutdown:{purge:l[`shutdown-purge`]}}):r(l.body)});return}let u=await n(l),d=l.local?c:await t(u);if(l.accountId=d,l.body){let e=r(l.body);a(await s(`Creating`,async()=>u.connectorInterrupts.create({...e,account_id:d,connector_id:l[`connector-id`]})),{successLabel:`Created`});return}let f=i({reboot:{purge:l[`reboot-purge`]},restart:{purge:l[`restart-purge`]},shutdown:{purge:l[`shutdown-purge`]}});a(await s(`Creating`,async()=>u.connectorInterrupts.create({...f,account_id:d,connector_id:l[`connector-id`]})),{successLabel:`Created`})}};function d(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`list`,describe:`Lists interrupts for a Magic WAN Connector.`,builder:d,handler:async r=>{if(r.dryRun){o({command:`cf connector-interrupts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${r[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(r[`connector-id`]))}/interrupts`,pathParams:{"connector-id":String(r[`connector-id`]??``)},bodyKind:`none`});return}let i=await n(r),l=r.local?c:await t(i);r.accountId=l,a(await s(`Loading`,async()=>i.connectorInterrupts.list({account_id:l,connector_id:r[`connector-id`]})),{successLabel:`Loaded`})}},p={command:`connector-interrupts`,describe:`connector-interrupts`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,_ as t,n}from"./auth-BqDOIrKX.mjs";import{t as r}from"./output-CUxZRM5A.mjs";import{n as i,t as a}from"./progress-Cent9Lsg.mjs";import{t as o}from"./local-D8bhHUMK.mjs";import{t as s}from"./cli-types-CMNMD1V7.mjs";function c(e){return e.positional(`event-n`,{type:`string`,description:`Event n`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`event-t`,{type:`string`,description:`Event t`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get <event-n>`,describe:`Gets Magic WAN Connector Telemetry Event`,builder:s(c),handler:async s=>{if(s.dryRun){i({command:`cf connector-telemetry-events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/events/${s[`event-t`]==null?`<event-t>`:encodeURIComponent(String(s[`event-t`]))}.${s[`event-n`]==null?`<event-n>`:encodeURIComponent(String(s[`event-n`]))}`,pathParams:{"connector-id":String(s[`connector-id`]??``),"event-t":String(s[`event-t`]??``),"event-n":String(s[`event-n`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.connectorTelemetryEvents.get({account_id:l,connector_id:s[`connector-id`],event_t:s[`event-t`],event_n:s[`event-n`]})),{successLabel:`Loaded`})}};function u(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`k`,{type:`string`,description:`Filter by event kind`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`Lists Magic WAN Connector Telemetry Events`,builder:u,handler:async s=>{let c={from:s.from,to:s.to,limit:s.limit,cursor:s.cursor,k:s.k};if(s.dryRun){i({command:`cf connector-telemetry-events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/events`,pathParams:{"connector-id":String(s[`connector-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.connectorTelemetryEvents.list({account_id:u,connector_id:s[`connector-id`],...c})),{successLabel:`Loaded`})}},f={command:`connector-telemetry-events`,describe:`connector-telemetry-events`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,_ as t,n}from"./auth-BqDOIrKX.mjs";import{t as r}from"./output-CUxZRM5A.mjs";import{n as i,t as a}from"./progress-Cent9Lsg.mjs";import{t as o}from"./local-D8bhHUMK.mjs";import{t as s}from"./cli-types-CMNMD1V7.mjs";function c(e){return e.positional(`snapshot-t`,{type:`string`,description:`Snapshot t`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get <snapshot-t>`,describe:`Gets Magic WAN Connector Telemetry Snapshot`,builder:s(c),handler:async s=>{if(s.dryRun){i({command:`cf connector-telemetry-snapshots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/snapshots/${s[`snapshot-t`]==null?`<snapshot-t>`:encodeURIComponent(String(s[`snapshot-t`]))}`,pathParams:{"connector-id":String(s[`connector-id`]??``),"snapshot-t":String(s[`snapshot-t`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.connectorTelemetrySnapshots.get({account_id:l,connector_id:s[`connector-id`],snapshot_t:s[`snapshot-t`]})),{successLabel:`Loaded`})}};function u(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`Lists Magic WAN Connector Telemetry Snapshots`,builder:u,handler:async s=>{let c={from:s.from,to:s.to,limit:s.limit,cursor:s.cursor};if(s.dryRun){i({command:`cf connector-telemetry-snapshots list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}/telemetry/snapshots`,pathParams:{"connector-id":String(s[`connector-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.connectorTelemetrySnapshots.list({account_id:u,connector_id:s[`connector-id`],...c})),{successLabel:`Loaded`})}},f={command:`connector-telemetry-snapshots`,describe:`connector-telemetry-snapshots`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};