cf 0.0.6 → 0.2.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 (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Create a new health check.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){l({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/healthchecks`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating healthcheck`,async()=>a.post(`/zones/${t.zoneId}/healthchecks`,{body:e})),{successLabel:`Created healthcheck`});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 d={};t.address!==void 0&&o(d,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(d,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(d,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(d,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(d,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(d,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(d,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(d,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(d,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(d,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(d,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(d,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(d,[`interval`],t.interval),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(d,[`retries`],t.retries),t.suspended!==void 0&&o(d,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(d,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(d,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(d,[`timeout`],t.timeout),t.type!==void 0&&o(d,[`type`],i(t.type,`type`,`text`)),c(await u(`Creating healthcheck`,async()=>a.post(`/zones/${t.zoneId}/healthchecks`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created healthcheck`})}},f={command:`delete <healthcheckId>`,describe:`Delete a health check.`,builder:e=>e.positional(`healthcheckId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.healthcheckId,`healthcheckId`),e.dryRun){l({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/healthchecks/${e.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(e.healthcheckId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`healthcheck`,String(e.healthcheckId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}if(e.body){let t=s(e.body);c(await u(`Deleting healthcheck`,async()=>i.delete(`/zones/${e.zoneId}/healthchecks/${e.healthcheckId}`,{body:t})),{successLabel:`Deleted healthcheck`});return}c(await u(`Deleting healthcheck`,async()=>i.healthchecks.delete(e.healthcheckId,o)),{successLabel:`Deleted healthcheck`})}},p={command:`edit <healthcheckId>`,describe:`Patch a configured health check.`,builder:e=>e.positional(`healthcheckId`,{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.`,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)`}),handler:async t=>{if(a(t.healthcheckId,`healthcheckId`),t.dryRun){l({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/healthchecks/${t.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(t.healthcheckId??``),zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let d=await n(t);if(t.zoneId=await r({zone:t.zone},d,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating healthcheck`,async()=>d.patch(`/zones/${t.zoneId}/healthchecks/${t.healthcheckId}`,{body:e})),{successLabel:`Updated healthcheck`});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={};t.address!==void 0&&o(f,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(f,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(f,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(f,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(f,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(f,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(f,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(f,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(f,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(f,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(f,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(f,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(f,[`interval`],t.interval),t.name!==void 0&&o(f,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(f,[`retries`],t.retries),t.suspended!==void 0&&o(f,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(f,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(f,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(f,[`timeout`],t.timeout),t.type!==void 0&&o(f,[`type`],i(t.type,`type`,`text`)),c(await u(`Updating healthcheck`,async()=>d.patch(`/zones/${t.zoneId}/healthchecks/${t.healthcheckId}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated healthcheck`})}},m={command:`get <healthcheckId>`,describe:`Fetch a single configured health check.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{a(e.healthcheckId,`healthcheckId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading healthcheck`,async()=>t.healthchecks.get(e.healthcheckId,i)),{successLabel:`Loaded healthcheck`})}},h={command:`list`,describe:`List configured health checks.`,builder:e=>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.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading healthchecks`,async()=>i.healthchecks.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded healthchecks`})}},g={command:`create`,describe:`Create a new preview health check.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){l({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/healthchecks/preview`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating preview`,async()=>a.post(`/zones/${t.zoneId}/healthchecks/preview`,{body:e})),{successLabel:`Created preview`});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 d={};t.address!==void 0&&o(d,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(d,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(d,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(d,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(d,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(d,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(d,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(d,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(d,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(d,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(d,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(d,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(d,[`interval`],t.interval),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(d,[`retries`],t.retries),t.suspended!==void 0&&o(d,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(d,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(d,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(d,[`timeout`],t.timeout),t.type!==void 0&&o(d,[`type`],i(t.type,`type`,`text`)),c(await u(`Creating preview`,async()=>a.post(`/zones/${t.zoneId}/healthchecks/preview`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created preview`})}},_={command:`delete <healthcheckId>`,describe:`Delete a health check.`,builder:e=>e.positional(`healthcheckId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.healthcheckId,`healthcheckId`),e.dryRun){l({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/healthchecks/preview/${e.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(e.healthcheckId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`preview`,String(e.healthcheckId??``),{force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}if(e.body){let t=s(e.body);c(await u(`Deleting preview`,async()=>i.delete(`/zones/${e.zoneId}/healthchecks/preview/${e.healthcheckId}`,{body:t})),{successLabel:`Deleted preview`});return}c(await u(`Deleting preview`,async()=>i.healthchecks.previews.delete(e.healthcheckId,o)),{successLabel:`Deleted preview`})}},v={command:`get <healthcheckId>`,describe:`Fetch a single configured health check preview.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{a(e.healthcheckId,`healthcheckId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading preview`,async()=>t.healthchecks.previews.get(e.healthcheckId,i)),{successLabel:`Loaded preview`})}},y={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(g).command(_).command(v).demandCommand(1),handler:()=>{}},b={command:`update <healthcheckId>`,describe:`Update a configured health check.`,builder:e=>e.positional(`healthcheckId`,{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.`,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)`}),handler:async t=>{if(a(t.healthcheckId,`healthcheckId`),t.dryRun){l({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/healthchecks/${t.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(t.healthcheckId??``),zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let d=await n(t);if(t.zoneId=await r({zone:t.zone},d,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating healthcheck`,async()=>d.put(`/zones/${t.zoneId}/healthchecks/${t.healthcheckId}`,{body:e})),{successLabel:`Updated healthcheck`});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={};t.address!==void 0&&o(f,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(f,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(f,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(f,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(f,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(f,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(f,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(f,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(f,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(f,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(f,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(f,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(f,[`interval`],t.interval),t.name!==void 0&&o(f,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(f,[`retries`],t.retries),t.suspended!==void 0&&o(f,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(f,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(f,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(f,[`timeout`],t.timeout),t.type!==void 0&&o(f,[`type`],i(t.type,`type`,`text`)),c(await u(`Updating healthcheck`,async()=>d.put(`/zones/${t.zoneId}/healthchecks/${t.healthcheckId}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated healthcheck`})}},x={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(f).command(p).command(m).command(h).command(b).command(y).demandCommand(1),handler:()=>{}};export{x as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./body-parser-iA3vRFmh.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./progress-5sHFvwez.mjs";const c={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:e=>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. 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}),handler:async e=>{r(e.hostname,`hostname`);let i=await t(e),o=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading tls single`,async()=>i.hostnames.settings.tlsSingle.get(o,e.settingId,e.hostname)),{successLabel:`Loaded tls single`})}},l={command:`tls-single`,describe:`Hostname TLS settings — single hostname lookup`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}},u={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:e=>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. 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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async i=>{if(r(i.hostname,`hostname`),i.dryRun){o({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${i.zoneId??`<zoneId>`}/hostnames/settings/${i.settingId??`<settingId>`}/${i.hostname??`<hostname>`}`,pathParams:{zoneId:String(i.zoneId??``),settingId:String(i.settingId??``),hostname:String(i.hostname??``)},bodyKind:`none`,validation:`passed`});return}let c=await t(i),l=await n({zone:i.zone},c,{quiet:i.quiet});if(i.zoneId=l,!await e(`tl`,String(i.hostname??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting tl`,async()=>c.hostnames.settings.tls.delete(l,i.settingId,i.hostname)),{successLabel:`Deleted tl`})}},d={command:`get <settingId>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:e=>e.positional(`settingId`,{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}),handler:async e=>{r(e.settingId,`settingId`);let i=await t(e),o=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading tl`,async()=>i.hostnames.settings.tls.get(o,e.settingId)),{successLabel:`Loaded tl`})}},f={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:e=>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. 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(r(e.hostname,`hostname`),e.dryRun){o({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/hostnames/settings/${e.settingId??`<settingId>`}/${e.hostname??`<hostname>`}`,pathParams:{zoneId:String(e.zoneId??``),settingId:String(e.settingId??``),hostname:String(e.hostname??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let c=await t(e),l=await n({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);a(await s(`Updating tl`,async()=>c.put(`/zones/${e.zoneId}/hostnames/settings/${e.settingId}/${e.hostname}`,{body:t})),{successLabel:`Updated tl`});return}a(await s(`Updating tl`,async()=>c.hostnames.settings.tls.update(l,e.settingId,e.hostname)),{successLabel:`Updated tl`})}},p={command:`tls`,describe:`Individual hostname TLS configuration overrides (min TLS version, ciphers, HTTP/2, etc.)`,builder:e=>e.command(u).command(d).command(f).demandCommand(1),handler:()=>{}},m={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(p).command(l).demandCommand(1),handler:()=>{}},h={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}};export{h as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Creates and returns a new Hyperdrive configuration.`,builder:e=>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. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. `}).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`]),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf hyperdrive create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`json`,body:{cachingDisabled:i.cachingDisabled,cachingMaxAge:i.cachingMaxAge,cachingStaleWhileRevalidate:i.cachingStaleWhileRevalidate,mtlsCaCertificateId:i.mtlsCaCertificateId,mtlsCertificateId:i.mtlsCertificateId,mtlsSslmode:i.mtlsSslmode,name:i.name,originDatabase:i.originDatabase,originPassword:i.originPassword,originScheme:i.originScheme,originUser:i.originUser,originHost:i.originHost,originPort:i.originPort,originAccessClientId:i.originAccessClientId,originAccessClientSecret:i.originAccessClientSecret,originServiceId:i.originServiceId,originConnectionLimit:i.originConnectionLimit,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating hyperdrive`,async()=>m.post(`/accounts/${h}/hyperdrive/configs`,{body:e})),{successLabel:`Created hyperdrive`});return}i.name===void 0&&(i.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),i.originDatabase===void 0&&(i.originDatabase=await t(`origin-database`,`Set the name of your origin database.`)),i.originPassword===void 0&&(i.originPassword=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),i.originScheme===void 0&&(i.originScheme=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),i.originUser===void 0&&(i.originUser=await t(`origin-user`,`Set the user of your origin database.`));let g={};i.cachingDisabled!==void 0&&c(g,[`caching`,`disabled`],i.cachingDisabled),i.cachingMaxAge!==void 0&&c(g,[`caching`,`max_age`],i.cachingMaxAge),i.cachingStaleWhileRevalidate!==void 0&&c(g,[`caching`,`stale_while_revalidate`],i.cachingStaleWhileRevalidate),i.mtlsCaCertificateId!==void 0&&c(g,[`mtls`,`ca_certificate_id`],o(i.mtlsCaCertificateId,`mtlsCaCertificateId`,`text`)),i.mtlsCertificateId!==void 0&&c(g,[`mtls`,`mtls_certificate_id`],o(i.mtlsCertificateId,`mtlsCertificateId`,`text`)),i.mtlsSslmode!==void 0&&c(g,[`mtls`,`sslmode`],o(i.mtlsSslmode,`mtlsSslmode`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.originDatabase!==void 0&&c(g,[`origin`,`database`],o(i.originDatabase,`originDatabase`,`text`)),i.originPassword!==void 0&&c(g,[`origin`,`password`],o(i.originPassword,`originPassword`,`text`)),i.originScheme!==void 0&&c(g,[`origin`,`scheme`],o(i.originScheme,`originScheme`,`text`)),i.originUser!==void 0&&c(g,[`origin`,`user`],o(i.originUser,`originUser`,`text`)),i.originHost!==void 0&&c(g,[`origin`,`host`],o(i.originHost,`originHost`,`text`)),i.originPort!==void 0&&c(g,[`origin`,`port`],i.originPort),i.originAccessClientId!==void 0&&c(g,[`origin`,`access_client_id`],o(i.originAccessClientId,`originAccessClientId`,`text`)),i.originAccessClientSecret!==void 0&&c(g,[`origin`,`access_client_secret`],o(i.originAccessClientSecret,`originAccessClientSecret`,`text`)),i.originServiceId!==void 0&&c(g,[`origin`,`service_id`],o(i.originServiceId,`originServiceId`,`text`)),i.originConnectionLimit!==void 0&&c(g,[`origin_connection_limit`],i.originConnectionLimit),u(await p(`Creating hyperdrive`,async()=>m.post(`/accounts/${h}/hyperdrive/configs`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created hyperdrive`})}},h={command:`delete <hyperdriveId>`,describe:`Deletes the specified Hyperdrive.`,builder:e=>e.positional(`hyperdriveId`,{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}),handler:async t=>{if(s(t.hyperdriveId,`hyperdriveId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf hyperdrive delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/hyperdrive/configs/${t.hyperdriveId??`<hyperdriveId>`}`,pathParams:{hyperdriveId:String(t.hyperdriveId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`hyperdrive`,String(t.hyperdriveId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting hyperdrive`,async()=>n.hyperdrive.delete(o,t.hyperdriveId)),{successLabel:`Deleted hyperdrive`})}},g={command:`edit <hyperdriveId>`,describe:`Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled.`,builder:e=>e.positional(`hyperdriveId`,{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. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. `}).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)`}),handler:async t=>{if(s(t.hyperdriveId,`hyperdriveId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf hyperdrive edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/hyperdrive/configs/${t.hyperdriveId??`<hyperdriveId>`}`,pathParams:{hyperdriveId:String(t.hyperdriveId??``)},bodyKind:`json`,body:{cachingDisabled:t.cachingDisabled,cachingMaxAge:t.cachingMaxAge,cachingStaleWhileRevalidate:t.cachingStaleWhileRevalidate,mtlsCaCertificateId:t.mtlsCaCertificateId,mtlsCertificateId:t.mtlsCertificateId,mtlsSslmode:t.mtlsSslmode,name:t.name,originConnectionLimit:t.originConnectionLimit,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating hyperdrive`,async()=>n.patch(`/accounts/${i}/hyperdrive/configs/${t.hyperdriveId}`,{body:e})),{successLabel:`Updated hyperdrive`});return}let m={};t.cachingDisabled!==void 0&&c(m,[`caching`,`disabled`],t.cachingDisabled),t.cachingMaxAge!==void 0&&c(m,[`caching`,`max_age`],t.cachingMaxAge),t.cachingStaleWhileRevalidate!==void 0&&c(m,[`caching`,`stale_while_revalidate`],t.cachingStaleWhileRevalidate),t.mtlsCaCertificateId!==void 0&&c(m,[`mtls`,`ca_certificate_id`],o(t.mtlsCaCertificateId,`mtlsCaCertificateId`,`text`)),t.mtlsCertificateId!==void 0&&c(m,[`mtls`,`mtls_certificate_id`],o(t.mtlsCertificateId,`mtlsCertificateId`,`text`)),t.mtlsSslmode!==void 0&&c(m,[`mtls`,`sslmode`],o(t.mtlsSslmode,`mtlsSslmode`,`text`)),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.originConnectionLimit!==void 0&&c(m,[`origin_connection_limit`],t.originConnectionLimit),u(await p(`Updating hyperdrive`,async()=>n.patch(`/accounts/${i}/hyperdrive/configs/${t.hyperdriveId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated hyperdrive`})}},_={command:`get <hyperdriveId>`,describe:`Returns the specified Hyperdrive configuration.`,builder:e=>e.positional(`hyperdriveId`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}),handler:async e=>{s(e.hyperdriveId,`hyperdriveId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading hyperdrive`,async()=>t.hyperdrive.get(n,e.hyperdriveId)),{successLabel:`Loaded hyperdrive`})}},v={command:`list`,describe:`Returns a list of Hyperdrives.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading hyperdrive`,async()=>t.hyperdrive.list(n)),{successLabel:`Loaded hyperdrive`})}},y={command:`update <hyperdriveId>`,describe:`Updates and returns the specified Hyperdrive configuration.`,builder:e=>e.positional(`hyperdriveId`,{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. Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit. `}).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`]),handler:async i=>{if(s(i.hyperdriveId,`hyperdriveId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf hyperdrive update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/hyperdrive/configs/${i.hyperdriveId??`<hyperdriveId>`}`,pathParams:{hyperdriveId:String(i.hyperdriveId??``)},bodyKind:`json`,body:{cachingDisabled:i.cachingDisabled,cachingMaxAge:i.cachingMaxAge,cachingStaleWhileRevalidate:i.cachingStaleWhileRevalidate,mtlsCaCertificateId:i.mtlsCaCertificateId,mtlsCertificateId:i.mtlsCertificateId,mtlsSslmode:i.mtlsSslmode,name:i.name,originDatabase:i.originDatabase,originPassword:i.originPassword,originScheme:i.originScheme,originUser:i.originUser,originHost:i.originHost,originPort:i.originPort,originAccessClientId:i.originAccessClientId,originAccessClientSecret:i.originAccessClientSecret,originServiceId:i.originServiceId,originConnectionLimit:i.originConnectionLimit,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating hyperdrive`,async()=>m.put(`/accounts/${h}/hyperdrive/configs/${i.hyperdriveId}`,{body:e})),{successLabel:`Updated hyperdrive`});return}i.name===void 0&&(i.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),i.originDatabase===void 0&&(i.originDatabase=await t(`origin-database`,`Set the name of your origin database.`)),i.originPassword===void 0&&(i.originPassword=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),i.originScheme===void 0&&(i.originScheme=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),i.originUser===void 0&&(i.originUser=await t(`origin-user`,`Set the user of your origin database.`));let g={};i.cachingDisabled!==void 0&&c(g,[`caching`,`disabled`],i.cachingDisabled),i.cachingMaxAge!==void 0&&c(g,[`caching`,`max_age`],i.cachingMaxAge),i.cachingStaleWhileRevalidate!==void 0&&c(g,[`caching`,`stale_while_revalidate`],i.cachingStaleWhileRevalidate),i.mtlsCaCertificateId!==void 0&&c(g,[`mtls`,`ca_certificate_id`],o(i.mtlsCaCertificateId,`mtlsCaCertificateId`,`text`)),i.mtlsCertificateId!==void 0&&c(g,[`mtls`,`mtls_certificate_id`],o(i.mtlsCertificateId,`mtlsCertificateId`,`text`)),i.mtlsSslmode!==void 0&&c(g,[`mtls`,`sslmode`],o(i.mtlsSslmode,`mtlsSslmode`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.originDatabase!==void 0&&c(g,[`origin`,`database`],o(i.originDatabase,`originDatabase`,`text`)),i.originPassword!==void 0&&c(g,[`origin`,`password`],o(i.originPassword,`originPassword`,`text`)),i.originScheme!==void 0&&c(g,[`origin`,`scheme`],o(i.originScheme,`originScheme`,`text`)),i.originUser!==void 0&&c(g,[`origin`,`user`],o(i.originUser,`originUser`,`text`)),i.originHost!==void 0&&c(g,[`origin`,`host`],o(i.originHost,`originHost`,`text`)),i.originPort!==void 0&&c(g,[`origin`,`port`],i.originPort),i.originAccessClientId!==void 0&&c(g,[`origin`,`access_client_id`],o(i.originAccessClientId,`originAccessClientId`,`text`)),i.originAccessClientSecret!==void 0&&c(g,[`origin`,`access_client_secret`],o(i.originAccessClientSecret,`originAccessClientSecret`,`text`)),i.originServiceId!==void 0&&c(g,[`origin`,`service_id`],o(i.originServiceId,`originServiceId`,`text`)),i.originConnectionLimit!==void 0&&c(g,[`origin_connection_limit`],i.originConnectionLimit),u(await p(`Updating hyperdrive`,async()=>m.put(`/accounts/${h}/hyperdrive/configs/${i.hyperdriveId}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated hyperdrive`})}},b={command:`hyperdrive`,describe:`Accelerate access to existing databases by caching queries and pooling connections at the edge`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).command(y).demandCommand(1),handler:()=>{}};export{b as default};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`get <permissionGroupId>`,describe:`Get information about a specific permission group in an account.`,builder:e=>e.positional(`permissionGroupId`,{type:`string`,description:`Permission Group identifier tag.`,demandOption:!0}),handler:async e=>{o(e.permissionGroupId,`permissionGroupId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading permission group`,async()=>t.iam.permissionGroups.get(r,e.permissionGroupId)),{successLabel:`Loaded permission group`})}},m={command:`list`,describe:`List all the permissions groups for an account.`,builder:e=>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.`}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.name!==void 0&&(t.name=e.name),e.label!==void 0&&(t.label=e.label),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading permission groups`,async()=>r.iam.permissionGroups.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded permission groups`})}},h={command:`permission-groups`,describe:`View the permission groups that can be assigned to API tokens and policies`,builder:e=>e.command(p).command(m).demandCommand(1),handler:()=>{}},g={command:`create`,describe:`Create a new Resource Group under the specified account.`,builder:e=>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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({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:{name:r.name,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating resource group`,async()=>p.post(`/accounts/${m}/iam/resource_groups`,{body:e})),{successLabel:`Created resource group`});return}r.name===void 0&&(r.name=await t(`name`,`Name of the resource group`));let h={};r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),l(await f(`Creating resource group`,async()=>p.post(`/accounts/${m}/iam/resource_groups`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created resource group`})}},_={command:`delete <resourceGroupId>`,describe:`Remove a resource group from an account.`,builder:e=>e.positional(`resourceGroupId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.resourceGroupId,`resourceGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam resource-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/resource_groups/${t.resourceGroupId??`<resourceGroupId>`}`,pathParams:{resourceGroupId:String(t.resourceGroupId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`resource group`,String(t.resourceGroupId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting resource group`,async()=>a.delete(`/accounts/${s}/iam/resource_groups/${t.resourceGroupId}`,{body:e})),{successLabel:`Deleted resource group`});return}l(await f(`Deleting resource group`,async()=>a.iam.resourceGroups.delete(s,t.resourceGroupId)),{successLabel:`Deleted resource group`})}},v={command:`get <resourceGroupId>`,describe:`Get information about a specific resource group in an account.`,builder:e=>e.positional(`resourceGroupId`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}),handler:async e=>{o(e.resourceGroupId,`resourceGroupId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading resource group`,async()=>t.iam.resourceGroups.get(r,e.resourceGroupId)),{successLabel:`Loaded resource group`})}},y={command:`list`,describe:`List all the resource groups for an account.`,builder:e=>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.`}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.name!==void 0&&(t.name=e.name);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading resource groups`,async()=>r.iam.resourceGroups.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resource groups`})}},b={command:`update <resourceGroupId>`,describe:`Modify an existing resource group.`,builder:e=>e.positional(`resourceGroupId`,{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)`}),handler:async t=>{if(o(t.resourceGroupId,`resourceGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam resource-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/resource_groups/${t.resourceGroupId??`<resourceGroupId>`}`,pathParams:{resourceGroupId:String(t.resourceGroupId??``)},bodyKind:`json`,body:{name:t.name,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating resource group`,async()=>r.put(`/accounts/${p}/iam/resource_groups/${t.resourceGroupId}`,{body:e})),{successLabel:`Updated resource group`});return}let m={};t.name!==void 0&&s(m,[`name`],a(t.name,`name`,`text`)),l(await f(`Updating resource group`,async()=>r.put(`/accounts/${p}/iam/resource_groups/${t.resourceGroupId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated resource group`})}},x={command:`resource-groups`,describe:`Define scopes that limit which account resources a policy or token can access`,builder:e=>e.command(g).command(_).command(v).command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`begin-verification <ssoConnectorId>`,describe:`Begin SSO connector verification`,builder:e=>e.positional(`ssoConnectorId`,{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}),handler:async t=>{if(o(t.ssoConnectorId,`ssoConnectorId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam sso begin-verification`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/sso_connectors/${t.ssoConnectorId??`<ssoConnectorId>`}/begin_verification`,pathParams:{ssoConnectorId:String(t.ssoConnectorId??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating sso`,async()=>r.iam.sso.beginVerification(a,t.ssoConnectorId)),{successLabel:`Created sso`})}},C={command:`create`,describe:`Create a new SSO connector`,builder:e=>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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf iam sso create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`json`,body:{beginVerification:r.beginVerification,emailDomain:r.emailDomain,useFedrampLanguage:r.useFedrampLanguage,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating sso`,async()=>p.post(`/accounts/${m}/sso_connectors`,{body:e})),{successLabel:`Created sso`});return}r.emailDomain===void 0&&(r.emailDomain=await t(`email-domain`,`Email domain of the new SSO connector`));let h={};r.beginVerification!==void 0&&s(h,[`begin_verification`],r.beginVerification),r.emailDomain!==void 0&&s(h,[`email_domain`],a(r.emailDomain,`emailDomain`,`text`)),r.useFedrampLanguage!==void 0&&s(h,[`use_fedramp_language`],r.useFedrampLanguage),l(await f(`Creating sso`,async()=>p.post(`/accounts/${m}/sso_connectors`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created sso`})}},w={command:`delete <ssoConnectorId>`,describe:`Delete an SSO connector`,builder:e=>e.positional(`ssoConnectorId`,{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}),handler:async t=>{if(o(t.ssoConnectorId,`ssoConnectorId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam sso delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/sso_connectors/${t.ssoConnectorId??`<ssoConnectorId>`}`,pathParams:{ssoConnectorId:String(t.ssoConnectorId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`sso`,String(t.ssoConnectorId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}l(await f(`Deleting sso`,async()=>a.iam.sso.delete(s,t.ssoConnectorId)),{successLabel:`Deleted sso`})}},T={command:`get <ssoConnectorId>`,describe:`Get SSO connector details`,builder:e=>e.positional(`ssoConnectorId`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}),handler:async e=>{o(e.ssoConnectorId,`ssoConnectorId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading sso`,async()=>t.iam.sso.get(r,e.ssoConnectorId)),{successLabel:`Loaded sso`})}},E={command:`list`,describe:`List all SSO connectors`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading sso`,async()=>t.iam.sso.list(r)),{successLabel:`Loaded sso`})}},D={command:`update <ssoConnectorId>`,describe:`Update SSO connector state`,builder:e=>e.positional(`ssoConnectorId`,{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`,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)`}),handler:async t=>{if(o(t.ssoConnectorId,`ssoConnectorId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam sso update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/sso_connectors/${t.ssoConnectorId??`<ssoConnectorId>`}`,pathParams:{ssoConnectorId:String(t.ssoConnectorId??``)},bodyKind:`json`,body:{enabled:t.enabled,useFedrampLanguage:t.useFedrampLanguage,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Updating sso`,async()=>r.patch(`/accounts/${a}/sso_connectors/${t.ssoConnectorId}`,{body:e})),{successLabel:`Updated sso`});return}let p={};t.enabled!==void 0&&s(p,[`enabled`],t.enabled),t.useFedrampLanguage!==void 0&&s(p,[`use_fedramp_language`],t.useFedrampLanguage),l(await f(`Updating sso`,async()=>r.patch(`/accounts/${a}/sso_connectors/${t.ssoConnectorId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated sso`})}},O={command:`sso`,describe:`Configure single sign-on connectors to authenticate account members through an external identity provider`,builder:e=>e.command(S).command(C).command(w).command(T).command(E).command(D).demandCommand(1),handler:()=>{}},k={command:`create`,describe:`Create a new user group under the specified account.`,builder:e=>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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({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:{name:r.name,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating user group`,async()=>p.post(`/accounts/${m}/iam/user_groups`,{body:e})),{successLabel:`Created user group`});return}r.name===void 0&&(r.name=await t(`name`,`Name of the User group.`));let h={};r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),l(await f(`Creating user group`,async()=>p.post(`/accounts/${m}/iam/user_groups`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created user group`})}},A={command:`delete <userGroupId>`,describe:`Remove a user group from an account.`,builder:e=>e.positional(`userGroupId`,{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}),handler:async t=>{if(o(t.userGroupId,`userGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam user-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/user_groups/${t.userGroupId??`<userGroupId>`}`,pathParams:{userGroupId:String(t.userGroupId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`user group`,String(t.userGroupId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}l(await f(`Deleting user group`,async()=>a.iam.userGroups.delete(s,t.userGroupId)),{successLabel:`Deleted user group`})}},j={command:`get <userGroupId>`,describe:`Get information about a specific user group in an account.`,builder:e=>e.positional(`userGroupId`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}),handler:async e=>{o(e.userGroupId,`userGroupId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading user group`,async()=>t.iam.userGroups.get(r,e.userGroupId)),{successLabel:`Loaded user group`})}},M={command:`list`,describe:`List all the user groups for an account.`,builder:e=>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`]}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.name!==void 0&&(t.name=e.name),e.fuzzyName!==void 0&&(t.fuzzyName=e.fuzzyName),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading user groups`,async()=>r.iam.userGroups.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded user groups`})}},N={command:`create <userGroupId>`,describe:`Add members to a User Group.`,builder:e=>e.positional(`userGroupId`,{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)`}),handler:async t=>{if(o(t.userGroupId,`userGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam user-groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/user_groups/${t.userGroupId??`<userGroupId>`}/members`,pathParams:{userGroupId:String(t.userGroupId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Creating member`,async()=>r.post(`/accounts/${a}/iam/user_groups/${t.userGroupId}/members`,{body:e})),{successLabel:`Created member`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},P={command:`delete <memberId>`,describe:`Remove a member from User Group`,builder:e=>e.positional(`memberId`,{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}),handler:async t=>{if(o(t.memberId,`memberId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam user-groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/user_groups/${t.userGroupId??`<userGroupId>`}/members/${t.memberId??`<memberId>`}`,pathParams:{userGroupId:String(t.userGroupId??``),memberId:String(t.memberId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`member`,String(t.memberId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}l(await f(`Deleting member`,async()=>a.iam.userGroups.members.delete(s,t.userGroupId,t.memberId)),{successLabel:`Deleted member`})}},F={command:`list`,describe:`List all the members attached to a user group.`,builder:e=>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`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.fuzzyEmail!==void 0&&(t.fuzzyEmail=e.fuzzyEmail),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading members`,async()=>r.iam.userGroups.members.list(a,e.userGroupId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded members`})}},I={command:`update <userGroupId>`,describe:`Replace the set of members attached to a User Group.`,builder:e=>e.positional(`userGroupId`,{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.`}),handler:async t=>{if(o(t.userGroupId,`userGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam user-groups members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/user_groups/${t.userGroupId??`<userGroupId>`}/members`,pathParams:{userGroupId:String(t.userGroupId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Updating member`,async()=>r.put(`/accounts/${a}/iam/user_groups/${t.userGroupId}/members`,{body:e})),{successLabel:`Updated member`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},L={command:`members`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(N).command(P).command(F).command(I).demandCommand(1),handler:()=>{}},R={command:`update <userGroupId>`,describe:`Modify an existing user group.`,builder:e=>e.positional(`userGroupId`,{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)`}),handler:async t=>{if(o(t.userGroupId,`userGroupId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf iam user-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/iam/user_groups/${t.userGroupId??`<userGroupId>`}`,pathParams:{userGroupId:String(t.userGroupId??``)},bodyKind:`json`,body:{name:t.name,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating user group`,async()=>r.put(`/accounts/${p}/iam/user_groups/${t.userGroupId}`,{body:e})),{successLabel:`Updated user group`});return}let m={};t.name!==void 0&&s(m,[`name`],a(t.name,`name`,`text`)),l(await f(`Updating user group`,async()=>r.put(`/accounts/${p}/iam/user_groups/${t.userGroupId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated user group`})}},z={command:`user-groups`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(k).command(A).command(j).command(M).command(R).command(L).demandCommand(1),handler:()=>{}},B={command:`iam`,describe:`Identity and access management — permission groups, resource groups, user groups, and SSO connectors`,builder:e=>e.command(h).command(x).command(O).command(z).demandCommand(1),handler:()=>{}};export{B as default};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`get <imageId>`,describe:`Fetch base image. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.`,builder:e=>e.positional(`imageId`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}),handler:async e=>{s(e.imageId,`imageId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading blob`,async()=>t.images.v1.blobs.get(e.imageId,n)),{successLabel:`Loaded blob`})}},h={command:`blobs`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`create`,describe:`Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url.`,builder:e=>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.`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1`,pathParams:{},bodyKind:`multipart`,body:{body:t.body,file:t.file,creator:t.creator,id:t.id,metadata:t.metadata,requireSignedURLs:t.requireSignedURLs,url:t.url},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.file!==void 0||t.body!==void 0||t.creator!==void 0||t.id!==void 0||t.metadata!==void 0||t.requireSignedURLs!==void 0||t.url!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.creator!==void 0&&e.append(`creator`,String(o(t.creator,`creator`,`text`)??``)),t.id!==void 0&&e.append(`id`,String(o(t.id,`id`,`text`)??``)),t.metadata!==void 0){let n=typeof t.metadata==`string`?o(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}t.requireSignedURLs!==void 0&&e.append(`requireSignedURLs`,String(t.requireSignedURLs)),t.url!==void 0&&e.append(`url`,String(o(t.url,`url`,`text`)??``)),u(await p(`Creating v1`,async()=>n.post(`/accounts/${i}/images/v1`,{body:e})),{successLabel:`Created v1`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating v1`,async()=>n.post(`/accounts/${i}/images/v1`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created v1`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},_={command:`delete <imageId>`,describe:`Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.`,builder:e=>e.positional(`imageId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.imageId,`imageId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/${t.imageId??`<imageId>`}`,pathParams:{imageId:String(t.imageId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`v1`,String(t.imageId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting v1`,async()=>n.delete(`/accounts/${o}/images/v1/${t.imageId}`,{body:e})),{successLabel:`Deleted v1`});return}u(await p(`Deleting v1`,async()=>n.images.v1.delete(t.imageId,o)),{successLabel:`Deleted v1`})}},v={command:`edit <imageId>`,describe:`Update image access control. On access control change, all copies of the image are purged from cache.`,builder:e=>e.positional(`imageId`,{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)`}),handler:async t=>{if(s(t.imageId,`imageId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/${t.imageId??`<imageId>`}`,pathParams:{imageId:String(t.imageId??``)},bodyKind:`json`,body:{creator:t.creator,requireSignedUrls:t.requireSignedUrls,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating v1`,async()=>n.patch(`/accounts/${i}/images/v1/${t.imageId}`,{body:e})),{successLabel:`Updated v1`});return}let m={};t.creator!==void 0&&c(m,[`creator`],o(t.creator,`creator`,`text`)),t.requireSignedUrls!==void 0&&c(m,[`requireSignedURLs`],t.requireSignedUrls),u(await p(`Updating v1`,async()=>n.patch(`/accounts/${i}/images/v1/${t.imageId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated v1`})}},y={command:`get <imageId>`,describe:`Fetch details for a single image.`,builder:e=>e.positional(`imageId`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}),handler:async e=>{s(e.imageId,`imageId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading v1`,async()=>t.images.v1.get(e.imageId,n)),{successLabel:`Loaded v1`})}},b={command:`delete <signingKeyName>`,describe:`Delete signing key with specified name. Returns all keys available. When last key is removed, a new default signing key will be generated.`,builder:e=>e.positional(`signingKeyName`,{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}),handler:async t=>{if(s(t.signingKeyName,`signingKeyName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/keys/${t.signingKeyName??`<signingKeyName>`}`,pathParams:{signingKeyName:String(t.signingKeyName??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`key`,String(t.signingKeyName??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting key`,async()=>n.images.v1.keys.delete(t.signingKeyName,o)),{successLabel:`Deleted key`})}},x={command:`list`,describe:`Lists your signing keys. These can be found on your Cloudflare Images dashboard.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading keys`,async()=>t.images.v1.keys.list(n)),{successLabel:`Loaded keys`})}},S={command:`update <signingKeyName>`,describe:`Create a new signing key with specified name. Returns all keys available.`,builder:e=>e.positional(`signingKeyName`,{type:`string`,description:`Signing key name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.signingKeyName,`signingKeyName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/keys/${t.signingKeyName??`<signingKeyName>`}`,pathParams:{signingKeyName:String(t.signingKeyName??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Updating key`,async()=>n.images.v1.keys.update(t.signingKeyName,i)),{successLabel:`Updated key`})}},C={command:`keys`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`list`,describe:`List up to 100 images with one request. Use the optional parameters below to get a specific range of images.`,builder:e=>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`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.creator!==void 0&&(t.creator=e.creator);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading v1`,async()=>n.images.v1.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded v1`})}},T={command:`get`,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:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading stat`,async()=>t.images.v1.stats.get(n)),{successLabel:`Loaded stat`})}},E={command:`stats`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(T).demandCommand(1),handler:()=>{}},D={command:`get <variantId>`,describe:`Fetch details for a single variant with properties at the top level of the result.`,builder:e=>e.positional(`variantId`,{type:`string`,description:`Variant ID`,demandOption:!0}),handler:async e=>{s(e.variantId,`variantId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading variants flat`,async()=>t.images.v1.variantsFlat.get(e.variantId,n)),{successLabel:`Loaded variants flat`})}},O={command:`variants-flat`,describe:`Images v1 variant details in flat format`,builder:e=>e.command(D).demandCommand(1),handler:()=>{}},k={command:`create`,describe:`Specify variants that allow you to resize images for different use cases.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf images v1 variants create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`json`,body:{id:i.id,neverRequireSignedUrls:i.neverRequireSignedUrls,optionsFit:i.optionsFit,optionsHeight:i.optionsHeight,optionsMetadata:i.optionsMetadata,optionsWidth:i.optionsWidth,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating variant`,async()=>m.post(`/accounts/${h}/images/v1/variants`,{body:e})),{successLabel:`Created variant`});return}if(i.id===void 0&&(i.id=await t(`id`,``)),i.optionsFit===void 0&&(i.optionsFit=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),i.optionsHeight===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(i.optionsMetadata===void 0&&(i.optionsMetadata=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),i.optionsWidth===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let g={};i.id!==void 0&&c(g,[`id`],o(i.id,`id`,`text`)),i.neverRequireSignedUrls!==void 0&&c(g,[`neverRequireSignedURLs`],i.neverRequireSignedUrls),i.optionsFit!==void 0&&c(g,[`options`,`fit`],o(i.optionsFit,`optionsFit`,`text`)),i.optionsHeight!==void 0&&c(g,[`options`,`height`],i.optionsHeight),i.optionsMetadata!==void 0&&c(g,[`options`,`metadata`],o(i.optionsMetadata,`optionsMetadata`,`text`)),i.optionsWidth!==void 0&&c(g,[`options`,`width`],i.optionsWidth),u(await p(`Creating variant`,async()=>m.post(`/accounts/${h}/images/v1/variants`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created variant`})}},A={command:`delete <variantId>`,describe:`Deleting a variant purges the cache for all images associated with the variant.`,builder:e=>e.positional(`variantId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.variantId,`variantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/variants/${t.variantId??`<variantId>`}`,pathParams:{variantId:String(t.variantId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`variant`,String(t.variantId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting variant`,async()=>n.delete(`/accounts/${o}/images/v1/variants/${t.variantId}`,{body:e})),{successLabel:`Deleted variant`});return}u(await p(`Deleting variant`,async()=>n.images.v1.variants.delete(t.variantId,o)),{successLabel:`Deleted variant`})}},j={command:`edit <variantId>`,describe:`Updating a variant purges the cache for all images associated with the variant.`,builder:e=>e.positional(`variantId`,{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.`,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)`}),handler:async t=>{if(s(t.variantId,`variantId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v1 variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v1/variants/${t.variantId??`<variantId>`}`,pathParams:{variantId:String(t.variantId??``)},bodyKind:`json`,body:{neverRequireSignedUrls:t.neverRequireSignedUrls,optionsFit:t.optionsFit,optionsHeight:t.optionsHeight,optionsMetadata:t.optionsMetadata,optionsWidth:t.optionsWidth,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating variant`,async()=>i.patch(`/accounts/${m}/images/v1/variants/${t.variantId}`,{body:e})),{successLabel:`Updated variant`});return}if(t.optionsFit===void 0&&(t.optionsFit=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),t.optionsHeight===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(t.optionsMetadata===void 0&&(t.optionsMetadata=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),t.optionsWidth===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let h={};t.neverRequireSignedUrls!==void 0&&c(h,[`neverRequireSignedURLs`],t.neverRequireSignedUrls),t.optionsFit!==void 0&&c(h,[`options`,`fit`],o(t.optionsFit,`optionsFit`,`text`)),t.optionsHeight!==void 0&&c(h,[`options`,`height`],t.optionsHeight),t.optionsMetadata!==void 0&&c(h,[`options`,`metadata`],o(t.optionsMetadata,`optionsMetadata`,`text`)),t.optionsWidth!==void 0&&c(h,[`options`,`width`],t.optionsWidth),u(await p(`Updating variant`,async()=>i.patch(`/accounts/${m}/images/v1/variants/${t.variantId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated variant`})}},M={command:`get <variantId>`,describe:`Fetch details for a single variant.`,builder:e=>e.positional(`variantId`,{type:`string`,description:`Variant ID`,demandOption:!0}),handler:async e=>{s(e.variantId,`variantId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading variant`,async()=>t.images.v1.variants.get(e.variantId,n)),{successLabel:`Loaded variant`})}},N={command:`list`,describe:`Lists existing variants.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading variants`,async()=>t.images.v1.variants.list(n)),{successLabel:`Loaded variants`})}},P={command:`variants`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(k).command(A).command(j).command(M).command(N).demandCommand(1),handler:()=>{}},F={command:`v1`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(g).command(_).command(v).command(y).command(w).command(h).command(C).command(E).command(P).command(O).demandCommand(1),handler:()=>{}},I={command:`create`,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:e=>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.`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf images v2 direct-uploads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/images/v2/direct_upload`,pathParams:{},bodyKind:`multipart`,body:{body:t.body,file:t.file,creator:t.creator,expiry:t.expiry,id:t.id,metadata:t.metadata,requireSignedURLs:t.requireSignedURLs},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.file!==void 0||t.body!==void 0||t.creator!==void 0||t.expiry!==void 0||t.id!==void 0||t.metadata!==void 0||t.requireSignedURLs!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.creator!==void 0&&e.append(`creator`,String(o(t.creator,`creator`,`text`)??``)),t.expiry!==void 0&&e.append(`expiry`,String(o(t.expiry,`expiry`,`text`)??``)),t.id!==void 0&&e.append(`id`,String(o(t.id,`id`,`text`)??``)),t.metadata!==void 0){let n=typeof t.metadata==`string`?o(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}t.requireSignedURLs!==void 0&&e.append(`requireSignedURLs`,String(t.requireSignedURLs)),u(await p(`Creating direct upload`,async()=>n.post(`/accounts/${i}/images/v2/direct_upload`,{body:e})),{successLabel:`Created direct upload`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Creating direct upload`,async()=>n.post(`/accounts/${i}/images/v2/direct_upload`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created direct upload`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},L={command:`direct-uploads`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(I).demandCommand(1),handler:()=>{}},R={command:`list`,describe:"List up to 10000 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 - `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 **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 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:e=>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`}),handler:async e=>{let t={};e.continuationToken!==void 0&&(t.continuation_token=e.continuationToken),e.perPage!==void 0&&(t.per_page=e.perPage),e.sortOrder!==void 0&&(t.sort_order=e.sortOrder),e.creator!==void 0&&(t.creator=e.creator);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading v2`,async()=>n.images.v2.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded v2`})}},z={command:`v2`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(R).command(L).demandCommand(1),handler:()=>{}},B={command:`images`,describe:`Store, resize, and deliver optimized images globally — variants, signing keys, and direct uploads`,builder:e=>e.command(F).command(z).demandCommand(1),handler:()=>{}};export{B as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{readFileSync as e}from"node:fs";import{resolve as t}from"node:path";function n(e,t){for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<32&&r!==10&&r!==9)throw Error(`Invalid character in ${t}: control character U+${r.toString(16).padStart(4,`0`)} at position ${n}`)}}function r(e,t){let n=e.replace(/\\/g,`/`);if(n.includes(`..`))throw Error(`Path traversal detected in ${t}: value must not contain '..'`);if(n.startsWith(`/`)||n.startsWith(`~`))throw Error(`Path traversal detected in ${t}: value must not start with '/' or '~'`)}function i(e,t){if(e.includes(`?`)||e.includes(`#`)||e.includes(`%`))throw Error(`${t} must not contain query parameters or URL encoding ('?', '#', '%')`)}function a(e,t){e&&(n(e,t),r(e,t),i(e,t))}function o(e,t){e&&n(e,t)}function s(r,i,a=`text`){if(r===void 0)return r;if(!r.startsWith(`@`))return a===`text`&&n(r,i),r;let o=r.slice(1);if(o.length===0)throw Error(`--${i} '@' must be followed by a file path (got empty path)`);let s=t(o),c;try{c=e(s)}catch(e){let t=e instanceof Error?e.message:`unknown read error`;throw Error(`--${i}: cannot read file at '${o}': ${t}`)}switch(a){case`text`:{let e=c.toString(`utf-8`);return n(e,i),e}case`binary`:return c;case`base64`:return c.toString(`base64`);case`json`:{let e=c.toString(`utf-8`);try{return JSON.parse(e)}catch(e){let t=e instanceof Error?e.message:`unknown JSON parse error`;throw Error(`--${i}: file at '${o}' is not valid JSON: ${t}`)}}}}export{o as i,s as n,a as r,n as t};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";import{n as f,t as p}from"./raw-fetch-CxFs4i0R.mjs";const m={command:`get <asn>`,describe:`Gets an overview of the Autonomous System Number (ASN) and a list of subnets for it.`,builder:e=>e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}),handler:async e=>{a(e.asn,`asn`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading asn`,async()=>n.intel.asn.get(e.asn,i)),{successLabel:`Loaded asn`})}},h={command:`get <asn>`,describe:`Get ASN Subnets.`,builder:e=>e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}),handler:async e=>{a(e.asn,`asn`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading subnet`,async()=>n.intel.asn.subnets.get(e.asn,i)),{successLabel:`Loaded subnet`})}},g={command:`subnets`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(h).demandCommand(1),handler:()=>{}},_={command:`asn`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(m).command(g).demandCommand(1),handler:()=>{}},v={command:`get`,describe:`Lists all available issue types in Security Center, describing categories of security issues.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading issue type`,async()=>n.intel.attackSurfaceReport.issueTypes.get(i)),{successLabel:`Loaded issue type`})}},y={command:`issue-types`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(v).demandCommand(1),handler:()=>{}},b={command:`class`,describe:`Retrieves Security Center issue counts aggregated by classification class.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let n={};e.dismissed!==void 0&&(n.dismissed=e.dismissed),e.issueClass!==void 0&&(n.issue_class=e.issueClass),e.issueType!==void 0&&(n.issue_type=e.issueType),e.product!==void 0&&(n.product=e.product),e.severity!==void 0&&(n.severity=e.severity),e.subject!==void 0&&(n.subject=e.subject);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading issue`,async()=>i.intel.attackSurfaceReport.issues.class(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded issue`})}},x={command:`dismiss <issueId>`,describe:`Deprecated endpoint for archiving Security Center insights. Use the newer archive-security-center-insight endpoint instead.`,builder:e=>e.positional(`issueId`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(a(n.issueId,`issueId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel attack-surface-report issues dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/attack-surface-report/${n.issueId??`<issueId>`}/dismiss`,pathParams:{issueId:String(n.issueId??``)},bodyKind:`json`,body:{dismiss:n.dismiss,body:n.body},validation:`passed`});return}let i=await r(n),f=n.local?u:await t(i);if(n.accountId=f,n.body){let e=s(n.body);c(await d(`Updating issue`,async()=>i.put(`/accounts/${f}/intel/attack-surface-report/${n.issueId}/dismiss`,{body:e})),{successLabel:`Updated issue`});return}let p={};n.dismiss!==void 0&&o(p,[`dismiss`],n.dismiss),c(await d(`Updating issue`,async()=>i.put(`/accounts/${f}/intel/attack-surface-report/${n.issueId}/dismiss`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated issue`})}},S={command:`list`,describe:`Lists all Security Center issues for the account, showing active security problems requiring attention.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`string`,description:`Page`}).option(`per-page`,{type:`string`,description:`Per page`}),handler:async e=>{let n={};e.dismissed!==void 0&&(n.dismissed=e.dismissed),e.issueClass!==void 0&&(n.issue_class=e.issueClass),e.issueType!==void 0&&(n.issue_type=e.issueType),e.product!==void 0&&(n.product=e.product),e.severity!==void 0&&(n.severity=e.severity),e.subject!==void 0&&(n.subject=e.subject),e.page!==void 0&&(n.page=e.page),e.perPage!==void 0&&(n.per_page=e.perPage);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading issues`,async()=>i.intel.attackSurfaceReport.issues.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded issues`})}},C={command:`severity`,describe:`Retrieves Security Center issue counts aggregated by severity level.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let n={};e.dismissed!==void 0&&(n.dismissed=e.dismissed),e.issueClass!==void 0&&(n.issue_class=e.issueClass),e.issueType!==void 0&&(n.issue_type=e.issueType),e.product!==void 0&&(n.product=e.product),e.severity!==void 0&&(n.severity=e.severity),e.subject!==void 0&&(n.subject=e.subject);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading issue`,async()=>i.intel.attackSurfaceReport.issues.severity(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded issue`})}},w={command:`type`,describe:`Retrieves Security Center issue counts aggregated by issue type.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let n={};e.dismissed!==void 0&&(n.dismissed=e.dismissed),e.issueClass!==void 0&&(n.issue_class=e.issueClass),e.issueType!==void 0&&(n.issue_type=e.issueType),e.product!==void 0&&(n.product=e.product),e.severity!==void 0&&(n.severity=e.severity),e.subject!==void 0&&(n.subject=e.subject);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading issue`,async()=>i.intel.attackSurfaceReport.issues.type(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded issue`})}},T={command:`issues`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(b).command(x).command(S).command(C).command(w).demandCommand(1),handler:()=>{}},E={command:`attack-surface-report`,describe:`Operations for attack-surface-report`,builder:e=>e.command(y).command(T).demandCommand(1),handler:()=>{}},D={command:`list`,describe:`Gets a list of all the domains that have resolved to a specific IP address.`,builder:e=>e.option(`start-end-params`,{type:`string`,description:`Start end params`}).option(`ipv4`,{type:`string`,description:`Ipv4`}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}),handler:async e=>{let n={};e.startEndParams!==void 0&&(n.start_end_params=e.startEndParams),e.ipv4!==void 0&&(n.ipv4=e.ipv4),e.page!==void 0&&(n.page=e.page),e.perPage!==void 0&&(n.per_page=e.perPage);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading dns`,async()=>i.intel.dns.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded dns`})}},O={command:`dns`,describe:`Passive DNS data showing historical DNS resolution records for domains`,builder:e=>e.command(D).demandCommand(1),handler:()=>{}},k={command:`get`,describe:`Gets historical security threat and content categories currently and previously assigned to a domain.`,builder:e=>e.option(`domain`,{type:`string`,description:`Domain`}),handler:async e=>{let n={};e.domain!==void 0&&(n.domain=e.domain);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading domain history`,async()=>i.intel.domainHistory.get(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded domain history`})}},A={command:`domain-history`,describe:`Historical domain registration and categorization changes over time`,builder:e=>e.command(k).demandCommand(1),handler:()=>{}},j={command:`get`,describe:`Same as summary.`,builder:e=>e.option(`domain`,{type:`string`,description:"Accepts multiple values like `?domain=cloudflare.com&domain=example.com`."}),handler:async e=>{let n={};e.domain!==void 0&&(n.domain=e.domain);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading bulk`,async()=>i.intel.domains.bulks.get(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded bulk`})}},M={command:`bulks`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(j).demandCommand(1),handler:()=>{}},N={command:`get`,describe:`Gets security details and statistics about a domain.`,builder:e=>e.option(`domain`,{type:`string`,description:`Domain`}).option(`skip-dns`,{type:`boolean`,description:`Skip DNS resolution lookups for faster response.`,default:!1}),handler:async e=>{let n={};e.domain!==void 0&&(n.domain=e.domain),e.skipDns!==void 0&&(n.skip_dns=e.skipDns);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading domain`,async()=>i.intel.domains.get(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded domain`})}},P={command:`domains`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(N).command(M).demandCommand(1),handler:()=>{}},F={command:`create`,describe:`Creates a new custom threat indicator feed for sharing threat intelligence data.`,builder:e=>e.option(`description`,{type:`string`,description:`The description of the example test`}).option(`name`,{type:`string`,description:`The name of the indicator feed`}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel indicator-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`json`,body:{description:n.description,name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating indicator feed`,async()=>f.post(`/accounts/${p}/intel/indicator-feeds`,{body:e})),{successLabel:`Created indicator feed`});return}let m={};n.description!==void 0&&o(m,[`description`],i(n.description,`description`,`text`)),n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Creating indicator feed`,async()=>f.post(`/accounts/${p}/intel/indicator-feeds`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created indicator feed`})}},I={command:`data <feedId>`,describe:`Retrieves the raw data entries in a custom threat indicator feed.`,builder:e=>e.positional(`feedId`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}),handler:async e=>{a(e.feedId,`feedId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,f((await d(`Loading indicator feed`,async()=>p(`/accounts/${i}/intel/indicator-feeds/${e.feedId}/data`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},ee={command:`get <feedId>`,describe:`Downloads the content of a custom threat indicator feed.`,builder:e=>e.positional(`feedId`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}),handler:async e=>{a(e.feedId,`feedId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading download`,async()=>n.intel.indicatorFeeds.downloads.get(i,e.feedId)),{successLabel:`Loaded download`})}},L={command:`downloads`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(ee).demandCommand(1),handler:()=>{}},R={command:`get <feedId>`,describe:`Retrieves details for a specific custom threat indicator feed.`,builder:e=>e.positional(`feedId`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}),handler:async e=>{a(e.feedId,`feedId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading indicator feed`,async()=>n.intel.indicatorFeeds.get(i,e.feedId)),{successLabel:`Loaded indicator feed`})}},z={command:`list`,describe:`Retrieves details for all accessible custom threat indicator feeds.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading indicator feeds`,async()=>n.intel.indicatorFeeds.list(i)),{successLabel:`Loaded indicator feeds`})}},B={command:`create`,describe:`Grants access permissions for a custom threat indicator feed to other accounts.`,builder:e=>e.option(`account-tag`,{type:`string`,description:`The Cloudflare account tag of the account to change permissions on`}).option(`feed-id`,{type:`number`,description:`The ID of the feed to add/remove permissions on`}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel indicator-feeds permissions create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/indicator-feeds/permissions/add`,pathParams:{},bodyKind:`json`,body:{accountTag:n.accountTag,feedId:n.feedId,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating permission`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/permissions/add`,{body:e})),{successLabel:`Updated permission`});return}let m={};n.accountTag!==void 0&&o(m,[`account_tag`],i(n.accountTag,`accountTag`,`text`)),n.feedId!==void 0&&o(m,[`feed_id`],n.feedId),c(await d(`Updating permission`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/permissions/add`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated permission`})}},V={command:`delete`,describe:`Revokes access permissions for a custom threat indicator feed.`,builder:e=>e.option(`account-tag`,{type:`string`,description:`The Cloudflare account tag of the account to change permissions on`}).option(`feed-id`,{type:`number`,description:`The ID of the feed to add/remove permissions on`}).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)`}),handler:async f=>{if(f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel indicator-feeds permissions delete`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/indicator-feeds/permissions/remove`,pathParams:{},bodyKind:`json`,body:{accountTag:f.accountTag,feedId:f.feedId,body:f.body},validation:`passed`});return}let p=await r(f),m=f.local?u:await t(p);if(f.accountId=m,!await n(`permission`,``,{force:!!f.force,message:`This operation destructively removes a permission entry.`})){process.stderr.write(`Aborted.
3
- `);return}if(f.body){let e=s(f.body);c(await d(`Deleting permission`,async()=>p.put(`/accounts/${m}/intel/indicator-feeds/permissions/remove`,{body:e})),{successLabel:`Deleted permission`});return}let h={};f.accountTag!==void 0&&o(h,[`account_tag`],i(f.accountTag,`accountTag`,`text`)),f.feedId!==void 0&&o(h,[`feed_id`],f.feedId),c(await d(`Deleting permission`,async()=>p.put(`/accounts/${m}/intel/indicator-feeds/permissions/remove`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Deleted permission`})}},H={command:`list`,describe:`Lists current access permissions for custom threat indicator feeds.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading permissions`,async()=>n.intel.indicatorFeeds.permissions.list(i)),{successLabel:`Loaded permissions`})}},U={command:`permissions`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(B).command(V).command(H).demandCommand(1),handler:()=>{}},W={command:`update <feedId>`,describe:`Revises the raw data entries in a custom threat indicator feed.`,builder:e=>e.positional(`feedId`,{type:`string`,description:`Indicator feed ID`,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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`source`,{type:`string`,description:`The file to upload`}),handler:async n=>{if(a(n.feedId,`feedId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel indicator-feeds snapshots update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/indicator-feeds/${n.feedId??`<feedId>`}/snapshot`,pathParams:{feedId:String(n.feedId??``)},bodyKind:`multipart`,body:{body:n.body,file:n.file,source:n.source},validation:`passed`});return}let o=await r(n),s=n.local?u:await t(o);if(n.accountId=s,n.file!==void 0||n.body!==void 0||n.source!==void 0){let e=new FormData;if(n.file){let{readFileSync:t}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=t(r(n.file));e.append(`file`,new Blob([i]),n.file.split(`/`).pop())}else n.body!==void 0&&e.append(`file`,n.body);n.source!==void 0&&e.append(`source`,String(i(n.source,`source`,`text`)??``)),c(await d(`Updating snapshot`,async()=>o.put(`/accounts/${s}/intel/indicator-feeds/${n.feedId}/snapshot`,{body:e})),{successLabel:`Updated snapshot`});return}if(n.body){let e=i(n.body,`body`,`binary`);c(await d(`Updating snapshot`,async()=>o.put(`/accounts/${s}/intel/indicator-feeds/${n.feedId}/snapshot`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated snapshot`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},G={command:`snapshots`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(W).demandCommand(1),handler:()=>{}},K={command:`update <feedId>`,describe:`Revises details for a specific custom threat indicator feed.`,builder:e=>e.positional(`feedId`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The new description of the feed`}).option(`is-attributable`,{type:`boolean`,description:`The new is_attributable value of the feed`}).option(`is-downloadable`,{type:`boolean`,description:`The new is_downloadable value of the feed`}).option(`is-public`,{type:`boolean`,description:`The new is_public value of the feed`}).option(`name`,{type:`string`,description:`The new name of the feed`}).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)`}),handler:async n=>{if(a(n.feedId,`feedId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel indicator-feeds update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/indicator-feeds/${n.feedId??`<feedId>`}`,pathParams:{feedId:String(n.feedId??``)},bodyKind:`json`,body:{description:n.description,isAttributable:n.isAttributable,isDownloadable:n.isDownloadable,isPublic:n.isPublic,name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating indicator feed`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/${n.feedId}`,{body:e})),{successLabel:`Updated indicator feed`});return}let m={};n.description!==void 0&&o(m,[`description`],i(n.description,`description`,`text`)),n.isAttributable!==void 0&&o(m,[`is_attributable`],n.isAttributable),n.isDownloadable!==void 0&&o(m,[`is_downloadable`],n.isDownloadable),n.isPublic!==void 0&&o(m,[`is_public`],n.isPublic),n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Updating indicator feed`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/${n.feedId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated indicator feed`})}},q={command:`indicator-feeds`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(F).command(I).command(R).command(z).command(K).command(L).command(U).command(G).demandCommand(1),handler:()=>{}},J={command:`get`,describe:`Returns a list of available IP list categories (e.g., anonymizer, botnetcc, malware, tor, vpn, open_proxies). This endpoint provides metadata about which IP lists are available in the system.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading ip list`,async()=>n.intel.ipLists.get(i)),{successLabel:`Loaded ip list`})}},Y={command:`ip-lists`,describe:`Curated IP lists used for threat detection and policy enforcement`,builder:e=>e.command(J).demandCommand(1),handler:()=>{}},X={command:`get`,describe:"Gets the geolocation, ASN, infrastructure type of the ASN, and any security threat categories of an IP address. **Must provide ip query parameters.** For example, `/intel/ip?ipv4=1.1.1.1` or `/intel/ip?ipv6=2001:db8::1`.",builder:e=>e.option(`ipv4`,{type:`string`,description:`Ipv4`}).option(`ipv6`,{type:`string`,description:`Ipv6`}),handler:async e=>{let n={};e.ipv4!==void 0&&(n.ipv4=e.ipv4),e.ipv6!==void 0&&(n.ipv6=e.ipv6);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading ip`,async()=>i.intel.ips.get(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded ip`})}},Z={command:`ips`,describe:`IP address intelligence — geolocation, risk assessment, and hosting provider details`,builder:e=>e.command(X).demandCommand(1),handler:()=>{}},Q={command:`create`,describe:`Allows you to submit requests to change a domain’s category.`,builder:e=>e.option(`content-adds`,{type:`string`,array:!0,description:`Content category IDs to add.`}).option(`content-removes`,{type:`string`,array:!0,description:`Content category IDs to remove.`}).option(`indicator-type`,{type:`string`,description:`The indicator_type field`,choices:[`domain`,`ipv4`,`ipv6`,`url`]}).option(`ip`,{type:`string`,description:"Provide only if indicator_type is `ipv4` or `ipv6`."}).option(`security-adds`,{type:`string`,array:!0,description:`Security category IDs to add.`}).option(`security-removes`,{type:`string`,array:!0,description:`Security category IDs to remove.`}).option(`url`,{type:`string`,description:"Provide only if indicator_type is `domain` or `url`. Example if indicator_type is `domain`: `example.com`. Example if indicator_type is `url`: `https://example.com/news/`."}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf intel miscategorizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/intel/miscategorization`,pathParams:{},bodyKind:`json`,body:{contentAdds:n.contentAdds,contentRemoves:n.contentRemoves,indicatorType:n.indicatorType,ip:n.ip,securityAdds:n.securityAdds,securityRemoves:n.securityRemoves,url:n.url,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating miscategorization`,async()=>f.post(`/accounts/${p}/intel/miscategorization`,{body:e})),{successLabel:`Created miscategorization`});return}let m={};n.contentAdds!==void 0&&o(m,[`content_adds`],n.contentAdds),n.contentRemoves!==void 0&&o(m,[`content_removes`],n.contentRemoves),n.indicatorType!==void 0&&o(m,[`indicator_type`],i(n.indicatorType,`indicatorType`,`text`)),n.ip!==void 0&&o(m,[`ip`],i(n.ip,`ip`,`text`)),n.securityAdds!==void 0&&o(m,[`security_adds`],n.securityAdds),n.securityRemoves!==void 0&&o(m,[`security_removes`],n.securityRemoves),n.url!==void 0&&o(m,[`url`],i(n.url,`url`,`text`)),c(await d(`Creating miscategorization`,async()=>f.post(`/accounts/${p}/intel/miscategorization`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created miscategorization`})}},$={command:`miscategorizations`,describe:`Report and track domain miscategorization corrections`,builder:e=>e.command(Q).demandCommand(1),handler:()=>{}},te={command:`list`,describe:`Retrieves DNS sinkhole configurations used for redirecting malicious domain traffic to safe destinations.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading sinkholes`,async()=>n.intel.sinkholes.list(i)),{successLabel:`Loaded sinkholes`})}},ne={command:`sinkholes`,describe:`DNS sinkhole addresses used to redirect malicious traffic for analysis`,builder:e=>e.command(te).demandCommand(1),handler:()=>{}},re={command:`get`,describe:`Retrieves WHOIS registration data for a domain, including registrant and nameserver information.`,builder:e=>e.option(`domain`,{type:`string`,description:`Domain`}),handler:async e=>{let n={};e.domain!==void 0&&(n.domain=e.domain);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading whoi`,async()=>i.intel.whois.get(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded whoi`})}},ie={command:`whois`,describe:`WHOIS registration data for domains including registrant, registrar, and nameservers`,builder:e=>e.command(re).demandCommand(1),handler:()=>{}},ae={command:`intel`,describe:`Threat intelligence lookups — IP reputation, domain info, ASN details, WHOIS, and indicator feeds`,builder:e=>e.command(_).command(E).command(O).command(A).command(P).command(q).command(Y).command(Z).command($).command(ne).command(ie).demandCommand(1),handler:()=>{}};export{ae as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./auth-BHD_B2p9.mjs";import{t}from"./output-CqGQp2r6.mjs";import{t as n}from"./progress-5sHFvwez.mjs";const r={command:`list`,describe:`Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or https://developers.cloudflare.com/china-network/reference/infrastructure/ for JD Cloud IPs.`,builder:e=>e.option(`networks`,{type:`string`,description:"Specified as `jdcloud` to list IPs used by JD Cloud data centers."}),handler:async r=>{let i={};r.networks!==void 0&&(i.networks=r.networks);let a=await e(r);t(await n(`Loading ips`,async()=>a.ips.list(Object.keys(i).length>0?i:void 0)),{successLabel:`Loaded ips`})}},i={command:`ips`,describe:`List Cloudflare's IP ranges used for proxying traffic — useful for firewall allowlisting`,builder:e=>e.command(r).demandCommand(1),handler:()=>{}};export{i as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Creates a Keyless SSL configuration that allows SSL/TLS termination without exposing private keys to Cloudflare. Keys remain on your infrastructure.`,builder:e=>e.option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or SSL certificate and intermediate(s).`}).option(`host`,{type:`string`,description:`The keyless SSL name.`}).option(`name`,{type:`string`,description:`The keyless SSL name.`}).option(`port`,{type:`number`,description:`The keyless SSL port used to communicate between Cloudflare and the client's Keyless SSL server.`,default:24008}).option(`tunnel-private-ip`,{type:`string`,description:`Private IP of the Key Server Host`}).option(`tunnel-vnet-id`,{type:`string`,description:`Cloudflare Tunnel Virtual Network ID`}).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)`}).check(e=>{if([`tunnel-private-ip`,`tunnel-vnet-id`].some(t=>e[t]!==void 0)){let t=[`tunnel-private-ip`,`tunnel-vnet-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tunnel-* flag is set`)}return!0}),handler:async t=>{if(t.dryRun){l({command:`cf keyless-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/keyless_certificates`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{bundleMethod:t.bundleMethod,certificate:t.certificate,host:t.host,name:t.name,port:t.port,tunnelPrivateIp:t.tunnelPrivateIp,tunnelVnetId:t.tunnelVnetId,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating keyless certificate`,async()=>a.post(`/zones/${t.zoneId}/keyless_certificates`,{body:e})),{successLabel:`Created keyless certificate`});return}if(t.certificate===void 0&&(t.certificate=await e(`certificate`,`The zone's SSL certificate or SSL certificate and intermediate(s).`)),t.host===void 0&&(t.host=await e(`host`,`The keyless SSL name.`)),t.port===void 0)throw Error(`--port is required (or pass --body with this field set).`);let d={};t.bundleMethod!==void 0&&o(d,[`bundle_method`],i(t.bundleMethod,`bundleMethod`,`text`)),t.certificate!==void 0&&o(d,[`certificate`],i(t.certificate,`certificate`,`text`)),t.host!==void 0&&o(d,[`host`],i(t.host,`host`,`text`)),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.port!==void 0&&o(d,[`port`],t.port),t.tunnelPrivateIp!==void 0&&o(d,[`tunnel`,`private_ip`],i(t.tunnelPrivateIp,`tunnelPrivateIp`,`text`)),t.tunnelVnetId!==void 0&&o(d,[`tunnel`,`vnet_id`],i(t.tunnelVnetId,`tunnelVnetId`,`text`)),c(await u(`Creating keyless certificate`,async()=>a.post(`/zones/${t.zoneId}/keyless_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created keyless certificate`})}},f={command:`delete <keylessCertificateId>`,describe:`Removes a Keyless SSL configuration. SSL connections will no longer use the keyless server for cryptographic operations.`,builder:e=>e.positional(`keylessCertificateId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.keylessCertificateId,`keylessCertificateId`),e.dryRun){l({command:`cf keyless-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/keyless_certificates/${e.keylessCertificateId??`<keylessCertificateId>`}`,pathParams:{keylessCertificateId:String(e.keylessCertificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`keyless certificate`,String(e.keylessCertificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}if(e.body){let t=s(e.body);c(await u(`Deleting keyless certificate`,async()=>i.delete(`/zones/${e.zoneId}/keyless_certificates/${e.keylessCertificateId}`,{body:t})),{successLabel:`Deleted keyless certificate`});return}c(await u(`Deleting keyless certificate`,async()=>i.keylessCertificates.delete(e.keylessCertificateId,o)),{successLabel:`Deleted keyless certificate`})}},p={command:`edit <keylessCertificateId>`,describe:`This will update attributes of a Keyless SSL. Consists of one or more of the following: host,name,port.`,builder:e=>e.positional(`keylessCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Whether or not the Keyless SSL is on or off.`}).option(`host`,{type:`string`,description:`The keyless SSL name.`}).option(`name`,{type:`string`,description:`The keyless SSL name.`}).option(`port`,{type:`number`,description:`The keyless SSL port used to communicate between Cloudflare and the client's Keyless SSL server.`,default:24008}).option(`tunnel-private-ip`,{type:`string`,description:`Private IP of the Key Server Host`}).option(`tunnel-vnet-id`,{type:`string`,description:`Cloudflare Tunnel Virtual Network ID`}).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)`}).check(e=>{if([`tunnel-private-ip`,`tunnel-vnet-id`].some(t=>e[t]!==void 0)){let t=[`tunnel-private-ip`,`tunnel-vnet-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tunnel-* flag is set`)}return!0}),handler:async e=>{if(a(e.keylessCertificateId,`keylessCertificateId`),e.dryRun){l({command:`cf keyless-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/keyless_certificates/${e.keylessCertificateId??`<keylessCertificateId>`}`,pathParams:{keylessCertificateId:String(e.keylessCertificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,host:e.host,name:e.name,port:e.port,tunnelPrivateIp:e.tunnelPrivateIp,tunnelVnetId:e.tunnelVnetId,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating keyless certificate`,async()=>t.patch(`/zones/${e.zoneId}/keyless_certificates/${e.keylessCertificateId}`,{body:n})),{successLabel:`Updated keyless certificate`});return}let d={};e.enabled!==void 0&&o(d,[`enabled`],e.enabled),e.host!==void 0&&o(d,[`host`],i(e.host,`host`,`text`)),e.name!==void 0&&o(d,[`name`],i(e.name,`name`,`text`)),e.port!==void 0&&o(d,[`port`],e.port),e.tunnelPrivateIp!==void 0&&o(d,[`tunnel`,`private_ip`],i(e.tunnelPrivateIp,`tunnelPrivateIp`,`text`)),e.tunnelVnetId!==void 0&&o(d,[`tunnel`,`vnet_id`],i(e.tunnelVnetId,`tunnelVnetId`,`text`)),c(await u(`Updating keyless certificate`,async()=>t.patch(`/zones/${e.zoneId}/keyless_certificates/${e.keylessCertificateId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated keyless certificate`})}},m={command:`get <keylessCertificateId>`,describe:`Get details for one Keyless SSL configuration.`,builder:e=>e.positional(`keylessCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.keylessCertificateId,`keylessCertificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading keyless certificate`,async()=>t.keylessCertificates.get(e.keylessCertificateId,i)),{successLabel:`Loaded keyless certificate`})}},h={command:`list`,describe:`List all Keyless SSL configurations for a given zone.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading keyless certificates`,async()=>t.keylessCertificates.list(i)),{successLabel:`Loaded keyless certificates`})}},g={command:`keyless-certificates`,describe:`Use your own SSL certificates without exposing private keys — keys stay on your infrastructure`,builder:e=>e.command(d).command(f).command(p).command(m).command(h).demandCommand(1),handler:()=>{}};export{g as default};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";import{n as p,t as m}from"./raw-fetch-CxFs4i0R.mjs";const h={command:`delete <namespaceId>`,describe:`Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.`,builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.namespaceId,`namespaceId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv bulk delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}/bulk/delete`,pathParams:{namespaceId:String(t.namespaceId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`bulk`,String(t.namespaceId??``),{force:!!t.force,message:`This operation deletes the specified keys from the namespace.`})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=c(t.body);if(Array.isArray(e)&&e.length>1e4){let n=Math.ceil(e.length/1e4),r=null;for(let i=0;i<e.length;i+=1e4){let o=e.slice(i,i+1e4);r=await f(`Deleting bulk: batch ${Math.floor(i/1e4)+1}/${n}`,async()=>a.post(`/accounts/${s}/storage/kv/namespaces/${t.namespaceId}/bulk/delete`,{body:o}))}l(r,{successLabel:`Deleted bulk`});return}l(await f(`Deleting bulk`,async()=>a.post(`/accounts/${s}/storage/kv/namespaces/${t.namespaceId}/bulk/delete`,{body:e})),{successLabel:`Deleted bulk`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`get <namespaceId>`,describe:"Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true.",builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`keys`,{type:`string`,array:!0,description:`Array of keys to retrieve (maximum of 100).`}).option(`type`,{type:`string`,description:`Whether to parse JSON values in the response.`,choices:[`text`,`json`],default:`text`}).option(`with-metadata`,{type:`boolean`,description:`Whether to include metadata in the response.`,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)`}),handler:async t=>{if(o(t.namespaceId,`namespaceId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv bulk get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}/bulk/get`,pathParams:{namespaceId:String(t.namespaceId??``)},bodyKind:`json`,body:{keys:t.keys,type:t.type,withMetadata:t.withMetadata,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating bulk`,async()=>r.post(`/accounts/${p}/storage/kv/namespaces/${t.namespaceId}/bulk/get`,{body:e})),{successLabel:`Created bulk`});return}if(t.keys===void 0)throw Error(`--keys is required (or pass --body with this field set).`);let m={};t.keys!==void 0&&s(m,[`keys`],t.keys),t.type!==void 0&&s(m,[`type`],a(t.type,`type`,`text`)),t.withMetadata!==void 0&&s(m,[`withMetadata`],t.withMetadata),l(await f(`Creating bulk`,async()=>r.post(`/accounts/${p}/storage/kv/namespaces/${t.namespaceId}/bulk/get`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created bulk`})}},_={command:`update <namespaceId>`,describe:"Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less.",builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace 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)`}),handler:async t=>{if(o(t.namespaceId,`namespaceId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}/bulk`,pathParams:{namespaceId:String(t.namespaceId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);if(Array.isArray(e)&&e.length>1e4){let n=Math.ceil(e.length/1e4),i=null;for(let o=0;o<e.length;o+=1e4){let s=e.slice(o,o+1e4);i=await f(`Updating bulk: batch ${Math.floor(o/1e4)+1}/${n}`,async()=>r.put(`/accounts/${a}/storage/kv/namespaces/${t.namespaceId}/bulk`,{body:s}))}l(i,{successLabel:`Updated bulk`});return}l(await f(`Updating bulk`,async()=>r.put(`/accounts/${a}/storage/kv/namespaces/${t.namespaceId}/bulk`,{body:e})),{successLabel:`Updated bulk`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},v={command:`bulk`,describe:`Bulk read, write, and delete operations on multiple KV key-value pairs at once`,builder:e=>e.command(h).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`delete <keyName>`,describe:"Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:e=>e.positional(`keyName`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.keyName,`keyName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}/values/${t.keyName??`<keyName>`}`,pathParams:{keyName:String(t.keyName??``),namespaceId:String(t.namespaceId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`key`,String(t.keyName??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting key`,async()=>a.delete(`/accounts/${s}/storage/kv/namespaces/${t.namespaceId}/values/${t.keyName}`,{body:e})),{successLabel:`Deleted key`});return}l(await f(`Deleting key`,async()=>a.kv.keys.delete(t.keyName,t.namespaceId,s)),{successLabel:`Deleted key`})}},b={command:`get <keyName>`,describe:"Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header.",builder:e=>e.positional(`keyName`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}),handler:async e=>{o(e.keyName,`keyName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r;let a=await f(`Loading key`,async()=>m(`/accounts/${r}/storage/kv/namespaces/${e.namespaceId}/values/${e.keyName}`,`GET`,e.local?e.localEndpoint:void 0));p(e.text===!0?a.toString(`utf-8`):a)}},x={command:`list`,describe:`Lists a namespace's keys.`,builder:e=>e.option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limits the number of keys returned in the response. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit.`}).option(`prefix`,{type:`string`,description:`Filters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned.`}).option(`cursor`,{type:`string`,description:"Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the `cursors` object in the `result_info` structure."}),handler:async e=>{let t={};e.limit!==void 0&&(t.limit=e.limit),e.prefix!==void 0&&(t.prefix=e.prefix),e.cursor!==void 0&&(t.cursor=e.cursor);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading keys`,async()=>r.kv.keys.list(e.namespaceId,a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded keys`})}},S={command:`update <keyName>`,describe:"Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use `multipart/form-data` content type for your PUT request (see dropdown below in `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored.",builder:e=>e.positional(`keyName`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`expiration`,{type:`string`,description:`Expires the key at a certain time, measured in number of seconds since the UNIX epoch.`}).option(`expiration-ttl`,{type:`string`,description:`Expires the key after a number of seconds. Must be at least 60.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A byte sequence to be stored, up to 25 MiB in length.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`The metadata`}),handler:async t=>{o(t.keyName,`keyName`);let r={};if(t.expiration!==void 0&&(r.expiration=t.expiration),t.expirationTtl!==void 0&&(r.expiration_ttl=t.expirationTtl),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}/values/${t.keyName??`<keyName>`}`,pathParams:{keyName:String(t.keyName??``),namespaceId:String(t.namespaceId??``)},bodyKind:`multipart`,body:{...r,body:t.body,file:t.file,metadata:t.metadata},validation:`passed`});return}let s=await i(t),c=t.local?d:await n(s);if(t.accountId=c,t.metadata!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`value`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`value`,t.body);t.metadata!==void 0&&e.append(`metadata`,String(a(t.metadata,`metadata`,`text`)??``)),l(await f(`Updating key`,async()=>s.put(`/accounts/${c}/storage/kv/namespaces/${t.namespaceId}/values/${t.keyName}`,{body:e})),{successLabel:`Updated key`});return}if(t.file){let{readFileSync:e}=await import(`node:fs`),{resolve:n}=await import(`node:path`),r=e(n(t.file));l(await f(`Updating key`,async()=>s.put(`/accounts/${c}/storage/kv/namespaces/${t.namespaceId}/values/${t.keyName}`,{body:r,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated key`});return}if(t.body){let e=a(t.body,`body`,`binary`),n=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await f(`Updating key`,async()=>s.put(`/accounts/${c}/storage/kv/namespaces/${t.namespaceId}/values/${t.keyName}${n?`?`+n:``}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated key`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},C={command:`keys`,describe:`Read, write, and delete individual key-value pairs in a KV namespace. Pass --namespace-id to scope.`,builder:e=>e.command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`get <keyName>`,describe:"Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:e=>e.positional(`keyName`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}),handler:async e=>{o(e.keyName,`keyName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading metadata`,async()=>t.kv.metadata.get(e.keyName,e.namespaceId,r)),{successLabel:`Loaded metadata`})}},T={command:`metadata`,describe:`Read the metadata associated with a KV key without fetching its value`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`create`,describe:"Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.",builder:e=>e.option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf kv namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/storage/kv/namespaces`,pathParams:{},bodyKind:`json`,body:{title:r.title,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating namespace`,async()=>p.post(`/accounts/${m}/storage/kv/namespaces`,{body:e})),{successLabel:`Created namespace`});return}r.title===void 0&&(r.title=await t(`title`,`A human-readable string name for a Namespace.`));let h={};r.title!==void 0&&s(h,[`title`],a(r.title,`title`,`text`)),l(await f(`Creating namespace`,async()=>p.post(`/accounts/${m}/storage/kv/namespaces`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created namespace`})}},D={command:`delete <namespaceId>`,describe:`Deletes the namespace corresponding to the given ID.`,builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.namespaceId,`namespaceId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf kv namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/storage/kv/namespaces/${t.namespaceId??`<namespaceId>`}`,pathParams:{namespaceId:String(t.namespaceId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`namespace`,String(t.namespaceId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting namespace`,async()=>a.delete(`/accounts/${s}/storage/kv/namespaces/${t.namespaceId}`,{body:e})),{successLabel:`Deleted namespace`});return}l(await f(`Deleting namespace`,async()=>a.kv.namespaces.delete(t.namespaceId,s)),{successLabel:`Deleted namespace`})}},O={command:`get <namespaceId>`,describe:`Get the namespace corresponding to the given ID.`,builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}),handler:async e=>{o(e.namespaceId,`namespaceId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading namespace`,async()=>t.kv.namespaces.get(e.namespaceId,r)),{successLabel:`Loaded namespace`})}},k={command:`list`,describe:`Returns the namespaces owned by an account.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`id`,`title`]}).option(`direction`,{type:`string`,description:`Direction to order namespaces.`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading namespaces`,async()=>r.kv.namespaces.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded namespaces`})}},A={command:`update <namespaceId>`,describe:`Modifies a namespace's title.`,builder:e=>e.positional(`namespaceId`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).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)`}),handler:async r=>{if(o(r.namespaceId,`namespaceId`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf kv namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/storage/kv/namespaces/${r.namespaceId??`<namespaceId>`}`,pathParams:{namespaceId:String(r.namespaceId??``)},bodyKind:`json`,body:{title:r.title,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Updating namespace`,async()=>p.put(`/accounts/${m}/storage/kv/namespaces/${r.namespaceId}`,{body:e})),{successLabel:`Updated namespace`});return}r.title===void 0&&(r.title=await t(`title`,`A human-readable string name for a Namespace.`));let h={};r.title!==void 0&&s(h,[`title`],a(r.title,`title`,`text`)),l(await f(`Updating namespace`,async()=>p.put(`/accounts/${m}/storage/kv/namespaces/${r.namespaceId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated namespace`})}},j={command:`namespaces`,describe:`KV namespaces — create, read, rename, and delete the containers that hold your key-value pairs`,builder:e=>e.command(E).command(D).command(O).command(k).command(A).demandCommand(1),handler:()=>{}},M={command:`kv`,describe:`Global, low-latency key-value storage for Workers — namespaces, keys, values, and bulk operations`,builder:e=>e.command(v).command(C).command(T).command(j).demandCommand(1),handler:()=>{}};export{M as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r,r as i}from"./input-validation-BpVQi9rR.mjs";import{n as a,t as o}from"./body-parser-iA3vRFmh.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./progress-5sHFvwez.mjs";const u={command:`create`,describe:`Updates the current status of Leaked Credential Checks.`,builder:e=>e.option(`enabled`,{type:`boolean`,description:`Determines whether or not Leaked Credential Checks are enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines the overall status for Leaked Credential Checks.`}),handler:async e=>{if(e.dryRun){c({command:`cf leaked-credential-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/leaked-credential-checks`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body},validation:`passed`});return}let r=await t(e);if(e.zoneId=await n({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Creating leaked credential check`,async()=>r.post(`/zones/${e.zoneId}/leaked-credential-checks`,{body:t})),{successLabel:`Created leaked credential check`});return}let i={};e.enabled!==void 0&&a(i,[`enabled`],e.enabled),s(await l(`Creating leaked credential check`,async()=>r.post(`/zones/${e.zoneId}/leaked-credential-checks`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created leaked credential check`})}},d={command:`create`,describe:`Create user-defined detection pattern for Leaked Credential Checks.`,builder:e=>e.option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`}),handler:async e=>{if(e.dryRun){c({command:`cf leaked-credential-checks detections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/leaked-credential-checks/detections`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{password:e.password,username:e.username,body:e.body},validation:`passed`});return}let i=await t(e);if(e.zoneId=await n({zone:e.zone},i,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Creating detection`,async()=>i.post(`/zones/${e.zoneId}/leaked-credential-checks/detections`,{body:t})),{successLabel:`Created detection`});return}let u={};e.password!==void 0&&a(u,[`password`],r(e.password,`password`,`text`)),e.username!==void 0&&a(u,[`username`],r(e.username,`username`,`text`)),s(await l(`Creating detection`,async()=>i.post(`/zones/${e.zoneId}/leaked-credential-checks/detections`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created detection`})}},f={command:`delete <detectionId>`,describe:`Remove user-defined detection pattern for Leaked Credential Checks.`,builder:e=>e.positional(`detectionId`,{type:`string`,description:`Defines the unique ID for this custom detection.`,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}),handler:async r=>{if(i(r.detectionId,`detectionId`),r.dryRun){c({command:`cf leaked-credential-checks detections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/leaked-credential-checks/detections/${r.detectionId??`<detectionId>`}`,pathParams:{zoneId:String(r.zoneId??``),detectionId:String(r.detectionId??``)},bodyKind:`none`,validation:`passed`});return}let a=await t(r),o=await n({zone:r.zone},a,{quiet:r.quiet});if(r.zoneId=o,!await e(`detection`,String(r.detectionId??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}s(await l(`Deleting detection`,async()=>a.leakedCredentialChecks.detections.delete(o,r.detectionId)),{successLabel:`Deleted detection`})}},p={command:`get <detectionId>`,describe:`Get user-defined detection pattern for Leaked Credential Checks.`,builder:e=>e.positional(`detectionId`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}),handler:async e=>{i(e.detectionId,`detectionId`);let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading detection`,async()=>r.leakedCredentialChecks.detections.get(a,e.detectionId)),{successLabel:`Loaded detection`})}},m={command:`list`,describe:`List user-defined detection patterns for Leaked Credential Checks.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading detections`,async()=>r.leakedCredentialChecks.detections.list(i)),{successLabel:`Loaded detections`})}},h={command:`update <detectionId>`,describe:`Update user-defined detection pattern for Leaked Credential Checks.`,builder:e=>e.positional(`detectionId`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`}),handler:async e=>{if(i(e.detectionId,`detectionId`),e.dryRun){c({command:`cf leaked-credential-checks detections update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/leaked-credential-checks/detections/${e.detectionId??`<detectionId>`}`,pathParams:{zoneId:String(e.zoneId??``),detectionId:String(e.detectionId??``)},bodyKind:`json`,body:{password:e.password,username:e.username,body:e.body},validation:`passed`});return}let u=await t(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating detection`,async()=>u.put(`/zones/${e.zoneId}/leaked-credential-checks/detections/${e.detectionId}`,{body:t})),{successLabel:`Updated detection`});return}let d={};e.password!==void 0&&a(d,[`password`],r(e.password,`password`,`text`)),e.username!==void 0&&a(d,[`username`],r(e.username,`username`,`text`)),s(await l(`Updating detection`,async()=>u.put(`/zones/${e.zoneId}/leaked-credential-checks/detections/${e.detectionId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated detection`})}},g={command:`detections`,describe:`Custom detection rules that define which request fields contain usernames and passwords to check`,builder:e=>e.command(d).command(f).command(p).command(m).command(h).demandCommand(1),handler:()=>{}},_={command:`get`,describe:`Retrieves the current status of Leaked Credential Checks.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading leaked credential check`,async()=>r.leakedCredentialChecks.get(i)),{successLabel:`Loaded leaked credential check`})}},v={command:`leaked-credential-checks`,describe:`Detect compromised credentials in login requests by checking against known breach databases`,builder:e=>e.command(u).command(_).command(g).demandCommand(1),handler:()=>{}};export{v as default};