cf 0.4.0 → 0.6.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 (255) hide show
  1. package/README.md +7 -1
  2. package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
  3. package/dist/accounts-BIY8wNGA.mjs +22 -0
  4. package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
  5. package/dist/addressing-CygRm0pN.mjs +12 -0
  6. package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
  7. package/dist/ai-BAmEAjN3.mjs +2 -0
  8. package/dist/ai-gateway-BENwPvvB.mjs +8 -0
  9. package/dist/ai-search-Bv_Whw3E.mjs +7 -0
  10. package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
  11. package/dist/alerting-D_qWrsoY.mjs +6 -0
  12. package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
  13. package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
  14. package/dist/api-gateway-D9PMVVqL.mjs +33 -0
  15. package/dist/argo-DwYGbyld.mjs +2 -0
  16. package/dist/artifacts-DKAjY_n4.mjs +4 -0
  17. package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
  18. package/dist/auth-DX9KnJ0P.mjs +9 -0
  19. package/dist/auth-TYwGydWg.mjs +5 -0
  20. package/dist/billing-CRTlRU88.mjs +2 -0
  21. package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
  22. package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
  23. package/dist/brand-protection-ZikBtl0y.mjs +3 -0
  24. package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
  25. package/dist/build-Bgw8TV1p.mjs +134 -0
  26. package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
  27. package/dist/calls-Cv0ieVg4.mjs +4 -0
  28. package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
  29. package/dist/client-certificates-BFuzeBrj.mjs +3 -0
  30. package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
  31. package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
  32. package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
  33. package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
  34. package/dist/connectivity-CjkXmEhO.mjs +3 -0
  35. package/dist/connector-interrupts-B7eSface.mjs +2 -0
  36. package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
  37. package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
  38. package/dist/connectors-YYu_Vx3H.mjs +3 -0
  39. package/dist/content-scanning-BorfRGKT.mjs +4 -0
  40. package/dist/context-C-WbewL6.mjs +2 -0
  41. package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
  42. package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
  43. package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
  44. package/dist/custom-pages-DamGVA75.mjs +4 -0
  45. package/dist/d1-sK0O5THv.mjs +4 -0
  46. package/dist/data-security-DsWpoWiS.mjs +6 -0
  47. package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
  48. package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
  49. package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
  50. package/dist/diagnostics-CH7T2WR3.mjs +3 -0
  51. package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
  52. package/dist/dist-B7hsuvbF.mjs +57 -0
  53. package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
  54. package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
  55. package/dist/dns-o7hUPMCG.mjs +29 -0
  56. package/dist/durable-objects-DgrTbvoF.mjs +2 -0
  57. package/dist/email-routing-owCvAEpf.mjs +10 -0
  58. package/dist/email-security-Dng3DVuf.mjs +8 -0
  59. package/dist/email-sending-bExMH4lu.mjs +3 -0
  60. package/dist/filters-DKs-wEzt.mjs +4 -0
  61. package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
  62. package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
  63. package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
  64. package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
  65. package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
  66. package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
  67. package/dist/iam-apCCcy7R.mjs +6 -0
  68. package/dist/images-Cxe45OHm.mjs +7 -0
  69. package/dist/index.mjs +1 -1
  70. package/dist/intel-8V4h6H46.mjs +3 -0
  71. package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
  72. package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
  73. package/dist/kv-Dz6then8.mjs +5 -0
  74. package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
  75. package/dist/load-balancers-ilsGgudX.mjs +6 -0
  76. package/dist/logpush-BH14TtuA.mjs +4 -0
  77. package/dist/logs-B8-mkf_I.mjs +3 -0
  78. package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
  79. package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
  80. package/dist/magic-transit-B-kU5e3s.mjs +89 -0
  81. package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
  82. package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
  83. package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
  84. package/dist/oauth-B5k80sip.mjs +61 -0
  85. package/dist/observability-9APhqFHo.mjs +4 -0
  86. package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
  87. package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
  88. package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
  90. package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
  91. package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
  92. package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
  93. package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
  94. package/dist/pages-5DKLs7CQ.mjs +11 -0
  95. package/dist/pipelines-DfGE44xo.mjs +6 -0
  96. package/dist/progress-CL8I-7YK.mjs +2 -0
  97. package/dist/prompt-q3B7sM2A.mjs +3 -0
  98. package/dist/queues-BoenUGIw.mjs +6 -0
  99. package/dist/r2-Cq_JCjK0.mjs +21 -0
  100. package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
  101. package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
  102. package/dist/rate-limits-CcAF3tMl.mjs +5 -0
  103. package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
  104. package/dist/realtime-kit-4bCGviO5.mjs +18 -0
  105. package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
  106. package/dist/request-tracers-DlHawg5l.mjs +2 -0
  107. package/dist/resource-sharing-7FhuboJE.mjs +5 -0
  108. package/dist/resource-tagging-divcugVb.mjs +16 -0
  109. package/dist/rules-CAXkege8.mjs +4 -0
  110. package/dist/rulesets-CBsdc8IV.mjs +8 -0
  111. package/dist/rum-D0hHPNl9.mjs +4 -0
  112. package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
  113. package/dist/schema-validation-BWNDnnIT.mjs +24 -0
  114. package/dist/scim-CWLli4fi.mjs +3 -0
  115. package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
  116. package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
  117. package/dist/security-center-BQT21oiM.mjs +2 -0
  118. package/dist/security-txt-CVpmJo29.mjs +3 -0
  119. package/dist/session-B8r8LNQN.mjs +93 -0
  120. package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
  121. package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
  122. package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
  123. package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
  124. package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
  125. package/dist/speed-UYEVue28.mjs +4 -0
  126. package/dist/src-BQ1dr9xR.mjs +108 -0
  127. package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
  128. package/dist/stream-BUsuOfQh.mjs +14 -0
  129. package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
  130. package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
  131. package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
  132. package/dist/turnstile-CAKVnS1L.mjs +23 -0
  133. package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
  134. package/dist/url-normalization-DA-RAxs4.mjs +3 -0
  135. package/dist/url-scanner-DmYu43f7.mjs +2 -0
  136. package/dist/user-Bah4wGGN.mjs +10 -0
  137. package/dist/vectorize-DhvVG2By.mjs +4 -0
  138. package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
  139. package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
  140. package/dist/web3-n3GW50u-.mjs +4 -0
  141. package/dist/workers-D6IaQ_F0.mjs +18 -0
  142. package/dist/workers-builds-DYi0OMMU.mjs +7 -0
  143. package/dist/workflows-DrdXUQ2g.mjs +4 -0
  144. package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
  145. package/dist/zero-trust-D6V9GH2W.mjs +118 -0
  146. package/dist/zero_trust-BzXKAX_x.mjs +3 -0
  147. package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
  148. package/package.json +3 -1
  149. package/dist/accounts-CjtZ8x1z.mjs +0 -22
  150. package/dist/addressing-CHFK6uxW.mjs +0 -12
  151. package/dist/ai-DS3i-I1a.mjs +0 -2
  152. package/dist/ai-gateway-RIsegO2x.mjs +0 -8
  153. package/dist/ai-search-Dcj4BauG.mjs +0 -7
  154. package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
  155. package/dist/alerting-Bk85NNf5.mjs +0 -6
  156. package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
  157. package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
  158. package/dist/argo-DnJRVnGX.mjs +0 -2
  159. package/dist/artifacts-BVWKiJUl.mjs +0 -4
  160. package/dist/audit-logs-DjTstbzL.mjs +0 -2
  161. package/dist/auth-BqDOIrKX.mjs +0 -150
  162. package/dist/auth-DKkSwnxh.mjs +0 -5
  163. package/dist/billing-3rEqF83h.mjs +0 -2
  164. package/dist/botnet-feed-MG91D7BR.mjs +0 -3
  165. package/dist/brand-protection-CK7gJi06.mjs +0 -3
  166. package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
  167. package/dist/calls-DXRWsZ8n.mjs +0 -4
  168. package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
  169. package/dist/client-certificates-B0ebLJdk.mjs +0 -3
  170. package/dist/cloud-connector-BOjaggJk.mjs +0 -2
  171. package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
  172. package/dist/connectivity-welFvZ7X.mjs +0 -3
  173. package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
  174. package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
  175. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
  176. package/dist/connectors-3vjrdFLB.mjs +0 -3
  177. package/dist/content-scanning-CnW2A0pv.mjs +0 -4
  178. package/dist/context-CONbNKO-.mjs +0 -2
  179. package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
  180. package/dist/custom-pages-5fCSP8in.mjs +0 -4
  181. package/dist/d1-CyiRbZZn.mjs +0 -4
  182. package/dist/data-security-Casx4OS_.mjs +0 -6
  183. package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
  184. package/dist/diagnostics-BqYDoDfw.mjs +0 -3
  185. package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
  186. package/dist/dist-DA54ZQu0.mjs +0 -82
  187. package/dist/dns-62t95Xif.mjs +0 -29
  188. package/dist/dns-firewall-Coy8d47t.mjs +0 -57
  189. package/dist/durable-objects-BSuRERkw.mjs +0 -2
  190. package/dist/email-routing-BDUYYeV3.mjs +0 -10
  191. package/dist/email-security-ChHA6eqQ.mjs +0 -8
  192. package/dist/email-sending-CVrRqn6S.mjs +0 -3
  193. package/dist/filters-qJpU9uAS.mjs +0 -4
  194. package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
  195. package/dist/hyperdrive-99OJV9nl.mjs +0 -18
  196. package/dist/iam-BRbpg3lN.mjs +0 -6
  197. package/dist/images-D1jI3r3O.mjs +0 -7
  198. package/dist/intel-C3ajLpXd.mjs +0 -3
  199. package/dist/kv-CSWoD9ks.mjs +0 -5
  200. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
  201. package/dist/load-balancers-Du1tNuUt.mjs +0 -6
  202. package/dist/logpush-SuJyO-uX.mjs +0 -4
  203. package/dist/logs-DcDNRPRl.mjs +0 -3
  204. package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
  205. package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
  206. package/dist/magic-transit-BTbkhBtF.mjs +0 -89
  207. package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
  208. package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
  209. package/dist/network-interconnects-DsiNytOU.mjs +0 -36
  210. package/dist/observability-CLqZ7OSi.mjs +0 -4
  211. package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
  212. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
  213. package/dist/pages-ChurJ2H7.mjs +0 -11
  214. package/dist/pipelines-CeyujvRf.mjs +0 -6
  215. package/dist/progress-Cent9Lsg.mjs +0 -2
  216. package/dist/queues-Rf_n11Cx.mjs +0 -6
  217. package/dist/r2-BtuTO3vQ.mjs +0 -21
  218. package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
  219. package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
  220. package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
  221. package/dist/realtime-kit-CivLpkpg.mjs +0 -18
  222. package/dist/request-tracers-D1aH4NmL.mjs +0 -2
  223. package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
  224. package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
  225. package/dist/rules-B10XWY10.mjs +0 -4
  226. package/dist/rulesets-lYczEcJp.mjs +0 -8
  227. package/dist/rum-B5GUKa4I.mjs +0 -4
  228. package/dist/schema-validation-DTq517Em.mjs +0 -24
  229. package/dist/scim-BiLfOQ89.mjs +0 -3
  230. package/dist/security-center-AVpTOBK3.mjs +0 -2
  231. package/dist/security-txt-DVlh8y9l.mjs +0 -3
  232. package/dist/shared-0bwWVDLo.mjs +0 -2
  233. package/dist/speed-BzRY3Xlh.mjs +0 -4
  234. package/dist/src-D9_Gq68b.mjs +0 -108
  235. package/dist/stream-CGTRN4ZN.mjs +0 -14
  236. package/dist/turnstile-l7mo9BWL.mjs +0 -23
  237. package/dist/url-normalization-D1CogSIG.mjs +0 -3
  238. package/dist/url-scanner-BnJHJqcz.mjs +0 -2
  239. package/dist/user-CiyYZ69X.mjs +0 -10
  240. package/dist/vectorize-D3LgMLOn.mjs +0 -4
  241. package/dist/web3-DlHE0CZc.mjs +0 -4
  242. package/dist/workers-DRAkU6YR.mjs +0 -18
  243. package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
  244. package/dist/workflows-z6oapEJs.mjs +0 -4
  245. package/dist/zero-trust-fyyIelWx.mjs +0 -118
  246. package/dist/zero_trust-BAhlNkjo.mjs +0 -3
  247. /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  248. /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
  249. /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
  250. /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
  251. /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
  252. /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
  253. /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
  254. /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
  255. /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{D as e,S as t,T as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}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:u,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Creating`,async()=>n.smartShield.cacheReserveClear.clear({zone_id:i})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`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:f,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield cache-reserve-clear status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.smartShield.cacheReserveClear.status({zone_id:i})),{successLabel:`Loaded`})}},m={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.smartShield.get({zone_id:i})),{successLabel:`Loaded`})}};function _(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Create a new health check.`,builder:_,handler:async n=>{if(n.dryRun){s({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.smartShield.healthChecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.smartShield.healthChecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function y(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:y,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>i.smartShield.healthChecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:x,handler:async n=>{if(n.dryRun){s({command:`cf smart-shield health-checks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.smartShield.healthChecks.edit({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.smartShield.healthChecks.edit({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}};function C(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:C,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.smartShield.healthChecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`List configured health checks.`,builder:T,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf smart-shield health-checks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.smartShield.healthChecks.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function D(e){return e.positional(`healthcheck-id`,{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.`}).option(`result-consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).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.`}).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.`}).option(`result-http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`result-http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).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.`}).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.`}).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.`}).option(`result-suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`result-tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`result-tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`result-timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`result-type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).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)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield health-checks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({result:{address:l(e[`result-address`],`result-address`,`text`),check_regions:e[`result-check-regions`],consecutive_fails:e[`result-consecutive-fails`],consecutive_successes:e[`result-consecutive-successes`],description:l(e[`result-description`],`result-description`,`text`),http_config:{allow_insecure:e[`result-http-config-allow-insecure`],expected_body:l(e[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:e[`result-http-config-expected-codes`],follow_redirects:e[`result-http-config-follow-redirects`],method:l(e[`result-http-config-method`],`result-http-config-method`,`text`),path:l(e[`result-http-config-path`],`result-http-config-path`,`text`),port:e[`result-http-config-port`]},interval:e[`result-interval`],name:l(e[`result-name`],`result-name`,`text`),retries:e[`result-retries`],suspended:e[`result-suspended`],tcp_config:{method:l(e[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:e[`result-tcp-config-port`]},timeout:e[`result-timeout`],type:l(e[`result-type`],`result-type`,`text`)},success:e.success}):i(e.body)});return}let n=await r(e),u=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=u,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.smartShield.healthChecks.update({...t,zone_id:u,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Updated`});return}if(e.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);let d=a({result:{address:l(e[`result-address`],`result-address`,`text`),check_regions:e[`result-check-regions`],consecutive_fails:e[`result-consecutive-fails`],consecutive_successes:e[`result-consecutive-successes`],description:l(e[`result-description`],`result-description`,`text`),http_config:{allow_insecure:e[`result-http-config-allow-insecure`],expected_body:l(e[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:e[`result-http-config-expected-codes`],follow_redirects:e[`result-http-config-follow-redirects`],method:l(e[`result-http-config-method`],`result-http-config-method`,`text`),path:l(e[`result-http-config-path`],`result-http-config-path`,`text`),port:e[`result-http-config-port`]},interval:e[`result-interval`],name:l(e[`result-name`],`result-name`,`text`),retries:e[`result-retries`],suspended:e[`result-suspended`],tcp_config:{method:l(e[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:e[`result-tcp-config-port`]},timeout:e[`result-timeout`],type:l(e[`result-type`],`result-type`,`text`)},success:e.success});o(await c(`Updating`,async()=>n.smartShield.healthChecks.update({...d,zone_id:u,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`health-checks`,describe:`Health checks operations`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return 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.`})}const j={command:`update`,describe:`Set Smart Shield Settings.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf smart-shield update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({cache_reserve:{value:l(e[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:l(e[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:l(e[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:l(e[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}}):i(e.body)});return}let n=await r(e),u=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=u,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.smartShield.update({...t,zone_id:u})),{successLabel:`Updated`});return}let d=a({cache_reserve:{value:l(e[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:l(e[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:l(e[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:l(e[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}});o(await c(`Updating`,async()=>n.smartShield.update({...d,zone_id:u})),{successLabel:`Updated`})}},M={command:`smart-shield`,describe:`Smart Shield settings, health checks, and cache reserve management`,builder:e=>e.command(g).command(j).command(m).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
2
+ import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{r as c,t as l}from"./prompt-q3B7sM2A.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}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:u,handler:async n=>{if(n.dryRun){a({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Creating`,async()=>r.smartShield.cacheReserveClear.clear({zone_id:s})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`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:f,handler:async n=>{if(n.dryRun){a({command:`cf smart-shield cache-reserve-clear status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.smartShield.cacheReserveClear.status({zone_id:s})),{successLabel:`Loaded`})}},m={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:h,handler:async n=>{if(n.dryRun){a({command:`cf smart-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.smartShield.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Create a new health check.`,builder:_,handler:async l=>{if(l.dryRun){a({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Creating`,async()=>u.smartShield.healthChecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Creating`,async()=>u.smartShield.healthChecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function y(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:y,handler:async n=>{if(n.dryRun){a({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>r.smartShield.healthChecks.delete({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:x,handler:async l=>{if(l.dryRun){a({command:`cf smart-shield health-checks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/smart_shield/healthchecks/${l[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(l[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(l[`healthcheck-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.smartShield.healthChecks.edit({body:e,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Updating`,async()=>u.smartShield.healthChecks.edit({body:f,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`})}};function C(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:C,handler:async n=>{if(n.dryRun){a({command:`cf smart-shield health-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.smartShield.healthChecks.get({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`List configured health checks.`,builder:T,handler:async n=>{let r={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf smart-shield health-checks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.smartShield.healthChecks.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function D(e){return e.positional(`healthcheck-id`,{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.`}).option(`result-consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).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.`}).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.`}).option(`result-http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`result-http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).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.`}).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.`}).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.`}).option(`result-suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`result-tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`result-tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`result-timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`result-type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).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)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async c=>{if(c.dryRun){a({command:`cf smart-shield health-checks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/smart_shield/healthchecks/${c[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(c[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(c[`healthcheck-id`]??``),"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({result:{address:s(c[`result-address`],`result-address`,`text`),check_regions:c[`result-check-regions`],consecutive_fails:c[`result-consecutive-fails`],consecutive_successes:c[`result-consecutive-successes`],description:s(c[`result-description`],`result-description`,`text`),http_config:{allow_insecure:c[`result-http-config-allow-insecure`],expected_body:s(c[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:c[`result-http-config-expected-codes`],follow_redirects:c[`result-http-config-follow-redirects`],method:s(c[`result-http-config-method`],`result-http-config-method`,`text`),path:s(c[`result-http-config-path`],`result-http-config-path`,`text`),port:c[`result-http-config-port`]},interval:c[`result-interval`],name:s(c[`result-name`],`result-name`,`text`),retries:c[`result-retries`],suspended:c[`result-suspended`],tcp_config:{method:s(c[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:c[`result-tcp-config-port`]},timeout:c[`result-timeout`],type:s(c[`result-type`],`result-type`,`text`)},success:c.success}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.smartShield.healthChecks.update({...e,zone_id:u,healthcheck_id:c[`healthcheck-id`]})),{successLabel:`Updated`});return}if(c.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);let d=r({result:{address:s(c[`result-address`],`result-address`,`text`),check_regions:c[`result-check-regions`],consecutive_fails:c[`result-consecutive-fails`],consecutive_successes:c[`result-consecutive-successes`],description:s(c[`result-description`],`result-description`,`text`),http_config:{allow_insecure:c[`result-http-config-allow-insecure`],expected_body:s(c[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:c[`result-http-config-expected-codes`],follow_redirects:c[`result-http-config-follow-redirects`],method:s(c[`result-http-config-method`],`result-http-config-method`,`text`),path:s(c[`result-http-config-path`],`result-http-config-path`,`text`),port:c[`result-http-config-port`]},interval:c[`result-interval`],name:s(c[`result-name`],`result-name`,`text`),retries:c[`result-retries`],suspended:c[`result-suspended`],tcp_config:{method:s(c[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:c[`result-tcp-config-port`]},timeout:c[`result-timeout`],type:s(c[`result-type`],`result-type`,`text`)},success:c.success});i(await o(`Updating`,async()=>l.smartShield.healthChecks.update({...d,zone_id:u,healthcheck_id:c[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`health-checks`,describe:`Health checks operations`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return 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.`})}const j={command:`update`,describe:`Set Smart Shield Settings.`,builder:A,handler:async c=>{if(c.dryRun){a({command:`cf smart-shield update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({cache_reserve:{value:s(c[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:s(c[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:s(c[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:s(c[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.smartShield.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=r({cache_reserve:{value:s(c[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:s(c[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:s(c[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:s(c[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}});i(await o(`Updating`,async()=>l.smartShield.update({...d,zone_id:u})),{successLabel:`Updated`})}},M={command:`smart-shield`,describe:`Smart Shield settings, health checks, and cache reserve management`,builder:e=>e.command(g).command(j).command(m).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{S as e,T as t,i as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i}from"./body-parser-CBpeIUns.mjs";import{t as a}from"./output-CUxZRM5A.mjs";import{n as o,t as s}from"./progress-Cent9Lsg.mjs";import{n as c,t as l}from"./input-validation-CTqtyiY9.mjs";import{n as u,t as d}from"./raw-fetch-DnbAMFBp.mjs";function f(e){return e.positional(`snippet-name`,{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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const p={command:`get <snippet-name>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:f,handler:async t=>{if(t.dryRun){o({command:`cf snippets content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}/content`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let n=await r(t);t.zoneId=await e({zone:t.zone},n,{quiet:t.quiet});let i=await s(`Loading`,async()=>d(`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}/content`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));u(t.text===!0?i.toString(`utf-8`):i)}},m={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.positional(`snippet-name`,{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})}const g={command:`delete <snippet-name>`,describe:`Deletes a snippet belonging to the zone.`,builder:h,handler:async n=>{if(n.dryRun){o({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/snippets/${n[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(n[`snippet-name`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"snippet-name":String(n[`snippet-name`]??``)},bodyKind:`none`});return}let i=await r(n),c=await e({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>i.snippets.delete({zone_id:c,snippet_name:n[`snippet-name`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <snippet-name>`,describe:`Fetches a snippet belonging to the zone.`,builder:_,handler:async t=>{if(t.dryRun){o({command:`cf snippets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.snippets.get({zone_id:i,snippet_name:t[`snippet-name`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`page`,{type:`number`,description:`Specifies the current page number.`}).option(`per-page`,{type:`number`,description:`Specifies how many results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Fetches all snippets belonging to the zone.`,builder:y,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){o({command:`cf snippets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(t),c=await e({zone:t.zone},i,{quiet:t.quiet});t.zoneId=c,a(await s(`Loading`,async()=>i.snippets.list({zone_id:c,...n})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete`,describe:`Deletes all snippet rules belonging to the zone.`,builder:x,handler:async n=>{if(n.dryRun){o({command:`cf snippets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(n),c=await e({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await t({force:!!n.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>i.snippets.rules.delete({zone_id:c})),{successLabel:`Deleted`})}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Fetches all snippet rules belonging to the zone.`,builder:C,handler:async t=>{if(t.dryRun){o({command:`cf snippets rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.snippets.rules.list({zone_id:i})),{successLabel:`Loaded`})}};function T(e){return 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.`})}const E={command:`update`,describe:`Updates all snippet rules belonging to the zone.`,builder:T,handler:async t=>{if(t.dryRun){o({command:`cf snippets rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:i(t.body)});return}let c=await r(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=i(t.body);a(await s(`Updating`,async()=>c.snippets.rules.update({...e,zone_id:l})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n(c,`PUT`,`/zones/${t.zoneId}/snippets/snippet_rules`)),{successLabel:`Updated`})}},D={command:`rules`,describe:`Rules that determine which requests trigger specific snippets based on URL patterns`,builder:e=>e.command(S).command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`snippet-name`,{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.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`Provide metadata about the snippet.`})}const k={command:`update <snippet-name>`,describe:`Creates or updates a snippet belonging to the zone.`,builder:O,handler:async t=>{if(t.dryRun){o({command:`cf snippets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,metadata:t.metadata}});return}let i=await r(t);if(t.zoneId=await e({zone:t.zone},i,{quiet:t.quiet}),t.file!==void 0||t.body!==void 0||t.metadata!==void 0){let e=new FormData;if(t.file){let n=l(t.file);e.append(`file`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.metadata!==void 0){let n=typeof t.metadata==`string`?c(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}a(await s(`Updating`,async()=>n(i,`PUT`,`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}`,{body:e})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>n(i,`PUT`,`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`snippets`,describe:`Lightweight JavaScript snippets that run on requests before Workers — for quick header modifications and redirects`,builder:e=>e.command(g).command(v).command(b).command(k).command(m).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{A as default};
2
+ import{N as e}from"./oauth-B5k80sip.mjs";import{i as t,n}from"./auth-DX9KnJ0P.mjs";import{n as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s,t as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./prompt-q3B7sM2A.mjs";import{n as u,t as d}from"./raw-fetch-bIXC9D1m.mjs";function f(e){return e.positional(`snippet-name`,{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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const p={command:`get <snippet-name>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:f,handler:async t=>{if(t.dryRun){a({command:`cf snippets content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}/content`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(t);t.zoneId=await e({zone:t.zone},r,{quiet:t.quiet});let i=await o(`Loading`,async()=>d(`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}/content`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));u(t.text===!0?i.toString(`utf-8`):i)}},m={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.positional(`snippet-name`,{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})}const g={command:`delete <snippet-name>`,describe:`Deletes a snippet belonging to the zone.`,builder:h,handler:async t=>{if(t.dryRun){a({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=s,!await l({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>r.snippets.delete({zone_id:s,snippet_name:t[`snippet-name`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <snippet-name>`,describe:`Fetches a snippet belonging to the zone.`,builder:_,handler:async t=>{if(t.dryRun){a({command:`cf snippets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.snippets.get({zone_id:s,snippet_name:t[`snippet-name`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`page`,{type:`number`,description:`Specifies the current page number.`}).option(`per-page`,{type:`number`,description:`Specifies how many results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Fetches all snippets belonging to the zone.`,builder:y,handler:async t=>{let r={page:t.page,per_page:t[`per-page`]};if(t.dryRun){a({command:`cf snippets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.snippets.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete`,describe:`Deletes all snippet rules belonging to the zone.`,builder:x,handler:async t=>{if(t.dryRun){a({command:`cf snippets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=s,!await l({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}i(await o(`Deleting`,async()=>r.snippets.rules.delete({zone_id:s})),{successLabel:`Deleted`})}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Fetches all snippet rules belonging to the zone.`,builder:C,handler:async t=>{if(t.dryRun){a({command:`cf snippets rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.snippets.rules.list({zone_id:s})),{successLabel:`Loaded`})}};function T(e){return 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.`})}const E={command:`update`,describe:`Updates all snippet rules belonging to the zone.`,builder:T,handler:async s=>{if(s.dryRun){a({command:`cf snippets rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:r(s.body)});return}let c=await n(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,s.body){let e=r(s.body);i(await o(`Updating`,async()=>c.snippets.rules.update({...e,zone_id:l})),{successLabel:`Updated`});return}i(await o(`Updating`,async()=>t(c,`PUT`,`/zones/${s.zoneId}/snippets/snippet_rules`)),{successLabel:`Updated`})}},D={command:`rules`,describe:`Rules that determine which requests trigger specific snippets based on URL patterns`,builder:e=>e.command(S).command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`snippet-name`,{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.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`Provide metadata about the snippet.`})}const k={command:`update <snippet-name>`,describe:`Creates or updates a snippet belonging to the zone.`,builder:O,handler:async r=>{if(r.dryRun){a({command:`cf snippets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/snippets/${r[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(r[`snippet-name`]))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"snippet-name":String(r[`snippet-name`]??``)},bodyKind:`multipart`,body:{body:r.body,file:r.file,metadata:r.metadata}});return}let l=await n(r);if(r.zoneId=await e({zone:r.zone},l,{quiet:r.quiet}),r.file!==void 0||r.body!==void 0||r.metadata!==void 0){let e=new FormData;if(r.file){let t=c(r.file);e.append(`file`,new Blob([t]),r.file.split(/[\\/]/).filter(Boolean).pop())}else r.body!==void 0&&e.append(`file`,r.body);if(r.metadata!==void 0){let t=typeof r.metadata==`string`?s(r.metadata,`metadata`,`text`):r.metadata;e.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}i(await o(`Updating`,async()=>t(l,`PUT`,`/zones/${r.zoneId}/snippets/${encodeURIComponent(String(r[`snippet-name`]))}`,{body:e})),{successLabel:`Updated`});return}if(r.body){let e=s(r.body,`body`,`binary`);i(await o(`Updating`,async()=>t(l,`PUT`,`/zones/${r.zoneId}/snippets/${encodeURIComponent(String(r[`snippet-name`]))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`snippets`,describe:`Lightweight JavaScript snippets that run on requests before Workers — for quick header modifications and redirects`,builder:e=>e.command(g).command(v).command(b).command(k).command(m).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{A as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./src-D9_Gq68b.mjs";import{a as t}from"./theme-CFHr0Dh9.mjs";import"./ui-B97lRnOv.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{homedir as i}from"node:os";import{join as a}from"node:path";import{execFileSync as o,spawn as s}from"node:child_process";function c(e){return t=>{if(!t.pkgRoot)return null;let r=a(t.pkgRoot,`bin`,e);return n(r)?r:null}}function l(){let e=a(process.env.CARGO_HOME??a(i(),`.cargo`),`bin`,`cloudflare-rs-dev-server`);return n(e)?e:null}const u=[{ecosystem:`npm`,pkg:`@cloudflare/vite-plugin`,minimumVersion:`1.42.0`,description:`Vite-based dev server (recommended for JavaScript/TypeScript)`,manifest:`package.json`,binary:c(`cf-vite`),installHint:`npm install --save-dev @cloudflare/vite-plugin@latest`},{ecosystem:`npm`,pkg:`wrangler`,fallback:!0,minimumVersion:`4.102.0`,description:`Wrangler-based dev server (legacy Worker projects)`,manifest:`package.json`,binary:c(`cf-wrangler.js`),installHint:`npm install --save-dev wrangler@latest`},{ecosystem:`pypi`,pkg:`cloudflare-py-dev-server`,description:`Python dev server (Pyodide via workerd)`,manifest:`pyproject.toml`,binary:()=>null,installHint:`pip install cloudflare-py-dev-server (or: uv add --dev cloudflare-py-dev-server)`},{ecosystem:`cargo`,pkg:`cloudflare-rs-dev-server`,description:`Rust dev server (wasm-bindgen + workerd)`,manifest:`Cargo.toml`,binary:l,installHint:`cargo install cloudflare-rs-dev-server`}];function d(e){return u.find(t=>t.pkg===e)}function f(e){let t=[];t.push(...p(e)),t.push(...g(e)),t.push(...b(e));let n=t.filter(e=>!e.impl.fallback);return n.length>0?n:t}function p(e){let t=a(e,`package.json`);if(!n(t))return[];let i;try{let e=r(t,`utf-8`);i=JSON.parse(e)}catch{return[]}let o=m(i),s=[];for(let n of o){let r=d(n);if(!r||r.ecosystem!==`npm`)continue;let i=h(e,n),a=i?r.binary({cwd:e,pkgRoot:i}):null;s.push({impl:r,binary:a,installed:!!i,manifestPath:t})}return s}function m(e){let t=new Set;for(let n of[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`]){let r=e[n];if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(e)}return t}function h(e,t){if(n(a(e,`node_modules`,t,`package.json`)))return a(e,`node_modules`,t)}function g(e){let t=a(e,`pyproject.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of _()){if(!v(i,n.pkg))continue;let r=y(e,n.pkg);o.push({impl:n,binary:r,manifestPath:t})}return o}function _(){let e=[],t=new Set;for(let n of S())n.ecosystem===`pypi`&&!t.has(n.pkg)&&(e.push(n),t.add(n.pkg));return e}function v(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`["']${n}(?=[\\s\\[<>=!~"';])`,`m`).test(e)}function y(e,t){if(n(a(e,`uv.lock`)))return`uv:${t}`;try{let r=o(`python3`,[`-c`,`import shutil, sys; p = shutil.which(${JSON.stringify(t)}); sys.stdout.write(p or "")`],{cwd:e,stdio:[`ignore`,`pipe`,`ignore`],encoding:`utf-8`}).trim();if(r&&n(r))return r}catch{}return null}function b(e){let t=a(e,`Cargo.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of S()){if(n.ecosystem!==`cargo`||!x(i,n.pkg))continue;let r=n.binary({cwd:e});o.push({impl:n,binary:r,manifestPath:t})}return o}function x(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^\\s*${n}\\s*=)|(^\\s*\\[[^\\]]*\\.${n}\\s*\\])`,`m`).test(e)}function S(){return u}function C(t){let n=f(t);if(n.length===0)throw w(t),new e(1);if(n.length>1)throw T(n),new e(1);let[r]=n;if(!r)throw new e(1);if(!r.binary)throw E(r),new e(1);return r}function w(e){console.error(`
2
+ import{t as e}from"./src-BQ1dr9xR.mjs";import{a as t}from"./theme-DbNbIY4d.mjs";import"./ui-BrNwNHX9.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{homedir as i}from"node:os";import{join as a}from"node:path";import{execFileSync as o,spawn as s}from"node:child_process";function c(e){return t=>{if(!t.pkgRoot)return null;let r=a(t.pkgRoot,`bin`,e);return n(r)?r:null}}function l(){let e=a(process.env.CARGO_HOME??a(i(),`.cargo`),`bin`,`cloudflare-rs-dev-server`);return n(e)?e:null}const u=[{ecosystem:`npm`,pkg:`@cloudflare/vite-plugin`,minimumVersion:`1.42.0`,description:`Vite-based dev server (recommended for JavaScript/TypeScript)`,manifest:`package.json`,binary:c(`cf-vite`),installHint:`npm install --save-dev @cloudflare/vite-plugin@latest`},{ecosystem:`npm`,pkg:`wrangler`,fallback:!0,minimumVersion:`4.102.0`,description:`Wrangler-based dev server (legacy Worker projects)`,manifest:`package.json`,binary:c(`cf-wrangler.js`),installHint:`npm install --save-dev wrangler@latest`},{ecosystem:`pypi`,pkg:`cloudflare-py-dev-server`,description:`Python dev server (Pyodide via workerd)`,manifest:`pyproject.toml`,binary:()=>null,installHint:`pip install cloudflare-py-dev-server (or: uv add --dev cloudflare-py-dev-server)`},{ecosystem:`cargo`,pkg:`cloudflare-rs-dev-server`,description:`Rust dev server (wasm-bindgen + workerd)`,manifest:`Cargo.toml`,binary:l,installHint:`cargo install cloudflare-rs-dev-server`}];function d(e){return u.find(t=>t.pkg===e)}function f(e){let t=[];t.push(...p(e)),t.push(...g(e)),t.push(...b(e));let n=t.filter(e=>!e.impl.fallback);return n.length>0?n:t}function p(e){let t=a(e,`package.json`);if(!n(t))return[];let i;try{let e=r(t,`utf-8`);i=JSON.parse(e)}catch{return[]}let o=m(i),s=[];for(let n of o){let r=d(n);if(!r||r.ecosystem!==`npm`)continue;let i=h(e,n),a=i?r.binary({cwd:e,pkgRoot:i}):null;s.push({impl:r,binary:a,installed:!!i,manifestPath:t})}return s}function m(e){let t=new Set;for(let n of[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`]){let r=e[n];if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(e)}return t}function h(e,t){if(n(a(e,`node_modules`,t,`package.json`)))return a(e,`node_modules`,t)}function g(e){let t=a(e,`pyproject.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of _()){if(!v(i,n.pkg))continue;let r=y(e,n.pkg);o.push({impl:n,binary:r,manifestPath:t})}return o}function _(){let e=[],t=new Set;for(let n of S())n.ecosystem===`pypi`&&!t.has(n.pkg)&&(e.push(n),t.add(n.pkg));return e}function v(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`["']${n}(?=[\\s\\[<>=!~"';])`,`m`).test(e)}function y(e,t){if(n(a(e,`uv.lock`)))return`uv:${t}`;try{let r=o(`python3`,[`-c`,`import shutil, sys; p = shutil.which(${JSON.stringify(t)}); sys.stdout.write(p or "")`],{cwd:e,stdio:[`ignore`,`pipe`,`ignore`],encoding:`utf-8`}).trim();if(r&&n(r))return r}catch{}return null}function b(e){let t=a(e,`Cargo.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of S()){if(n.ecosystem!==`cargo`||!x(i,n.pkg))continue;let r=n.binary({cwd:e});o.push({impl:n,binary:r,manifestPath:t})}return o}function x(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^\\s*${n}\\s*=)|(^\\s*\\[[^\\]]*\\.${n}\\s*\\])`,`m`).test(e)}function S(){return u}function C(t){let n=f(t);if(n.length===0)throw w(t),new e(1);if(n.length>1)throw T(n),new e(1);let[r]=n;if(!r)throw new e(1);if(!r.binary)throw E(r),new e(1);return r}function w(e){console.error(`
3
3
  No Cloudflare dev-server is installed in this project.
4
4
 
5
5
  A project must declare exactly one of the following in its manifest:
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{D as e,S as t,T as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./cli-types-CMNMD1V7.mjs";function d(e){return e.option(`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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:d,handler:async e=>{let n={appID:e[`app-id`],colo_name:e[`colo-name`]};if(e.dryRun){s({command:`cf spectrum analytics aggregates currents get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/aggregate/current`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.aggregates.currents.get({zone_id:a,...n})),{successLabel:`Loaded`})}},p={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
2
+ import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{r as c,t as l}from"./prompt-q3B7sM2A.mjs";import{t as u}from"./cli-types-DGgEbf8K.mjs";function d(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:d,handler:async n=>{let r={appID:n[`app-id`],colo_name:n[`colo-name`]};if(n.dryRun){a({command:`cf spectrum analytics aggregates currents get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/analytics/aggregate/current`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.spectrum.analytics.aggregates.currents.get({zone_id:c,...r})),{successLabel:`Loaded`})}},p={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
3
3
 
4
4
  Dimension | Name | Example
5
5
  --------------------------|---------------------------------|--------------------------
@@ -27,7 +27,7 @@ Operator | Name | URL Encoded
27
27
  \\>= | Greater than or equal to | %3E%3D
28
28
  \\<= | Less than or equal to | %3C%3D
29
29
 
30
- Use the above to construct filters.`}).option(`since`,{type:`string`,description:"Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified."}).option(`time-delta`,{type:`string`,description:`Used to select time series resolution.`,choices:[`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`],demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves a list of aggregate metrics grouped by time interval.`,builder:u(h),handler:async e=>{let n={dimensions:e.dimensions,sort:e.sort,until:e.until,metrics:e.metrics,filters:e.filters,since:e.since,time_delta:e[`time-delta`]};if(e.dryRun){s({command:`cf spectrum analytics events bytimes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/events/bytime`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.events.bytimes.get({zone_id:a,...n})),{successLabel:`Loaded`})}},_={command:`bytimes`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
30
+ Use the above to construct filters.`}).option(`since`,{type:`string`,description:"Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified."}).option(`time-delta`,{type:`string`,description:`Used to select time series resolution.`,choices:[`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`],demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves a list of aggregate metrics grouped by time interval.`,builder:u(h),handler:async n=>{let r={dimensions:n.dimensions,sort:n.sort,until:n.until,metrics:n.metrics,filters:n.filters,since:n.since,time_delta:n[`time-delta`]};if(n.dryRun){a({command:`cf spectrum analytics events bytimes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/analytics/events/bytime`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.spectrum.analytics.events.bytimes.get({zone_id:c,...r})),{successLabel:`Loaded`})}},_={command:`bytimes`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
31
31
 
32
32
  Dimension | Name | Example
33
33
  --------------------------|---------------------------------|--------------------------
@@ -55,9 +55,9 @@ Operator | Name | URL Encoded
55
55
  \\>= | Greater than or equal to | %3E%3D
56
56
  \\<= | Less than or equal to | %3C%3D
57
57
 
58
- Use the above to construct filters.`}).option(`since`,{type:`string`,description:"Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves a list of summarised aggregate metrics over a given time period.`,builder:u(v),handler:async e=>{let n={dimensions:e.dimensions,sort:e.sort,until:e.until,metrics:e.metrics,filters:e.filters,since:e.since};if(e.dryRun){s({command:`cf spectrum analytics events summaries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/analytics/events/summary`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.analytics.events.summaries.get({zone_id:a,...n})),{successLabel:`Loaded`})}},b={command:`summaries`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},x={command:`events`,describe:`Operations for analytics.events`,builder:e=>e.command(_).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(m).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
58
+ Use the above to construct filters.`}).option(`since`,{type:`string`,description:"Start of time interval to query, defaults to `until` - 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves a list of summarised aggregate metrics over a given time period.`,builder:u(v),handler:async n=>{let r={dimensions:n.dimensions,sort:n.sort,until:n.until,metrics:n.metrics,filters:n.filters,since:n.since};if(n.dryRun){a({command:`cf spectrum analytics events summaries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/analytics/events/summary`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.spectrum.analytics.events.summaries.get({zone_id:c,...r})),{successLabel:`Loaded`})}},b={command:`summaries`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},x={command:`events`,describe:`Operations for analytics.events`,builder:e=>e.command(_).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(m).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
59
59
  Notes: Only available for TCP or UDP 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.
60
- 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(`virtual-network-id`,{type:`string`,description:`Optional UUID of a virtual network for routing origin traffic through tunnel virtual networks.`}).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`])}const w={command:`create`,describe:`Creates a new Spectrum application from a configuration using a name for the origin.`,builder:C,handler:async n=>{if(n.dryRun){s({command:`cf spectrum apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({argo_smart_routing:n[`argo-smart-routing`],dns:{name:l(n[`dns-name`],`dns-name`,`text`),type:l(n[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:l(n[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:l(n[`edge-ips-type`],`edge-ips-type`,`text`),ips:n[`edge-ips-ips`]},ip_firewall:n[`ip-firewall`],origin_direct:n[`origin-direct`],origin_dns:{name:l(n[`origin-dns-name`],`origin-dns-name`,`text`),ttl:n[`origin-dns-ttl`],type:l(n[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:l(n.protocol,`protocol`,`text`),proxy_protocol:l(n[`proxy-protocol`],`proxy-protocol`,`text`),tls:l(n.tls,`tls`,`text`),traffic_type:l(n[`traffic-type`],`traffic-type`,`text`),virtual_network_id:l(n[`virtual-network-id`],`virtual-network-id`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.spectrum.apps.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.protocol===void 0&&(n.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=a({argo_smart_routing:n[`argo-smart-routing`],dns:{name:l(n[`dns-name`],`dns-name`,`text`),type:l(n[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:l(n[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:l(n[`edge-ips-type`],`edge-ips-type`,`text`),ips:n[`edge-ips-ips`]},ip_firewall:n[`ip-firewall`],origin_direct:n[`origin-direct`],origin_dns:{name:l(n[`origin-dns-name`],`origin-dns-name`,`text`),ttl:n[`origin-dns-ttl`],type:l(n[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:l(n.protocol,`protocol`,`text`),proxy_protocol:l(n[`proxy-protocol`],`proxy-protocol`,`text`),tls:l(n.tls,`tls`,`text`),traffic_type:l(n[`traffic-type`],`traffic-type`,`text`),virtual_network_id:l(n[`virtual-network-id`],`virtual-network-id`,`text`)});o(await c(`Creating`,async()=>u.spectrum.apps.create({body:f,zone_id:d})),{successLabel:`Created`})}};function T(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <app-id>`,describe:`Deletes a previously existing application.`,builder:T,handler:async e=>{if(e.dryRun){s({command:`cf spectrum apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
61
- `);return}o(await c(`Deleting`,async()=>i.spectrum.apps.delete({zone_id:a,app_id:e[`app-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <app-id>`,describe:`Gets the application configuration of a specific application inside a zone.`,builder:D,handler:async e=>{if(e.dryRun){s({command:`cf spectrum apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.spectrum.apps.get({zone_id:i,app_id:e[`app-id`]})),{successLabel:`Loaded`})}};function k(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Retrieves a list of currently existing Spectrum applications inside a zone.`,builder:u(k),handler:async e=>{let n={page:e.page,per_page:e[`per-page`],direction:e.direction,order:e.order};if(e.dryRun){s({command:`cf spectrum apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.spectrum.apps.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function j(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
60
+ 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(`virtual-network-id`,{type:`string`,description:`Optional UUID of a virtual network for routing origin traffic through tunnel virtual networks.`}).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`])}const w={command:`create`,describe:`Creates a new Spectrum application from a configuration using a name for the origin.`,builder:C,handler:async l=>{if(l.dryRun){a({command:`cf spectrum apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({argo_smart_routing:l[`argo-smart-routing`],dns:{name:s(l[`dns-name`],`dns-name`,`text`),type:s(l[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:s(l[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:s(l[`edge-ips-type`],`edge-ips-type`,`text`),ips:l[`edge-ips-ips`]},ip_firewall:l[`ip-firewall`],origin_direct:l[`origin-direct`],origin_dns:{name:s(l[`origin-dns-name`],`origin-dns-name`,`text`),ttl:l[`origin-dns-ttl`],type:s(l[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:s(l.protocol,`protocol`,`text`),proxy_protocol:s(l[`proxy-protocol`],`proxy-protocol`,`text`),tls:s(l.tls,`tls`,`text`),traffic_type:s(l[`traffic-type`],`traffic-type`,`text`),virtual_network_id:s(l[`virtual-network-id`],`virtual-network-id`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Creating`,async()=>u.spectrum.apps.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.protocol===void 0&&(l.protocol=await c(`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=r({argo_smart_routing:l[`argo-smart-routing`],dns:{name:s(l[`dns-name`],`dns-name`,`text`),type:s(l[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:s(l[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:s(l[`edge-ips-type`],`edge-ips-type`,`text`),ips:l[`edge-ips-ips`]},ip_firewall:l[`ip-firewall`],origin_direct:l[`origin-direct`],origin_dns:{name:s(l[`origin-dns-name`],`origin-dns-name`,`text`),ttl:l[`origin-dns-ttl`],type:s(l[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:s(l.protocol,`protocol`,`text`),proxy_protocol:s(l[`proxy-protocol`],`proxy-protocol`,`text`),tls:s(l.tls,`tls`,`text`),traffic_type:s(l[`traffic-type`],`traffic-type`,`text`),virtual_network_id:s(l[`virtual-network-id`],`virtual-network-id`,`text`)});i(await o(`Creating`,async()=>u.spectrum.apps.create({body:f,zone_id:d})),{successLabel:`Created`})}};function T(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <app-id>`,describe:`Deletes a previously existing application.`,builder:T,handler:async n=>{if(n.dryRun){a({command:`cf spectrum apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/apps/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}`,pathParams:{"app-id":String(n[`app-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
61
+ `);return}i(await o(`Deleting`,async()=>r.spectrum.apps.delete({zone_id:s,app_id:n[`app-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <app-id>`,describe:`Gets the application configuration of a specific application inside a zone.`,builder:D,handler:async n=>{if(n.dryRun){a({command:`cf spectrum apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/apps/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}`,pathParams:{"app-id":String(n[`app-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.spectrum.apps.get({zone_id:s,app_id:n[`app-id`]})),{successLabel:`Loaded`})}};function k(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Retrieves a list of currently existing Spectrum applications inside a zone.`,builder:u(k),handler:async n=>{let r={page:n.page,per_page:n[`per-page`],direction:n.direction,order:n.order};if(n.dryRun){a({command:`cf spectrum apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/apps`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.spectrum.apps.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function j(e){return e.positional(`app-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`argo-smart-routing`,{type:`boolean`,description:`Enables Argo Smart Routing for this application.
62
62
  Notes: Only available for TCP or UDP applications with traffic_type set to "direct".`}).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.
63
- Notes: Only available for TCP applications.`}).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`]}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`]}).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`]}).option(`virtual-network-id`,{type:`string`,description:`Optional UUID of a virtual network for routing origin traffic through tunnel virtual networks.`}).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`])}const M={command:`update <app-id>`,describe:`Updates a previously existing application's configuration that uses a name for the origin.`,builder:j,handler:async n=>{if(n.dryRun){s({command:`cf spectrum apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/spectrum/apps/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}`,pathParams:{"app-id":String(n[`app-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({argo_smart_routing:n[`argo-smart-routing`],dns:{name:l(n[`dns-name`],`dns-name`,`text`),type:l(n[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:l(n[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:l(n[`edge-ips-type`],`edge-ips-type`,`text`),ips:n[`edge-ips-ips`]},ip_firewall:n[`ip-firewall`],origin_direct:n[`origin-direct`],origin_dns:{name:l(n[`origin-dns-name`],`origin-dns-name`,`text`),ttl:n[`origin-dns-ttl`],type:l(n[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:l(n.protocol,`protocol`,`text`),proxy_protocol:l(n[`proxy-protocol`],`proxy-protocol`,`text`),tls:l(n.tls,`tls`,`text`),traffic_type:l(n[`traffic-type`],`traffic-type`,`text`),virtual_network_id:l(n[`virtual-network-id`],`virtual-network-id`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.spectrum.apps.update({body:e,zone_id:d,app_id:n[`app-id`]})),{successLabel:`Updated`});return}n.protocol===void 0&&(n.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=a({argo_smart_routing:n[`argo-smart-routing`],dns:{name:l(n[`dns-name`],`dns-name`,`text`),type:l(n[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:l(n[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:l(n[`edge-ips-type`],`edge-ips-type`,`text`),ips:n[`edge-ips-ips`]},ip_firewall:n[`ip-firewall`],origin_direct:n[`origin-direct`],origin_dns:{name:l(n[`origin-dns-name`],`origin-dns-name`,`text`),ttl:n[`origin-dns-ttl`],type:l(n[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:l(n.protocol,`protocol`,`text`),proxy_protocol:l(n[`proxy-protocol`],`proxy-protocol`,`text`),tls:l(n.tls,`tls`,`text`),traffic_type:l(n[`traffic-type`],`traffic-type`,`text`),virtual_network_id:l(n[`virtual-network-id`],`virtual-network-id`,`text`)});o(await c(`Updating`,async()=>u.spectrum.apps.update({body:f,zone_id:d,app_id:n[`app-id`]})),{successLabel:`Updated`})}},N={command:`apps`,describe:`Operations for apps`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`spectrum`,describe:`Proxy and protect arbitrary TCP/UDP applications through Cloudflare's network with DDoS mitigation`,builder:e=>e.command(S).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
63
+ Notes: Only available for TCP applications.`}).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`]}).option(`tls`,{type:`string`,description:`The type of TLS termination associated with the application.`,choices:[`off`,`flexible`,`full`,`strict`]}).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`]}).option(`virtual-network-id`,{type:`string`,description:`Optional UUID of a virtual network for routing origin traffic through tunnel virtual networks.`}).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`])}const M={command:`update <app-id>`,describe:`Updates a previously existing application's configuration that uses a name for the origin.`,builder:j,handler:async l=>{if(l.dryRun){a({command:`cf spectrum apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/spectrum/apps/${l[`app-id`]==null?`<app-id>`:encodeURIComponent(String(l[`app-id`]))}`,pathParams:{"app-id":String(l[`app-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({argo_smart_routing:l[`argo-smart-routing`],dns:{name:s(l[`dns-name`],`dns-name`,`text`),type:s(l[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:s(l[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:s(l[`edge-ips-type`],`edge-ips-type`,`text`),ips:l[`edge-ips-ips`]},ip_firewall:l[`ip-firewall`],origin_direct:l[`origin-direct`],origin_dns:{name:s(l[`origin-dns-name`],`origin-dns-name`,`text`),ttl:l[`origin-dns-ttl`],type:s(l[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:s(l.protocol,`protocol`,`text`),proxy_protocol:s(l[`proxy-protocol`],`proxy-protocol`,`text`),tls:s(l.tls,`tls`,`text`),traffic_type:s(l[`traffic-type`],`traffic-type`,`text`),virtual_network_id:s(l[`virtual-network-id`],`virtual-network-id`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.spectrum.apps.update({body:e,zone_id:d,app_id:l[`app-id`]})),{successLabel:`Updated`});return}l.protocol===void 0&&(l.protocol=await c(`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=r({argo_smart_routing:l[`argo-smart-routing`],dns:{name:s(l[`dns-name`],`dns-name`,`text`),type:s(l[`dns-type`],`dns-type`,`text`)},edge_ips:{connectivity:s(l[`edge-ips-connectivity`],`edge-ips-connectivity`,`text`),type:s(l[`edge-ips-type`],`edge-ips-type`,`text`),ips:l[`edge-ips-ips`]},ip_firewall:l[`ip-firewall`],origin_direct:l[`origin-direct`],origin_dns:{name:s(l[`origin-dns-name`],`origin-dns-name`,`text`),ttl:l[`origin-dns-ttl`],type:s(l[`origin-dns-type`],`origin-dns-type`,`text`)},protocol:s(l.protocol,`protocol`,`text`),proxy_protocol:s(l[`proxy-protocol`],`proxy-protocol`,`text`),tls:s(l.tls,`tls`,`text`),traffic_type:s(l[`traffic-type`],`traffic-type`,`text`),virtual_network_id:s(l[`virtual-network-id`],`virtual-network-id`,`text`)});i(await o(`Updating`,async()=>u.spectrum.apps.update({body:f,zone_id:d,app_id:l[`app-id`]})),{successLabel:`Updated`})}},N={command:`apps`,describe:`Operations for apps`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`spectrum`,describe:`Proxy and protect arbitrary TCP/UDP applications through Cloudflare's network with DDoS mitigation`,builder:e=>e.command(S).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n}from"./body-parser-DWSy7uZ8.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-CL8I-7YK.mjs";import{t as o}from"./prompt-q3B7sM2A.mjs";import{t as s}from"./cli-types-DGgEbf8K.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Retrieves quota for all plans, as well as the current zone quota.`,builder:c,handler:async n=>{if(n.dryRun){i({command:`cf speed availabilities list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/availabilities`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(n),s=await e({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await a(`Loading`,async()=>o.speed.availabilities.list({zone_id:s})),{successLabel:`Loaded`})}},u={command:`availabilities`,describe:`Operations for availabilities`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`list`,describe:`Lists all webpages which have been tested.`,builder:d,handler:async n=>{if(n.dryRun){i({command:`cf speed pages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/pages`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(n),s=await e({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await a(`Loading`,async()=>o.speed.pages.list({zone_id:s})),{successLabel:`Loaded`})}};function p(e){return 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)`})}const m={command:`create <url>`,describe:`Starts a test for a specific webpage, in a specific region.`,builder:p,handler:async o=>{if(o.dryRun){i({command:`cf speed pages tests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/speed_api/pages/${o.url==null?`<url>`:encodeURIComponent(String(o.url))}/tests`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``),url:String(o.url??``)},bodyKind:`json`,body:o.body===void 0?void 0:n(o.body)});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,o.body){let e=n(o.body);r(await a(`Creating`,async()=>s.speed.pages.tests.create({...e,zone_id:c,url:o.url})),{successLabel:`Created`});return}r(await a(`Creating`,async()=>s.speed.pages.tests.create({zone_id:c,url:o.url})),{successLabel:`Created`})}};function h(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <url>`,describe:`Deletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.`,builder:s(h),handler:async n=>{let s={region:n.region};if(n.dryRun){i({command:`cf speed pages tests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/pages/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}/tests`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:s,bodyKind:`none`});return}let c=await t(n),l=await e({zone:n.zone},c,{quiet:n.quiet});if(n.zoneId=l,!await o({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}r(await a(`Deleting`,async()=>c.speed.pages.tests.delete({zone_id:l,url:n.url,...s})),{successLabel:`Deleted`})}};function _(e){return e.positional(`test-id`,{type:`string`,description:`Test ID`,demandOption:!0}).option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <test-id>`,describe:`Retrieves the result of a specific test.`,builder:_,handler:async n=>{if(n.dryRun){i({command:`cf speed pages tests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/pages/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}/tests/${n[`test-id`]==null?`<test-id>`:encodeURIComponent(String(n[`test-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``),"test-id":String(n[`test-id`]??``)},bodyKind:`none`});return}let o=await t(n),s=await e({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await a(`Loading`,async()=>o.speed.pages.tests.get({zone_id:s,url:n.url,test_id:n[`test-id`]})),{successLabel:`Loaded`})}};function y(e){return 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:`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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Test history (list of tests) for a specific webpage.`,builder:s(y),handler:async n=>{let o={page:n.page,per_page:n[`per-page`],region:n.region};if(n.dryRun){i({command:`cf speed pages tests list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/pages/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}/tests`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:o,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,r(await a(`Loading`,async()=>s.speed.pages.tests.list({zone_id:c,url:n.url,...o})),{successLabel:`Loaded`})}},x={command:`tests`,describe:`Operations for pages.tests`,builder:e=>e.command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return 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}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`trend <url>`,describe:`Lists the core web vital metrics trend over time for a specific page.`,builder:s(S),handler:async n=>{let o={region:n.region,deviceType:n[`device-type`],start:n.start,end:n.end,tz:n.tz,metrics:n.metrics};if(n.dryRun){i({command:`cf speed pages trend`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/pages/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}/trend`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:o,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,r(await a(`Loading`,async()=>s.speed.pages.trend({zone_id:c,url:n.url,...o})),{successLabel:`Loaded`})}},w={command:`pages`,describe:`Operations for pages`,builder:e=>e.command(f).command(C).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return 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`]}).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})}const E={command:`create <url>`,describe:`Creates a scheduled test for a page.`,builder:s(T),handler:async n=>{let o={region:n.region,frequency:n.frequency};if(n.dryRun){i({command:`cf speed schedule create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/schedule/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:o,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,r(await a(`Creating`,async()=>s.speed.schedule.create({zone_id:c,url:n.url,...o})),{successLabel:`Created`})}};function D(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const O={command:`delete <url>`,describe:`Deletes a scheduled test for a page.`,builder:s(D),handler:async n=>{let s={region:n.region};if(n.dryRun){i({command:`cf speed schedule delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/schedule/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:s,bodyKind:`none`});return}let c=await t(n),l=await e({zone:n.zone},c,{quiet:n.quiet});if(n.zoneId=l,!await o({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}r(await a(`Deleting`,async()=>c.speed.schedule.delete({zone_id:l,url:n.url,...s})),{successLabel:`Deleted`})}};function k(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <url>`,describe:`Retrieves the test schedule for a page in a specific region.`,builder:s(k),handler:async n=>{let o={region:n.region};if(n.dryRun){i({command:`cf speed schedule get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/speed_api/schedule/${n.url==null?`<url>`:encodeURIComponent(String(n.url))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),url:String(n.url??``)},query:o,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,r(await a(`Loading`,async()=>s.speed.schedule.get({zone_id:c,url:n.url,...o})),{successLabel:`Loaded`})}},j={command:`schedule`,describe:`Operations for schedule`,builder:e=>e.command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`speed`,describe:`speed`,builder:e=>e.command(u).command(w).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};