cf 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./output-CqGQp2r6.mjs";import{t as a}from"./dry-run-FV0pZwdg.mjs";import{t as o}from"./progress-5sHFvwez.mjs";const s={command:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/schemas`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Creating schema`,async()=>s.post(`/zones/${e.zoneId}/schema_validation/schemas`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Created schema`});return}i(await o(`Creating schema`,async()=>s.schemaValidation.schemas.create(c)),{successLabel:`Created schema`})}},c={command:`delete`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield. Operations using this schema will lose their validation rules.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/schema_validation/schemas/${r.schemaId??`<schemaId>`}`,pathParams:{zoneId:String(r.zoneId??``),schemaId:String(r.schemaId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`schema`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}i(await o(`Deleting schema`,async()=>s.schemaValidation.schemas.delete(c,r.schemaId)),{successLabel:`Deleted schema`})}},l={command:`edit`,describe:`Modifies an existing OpenAPI schema in API Shield, updating the validation rules for associated API operations.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/schemas/${e.schemaId??`<schemaId>`}`,pathParams:{zoneId:String(e.zoneId??``),schemaId:String(e.schemaId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating schema`,async()=>s.patch(`/zones/${e.zoneId}/schema_validation/schemas/${e.schemaId}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated schema`});return}i(await o(`Updating schema`,async()=>s.schemaValidation.schemas.edit(c,e.schemaId)),{successLabel:`Updated schema`})}},u={command:`get`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Shield.`,builder:e=>e.option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`,default:!1}),handler:async e=>{let r={};e.omitSource!==void 0&&(r.omit_source=e.omitSource);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading schema`,async()=>a.schemaValidation.schemas.get(s,e.schemaId,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded schema`})}},d={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading hosts`,async()=>a.schemaValidation.schemas.hosts.list(s,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded hosts`})}},f={command:`hosts`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}},p={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield with pagination support.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`,default:!1}).option(`validation-enabled`,{type:`boolean`,description:`Filter for enabled schemas`,default:!1}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage),e.omitSource!==void 0&&(r.omit_source=e.omitSource),e.validationEnabled!==void 0&&(r.validation_enabled=e.validationEnabled);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading schemas`,async()=>a.schemaValidation.schemas.list(s,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded schemas`})}},m={command:`get`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:e=>e.option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}),handler:async e=>{let r={};e.feature!==void 0&&(r.feature=e.feature),e.host!==void 0&&(r.host=e.host),e.method!==void 0&&(r.method=e.method),e.endpoint!==void 0&&(r.endpoint=e.endpoint),e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage),e.operationStatus!==void 0&&(r.operation_status=e.operationStatus);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading operation`,async()=>a.schemaValidation.schemas.operations.get(s,e.schemaId,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded operation`})}},h={command:`operations`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`schemas`,describe:`Uploaded API schemas used to validate incoming requests against expected formats`,builder:e=>e.command(s).command(c).command(l).command(u).command(p).command(f).command(h).demandCommand(1),handler:()=>{}},_={command:`edit`,describe:`Partially updates global schema validation settings for a zone using PATCH semantics.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/settings`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating setting`,async()=>s.patch(`/zones/${e.zoneId}/schema_validation/settings`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated setting`});return}i(await o(`Updating setting`,async()=>s.schemaValidation.settings.edit(c)),{successLabel:`Updated setting`})}},v={command:`get`,describe:`Retrieves the current global schema validation settings for a zone.`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading setting`,async()=>r.schemaValidation.settings.get(a)),{successLabel:`Loaded setting`})}},y={command:`bulk-edit`,describe:`Updates schema validation settings for multiple API operations in a single request. Efficient for applying consistent validation rules across endpoints.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation settings operations bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/settings/operations`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating operations`,async()=>s.patch(`/zones/${e.zoneId}/schema_validation/settings/operations`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated operations`});return}i(await o(`Updating operations`,async()=>s.schemaValidation.settings.operations.bulkEdit(c)),{successLabel:`Updated operations`})}},b={command:`delete`,describe:`Removes custom schema validation settings for a specific API operation, reverting to zone-level defaults.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf schema-validation settings operations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/schema_validation/settings/operations/${r.operationId??`<operationId>`}`,pathParams:{zoneId:String(r.zoneId??``),operationId:String(r.operationId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`operation`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}i(await o(`Deleting operation`,async()=>s.schemaValidation.settings.operations.delete(c,r.operationId)),{successLabel:`Deleted operation`})}},x={command:`get`,describe:`Retrieves the schema validation settings configured for a specific API operation.`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading operation`,async()=>r.schemaValidation.settings.operations.get(a,e.operationId)),{successLabel:`Loaded operation`})}},S={command:`list`,describe:`Lists all per-operation schema validation settings configured for the zone.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let a=await t(e),s=await n({zone:e.zone},a,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading operations`,async()=>a.schemaValidation.settings.operations.list(s,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded operations`})}},C={command:`update`,describe:`Fully updates schema validation settings for a specific API operation.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation settings operations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/settings/operations/${e.operationId??`<operationId>`}`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating operation`,async()=>s.put(`/zones/${e.zoneId}/schema_validation/settings/operations/${e.operationId}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated operation`});return}i(await o(`Updating operation`,async()=>s.schemaValidation.settings.operations.update(c,e.operationId)),{successLabel:`Updated operation`})}},w={command:`operations`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(y).command(b).command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`update`,describe:`Fully updates global schema validation settings for a zone, replacing existing configuration.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){a({command:`cf schema-validation settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/schema_validation/settings`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating setting`,async()=>s.put(`/zones/${e.zoneId}/schema_validation/settings`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated setting`});return}i(await o(`Updating setting`,async()=>s.schemaValidation.settings.update(c)),{successLabel:`Updated setting`})}},E={command:`settings`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(_).command(v).command(T).command(w).demandCommand(1),handler:()=>{}},D={command:`schema-validation`,describe:`API schema validation settings — enforce request/response schemas and configure validation behavior`,builder:e=>e.command(g).command(E).demandCommand(1),handler:()=>{}};export{D as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{t as o}from"./output-CqGQp2r6.mjs";import{t as s}from"./dry-run-FV0pZwdg.mjs";import{t as c}from"./local-OqhVQbv0.mjs";import{t as l}from"./progress-5sHFvwez.mjs";const u={command:`create`,describe:"Creates a new SCIM Group (user group) for the account. The `displayName` must not be empty and must not begin with `CF` (reserved for system groups).",builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Groups`,pathParams:{},bodyKind:`octet-stream`,body:{body:n.body,file:n.file},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);if(n.accountId=d,n.file){let{readFileSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),r=e(t(n.file));o(await l(`Creating group`,async()=>u.post(`/accounts/${d}/scim/v2/Groups`,{body:r,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created group`});return}if(n.body){let e=i(n.body,`body`,`binary`);o(await l(`Creating group`,async()=>u.post(`/accounts/${d}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created group`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},d={command:`delete <groupId>`,describe:`Deletes a SCIM Group (custom user groups only). System groups backed by Cloudflare permission groups cannot be deleted via SCIM. Returns 204 No Content on success.`,builder:e=>e.positional(`groupId`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async i=>{if(a(i.groupId,`groupId`),i.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Groups/${i.groupId??`<groupId>`}`,pathParams:{groupId:String(i.groupId??``)},bodyKind:`none`,validation:`passed`});return}let u=await r(i),d=i.local?c:await t(u);if(i.accountId=d,!await n(`group`,String(i.groupId??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}o(await l(`Deleting group`,async()=>u.scim.groups.delete(d,i.groupId)),{successLabel:`Deleted group`})}},f={command:`edit <groupId>`,describe:"Partially updates a SCIM Group via PATCH operations (RFC 7644 Section 3.5.2). Supports add, remove, and replace operations on `members`, `displayName`, and `externalId`. For system groups (prefixed `cloudflare-v1-`), only member management operations are supported.",builder:e=>e.positional(`groupId`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style 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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}),handler:async n=>{if(a(n.groupId,`groupId`),n.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Groups/${n.groupId??`<groupId>`}`,pathParams:{groupId:String(n.groupId??``)},bodyKind:`octet-stream`,body:{body:n.body,file:n.file},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);if(n.accountId=d,n.file){let{readFileSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),r=e(t(n.file));o(await l(`Updating group`,async()=>u.patch(`/accounts/${d}/scim/v2/Groups/${n.groupId}`,{body:r,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated group`});return}if(n.body){let e=i(n.body,`body`,`binary`);o(await l(`Updating group`,async()=>u.patch(`/accounts/${d}/scim/v2/Groups/${n.groupId}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated group`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},p={command:`get <groupId>`,describe:`Retrieves a single SCIM Group resource by group ID.`,builder:e=>e.positional(`groupId`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}),handler:async e=>{a(e.groupId,`groupId`);let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading group`,async()=>n.scim.groups.get(i,e.groupId)),{successLabel:`Loaded group`})}},m={command:`list`,describe:"Lists SCIM Group resources for the account. Returns both system groups (backed by Cloudflare permission groups, prefixed `cloudflare-v1-`) and custom user groups. Supports filtering by `displayName` using SCIM filter syntax.",builder:e=>e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `displayName eq "value"` is supported.'}),handler:async e=>{let n={};e.startIndex!==void 0&&(n.startIndex=e.startIndex),e.count!==void 0&&(n.count=e.count),e.filter!==void 0&&(n.filter=e.filter);let i=await r(e),a=e.local?c:await t(i);e.accountId=a,o(await l(`Loading groups`,async()=>i.scim.groups.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded groups`})}},h={command:`groups`,describe:`Groups operations`,builder:e=>e.command(u).command(d).command(f).command(p).command(m).demandCommand(1),handler:()=>{}},g={command:`get <resourceTypeId>`,describe:"Returns a single SCIM resource type by ID (RFC 7643 Section 6). Valid IDs are `User` and `Group`.",builder:e=>e.positional(`resourceTypeId`,{type:`string`,description:`The resource type identifier.`,demandOption:!0}),handler:async e=>{a(e.resourceTypeId,`resourceTypeId`);let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading resource type`,async()=>n.scim.resourceTypes.get(i,e.resourceTypeId)),{successLabel:`Loaded resource type`})}},_={command:`list`,describe:`Returns the list of SCIM resource types supported by the Cloudflare SCIM service (RFC 7643 Section 6, RFC 7644 Section 4). Clients use this to discover available resource categories (e.g. Users, Groups) and their associated schemas. Query parameters are not supported on this endpoint.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading resource types`,async()=>n.scim.resourceTypes.list(i)),{successLabel:`Loaded resource types`})}},v={command:`resource-types`,describe:`Resource Types operations`,builder:e=>e.command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`get <schemaId>`,describe:"Returns a single SCIM schema definition by schema URI ID (RFC 7643 Section 7). Valid IDs are `urn:ietf:params:scim:schemas:core:2.0:User` and `urn:ietf:params:scim:schemas:core:2.0:Group`.",builder:e=>e.positional(`schemaId`,{type:`string`,description:`The schema URI identifier.`,demandOption:!0}),handler:async e=>{a(e.schemaId,`schemaId`);let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading schema`,async()=>n.scim.schemas.get(i,e.schemaId)),{successLabel:`Loaded schema`})}},b={command:`list`,describe:`Returns the list of SCIM schemas supported by the Cloudflare SCIM service (RFC 7643 Section 7, RFC 7644 Section 4). Clients use this to introspect the attributes of each resource type. Query parameters are not supported on this endpoint.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading schemas`,async()=>n.scim.schemas.list(i)),{successLabel:`Loaded schemas`})}},x={command:`schemas`,describe:`Schemas operations`,builder:e=>e.command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`get`,describe:`Returns the SCIM 2.0 Service Provider configuration (RFC 7643 Section 5). IdPs use this endpoint to auto-configure their SCIM integration with Cloudflare, discovering which optional features (patch, bulk, filter, etc.) are supported.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading service provider config`,async()=>n.scim.serviceProviderConfig.get(i)),{successLabel:`Loaded service provider config`})}},C={command:`service-provider-config`,describe:`Service Provider Config operations`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`create`,describe:"Provisions a new account member via SCIM. The `userName` field must be a valid email address and must match the primary email in `emails`. The account must be an Enterprise account with SCIM entitlements enabled.",builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim users create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Users`,pathParams:{},bodyKind:`octet-stream`,body:{body:n.body,file:n.file},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);if(n.accountId=d,n.file){let{readFileSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),r=e(t(n.file));o(await l(`Creating user`,async()=>u.post(`/accounts/${d}/scim/v2/Users`,{body:r,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created user`});return}if(n.body){let e=i(n.body,`body`,`binary`);o(await l(`Creating user`,async()=>u.post(`/accounts/${d}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created user`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},T={command:`edit <userId>`,describe:'Partially updates a SCIM User via PATCH operations (RFC 7644 Section 3.5.2). Supports updating `userName`, `name.givenName`, `name.familyName`, and `active`. Setting `active: false` deprovisions the user (removes them from the account). For IdP compatibility, `emails[type eq "work"].value` is also accepted as an alias for `userName`.',builder:e=>e.positional(`userId`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,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`}),handler:async n=>{if(a(n.userId,`userId`),n.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim users edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Users/${n.userId??`<userId>`}`,pathParams:{userId:String(n.userId??``)},bodyKind:`octet-stream`,body:{body:n.body,file:n.file},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);if(n.accountId=d,n.file){let{readFileSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),r=e(t(n.file));o(await l(`Updating user`,async()=>u.patch(`/accounts/${d}/scim/v2/Users/${n.userId}`,{body:r,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated user`});return}if(n.body){let e=i(n.body,`body`,`binary`);o(await l(`Updating user`,async()=>u.patch(`/accounts/${d}/scim/v2/Users/${n.userId}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated user`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},E={command:`get <userId>`,describe:`Retrieves a single account member as a SCIM User resource by user tag.`,builder:e=>e.positional(`userId`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}),handler:async e=>{a(e.userId,`userId`);let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading user`,async()=>n.scim.users.get(i,e.userId)),{successLabel:`Loaded user`})}},D={command:`list`,describe:'Lists account members as SCIM User resources. Supports optional filtering by `userName` (email) using the SCIM filter syntax (e.g. `userName eq "user@example.com"`). Pagination is controlled via `startIndex` and `count` query parameters per RFC 7644 Section 3.4.2.4.',builder:e=>e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `userName eq "value"` is supported.'}),handler:async e=>{let n={};e.startIndex!==void 0&&(n.startIndex=e.startIndex),e.count!==void 0&&(n.count=e.count),e.filter!==void 0&&(n.filter=e.filter);let i=await r(e),a=e.local?c:await t(i);e.accountId=a,o(await l(`Loading users`,async()=>i.scim.users.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded users`})}},O={command:`update <userId>`,describe:"Replaces a SCIM User resource (RFC 7644 Section 3.5.1). Fully replaces the mutable attributes of the user. Supports updating `userName`, `name`, `emails`, and `active`.",builder:e=>e.positional(`userId`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,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`}),handler:async n=>{if(a(n.userId,`userId`),n.dryRun){let t=e();t&&a(t,`accountId`),s({command:`cf scim users update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/scim/v2/Users/${n.userId??`<userId>`}`,pathParams:{userId:String(n.userId??``)},bodyKind:`octet-stream`,body:{body:n.body,file:n.file},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);if(n.accountId=d,n.file){let{readFileSync:e}=await import(`node:fs`),{resolve:t}=await import(`node:path`),r=e(t(n.file));o(await l(`Updating user`,async()=>u.put(`/accounts/${d}/scim/v2/Users/${n.userId}`,{body:r,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated user`});return}if(n.body){let e=i(n.body,`body`,`binary`);o(await l(`Updating user`,async()=>u.put(`/accounts/${d}/scim/v2/Users/${n.userId}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated user`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},k={command:`users`,describe:`Users operations`,builder:e=>e.command(w).command(T).command(E).command(D).command(O).demandCommand(1),handler:()=>{}},A={command:`scim`,describe:`SCIM 2.0 provisioning — manage users, groups, and identity provider sync for your account`,builder:e=>e.command(h).command(v).command(x).command(C).command(k).demandCommand(1),handler:()=>{}};export{A as default};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`get`,describe:`Lists the number of secrets used in the account.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading quota`,async()=>t.secretsStore.quota.get(r)),{successLabel:`Loaded quota`})}},m={command:`quota`,describe:`Account quota limits for secrets stores, secrets count, and storage capacity`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}},h={command:`create <storeId>`,describe:`Creates a secret in the account`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.storeId,`storeId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf secrets-store secrets bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secrets_store/stores/${t.storeId??`<storeId>`}/secrets`,pathParams:{storeId:String(t.storeId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Creating bulk`,async()=>r.post(`/accounts/${a}/secrets_store/stores/${t.storeId}/secrets`,{body:e})),{successLabel:`Created bulk`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`delete <storeId>`,describe:`Deletes one or more secrets`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`List of secret identifier tags to delete.`}).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:`Request body for bulk deleting secrets`}),handler:async t=>{if(o(t.storeId,`storeId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf secrets-store secrets bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secrets_store/stores/${t.storeId??`<storeId>`}/secrets`,pathParams:{storeId:String(t.storeId??``)},bodyKind:`json`,body:{ids:t.ids,body:t.body},validation:`passed`});return}let a=await i(t),p=t.local?d:await n(a);if(t.accountId=p,!await r(`bulk`,String(t.storeId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=c(t.body);l(await f(`Deleting bulk`,async()=>a.delete(`/accounts/${p}/secrets_store/stores/${t.storeId}/secrets`,{body:e})),{successLabel:`Deleted bulk`});return}if(t.ids===void 0)throw Error(`--ids is required (or pass --body with this field set).`);let m={};t.ids!==void 0&&s(m,[`ids`],t.ids),l(await f(`Deleting bulk`,async()=>a.delete(`/accounts/${p}/secrets_store/stores/${t.storeId}/secrets`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted bulk`})}},_={command:`bulk`,describe:`Encrypted key-value secrets within a store. Pass --store-id to scope.`,builder:e=>e.command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`delete <secretId>`,describe:`Deletes a single secret`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store 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}),handler:async t=>{if(o(t.secretId,`secretId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf secrets-store secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secrets_store/stores/${t.storeId??`<storeId>`}/secrets/${t.secretId??`<secretId>`}`,pathParams:{storeId:String(t.storeId??``),secretId:String(t.secretId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`secret`,String(t.secretId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}l(await f(`Deleting secret`,async()=>a.secretsStore.secrets.delete(s,t.storeId,t.secretId)),{successLabel:`Deleted secret`})}},y={command:`duplicate <secretId>`,describe:`Duplicates the secret, keeping the value`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret`}).option(`name`,{type:`string`,description:`The name of the secret`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(o(r.secretId,`secretId`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf secrets-store secrets duplicate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secrets_store/stores/${r.storeId??`<storeId>`}/secrets/${r.secretId??`<secretId>`}/duplicate`,pathParams:{storeId:String(r.storeId??``),secretId:String(r.secretId??``)},bodyKind:`json`,body:{comment:r.comment,name:r.name,scopes:r.scopes,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating secret`,async()=>p.post(`/accounts/${m}/secrets_store/stores/${r.storeId}/secrets/${r.secretId}/duplicate`,{body:e})),{successLabel:`Created secret`});return}if(r.name===void 0&&(r.name=await t(`name`,`The name of the secret`)),r.scopes===void 0)throw Error(`--scopes is required (or pass --body with this field set).`);let h={};r.comment!==void 0&&s(h,[`comment`],a(r.comment,`comment`,`text`)),r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),r.scopes!==void 0&&s(h,[`scopes`],r.scopes),l(await f(`Creating secret`,async()=>p.post(`/accounts/${m}/secrets_store/stores/${r.storeId}/secrets/${r.secretId}/duplicate`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created secret`})}},b={command:`edit <secretId>`,describe:`Updates a single secret`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`value`,{type:`string`,description:`The value of the secret. Maximum 64 KiB (65,536 bytes). Note that this is 'write only' - no API response will provide this value, it is only used to create/modify secrets.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.secretId,`secretId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf secrets-store secrets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secrets_store/stores/${t.storeId??`<storeId>`}/secrets/${t.secretId??`<secretId>`}`,pathParams:{storeId:String(t.storeId??``),secretId:String(t.secretId??``)},bodyKind:`json`,body:{comment:t.comment,scopes:t.scopes,value:t.value,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating secret`,async()=>r.patch(`/accounts/${p}/secrets_store/stores/${t.storeId}/secrets/${t.secretId}`,{body:e})),{successLabel:`Updated secret`});return}let m={};t.comment!==void 0&&s(m,[`comment`],a(t.comment,`comment`,`text`)),t.scopes!==void 0&&s(m,[`scopes`],t.scopes),t.value!==void 0&&s(m,[`value`],a(t.value,`value`,`text`)),l(await f(`Updating secret`,async()=>r.patch(`/accounts/${p}/secrets_store/stores/${t.storeId}/secrets/${t.secretId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated secret`})}},x={command:`get <secretId>`,describe:`Returns details of a single secret`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}),handler:async e=>{o(e.secretId,`secretId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading secret`,async()=>t.secretsStore.secrets.get(r,e.storeId,e.secretId)),{successLabel:`Loaded secret`})}},S={command:`list`,describe:`Lists all store secrets`,builder:e=>e.option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`direction`,{type:`string`,description:`Direction to sort objects`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page`}).option(`search`,{type:`string`,description:`Search secrets using a filter string, filtering across name and comment`}).option(`order`,{type:`string`,description:`Order secrets by values in the given field`,choices:[`name`,`comment`,`created`,`modified`,`status`]}).option(`scopes`,{type:`string`,description:`Only secrets with the given scopes will be returned`}),handler:async e=>{let t={};e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.search!==void 0&&(t.search=e.search),e.order!==void 0&&(t.order=e.order),e.scopes!==void 0&&(t.scopes=e.scopes);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading secrets`,async()=>r.secretsStore.secrets.list(a,e.storeId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded secrets`})}},C={command:`secrets`,describe:`Encrypted key-value secrets within a store. Pass --store-id to scope.`,builder:e=>e.command(v).command(y).command(b).command(x).command(S).command(_).demandCommand(1),handler:()=>{}},w={command:`create`,describe:`Creates a store in the account`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the store`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf secrets-store stores create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secrets_store/stores`,pathParams:{},bodyKind:`json`,body:{name:r.name,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating store`,async()=>p.post(`/accounts/${m}/secrets_store/stores`,{body:e})),{successLabel:`Created store`});return}r.name===void 0&&(r.name=await t(`name`,`The name of the store`));let h={};r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),l(await f(`Creating store`,async()=>p.post(`/accounts/${m}/secrets_store/stores`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created store`})}},T={command:`delete <storeId>`,describe:`Deletes a single store`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store 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}),handler:async t=>{if(o(t.storeId,`storeId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf secrets-store stores delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secrets_store/stores/${t.storeId??`<storeId>`}`,pathParams:{storeId:String(t.storeId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`store`,String(t.storeId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}l(await f(`Deleting store`,async()=>a.secretsStore.stores.delete(s,t.storeId)),{successLabel:`Deleted store`})}},E={command:`list`,describe:`Lists all the stores in an account`,builder:e=>e.option(`direction`,{type:`string`,description:`Direction to sort objects`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page`}).option(`order`,{type:`string`,description:`Order secrets by values in the given field`,choices:[`name`,`comment`,`created`,`modified`,`status`]}),handler:async e=>{let t={};e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading stores`,async()=>r.secretsStore.stores.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded stores`})}},D={command:`stores`,describe:`Secret stores that hold encrypted key-value secrets accessible by Workers and services`,builder:e=>e.command(w).command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`create <accountTag>`,describe:`Creates a store in the account on behalf of the calling service. The store will be marked as managed by the authenticated service. Requires account_id in the request body.`,builder:e=>e.positional(`accountTag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the store`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a store via system API routes`}),handler:async e=>{if(o(e.accountTag,`accountTag`),e.dryRun){u({command:`cf secrets-store system-stores create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores`,pathParams:{accountTag:String(e.accountTag??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let n=await i(e);if(e.body){let t=c(e.body);l(await f(`Creating system store`,async()=>n.post(`/system/accounts/${e.accountTag}/stores`,{body:t})),{successLabel:`Created system store`});return}e.name===void 0&&(e.name=await t(`name`,`The name of the store`));let r={};e.name!==void 0&&s(r,[`name`],a(e.name,`name`,`text`)),l(await f(`Creating system store`,async()=>n.post(`/system/accounts/${e.accountTag}/stores`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created system store`})}},k={command:`delete <storeId>`,describe:`Deletes a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account 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}),handler:async e=>{if(o(e.storeId,`storeId`),e.dryRun){u({command:`cf secrets-store system-stores delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e);if(!await r(`system store`,String(e.storeId??``),{force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}l(await f(`Deleting system store`,async()=>t.secretsStore.systemStores.delete(e.accountTag,e.storeId)),{successLabel:`Deleted system store`})}},A={command:`id <storeId>`,describe:`Returns details of a single store`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}),handler:async e=>{o(e.storeId,`storeId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading by`,async()=>t.secretsStore.systemStores.get.by.id(r,e.storeId)),{successLabel:`Loaded by`})}},j={command:`by`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`v2 <storeId>`,describe:`Returns details of a single store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}),handler:async e=>{o(e.storeId,`storeId`);let t=await i(e);l(await f(`Loading get`,async()=>t.secretsStore.systemStores.get.v2(e.accountTag,e.storeId)),{successLabel:`Loaded get`})}},N={command:`get`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(M).command(j).demandCommand(1),handler:()=>{}},P={command:`list`,describe:`Lists all stores in an account that are managed by the calling service. Only returns stores where managed_by matches the authenticated service.`,builder:e=>e.option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Direction to sort objects`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page`}).option(`order`,{type:`string`,description:`Order secrets by values in the given field`,choices:[`name`,`comment`,`created`,`modified`,`status`]}),handler:async e=>{let t={};e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order);let n=await i(e);l(await f(`Loading system stores`,async()=>n.secretsStore.systemStores.list(e.accountTag,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded system stores`})}},F={command:`create <storeId>`,describe:`Creates one or more secrets in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`storeId`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account 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)`}),handler:async e=>{if(o(e.storeId,`storeId`),e.dryRun){u({command:`cf secrets-store system-stores secrets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}/secrets`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e);if(e.body){let n=c(e.body);l(await f(`Creating secret`,async()=>t.post(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets`,{body:n})),{successLabel:`Created secret`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},I={command:`id <secretId>`,describe:`Deletes a single secret from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store 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}),handler:async e=>{if(o(e.secretId,`secretId`),e.dryRun){u({command:`cf secrets-store system-stores secrets delete by id`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}/secrets/${e.secretId??`<secretId>`}`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``),secretId:String(e.secretId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e);if(!await r(`by`,String(e.secretId??``),{force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}l(await f(`Deleting by`,async()=>t.secretsStore.systemStores.secrets.delete.by.id(e.accountTag,e.storeId,e.secretId)),{successLabel:`Deleted by`})}},L={command:`by`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(I).demandCommand(1),handler:()=>{}},R={command:`bulk`,describe:`Deletes one or more secrets from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`List of secret identifier tags to delete.`}).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:`Request body for bulk deleting secrets`}),handler:async e=>{if(e.dryRun){u({command:`cf secrets-store system-stores secrets delete system bulk`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}/secrets`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``)},bodyKind:`json`,body:{ids:e.ids,body:e.body},validation:`passed`});return}let t=await i(e);if(!await r(`system`,``,{force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}if(e.body){let n=c(e.body);l(await f(`Deleting system`,async()=>t.delete(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets`,{body:n})),{successLabel:`Deleted system`});return}if(e.ids===void 0)throw Error(`--ids is required (or pass --body with this field set).`);let n={};e.ids!==void 0&&s(n,[`ids`],e.ids),l(await f(`Deleting system`,async()=>t.delete(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted system`})}},z={command:`system`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(R).demandCommand(1),handler:()=>{}},B={command:`delete`,describe:`Operations for system-stores.secrets.delete`,builder:e=>e.command(L).command(z).demandCommand(1),handler:()=>{}},V={command:`create <secretId>`,describe:`Duplicates a secret in a store managed by the calling service, keeping the value. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret`}).option(`name`,{type:`string`,description:`The name of the secret`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(o(e.secretId,`secretId`),e.dryRun){u({command:`cf secrets-store system-stores secrets duplicate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}/secrets/${e.secretId??`<secretId>`}/duplicate`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``),secretId:String(e.secretId??``)},bodyKind:`json`,body:{comment:e.comment,name:e.name,scopes:e.scopes,body:e.body},validation:`passed`});return}let n=await i(e);if(e.body){let t=c(e.body);l(await f(`Creating duplicate`,async()=>n.post(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets/${e.secretId}/duplicate`,{body:t})),{successLabel:`Created duplicate`});return}if(e.name===void 0&&(e.name=await t(`name`,`The name of the secret`)),e.scopes===void 0)throw Error(`--scopes is required (or pass --body with this field set).`);let r={};e.comment!==void 0&&s(r,[`comment`],a(e.comment,`comment`,`text`)),e.name!==void 0&&s(r,[`name`],a(e.name,`name`,`text`)),e.scopes!==void 0&&s(r,[`scopes`],e.scopes),l(await f(`Creating duplicate`,async()=>n.post(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets/${e.secretId}/duplicate`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created duplicate`})}},H={command:`duplicate`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(V).demandCommand(1),handler:()=>{}},U={command:`edit <secretId>`,describe:`Updates a single secret in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`value`,{type:`string`,description:`The value of the secret. Maximum 64 KiB (65,536 bytes). Note that this is 'write only' - no API response will provide this value, it is only used to create/modify secrets.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(o(e.secretId,`secretId`),e.dryRun){u({command:`cf secrets-store system-stores secrets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/system/accounts/${e.accountTag??`<accountTag>`}/stores/${e.storeId??`<storeId>`}/secrets/${e.secretId??`<secretId>`}`,pathParams:{accountTag:String(e.accountTag??``),storeId:String(e.storeId??``),secretId:String(e.secretId??``)},bodyKind:`json`,body:{comment:e.comment,scopes:e.scopes,value:e.value,body:e.body},validation:`passed`});return}let t=await i(e);if(e.body){let n=c(e.body);l(await f(`Updating secret`,async()=>t.patch(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets/${e.secretId}`,{body:n})),{successLabel:`Updated secret`});return}let n={};e.comment!==void 0&&s(n,[`comment`],a(e.comment,`comment`,`text`)),e.scopes!==void 0&&s(n,[`scopes`],e.scopes),e.value!==void 0&&s(n,[`value`],a(e.value,`value`,`text`)),l(await f(`Updating secret`,async()=>t.patch(`/system/accounts/${e.accountTag}/stores/${e.storeId}/secrets/${e.secretId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated secret`})}},W={command:`get <secretId>`,describe:`Returns details of a single secret from a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.positional(`secretId`,{type:`string`,description:`Secret identifier tag.`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}),handler:async e=>{o(e.secretId,`secretId`);let t=await i(e);l(await f(`Loading secret`,async()=>t.secretsStore.systemStores.secrets.get(e.accountTag,e.storeId,e.secretId)),{successLabel:`Loaded secret`})}},G={command:`list`,describe:`Lists all secrets in a store managed by the calling service. Returns 404 if the store doesn't exist or is not managed by the authenticated service.`,builder:e=>e.option(`account-tag`,{type:`string`,description:`Account tag identifier (e.g., '12a6ed19f349896cfbd6694ba3de8d31'). This is the account's external tag identifier, not the numeric account ID.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store Identifier`,demandOption:!0}).option(`direction`,{type:`string`,description:`Direction to sort objects`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page`}).option(`search`,{type:`string`,description:`Search secrets using a filter string, filtering across name and comment`}).option(`order`,{type:`string`,description:`Order secrets by values in the given field`,choices:[`name`,`comment`,`created`,`modified`,`status`]}).option(`scopes`,{type:`string`,description:`Only secrets with the given scopes will be returned`}),handler:async e=>{let t={};e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.search!==void 0&&(t.search=e.search),e.order!==void 0&&(t.order=e.order),e.scopes!==void 0&&(t.scopes=e.scopes);let n=await i(e);l(await f(`Loading secrets`,async()=>n.secretsStore.systemStores.secrets.list(e.accountTag,e.storeId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded secrets`})}},K={command:`secrets`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(F).command(U).command(W).command(G).command(B).command(H).demandCommand(1),handler:()=>{}},q={command:`system-stores`,describe:`System-level secret store management — CRUD for stores and their secrets`,builder:e=>e.command(O).command(k).command(P).command(N).command(K).demandCommand(1),handler:()=>{}},J={command:`secrets-store`,describe:`Centralized secret management — store API keys, tokens, and credentials for use across Workers and other products`,builder:e=>e.command(m).command(C).command(D).command(q).demandCommand(1),handler:()=>{}};export{J as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{r as i}from"./input-validation-BpVQi9rR.mjs";import{n as a,t as o}from"./body-parser-iA3vRFmh.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./local-OqhVQbv0.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`get`,describe:`Retrieves Security Center insight counts aggregated by classification class.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let r={};e.dismissed!==void 0&&(r.dismissed=e.dismissed),e.issueClass!==void 0&&(r.issue_class=e.issueClass),e.issueType!==void 0&&(r.issue_type=e.issueType),e.product!==void 0&&(r.product=e.product),e.severity!==void 0&&(r.severity=e.severity),e.subject!==void 0&&(r.subject=e.subject);let i=await n(e),a=e.local?l:await t(i);e.accountId=a,s(await u(`Loading class`,async()=>i.securityCenter.insights.class.get(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded class`})}},f={command:`class`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}},p={command:`dismiss <issueId>`,describe:`Archives a Security Center insight for an account, removing it from the active insights list while preserving historical data.`,builder:e=>e.positional(`issueId`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(i(r.issueId,`issueId`),r.dryRun){let t=e();t&&i(t,`accountId`),c({command:`cf security-center insights dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/security-center/insights/${r.issueId??`<issueId>`}/dismiss`,pathParams:{issueId:String(r.issueId??``)},bodyKind:`json`,body:{dismiss:r.dismiss,body:r.body},validation:`passed`});return}let d=await n(r),f=r.local?l:await t(d);if(r.accountId=f,r.body){let e=o(r.body);s(await u(`Updating insight`,async()=>d.put(`/accounts/${f}/security-center/insights/${r.issueId}/dismiss`,{body:e})),{successLabel:`Updated insight`});return}let p={};r.dismiss!==void 0&&a(p,[`dismiss`],r.dismiss),s(await u(`Updating insight`,async()=>d.put(`/accounts/${f}/security-center/insights/${r.issueId}/dismiss`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated insight`})}},m={command:`list`,describe:`Lists all Security Center insights for the account, showing security findings and recommendations.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`string`,description:`Page`}).option(`per-page`,{type:`string`,description:`Per page`}),handler:async e=>{let r={};e.dismissed!==void 0&&(r.dismissed=e.dismissed),e.issueClass!==void 0&&(r.issue_class=e.issueClass),e.issueType!==void 0&&(r.issue_type=e.issueType),e.product!==void 0&&(r.product=e.product),e.severity!==void 0&&(r.severity=e.severity),e.subject!==void 0&&(r.subject=e.subject),e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let i=await n(e),a=e.local?l:await t(i);e.accountId=a,s(await u(`Loading insights`,async()=>i.securityCenter.insights.list(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded insights`})}},h={command:`get`,describe:`Retrieves Security Center insight counts aggregated by severity level (critical, high, medium, low).`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let r={};e.dismissed!==void 0&&(r.dismissed=e.dismissed),e.issueClass!==void 0&&(r.issue_class=e.issueClass),e.issueType!==void 0&&(r.issue_type=e.issueType),e.product!==void 0&&(r.product=e.product),e.severity!==void 0&&(r.severity=e.severity),e.subject!==void 0&&(r.subject=e.subject);let i=await n(e),a=e.local?l:await t(i);e.accountId=a,s(await u(`Loading severity`,async()=>i.securityCenter.insights.severity.get(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded severity`})}},g={command:`severity`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(h).demandCommand(1),handler:()=>{}},_={command:`get`,describe:`Retrieves Security Center insight counts aggregated by insight type.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let r={};e.dismissed!==void 0&&(r.dismissed=e.dismissed),e.issueClass!==void 0&&(r.issue_class=e.issueClass),e.issueType!==void 0&&(r.issue_type=e.issueType),e.product!==void 0&&(r.product=e.product),e.severity!==void 0&&(r.severity=e.severity),e.subject!==void 0&&(r.subject=e.subject);let i=await n(e),a=e.local?l:await t(i);e.accountId=a,s(await u(`Loading type`,async()=>i.securityCenter.insights.type.get(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded type`})}},v={command:`type`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},y={command:`insights`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(p).command(m).command(f).command(g).command(v).demandCommand(1),handler:()=>{}},b={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by classification class.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let t={};e.dismissed!==void 0&&(t.dismissed=e.dismissed),e.issueClass!==void 0&&(t.issue_class=e.issueClass),e.issueType!==void 0&&(t.issue_type=e.issueType),e.product!==void 0&&(t.product=e.product),e.severity!==void 0&&(t.severity=e.severity),e.subject!==void 0&&(t.subject=e.subject);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await u(`Loading class`,async()=>i.securityCenter.zoneInsights.class.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded class`})}},x={command:`class`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}},S={command:`get <issueId>`,describe:`Returns the full context payload for an insight. This endpoint is used for insights with large payloads that are not included inline in the list response.`,builder:e=>e.positional(`issueId`,{type:`string`,description:`Issue ID`,demandOption:!0}),handler:async e=>{i(e.issueId,`issueId`);let r=await n(e),a=e.local?l:await t(r);e.accountId=a,s(await u(`Loading context`,async()=>r.securityCenter.zoneInsights.context.get(a,e.issueId)),{successLabel:`Loaded context`})}},C={command:`context`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`update <issueId>`,describe:`Archives a zone-specific Security Center insight, removing it from the active zone insights while preserving historical data.`,builder:e=>e.positional(`issueId`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(i(e.issueId,`issueId`),e.dryRun){c({command:`cf security-center zone-insights dismiss update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/security-center/insights/${e.issueId??`<issueId>`}/dismiss`,pathParams:{zoneId:String(e.zoneId??``),issueId:String(e.issueId??``)},bodyKind:`json`,body:{dismiss:e.dismiss,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=o(e.body);s(await u(`Updating dismiss`,async()=>t.put(`/zones/${e.zoneId}/security-center/insights/${e.issueId}/dismiss`,{body:n})),{successLabel:`Updated dismiss`});return}let l={};e.dismiss!==void 0&&a(l,[`dismiss`],e.dismiss),s(await u(`Updating dismiss`,async()=>t.put(`/zones/${e.zoneId}/security-center/insights/${e.issueId}/dismiss`,{body:Object.keys(l).length>0?l:void 0})),{successLabel:`Updated dismiss`})}},T={command:`dismiss`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`get`,describe:`Lists Security Center insights for a specific zone, showing zone-level security findings.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`string`,description:`Page`}).option(`per-page`,{type:`string`,description:`Per page`}),handler:async e=>{let t={};e.dismissed!==void 0&&(t.dismissed=e.dismissed),e.issueClass!==void 0&&(t.issue_class=e.issueClass),e.issueType!==void 0&&(t.issue_type=e.issueType),e.product!==void 0&&(t.product=e.product),e.severity!==void 0&&(t.severity=e.severity),e.subject!==void 0&&(t.subject=e.subject),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await u(`Loading zone insight`,async()=>i.securityCenter.zoneInsights.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded zone insight`})}},D={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by severity level.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let t={};e.dismissed!==void 0&&(t.dismissed=e.dismissed),e.issueClass!==void 0&&(t.issue_class=e.issueClass),e.issueType!==void 0&&(t.issue_type=e.issueType),e.product!==void 0&&(t.product=e.product),e.severity!==void 0&&(t.severity=e.severity),e.subject!==void 0&&(t.subject=e.subject);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await u(`Loading severity`,async()=>i.securityCenter.zoneInsights.severity.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded severity`})}},O={command:`severity`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(D).demandCommand(1),handler:()=>{}},k={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by insight type.`,builder:e=>e.option(`dismissed`,{type:`string`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}),handler:async e=>{let t={};e.dismissed!==void 0&&(t.dismissed=e.dismissed),e.issueClass!==void 0&&(t.issue_class=e.issueClass),e.issueType!==void 0&&(t.issue_type=e.issueType),e.product!==void 0&&(t.product=e.product),e.severity!==void 0&&(t.severity=e.severity),e.subject!==void 0&&(t.subject=e.subject);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await u(`Loading type`,async()=>i.securityCenter.zoneInsights.type.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded type`})}},A={command:`type`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(k).demandCommand(1),handler:()=>{}},j={command:`zone-insights`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(E).command(x).command(C).command(T).command(O).command(A).demandCommand(1),handler:()=>{}},M={command:`security-center`,describe:`Security posture dashboard — view and manage security insights, misconfigurations, and vulnerabilities`,builder:e=>e.command(y).command(j).demandCommand(1),handler:()=>{}};export{M as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{n as i,t as a}from"./body-parser-iA3vRFmh.mjs";import{t as o}from"./output-CqGQp2r6.mjs";import{t as s}from"./dry-run-FV0pZwdg.mjs";import{t as c}from"./progress-5sHFvwez.mjs";const l={command:`delete`,describe:`Removes the security.txt file configuration for a zone. The /.well-known/security.txt endpoint will no longer be served.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){s({command:`cf security-txt delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/security-center/securitytxt`,pathParams:{zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await t(r),a=await n({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=a,!await e(`security txt`,String(a??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting security txt`,async()=>i.securityTxt.delete(a)),{successLabel:`Deleted security txt`})}},u={command:`get`,describe:`Retrieves the current security.txt file configuration for a zone, used for security vulnerability reporting.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading security txt`,async()=>r.securityTxt.get(i)),{successLabel:`Loaded security txt`})}},d={command:`update`,describe:`Updates the security.txt file configuration for a zone, which provides security researchers with vulnerability reporting information.`,builder:e=>e.option(`acknowledgments`,{type:`string`,array:!0,description:`The acknowledgments field`}).option(`canonical`,{type:`string`,array:!0,description:`The canonical field`}).option(`contact`,{type:`string`,array:!0,description:`The contact field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`encryption`,{type:`string`,array:!0,description:`The encryption field`}).option(`expires`,{type:`string`,description:`The expires field`}).option(`hiring`,{type:`string`,array:!0,description:`The hiring field`}).option(`policy`,{type:`string`,array:!0,description:`The policy field`}).option(`preferred-languages`,{type:`string`,description:`The preferred_languages field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){s({command:`cf security-txt update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/security-center/securitytxt`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{acknowledgments:e.acknowledgments,canonical:e.canonical,contact:e.contact,enabled:e.enabled,encryption:e.encryption,expires:e.expires,hiring:e.hiring,policy:e.policy,preferredLanguages:e.preferredLanguages,body:e.body},validation:`passed`});return}let l=await t(e);if(e.zoneId=await n({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating security txt`,async()=>l.put(`/zones/${e.zoneId}/security-center/securitytxt`,{body:t})),{successLabel:`Updated security txt`});return}let u={};e.acknowledgments!==void 0&&i(u,[`acknowledgments`],e.acknowledgments),e.canonical!==void 0&&i(u,[`canonical`],e.canonical),e.contact!==void 0&&i(u,[`contact`],e.contact),e.enabled!==void 0&&i(u,[`enabled`],e.enabled),e.encryption!==void 0&&i(u,[`encryption`],e.encryption),e.expires!==void 0&&i(u,[`expires`],r(e.expires,`expires`,`text`)),e.hiring!==void 0&&i(u,[`hiring`],e.hiring),e.policy!==void 0&&i(u,[`policy`],e.policy),e.preferredLanguages!==void 0&&i(u,[`preferred_languages`],r(e.preferredLanguages,`preferredLanguages`,`text`)),o(await c(`Updating security txt`,async()=>l.put(`/zones/${e.zoneId}/security-center/securitytxt`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated security txt`})}},f={command:`security-txt`,describe:`Manage the /.well-known/security.txt file that tells security researchers how to report vulnerabilities`,builder:e=>e.command(l).command(u).command(d).demandCommand(1),handler:()=>{}};export{f as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e,t}from"./theme-BKCxTQTe.mjs";import{stripVTControlCharacters as n}from"node:util";function r({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const i=r();function a(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(i,``)}const o=(e=0)=>t=>`\u001B[${t+e}m`,s=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,c=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier);const u=Object.keys(l.color),d=Object.keys(l.bgColor);[...u,...d];function f(){let e=new Map;for(let[t,n]of Object.entries(l)){for(let[t,r]of Object.entries(n))l[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=l[t],e.set(r[0],r[1]);Object.defineProperty(l,t,{value:n,enumerable:!1})}return Object.defineProperty(l,`codes`,{value:e,enumerable:!1}),l.color.close=`\x1B[39m`,l.bgColor.close=`\x1B[49m`,l.color.ansi=o(),l.color.ansi256=s(),l.color.ansi16m=c(),l.bgColor.ansi=o(10),l.bgColor.ansi256=s(10),l.bgColor.ansi16m=c(10),Object.defineProperties(l,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>l.rgbToAnsi256(...l.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>l.ansi256ToAnsi(l.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>l.ansi256ToAnsi(l.hexToAnsi256(e)),enumerable:!1}}),l}const p=f();var m=class e extends Error{constructor(t){super(t),this.name=`CloudflareError`,Object.setPrototypeOf(this,e.prototype)}},h=class e extends m{status;error;request;constructor(t,n,r,i){super(t),this.name=`APIError`,this.status=n,this.error=r,this.request=i,Object.setPrototypeOf(this,e.prototype)}get codes(){return this.error&&typeof this.error==`object`&&`errors`in this.error?this.error.errors.map(e=>e.code):[]}get messages(){return this.error&&typeof this.error==`object`&&`errors`in this.error?this.error.errors.map(e=>e.message):[this.message]}},g=class e extends h{constructor(t,n=401,r,i){super(t,n,r,i),this.name=`AuthenticationError`,Object.setPrototypeOf(this,e.prototype)}},_=class e extends h{constructor(t,n=429,r,i){super(t,n,r,i),this.name=`RateLimitError`,Object.setPrototypeOf(this,e.prototype)}};const v=process.env.CLI_VERSION??`0.0.6`;function y(r){let i=e(),a=`🍊☁️ ${i.bold.hex(t.orange)(`cf`)} ${i.dim(`·`)} ${i.dim(`v${r}`)}`,o=n(a).length,s=`─`.repeat(o);return`${a}\n${i.hex(t.orange)(s)}`}let b=!1,x=!1;function S(e,t={}){if(!(b||x)){if(t.quiet||!process.stderr.isTTY){x=!0;return}process.stderr.write(`${y(e)}\n`),b=!0}}export{g as a,p as c,h as i,a as l,y as n,m as o,v as r,_ as s,S as t};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The request body is currently not used.`}),handler:async e=>{if(e.dryRun){l({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/smart_shield/cache_reserve_clear`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=s(e.body);c(await u(`Creating cache reserve clear`,async()=>t.post(`/zones/${e.zoneId}/smart_shield/cache_reserve_clear`,{body:n})),{successLabel:`Created cache reserve clear`});return}c(await u(`Creating cache reserve clear`,async()=>t.smartShield.cacheReserveClear.clear(i)),{successLabel:`Created cache reserve clear`})}},f={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading cache reserve clear`,async()=>t.smartShield.cacheReserveClear.status(i)),{successLabel:`Loaded cache reserve clear`})}},p={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(f).demandCommand(1),handler:()=>{}},m={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading smart shield`,async()=>t.smartShield.get(i)),{successLabel:`Loaded smart shield`})}},h={command:`create`,describe:`Create a new health check.`,builder:e=>e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/smart_shield/healthchecks`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating health check`,async()=>a.post(`/zones/${t.zoneId}/smart_shield/healthchecks`,{body:e})),{successLabel:`Created health check`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};t.address!==void 0&&o(d,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(d,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(d,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(d,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(d,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(d,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(d,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(d,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(d,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(d,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(d,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(d,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(d,[`interval`],t.interval),t.name!==void 0&&o(d,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(d,[`retries`],t.retries),t.suspended!==void 0&&o(d,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(d,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(d,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(d,[`timeout`],t.timeout),t.type!==void 0&&o(d,[`type`],i(t.type,`type`,`text`)),c(await u(`Creating health check`,async()=>a.post(`/zones/${t.zoneId}/smart_shield/healthchecks`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created health check`})}},g={command:`delete <healthcheckId>`,describe:`Delete a health check.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.healthcheckId,`healthcheckId`),e.dryRun){l({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/smart_shield/healthchecks/${e.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(e.healthcheckId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`health check`,String(e.healthcheckId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}if(e.body){let t=s(e.body);c(await u(`Deleting health check`,async()=>i.delete(`/zones/${e.zoneId}/smart_shield/healthchecks/${e.healthcheckId}`,{body:t})),{successLabel:`Deleted health check`});return}c(await u(`Deleting health check`,async()=>i.smartShield.healthChecks.delete(e.healthcheckId,o)),{successLabel:`Deleted health check`})}},_={command:`edit <healthcheckId>`,describe:`Patch a configured health check.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(a(t.healthcheckId,`healthcheckId`),t.dryRun){l({command:`cf smart-shield health-checks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/smart_shield/healthchecks/${t.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(t.healthcheckId??``),zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{address:t.address,checkRegions:t.checkRegions,consecutiveFails:t.consecutiveFails,consecutiveSuccesses:t.consecutiveSuccesses,description:t.description,httpConfigAllowInsecure:t.httpConfigAllowInsecure,httpConfigExpectedBody:t.httpConfigExpectedBody,httpConfigExpectedCodes:t.httpConfigExpectedCodes,httpConfigFollowRedirects:t.httpConfigFollowRedirects,httpConfigMethod:t.httpConfigMethod,httpConfigPath:t.httpConfigPath,httpConfigPort:t.httpConfigPort,interval:t.interval,name:t.name,retries:t.retries,suspended:t.suspended,tcpConfigMethod:t.tcpConfigMethod,tcpConfigPort:t.tcpConfigPort,timeout:t.timeout,type:t.type,body:t.body},validation:`passed`});return}let d=await n(t);if(t.zoneId=await r({zone:t.zone},d,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating health check`,async()=>d.patch(`/zones/${t.zoneId}/smart_shield/healthchecks/${t.healthcheckId}`,{body:e})),{successLabel:`Updated health check`});return}t.address===void 0&&(t.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),t.name===void 0&&(t.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f={};t.address!==void 0&&o(f,[`address`],i(t.address,`address`,`text`)),t.checkRegions!==void 0&&o(f,[`check_regions`],t.checkRegions),t.consecutiveFails!==void 0&&o(f,[`consecutive_fails`],t.consecutiveFails),t.consecutiveSuccesses!==void 0&&o(f,[`consecutive_successes`],t.consecutiveSuccesses),t.description!==void 0&&o(f,[`description`],i(t.description,`description`,`text`)),t.httpConfigAllowInsecure!==void 0&&o(f,[`http_config`,`allow_insecure`],t.httpConfigAllowInsecure),t.httpConfigExpectedBody!==void 0&&o(f,[`http_config`,`expected_body`],i(t.httpConfigExpectedBody,`httpConfigExpectedBody`,`text`)),t.httpConfigExpectedCodes!==void 0&&o(f,[`http_config`,`expected_codes`],t.httpConfigExpectedCodes),t.httpConfigFollowRedirects!==void 0&&o(f,[`http_config`,`follow_redirects`],t.httpConfigFollowRedirects),t.httpConfigMethod!==void 0&&o(f,[`http_config`,`method`],i(t.httpConfigMethod,`httpConfigMethod`,`text`)),t.httpConfigPath!==void 0&&o(f,[`http_config`,`path`],i(t.httpConfigPath,`httpConfigPath`,`text`)),t.httpConfigPort!==void 0&&o(f,[`http_config`,`port`],t.httpConfigPort),t.interval!==void 0&&o(f,[`interval`],t.interval),t.name!==void 0&&o(f,[`name`],i(t.name,`name`,`text`)),t.retries!==void 0&&o(f,[`retries`],t.retries),t.suspended!==void 0&&o(f,[`suspended`],t.suspended),t.tcpConfigMethod!==void 0&&o(f,[`tcp_config`,`method`],i(t.tcpConfigMethod,`tcpConfigMethod`,`text`)),t.tcpConfigPort!==void 0&&o(f,[`tcp_config`,`port`],t.tcpConfigPort),t.timeout!==void 0&&o(f,[`timeout`],t.timeout),t.type!==void 0&&o(f,[`type`],i(t.type,`type`,`text`)),c(await u(`Updating health check`,async()=>d.patch(`/zones/${t.zoneId}/smart_shield/healthchecks/${t.healthcheckId}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated health check`})}},v={command:`get <healthcheckId>`,describe:`Fetch a single configured health check.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.healthcheckId,`healthcheckId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading health check`,async()=>t.smartShield.healthChecks.get(e.healthcheckId,i)),{successLabel:`Loaded health check`})}},y={command:`list`,describe:`List configured health checks.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading health checks`,async()=>i.smartShield.healthChecks.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded health checks`})}},b={command:`update <healthcheckId>`,describe:`Update a configured health check.`,builder:e=>e.positional(`healthcheckId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`result-address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`result-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(`result-consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`result-consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`result-description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`result-http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`result-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(`result-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(`result-http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`result-http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`result-http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`result-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(`result-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(`result-name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`result-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(`result-suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`result-tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`result-tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`result-timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`result-type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`success`,{type:`boolean`,description:`Whether the API call was successful.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.healthcheckId,`healthcheckId`),e.dryRun){l({command:`cf smart-shield health-checks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/smart_shield/healthchecks/${e.healthcheckId??`<healthcheckId>`}`,pathParams:{healthcheckId:String(e.healthcheckId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{resultAddress:e.resultAddress,resultCheckRegions:e.resultCheckRegions,resultConsecutiveFails:e.resultConsecutiveFails,resultConsecutiveSuccesses:e.resultConsecutiveSuccesses,resultDescription:e.resultDescription,resultHttpConfigAllowInsecure:e.resultHttpConfigAllowInsecure,resultHttpConfigExpectedBody:e.resultHttpConfigExpectedBody,resultHttpConfigExpectedCodes:e.resultHttpConfigExpectedCodes,resultHttpConfigFollowRedirects:e.resultHttpConfigFollowRedirects,resultHttpConfigMethod:e.resultHttpConfigMethod,resultHttpConfigPath:e.resultHttpConfigPath,resultHttpConfigPort:e.resultHttpConfigPort,resultInterval:e.resultInterval,resultName:e.resultName,resultRetries:e.resultRetries,resultSuspended:e.resultSuspended,resultTcpConfigMethod:e.resultTcpConfigMethod,resultTcpConfigPort:e.resultTcpConfigPort,resultTimeout:e.resultTimeout,resultType:e.resultType,success:e.success,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating health check`,async()=>t.put(`/zones/${e.zoneId}/smart_shield/healthchecks/${e.healthcheckId}`,{body:n})),{successLabel:`Updated health check`});return}if(e.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);let d={};e.resultAddress!==void 0&&o(d,[`result`,`address`],i(e.resultAddress,`resultAddress`,`text`)),e.resultCheckRegions!==void 0&&o(d,[`result`,`check_regions`],e.resultCheckRegions),e.resultConsecutiveFails!==void 0&&o(d,[`result`,`consecutive_fails`],e.resultConsecutiveFails),e.resultConsecutiveSuccesses!==void 0&&o(d,[`result`,`consecutive_successes`],e.resultConsecutiveSuccesses),e.resultDescription!==void 0&&o(d,[`result`,`description`],i(e.resultDescription,`resultDescription`,`text`)),e.resultHttpConfigAllowInsecure!==void 0&&o(d,[`result`,`http_config`,`allow_insecure`],e.resultHttpConfigAllowInsecure),e.resultHttpConfigExpectedBody!==void 0&&o(d,[`result`,`http_config`,`expected_body`],i(e.resultHttpConfigExpectedBody,`resultHttpConfigExpectedBody`,`text`)),e.resultHttpConfigExpectedCodes!==void 0&&o(d,[`result`,`http_config`,`expected_codes`],e.resultHttpConfigExpectedCodes),e.resultHttpConfigFollowRedirects!==void 0&&o(d,[`result`,`http_config`,`follow_redirects`],e.resultHttpConfigFollowRedirects),e.resultHttpConfigMethod!==void 0&&o(d,[`result`,`http_config`,`method`],i(e.resultHttpConfigMethod,`resultHttpConfigMethod`,`text`)),e.resultHttpConfigPath!==void 0&&o(d,[`result`,`http_config`,`path`],i(e.resultHttpConfigPath,`resultHttpConfigPath`,`text`)),e.resultHttpConfigPort!==void 0&&o(d,[`result`,`http_config`,`port`],e.resultHttpConfigPort),e.resultInterval!==void 0&&o(d,[`result`,`interval`],e.resultInterval),e.resultName!==void 0&&o(d,[`result`,`name`],i(e.resultName,`resultName`,`text`)),e.resultRetries!==void 0&&o(d,[`result`,`retries`],e.resultRetries),e.resultSuspended!==void 0&&o(d,[`result`,`suspended`],e.resultSuspended),e.resultTcpConfigMethod!==void 0&&o(d,[`result`,`tcp_config`,`method`],i(e.resultTcpConfigMethod,`resultTcpConfigMethod`,`text`)),e.resultTcpConfigPort!==void 0&&o(d,[`result`,`tcp_config`,`port`],e.resultTcpConfigPort),e.resultTimeout!==void 0&&o(d,[`result`,`timeout`],e.resultTimeout),e.resultType!==void 0&&o(d,[`result`,`type`],i(e.resultType,`resultType`,`text`)),e.success!==void 0&&o(d,[`success`],e.success),c(await u(`Updating health check`,async()=>t.put(`/zones/${e.zoneId}/smart_shield/healthchecks/${e.healthcheckId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated health check`})}},x={command:`health-checks`,describe:`Health checks operations`,builder:e=>e.command(h).command(g).command(_).command(v).command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`update`,describe:`Set Smart Shield Settings.`,builder:e=>e.option(`cache-reserve-value`,{type:`string`,description:`Specifies the enablement value of Cache Reserve.`,choices:[`on`,`off`]}).option(`regional-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Regional Tiered Cache.`,choices:[`on`,`off`]}).option(`smart-routing-value`,{type:`string`,description:`Specifies the enablement value of Smart Routing.`,choices:[`on`,`off`]}).option(`smart-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Smart Tiered Cache.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The patch body for Smart Shield.`}),handler:async e=>{if(e.dryRun){l({command:`cf smart-shield update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/smart_shield`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{cacheReserveValue:e.cacheReserveValue,regionalTieredCacheValue:e.regionalTieredCacheValue,smartRoutingValue:e.smartRoutingValue,smartTieredCacheValue:e.smartTieredCacheValue,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating smart shield`,async()=>t.patch(`/zones/${e.zoneId}/smart_shield`,{body:n})),{successLabel:`Updated smart shield`});return}let a={};e.cacheReserveValue!==void 0&&o(a,[`cache_reserve`,`value`],i(e.cacheReserveValue,`cacheReserveValue`,`text`)),e.regionalTieredCacheValue!==void 0&&o(a,[`regional_tiered_cache`,`value`],i(e.regionalTieredCacheValue,`regionalTieredCacheValue`,`text`)),e.smartRoutingValue!==void 0&&o(a,[`smart_routing`,`value`],i(e.smartRoutingValue,`smartRoutingValue`,`text`)),e.smartTieredCacheValue!==void 0&&o(a,[`smart_tiered_cache`,`value`],i(e.smartTieredCacheValue,`smartTieredCacheValue`,`text`)),c(await u(`Updating smart shield`,async()=>t.patch(`/zones/${e.zoneId}/smart_shield`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Updated smart shield`})}},C={command:`smart-shield`,describe:`Smart Shield settings, health checks, and cache reserve management`,builder:e=>e.command(m).command(S).command(p).command(x).demandCommand(1),handler:()=>{}};export{C as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r,r as i}from"./input-validation-BpVQi9rR.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./progress-5sHFvwez.mjs";const c={command:`get <snippetName>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:e=>e.positional(`snippetName`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}),handler:async e=>{i(e.snippetName,`snippetName`);let r=await t(e),o=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading content`,async()=>r.snippets.content.get(o,e.snippetName)),{successLabel:`Loaded content`})}},l={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}},u={command:`delete <snippetName>`,describe:`Deletes a snippet belonging to the zone.`,builder:e=>e.positional(`snippetName`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(i(r.snippetName,`snippetName`),r.dryRun){o({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/snippets/${r.snippetName??`<snippetName>`}`,pathParams:{zoneId:String(r.zoneId??``),snippetName:String(r.snippetName??``)},bodyKind:`none`,validation:`passed`});return}let c=await t(r),l=await n({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await e(`snippet`,String(r.snippetName??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting snippet`,async()=>c.snippets.delete(l,r.snippetName)),{successLabel:`Deleted snippet`})}},d={command:`get <snippetName>`,describe:`Fetches a snippet belonging to the zone.`,builder:e=>e.positional(`snippetName`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}),handler:async e=>{i(e.snippetName,`snippetName`);let r=await t(e),o=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading snippet`,async()=>r.snippets.get(o,e.snippetName)),{successLabel:`Loaded snippet`})}},f={command:`list`,describe:`Fetches all snippets belonging to the zone.`,builder:e=>e.option(`page`,{type:`string`,description:`Specifies the current page number.`}).option(`per-page`,{type:`string`,description:`Specifies how many results to return per page.`}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage);let i=await t(e),o=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading snippets`,async()=>i.snippets.list(o,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded snippets`})}},p={command:`delete`,describe:`Deletes all snippet rules belonging to the zone.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){o({command:`cf snippets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/snippets/snippet_rules`,pathParams:{zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await t(r),c=await n({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await e(`rule`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting rule`,async()=>i.snippets.rules.delete(c)),{successLabel:`Deleted rule`})}},m={command:`list`,describe:`Fetches all snippet rules belonging to the zone.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading rules`,async()=>r.snippets.rules.list(i)),{successLabel:`Loaded rules`})}},h={command:`update`,describe:`Updates all snippet rules belonging to the zone.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet rules object.`}),handler:async e=>{if(e.dryRun){o({command:`cf snippets rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/snippets/snippet_rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await t(e),c=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);a(await s(`Updating rule`,async()=>i.put(`/zones/${e.zoneId}/snippets/snippet_rules`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated rule`});return}a(await s(`Updating rule`,async()=>i.snippets.rules.update(c)),{successLabel:`Updated rule`})}},g={command:`rules`,describe:`Rules that determine which requests trigger specific snippets based on URL patterns`,builder:e=>e.command(p).command(m).command(h).demandCommand(1),handler:()=>{}},_={command:`update <snippetName>`,describe:`Creates or updates a snippet belonging to the zone.`,builder:e=>e.positional(`snippetName`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet object.`}),handler:async e=>{if(i(e.snippetName,`snippetName`),e.dryRun){o({command:`cf snippets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/snippets/${e.snippetName??`<snippetName>`}`,pathParams:{zoneId:String(e.zoneId??``),snippetName:String(e.snippetName??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let c=await t(e);if(e.zoneId=await n({zone:e.zone},c,{quiet:e.quiet}),e.body){let t=r(e.body,`body`,`binary`);a(await s(`Updating snippet`,async()=>c.put(`/zones/${e.zoneId}/snippets/${e.snippetName}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated snippet`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},v={command:`snippets`,describe:`Lightweight JavaScript snippets that run on requests before Workers — for quick header modifications and redirects`,builder:e=>e.command(u).command(d).command(f).command(_).command(l).command(g).demandCommand(1),handler:()=>{}};export{v as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:e=>e.option(`app-id`,{type:`string`,description:`Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match.`}).option(`colo-name`,{type:`string`,description:`Co-location identifier.`}),handler:async e=>{let t={};e.appID!==void 0&&(t.appID=e.appID),e.coloName!==void 0&&(t.colo_name=e.coloName);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading current`,async()=>i.spectrum.analytics.aggregates.currents.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded current`})}},f={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}},p={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`get`,describe:`Retrieves a list of aggregate metrics grouped by time interval.`,builder:e=>e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are: Dimension | Name | Example --------------------------|---------------------------------|-------------------------- event | Connection Event | connect, progress, disconnect, originError, clientFiltered appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 coloName | Colo Name | SFO ipVersion | IP version used by the client | 4, 6.`}).option(`sort`,{type:`string`,description:"The sort order for the result set; sort fields must be included in `metrics` or `dimensions`."}).option(`until`,{type:`string`,description:`Until`}).option(`metrics`,{type:`string`,description:`One or more metrics to compute. Options are: Metric | Name | Example | Unit --------------------------|-------------------------------------|--------------------------|-------------------------- count | Count of total events | 1000 | Count bytesIngress | Sum of ingress bytes | 1000 | Sum bytesEgress | Sum of egress bytes | 1000 | Sum durationAvg | Average connection duration | 1.0 | Time in milliseconds durationMedian | Median connection duration | 1.0 | Time in milliseconds duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds.`}).option(`filters`,{type:`string`,description:`Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: Operator | Name | URL Encoded --------------------------|---------------------------------|-------------------------- == | Equals | %3D%3D != | Does not equals | !%3D \\> | Greater Than | %3E \\< | Less Than | %3C \\>= | Greater than or equal to | %3E%3D \\<= | Less than or equal to | %3C%3D`}).option(`since`,{type:`string`,description:`Since`}).option(`time-delta`,{type:`string`,description:`Used to select time series resolution.`,choices:[`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`],demandOption:!0}),handler:async e=>{let t={};e.dimensions!==void 0&&(t.dimensions=e.dimensions),e.sort!==void 0&&(t.sort=e.sort),e.until!==void 0&&(t.until=e.until),e.metrics!==void 0&&(t.metrics=e.metrics),e.filters!==void 0&&(t.filters=e.filters),e.since!==void 0&&(t.since=e.since),e.timeDelta!==void 0&&(t.time_delta=e.timeDelta);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading bytime`,async()=>i.spectrum.analytics.events.bytimes.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded bytime`})}},h={command:`bytimes`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`get`,describe:`Retrieves a list of summarised aggregate metrics over a given time period.`,builder:e=>e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are: Dimension | Name | Example --------------------------|---------------------------------|-------------------------- event | Connection Event | connect, progress, disconnect, originError, clientFiltered appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 coloName | Colo Name | SFO ipVersion | IP version used by the client | 4, 6.`}).option(`sort`,{type:`string`,description:"The sort order for the result set; sort fields must be included in `metrics` or `dimensions`."}).option(`until`,{type:`string`,description:`Until`}).option(`metrics`,{type:`string`,description:`One or more metrics to compute. Options are: Metric | Name | Example | Unit --------------------------|-------------------------------------|--------------------------|-------------------------- count | Count of total events | 1000 | Count bytesIngress | Sum of ingress bytes | 1000 | Sum bytesEgress | Sum of egress bytes | 1000 | Sum durationAvg | Average connection duration | 1.0 | Time in milliseconds durationMedian | Median connection duration | 1.0 | Time in milliseconds duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds.`}).option(`filters`,{type:`string`,description:`Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are: Operator | Name | URL Encoded --------------------------|---------------------------------|-------------------------- == | Equals | %3D%3D != | Does not equals | !%3D \\> | Greater Than | %3E \\< | Less Than | %3C \\>= | Greater than or equal to | %3E%3D \\<= | Less than or equal to | %3C%3D`}).option(`since`,{type:`string`,description:`Since`}),handler:async e=>{let t={};e.dimensions!==void 0&&(t.dimensions=e.dimensions),e.sort!==void 0&&(t.sort=e.sort),e.until!==void 0&&(t.until=e.until),e.metrics!==void 0&&(t.metrics=e.metrics),e.filters!==void 0&&(t.filters=e.filters),e.since!==void 0&&(t.since=e.since);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading summary`,async()=>i.spectrum.analytics.events.summaries.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded summary`})}},_={command:`summaries`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(g).demandCommand(1),handler:()=>{}},v={command:`events`,describe:`Operations for analytics.events`,builder:e=>e.command(h).command(_).demandCommand(1),handler:()=>{}},y={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(p).command(v).demandCommand(1),handler:()=>{}},b={command:`create`,describe:`Creates a new Spectrum application from a configuration using a name for the origin.`,builder:e=>e.option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application. Notes: Only available for TCP applications with traffic_type set to "direct".`,default:!1}).option(`dns-name`,{type:`string`,description:`The name of the DNS record associated with the application.`}).option(`dns-type`,{type:`string`,description:`The type of DNS record associated with the application.`,choices:[`CNAME`,`ADDRESS`]}).option(`edge-ips-connectivity`,{type:`string`,description:`The IP versions supported for inbound connections on Spectrum anycast IPs.`,choices:[`all`,`ipv4`,`ipv6`]}).option(`edge-ips-type`,{type:`string`,description:`The type of edge IP configuration specified. Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the connectivity you specify. Only valid with CNAME DNS names.`,choices:[`dynamic`,`static`]}).option(`edge-ips-ips`,{type:`string`,array:!0,description:`The array of customer owned IPs we broadcast via anycast for this hostname and application.`}).option(`ip-firewall`,{type:`boolean`,description:`Enables IP Access Rules for this application. Notes: Only available for TCP applications.`,default:!1}).option(`origin-direct`,{type:`string`,array:!0,description:`List of origin IP addresses. Array may contain multiple IP addresses for load balancing.`}).option(`origin-dns-name`,{type:`string`,description:`The name of the DNS record associated with the origin.`}).option(`origin-dns-ttl`,{type:`number`,description:`The TTL of our resolution of your DNS record in seconds.`}).option(`origin-dns-type`,{type:`string`,description:`The type of DNS record associated with the origin. "" is used to specify a combination of A/AAAA records.`,choices:[`A`,`AAAA`,`SRV`]}).option(`protocol`,{type:`string`,description:'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'}).option(`proxy-protocol`,{type:`string`,description:`Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol.`,choices:[`off`,`v1`,`v2`,`simple`],default:`off`}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`],default:`off`}).option(`traffic-type`,{type:`string`,description:`Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the \`protocol\`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly.`,choices:[`direct`,`http`,`https`],default:`direct`}).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(`edge-ips-connectivity`,[`edge-ips-ips`]).conflicts(`edge-ips-ips`,[`edge-ips-connectivity`]),handler:async t=>{if(t.dryRun){l({command:`cf spectrum apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/spectrum/apps`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{argoSmartRouting:t.argoSmartRouting,dnsName:t.dnsName,dnsType:t.dnsType,edgeIpsConnectivity:t.edgeIpsConnectivity,edgeIpsType:t.edgeIpsType,edgeIpsIps:t.edgeIpsIps,ipFirewall:t.ipFirewall,originDirect:t.originDirect,originDnsName:t.originDnsName,originDnsTtl:t.originDnsTtl,originDnsType:t.originDnsType,protocol:t.protocol,proxyProtocol:t.proxyProtocol,tls:t.tls,trafficType:t.trafficType,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating app`,async()=>a.post(`/zones/${t.zoneId}/spectrum/apps`,{body:e})),{successLabel:`Created app`});return}t.protocol===void 0&&(t.protocol=await e(`protocol`,'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'));let d={};t.argoSmartRouting!==void 0&&o(d,[`argo_smart_routing`],t.argoSmartRouting),t.dnsName!==void 0&&o(d,[`dns`,`name`],i(t.dnsName,`dnsName`,`text`)),t.dnsType!==void 0&&o(d,[`dns`,`type`],i(t.dnsType,`dnsType`,`text`)),t.edgeIpsConnectivity!==void 0&&o(d,[`edge_ips`,`connectivity`],i(t.edgeIpsConnectivity,`edgeIpsConnectivity`,`text`)),t.edgeIpsType!==void 0&&o(d,[`edge_ips`,`type`],i(t.edgeIpsType,`edgeIpsType`,`text`)),t.edgeIpsIps!==void 0&&o(d,[`edge_ips`,`ips`],t.edgeIpsIps),t.ipFirewall!==void 0&&o(d,[`ip_firewall`],t.ipFirewall),t.originDirect!==void 0&&o(d,[`origin_direct`],t.originDirect),t.originDnsName!==void 0&&o(d,[`origin_dns`,`name`],i(t.originDnsName,`originDnsName`,`text`)),t.originDnsTtl!==void 0&&o(d,[`origin_dns`,`ttl`],t.originDnsTtl),t.originDnsType!==void 0&&o(d,[`origin_dns`,`type`],i(t.originDnsType,`originDnsType`,`text`)),t.protocol!==void 0&&o(d,[`protocol`],i(t.protocol,`protocol`,`text`)),t.proxyProtocol!==void 0&&o(d,[`proxy_protocol`],i(t.proxyProtocol,`proxyProtocol`,`text`)),t.tls!==void 0&&o(d,[`tls`],i(t.tls,`tls`,`text`)),t.trafficType!==void 0&&o(d,[`traffic_type`],i(t.trafficType,`trafficType`,`text`)),c(await u(`Creating app`,async()=>a.post(`/zones/${t.zoneId}/spectrum/apps`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created app`})}},x={command:`delete <appId>`,describe:`Deletes a previously existing application.`,builder:e=>e.positional(`appId`,{type:`string`,description:`App 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}),handler:async e=>{if(a(e.appId,`appId`),e.dryRun){l({command:`cf spectrum apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/spectrum/apps/${e.appId??`<appId>`}`,pathParams:{appId:String(e.appId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`app`,String(e.appId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting app`,async()=>i.spectrum.apps.delete(e.appId,o)),{successLabel:`Deleted app`})}},S={command:`get <appId>`,describe:`Gets the application configuration of a specific application inside a zone.`,builder:e=>e.positional(`appId`,{type:`string`,description:`App ID`,demandOption:!0}),handler:async e=>{a(e.appId,`appId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading app`,async()=>t.spectrum.apps.get(e.appId,i)),{successLabel:`Loaded app`})}},C={command:`list`,describe:`Retrieves a list of currently existing Spectrum applications inside a zone.`,builder:e=>e.option(`page`,{type:`number`,description:"Page number of paginated results. This parameter is required in order to use other pagination parameters. If included in the query, `result_info` will be present in the response."}).option(`per-page`,{type:`number`,description:`Sets the maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Sets the direction by which results are ordered.`,choices:[`asc`,`desc`]}).option(`order`,{type:`string`,description:`Application field by which results are ordered.`,choices:[`protocol`,`app_id`,`created_on`,`modified_on`,`dns`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.direction!==void 0&&(t.direction=e.direction),e.order!==void 0&&(t.order=e.order);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading apps`,async()=>i.spectrum.apps.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded apps`})}},w={command:`update <appId>`,describe:`Updates a previously existing application's configuration that uses a name for the origin.`,builder:e=>e.positional(`appId`,{type:`string`,description:`App ID`,demandOption:!0}).option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application. Notes: Only available for TCP applications with traffic_type set to "direct".`,default:!1}).option(`dns-name`,{type:`string`,description:`The name of the DNS record associated with the application.`}).option(`dns-type`,{type:`string`,description:`The type of DNS record associated with the application.`,choices:[`CNAME`,`ADDRESS`]}).option(`edge-ips-connectivity`,{type:`string`,description:`The IP versions supported for inbound connections on Spectrum anycast IPs.`,choices:[`all`,`ipv4`,`ipv6`]}).option(`edge-ips-type`,{type:`string`,description:`The type of edge IP configuration specified. Dynamically allocated edge IPs use Spectrum anycast IPs in accordance with the connectivity you specify. Only valid with CNAME DNS names.`,choices:[`dynamic`,`static`]}).option(`edge-ips-ips`,{type:`string`,array:!0,description:`The array of customer owned IPs we broadcast via anycast for this hostname and application.`}).option(`ip-firewall`,{type:`boolean`,description:`Enables IP Access Rules for this application. Notes: Only available for TCP applications.`,default:!1}).option(`origin-direct`,{type:`string`,array:!0,description:`List of origin IP addresses. Array may contain multiple IP addresses for load balancing.`}).option(`origin-dns-name`,{type:`string`,description:`The name of the DNS record associated with the origin.`}).option(`origin-dns-ttl`,{type:`number`,description:`The TTL of our resolution of your DNS record in seconds.`}).option(`origin-dns-type`,{type:`string`,description:`The type of DNS record associated with the origin. "" is used to specify a combination of A/AAAA records.`,choices:[`A`,`AAAA`,`SRV`]}).option(`protocol`,{type:`string`,description:'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'}).option(`proxy-protocol`,{type:`string`,description:`Enables Proxy Protocol to the origin. Refer to [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple Proxy Protocol.`,choices:[`off`,`v1`,`v2`,`simple`],default:`off`}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`],default:`off`}).option(`traffic-type`,{type:`string`,description:`Determines how data travels from the edge to your origin. When set to "direct", Spectrum will send traffic directly to your origin, and the application's type is derived from the \`protocol\`. When set to "http" or "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and the application type matches this property exactly.`,choices:[`direct`,`http`,`https`],default:`direct`}).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(`edge-ips-connectivity`,[`edge-ips-ips`]).conflicts(`edge-ips-ips`,[`edge-ips-connectivity`]),handler:async t=>{if(a(t.appId,`appId`),t.dryRun){l({command:`cf spectrum apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/spectrum/apps/${t.appId??`<appId>`}`,pathParams:{appId:String(t.appId??``),zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{argoSmartRouting:t.argoSmartRouting,dnsName:t.dnsName,dnsType:t.dnsType,edgeIpsConnectivity:t.edgeIpsConnectivity,edgeIpsType:t.edgeIpsType,edgeIpsIps:t.edgeIpsIps,ipFirewall:t.ipFirewall,originDirect:t.originDirect,originDnsName:t.originDnsName,originDnsTtl:t.originDnsTtl,originDnsType:t.originDnsType,protocol:t.protocol,proxyProtocol:t.proxyProtocol,tls:t.tls,trafficType:t.trafficType,body:t.body},validation:`passed`});return}let d=await n(t);if(t.zoneId=await r({zone:t.zone},d,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating app`,async()=>d.put(`/zones/${t.zoneId}/spectrum/apps/${t.appId}`,{body:e})),{successLabel:`Updated app`});return}t.protocol===void 0&&(t.protocol=await e(`protocol`,'The port configuration at Cloudflare\'s edge. May specify a single port, for example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`.'));let f={};t.argoSmartRouting!==void 0&&o(f,[`argo_smart_routing`],t.argoSmartRouting),t.dnsName!==void 0&&o(f,[`dns`,`name`],i(t.dnsName,`dnsName`,`text`)),t.dnsType!==void 0&&o(f,[`dns`,`type`],i(t.dnsType,`dnsType`,`text`)),t.edgeIpsConnectivity!==void 0&&o(f,[`edge_ips`,`connectivity`],i(t.edgeIpsConnectivity,`edgeIpsConnectivity`,`text`)),t.edgeIpsType!==void 0&&o(f,[`edge_ips`,`type`],i(t.edgeIpsType,`edgeIpsType`,`text`)),t.edgeIpsIps!==void 0&&o(f,[`edge_ips`,`ips`],t.edgeIpsIps),t.ipFirewall!==void 0&&o(f,[`ip_firewall`],t.ipFirewall),t.originDirect!==void 0&&o(f,[`origin_direct`],t.originDirect),t.originDnsName!==void 0&&o(f,[`origin_dns`,`name`],i(t.originDnsName,`originDnsName`,`text`)),t.originDnsTtl!==void 0&&o(f,[`origin_dns`,`ttl`],t.originDnsTtl),t.originDnsType!==void 0&&o(f,[`origin_dns`,`type`],i(t.originDnsType,`originDnsType`,`text`)),t.protocol!==void 0&&o(f,[`protocol`],i(t.protocol,`protocol`,`text`)),t.proxyProtocol!==void 0&&o(f,[`proxy_protocol`],i(t.proxyProtocol,`proxyProtocol`,`text`)),t.tls!==void 0&&o(f,[`tls`],i(t.tls,`tls`,`text`)),t.trafficType!==void 0&&o(f,[`traffic_type`],i(t.trafficType,`trafficType`,`text`)),c(await u(`Updating app`,async()=>d.put(`/zones/${t.zoneId}/spectrum/apps/${t.appId}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated app`})}},T={command:`apps`,describe:`Spectrum application configurations that map protocols and ports to origin servers`,builder:e=>e.command(b).command(x).command(S).command(C).command(w).demandCommand(1),handler:()=>{}},E={command:`spectrum`,describe:`Proxy and protect arbitrary TCP/UDP applications through Cloudflare's network with DDoS mitigation`,builder:e=>e.command(y).command(T).demandCommand(1),handler:()=>{}};export{E as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./body-parser-iA3vRFmh.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./progress-5sHFvwez.mjs";const c={command:`list`,describe:`Retrieves quota for all plans, as well as the current zone quota.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading availabilities`,async()=>r.speed.availabilities.list(i)),{successLabel:`Loaded availabilities`})}},l={command:`availabilities`,describe:`Check which speed test regions and configurations are available for your zone`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}},u={command:`list`,describe:`Lists all webpages which have been tested.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading pages`,async()=>r.speed.pages.list(i)),{successLabel:`Loaded pages`})}},d={command:`create <url>`,describe:`Starts a test for a specific webpage, in a specific region.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(r(e.url,`url`),e.dryRun){o({command:`cf speed pages tests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/speed_api/pages/${e.url??`<url>`}/tests`,pathParams:{zoneId:String(e.zoneId??``),url:String(e.url??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let c=await t(e),l=await n({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);a(await s(`Creating test`,async()=>c.post(`/zones/${e.zoneId}/speed_api/pages/${e.url}/tests`,{body:t})),{successLabel:`Created test`});return}a(await s(`Creating test`,async()=>c.speed.pages.tests.create(l,e.url)),{successLabel:`Created test`})}},f={command:`delete <url>`,describe:`Deletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async i=>{r(i.url,`url`);let c={};if(i.region!==void 0&&(c.region=i.region),i.dryRun){o({command:`cf speed pages tests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${i.zoneId??`<zoneId>`}/speed_api/pages/${i.url??`<url>`}/tests`,pathParams:{zoneId:String(i.zoneId??``),url:String(i.url??``)},bodyKind:`json`,body:{...c},validation:`passed`});return}let l=await t(i),u=await n({zone:i.zone},l,{quiet:i.quiet});if(i.zoneId=u,!await e(`test`,String(i.url??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting test`,async()=>l.speed.pages.tests.delete(u,i.url,Object.keys(c).length>0?c:void 0)),{successLabel:`Deleted test`})}},p={command:`get <testId>`,describe:`Retrieves the result of a specific test.`,builder:e=>e.positional(`testId`,{type:`string`,description:`Test ID`,demandOption:!0}).option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}),handler:async e=>{r(e.testId,`testId`);let i=await t(e),o=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading test`,async()=>i.speed.pages.tests.get(o,e.url,e.testId)),{successLabel:`Loaded test`})}},m={command:`list`,describe:`Test history (list of tests) for a specific webpage.`,builder:e=>e.option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`region`,{type:`string`,description:`Region`}),handler:async e=>{let r={};e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage),e.region!==void 0&&(r.region=e.region);let i=await t(e),o=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o,a(await s(`Loading tests`,async()=>i.speed.pages.tests.list(o,e.url,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded tests`})}},h={command:`tests`,describe:`Tested pages with their performance history, trends, and individual test results`,builder:e=>e.command(d).command(f).command(p).command(m).demandCommand(1),handler:()=>{}},g={command:`trend <url>`,describe:`Lists the core web vital metrics trend over time for a specific page.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`],demandOption:!0}).option(`device-type`,{type:`string`,description:`The type of device.`,choices:[`DESKTOP`,`MOBILE`],demandOption:!0}).option(`start`,{type:`string`,description:`Start`,demandOption:!0}).option(`end`,{type:`string`,description:`End`}).option(`tz`,{type:`string`,description:`The timezone of the start and end timestamps.`,demandOption:!0}).option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to include in the results.`,demandOption:!0}),handler:async e=>{r(e.url,`url`);let i={};e.region!==void 0&&(i.region=e.region),e.deviceType!==void 0&&(i.deviceType=e.deviceType),e.start!==void 0&&(i.start=e.start),e.end!==void 0&&(i.end=e.end),e.tz!==void 0&&(i.tz=e.tz),e.metrics!==void 0&&(i.metrics=e.metrics);let o=await t(e),c=await n({zone:e.zone},o,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading page`,async()=>o.speed.pages.trend(c,e.url,Object.keys(i).length>0?i:void 0)),{successLabel:`Loaded page`})}},_={command:`pages`,describe:`Tested pages with their performance history, trends, and individual test results`,builder:e=>e.command(u).command(g).command(h).demandCommand(1),handler:()=>{}},v={command:`create <url>`,describe:`Creates a scheduled test for a page.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).option(`frequency`,{type:`string`,description:`The frequency of the scheduled test. Defaults to WEEKLY for free plans, DAILY for paid plans.`,choices:[`DAILY`,`WEEKLY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async e=>{r(e.url,`url`);let i={};if(e.region!==void 0&&(i.region=e.region),e.frequency!==void 0&&(i.frequency=e.frequency),e.dryRun){o({command:`cf speed schedule create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/speed_api/schedule/${e.url??`<url>`}`,pathParams:{zoneId:String(e.zoneId??``),url:String(e.url??``)},bodyKind:`json`,body:{...i},validation:`passed`});return}let c=await t(e),l=await n({zone:e.zone},c,{quiet:e.quiet});e.zoneId=l,a(await s(`Creating schedule`,async()=>c.speed.schedule.create(l,e.url,Object.keys(i).length>0?i:void 0)),{successLabel:`Created schedule`})}},y={command:`delete <url>`,describe:`Deletes a scheduled test for a page.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async i=>{r(i.url,`url`);let c={};if(i.region!==void 0&&(c.region=i.region),i.dryRun){o({command:`cf speed schedule delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${i.zoneId??`<zoneId>`}/speed_api/schedule/${i.url??`<url>`}`,pathParams:{zoneId:String(i.zoneId??``),url:String(i.url??``)},bodyKind:`json`,body:{...c},validation:`passed`});return}let l=await t(i),u=await n({zone:i.zone},l,{quiet:i.quiet});if(i.zoneId=u,!await e(`schedule`,String(i.url??``),{force:!!i.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting schedule`,async()=>l.speed.schedule.delete(u,i.url,Object.keys(c).length>0?c:void 0)),{successLabel:`Deleted schedule`})}},b={command:`get <url>`,describe:`Retrieves the test schedule for a page in a specific region.`,builder:e=>e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`Region`}),handler:async e=>{r(e.url,`url`);let i={};e.region!==void 0&&(i.region=e.region);let o=await t(e),c=await n({zone:e.zone},o,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading schedule`,async()=>o.speed.schedule.get(c,e.url,Object.keys(i).length>0?i:void 0)),{successLabel:`Loaded schedule`})}},x={command:`schedule`,describe:`Scheduled recurring speed tests that automatically run at regular intervals`,builder:e=>e.command(v).command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`speed`,describe:`Observatory speed tests — run Lighthouse audits, track performance trends, and schedule recurring tests`,builder:e=>e.command(l).command(_).command(x).demandCommand(1),handler:()=>{}};export{S as default};