cf 0.2.0 → 0.3.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 (262) hide show
  1. package/dist/_meta/agent-context.json +63 -62
  2. package/dist/_meta/commands.json +12365 -9690
  3. package/dist/_meta/schemas.json +19206 -15404
  4. package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
  5. package/dist/accounts-Kx1epdA1.mjs +22 -0
  6. package/dist/acm-Utu252kC.mjs +3 -0
  7. package/dist/addressing-CBq7Z7Vq.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
  9. package/dist/ai-DOOKLPkG.mjs +2 -0
  10. package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
  11. package/dist/ai-search-CQF_Sn7d.mjs +7 -0
  12. package/dist/ai_gateway-C3fH22C0.mjs +4 -0
  13. package/dist/alerting-CqmEIaKn.mjs +6 -0
  14. package/dist/analytics-Dv-X8x7D.mjs +20 -0
  15. package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
  16. package/dist/api-gateway-CNv0IHTU.mjs +33 -0
  17. package/dist/argo-CX_A4kcn.mjs +2 -0
  18. package/dist/audit-logs-BfBf3oo-.mjs +2 -0
  19. package/dist/auth-SyWhMmPu.mjs +6 -0
  20. package/dist/auth-ffdf9yR0.mjs +135 -0
  21. package/dist/autorag-BuGhGTeZ.mjs +2 -0
  22. package/dist/billing-PoG81XaQ.mjs +2 -0
  23. package/dist/body-parser-DKa8Ipg1.mjs +2 -0
  24. package/dist/bot-management-CFvtVx62.mjs +5 -0
  25. package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
  26. package/dist/brand-protection-D05Eg-_6.mjs +3 -0
  27. package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
  28. package/dist/{build-5jmmOZhm.mjs → build-DYkGW4dh.mjs} +1 -1
  29. package/dist/cache-DsoW6Xwv.mjs +5 -0
  30. package/dist/calls-CZbO7TyR.mjs +4 -0
  31. package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
  32. package/dist/cli-types-CRIDdDw3.mjs +2 -0
  33. package/dist/client-certificates-MJcDsTId.mjs +3 -0
  34. package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
  35. package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
  36. package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
  37. package/dist/connectivity-BX8C7tvK.mjs +3 -0
  38. package/dist/content-scanning-r6uzMO1r.mjs +4 -0
  39. package/dist/context-DGlHRGWM.mjs +2 -0
  40. package/dist/custom-certificates-aAiEguR7.mjs +5 -0
  41. package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
  42. package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
  43. package/dist/custom-pages-DQCi2plU.mjs +4 -0
  44. package/dist/d1-DbnYhw45.mjs +4 -0
  45. package/dist/data-security-D_EtYBfo.mjs +6 -0
  46. package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
  47. package/dist/{deploy-DbkiIzUr.mjs → deploy-CQial3kN.mjs} +1 -1
  48. package/dist/{dev-C6iSuQZm.mjs → dev-B38LfCTl.mjs} +1 -1
  49. package/dist/diagnostics-BJQGjVJn.mjs +3 -0
  50. package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
  51. package/dist/{dist-CnSubA1Z.mjs → dist-AIcZFk0U.mjs} +7 -7
  52. package/dist/dns-VMhQSr5n.mjs +29 -0
  53. package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
  54. package/dist/durable-objects-CTboySEo.mjs +2 -0
  55. package/dist/email-routing-tIR2SFu-.mjs +10 -0
  56. package/dist/email-security-Ca1id3rZ.mjs +8 -0
  57. package/dist/email-sending-DwWKc5jC.mjs +3 -0
  58. package/dist/filters-A4dg_a68.mjs +4 -0
  59. package/dist/firewall-DWPQgYd9.mjs +11 -0
  60. package/dist/fraud-BMkSsJGU.mjs +20 -0
  61. package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
  62. package/dist/healthchecks-CtIfrFql.mjs +4 -0
  63. package/dist/hostnames-BiomxukN.mjs +3 -0
  64. package/dist/hyperdrive-Da104VaQ.mjs +18 -0
  65. package/dist/iam-BIGKo0WW.mjs +6 -0
  66. package/dist/images-BO8FbDAa.mjs +5 -0
  67. package/dist/index.mjs +1 -1
  68. package/dist/intel-CY6_79v8.mjs +3 -0
  69. package/dist/{ips-B8fwxKZD.mjs → ips-K4bzaGqd.mjs} +1 -1
  70. package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
  71. package/dist/kv-8o27w_pY.mjs +5 -0
  72. package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
  73. package/dist/load-balancers-DtG8nj25.mjs +6 -0
  74. package/dist/logpush-4L0njy1d.mjs +4 -0
  75. package/dist/logs-B_Yp95hv.mjs +3 -0
  76. package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
  77. package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
  78. package/dist/magic-transit-CXDyvhxq.mjs +90 -0
  79. package/dist/managed-transforms-D15yVbZx.mjs +3 -0
  80. package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
  81. package/dist/network-interconnects-rrr7red3.mjs +36 -0
  82. package/dist/observability-DWvpqnQJ.mjs +4 -0
  83. package/dist/organizations-T77D50Sq.mjs +41 -0
  84. package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
  85. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
  86. package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
  87. package/dist/output-BJFNwj7b.mjs +2 -0
  88. package/dist/page-rules-CjZPTMQX.mjs +18 -0
  89. package/dist/page-shield-D5RRNJCY.mjs +37 -0
  90. package/dist/pages-CWJtJnL0.mjs +11 -0
  91. package/dist/pipelines-B0L_7j9e.mjs +6 -0
  92. package/dist/{progress-CjcQ6ato.mjs → progress-CrCGTq7N.mjs} +1 -1
  93. package/dist/queues-CN6DPhRR.mjs +6 -0
  94. package/dist/r2-DQIcyRtA.mjs +21 -0
  95. package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
  96. package/dist/radar-Bxb0WX8V.mjs +2 -0
  97. package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
  98. package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
  99. package/dist/realtime-kit-CaquuVOE.mjs +18 -0
  100. package/dist/registrar-Ko-xZemf.mjs +46 -0
  101. package/dist/request-tracers-DOW_reTJ.mjs +2 -0
  102. package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
  103. package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
  104. package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
  105. package/dist/rules-BXRADHL5.mjs +4 -0
  106. package/dist/rulesets-CBgpeSvJ.mjs +8 -0
  107. package/dist/rum-BjPptTUP.mjs +4 -0
  108. package/dist/{schema-CHBfkARI.mjs → schema-D16TgWBg.mjs} +1 -1
  109. package/dist/schema-validation-Dgv_opM3.mjs +24 -0
  110. package/dist/scim-DdSEr4kZ.mjs +3 -0
  111. package/dist/secrets-store-7BfyvJLb.mjs +25 -0
  112. package/dist/security-center-DAy6AKtT.mjs +2 -0
  113. package/dist/security-txt-xAMb7K6Y.mjs +3 -0
  114. package/dist/session-COHHdS7A.mjs +5 -0
  115. package/dist/{shared-DEzmTsEC.mjs → shared-AGtpXwwL.mjs} +1 -1
  116. package/dist/smart-shield-TeWZFnH2.mjs +3 -0
  117. package/dist/snippets-CCSsCXVs.mjs +4 -0
  118. package/dist/{spawn-13QQ0IwO.mjs → spawn-DcppKGI5.mjs} +1 -1
  119. package/dist/spectrum-CTTZID8u.mjs +63 -0
  120. package/dist/speed-CuzTE0AL.mjs +4 -0
  121. package/dist/{src-B9cKsgsg.mjs → src-BW6vfAwE.mjs} +10 -10
  122. package/dist/ssl-BWA2LdwC.mjs +15 -0
  123. package/dist/stream-GFsIZ-pP.mjs +14 -0
  124. package/dist/tenants-Bd7NGQ_m.mjs +2 -0
  125. package/dist/token-validation-DAgtFOvs.mjs +10 -0
  126. package/dist/{tools-B7QiNu-d.mjs → tools-DXQmfFuE.mjs} +1 -1
  127. package/dist/turnstile-cfdaO4ca.mjs +23 -0
  128. package/dist/{ui-BXjU1dX1.mjs → ui-D4KtlMh9.mjs} +1 -1
  129. package/dist/url-normalization-B5RN4nLD.mjs +3 -0
  130. package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
  131. package/dist/user-CAo-yCJA.mjs +10 -0
  132. package/dist/vectorize-C7_oQlaI.mjs +4 -0
  133. package/dist/{versions-DzyrlUAi.mjs → versions-CUwWJWmy.mjs} +1 -1
  134. package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
  135. package/dist/web3-HQJRm38W.mjs +4 -0
  136. package/dist/workers-Dg7ddG2Q.mjs +18 -0
  137. package/dist/workers-builds-AVfx8IyL.mjs +7 -0
  138. package/dist/workflows-VquuSh2J.mjs +4 -0
  139. package/dist/zaraz-xYSWIV4P.mjs +2 -0
  140. package/dist/zero-trust-CP96wnSh.mjs +118 -0
  141. package/dist/zones-BSgmZ9WC.mjs +21 -0
  142. package/package.json +4 -3
  143. package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
  144. package/dist/accounts-BopMfODC.mjs +0 -21
  145. package/dist/acm-BT4vlnEJ.mjs +0 -3
  146. package/dist/addressing-B3uFxHst.mjs +0 -13
  147. package/dist/ai-DWHqwMap.mjs +0 -2
  148. package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
  149. package/dist/ai-search-VnOQ5n--.mjs +0 -7
  150. package/dist/alerting-BmmgIlIO.mjs +0 -6
  151. package/dist/analytics-isY03taL.mjs +0 -20
  152. package/dist/api-gateway-DXurEbA-.mjs +0 -33
  153. package/dist/argo-B02BL_hp.mjs +0 -2
  154. package/dist/audit-logs-DcgR9xUc.mjs +0 -2
  155. package/dist/auth-CQcAgnOy.mjs +0 -135
  156. package/dist/auth-DenWm_X0.mjs +0 -6
  157. package/dist/autorag-CmrwnGVj.mjs +0 -2
  158. package/dist/billing-CaW1ZAB1.mjs +0 -2
  159. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  160. package/dist/bot-management-CeBsFx68.mjs +0 -5
  161. package/dist/botnet-feed-B396vQeQ.mjs +0 -3
  162. package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
  163. package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
  164. package/dist/builds-C_ySULja.mjs +0 -2
  165. package/dist/cache-DmXizSMi.mjs +0 -5
  166. package/dist/calls-x4KQpTB4.mjs +0 -4
  167. package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
  168. package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
  169. package/dist/cloud-connector-BClQpEzI.mjs +0 -2
  170. package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
  171. package/dist/connectivity-G0NP6LtW.mjs +0 -3
  172. package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
  173. package/dist/context-CC0Rhkhy.mjs +0 -2
  174. package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
  175. package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
  176. package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
  177. package/dist/custom-pages-D-oErw57.mjs +0 -4
  178. package/dist/d1-C95ckPKI.mjs +0 -3
  179. package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
  180. package/dist/diagnostics-DEEhPnXj.mjs +0 -3
  181. package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
  182. package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
  183. package/dist/dns-qW-3TZOT.mjs +0 -29
  184. package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
  185. package/dist/email-routing-tdNJaCpJ.mjs +0 -10
  186. package/dist/email-security-DTVHNr2h.mjs +0 -60
  187. package/dist/email-sending-DsFTvE31.mjs +0 -3
  188. package/dist/filters-DO1Is_tI.mjs +0 -4
  189. package/dist/firewall-DbUhVTCg.mjs +0 -11
  190. package/dist/fraud-Bzr4njYb.mjs +0 -8
  191. package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
  192. package/dist/healthchecks-BBAs-lS_.mjs +0 -4
  193. package/dist/hostnames-Dz9PEUKS.mjs +0 -3
  194. package/dist/hyperdrive-B1iUJddG.mjs +0 -18
  195. package/dist/iam-CJM8gHpG.mjs +0 -6
  196. package/dist/images-DEoBmtFS.mjs +0 -5
  197. package/dist/intel-BM6xkZ0C.mjs +0 -3
  198. package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
  199. package/dist/kv-BTceLtWZ.mjs +0 -5
  200. package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
  201. package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
  202. package/dist/logpush-CSYhgevA.mjs +0 -4
  203. package/dist/logs-DlIwmMpt.mjs +0 -3
  204. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
  205. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
  206. package/dist/magic-transit-qQmA-981.mjs +0 -89
  207. package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
  208. package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
  209. package/dist/network-interconnects-CxG2deY0.mjs +0 -36
  210. package/dist/organizations-DyEAiGiR.mjs +0 -41
  211. package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
  212. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
  213. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
  214. package/dist/output-D7_yAFVR.mjs +0 -2
  215. package/dist/page-rules-DP-w6TAm.mjs +0 -18
  216. package/dist/page-shield-Bf7kFp8c.mjs +0 -37
  217. package/dist/pages-D0Y_XRqW.mjs +0 -10
  218. package/dist/pipelines-C-SPESAk.mjs +0 -6
  219. package/dist/queues-wv6CZsi8.mjs +0 -6
  220. package/dist/r2-DuXjp9n5.mjs +0 -21
  221. package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
  222. package/dist/radar-BW_ZHP8X.mjs +0 -2
  223. package/dist/rate-limits-DLTkIvwr.mjs +0 -5
  224. package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
  225. package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
  226. package/dist/registrar-DIIv6fWd.mjs +0 -46
  227. package/dist/request-tracers-DMej0Drs.mjs +0 -2
  228. package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
  229. package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
  230. package/dist/rules-DLJpOYbC.mjs +0 -4
  231. package/dist/rulesets-D9nqEJT5.mjs +0 -8
  232. package/dist/rum-DBVmdPkp.mjs +0 -4
  233. package/dist/schema-validation-MCd3xdtX.mjs +0 -4
  234. package/dist/scim-DZA3VXog.mjs +0 -3
  235. package/dist/scm-CilfPOue.mjs +0 -2
  236. package/dist/secrets-store-BrvcZSOM.mjs +0 -21
  237. package/dist/security-center-BU6f3Cm1.mjs +0 -2
  238. package/dist/security-txt-BPIbP3dG.mjs +0 -3
  239. package/dist/session-H7IV2BrM.mjs +0 -2
  240. package/dist/smart-shield-e8XFBkiF.mjs +0 -3
  241. package/dist/snippets-B4M3MMb8.mjs +0 -4
  242. package/dist/spectrum-B0adfSRI.mjs +0 -59
  243. package/dist/speed-BVcUtkAz.mjs +0 -4
  244. package/dist/ssl-BAa91gsc.mjs +0 -15
  245. package/dist/stream-D53sxKb3.mjs +0 -14
  246. package/dist/tenants-bH5pt3dJ.mjs +0 -2
  247. package/dist/token-validation-M61Vx_Tw.mjs +0 -4
  248. package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
  249. package/dist/url-normalization-DZrWDgB5.mjs +0 -3
  250. package/dist/url-scanner-Zo49edNp.mjs +0 -2
  251. package/dist/user-DbXlVReB.mjs +0 -10
  252. package/dist/vectorize-CUnTM0DT.mjs +0 -4
  253. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  254. package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
  255. package/dist/web3-DueyOQtx.mjs +0 -4
  256. package/dist/workers-builds-BM_aoeUR.mjs +0 -7
  257. package/dist/workers-nV_vBCfV.mjs +0 -16
  258. package/dist/workflows-CQITmo-s.mjs +0 -4
  259. package/dist/zaraz-DIbpF5Op.mjs +0 -2
  260. package/dist/zero-trust-CKp8j512.mjs +0 -119
  261. package/dist/zones-BZ5tZDbH.mjs +0 -28
  262. /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,n as t}from"./auth-ffdf9yR0.mjs";import{n,t as r}from"./body-parser-DKa8Ipg1.mjs";import{t as i}from"./output-BJFNwj7b.mjs";import{n as a,t as o}from"./progress-CrCGTq7N.mjs";import{n as s}from"./input-validation-zEO81MWN.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:c,handler:async n=>{if(n.dryRun){a({command:`cf fraud get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.fraud.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.option(`authentication-settings-failure-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-failure-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
3
+ - Maximum of 10 codes per criterion.
4
+ - Each code must be a valid HTTP status code (100-599).
5
+ - Codes are deduplicated and sorted on save.
6
+ - Omit to leave unchanged on update.
7
+ - Provide an empty array \`[]\` to clear codes on update.
8
+ `}).option(`authentication-settings-success-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-success-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
9
+ - Maximum of 10 codes per criterion.
10
+ - Each code must be a valid HTTP status code (100-599).
11
+ - Codes are deduplicated and sorted on save.
12
+ - Omit to leave unchanged on update.
13
+ - Provide an empty array \`[]\` to clear codes on update.
14
+ `}).option(`user-profiles`,{type:`string`,description:`Whether Fraud User Profiles is enabled for the zone.`,choices:[`enabled`,`disabled`]}).option(`username-expressions`,{type:`string`,array:!0,description:`List of expressions to detect usernames in write HTTP requests.
15
+
16
+ - Maximum of 10 expressions.
17
+ - Omit or set to null to leave unchanged on update.
18
+ - Provide an empty array \`[]\` to clear all expressions on update.
19
+ - Invalid expressions will result in a 10400 Bad Request with details in the \`messages\` array.
20
+ `}).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([`authentication-settings-failure-criteria-kind`,`authentication-settings-failure-criteria-status-codes`,`authentication-settings-success-criteria-kind`,`authentication-settings-success-criteria-status-codes`].some(t=>e[t]!==void 0)){let t=[`authentication-settings-failure-criteria-kind`,`authentication-settings-success-criteria-kind`].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 --authentication_settings-* flag is set`)}return!0})}const d={command:`update`,describe:"Update Fraud Detection settings for a zone. Notes on `username_expressions` behavior: - If omitted or set to null, expressions are not modified. - If provided as an empty array `[]`, all expressions will be cleared.",builder:u,handler:async c=>{if(c.dryRun){a({command:`cf fraud update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({authentication_settings:{failure_criteria:{kind:s(c[`authentication-settings-failure-criteria-kind`],`authentication-settings-failure-criteria-kind`,`text`),status_codes:c[`authentication-settings-failure-criteria-status-codes`]},success_criteria:{kind:s(c[`authentication-settings-success-criteria-kind`],`authentication-settings-success-criteria-kind`,`text`),status_codes:c[`authentication-settings-success-criteria-status-codes`]}},user_profiles:s(c[`user-profiles`],`user-profiles`,`text`),username_expressions:c[`username-expressions`]}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.fraud.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=r({authentication_settings:{failure_criteria:{kind:s(c[`authentication-settings-failure-criteria-kind`],`authentication-settings-failure-criteria-kind`,`text`),status_codes:c[`authentication-settings-failure-criteria-status-codes`]},success_criteria:{kind:s(c[`authentication-settings-success-criteria-kind`],`authentication-settings-success-criteria-kind`,`text`),status_codes:c[`authentication-settings-success-criteria-status-codes`]}},user_profiles:s(c[`user-profiles`],`user-profiles`,`text`),username_expressions:c[`username-expressions`]});i(await o(`Updating`,async()=>l.fraud.update({body:d,zone_id:u})),{successLabel:`Updated`})}},f={command:`fraud`,describe:`Fraud detection for login and signup flows — identify credential stuffing, account takeover, and fake accounts`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,n}from"./auth-ffdf9yR0.mjs";import{n as r,t as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.googleTagGateway.config.get({zone_id:i})),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:e,zone_id:d})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await e(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await e(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let f=i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]});a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:f,zone_id:d})),{successLabel:`Updated`})}},p={command:`config`,describe:`Operations for config`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,T as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Create a new health check.`,builder:u,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.previews.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}},E={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.update({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.update({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(O).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{k as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,i as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{t as c}from"./cli-types-CRIDdDw3.mjs";function l(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:c(l),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tlsSingle.get({zone_id:i,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Loaded`})}},d={command:`tls-single`,describe:`Operations for settings.tls-single`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:c(f),handler:async n=>{if(n.dryRun){o({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/hostnames/settings/${n[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(n[`setting-id`]))}/${n.hostname==null?`<hostname>`:encodeURIComponent(String(n.hostname))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"setting-id":String(n[`setting-id`]??``),hostname:String(n.hostname??``)},bodyKind:`none`});return}let i=await r(n),c=await e({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>i.hostnames.settings.tls.delete({zone_id:c,setting_id:n[`setting-id`],hostname:n.hostname})),{successLabel:`Deleted`})}};function m(e){return e.positional(`setting-id`,{type:`string`,description:'The TLS Setting name. The value type depends on the setting: - `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`). - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`). - `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:c(m),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tls.get({zone_id:i,setting_id:t[`setting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:c(g),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`json`,body:t.body===void 0?void 0:i(t.body)});return}let c=await r(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=i(t.body);a(await s(`Updating`,async()=>c.hostnames.settings.tls.update({...e,zone_id:l,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n(c,`PUT`,`/zones/${t.zoneId}/hostnames/settings/${encodeURIComponent(String(t[`setting-id`]))}/${encodeURIComponent(String(t.hostname))}`)),{successLabel:`Updated`})}},v={command:`tls`,describe:`Operations for settings.tls`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(v).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
3
+
4
+ Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
5
+ If not specified, defaults to 20 for free tier and 60 for paid tier.
6
+ Contact Cloudflare if you need a higher limit.
7
+ `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const m={command:`create`,describe:`Creates and returns a new Hyperdrive configuration.`,builder:p,handler:async r=>{if(r.dryRun){l({command:`cf hyperdrive create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({caching:{disabled:r[`caching-disabled`],max_age:r[`caching-max-age`],stale_while_revalidate:r[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(r[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(r[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(r[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(r.name,`name`,`text`),origin:{database:d(r[`origin-database`],`origin-database`,`text`),password:d(r[`origin-password`],`origin-password`,`text`),scheme:d(r[`origin-scheme`],`origin-scheme`,`text`),user:d(r[`origin-user`],`origin-user`,`text`),host:d(r[`origin-host`],`origin-host`,`text`),port:r[`origin-port`],access_client_id:d(r[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(r[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(r[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:r[`origin-connection-limit`]}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.hyperdrive.create({body:e,account_id:m})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),r[`origin-database`]===void 0&&(r[`origin-database`]=await t(`origin-database`,`Set the name of your origin database.`)),r[`origin-password`]===void 0&&(r[`origin-password`]=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),r[`origin-scheme`]===void 0&&(r[`origin-scheme`]=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),r[`origin-user`]===void 0&&(r[`origin-user`]=await t(`origin-user`,`Set the user of your origin database.`));let h=s({caching:{disabled:r[`caching-disabled`],max_age:r[`caching-max-age`],stale_while_revalidate:r[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(r[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(r[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(r[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(r.name,`name`,`text`),origin:{database:d(r[`origin-database`],`origin-database`,`text`),password:d(r[`origin-password`],`origin-password`,`text`),scheme:d(r[`origin-scheme`],`origin-scheme`,`text`),user:d(r[`origin-user`],`origin-user`,`text`),host:d(r[`origin-host`],`origin-host`,`text`),port:r[`origin-port`],access_client_id:d(r[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(r[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(r[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:r[`origin-connection-limit`]});c(await u(`Creating`,async()=>p.hyperdrive.create({body:h,account_id:m})),{successLabel:`Created`})}};function h(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <hyperdrive-id>`,describe:`Deletes the specified Hyperdrive.`,builder:h,handler:async t=>{if(t.dryRun){l({command:`cf hyperdrive delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs/${t[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(t[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(t[`hyperdrive-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
8
+ `);return}c(await u(`Deleting`,async()=>n.hyperdrive.delete({account_id:o,hyperdrive_id:t[`hyperdrive-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
9
+
10
+ Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
11
+ If not specified, defaults to 20 for free tier and 60 for paid tier.
12
+ Contact Cloudflare if you need a higher limit.
13
+ `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <hyperdrive-id>`,describe:`Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf hyperdrive edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs/${t[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(t[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(t[`hyperdrive-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({caching:{disabled:t[`caching-disabled`],max_age:t[`caching-max-age`],stale_while_revalidate:t[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(t[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(t[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(t[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(t.name,`name`,`text`),origin_connection_limit:t[`origin-connection-limit`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.hyperdrive.edit({...e,account_id:r,hyperdrive_id:t[`hyperdrive-id`]})),{successLabel:`Updated`});return}let p=s({caching:{disabled:t[`caching-disabled`],max_age:t[`caching-max-age`],stale_while_revalidate:t[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(t[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(t[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(t[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(t.name,`name`,`text`),origin_connection_limit:t[`origin-connection-limit`]});c(await u(`Updating`,async()=>n.hyperdrive.edit({...p,account_id:r,hyperdrive_id:t[`hyperdrive-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <hyperdrive-id>`,describe:`Returns the specified Hyperdrive configuration.`,builder:y,handler:async t=>{if(t.dryRun){l({command:`cf hyperdrive get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs/${t[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(t[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(t[`hyperdrive-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.hyperdrive.get({account_id:r,hyperdrive_id:t[`hyperdrive-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Returns a list of Hyperdrives.`,builder:x,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf hyperdrive list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.hyperdrive.list({account_id:o,...n})),{successLabel:`Loaded`})}};function C(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
14
+
15
+ Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
16
+ If not specified, defaults to 20 for free tier and 60 for paid tier.
17
+ Contact Cloudflare if you need a higher limit.
18
+ `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const w={command:`update <hyperdrive-id>`,describe:`Updates and returns the specified Hyperdrive configuration.`,builder:C,handler:async r=>{if(r.dryRun){l({command:`cf hyperdrive update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/hyperdrive/configs/${r[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(r[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(r[`hyperdrive-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({caching:{disabled:r[`caching-disabled`],max_age:r[`caching-max-age`],stale_while_revalidate:r[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(r[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(r[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(r[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(r.name,`name`,`text`),origin:{database:d(r[`origin-database`],`origin-database`,`text`),password:d(r[`origin-password`],`origin-password`,`text`),scheme:d(r[`origin-scheme`],`origin-scheme`,`text`),user:d(r[`origin-user`],`origin-user`,`text`),host:d(r[`origin-host`],`origin-host`,`text`),port:r[`origin-port`],access_client_id:d(r[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(r[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(r[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:r[`origin-connection-limit`]}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.hyperdrive.update({body:e,account_id:m,hyperdrive_id:r[`hyperdrive-id`]})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),r[`origin-database`]===void 0&&(r[`origin-database`]=await t(`origin-database`,`Set the name of your origin database.`)),r[`origin-password`]===void 0&&(r[`origin-password`]=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),r[`origin-scheme`]===void 0&&(r[`origin-scheme`]=await n(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),r[`origin-user`]===void 0&&(r[`origin-user`]=await t(`origin-user`,`Set the user of your origin database.`));let h=s({caching:{disabled:r[`caching-disabled`],max_age:r[`caching-max-age`],stale_while_revalidate:r[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:d(r[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:d(r[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:d(r[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:d(r.name,`name`,`text`),origin:{database:d(r[`origin-database`],`origin-database`,`text`),password:d(r[`origin-password`],`origin-password`,`text`),scheme:d(r[`origin-scheme`],`origin-scheme`,`text`),user:d(r[`origin-user`],`origin-user`,`text`),host:d(r[`origin-host`],`origin-host`,`text`),port:r[`origin-port`],access_client_id:d(r[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:d(r[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:d(r[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:r[`origin-connection-limit`]});c(await u(`Updating`,async()=>p.hyperdrive.update({body:h,account_id:m,hyperdrive_id:r[`hyperdrive-id`]})),{successLabel:`Updated`})}},T={command:`hyperdrive`,describe:`Accelerate access to existing databases by caching queries and pooling connections at the edge`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{T as default};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,n as i}from"./auth-ffdf9yR0.mjs";import{n as a,t as o}from"./body-parser-DKa8Ipg1.mjs";import{t as s}from"./output-BJFNwj7b.mjs";import{n as c,t as l}from"./progress-CrCGTq7N.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";import{t as f}from"./cli-types-CRIDdDw3.mjs";function p(e){return e.positional(`permission-group-id`,{type:`string`,description:`Permission Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <permission-group-id>`,describe:`Get information about a specific permission group in an account.`,builder:p,handler:async t=>{if(t.dryRun){c({command:`cf iam permission-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/permission_groups/${t[`permission-group-id`]==null?`<permission-group-id>`:encodeURIComponent(String(t[`permission-group-id`]))}`,pathParams:{"permission-group-id":String(t[`permission-group-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.iam.permissionGroups.get({account_id:a,permission_group_id:t[`permission-group-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`id`,{type:`string`,description:`ID of the permission group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the permission group to be fetched.`}).option(`label`,{type:`string`,description:`Label of the permission group to be fetched.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List all the permissions groups for an account.`,builder:h,handler:async t=>{let n={id:t.id,name:t.name,label:t.label,page:t.page,per_page:t[`per-page`]};if(t.dryRun){c({command:`cf iam permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/permission_groups`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.iam.permissionGroups.list({account_id:o,...n})),{successLabel:`Loaded`})}},_={command:`permission-groups`,describe:`View the permission groups that can be assigned to API tokens and policies`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`name`,{type:`string`,description:`Name of the resource group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`create`,describe:`Create a new Resource Group under the specified account.`,builder:v,handler:async n=>{if(n.dryRun){c({command:`cf iam resource-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/resource_groups`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({name:u(n.name,`name`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.iam.resourceGroups.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`Name of the resource group`));let m=o({name:u(n.name,`name`,`text`)});s(await l(`Creating`,async()=>f.iam.resourceGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <resource-group-id>`,describe:`Remove a resource group from an account.`,builder:b,handler:async t=>{if(t.dryRun){c({command:`cf iam resource-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/resource_groups/${t[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(t[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(t[`resource-group-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>a.iam.resourceGroups.delete({account_id:o,resource_group_id:t[`resource-group-id`]})),{successLabel:`Deleted`})}};function S(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <resource-group-id>`,describe:`Get information about a specific resource group in an account.`,builder:S,handler:async t=>{if(t.dryRun){c({command:`cf iam resource-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/resource_groups/${t[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(t[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(t[`resource-group-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.iam.resourceGroups.get({account_id:a,resource_group_id:t[`resource-group-id`]})),{successLabel:`Loaded`})}};function w(e){return e.option(`id`,{type:`string`,description:`ID of the resource group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the resource group to be fetched.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`List all the resource groups for an account.`,builder:w,handler:async t=>{let n={id:t.id,name:t.name};if(t.dryRun){c({command:`cf iam resource-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/resource_groups`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.iam.resourceGroups.list({account_id:o,...n})),{successLabel:`Loaded`})}};function E(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the resource group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`update <resource-group-id>`,describe:`Modify an existing resource group.`,builder:E,handler:async t=>{if(t.dryRun){c({command:`cf iam resource-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/resource_groups/${t[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(t[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(t[`resource-group-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({name:u(t.name,`name`,`text`)}):a(t.body)});return}let n=await i(t),f=t.local?d:await r(n);if(t.accountId=f,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.iam.resourceGroups.update({...e,account_id:f,resource_group_id:t[`resource-group-id`]})),{successLabel:`Updated`});return}let p=o({name:u(t.name,`name`,`text`)});s(await l(`Updating`,async()=>n.iam.resourceGroups.update({...p,account_id:f,resource_group_id:t[`resource-group-id`]})),{successLabel:`Updated`})}},O={command:`resource-groups`,describe:`Define scopes that limit which account resources a policy or token can access`,builder:e=>e.command(y).command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`begin-verification <sso-connector-id>`,describe:`Validates the user has added the DNS TXT record required for validating ownership of the domain they are trying to set up a connector for.`,builder:k,handler:async t=>{if(t.dryRun){c({command:`cf iam sso begin-verification`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors/${t[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(t[`sso-connector-id`]))}/begin_verification`,pathParams:{"sso-connector-id":String(t[`sso-connector-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Creating`,async()=>n.iam.sso.beginVerification({account_id:a,sso_connector_id:t[`sso-connector-id`]})),{successLabel:`Created`})}};function j(e){return e.option(`begin-verification`,{type:`boolean`,description:`Begin the verification process after creation`,default:!0}).option(`email-domain`,{type:`string`,description:`Email domain of the new SSO connector`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`create`,describe:`Creates a new SSO connector for logging into Cloudflare through an identity provider.`,builder:j,handler:async n=>{if(n.dryRun){c({command:`cf iam sso create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({begin_verification:n[`begin-verification`],email_domain:u(n[`email-domain`],`email-domain`,`text`),use_fedramp_language:n[`use-fedramp-language`]}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.iam.sso.create({...e,account_id:p})),{successLabel:`Created`});return}n[`email-domain`]===void 0&&(n[`email-domain`]=await t(`email-domain`,`Email domain of the new SSO connector`));let m=o({begin_verification:n[`begin-verification`],email_domain:u(n[`email-domain`],`email-domain`,`text`),use_fedramp_language:n[`use-fedramp-language`]});s(await l(`Creating`,async()=>f.iam.sso.create({...m,account_id:p})),{successLabel:`Created`})}};function N(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const P={command:`delete <sso-connector-id>`,describe:`Deletes an SSO connector from the account.`,builder:N,handler:async t=>{if(t.dryRun){c({command:`cf iam sso delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors/${t[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(t[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(t[`sso-connector-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}s(await l(`Deleting`,async()=>a.iam.sso.delete({account_id:o,sso_connector_id:t[`sso-connector-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <sso-connector-id>`,describe:`Retrieves details for a specific SSO connector.`,builder:F,handler:async t=>{if(t.dryRun){c({command:`cf iam sso get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors/${t[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(t[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(t[`sso-connector-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.iam.sso.get({account_id:a,sso_connector_id:t[`sso-connector-id`]})),{successLabel:`Loaded`})}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Lists all SSO connectors configured for the account.`,builder:I,handler:async t=>{if(t.dryRun){c({command:`cf iam sso list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.iam.sso.list({account_id:a})),{successLabel:`Loaded`})}};function R(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`SSO Connector enabled state`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`update <sso-connector-id>`,describe:`Updates the state or configuration of an SSO connector.`,builder:R,handler:async t=>{if(t.dryRun){c({command:`cf iam sso update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/sso_connectors/${t[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(t[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(t[`sso-connector-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({enabled:t.enabled,use_fedramp_language:t[`use-fedramp-language`]}):a(t.body)});return}let n=await i(t),u=t.local?d:await r(n);if(t.accountId=u,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.iam.sso.update({...e,account_id:u,sso_connector_id:t[`sso-connector-id`]})),{successLabel:`Updated`});return}let f=o({enabled:t.enabled,use_fedramp_language:t[`use-fedramp-language`]});s(await l(`Updating`,async()=>n.iam.sso.update({...f,account_id:u,sso_connector_id:t[`sso-connector-id`]})),{successLabel:`Updated`})}},B={command:`sso`,describe:`Configure single sign-on connectors to authenticate account members through an external identity provider`,builder:e=>e.command(A).command(M).command(P).command(ee).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`name`,{type:`string`,description:`Name of the User group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`create`,describe:`Create a new user group under the specified account.`,builder:V,handler:async n=>{if(n.dryRun){c({command:`cf iam user-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({name:u(n.name,`name`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.iam.userGroups.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`Name of the User group.`));let m=o({name:u(n.name,`name`,`text`)});s(await l(`Creating`,async()=>f.iam.userGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function U(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const W={command:`delete <user-group-id>`,describe:`Remove a user group from an account.`,builder:U,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}s(await l(`Deleting`,async()=>a.iam.userGroups.delete({account_id:o,user_group_id:t[`user-group-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <user-group-id>`,describe:`Get information about a specific user group in an account.`,builder:G,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.iam.userGroups.get({account_id:a,user_group_id:t[`user-group-id`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`id`,{type:`string`,description:`ID of the user group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the user group to be fetched.`}).option(`fuzzy-name`,{type:`string`,description:`A string used for searching for user groups containing that substring.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`The sort order of returned user groups by name (ascending or descending).`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`List all the user groups for an account.`,builder:f(q),handler:async t=>{let n={id:t.id,name:t.name,fuzzyName:t[`fuzzy-name`],page:t.page,per_page:t[`per-page`],direction:t.direction};if(t.dryRun){c({command:`cf iam user-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.list({account_id:o,...n})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const X={command:`create <user-group-id>`,describe:`Add members to a User Group.`,builder:Y,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.iam.userGroups.members.create({body:e,account_id:o,user_group_id:t[`user-group-id`]})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Z(e){return e.positional(`member-id`,{type:`string`,description:`The identifier of an existing account Member.`,demandOption:!0}).option(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Q={command:`delete <member-id>`,describe:`Remove a member from User Group`,builder:Z,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}/members/${t[`member-id`]==null?`<member-id>`:encodeURIComponent(String(t[`member-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``),"member-id":String(t[`member-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
6
+ `);return}s(await l(`Deleting`,async()=>a.iam.userGroups.members.delete({account_id:o,user_group_id:t[`user-group-id`],member_id:t[`member-id`]})),{successLabel:`Deleted`})}};function $(e){return e.option(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`fuzzy-email`,{type:`string`,description:`A string used for filtering members by partial email match.`}).option(`direction`,{type:`string`,description:`The sort order of returned user group members by email.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`list`,describe:`List all the members attached to a user group.`,builder:f($),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],fuzzyEmail:t[`fuzzy-email`],direction:t.direction};if(t.dryRun){c({command:`cf iam user-groups members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.members.list({account_id:o,user_group_id:t[`user-group-id`],...n})),{successLabel:`Loaded`})}};function ne(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Set/Replace members to a user group.`})}const re={command:`update <user-group-id>`,describe:`Replace the set of members attached to a User Group.`,builder:ne,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.iam.userGroups.members.update({body:e,account_id:o,user_group_id:t[`user-group-id`]})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ie={command:`members`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(X).command(Q).command(te).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the User group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`update <user-group-id>`,describe:`Modify an existing user group.`,builder:ae,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({name:u(t.name,`name`,`text`)}):a(t.body)});return}let n=await i(t),f=t.local?d:await r(n);if(t.accountId=f,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.iam.userGroups.update({...e,account_id:f,user_group_id:t[`user-group-id`]})),{successLabel:`Updated`});return}let p=o({name:u(t.name,`name`,`text`)});s(await l(`Updating`,async()=>n.iam.userGroups.update({...p,account_id:f,user_group_id:t[`user-group-id`]})),{successLabel:`Updated`})}},se={command:`user-groups`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(H).command(W).command(K).command(J).command(oe).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ce={command:`iam`,describe:`Identity and access management — permission groups, resource groups, user groups, and SSO connectors`,builder:e=>e.command(_).command(O).command(B).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ce as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f,t as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";import{t as h}from"./cli-types-CRIDdDw3.mjs";import{n as g,t as _}from"./raw-fetch-Dlccg0Tr.mjs";function v(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const y={command:`get <image-id>`,describe:`Download an image from CF Images. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.`,builder:v,handler:async t=>{if(t.dryRun){u({command:`cf images v1 blobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/${t[`image-id`]==null?`<image-id>`:encodeURIComponent(String(t[`image-id`]))}/blob`,pathParams:{"image-id":String(t[`image-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r;let a=await d(`Loading`,async()=>_(`/accounts/${r}/images/v1/${encodeURIComponent(String(t[`image-id`]))}/blob`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));g(t.text===!0?a.toString(`utf-8`):a)}},b={command:`blobs`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`id`,{type:`string`,description:`An optional custom unique identifier for your image.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can use used for keeping references to another system of record for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token for the access.`}).option(`url`,{type:`string`,description:`A URL to fetch an image from origin. Only needed when type is uploading from a URL.`})}const S={command:`create`,describe:`Upload an image to CF Images. Images up to 10 Megabytes can be uploaded using a single HTTP POST (multipart/form-data) request by sending an image file or passing a URL accessible to the API.`,builder:x,handler:async t=>{if(t.dryRun){u({command:`cf images v1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1`,pathParams:{},bodyKind:`multipart`,body:{body:t.body,file:t.file,creator:t.creator,id:t.id,metadata:t.metadata,"require-signed-urls":t[`require-signed-urls`],url:t.url}});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.file!==void 0||t.body!==void 0||t.creator!==void 0||t.id!==void 0||t.metadata!==void 0||t[`require-signed-urls`]!==void 0||t.url!==void 0){let e=new FormData;if(t.file){let n=p(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.creator!==void 0&&e.append(`creator`,String(f(t.creator,`creator`,`text`)??``)),t.id!==void 0&&e.append(`id`,String(f(t.id,`id`,`text`)??``)),t.metadata!==void 0){let n=typeof t.metadata==`string`?f(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}t[`require-signed-urls`]!==void 0&&e.append(`requireSignedURLs`,String(t[`require-signed-urls`])),t.url!==void 0&&e.append(`url`,String(f(t.url,`url`,`text`)??``)),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/images/v1`,{body:e})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/images/v1`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.images.v1.create({account_id:r})),{successLabel:`Created`})}};function C(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`delete <image-id>`,describe:`Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.`,builder:C,handler:async t=>{if(t.dryRun){u({command:`cf images v1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/${t[`image-id`]==null?`<image-id>`:encodeURIComponent(String(t[`image-id`]))}`,pathParams:{"image-id":String(t[`image-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}l(await d(`Deleting`,async()=>n.images.v1.delete({account_id:a,image_id:t[`image-id`]})),{successLabel:`Deleted`})}};function T(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the image can be accessed using only its UID. If set to `true`, a signed token needs to be generated with a signing key to view the image. Returns a new UID on a change. No change if not specified."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`edit <image-id>`,describe:`Update a CF Images image's metadata, creator, or access control. On access control change, all copies of the image are purged from cache.`,builder:T,handler:async t=>{if(t.dryRun){u({command:`cf images v1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/${t[`image-id`]==null?`<image-id>`:encodeURIComponent(String(t[`image-id`]))}`,pathParams:{"image-id":String(t[`image-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({creator:f(t.creator,`creator`,`text`),requireSignedURLs:t[`require-signed-urls`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.images.v1.edit({...e,account_id:r,image_id:t[`image-id`]})),{successLabel:`Updated`});return}let a=c({creator:f(t.creator,`creator`,`text`),requireSignedURLs:t[`require-signed-urls`]});l(await d(`Updating`,async()=>n.images.v1.edit({...a,account_id:r,image_id:t[`image-id`]})),{successLabel:`Updated`})}};function D(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <image-id>`,describe:`Fetch details for a CF Images image.`,builder:D,handler:async t=>{if(t.dryRun){u({command:`cf images v1 get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/${t[`image-id`]==null?`<image-id>`:encodeURIComponent(String(t[`image-id`]))}`,pathParams:{"image-id":String(t[`image-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.get({account_id:r,image_id:t[`image-id`]})),{successLabel:`Loaded`})}};function k(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const A={command:`delete <signing-key-name>`,describe:`Delete a CF Images signing key with specified name. Returns all keys available. When the last key is removed, a new default signing key will be generated.`,builder:k,handler:async t=>{if(t.dryRun){u({command:`cf images v1 keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/keys/${t[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(t[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(t[`signing-key-name`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}l(await d(`Deleting`,async()=>n.images.v1.keys.delete({account_id:a,signing_key_name:t[`signing-key-name`]})),{successLabel:`Deleted`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`List your CF Images signing keys.`,builder:j,handler:async t=>{if(t.dryRun){u({command:`cf images v1 keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/keys`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.keys.list({account_id:r})),{successLabel:`Loaded`})}};function N(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`update <signing-key-name>`,describe:`Create a new CF Images signing key with specified name. Returns all keys available.`,builder:N,handler:async t=>{if(t.dryRun){u({command:`cf images v1 keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/keys/${t[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(t[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(t[`signing-key-name`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Updating`,async()=>n.images.v1.keys.update({account_id:r,signing_key_name:t[`signing-key-name`]})),{successLabel:`Updated`})}},F={command:`keys`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(A).command(M).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`List up to 100 images with one request. Use the optional parameters below to get a specific range of images.`,builder:I,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],creator:t.creator};if(t.dryRun){u({command:`cf images v1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.images.v1.list({account_id:a,...n})),{successLabel:`Loaded`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={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:L,handler:async t=>{if(t.dryRun){u({command:`cf images v1 stats get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/stats`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.stats.get({account_id:r})),{successLabel:`Loaded`})}},z={command:`stats`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <variant-id>`,describe:`Fetch details for a single variant with properties at the top level of the result.`,builder:B,handler:async t=>{if(t.dryRun){u({command:`cf images v1 variants-flat get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants/${t[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(t[`variant-id`]))}/flat`,pathParams:{"variant-id":String(t[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.variantsFlat.get({account_id:r,variant_id:t[`variant-id`]})),{successLabel:`Loaded`})}},H={command:`variants-flat`,describe:`Images v1 variant details in flat format`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`id`,{type:`string`,description:`The id field`}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`,default:!1}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Create a CF Images variant that allows you to resize images for different use cases.`,builder:U,handler:async r=>{if(r.dryRun){u({command:`cf images v1 variants create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`json`,body:r.body===void 0?c({id:f(r.id,`id`,`text`),neverRequireSignedURLs:r[`never-require-signed-urls`],options:{fit:f(r[`options-fit`],`options-fit`,`text`),height:r[`options-height`],metadata:f(r[`options-metadata`],`options-metadata`,`text`),width:r[`options-width`]}}):s(r.body)});return}let a=await o(r),p=r.local?m:await i(a);if(r.accountId=p,r.body){let e=s(r.body);l(await d(`Creating`,async()=>a.images.v1.variants.create({body:e,account_id:p})),{successLabel:`Created`});return}if(r.id===void 0&&(r.id=await t(`id`,`The id field`)),r[`options-fit`]===void 0&&(r[`options-fit`]=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),r[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(r[`options-metadata`]===void 0&&(r[`options-metadata`]=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),r[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let h=c({id:f(r.id,`id`,`text`),neverRequireSignedURLs:r[`never-require-signed-urls`],options:{fit:f(r[`options-fit`],`options-fit`,`text`),height:r[`options-height`],metadata:f(r[`options-metadata`],`options-metadata`,`text`),width:r[`options-width`]}});l(await d(`Creating`,async()=>a.images.v1.variants.create({body:h,account_id:p})),{successLabel:`Created`})}};function G(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <variant-id>`,describe:`Delete a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:G,handler:async t=>{if(t.dryRun){u({command:`cf images v1 variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants/${t[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(t[`variant-id`]))}`,pathParams:{"variant-id":String(t[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}l(await d(`Deleting`,async()=>n.images.v1.variants.delete({account_id:a,variant_id:t[`variant-id`]})),{successLabel:`Deleted`})}};function q(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const J={command:`edit <variant-id>`,describe:`Update a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:q,handler:async t=>{if(t.dryRun){u({command:`cf images v1 variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants/${t[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(t[`variant-id`]))}`,pathParams:{"variant-id":String(t[`variant-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({neverRequireSignedURLs:t[`never-require-signed-urls`],options:{fit:f(t[`options-fit`],`options-fit`,`text`),height:t[`options-height`],metadata:f(t[`options-metadata`],`options-metadata`,`text`),width:t[`options-width`]}}):s(t.body)});return}let r=await o(t),a=t.local?m:await i(r);if(t.accountId=a,t.body){let e=s(t.body);l(await d(`Updating`,async()=>r.images.v1.variants.edit({...e,account_id:a,variant_id:t[`variant-id`]})),{successLabel:`Updated`});return}if(t[`options-fit`]===void 0&&(t[`options-fit`]=await n(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),t[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(t[`options-metadata`]===void 0&&(t[`options-metadata`]=await n(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),t[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let p=c({neverRequireSignedURLs:t[`never-require-signed-urls`],options:{fit:f(t[`options-fit`],`options-fit`,`text`),height:t[`options-height`],metadata:f(t[`options-metadata`],`options-metadata`,`text`),width:t[`options-width`]}});l(await d(`Updating`,async()=>r.images.v1.variants.edit({...p,account_id:a,variant_id:t[`variant-id`]})),{successLabel:`Updated`})}};function Y(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`get <variant-id>`,describe:`Fetch details for a CF Images variant.`,builder:Y,handler:async t=>{if(t.dryRun){u({command:`cf images v1 variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants/${t[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(t[`variant-id`]))}`,pathParams:{"variant-id":String(t[`variant-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.variants.get({account_id:r,variant_id:t[`variant-id`]})),{successLabel:`Loaded`})}};function Z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`list`,describe:`List existing CF Images variants.`,builder:Z,handler:async t=>{if(t.dryRun){u({command:`cf images v1 variants list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.images.v1.variants.list({account_id:r})),{successLabel:`Loaded`})}},$={command:`variants`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},te={command:`v1`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(S).command(w).command(E).command(O).command(ee).command(b).command(F).command(z).command($).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`expiry`,{type:`string`,description:`The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours.`}).option(`id`,{type:`string`,description:`Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a UUID.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can be used for keeping references to another system of record, for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token to be accessed.`})}const re={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:ne,handler:async t=>{if(t.dryRun){u({command:`cf images v2 direct-uploads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<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,"require-signed-urls":t[`require-signed-urls`]}});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,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[`require-signed-urls`]!==void 0){let e=new FormData;if(t.file){let n=p(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.creator!==void 0&&e.append(`creator`,String(f(t.creator,`creator`,`text`)??``)),t.expiry!==void 0&&e.append(`expiry`,String(f(t.expiry,`expiry`,`text`)??``)),t.id!==void 0&&e.append(`id`,String(f(t.id,`id`,`text`)??``)),t.metadata!==void 0){let n=typeof t.metadata==`string`?f(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}t[`require-signed-urls`]!==void 0&&e.append(`requireSignedURLs`,String(t[`require-signed-urls`])),l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/images/v2/direct_upload`,{body:e})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/images/v2/direct_upload`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.images.v2.directUploads.create({account_id:r})),{successLabel:`Created`})}},ie={command:`direct-uploads`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.option(`continuation-token`,{type:`string`,description:`Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint.`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`sort-order`,{type:`string`,description:`Sorting order by upload time`,choices:[`asc`,`desc`]}).option(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:"List up to 10000 images from CF Images, with up to 1000 results per page. Use the optional parameters below to get a specific range of images. Pagination is supported via continuation_token. **Metadata Filtering (Optional):** You can optionally filter images by custom metadata fields using the `meta.<field>[<operator>]=<value>` syntax. **Supported Operators:** - `eq` / `eq:string` / `eq:number` / `eq:boolean` - Exact match - `gt` / `gt:number` - Greater than (number only) - `gte` / `gte:number` - Greater than or equal (number only) - `lt` / `lt:number` - Less than (number only) - `lte` / `lte:number` - Less than or equal (number only) - `in` / `in:string` / `in:number` - Match any value in list (pipe-separated) **Metadata Filter Constraints:** - Maximum 5 metadata filters per request - Maximum 5 levels of nesting (e.g., `meta.first.second.third.fourth.fifth`) - Maximum 10 elements for list operators (`in`) - Supports string, number, and boolean value types - Range operators (`gt`, `gte`, `lt`, `lte`) only accept numeric values **Filter Consistency:** Filters are combined with AND logic. The system does not validate whether filter combinations are logically consistent. For example, `meta.priority[eq:number]=5&meta.priority[lte:number]=3` will return zero results because no value can satisfy both conditions simultaneously. It is the caller's responsibility to ensure filter combinations make sense. **Examples:** ``` # List all images /images/v2 # Filter by metadata [eq] /images/v2?meta.status[eq:string]=active # Filter by metadata [in] /images/v2?meta.status[in]=pending|deleted|flagged # Filter by metadata [in:number] /images/v2?meta.ratings[in:number]=4|5 # Filter by metadata range [gte:number] /images/v2?meta.priority[gte:number]=1 # Filter by bounded range /images/v2?meta.priority[gte:number]=1&meta.priority[lte:number]=5 # Filter by nested metadata /images/v2?meta.region.name[eq]=eu-west # Combine metadata filters with creator /images/v2?meta.status[eq]=active&creator=user123 # Multiple metadata filters (AND logic) /images/v2?meta.status[eq]=active&meta.priority[eq:number]=5 ```",builder:h(ae),handler:async t=>{let n={continuation_token:t[`continuation-token`],per_page:t[`per-page`],sort_order:t[`sort-order`],creator:t.creator};if(t.dryRun){u({command:`cf images v2 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/images/v2`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.images.v2.list({account_id:a,...n})),{successLabel:`Loaded`})}},se={command:`v2`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(oe).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ce={command:`images`,describe:`Store, resize, and deliver optimized images globally — variants, signing keys, and direct uploads`,builder:e=>e.command(te).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ce as default};
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{i as e,n as t,r as n,t as r}from"./src-B9cKsgsg.mjs";export{r as CliExit,t as buildCli,n as main,e as runMain};
2
+ import{i as e,n as t,r as n,t as r}from"./src-BW6vfAwE.mjs";export{r as CliExit,t as buildCli,n as main,e as runMain};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,T as t,_ as n,i as r,n as i}from"./auth-ffdf9yR0.mjs";import{n as a,t as o}from"./body-parser-DKa8Ipg1.mjs";import{t as s}from"./output-BJFNwj7b.mjs";import{n as c,t as l}from"./progress-CrCGTq7N.mjs";import{n as u,t as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{t as p}from"./cli-types-CRIDdDw3.mjs";import{n as m,t as ee}from"./raw-fetch-Dlccg0Tr.mjs";function h(e){return e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <asn>`,describe:`Gets an overview of the Autonomous System Number (ASN) and a list of subnets for it.`,builder:p(h),handler:async t=>{if(t.dryRun){c({command:`cf intel asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/asn/${t.asn==null?`<asn>`:encodeURIComponent(String(t.asn))}`,pathParams:{asn:String(t.asn??``)},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.asn.get({account_id:a,asn:t.asn})),{successLabel:`Loaded`})}};function _(e){return e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <asn>`,describe:`Get ASN Subnets.`,builder:p(_),handler:async t=>{if(t.dryRun){c({command:`cf intel asn subnets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/asn/${t.asn==null?`<asn>`:encodeURIComponent(String(t.asn))}/subnets`,pathParams:{asn:String(t.asn??``)},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.asn.subnets.get({account_id:a,asn:t.asn})),{successLabel:`Loaded`})}},y={command:`subnets`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`asn`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Lists all available issue types in Security Center, describing categories of security issues.`,builder:x,handler:async t=>{if(t.dryRun){c({command:`cf intel attack-surface-report issue-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/issue-types`,pathParams:{},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.attackSurfaceReport.issueTypes.get({account_id:a})),{successLabel:`Loaded`})}},C={command:`issue-types`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`dismissed`,{type:`boolean`,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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`class`,describe:`Retrieves Security Center issue counts aggregated by classification class.`,builder:p(w),handler:async t=>{let r={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){c({command:`cf intel attack-surface-report issues class`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/issues/class`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.attackSurfaceReport.issues.class({account_id:o,...r})),{successLabel:`Loaded`})}};function E(e){return e.positional(`issue-id`,{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)`})}const D={command:`dismiss <issue-id>`,describe:`Deprecated endpoint for archiving Security Center insights. Use the newer archive-security-center-insight endpoint instead.`,builder:E,handler:async t=>{if(t.dryRun){c({command:`cf intel attack-surface-report issues dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/${t[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(t[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(t[`issue-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({dismiss:t.dismiss}):a(t.body)});return}let r=await i(t),u=t.local?f:await n(r);if(t.accountId=u,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.intel.attackSurfaceReport.issues.dismiss({...e,account_id:u,issue_id:t[`issue-id`]})),{successLabel:`Updated`});return}let d=o({dismiss:t.dismiss});s(await l(`Updating`,async()=>r.intel.attackSurfaceReport.issues.dismiss({...d,account_id:u,issue_id:t[`issue-id`]})),{successLabel:`Updated`})}};function O(e){return e.option(`dismissed`,{type:`boolean`,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:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all Security Center issues for the account, showing active security problems requiring attention.`,builder:p(O),handler:async t=>{let r={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject,page:t.page,per_page:t[`per-page`]};if(t.dryRun){c({command:`cf intel attack-surface-report issues list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/issues`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.attackSurfaceReport.issues.list({account_id:o,...r})),{successLabel:`Loaded`})}};function A(e){return e.option(`dismissed`,{type:`boolean`,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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`severity`,describe:`Retrieves Security Center issue counts aggregated by severity level.`,builder:p(A),handler:async t=>{let r={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){c({command:`cf intel attack-surface-report issues severity`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/issues/severity`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.attackSurfaceReport.issues.severity({account_id:o,...r})),{successLabel:`Loaded`})}};function M(e){return e.option(`dismissed`,{type:`boolean`,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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`type`,describe:`Retrieves Security Center issue counts aggregated by issue type.`,builder:p(M),handler:async t=>{let r={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){c({command:`cf intel attack-surface-report issues type`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/attack-surface-report/issues/type`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.attackSurfaceReport.issues.type({account_id:o,...r})),{successLabel:`Loaded`})}},P={command:`issues`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`attack-surface-report`,describe:`Operations for attack-surface-report`,builder:e=>e.command(C).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Gets a list of all the domains that have resolved to a specific IP address.`,builder:p(I),handler:async t=>{let r={start_end_params:t[`start-end-params`],ipv4:t.ipv4,page:t.page,per_page:t[`per-page`]};if(t.dryRun){c({command:`cf intel dns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/dns`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.dns.list({account_id:o,...r})),{successLabel:`Loaded`})}},R={command:`dns`,describe:`Passive DNS data showing historical DNS resolution records for domains`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Gets historical security threat and content categories currently and previously assigned to a domain.`,builder:z,handler:async t=>{let r={domain:t.domain};if(t.dryRun){c({command:`cf intel domain-history get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/domain-history`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.domainHistory.get({account_id:o,...r})),{successLabel:`Loaded`})}},V={command:`domain-history`,describe:`Historical domain registration and categorization changes over time`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.option(`domain`,{type:`string`,description:"Accepts multiple values like `?domain=cloudflare.com&domain=example.com`."}).option(`include-ranking`,{type:`boolean`,description:"Whether to include domain ranking data in the response. Defaults to\n`false` — ranking lookups are expensive at bulk scale and most\ncallers do not need them. Set to `true` to opt in. This parameter\nreplaces the deprecated `skip_ranking` (see below)."}).option(`skip-ranking`,{type:`boolean`,description:"**Deprecated.** Previously controlled whether the ranking lookup\nwas skipped (defaulted to `false`, meaning ranking ran). The\nendpoint's default behavior is being flipped — ranking is now\nopt-in via `include_ranking=true` — and this parameter will be\nsilently ignored. Remove it from your callers and use\n`include_ranking` instead."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get`,describe:"Returns security details and statistics about multiple domains in a single request. **Behavior change — domain ranking is becoming opt-in.** This endpoint previously included domain ranking data in every response and accepted a `skip_ranking=true` query parameter to opt out. That parameter is being deprecated and ranking will no longer be returned by default. Callers that want ranking data must pass `include_ranking=true`. The `skip_ranking` parameter will be silently ignored once the change ships.",builder:H,handler:async t=>{let r={domain:t.domain,include_ranking:t[`include-ranking`],skip_ranking:t[`skip-ranking`]};if(t.dryRun){c({command:`cf intel domains bulks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/domain/bulk`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.domains.bulks.get({account_id:o,...r})),{successLabel:`Loaded`})}},W={command:`bulks`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`skip-dns`,{type:`boolean`,description:`Skip DNS resolution lookups for faster response.`}).option(`skip-ranking`,{type:`boolean`,description:"Skip the domain ranking lookup for faster responses. Defaults to\n`false` (ranking is included). Set to `true` to opt out — primarily\nused by callers like Cloudflare Radar that need to avoid a\ncircular dependency when building the domain details page.\nNote: the bulk endpoint (`/intel/domain/bulk`) uses opposite\ndefaults — see `include_ranking` there."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get`,describe:`Gets security details and statistics about a domain.`,builder:G,handler:async t=>{let r={domain:t.domain,skip_dns:t[`skip-dns`],skip_ranking:t[`skip-ranking`]};if(t.dryRun){c({command:`cf intel domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/domain`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.domains.get({account_id:o,...r})),{successLabel:`Loaded`})}},q={command:`domains`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(K).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return 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)`})}const Y={command:`create`,describe:`Creates a new custom threat indicator feed for sharing threat intelligence data.`,builder:J,handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({description:u(t.description,`description`,`text`),name:u(t.name,`name`,`text`)}):a(t.body)});return}let r=await i(t),d=t.local?f:await n(r);if(t.accountId=d,t.body){let e=a(t.body);s(await l(`Creating`,async()=>r.intel.indicatorFeeds.create({...e,account_id:d})),{successLabel:`Created`});return}let p=o({description:u(t.description,`description`,`text`),name:u(t.name,`name`,`text`)});s(await l(`Creating`,async()=>r.intel.indicatorFeeds.create({...p,account_id:d})),{successLabel:`Created`})}};function X(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`data <feed-id>`,describe:`Retrieves the raw data entries in a custom threat indicator feed.`,builder:X,handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds data`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/${t[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(t[`feed-id`]))}/data`,pathParams:{"feed-id":String(t[`feed-id`]??``)},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,m((await l(`Loading`,async()=>ee(`/accounts/${a}/intel/indicator-feeds/${encodeURIComponent(String(t[`feed-id`]))}/data`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}))).toString(`utf-8`))}};function Z(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <feed-id>`,describe:`Downloads the content of a custom threat indicator feed.`,builder:p(Z),handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/${t[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(t[`feed-id`]))}/download`,pathParams:{"feed-id":String(t[`feed-id`]??``)},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.indicatorFeeds.downloads.get({account_id:a,feed_id:t[`feed-id`]})),{successLabel:`Loaded`})}},ne={command:`downloads`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <feed-id>`,describe:`Retrieves details for a specific custom threat indicator feed.`,builder:p(re),handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/${t[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(t[`feed-id`]))}`,pathParams:{"feed-id":String(t[`feed-id`]??``)},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.indicatorFeeds.get({account_id:a,feed_id:t[`feed-id`]})),{successLabel:`Loaded`})}};function ae(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`Retrieves details for all accessible custom threat indicator feeds.`,builder:ae,handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.indicatorFeeds.list({account_id:a})),{successLabel:`Loaded`})}};function se(e){return 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)`})}const ce={command:`create`,describe:`Grants access permissions for a custom threat indicator feed to other accounts.`,builder:se,handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds permissions create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/permissions/add`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({account_tag:u(t[`account-tag`],`account-tag`,`text`),feed_id:t[`feed-id`]}):a(t.body)});return}let r=await i(t),d=t.local?f:await n(r);if(t.accountId=d,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.intel.indicatorFeeds.permissions.create({body:e,account_id:d})),{successLabel:`Updated`});return}let p=o({account_tag:u(t[`account-tag`],`account-tag`,`text`),feed_id:t[`feed-id`]});s(await l(`Updating`,async()=>r.intel.indicatorFeeds.permissions.create({body:p,account_id:d})),{successLabel:`Updated`})}};function le(e){return 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)`})}const ue={command:`delete`,describe:`Revokes access permissions for a custom threat indicator feed.`,builder:le,handler:async r=>{if(r.dryRun){c({command:`cf intel indicator-feeds permissions delete`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/permissions/remove`,pathParams:{},bodyKind:`json`,body:r.body===void 0?o({account_tag:u(r[`account-tag`],`account-tag`,`text`),feed_id:r[`feed-id`]}):a(r.body)});return}let d=await i(r),p=r.local?f:await n(d);if(r.accountId=p,!await t({force:!!r.force,message:`This operation destructively removes a permission entry.`})){process.stderr.write(`Aborted.
3
+ `);return}if(r.body){let e=a(r.body);s(await l(`Deleting`,async()=>d.intel.indicatorFeeds.permissions.delete({body:e,account_id:p})),{successLabel:`Deleted`});return}let m=o({account_tag:u(r[`account-tag`],`account-tag`,`text`),feed_id:r[`feed-id`]});s(await l(`Deleting`,async()=>d.intel.indicatorFeeds.permissions.delete({body:m,account_id:p})),{successLabel:`Deleted`})}};function de(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`list`,describe:`Lists current access permissions for custom threat indicator feeds.`,builder:de,handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds permissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/permissions/view`,pathParams:{},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.indicatorFeeds.permissions.list({account_id:a})),{successLabel:`Loaded`})}},pe={command:`permissions`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`feed-id`,{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. Either a plain STIX2/CRDF body or a gzipped one (recognised by `0x1f 0x8b` magic bytes or a `.gz` filename suffix). "})}const he={command:`update <feed-id>`,describe:"Revises the raw data entries in a custom threat indicator feed. Accepts both plain and gzipped STIX2/CRDF bodies. Gzip is detected by RFC 1952 magic bytes (`0x1f 0x8b`) and/or a `.gz` filename suffix (case-insensitive) — either signal alone is sufficient to trigger the gzip path; if the body is not valid gzip, the upload fails fast. Customers are encouraged to gzip larger uploads — the api-gateway 500 MB body cap applies to the on-the-wire (compressed) size, so gzip lets a single upload carry several GiB of decompressed STIX.",builder:p(me),handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds snapshots update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/${t[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(t[`feed-id`]))}/snapshot`,pathParams:{"feed-id":String(t[`feed-id`]??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,source:t.source}});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,t.file!==void 0||t.body!==void 0||t.source!==void 0){let e=new FormData;if(t.file){let n=d(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);t.source!==void 0&&e.append(`source`,String(u(t.source,`source`,`text`)??``)),s(await l(`Updating`,async()=>r(a,`PUT`,`/accounts/${o}/intel/indicator-feeds/${encodeURIComponent(String(t[`feed-id`]))}/snapshot`,{body:e})),{successLabel:`Updated`});return}if(t.body){let e=u(t.body,`body`,`binary`);s(await l(`Updating`,async()=>r(a,`PUT`,`/accounts/${o}/intel/indicator-feeds/${encodeURIComponent(String(t[`feed-id`]))}/snapshot`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>a.intel.indicatorFeeds.snapshots.update({account_id:o,feed_id:t[`feed-id`]})),{successLabel:`Updated`})}},ge={command:`snapshots`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _e(e){return e.positional(`feed-id`,{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)`})}const ve={command:`update <feed-id>`,describe:`Revises details for a specific custom threat indicator feed.`,builder:p(_e),handler:async t=>{if(t.dryRun){c({command:`cf intel indicator-feeds update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/indicator-feeds/${t[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(t[`feed-id`]))}`,pathParams:{"feed-id":String(t[`feed-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({description:u(t.description,`description`,`text`),is_attributable:t[`is-attributable`],is_downloadable:t[`is-downloadable`],is_public:t[`is-public`],name:u(t.name,`name`,`text`)}):a(t.body)});return}let r=await i(t),d=t.local?f:await n(r);if(t.accountId=d,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.intel.indicatorFeeds.update({...e,account_id:d,feed_id:t[`feed-id`]})),{successLabel:`Updated`});return}let p=o({description:u(t.description,`description`,`text`),is_attributable:t[`is-attributable`],is_downloadable:t[`is-downloadable`],is_public:t[`is-public`],name:u(t.name,`name`,`text`)});s(await l(`Updating`,async()=>r.intel.indicatorFeeds.update({...p,account_id:d,feed_id:t[`feed-id`]})),{successLabel:`Updated`})}},ye={command:`indicator-feeds`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(Y).command(te).command(ie).command(oe).command(ve).command(ne).command(pe).command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={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:be,handler:async t=>{if(t.dryRun){c({command:`cf intel ip-lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/ip-lists`,pathParams:{},bodyKind:`none`});return}let r=await i(t),a=t.local?f:await n(r);t.accountId=a,s(await l(`Loading`,async()=>r.intel.ipLists.get({account_id:a})),{successLabel:`Loaded`})}},xe={command:`ip-lists`,describe:`Curated IP lists used for threat detection and policy enforcement`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.option(`ipv4`,{type:`string`,description:`Ipv4`}).option(`ipv6`,{type:`string`,description:`Ipv6`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={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:Se,handler:async t=>{let r={ipv4:t.ipv4,ipv6:t.ipv6};if(t.dryRun){c({command:`cf intel ips get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/ip`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.ips.get({account_id:o,...r})),{successLabel:`Loaded`})}},we={command:`ips`,describe:`IP address intelligence — geolocation, risk assessment, and hosting provider details`,builder:e=>e.command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return 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)`})}const Ee={command:`create`,describe:"Allows you to submit requests to change a domain’s category. Requests that include category `169` (New Domains) or category `177` (Newly Seen) in any of `content_adds`, `content_removes`, `security_adds`, or `security_removes` will be rejected with a `400 Bad Request`. These categories are automatically managed and fall off 30 days after they are applied.",builder:Te,handler:async t=>{if(t.dryRun){c({command:`cf intel miscategorizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/miscategorization`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({content_adds:t[`content-adds`],content_removes:t[`content-removes`],indicator_type:u(t[`indicator-type`],`indicator-type`,`text`),ip:u(t.ip,`ip`,`text`),security_adds:t[`security-adds`],security_removes:t[`security-removes`],url:u(t.url,`url`,`text`)}):a(t.body)});return}let r=await i(t),d=t.local?f:await n(r);if(t.accountId=d,t.body){let e=a(t.body);s(await l(`Creating`,async()=>r.intel.miscategorizations.create({...e,account_id:d})),{successLabel:`Created`});return}let p=o({content_adds:t[`content-adds`],content_removes:t[`content-removes`],indicator_type:u(t[`indicator-type`],`indicator-type`,`text`),ip:u(t.ip,`ip`,`text`),security_adds:t[`security-adds`],security_removes:t[`security-removes`],url:u(t.url,`url`,`text`)});s(await l(`Creating`,async()=>r.intel.miscategorizations.create({...p,account_id:d})),{successLabel:`Created`})}},De={command:`miscategorizations`,describe:`Report and track domain miscategorization corrections`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`get`,describe:`Retrieves WHOIS registration data for a domain, including registrant and nameserver information.`,builder:Oe,handler:async t=>{let r={domain:t.domain};if(t.dryRun){c({command:`cf intel whois get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/intel/whois`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(t),o=t.local?f:await n(a);t.accountId=o,s(await l(`Loading`,async()=>a.intel.whois.get({account_id:o,...r})),{successLabel:`Loaded`})}},Ae={command:`whois`,describe:`WHOIS registration data for domains including registrant, registrar, and nameservers`,builder:e=>e.command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},je={command:`intel`,describe:`Threat intelligence lookups — IP reputation, domain info, ASN details, WHOIS, and indicator feeds`,builder:e=>e.command(b).command(F).command(R).command(V).command(q).command(ye).command(xe).command(we).command(De).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{je as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./auth-CQcAgnOy.mjs";import{t}from"./output-D7_yAFVR.mjs";import{n,t as r}from"./progress-CjcQ6ato.mjs";function i(e){return e.option(`networks`,{type:`string`,description:"Specified as `jdcloud` to list IPs used by JD Cloud data centers."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={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:i,handler:async i=>{let a={networks:i.networks};if(i.dryRun){n({command:`cf ips list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/ips`,pathParams:{},query:a,bodyKind:`none`});return}let o=await e(i);t(await r(`Loading`,async()=>o.ips.list(a)),{successLabel:`Loaded`})}},o={command:`ips`,describe:`List Cloudflare's IP ranges used for proxying traffic — useful for firewall allowlisting`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{o as default};
2
+ import{n as e}from"./auth-ffdf9yR0.mjs";import{t}from"./output-BJFNwj7b.mjs";import{n,t as r}from"./progress-CrCGTq7N.mjs";function i(e){return e.option(`networks`,{type:`string`,description:"Specified as `jdcloud` to list IPs used by JD Cloud data centers."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={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:i,handler:async i=>{let a={networks:i.networks};if(i.dryRun){n({command:`cf ips list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/ips`,pathParams:{},query:a,bodyKind:`none`});return}let o=await e(i);t(await r(`Loading`,async()=>o.ips.list(a)),{successLabel:`Loaded`})}},o={command:`ips`,describe:`List Cloudflare's IP ranges used for proxying traffic — useful for firewall allowlisting`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{o as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,T as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return 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})}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:u,handler:async n=>{if(n.dryRun){s({command:`cf keyless-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/keyless_certificates`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({bundle_method:l(n[`bundle-method`],`bundle-method`,`text`),certificate:l(n.certificate,`certificate`,`text`),host:l(n.host,`host`,`text`),name:l(n.name,`name`,`text`),port:n.port,tunnel:{private_ip:l(n[`tunnel-private-ip`],`tunnel-private-ip`,`text`),vnet_id:l(n[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)}}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.keylessCertificates.create({...e,zone_id:d})),{successLabel:`Created`});return}if(n.certificate===void 0&&(n.certificate=await e(`certificate`,`The zone's SSL certificate or SSL certificate and intermediate(s).`)),n.host===void 0&&(n.host=await e(`host`,`The keyless SSL name.`)),n.port===void 0)throw Error(`--port is required (or pass --body with this field set).`);let f=a({bundle_method:l(n[`bundle-method`],`bundle-method`,`text`),certificate:l(n.certificate,`certificate`,`text`),host:l(n.host,`host`,`text`),name:l(n.name,`name`,`text`),port:n.port,tunnel:{private_ip:l(n[`tunnel-private-ip`],`tunnel-private-ip`,`text`),vnet_id:l(n[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)}});o(await c(`Creating`,async()=>u.keylessCertificates.create({...f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`keyless-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <keyless-certificate-id>`,describe:`Removes a Keyless SSL configuration. SSL connections will no longer use the keyless server for cryptographic operations.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates/${e[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(e[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(e[`keyless-certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}o(await c(`Deleting`,async()=>i.keylessCertificates.delete({zone_id:a,keyless_certificate_id:e[`keyless-certificate-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`keyless-certificate-id`,{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.`}).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})}const h={command:`edit <keyless-certificate-id>`,describe:`This will update attributes of a Keyless SSL. Consists of one or more of the following: host,name,port.`,builder:m,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates/${e[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(e[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(e[`keyless-certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({enabled:e.enabled,host:l(e.host,`host`,`text`),name:l(e.name,`name`,`text`),port:e.port,tunnel:{private_ip:l(e[`tunnel-private-ip`],`tunnel-private-ip`,`text`),vnet_id:l(e[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)}}):i(e.body)});return}let n=await r(e),u=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=u,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.keylessCertificates.edit({...t,zone_id:u,keyless_certificate_id:e[`keyless-certificate-id`]})),{successLabel:`Updated`});return}let d=a({enabled:e.enabled,host:l(e.host,`host`,`text`),name:l(e.name,`name`,`text`),port:e.port,tunnel:{private_ip:l(e[`tunnel-private-ip`],`tunnel-private-ip`,`text`),vnet_id:l(e[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)}});o(await c(`Updating`,async()=>n.keylessCertificates.edit({...d,zone_id:u,keyless_certificate_id:e[`keyless-certificate-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`keyless-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <keyless-certificate-id>`,describe:`Get details for one Keyless SSL configuration.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates/${e[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(e[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(e[`keyless-certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.keylessCertificates.get({zone_id:i,keyless_certificate_id:e[`keyless-certificate-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List all Keyless SSL configurations for a given zone.`,builder:v,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.keylessCertificates.list({zone_id:i})),{successLabel:`Loaded`})}},b={command:`keyless-certificates`,describe:`Use your own SSL certificates without exposing private keys — keys stay on your infrastructure`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d,t as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";import{t as m}from"./cli-types-CRIDdDw3.mjs";import{n as h,t as g}from"./raw-fetch-Dlccg0Tr.mjs";function _(e){return e.positional(`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)`})}const v={command:`delete <namespace-id>`,describe:`Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let s=await a(t),d=t.local?p:await r(s);if(t.accountId=d,!await n({force:!!t.force,message:`This operation deletes the specified keys from the namespace.`})){process.stderr.write(`Aborted.
3
+ `);return}if(t.body){let e=o(t.body);if(Array.isArray(e)&&e.length>1e4){let n=Math.ceil(e.length/1e4),r=null;for(let a=0;a<e.length;a+=1e4){let o=e.slice(a,a+1e4);r=await u(`Deleting: batch ${Math.floor(a/1e4)+1}/${n}`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:o}))}c(r,{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:e})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function y(e){return e.positional(`namespace-id`,{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)`})}const b={command:`get <namespace-id>`,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:y,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk/get`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({keys:t.keys,type:d(t.type,`type`,`text`),withMetadata:t[`with-metadata`]}):o(t.body)});return}let n=await a(t),i=t.local?p:await r(n);if(t.accountId=i,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.kv.bulk.get({...e,account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Created`});return}if(t.keys===void 0)throw Error(`--keys is required (or pass --body with this field set).`);let f=s({keys:t.keys,type:d(t.type,`type`,`text`),withMetadata:t[`with-metadata`]});c(await u(`Creating`,async()=>n.kv.bulk.get({...f,account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Created`})}};function x(e){return e.positional(`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(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`update <namespace-id>`,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:x,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),s=t.local?p:await r(n);if(t.accountId=s,t.body){let e=o(t.body);if(Array.isArray(e)&&e.length>1e4){let r=Math.ceil(e.length/1e4),a=null;for(let o=0;o<e.length;o+=1e4){let c=e.slice(o,o+1e4);a=await u(`Updating: batch ${Math.floor(o/1e4)+1}/${r}`,async()=>i(n,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk`,{body:c}))}c(a,{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i(n,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk`,{body:e})),{successLabel:`Updated`});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:`bulk`,describe:`Bulk read, write, and delete operations on multiple KV key-value pairs at once`,builder:e=>e.command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`key-name`,{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})}const T={command:`delete <key-name>`,describe:"Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:w,handler:async t=>{if(t.dryRun){l({command:`cf kv keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>i.kv.keys.delete({account_id:o,namespace_id:t[`namespace-id`],key_name:t[`key-name`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-name`,{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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const D={command:`get <key-name>`,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,handler:async t=>{if(t.dryRun){l({command:`cf kv keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i;let o=await u(`Loading`,async()=>g(`/accounts/${i}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));h(t.text===!0?o.toString(`utf-8`):o)}};function O(e){return 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."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists a namespace's keys.`,builder:O,handler:async t=>{let n={limit:t.limit,prefix:t.prefix,cursor:t.cursor};if(t.dryRun){l({command:`cf kv keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/keys`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);t.accountId=o,c(await u(`Loading`,async()=>i.kv.keys.list({account_id:o,namespace_id:t[`namespace-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-name`,{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:`number`,description:`Expires the key at a certain time, measured in number of seconds since the UNIX epoch.`}).option(`expiration-ttl`,{type:`number`,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`})}const j={command:`update <key-name>`,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:A,handler:async t=>{let n={expiration:t.expiration,expiration_ttl:t[`expiration-ttl`]};if(t.dryRun){l({command:`cf kv keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},query:n,bodyKind:t.metadata===void 0?`octet-stream`:`multipart`,body:t.metadata===void 0?t.body:{body:t.body,file:t.file,metadata:t.metadata}});return}let o=await a(t),s=t.local?p:await r(o);if(t.accountId=s,t.metadata!==void 0){let e=new FormData;if(t.file){let n=f(t.file);e.append(`value`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`value`,t.body);t.metadata!==void 0&&e.append(`metadata`,String(d(t.metadata,`metadata`,`text`)??``)),c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{body:e})),{successLabel:`Updated`});return}if(t.file){let e=f(t.file);c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(t.body){let e=d(t.body,`body`,`binary`),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}${r?`?`+r:``}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},M={command:`keys`,describe:`Read, write, and delete individual key-value pairs in a KV namespace. Pass --namespace-id to scope.`,builder:e=>e.command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`key-name`,{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})}const P={command:`get <key-name>`,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:N,handler:async t=>{if(t.dryRun){l({command:`cf kv metadata get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/metadata/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i,c(await u(`Loading`,async()=>n.kv.metadata.get({account_id:i,namespace_id:t[`namespace-id`],key_name:t[`key-name`]})),{successLabel:`Loaded`})}},F={command:`metadata`,describe:`Read the metadata associated with a KV key without fetching its value`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return 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)`})}const L={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:I,handler:async n=>{if(n.dryRun){l({command:`cf kv namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({title:d(n.title,`title`,`text`)}):o(n.body)});return}let i=await a(n),f=n.local?p:await r(i);if(n.accountId=f,n.body){let e=o(n.body);c(await u(`Creating`,async()=>i.kv.namespaces.create({body:e,account_id:f})),{successLabel:`Created`});return}n.title===void 0&&(n.title=await t(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(n.title,`title`,`text`)});c(await u(`Creating`,async()=>i.kv.namespaces.create({body:m,account_id:f})),{successLabel:`Created`})}};function R(e){return e.positional(`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})}const z={command:`delete <namespace-id>`,describe:`Deletes the namespace corresponding to the given ID.`,builder:R,handler:async t=>{if(t.dryRun){l({command:`cf kv namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>i.kv.namespaces.delete({account_id:o,namespace_id:t[`namespace-id`]})),{successLabel:`Deleted`})}};function B(e){return e.positional(`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})}const V={command:`get <namespace-id>`,describe:`Get the namespace corresponding to the given ID.`,builder:B,handler:async t=>{if(t.dryRun){l({command:`cf kv namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i,c(await u(`Loading`,async()=>n.kv.namespaces.get({account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Loaded`})}};function H(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`id`,`title`]}).option(`direction`,{type:`string`,description:`Direction to order namespaces.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:`Returns the namespaces owned by an account.`,builder:m(H),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){l({command:`cf kv namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);t.accountId=o,c(await u(`Loading`,async()=>i.kv.namespaces.list({account_id:o,...n})),{successLabel:`Loaded`})}};function W(e){return e.positional(`namespace-id`,{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)`})}const G={command:`update <namespace-id>`,describe:`Modifies a namespace's title.`,builder:W,handler:async n=>{if(n.dryRun){l({command:`cf kv namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${n[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(n[`namespace-id`]))}`,pathParams:{"namespace-id":String(n[`namespace-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({title:d(n.title,`title`,`text`)}):o(n.body)});return}let i=await a(n),f=n.local?p:await r(i);if(n.accountId=f,n.body){let e=o(n.body);c(await u(`Updating`,async()=>i.kv.namespaces.update({body:e,account_id:f,namespace_id:n[`namespace-id`]})),{successLabel:`Updated`});return}n.title===void 0&&(n.title=await t(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(n.title,`title`,`text`)});c(await u(`Updating`,async()=>i.kv.namespaces.update({body:m,account_id:f,namespace_id:n[`namespace-id`]})),{successLabel:`Updated`})}},K={command:`namespaces`,describe:`KV namespaces — create, read, rename, and delete the containers that hold your key-value pairs`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`kv`,describe:`Global, low-latency key-value storage for Workers — namespaces, keys, values, and bulk operations`,builder:e=>e.command(C).command(M).command(F).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,n}from"./auth-ffdf9yR0.mjs";import{n as r,t as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return 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.`})}const u={command:`create`,describe:`Updates the current status of Leaked Credential Checks.`,builder:l,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({enabled:t.enabled}):r(t.body)});return}let c=await n(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=r(t.body);a(await s(`Creating`,async()=>c.leakedCredentialChecks.create({body:e,zone_id:l})),{successLabel:`Created`});return}let u=i({enabled:t.enabled});a(await s(`Creating`,async()=>c.leakedCredentialChecks.create({body:u,zone_id:l})),{successLabel:`Created`})}};function d(e){return 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.`})}const f={command:`create`,describe:`Create user-defined detection pattern for Leaked Credential Checks.`,builder:d,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks detections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({password:c(t.password,`password`,`text`),username:c(t.username,`username`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:e,zone_id:u})),{successLabel:`Created`});return}let d=i({password:c(t.password,`password`,`text`),username:c(t.username,`username`,`text`)});a(await s(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:d,zone_id:u})),{successLabel:`Created`})}};function p(e){return e.positional(`detection-id`,{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})}const m={command:`delete <detection-id>`,describe:`Remove user-defined detection pattern for Leaked Credential Checks.`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf leaked-credential-checks detections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/leaked-credential-checks/detections/${r[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(r[`detection-id`]))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"detection-id":String(r[`detection-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await e({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await t({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>i.leakedCredentialChecks.detections.delete({zone_id:c,detection_id:r[`detection-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`detection-id`,{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})}const g={command:`get <detection-id>`,describe:`Get user-defined detection pattern for Leaked Credential Checks.`,builder:h,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks/detections/${t[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(t[`detection-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"detection-id":String(t[`detection-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.get({zone_id:i,detection_id:t[`detection-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`List user-defined detection patterns for Leaked Credential Checks.`,builder:_,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks detections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.list({zone_id:i})),{successLabel:`Loaded`})}};function y(e){return e.positional(`detection-id`,{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.`})}const b={command:`update <detection-id>`,describe:`Update user-defined detection pattern for Leaked Credential Checks.`,builder:y,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks detections update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks/detections/${t[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(t[`detection-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"detection-id":String(t[`detection-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({password:c(t.password,`password`,`text`),username:c(t.username,`username`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:e,zone_id:u,detection_id:t[`detection-id`]})),{successLabel:`Updated`});return}let d=i({password:c(t.password,`password`,`text`),username:c(t.username,`username`,`text`)});a(await s(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:d,zone_id:u,detection_id:t[`detection-id`]})),{successLabel:`Updated`})}},x={command:`detections`,describe:`Custom detection rules that define which request fields contain usernames and passwords to check`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Retrieves the current status of Leaked Credential Checks.`,builder:S,handler:async t=>{if(t.dryRun){o({command:`cf leaked-credential-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.get({zone_id:i})),{successLabel:`Loaded`})}},w={command:`leaked-credential-checks`,describe:`Detect compromised credentials in login requests by checking against known breach databases`,builder:e=>e.command(u).command(C).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};