cf 0.5.0 → 0.7.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 (317) hide show
  1. package/dist/_meta/agent-context.json +78 -41
  2. package/dist/_meta/commands.json +19888 -21071
  3. package/dist/_meta/schemas.json +14305 -15328
  4. package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
  5. package/dist/account-D8mYiWxQ.mjs +2 -0
  6. package/dist/accounts-CJci1Oez.mjs +23 -0
  7. package/dist/acm-CmCd985Q.mjs +3 -0
  8. package/dist/addressing-R7p6TRBe.mjs +12 -0
  9. package/dist/{agent-context-DMPfi54f.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
  10. package/dist/ai-BzJg0RIX.mjs +3 -0
  11. package/dist/ai-audit-B0vJNOZG.mjs +2 -0
  12. package/dist/ai-gateway-D3vJR3My.mjs +10 -0
  13. package/dist/ai-search-CNg7W7U4.mjs +7 -0
  14. package/dist/alerting-_sdM0B0S.mjs +6 -0
  15. package/dist/alerts-dpT6Qsdu.mjs +2 -0
  16. package/dist/{analytics-DSSRDZz8.mjs → analytics-BFBJhDrP.mjs} +1 -1
  17. package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
  18. package/dist/api-gateway-D4AIEtUq.mjs +33 -0
  19. package/dist/argo-Bjk6nFfs.mjs +2 -0
  20. package/dist/artifacts-Ba4b3iOa.mjs +4 -0
  21. package/dist/{audit-logs-BuExU_nz.mjs → audit-logs-BE0T5All.mjs} +1 -1
  22. package/dist/{auth-CSC4yhEJ.mjs → auth-CZ0E51rF.mjs} +3 -3
  23. package/dist/auth-D_zyQbDR.mjs +5 -0
  24. package/dist/autorag-Cnpp8PAG.mjs +2 -0
  25. package/dist/billing-Dz6Zj8Eq.mjs +2 -0
  26. package/dist/bot-management-pFwIbFi-.mjs +5 -0
  27. package/dist/botnet-feed-BY9uGChY.mjs +3 -0
  28. package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
  29. package/dist/brands-CGpk9nZB.mjs +2 -0
  30. package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
  31. package/dist/browser-run-DhHtz4y3.mjs +4 -0
  32. package/dist/build-CWuStmDi.mjs +2 -0
  33. package/dist/cache-DVhkiIGK.mjs +5 -0
  34. package/dist/calls-95zjvIcO.mjs +4 -0
  35. package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
  36. package/dist/cf-BLT7uKJF.mjs +18 -0
  37. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
  38. package/dist/clear-DXx8WBAN.mjs +2 -0
  39. package/dist/client-certificates-D6mE4vJu.mjs +3 -0
  40. package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
  41. package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
  42. package/dist/{completions-DOeHPdCG.mjs → completions-DMc_PlIw.mjs} +2 -2
  43. package/dist/connectivity-DJkE3crz.mjs +3 -0
  44. package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
  45. package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
  46. package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
  47. package/dist/connectors-zWaZTi2A.mjs +3 -0
  48. package/dist/content-scanning-CGvGf04y.mjs +4 -0
  49. package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
  50. package/dist/custom-certificates-CWUrPYLP.mjs +5 -0
  51. package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
  52. package/dist/custom-hostnames-CVQSksqq.mjs +5 -0
  53. package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
  54. package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
  55. package/dist/d1-78Ym1P6D.mjs +4 -0
  56. package/dist/data-security-zmFoMwRU.mjs +6 -0
  57. package/dist/{dcv-delegation-Bgf86J-r.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
  58. package/dist/{deploy-dVrgDUOp.mjs → deploy-CVvkZFjR.mjs} +1 -1
  59. package/dist/{dev-C01_Lby6.mjs → dev-DSslyDXx.mjs} +1 -1
  60. package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
  61. package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
  62. package/dist/dist-B7hsuvbF.mjs +57 -0
  63. package/dist/dist-BH-4NQOV.mjs +134 -0
  64. package/dist/dns-D7VAaCyO.mjs +29 -0
  65. package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
  66. package/dist/domain-info-CRvKc2Lg.mjs +2 -0
  67. package/dist/durable-objects-BIpvyu9m.mjs +2 -0
  68. package/dist/email-auth-Cx--s8W4.mjs +2 -0
  69. package/dist/email-routing-CiDbivcN.mjs +10 -0
  70. package/dist/email-security-BYeAuSc6.mjs +12 -0
  71. package/dist/email-sending-Dg2rSmHH.mjs +4 -0
  72. package/dist/filters-DZ8YnQ90.mjs +4 -0
  73. package/dist/firewall-DEd1hs_I.mjs +11 -0
  74. package/dist/flagship-DVw7xGoP.mjs +4 -0
  75. package/dist/{fraud-C03MtdZb.mjs → fraud-BbGS3FZs.mjs} +2 -2
  76. package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
  77. package/dist/healthchecks-Da9N3ix4.mjs +4 -0
  78. package/dist/hostnames-mimZu2tB.mjs +3 -0
  79. package/dist/hyperdrive-BNdvxOos.mjs +21 -0
  80. package/dist/iam-DGQ-OgRl.mjs +6 -0
  81. package/dist/images-CI6Iy9ho.mjs +7 -0
  82. package/dist/index.mjs +1 -1
  83. package/dist/intel-BDB-aRtU.mjs +3 -0
  84. package/dist/internal-Czlp5Ekb.mjs +2 -0
  85. package/dist/{ips-nv9INuWZ.mjs → ips-B9UuPvsY.mjs} +1 -1
  86. package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
  87. package/dist/kv-BHerx4dZ.mjs +5 -0
  88. package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
  89. package/dist/live-Ce7dZW7p.mjs +2 -0
  90. package/dist/load-balancers-DSjS5WKw.mjs +6 -0
  91. package/dist/logexplorer-DBIfTlRP.mjs +24 -0
  92. package/dist/logo-matches-C00iGpzW.mjs +2 -0
  93. package/dist/logos-CJLhx1go.mjs +3 -0
  94. package/dist/logpush-Cr1U-eK-.mjs +5 -0
  95. package/dist/logs-DMvtchc6.mjs +3 -0
  96. package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
  97. package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
  98. package/dist/magic-transit-DiKiPUax.mjs +110 -0
  99. package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
  100. package/dist/matches-B0yHbQ2I.mjs +2 -0
  101. package/dist/moq-UgBawOXe.mjs +13 -0
  102. package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
  103. package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
  104. package/dist/oauth-DBJ5GSFk.mjs +40 -0
  105. package/dist/observability-B-1y36QS.mjs +4 -0
  106. package/dist/organization-Dq3PClZ7.mjs +41 -0
  107. package/dist/organizations-AhsQkHyX.mjs +2 -0
  108. package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
  109. package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
  110. package/dist/origin-tls-client-auth-BDw5q-6G.mjs +4 -0
  111. package/dist/{page-rules-EZHJePmn.mjs → page-rules-DqYQ23eg.mjs} +5 -5
  112. package/dist/{page-shield-CXJioWPs.mjs → page-shield-DKdlZOLO.mjs} +5 -5
  113. package/dist/pages-BsXF11Kv.mjs +11 -0
  114. package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
  115. package/dist/pipelines-D_QhSnGW.mjs +6 -0
  116. package/dist/progress-O88q63Bk.mjs +2 -0
  117. package/dist/prompt-DTAWiEm2.mjs +3 -0
  118. package/dist/queries-CAE95-OH.mjs +3 -0
  119. package/dist/queues-BBz35Mqd.mjs +6 -0
  120. package/dist/r2-Zp99S5xF.mjs +21 -0
  121. package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
  122. package/dist/radar-Cij-XVQJ.mjs +2 -0
  123. package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
  124. package/dist/rate-limits-DSdToIWv.mjs +5 -0
  125. package/dist/raw-fetch-DgezeshQ.mjs +2 -0
  126. package/dist/ready-DMpJvyaz.mjs +2 -0
  127. package/dist/realtime-kit-9rJcapfM.mjs +18 -0
  128. package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
  129. package/dist/refute-BGTpr5sy.mjs +2 -0
  130. package/dist/registrar-CXViZlah.mjs +83 -0
  131. package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
  132. package/dist/request-tracers-DATfBnE9.mjs +2 -0
  133. package/dist/{resolve-C3h-mwp7.mjs → resolve-Bs2sMRYS.mjs} +1 -1
  134. package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
  135. package/dist/resource-tagging-BTn05AOj.mjs +16 -0
  136. package/dist/rules-ens3OHme.mjs +4 -0
  137. package/dist/rulesets-bkreZRao.mjs +8 -0
  138. package/dist/rum-CpgXFcwl.mjs +4 -0
  139. package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
  140. package/dist/scan-page-BqoQTk3R.mjs +2 -0
  141. package/dist/{schema-BR31o4P6.mjs → schema-DCF4yEp_.mjs} +1 -1
  142. package/dist/schema-validation-Ca6o94ts.mjs +24 -0
  143. package/dist/scim-C4oT8TMc.mjs +4 -0
  144. package/dist/sdk-pQ5kaGUX.mjs +3 -0
  145. package/dist/search-C4T5riPh.mjs +2 -0
  146. package/dist/secrets-store-CWEuiDNo.mjs +7 -0
  147. package/dist/security-center-BOvm7xy6.mjs +2 -0
  148. package/dist/security-txt-BCAUBctN.mjs +3 -0
  149. package/dist/session-B1ARgLG7.mjs +2 -0
  150. package/dist/share-DhmVspmL.mjs +5 -0
  151. package/dist/shared-Bod3-Exx.mjs +990 -0
  152. package/dist/signed-url-DA509wgp.mjs +2 -0
  153. package/dist/smart-shield-DZm4fn6z.mjs +3 -0
  154. package/dist/snippets-oQ0u26-z.mjs +4 -0
  155. package/dist/{spawn-CCGzKlC4.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
  156. package/dist/{spectrum-pVGxb7u5.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
  157. package/dist/speed-DqNnvLBD.mjs +4 -0
  158. package/dist/{src-DU7FBCOX.mjs → src-By-zTCHz.mjs} +9 -9
  159. package/dist/ssl-tS3CYZsZ.mjs +15 -0
  160. package/dist/state-OsdDJvdj.mjs +2 -0
  161. package/dist/stream-Bud9Os5V.mjs +14 -0
  162. package/dist/submission-info-DfIXmu-M.mjs +2 -0
  163. package/dist/submit-BtP8she2.mjs +2 -0
  164. package/dist/tenant-CMwHa-tU.mjs +2 -0
  165. package/dist/token-validation-BYC7HTok.mjs +10 -0
  166. package/dist/{tools-D_hfUU_Z.mjs → tools-Dru4l8yh.mjs} +1 -1
  167. package/dist/total-queries-DdLBNJzd.mjs +2 -0
  168. package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
  169. package/dist/turnstile-CP4nScaL.mjs +23 -0
  170. package/dist/{ui-erjBdVKL.mjs → ui-BNoF0KpD.mjs} +2 -2
  171. package/dist/url-info-Chs9h7Y-.mjs +2 -0
  172. package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
  173. package/dist/url-scanner-D4pYNlO-.mjs +2 -0
  174. package/dist/user-DtefniLc.mjs +11 -0
  175. package/dist/vectorize-BeAY2g-7.mjs +4 -0
  176. package/dist/verify-D7J3F_NZ.mjs +2 -0
  177. package/dist/{versions-CBHwWPAM.mjs → versions-dMW3bLVv.mjs} +1 -1
  178. package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
  179. package/dist/web3-Dhw79l4S.mjs +4 -0
  180. package/dist/workers-builds-CuOAB3u4.mjs +7 -0
  181. package/dist/workers-l3zMNOU6.mjs +20 -0
  182. package/dist/workflows-rb7RYBKP.mjs +6 -0
  183. package/dist/zaraz-CHecMYuo.mjs +2 -0
  184. package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
  185. package/dist/zone-BnnqJwW-.mjs +2 -0
  186. package/dist/zones-DpI2YikF.mjs +21 -0
  187. package/package.json +3 -1
  188. package/dist/abuse-reports-Ina5TlsU.mjs +0 -8
  189. package/dist/accounts-B_joQcMi.mjs +0 -22
  190. package/dist/acm-_kIHqYME.mjs +0 -3
  191. package/dist/addressing-CaFlw8y1.mjs +0 -12
  192. package/dist/ai-CqnhNb_c.mjs +0 -2
  193. package/dist/ai-gateway-pgYGI519.mjs +0 -8
  194. package/dist/ai-search-eqQMPQol.mjs +0 -7
  195. package/dist/ai_gateway--vuVLnOm.mjs +0 -4
  196. package/dist/alerting-CPxHiYHb.mjs +0 -6
  197. package/dist/analytics_engine-gWyfnsCs.mjs +0 -2
  198. package/dist/api-gateway-BXXGFCVR.mjs +0 -33
  199. package/dist/argo-aC6A3JyX.mjs +0 -2
  200. package/dist/artifacts-HD4V2xpK.mjs +0 -4
  201. package/dist/auth-D5hNsOFq.mjs +0 -5
  202. package/dist/billing-COaghyxl.mjs +0 -2
  203. package/dist/bot-management-DmEzeV1Y.mjs +0 -5
  204. package/dist/botnet-feed-ByEAXAkw.mjs +0 -3
  205. package/dist/brand-protection-dPrGe8sL.mjs +0 -3
  206. package/dist/browser-rendering-BiSGnpBf.mjs +0 -4
  207. package/dist/build-HuS9-R0V.mjs +0 -1054
  208. package/dist/cache-CY-7Lt71.mjs +0 -5
  209. package/dist/calls-wOQGDWPl.mjs +0 -4
  210. package/dist/certificate-authorities-CtqzAtxQ.mjs +0 -2
  211. package/dist/client-certificates-CRf41xLe.mjs +0 -3
  212. package/dist/cloud-connector-BA5IRZUP.mjs +0 -2
  213. package/dist/cloudforce-one-Bq_qPAWs.mjs +0 -21
  214. package/dist/config-B5k-XbwS.mjs +0 -2
  215. package/dist/connectivity-Bx3MgTHX.mjs +0 -3
  216. package/dist/connector-interrupts-D7ylweJZ.mjs +0 -2
  217. package/dist/connector-telemetry-events-6izV1kbP.mjs +0 -2
  218. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +0 -2
  219. package/dist/connectors-DRt4e6d_.mjs +0 -3
  220. package/dist/content-scanning-Cd2vy5Sz.mjs +0 -4
  221. package/dist/context-jpewmual.mjs +0 -2
  222. package/dist/custom-certificates-DYE-9epx.mjs +0 -5
  223. package/dist/custom-hostnames-CtuTdFcX.mjs +0 -5
  224. package/dist/custom-nameservers-CWqA51in.mjs +0 -3
  225. package/dist/custom-pages-DeUKEFGe.mjs +0 -4
  226. package/dist/d1-DvWY9Gp4.mjs +0 -4
  227. package/dist/data-security-BPo6dIWu.mjs +0 -6
  228. package/dist/diagnostics-6nKPmVgz.mjs +0 -3
  229. package/dist/dispatch-namespaces-64lXx2WJ.mjs +0 -7
  230. package/dist/dist-C6zxsVdY.mjs +0 -306
  231. package/dist/dist-t_YrL25p.mjs +0 -82
  232. package/dist/dns-ClciFGxx.mjs +0 -29
  233. package/dist/dns-firewall-DfUmXDCe.mjs +0 -57
  234. package/dist/durable-objects-CMaYZ-YU.mjs +0 -2
  235. package/dist/email-routing-CGXhFqF5.mjs +0 -10
  236. package/dist/email-security-D5viPq8S.mjs +0 -8
  237. package/dist/email-sending-C2jpc3gh.mjs +0 -3
  238. package/dist/filters-bzsFcWt0.mjs +0 -4
  239. package/dist/firewall-DYZcTtIC.mjs +0 -11
  240. package/dist/google-tag-gateway-Dfy887yA.mjs +0 -2
  241. package/dist/healthchecks-DRoAlWgr.mjs +0 -4
  242. package/dist/hostnames-CFgIVI3s.mjs +0 -3
  243. package/dist/hyperdrive-C7-gwTSV.mjs +0 -18
  244. package/dist/iam-DqVPzGrb.mjs +0 -6
  245. package/dist/images-BYfl4YgR.mjs +0 -7
  246. package/dist/intel-duTEPIHc.mjs +0 -3
  247. package/dist/keyless-certificates-CRCDVd3g.mjs +0 -3
  248. package/dist/kv-CZoV4tiv.mjs +0 -5
  249. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +0 -3
  250. package/dist/load-balancers--OMg0HNt.mjs +0 -6
  251. package/dist/logpush-C0_lZTyY.mjs +0 -4
  252. package/dist/logs-BtpWZQfV.mjs +0 -3
  253. package/dist/magic-cloud-networking-u6rwYbGg.mjs +0 -5
  254. package/dist/magic-network-monitoring-CKgQyRj4.mjs +0 -4
  255. package/dist/magic-transit-CLhMcJ_-.mjs +0 -89
  256. package/dist/managed-transforms-D0Z2mlth.mjs +0 -3
  257. package/dist/mtls-certificates-BL65NK5T.mjs +0 -3
  258. package/dist/network-interconnects-Bgu9gmaG.mjs +0 -36
  259. package/dist/oauth-Bk-F-tIO.mjs +0 -52
  260. package/dist/observability-BynRbTF4.mjs +0 -4
  261. package/dist/organizations-BqJHyvMK.mjs +0 -41
  262. package/dist/origin-ca-certificates-BGvYwm3C.mjs +0 -3
  263. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +0 -2
  264. package/dist/origin-tls-client-auth-d3snC3vr.mjs +0 -4
  265. package/dist/pages-D4aYteKk.mjs +0 -11
  266. package/dist/pipelines-G8Iusxq-.mjs +0 -6
  267. package/dist/progress-DrDErV9w.mjs +0 -2
  268. package/dist/queues-DEkbKqZX.mjs +0 -6
  269. package/dist/r2-CV0IkCAW.mjs +0 -21
  270. package/dist/r2-data-catalog-NtqGC_a_.mjs +0 -14
  271. package/dist/radar-D986zPJr.mjs +0 -2
  272. package/dist/rate-limits-B2wRsUX1.mjs +0 -5
  273. package/dist/raw-fetch-_n0lMAnD.mjs +0 -2
  274. package/dist/realtime-kit-Ld3c5eU6.mjs +0 -18
  275. package/dist/registrar-CDIwTz3G.mjs +0 -46
  276. package/dist/request-tracers-D7SFMDik.mjs +0 -2
  277. package/dist/resource-sharing-YIQ04jXE.mjs +0 -5
  278. package/dist/resource-tagging-Bd6Y03sg.mjs +0 -16
  279. package/dist/rules-DHjLP5Kx.mjs +0 -4
  280. package/dist/rulesets-q4QABpKs.mjs +0 -8
  281. package/dist/rum-SmT4HZmM.mjs +0 -4
  282. package/dist/schema-validation-vVetgC_P.mjs +0 -24
  283. package/dist/scim-ChOkZpNx.mjs +0 -3
  284. package/dist/sdk-DhIhH6GB.mjs +0 -5
  285. package/dist/secrets-store-BAK9G12O.mjs +0 -25
  286. package/dist/security-center-eScuYDKP.mjs +0 -2
  287. package/dist/security-txt-x7R4gmQu.mjs +0 -3
  288. package/dist/session-DHYCE-PM.mjs +0 -93
  289. package/dist/shared-BAjo72Lz.mjs +0 -2
  290. package/dist/smart-shield-CWlSsNi8.mjs +0 -3
  291. package/dist/snippets-DrlgYJYp.mjs +0 -4
  292. package/dist/speed-ZFrMWDgd.mjs +0 -4
  293. package/dist/ssl-9JY05sYt.mjs +0 -15
  294. package/dist/stream-tRU39b8K.mjs +0 -14
  295. package/dist/tenants-HLGUazms.mjs +0 -2
  296. package/dist/token-validation-_VdamKpz.mjs +0 -10
  297. package/dist/turnstile-BRzXd28B.mjs +0 -23
  298. package/dist/url-normalization-D-NxuLtN.mjs +0 -3
  299. package/dist/url-scanner-BzzR6iDx.mjs +0 -2
  300. package/dist/user-C4omq__w.mjs +0 -10
  301. package/dist/vectorize-By6EqcNR.mjs +0 -4
  302. package/dist/waiting-rooms-u6KwrzWd.mjs +0 -11
  303. package/dist/web3-DQ5dmE9W.mjs +0 -4
  304. package/dist/workers-D8Be7_as.mjs +0 -18
  305. package/dist/workers-builds-BE3W3qNk.mjs +0 -7
  306. package/dist/workflows-BWWufqFA.mjs +0 -4
  307. package/dist/zaraz-Bsa9AvVL.mjs +0 -2
  308. package/dist/zero-trust-UNVZFnKu.mjs +0 -118
  309. package/dist/zero_trust-B0_Rk4p2.mjs +0 -3
  310. package/dist/zones-BXtdwt6E.mjs +0 -21
  311. /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
  312. /package/dist/{cli-types-BeyOc81z.mjs → cli-types-CFw6Xygp.mjs} +0 -0
  313. /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
  314. /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
  315. /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
  316. /package/dist/{metadata-OOwvpR8m.mjs → metadata-Cnyws6iO.mjs} +0 -0
  317. /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import{S as e,T as t,g as n,w as r,x as i}from"./oauth-Bk-F-tIO.mjs";import{i as a,n as o}from"./auth-CSC4yhEJ.mjs";import{n as s,t as c}from"./body-parser-DWSy7uZ8.mjs";import{t as l}from"./output-B6fBFRqe.mjs";import{n as u,t as d}from"./progress-DrDErV9w.mjs";import{n as f}from"./input-validation-_fMCApaH.mjs";import{t as p}from"./local-CYc9q7l2.mjs";import{t as m}from"./cli-types-BeyOc81z.mjs";function ee(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).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 te={command:`create`,describe:`Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:ee,handler:async r=>{if(r.dryRun){u({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`)}):s(r.body)});return}let i=await o(r),a=r.local?p:await n(i);if(r.accountId=a,r.body){let e=s(r.body);l(await d(`Creating`,async()=>i.firewall.accessRules.create({...e,account_id:a})),{successLabel:`Created`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`)});l(await d(`Creating`,async()=>i.firewall.accessRules.create({...m,account_id:a})),{successLabel:`Created`})}};function h(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,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 g={command:`delete <rule-id>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:h,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let i=await o(t),a=t.local?p:await n(i);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}l(await d(`Deleting`,async()=>i.firewall.accessRules.delete({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).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:`edit <rule-id>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:_,handler:async r=>{if(r.dryRun){u({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`),notes:f(r.notes,`notes`,`text`)}):s(r.body)});return}let i=await o(r),a=r.local?p:await n(i);if(r.accountId=a,r.body){let e=s(r.body);l(await d(`Updating`,async()=>i.firewall.accessRules.edit({body:e,account_id:a,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(r[`configuration-target`],`configuration-target`,`text`),value:f(r[`configuration-value`],`configuration-value`,`text`)},mode:f(r.mode,`mode`,`text`),notes:f(r.notes,`notes`,`text`)});l(await d(`Updating`,async()=>i.firewall.accessRules.edit({body:m,account_id:a,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <rule-id>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let r=await o(t),i=t.local?p:await n(r);t.accountId=i,l(await d(`Loading`,async()=>r.firewall.accessRules.get({account_id:i,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
4
- Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async t=>{let r={mode:t.mode,"configuration.target":t[`configuration-target`],"configuration.value":t[`configuration-value`],notes:t.notes,match:t.match,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){u({command:`cf firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},query:r,bodyKind:`none`});return}let i=await o(t),a=t.local?p:await n(i);t.accountId=a,l(await d(`Loading`,async()=>i.firewall.accessRules.list({account_id:a,...r})),{successLabel:`Loaded`})}},C={command:`access-rules`,describe:`IP-based access rules that allow, block, challenge, or whitelist traffic globally or per-zone`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 T={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:w,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls});l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...r,zone_id:n})),{successLabel:`Created`})}};function E(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,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 D={command:`delete <lock-downs-id>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:E,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}l(await d(`Deleting`,async()=>t.firewall.lockdowns.delete({zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <lock-downs-id>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:O,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.lockdowns.get({zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`modified-on`,{type:`string`,description:`The timestamp of when the rule was last modified.`}).option(`ip`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`uri-search`,{type:`string`,description:`A single URI to search for in the list of URLs of existing rules.`}).option(`ip-range-search`,{type:`string`,description:`A single IP address range to search for in existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`created-on`,{type:`string`,description:`The timestamp of when the rule was created.`}).option(`description-search`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`ip-search`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:A,handler:async e=>{let t={page:e.page,description:e.description,modified_on:e[`modified-on`],ip:e.ip,priority:e.priority,uri_search:e[`uri-search`],ip_range_search:e[`ip-range-search`],per_page:e[`per-page`],created_on:e[`created-on`],description_search:e[`description-search`],ip_search:e[`ip-search`]};if(e.dryRun){u({command:`cf firewall lockdowns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.lockdowns.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function M(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 N={command:`update <lock-downs-id>`,describe:`Updates an existing Zone Lockdown rule.`,builder:M,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...r,zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...r,zone_id:n,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`})}},P={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:F,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({...r,zone_id:n})),{successLabel:`Deleted`});return}l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({zone_id:n})),{successLabel:`Deleted`})}};function L(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 R={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:L,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkEdit({body:r,zone_id:n})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PATCH`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function z(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 B={command:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkUpdate({body:r,zone_id:n})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PUT`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function V(e){return e.option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).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 H={command:`create`,describe:`Create one or more firewall rules.`,builder:V,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.rules.create({...r,zone_id:n})),{successLabel:`Created`});return}let r=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Creating`,async()=>t.firewall.rules.create({...r,zone_id:n})),{successLabel:`Created`})}};function U(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`delete-filter-if-unused`,{type:`boolean`,description:`When true, indicates that Cloudflare should also delete the associated filter if there are no other firewall rules referencing the filter.`}).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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`delete <rule-id>`,describe:`Deletes an existing firewall rule.`,builder:U,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({delete_filter_if_unused:e[`delete-filter-if-unused`]}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.delete({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({delete_filter_if_unused:e[`delete-filter-if-unused`]});l(await d(`Deleting`,async()=>t.firewall.rules.delete({...a,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).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 K={command:`edit <rule-id>`,describe:`Updates the priority of an existing firewall rule.`,builder:G,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>t.firewall.rules.edit({zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function q(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <rule-id>`,describe:`Fetches the details of a firewall rule.`,builder:q,handler:async e=>{let t={id:e.id};if(e.dryRun){u({command:`cf firewall rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.rules.get({zone_id:r,rule_id:e[`rule-id`],...t})),{successLabel:`Loaded`})}};function Y(e){return e.option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`action`,{type:`string`,description:`The action to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of firewall rules per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the firewall rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:Y,handler:async e=>{let t={description:e.description,action:e.action,page:e.page,per_page:e[`per-page`],id:e.id,paused:e.paused};if(e.dryRun){u({command:`cf firewall rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.rules.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).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 Q={command:`update <rule-id>`,describe:`Updates an existing firewall rule.`,builder:Z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.update({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Updating`,async()=>t.firewall.rules.update({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}},ne={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ua` when specifying a user agent in the rule.",choices:[`ua`]}).option(`configuration-value`,{type:`string`,description:`the user agent to exactly match`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).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 ie={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:re,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.firewall.uaRules.create({...t,zone_id:r})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Creating`,async()=>n.firewall.uaRules.create({...a,zone_id:r})),{successLabel:`Created`})}};function ae(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,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 oe={command:`delete <ua-rule-id>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:ae,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}l(await d(`Deleting`,async()=>t.firewall.uaRules.delete({zone_id:n,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <ua-rule-id>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:se,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.uaRules.get({zone_id:n,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`user-agent`,{type:`string`,description:`A string to search for in the user agent values of existing rules.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:le,handler:async e=>{let t={page:e.page,description:e.description,per_page:e[`per-page`],user_agent:e[`user-agent`],paused:e.paused};if(e.dryRun){u({command:`cf firewall ua-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.uaRules.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function de(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).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 fe={command:`update <ua-rule-id>`,describe:`Updates an existing User Agent Blocking rule.`,builder:de,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.firewall.uaRules.update({...t,zone_id:r,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Updating`,async()=>n.firewall.uaRules.update({...a,zone_id:r,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`})}},pe={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 he={command:`create`,describe:`Creates a URI-based WAF override for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:me,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...r,zone_id:n})),{successLabel:`Created`})}};function ge(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,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 _e={command:`delete <overrides-id>`,describe:`Deletes an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ge,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
9
- `);return}l(await d(`Deleting`,async()=>t.firewall.waf.overrides.delete({zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.overrides.get({zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.overrides.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...r,zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let r=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...r,zone_id:n,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.get({zone_id:n,package_id:e[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).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 Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...r,zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...r,zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.groups.get({zone_id:n,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async e=>{let t={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){u({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.groups.list({zone_id:r,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){u({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.list({zone_id:r,...t})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`on`,`off`]}).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 Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...r,zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...r,zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.firewall.waf.packages.rules.get({zone_id:n,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async e=>{let t={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){u({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.waf.packages.rules.list({zone_id:r,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).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 Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.firewall.zoneAccessRules.create({...t,zone_id:r})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)});l(await d(`Creating`,async()=>n.firewall.zoneAccessRules.create({...a,zone_id:r})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({cascade:f(e.cascade,`cascade`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
10
- `);return}if(e.body){let r=s(e.body);l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({cascade:f(e.cascade,`cascade`,`text`)});l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...a,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function Je(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).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 Ye={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:Je,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)}):s(e.body)});return}let t=await o(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let r=c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)});l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Xe(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`The target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`The string to search for in the notes of existing IP Access rules.
11
- Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){u({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),r=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>n.firewall.zoneAccessRules.list({zone_id:r,...t})),{successLabel:`Loaded`})}},Qe={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command(Ge).command(qe).command(Ye).command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(C).command(P).command(ne).command(pe).command(Ue).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$e as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{E as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.googleTagGateway.config.get({zone_id:i})),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:e,zone_id:d})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await e(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await e(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let f=i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]});a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:f,zone_id:d})),{successLabel:`Updated`})}},p={command:`config`,describe:`Operations for config`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{E as e,w as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";function u(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).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:`Create a new health check.`,builder:u,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>u.healthchecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`healthcheck-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 p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).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 h={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"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.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...t})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).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 preview health check.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-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 C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"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.healthchecks.previews.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}},E={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).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 O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.healthchecks.update({body:e,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(t.address,`address`,`text`),check_regions:t[`check-regions`],consecutive_fails:t[`consecutive-fails`],consecutive_successes:t[`consecutive-successes`],description:l(t.description,`description`,`text`),http_config:{allow_insecure:t[`http-config-allow-insecure`],expected_body:l(t[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:t[`http-config-expected-codes`],follow_redirects:t[`http-config-follow-redirects`],method:l(t[`http-config-method`],`http-config-method`,`text`),path:l(t[`http-config-path`],`http-config-path`,`text`),port:t[`http-config-port`]},interval:t.interval,name:l(t.name,`name`,`text`),retries:t.retries,suspended:t.suspended,tcp_config:{method:l(t[`tcp-config-method`],`tcp-config-method`,`text`),port:t[`tcp-config-port`]},timeout:t.timeout,type:l(t.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.update({body:f,zone_id:d,healthcheck_id:t[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(O).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{k as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{w as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{i as n,n as r}from"./auth-CSC4yhEJ.mjs";import{n as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{t as c}from"./cli-types-BeyOc81z.mjs";function l(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:c(l),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tlsSingle.get({zone_id:i,setting_id:e[`setting-id`],hostname:e.hostname})),{successLabel:`Loaded`})}},d={command:`tls-single`,describe:`Operations for settings.tls-single`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',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 p={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:c(f),handler:async n=>{if(n.dryRun){o({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/hostnames/settings/${n[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(n[`setting-id`]))}/${n.hostname==null?`<hostname>`:encodeURIComponent(String(n.hostname))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"setting-id":String(n[`setting-id`]??``),hostname:String(n.hostname??``)},bodyKind:`none`});return}let i=await r(n),c=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await e({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>i.hostnames.settings.tls.delete({zone_id:c,setting_id:n[`setting-id`],hostname:n.hostname})),{successLabel:`Deleted`})}};function m(e){return e.positional(`setting-id`,{type:`string`,description:'The TLS Setting name. The value type depends on the setting: - `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`). - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`). - `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:c(m),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tls.get({zone_id:i,setting_id:e[`setting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).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 _={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:c(g),handler:async e=>{if(e.dryRun){o({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let c=await r(e),l=await t({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);a(await s(`Updating`,async()=>c.hostnames.settings.tls.update({...t,zone_id:l,setting_id:e[`setting-id`],hostname:e.hostname})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n(c,`PUT`,`/zones/${e.zoneId}/hostnames/settings/${encodeURIComponent(String(e[`setting-id`]))}/${encodeURIComponent(String(e.hostname))}`)),{successLabel:`Updated`})}},v={command:`tls`,describe:`Operations for settings.tls`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(v).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";function p(e){return e.option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
3
-
4
- Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
5
- If not specified, defaults to 20 for free tier and 60 for paid tier.
6
- Contact Cloudflare if you need a higher limit.
7
- `}).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(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const m={command:`create`,describe:`Creates and returns a new Hyperdrive configuration.`,builder:p,handler:async i=>{if(i.dryRun){l({command:`cf hyperdrive create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`json`,body:i.body===void 0?s({caching:{disabled:i[`caching-disabled`],max_age:i[`caching-max-age`],stale_while_revalidate:i[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(i[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(i[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(i[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(i.name,`name`,`text`),origin:{database:d(i[`origin-database`],`origin-database`,`text`),password:d(i[`origin-password`],`origin-password`,`text`),scheme:d(i[`origin-scheme`],`origin-scheme`,`text`),user:d(i[`origin-user`],`origin-user`,`text`),host:d(i[`origin-host`],`origin-host`,`text`),port:i[`origin-port`],access_client_id:d(i[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(i[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(i[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:i[`origin-connection-limit`]}):o(i.body)});return}let p=await a(i),m=i.local?f:await r(p);if(i.accountId=m,i.body){let e=o(i.body);c(await u(`Creating`,async()=>p.hyperdrive.create({body:e,account_id:m})),{successLabel:`Created`});return}i.name===void 0&&(i.name=await e(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),i[`origin-database`]===void 0&&(i[`origin-database`]=await e(`origin-database`,`Set the name of your origin database.`)),i[`origin-password`]===void 0&&(i[`origin-password`]=await e(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),i[`origin-scheme`]===void 0&&(i[`origin-scheme`]=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),i[`origin-user`]===void 0&&(i[`origin-user`]=await e(`origin-user`,`Set the user of your origin database.`));let h=s({caching:{disabled:i[`caching-disabled`],max_age:i[`caching-max-age`],stale_while_revalidate:i[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(i[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(i[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(i[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(i.name,`name`,`text`),origin:{database:d(i[`origin-database`],`origin-database`,`text`),password:d(i[`origin-password`],`origin-password`,`text`),scheme:d(i[`origin-scheme`],`origin-scheme`,`text`),user:d(i[`origin-user`],`origin-user`,`text`),host:d(i[`origin-host`],`origin-host`,`text`),port:i[`origin-port`],access_client_id:d(i[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(i[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(i[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:i[`origin-connection-limit`]});c(await u(`Creating`,async()=>p.hyperdrive.create({body:h,account_id:m})),{successLabel:`Created`})}};function h(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,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 g={command:`delete <hyperdrive-id>`,describe:`Deletes the specified Hyperdrive.`,builder:h,handler:async e=>{if(e.dryRun){l({command:`cf hyperdrive delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}c(await u(`Deleting`,async()=>n.hyperdrive.delete({account_id:o,hyperdrive_id:e[`hyperdrive-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
9
-
10
- Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
11
- If not specified, defaults to 20 for free tier and 60 for paid tier.
12
- Contact Cloudflare if you need a higher limit.
13
- `}).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:`edit <hyperdrive-id>`,describe:`Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf hyperdrive edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({caching:{disabled:e[`caching-disabled`],max_age:e[`caching-max-age`],stale_while_revalidate:e[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(e[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(e[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(e[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(e.name,`name`,`text`),origin_connection_limit:e[`origin-connection-limit`]}):o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>n.hyperdrive.edit({...t,account_id:i,hyperdrive_id:e[`hyperdrive-id`]})),{successLabel:`Updated`});return}let p=s({caching:{disabled:e[`caching-disabled`],max_age:e[`caching-max-age`],stale_while_revalidate:e[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(e[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(e[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(e[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(e.name,`name`,`text`),origin_connection_limit:e[`origin-connection-limit`]});c(await u(`Updating`,async()=>n.hyperdrive.edit({...p,account_id:i,hyperdrive_id:e[`hyperdrive-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <hyperdrive-id>`,describe:`Returns the specified Hyperdrive configuration.`,builder:y,handler:async e=>{if(e.dryRun){l({command:`cf hyperdrive get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.hyperdrive.get({account_id:i,hyperdrive_id:e[`hyperdrive-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Returns a list of Hyperdrives.`,builder:x,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf hyperdrive list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await r(i);e.accountId=o,c(await u(`Loading`,async()=>i.hyperdrive.list({account_id:o,...n})),{successLabel:`Loaded`})}};function C(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
14
-
15
- Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
16
- If not specified, defaults to 20 for free tier and 60 for paid tier.
17
- Contact Cloudflare if you need a higher limit.
18
- `}).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(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const w={command:`update <hyperdrive-id>`,describe:`Updates and returns the specified Hyperdrive configuration.`,builder:C,handler:async i=>{if(i.dryRun){l({command:`cf hyperdrive update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${i[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(i[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(i[`hyperdrive-id`]??``)},bodyKind:`json`,body:i.body===void 0?s({caching:{disabled:i[`caching-disabled`],max_age:i[`caching-max-age`],stale_while_revalidate:i[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(i[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(i[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(i[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(i.name,`name`,`text`),origin:{database:d(i[`origin-database`],`origin-database`,`text`),password:d(i[`origin-password`],`origin-password`,`text`),scheme:d(i[`origin-scheme`],`origin-scheme`,`text`),user:d(i[`origin-user`],`origin-user`,`text`),host:d(i[`origin-host`],`origin-host`,`text`),port:i[`origin-port`],access_client_id:d(i[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(i[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(i[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:i[`origin-connection-limit`]}):o(i.body)});return}let p=await a(i),m=i.local?f:await r(p);if(i.accountId=m,i.body){let e=o(i.body);c(await u(`Updating`,async()=>p.hyperdrive.update({body:e,account_id:m,hyperdrive_id:i[`hyperdrive-id`]})),{successLabel:`Updated`});return}i.name===void 0&&(i.name=await e(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),i[`origin-database`]===void 0&&(i[`origin-database`]=await e(`origin-database`,`Set the name of your origin database.`)),i[`origin-password`]===void 0&&(i[`origin-password`]=await e(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),i[`origin-scheme`]===void 0&&(i[`origin-scheme`]=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),i[`origin-user`]===void 0&&(i[`origin-user`]=await e(`origin-user`,`Set the user of your origin database.`));let h=s({caching:{disabled:i[`caching-disabled`],max_age:i[`caching-max-age`],stale_while_revalidate:i[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(i[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(i[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(i[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(i.name,`name`,`text`),origin:{database:d(i[`origin-database`],`origin-database`,`text`),password:d(i[`origin-password`],`origin-password`,`text`),scheme:d(i[`origin-scheme`],`origin-scheme`,`text`),user:d(i[`origin-user`],`origin-user`,`text`),host:d(i[`origin-host`],`origin-host`,`text`),port:i[`origin-port`],access_client_id:d(i[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(i[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(i[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:i[`origin-connection-limit`]});c(await u(`Updating`,async()=>p.hyperdrive.update({body:h,account_id:m,hyperdrive_id:i[`hyperdrive-id`]})),{successLabel:`Updated`})}},T={command:`hyperdrive`,describe:`Accelerate access to existing databases by caching queries and pooling connections at the edge`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{T as default};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{E as e,S as t,g as n,w as r}from"./oauth-Bk-F-tIO.mjs";import{n as i}from"./auth-CSC4yhEJ.mjs";import{n as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-DrDErV9w.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{t as f}from"./cli-types-BeyOc81z.mjs";function p(e){return e.positional(`permission-group-id`,{type:`string`,description:`Permission Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <permission-group-id>`,describe:`Get information about a specific permission group in an account.`,builder:p,handler:async e=>{if(e.dryRun){c({command:`cf iam permission-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/permission_groups/${e[`permission-group-id`]==null?`<permission-group-id>`:encodeURIComponent(String(e[`permission-group-id`]))}`,pathParams:{"permission-group-id":String(e[`permission-group-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.iam.permissionGroups.get({account_id:a,permission_group_id:e[`permission-group-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`id`,{type:`string`,description:`ID of the permission group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the permission group to be fetched.`}).option(`label`,{type:`string`,description:`Label of the permission group to be fetched.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List all the permissions groups for an account.`,builder:h,handler:async e=>{let r={id:e.id,name:e.name,label:e.label,page:e.page,per_page:e[`per-page`]};if(e.dryRun){c({command:`cf iam permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/permission_groups`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.permissionGroups.list({account_id:o,...r})),{successLabel:`Loaded`})}},_={command:`permission-groups`,describe:`View the permission groups that can be assigned to API tokens and policies`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`name`,{type:`string`,description:`Name of the resource group`}).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 y={command:`create`,describe:`Create a new Resource Group under the specified account.`,builder:v,handler:async r=>{if(r.dryRun){c({command:`cf iam resource-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?o({name:u(r.name,`name`,`text`)}):a(r.body)});return}let f=await i(r),p=r.local?d:await n(f);if(r.accountId=p,r.body){let e=a(r.body);s(await l(`Creating`,async()=>f.iam.resourceGroups.create({...e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await e(`name`,`Name of the resource group`));let m=o({name:u(r.name,`name`,`text`)});s(await l(`Creating`,async()=>f.iam.resourceGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,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 x={command:`delete <resource-group-id>`,describe:`Remove a resource group from an account.`,builder:b,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${e[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(e[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(e[`resource-group-id`]??``)},bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}s(await l(`Deleting`,async()=>a.iam.resourceGroups.delete({account_id:o,resource_group_id:e[`resource-group-id`]})),{successLabel:`Deleted`})}};function S(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <resource-group-id>`,describe:`Get information about a specific resource group in an account.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${e[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(e[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(e[`resource-group-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.iam.resourceGroups.get({account_id:a,resource_group_id:e[`resource-group-id`]})),{successLabel:`Loaded`})}};function w(e){return e.option(`id`,{type:`string`,description:`ID of the resource group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the resource group to be fetched.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`List all the resource groups for an account.`,builder:w,handler:async e=>{let r={id:e.id,name:e.name};if(e.dryRun){c({command:`cf iam resource-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.resourceGroups.list({account_id:o,...r})),{successLabel:`Loaded`})}};function E(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the resource group`}).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 <resource-group-id>`,describe:`Modify an existing resource group.`,builder:E,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${e[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(e[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(e[`resource-group-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({name:u(e.name,`name`,`text`)}):a(e.body)});return}let r=await i(e),f=e.local?d:await n(r);if(e.accountId=f,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.iam.resourceGroups.update({...t,account_id:f,resource_group_id:e[`resource-group-id`]})),{successLabel:`Updated`});return}let p=o({name:u(e.name,`name`,`text`)});s(await l(`Updating`,async()=>r.iam.resourceGroups.update({...p,account_id:f,resource_group_id:e[`resource-group-id`]})),{successLabel:`Updated`})}},O={command:`resource-groups`,describe:`Define scopes that limit which account resources a policy or token can access`,builder:e=>e.command(y).command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`begin-verification <sso-connector-id>`,describe:`Validates the user has added the DNS TXT record required for validating ownership of the domain they are trying to set up a connector for.`,builder:k,handler:async e=>{if(e.dryRun){c({command:`cf iam sso begin-verification`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}/begin_verification`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Creating`,async()=>r.iam.sso.beginVerification({account_id:a,sso_connector_id:e[`sso-connector-id`]})),{successLabel:`Created`})}};function j(e){return e.option(`begin-verification`,{type:`boolean`,description:`Begin the verification process after creation`,default:!0}).option(`email-domain`,{type:`string`,description:`Email domain of the new SSO connector`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`,default:!1}).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:`create`,describe:`Creates a new SSO connector for logging into Cloudflare through an identity provider.`,builder:j,handler:async r=>{if(r.dryRun){c({command:`cf iam sso create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`json`,body:r.body===void 0?o({begin_verification:r[`begin-verification`],email_domain:u(r[`email-domain`],`email-domain`,`text`),use_fedramp_language:r[`use-fedramp-language`]}):a(r.body)});return}let f=await i(r),p=r.local?d:await n(f);if(r.accountId=p,r.body){let e=a(r.body);s(await l(`Creating`,async()=>f.iam.sso.create({...e,account_id:p})),{successLabel:`Created`});return}r[`email-domain`]===void 0&&(r[`email-domain`]=await e(`email-domain`,`Email domain of the new SSO connector`));let m=o({begin_verification:r[`begin-verification`],email_domain:u(r[`email-domain`],`email-domain`,`text`),use_fedramp_language:r[`use-fedramp-language`]});s(await l(`Creating`,async()=>f.iam.sso.create({...m,account_id:p})),{successLabel:`Created`})}};function N(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,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 P={command:`delete <sso-connector-id>`,describe:`Deletes an SSO connector from the account.`,builder:N,handler:async e=>{if(e.dryRun){c({command:`cf iam sso delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}s(await l(`Deleting`,async()=>a.iam.sso.delete({account_id:o,sso_connector_id:e[`sso-connector-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <sso-connector-id>`,describe:`Retrieves details for a specific SSO connector.`,builder:F,handler:async e=>{if(e.dryRun){c({command:`cf iam sso get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.iam.sso.get({account_id:a,sso_connector_id:e[`sso-connector-id`]})),{successLabel:`Loaded`})}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Lists all SSO connectors configured for the account.`,builder:I,handler:async e=>{if(e.dryRun){c({command:`cf iam sso list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.iam.sso.list({account_id:a})),{successLabel:`Loaded`})}};function R(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`SSO Connector enabled state`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`}).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 z={command:`update <sso-connector-id>`,describe:`Updates the state or configuration of an SSO connector.`,builder:R,handler:async e=>{if(e.dryRun){c({command:`cf iam sso update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({enabled:e.enabled,use_fedramp_language:e[`use-fedramp-language`]}):a(e.body)});return}let r=await i(e),u=e.local?d:await n(r);if(e.accountId=u,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.iam.sso.update({...t,account_id:u,sso_connector_id:e[`sso-connector-id`]})),{successLabel:`Updated`});return}let f=o({enabled:e.enabled,use_fedramp_language:e[`use-fedramp-language`]});s(await l(`Updating`,async()=>r.iam.sso.update({...f,account_id:u,sso_connector_id:e[`sso-connector-id`]})),{successLabel:`Updated`})}},B={command:`sso`,describe:`Configure single sign-on connectors to authenticate account members through an external identity provider`,builder:e=>e.command(A).command(M).command(P).command(ee).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`name`,{type:`string`,description:`Name of the User group.`}).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 H={command:`create`,describe:`Create a new user group under the specified account.`,builder:V,handler:async r=>{if(r.dryRun){c({command:`cf iam user-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?o({name:u(r.name,`name`,`text`)}):a(r.body)});return}let f=await i(r),p=r.local?d:await n(f);if(r.accountId=p,r.body){let e=a(r.body);s(await l(`Creating`,async()=>f.iam.userGroups.create({...e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await e(`name`,`Name of the User group.`));let m=o({name:u(r.name,`name`,`text`)});s(await l(`Creating`,async()=>f.iam.userGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function U(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,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 W={command:`delete <user-group-id>`,describe:`Remove a user group from an account.`,builder:U,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}s(await l(`Deleting`,async()=>a.iam.userGroups.delete({account_id:o,user_group_id:e[`user-group-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <user-group-id>`,describe:`Get information about a specific user group in an account.`,builder:G,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.iam.userGroups.get({account_id:a,user_group_id:e[`user-group-id`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`id`,{type:`string`,description:`ID of the user group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the user group to be fetched.`}).option(`fuzzy-name`,{type:`string`,description:`A string used for searching for user groups containing that substring.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`The sort order of returned user groups by name (ascending or descending).`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`List all the user groups for an account.`,builder:f(q),handler:async e=>{let r={id:e.id,name:e.name,fuzzyName:e[`fuzzy-name`],page:e.page,per_page:e[`per-page`],direction:e.direction};if(e.dryRun){c({command:`cf iam user-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.list({account_id:o,...r})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).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 <user-group-id>`,describe:`Add members to a User Group.`,builder:Y,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let r=await i(e),o=e.local?d:await n(r);if(e.accountId=o,e.body){let t=a(e.body);s(await l(`Creating`,async()=>r.iam.userGroups.members.create({body:t,account_id:o,user_group_id:e[`user-group-id`]})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Z(e){return e.positional(`member-id`,{type:`string`,description:`The identifier of an existing account Member.`,demandOption:!0}).option(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,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 Q={command:`delete <member-id>`,describe:`Remove a member from User Group`,builder:Z,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members/${e[`member-id`]==null?`<member-id>`:encodeURIComponent(String(e[`member-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``),"member-id":String(e[`member-id`]??``)},bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}s(await l(`Deleting`,async()=>a.iam.userGroups.members.delete({account_id:o,user_group_id:e[`user-group-id`],member_id:e[`member-id`]})),{successLabel:`Deleted`})}};function $(e){return e.option(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`fuzzy-email`,{type:`string`,description:`A string used for filtering members by partial email match.`}).option(`direction`,{type:`string`,description:`The sort order of returned user group members by email.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`list`,describe:`List all the members attached to a user group.`,builder:f($),handler:async e=>{let r={page:e.page,per_page:e[`per-page`],fuzzyEmail:e[`fuzzy-email`],direction:e.direction};if(e.dryRun){c({command:`cf iam user-groups members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.members.list({account_id:o,user_group_id:e[`user-group-id`],...r})),{successLabel:`Loaded`})}};function ne(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Set/Replace members to a user group.`})}const re={command:`update <user-group-id>`,describe:`Replace the set of members attached to a User Group.`,builder:ne,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let r=await i(e),o=e.local?d:await n(r);if(e.accountId=o,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.iam.userGroups.members.update({body:t,account_id:o,user_group_id:e[`user-group-id`]})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ie={command:`members`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(X).command(Q).command(te).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the User group.`}).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 oe={command:`update <user-group-id>`,describe:`Modify an existing user group.`,builder:ae,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({name:u(e.name,`name`,`text`)}):a(e.body)});return}let r=await i(e),f=e.local?d:await n(r);if(e.accountId=f,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.iam.userGroups.update({...t,account_id:f,user_group_id:e[`user-group-id`]})),{successLabel:`Updated`});return}let p=o({name:u(e.name,`name`,`text`)});s(await l(`Updating`,async()=>r.iam.userGroups.update({...p,account_id:f,user_group_id:e[`user-group-id`]})),{successLabel:`Updated`})}},se={command:`user-groups`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(H).command(W).command(K).command(J).command(oe).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ce={command:`iam`,describe:`Identity and access management — permission groups, resource groups, user groups, and SSO connectors`,builder:e=>e.command(_).command(O).command(B).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ce as default};
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{i as a,n as o}from"./auth-CSC4yhEJ.mjs";import{n as s,t as c}from"./body-parser-DWSy7uZ8.mjs";import{t as l}from"./output-B6fBFRqe.mjs";import{n as u,t as d}from"./progress-DrDErV9w.mjs";import{n as f,t as p}from"./input-validation-_fMCApaH.mjs";import{t as m}from"./local-CYc9q7l2.mjs";import{t as h}from"./cli-types-BeyOc81z.mjs";import{n as ee,t as te}from"./raw-fetch-_n0lMAnD.mjs";function g(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`id`,{type:`string`,description:`An optional custom unique identifier for your image.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can use used for keeping references to another system of record for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token for the access.`}).option(`url`,{type:`string`,description:`A URL to fetch an image from origin. Only needed when type is uploading from a URL.`})}const _={command:`create`,describe:`Upload an image to CF Images. Images up to 10 Megabytes can be uploaded using a single HTTP POST (multipart/form-data) request by sending an image file or passing a URL accessible to the API.`,builder:g,handler:async e=>{if(e.dryRun){u({command:`cf images create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,creator:e.creator,id:e.id,metadata:e.metadata,"require-signed-urls":e[`require-signed-urls`],url:e.url}});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.creator!==void 0||e.id!==void 0||e.metadata!==void 0||e[`require-signed-urls`]!==void 0||e.url!==void 0){let t=new FormData;if(e.file){let n=p(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);if(e.creator!==void 0&&t.append(`creator`,String(f(e.creator,`creator`,`text`)??``)),e.id!==void 0&&t.append(`id`,String(f(e.id,`id`,`text`)??``)),e.metadata!==void 0){let n=typeof e.metadata==`string`?f(e.metadata,`metadata`,`text`):e.metadata;t.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}e[`require-signed-urls`]!==void 0&&t.append(`requireSignedURLs`,String(e[`require-signed-urls`])),e.url!==void 0&&t.append(`url`,String(f(e.url,`url`,`text`)??``)),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/images/v1`,{body:t})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/images/v1`,{body:t,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.images.create({account_id:i})),{successLabel:`Created`})}};function v(e){return e.positional(`image-id`,{type:`string`,description:`Image unique 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 y={command:`delete <image-id>`,describe:`Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.`,builder:v,handler:async e=>{if(e.dryRun){u({command:`cf images delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force,message:`This operation will delete this image.`})){process.stderr.write(`Aborted.
3
- `);return}l(await d(`Deleting`,async()=>n.images.delete({account_id:a,image_id:e[`image-id`]})),{successLabel:`Deleted`})}};function b(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`expiry`,{type:`string`,description:`The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours.`}).option(`id`,{type:`string`,description:`Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a UUID.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can be used for keeping references to another system of record, for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token to be accessed.`})}const x={command:`direct-upload`,describe:"Direct uploads allow users to upload images without API keys. A common use case are web apps, client-side applications, or mobile devices where users upload content directly to Cloudflare Images. This method creates a draft record for a future image. It returns an upload URL and an image identifier. To verify if the image itself has been uploaded, send an image details request (accounts/:account_identifier/images/v1/:identifier), and check that the `draft: true` property is not present.",builder:b,handler:async e=>{if(e.dryRun){u({command:`cf images direct-upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/direct_upload`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,creator:e.creator,expiry:e.expiry,id:e.id,metadata:e.metadata,"require-signed-urls":e[`require-signed-urls`]}});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.creator!==void 0||e.expiry!==void 0||e.id!==void 0||e.metadata!==void 0||e[`require-signed-urls`]!==void 0){let t=new FormData;if(e.file){let n=p(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);if(e.creator!==void 0&&t.append(`creator`,String(f(e.creator,`creator`,`text`)??``)),e.expiry!==void 0&&t.append(`expiry`,String(f(e.expiry,`expiry`,`text`)??``)),e.id!==void 0&&t.append(`id`,String(f(e.id,`id`,`text`)??``)),e.metadata!==void 0){let n=typeof e.metadata==`string`?f(e.metadata,`metadata`,`text`):e.metadata;t.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}e[`require-signed-urls`]!==void 0&&t.append(`requireSignedURLs`,String(e[`require-signed-urls`])),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/images/v2/direct_upload`,{body:t})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/images/v2/direct_upload`,{body:t,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.images.directUpload({account_id:i})),{successLabel:`Created`})}};function S(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the image can be accessed using only its UID. If set to `true`, a signed token needs to be generated with a signing key to view the image. Returns a new UID on a change. No change if not specified."}).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 C={command:`edit <image-id>`,describe:`Update a CF Images image's metadata, creator, or access control. On access control change, all copies of the image are purged from cache.`,builder:S,handler:async e=>{if(e.dryRun){u({command:`cf images edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({creator:f(e.creator,`creator`,`text`),requireSignedURLs:e[`require-signed-urls`]}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>n.images.edit({...t,account_id:i,image_id:e[`image-id`]})),{successLabel:`Updated`});return}let a=c({creator:f(e.creator,`creator`,`text`),requireSignedURLs:e[`require-signed-urls`]});l(await d(`Updating`,async()=>n.images.edit({...a,account_id:i,image_id:e[`image-id`]})),{successLabel:`Updated`})}};function w(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const T={command:`get-blob <image-id>`,describe:`Download an image from CF Images. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.`,builder:w,handler:async e=>{if(e.dryRun){u({command:`cf images get-blob`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}/blob`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i;let a=await d(`Loading`,async()=>te(`/accounts/${i}/images/v1/${encodeURIComponent(String(e[`image-id`]))}/blob`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));ee(e.text===!0?a.toString(`utf-8`):a)}};function E(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <image-id>`,describe:`Fetch details for a CF Images image.`,builder:E,handler:async e=>{if(e.dryRun){u({command:`cf images get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.get({account_id:i,image_id:e[`image-id`]})),{successLabel:`Loaded`})}};function O(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`create <signing-key-name>`,describe:`Create a new CF Images signing key with specified name. Returns all keys available.`,builder:O,handler:async e=>{if(e.dryRun){u({command:`cf images keys create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys/${e[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(e[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(e[`signing-key-name`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Updating`,async()=>n.images.keys.create({account_id:i,signing_key_name:e[`signing-key-name`]})),{successLabel:`Updated`})}};function A(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key name`,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 j={command:`delete <signing-key-name>`,describe:`Delete a CF Images signing key with specified name. Returns all keys available. When the last key is removed, a new default signing key will be generated.`,builder:A,handler:async e=>{if(e.dryRun){u({command:`cf images keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys/${e[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(e[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(e[`signing-key-name`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force,message:`This operation will delete this signing key. This will invalidate any URLs that are signed with this key.`})){process.stderr.write(`Aborted.
4
- `);return}l(await d(`Deleting`,async()=>n.images.keys.delete({account_id:a,signing_key_name:e[`signing-key-name`]})),{successLabel:`Deleted`})}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`List your CF Images signing keys.`,builder:M,handler:async e=>{if(e.dryRun){u({command:`cf images keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.keys.list({account_id:i})),{successLabel:`Loaded`})}},P={command:`keys`,describe:`Operations for keys`,builder:e=>e.command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`continuation-token`,{type:`string`,description:`Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint.`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`sort-order`,{type:`string`,description:`Sorting order by upload time`,choices:[`asc`,`desc`]}).option(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:"List up to 10000 images from CF Images, with up to 1000 results per page. Use the optional parameters below to get a specific range of images. Pagination is supported via continuation_token. **Metadata Filtering (Optional):** You can optionally filter images by custom metadata fields using the `meta.<field>[<operator>]=<value>` syntax. **Supported Operators:** - `eq` / `eq:string` / `eq:number` / `eq:boolean` - Exact match - `gt` / `gt:number` - Greater than (number only) - `gte` / `gte:number` - Greater than or equal (number only) - `lt` / `lt:number` - Less than (number only) - `lte` / `lte:number` - Less than or equal (number only) - `in` / `in:string` / `in:number` - Match any value in list (pipe-separated) **Metadata Filter Constraints:** - Maximum 5 metadata filters per request - Maximum 5 levels of nesting (e.g., `meta.first.second.third.fourth.fifth`) - Maximum 10 elements for list operators (`in`) - Supports string, number, and boolean value types - Range operators (`gt`, `gte`, `lt`, `lte`) only accept numeric values **Filter Consistency:** Filters are combined with AND logic. The system does not validate whether filter combinations are logically consistent. For example, `meta.priority[eq:number]=5&meta.priority[lte:number]=3` will return zero results because no value can satisfy both conditions simultaneously. It is the caller's responsibility to ensure filter combinations make sense. **Examples:** ``` # List all images /images/v2 # Filter by metadata [eq] /images/v2?meta.status[eq:string]=active # Filter by metadata [in] /images/v2?meta.status[in]=pending|deleted|flagged # Filter by metadata [in:number] /images/v2?meta.ratings[in:number]=4|5 # Filter by metadata range [gte:number] /images/v2?meta.priority[gte:number]=1 # Filter by bounded range /images/v2?meta.priority[gte:number]=1&meta.priority[lte:number]=5 # Filter by nested metadata /images/v2?meta.region.name[eq]=eu-west # Combine metadata filters with creator /images/v2?meta.status[eq]=active&creator=user123 # Multiple metadata filters (AND logic) /images/v2?meta.status[eq]=active&meta.priority[eq:number]=5 ```",builder:h(F),handler:async e=>{let n={continuation_token:e[`continuation-token`],per_page:e[`per-page`],sort_order:e[`sort-order`],creator:e.creator};if(e.dryRun){u({command:`cf images list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.images.list({account_id:a,...n})),{successLabel:`Loaded`})}};function L(e){return e.option(`conflict-behaviour`,{type:`string`,description:`How to handle objects that already exist at the destination.`,choices:[`skip`,`overwrite`],default:`skip`}).option(`excluded-content-types`,{type:`string`,array:!0,description:`Content types to skip during migration.`}).option(`path-prefix`,{type:`string`,description:`Prefix to prepend to image custom IDs.`}).option(`root-directory`,{type:`string`,description:`Only import objects under this prefix in the source bucket.`}).option(`source-id`,{type:`string`,description:`The identifier of the source to migrate from.`}).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 R={command:`create`,describe:`Create a new migration from an existing source. The migration will import objects from the source bucket into Cloudflare Images.`,builder:L,handler:async n=>{if(n.dryRun){u({command:`cf images sourcing-kit migrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({conflictBehaviour:f(n[`conflict-behaviour`],`conflict-behaviour`,`text`),excludedContentTypes:n[`excluded-content-types`],pathPrefix:f(n[`path-prefix`],`path-prefix`,`text`),rootDirectory:f(n[`root-directory`],`root-directory`,`text`),sourceId:f(n[`source-id`],`source-id`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.images.sourcingKit.migrations.create({...e,account_id:a})),{successLabel:`Created`});return}n[`source-id`]===void 0&&(n[`source-id`]=await e(`source-id`,`The identifier of the source to migrate from.`));let p=c({conflictBehaviour:f(n[`conflict-behaviour`],`conflict-behaviour`,`text`),excludedContentTypes:n[`excluded-content-types`],pathPrefix:f(n[`path-prefix`],`path-prefix`,`text`),rootDirectory:f(n[`root-directory`],`root-directory`,`text`),sourceId:f(n[`source-id`],`source-id`,`text`)});l(await d(`Creating`,async()=>i.images.sourcingKit.migrations.create({...p,account_id:a})),{successLabel:`Created`})}};function z(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource 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 B={command:`delete <migration-id>`,describe:`Delete an existing migration. Only completed, errored, or aborted migrations can be deleted.`,builder:z,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit migrations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}`,pathParams:{"migration-id":String(e[`migration-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}l(await d(`Deleting`,async()=>n.images.sourcingKit.migrations.delete({account_id:a,migration_id:e[`migration-id`]})),{successLabel:`Deleted`})}};function V(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <migration-id>`,describe:`Fetch details for a single migration.`,builder:V,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit migrations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}`,pathParams:{"migration-id":String(e[`migration-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.sourcingKit.migrations.get({account_id:i,migration_id:e[`migration-id`]})),{successLabel:`Loaded`})}};function U(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`abort <migration-id>`,describe:`Abort a running migration. Objects already imported will not be removed.`,builder:U,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit migrations lifecycle abort`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}/lifecycle/abort`,pathParams:{"migration-id":String(e[`migration-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Updating`,async()=>n.images.sourcingKit.migrations.lifecycle.abort({account_id:i,migration_id:e[`migration-id`]})),{successLabel:`Updated`})}};function G(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <migration-id>`,describe:`Get the current progress of a migration including counts of scanned, imported, skipped, and errored objects.`,builder:G,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit migrations lifecycle get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}/lifecycle`,pathParams:{"migration-id":String(e[`migration-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.sourcingKit.migrations.lifecycle.get({account_id:i,migration_id:e[`migration-id`]})),{successLabel:`Loaded`})}};function q(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`logs <migration-id>`,describe:`List log entries for a specific migration.`,builder:q,handler:async e=>{let n={offset:e.offset,limit:e.limit};if(e.dryRun){u({command:`cf images sourcing-kit migrations lifecycle logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}/logs`,pathParams:{"migration-id":String(e[`migration-id`]??``)},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.images.sourcingKit.migrations.lifecycle.logs({account_id:a,migration_id:e[`migration-id`],...n})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`start <migration-id>`,describe:`Start a pending migration. The migration will begin importing objects from the configured source.`,builder:Y,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit migrations lifecycle start`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${e[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(e[`migration-id`]))}/lifecycle/start`,pathParams:{"migration-id":String(e[`migration-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Updating`,async()=>n.images.sourcingKit.migrations.lifecycle.start({account_id:i,migration_id:e[`migration-id`]})),{successLabel:`Updated`})}},Z={command:`lifecycle`,describe:`Operations for sourcing-kit.migrations.lifecycle`,builder:e=>e.command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`list`,describe:`List all migrations for the account.`,builder:Q,handler:async e=>{let n={offset:e.offset,limit:e.limit};if(e.dryRun){u({command:`cf images sourcing-kit migrations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.images.sourcingKit.migrations.list({account_id:a,...n})),{successLabel:`Loaded`})}},re={command:`migrations`,describe:`Operations for sourcing-kit.migrations`,builder:e=>e.command(R).command(B).command(H).command(ne).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`connectivity <source-id>`,describe:`Check the current connectivity status of an existing migration source.`,builder:ie,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit sources connectivity`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${e[`source-id`]==null?`<source-id>`:encodeURIComponent(String(e[`source-id`]))}/connectivity`,pathParams:{"source-id":String(e[`source-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.sourcingKit.sources.connectivity({account_id:i,source_id:e[`source-id`]})),{successLabel:`Loaded`})}};function oe(e){return e.option(`account`,{type:`string`,description:`Account identifier for the bucket (required for R2 vendor).`}).option(`bucket`,{type:`string`,description:`The name of the storage bucket.`}).option(`name`,{type:`string`,description:`A human-readable name for the source.`}).option(`vendor`,{type:`string`,description:`The cloud storage vendor of the source bucket.`,choices:[`s3`,`r2`]}).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 se={command:`create`,describe:`Create a new migration source by providing storage credentials. The service will verify connectivity to the bucket before accepting the source.`,builder:oe,handler:async i=>{if(i.dryRun){u({command:`cf images sourcing-kit sources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources`,pathParams:{},bodyKind:`json`,body:i.body===void 0?c({account:f(i.account,`account`,`text`),bucket:f(i.bucket,`bucket`,`text`),name:f(i.name,`name`,`text`),vendor:f(i.vendor,`vendor`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.images.sourcingKit.sources.create({...e,account_id:p})),{successLabel:`Created`});return}i.bucket===void 0&&(i.bucket=await e(`bucket`,`The name of the storage bucket.`)),i.name===void 0&&(i.name=await e(`name`,`A human-readable name for the source.`)),i.vendor===void 0&&(i.vendor=await n(`vendor`,`The cloud storage vendor of the source bucket.`,[`s3`,`r2`]));let h=c({account:f(i.account,`account`,`text`),bucket:f(i.bucket,`bucket`,`text`),name:f(i.name,`name`,`text`),vendor:f(i.vendor,`vendor`,`text`)});l(await d(`Creating`,async()=>a.images.sourcingKit.sources.create({...h,account_id:p})),{successLabel:`Created`})}};function ce(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource 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 le={command:`delete <source-id>`,describe:`Delete an existing migration source. Sources with active migrations cannot be deleted.`,builder:ce,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit sources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${e[`source-id`]==null?`<source-id>`:encodeURIComponent(String(e[`source-id`]))}`,pathParams:{"source-id":String(e[`source-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}l(await d(`Deleting`,async()=>n.images.sourcingKit.sources.delete({account_id:a,source_id:e[`source-id`]})),{successLabel:`Deleted`})}};function ue(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`get <source-id>`,describe:`Fetch details for a single migration source.`,builder:ue,handler:async e=>{if(e.dryRun){u({command:`cf images sourcing-kit sources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${e[`source-id`]==null?`<source-id>`:encodeURIComponent(String(e[`source-id`]))}`,pathParams:{"source-id":String(e[`source-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.sourcingKit.sources.get({account_id:i,source_id:e[`source-id`]})),{successLabel:`Loaded`})}};function fe(e){return e.option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`name`,{type:`string`,description:`Filter sources by name (partial match).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`list`,describe:`List all configured migration sources for the account.`,builder:fe,handler:async e=>{let n={offset:e.offset,limit:e.limit,name:e.name};if(e.dryRun){u({command:`cf images sourcing-kit sources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.images.sourcingKit.sources.list({account_id:a,...n})),{successLabel:`Loaded`})}};function me(e){return e.option(`account`,{type:`string`,description:`Account identifier for the bucket (required for R2 vendor).`}).option(`bucket`,{type:`string`,description:`The name of the storage bucket.`}).option(`region`,{type:`string`,description:`The region hint for the bucket (S3 only).`}).option(`vendor`,{type:`string`,description:`The cloud storage vendor of the source bucket.`,choices:[`s3`,`r2`]}).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 he={command:`pre-check`,describe:`Verify connectivity to a storage bucket before creating a source. Returns connectivity status without persisting any state.`,builder:me,handler:async i=>{if(i.dryRun){u({command:`cf images sourcing-kit sources pre-check`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:i.body===void 0?c({account:f(i.account,`account`,`text`),bucket:f(i.bucket,`bucket`,`text`),region:f(i.region,`region`,`text`),vendor:f(i.vendor,`vendor`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.images.sourcingKit.sources.preCheck({...e,account_id:p})),{successLabel:`Created`});return}i.bucket===void 0&&(i.bucket=await e(`bucket`,`The name of the storage bucket.`)),i.vendor===void 0&&(i.vendor=await n(`vendor`,`The cloud storage vendor of the source bucket.`,[`s3`,`r2`]));let h=c({account:f(i.account,`account`,`text`),bucket:f(i.bucket,`bucket`,`text`),region:f(i.region,`region`,`text`),vendor:f(i.vendor,`vendor`,`text`)});l(await d(`Creating`,async()=>a.images.sourcingKit.sources.preCheck({...h,account_id:p})),{successLabel:`Created`})}};function ge(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`name`,{type:`string`,description:`Updated name for the source.`}).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 _e={command:`update <source-id>`,describe:`Update the name of an existing migration source.`,builder:ge,handler:async n=>{if(n.dryRun){u({command:`cf images sourcing-kit sources update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${n[`source-id`]==null?`<source-id>`:encodeURIComponent(String(n[`source-id`]))}`,pathParams:{"source-id":String(n[`source-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>i.images.sourcingKit.sources.update({...e,account_id:a,source_id:n[`source-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await e(`name`,`Updated name for the source.`));let p=c({name:f(n.name,`name`,`text`)});l(await d(`Updating`,async()=>i.images.sourcingKit.sources.update({...p,account_id:a,source_id:n[`source-id`]})),{successLabel:`Updated`})}},ve={command:`sources`,describe:`Operations for sourcing-kit.sources`,builder:e=>e.command(ae).command(se).command(le).command(de).command(pe).command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ye={command:`sourcing-kit`,describe:`Operations for sourcing-kit`,builder:e=>e.command(re).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`stats`,describe:`Fetch image statistics details for Cloudflare Images. The returned statistics detail storage usage, including the current image count vs this account's allowance.`,builder:be,handler:async e=>{if(e.dryRun){u({command:`cf images stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/stats`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.stats({account_id:i})),{successLabel:`Loaded`})}};function Se(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`list`,describe:`List up to 100 images with one request. Use the optional parameters below to get a specific range of images.`,builder:Se,handler:async e=>{let n={page:e.page,per_page:e[`per-page`],creator:e.creator};if(e.dryRun){u({command:`cf images v1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1`,pathParams:{},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.images.v1.list({account_id:a,...n})),{successLabel:`Loaded`})}};function we(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get <variant-id>`,describe:`Fetch details for a single variant with properties at the top level of the result.`,builder:we,handler:async e=>{if(e.dryRun){u({command:`cf images v1 variants-flat get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}/flat`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.v1.variantsFlat.get({account_id:i,variant_id:e[`variant-id`]})),{successLabel:`Loaded`})}},Ee={command:`variants-flat`,describe:`Operations for v1.variants-flat`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`v1`,describe:`Operations for v1`,builder:e=>e.command(Ce).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.option(`id`,{type:`string`,description:`The id field`}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`,default:!1}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).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 Oe={command:`create`,describe:`Create a CF Images variant that allows you to resize images for different use cases.`,builder:$,handler:async i=>{if(i.dryRun){u({command:`cf images variants create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`json`,body:i.body===void 0?c({id:f(i.id,`id`,`text`),neverRequireSignedURLs:i[`never-require-signed-urls`],options:{fit:f(i[`options-fit`],`options-fit`,`text`),height:i[`options-height`],metadata:f(i[`options-metadata`],`options-metadata`,`text`),width:i[`options-width`]}}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.images.variants.create({body:e,account_id:p})),{successLabel:`Created`});return}if(i.id===void 0&&(i.id=await e(`id`,`The id field`)),i[`options-fit`]===void 0&&(i[`options-fit`]=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),i[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(i[`options-metadata`]===void 0&&(i[`options-metadata`]=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),i[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let h=c({id:f(i.id,`id`,`text`),neverRequireSignedURLs:i[`never-require-signed-urls`],options:{fit:f(i[`options-fit`],`options-fit`,`text`),height:i[`options-height`],metadata:f(i[`options-metadata`],`options-metadata`,`text`),width:i[`options-width`]}});l(await d(`Creating`,async()=>a.images.variants.create({body:h,account_id:p})),{successLabel:`Created`})}};function ke(e){return e.positional(`variant-id`,{type:`string`,description:`Variant 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 Ae={command:`delete <variant-id>`,describe:`Delete a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf images variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force,message:`This operation will delete this variant.`})){process.stderr.write(`Aborted.
7
- `);return}l(await d(`Deleting`,async()=>n.images.variants.delete({account_id:a,variant_id:e[`variant-id`]})),{successLabel:`Deleted`})}};function je(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).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 Me={command:`edit <variant-id>`,describe:`Update a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:je,handler:async e=>{if(e.dryRun){u({command:`cf images variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({neverRequireSignedURLs:e[`never-require-signed-urls`],options:{fit:f(e[`options-fit`],`options-fit`,`text`),height:e[`options-height`],metadata:f(e[`options-metadata`],`options-metadata`,`text`),width:e[`options-width`]}}):s(e.body)});return}let i=await o(e),a=e.local?m:await r(i);if(e.accountId=a,e.body){let t=s(e.body);l(await d(`Updating`,async()=>i.images.variants.edit({...t,account_id:a,variant_id:e[`variant-id`]})),{successLabel:`Updated`});return}if(e[`options-fit`]===void 0&&(e[`options-fit`]=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),e[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(e[`options-metadata`]===void 0&&(e[`options-metadata`]=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),e[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let p=c({neverRequireSignedURLs:e[`never-require-signed-urls`],options:{fit:f(e[`options-fit`],`options-fit`,`text`),height:e[`options-height`],metadata:f(e[`options-metadata`],`options-metadata`,`text`),width:e[`options-width`]}});l(await d(`Updating`,async()=>i.images.variants.edit({...p,account_id:a,variant_id:e[`variant-id`]})),{successLabel:`Updated`})}};function Ne(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`get <variant-id>`,describe:`Fetch details for a CF Images variant.`,builder:Ne,handler:async e=>{if(e.dryRun){u({command:`cf images variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.variants.get({account_id:i,variant_id:e[`variant-id`]})),{successLabel:`Loaded`})}};function Fe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`list`,describe:`List existing CF Images variants.`,builder:Fe,handler:async e=>{if(e.dryRun){u({command:`cf images variants list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.images.variants.list({account_id:i})),{successLabel:`Loaded`})}},Le={command:`variants`,describe:`Operations for variants`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={command:`images`,describe:`images`,builder:e=>e.command(_).command(y).command(x).command(C).command(D).command(T).command(I).command(xe).command(P).command(ye).command(De).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Re as default};