cf 0.2.0 → 0.4.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 (278) hide show
  1. package/dist/_meta/agent-context.json +76 -70
  2. package/dist/_meta/commands.json +47761 -55490
  3. package/dist/_meta/schemas.json +31106 -34818
  4. package/dist/abuse-reports-Dy76QPNP.mjs +8 -0
  5. package/dist/accounts-CjtZ8x1z.mjs +22 -0
  6. package/dist/acm-C2lYIWs1.mjs +3 -0
  7. package/dist/addressing-CHFK6uxW.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-CgGCT0xU.mjs} +1 -1
  9. package/dist/ai-DS3i-I1a.mjs +2 -0
  10. package/dist/ai-gateway-RIsegO2x.mjs +8 -0
  11. package/dist/ai-search-Dcj4BauG.mjs +7 -0
  12. package/dist/ai_gateway-w7YwfcPE.mjs +4 -0
  13. package/dist/alerting-Bk85NNf5.mjs +6 -0
  14. package/dist/analytics-CkhhhZWZ.mjs +20 -0
  15. package/dist/analytics_engine-B7qgDJCA.mjs +2 -0
  16. package/dist/api-gateway-CWdR4Ne7.mjs +33 -0
  17. package/dist/argo-DnJRVnGX.mjs +2 -0
  18. package/dist/artifacts-BVWKiJUl.mjs +4 -0
  19. package/dist/audit-logs-DjTstbzL.mjs +2 -0
  20. package/dist/auth-BqDOIrKX.mjs +150 -0
  21. package/dist/auth-DKkSwnxh.mjs +5 -0
  22. package/dist/billing-3rEqF83h.mjs +2 -0
  23. package/dist/body-parser-CBpeIUns.mjs +2 -0
  24. package/dist/bot-management-CJxD1pqi.mjs +5 -0
  25. package/dist/botnet-feed-MG91D7BR.mjs +3 -0
  26. package/dist/brand-protection-CK7gJi06.mjs +3 -0
  27. package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
  28. package/dist/{build-5jmmOZhm.mjs → build-BE4o4imx.mjs} +131 -131
  29. package/dist/cache-B7pRbpTy.mjs +5 -0
  30. package/dist/calls-DXRWsZ8n.mjs +4 -0
  31. package/dist/certificate-authorities-BR3gXBLs.mjs +2 -0
  32. package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
  33. package/dist/cli-types-CMNMD1V7.mjs +2 -0
  34. package/dist/client-certificates-B0ebLJdk.mjs +3 -0
  35. package/dist/cloud-connector-BOjaggJk.mjs +2 -0
  36. package/dist/cloudforce-one-B6HYfk5Z.mjs +21 -0
  37. package/dist/{completions-BKrxcfhN.mjs → completions-D_9WsLG7.mjs} +1 -1
  38. package/dist/config-7CBz8Xm0.mjs +2 -0
  39. package/dist/connectivity-welFvZ7X.mjs +3 -0
  40. package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
  41. package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
  42. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
  43. package/dist/connectors-3vjrdFLB.mjs +3 -0
  44. package/dist/content-scanning-CnW2A0pv.mjs +4 -0
  45. package/dist/context-CONbNKO-.mjs +2 -0
  46. package/dist/custom-certificates-CnYh6Yi-.mjs +5 -0
  47. package/dist/custom-hostnames-C2upqZso.mjs +5 -0
  48. package/dist/custom-nameservers-BGkAD_PZ.mjs +3 -0
  49. package/dist/custom-pages-5fCSP8in.mjs +4 -0
  50. package/dist/d1-CyiRbZZn.mjs +4 -0
  51. package/dist/data-security-Casx4OS_.mjs +6 -0
  52. package/dist/dcv-delegation-DVYO10oA.mjs +2 -0
  53. package/dist/{deploy-DbkiIzUr.mjs → deploy-KBRFIatG.mjs} +1 -1
  54. package/dist/{dev-C6iSuQZm.mjs → dev-pPazzZvt.mjs} +1 -1
  55. package/dist/diagnostics-BqYDoDfw.mjs +3 -0
  56. package/dist/dispatch-namespaces-Cz2rajnP.mjs +7 -0
  57. package/dist/{dist-CnSubA1Z.mjs → dist-DA54ZQu0.mjs} +1 -1
  58. package/dist/dist-DpDjsWWn.mjs +306 -0
  59. package/dist/dns-62t95Xif.mjs +29 -0
  60. package/dist/dns-firewall-Coy8d47t.mjs +57 -0
  61. package/dist/durable-objects-BSuRERkw.mjs +2 -0
  62. package/dist/email-routing-BDUYYeV3.mjs +10 -0
  63. package/dist/email-security-ChHA6eqQ.mjs +8 -0
  64. package/dist/email-sending-CVrRqn6S.mjs +3 -0
  65. package/dist/filters-qJpU9uAS.mjs +4 -0
  66. package/dist/firewall-C3DDwfwh.mjs +11 -0
  67. package/dist/fraud-DY3YXFVf.mjs +20 -0
  68. package/dist/google-tag-gateway-B00MHDfB.mjs +2 -0
  69. package/dist/healthchecks-Drvb79v0.mjs +4 -0
  70. package/dist/hostnames-BdAQo1Mr.mjs +3 -0
  71. package/dist/hyperdrive-99OJV9nl.mjs +18 -0
  72. package/dist/iam-BRbpg3lN.mjs +6 -0
  73. package/dist/images-D1jI3r3O.mjs +7 -0
  74. package/dist/index.mjs +1 -1
  75. package/dist/intel-C3ajLpXd.mjs +3 -0
  76. package/dist/{ips-B8fwxKZD.mjs → ips-B6JETVOY.mjs} +1 -1
  77. package/dist/keyless-certificates-C4MZ4xnf.mjs +3 -0
  78. package/dist/kv-CSWoD9ks.mjs +5 -0
  79. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +3 -0
  80. package/dist/load-balancers-Du1tNuUt.mjs +6 -0
  81. package/dist/logpush-SuJyO-uX.mjs +4 -0
  82. package/dist/logs-DcDNRPRl.mjs +3 -0
  83. package/dist/magic-cloud-networking-D-T0RCvi.mjs +5 -0
  84. package/dist/magic-network-monitoring-CqtvOePQ.mjs +4 -0
  85. package/dist/magic-transit-BTbkhBtF.mjs +89 -0
  86. package/dist/managed-transforms-CfUBSz9p.mjs +3 -0
  87. package/dist/mtls-certificates-Cf1O8c2E.mjs +3 -0
  88. package/dist/network-interconnects-DsiNytOU.mjs +36 -0
  89. package/dist/observability-CLqZ7OSi.mjs +4 -0
  90. package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
  91. package/dist/organizations-aRi1bhFC.mjs +41 -0
  92. package/dist/origin-ca-certificates-BB4H89a_.mjs +3 -0
  93. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +2 -0
  94. package/dist/origin-tls-client-auth-CnQNy9-l.mjs +4 -0
  95. package/dist/output-CUxZRM5A.mjs +2 -0
  96. package/dist/page-rules-CYqtPU1p.mjs +18 -0
  97. package/dist/page-shield-D8l9ZMUl.mjs +37 -0
  98. package/dist/pages-ChurJ2H7.mjs +11 -0
  99. package/dist/pipelines-CeyujvRf.mjs +6 -0
  100. package/dist/{progress-CjcQ6ato.mjs → progress-Cent9Lsg.mjs} +1 -1
  101. package/dist/queues-Rf_n11Cx.mjs +6 -0
  102. package/dist/r2-BtuTO3vQ.mjs +21 -0
  103. package/dist/r2-data-catalog-Debz38kv.mjs +14 -0
  104. package/dist/radar-CzGM92uM.mjs +2 -0
  105. package/dist/rate-limits-Bbk7HxP7.mjs +5 -0
  106. package/dist/raw-fetch-DnbAMFBp.mjs +2 -0
  107. package/dist/realtime-kit-CivLpkpg.mjs +18 -0
  108. package/dist/registrar-8IeA5DKd.mjs +46 -0
  109. package/dist/request-tracers-D1aH4NmL.mjs +2 -0
  110. package/dist/{resolve-BuJRWSk0.mjs → resolve-D1mG0REg.mjs} +1 -1
  111. package/dist/resource-sharing-B-Pcto7-.mjs +5 -0
  112. package/dist/resource-tagging-Bpb6Qq1M.mjs +16 -0
  113. package/dist/rules-B10XWY10.mjs +4 -0
  114. package/dist/rulesets-lYczEcJp.mjs +8 -0
  115. package/dist/rum-B5GUKa4I.mjs +4 -0
  116. package/dist/{schema-CHBfkARI.mjs → schema-hefO-tzo.mjs} +1 -1
  117. package/dist/schema-validation-DTq517Em.mjs +24 -0
  118. package/dist/scim-BiLfOQ89.mjs +3 -0
  119. package/dist/secrets-store-CBX0dvHL.mjs +25 -0
  120. package/dist/security-center-AVpTOBK3.mjs +2 -0
  121. package/dist/security-txt-DVlh8y9l.mjs +3 -0
  122. package/dist/session-CsvPYFj8.mjs +5 -0
  123. package/dist/shared-0bwWVDLo.mjs +2 -0
  124. package/dist/smart-shield-DblHIce0.mjs +3 -0
  125. package/dist/snippets-DrpqSXYC.mjs +4 -0
  126. package/dist/{spawn-13QQ0IwO.mjs → spawn-DK7pott_.mjs} +1 -1
  127. package/dist/spectrum-CnrG0jIC.mjs +63 -0
  128. package/dist/speed-BzRY3Xlh.mjs +4 -0
  129. package/dist/{src-B9cKsgsg.mjs → src-D9_Gq68b.mjs} +12 -12
  130. package/dist/ssl-Cp6tQkZH.mjs +15 -0
  131. package/dist/stream-CGTRN4ZN.mjs +14 -0
  132. package/dist/tenants-o_M62Y1n.mjs +2 -0
  133. package/dist/token-validation-Ca5AGEns.mjs +10 -0
  134. package/dist/{tools-B7QiNu-d.mjs → tools-DtNNmO6l.mjs} +1 -1
  135. package/dist/turnstile-l7mo9BWL.mjs +23 -0
  136. package/dist/{ui-BXjU1dX1.mjs → ui-B97lRnOv.mjs} +1 -1
  137. package/dist/url-normalization-D1CogSIG.mjs +3 -0
  138. package/dist/url-scanner-BnJHJqcz.mjs +2 -0
  139. package/dist/user-CiyYZ69X.mjs +10 -0
  140. package/dist/vectorize-D3LgMLOn.mjs +4 -0
  141. package/dist/{versions-DzyrlUAi.mjs → versions-B6E8WQyA.mjs} +1 -1
  142. package/dist/waiting-rooms-Bhy_nuV3.mjs +11 -0
  143. package/dist/web3-DlHE0CZc.mjs +4 -0
  144. package/dist/workers-DRAkU6YR.mjs +18 -0
  145. package/dist/workers-builds-BmNjiHDZ.mjs +7 -0
  146. package/dist/workflows-z6oapEJs.mjs +4 -0
  147. package/dist/zaraz-CyzfYOEU.mjs +2 -0
  148. package/dist/zero-trust-fyyIelWx.mjs +118 -0
  149. package/dist/zero_trust-BAhlNkjo.mjs +3 -0
  150. package/dist/zones-MSULnDwW.mjs +21 -0
  151. package/package.json +7 -6
  152. package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
  153. package/dist/accounts-BopMfODC.mjs +0 -21
  154. package/dist/acm-BT4vlnEJ.mjs +0 -3
  155. package/dist/addressing-B3uFxHst.mjs +0 -13
  156. package/dist/ai-DWHqwMap.mjs +0 -2
  157. package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
  158. package/dist/ai-search-VnOQ5n--.mjs +0 -7
  159. package/dist/alerting-BmmgIlIO.mjs +0 -6
  160. package/dist/analytics-isY03taL.mjs +0 -20
  161. package/dist/api-gateway-DXurEbA-.mjs +0 -33
  162. package/dist/argo-B02BL_hp.mjs +0 -2
  163. package/dist/audit-logs-DcgR9xUc.mjs +0 -2
  164. package/dist/auth-CQcAgnOy.mjs +0 -135
  165. package/dist/auth-DenWm_X0.mjs +0 -6
  166. package/dist/autorag-CmrwnGVj.mjs +0 -2
  167. package/dist/billing-CaW1ZAB1.mjs +0 -2
  168. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  169. package/dist/bot-management-CeBsFx68.mjs +0 -5
  170. package/dist/botnet-feed-B396vQeQ.mjs +0 -3
  171. package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
  172. package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
  173. package/dist/builds-C_ySULja.mjs +0 -2
  174. package/dist/cache-DmXizSMi.mjs +0 -5
  175. package/dist/calls-x4KQpTB4.mjs +0 -4
  176. package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
  177. package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
  178. package/dist/cloud-connector-BClQpEzI.mjs +0 -2
  179. package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
  180. package/dist/config-DYzlVxcB.mjs +0 -2
  181. package/dist/connectivity-G0NP6LtW.mjs +0 -3
  182. package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
  183. package/dist/context-CC0Rhkhy.mjs +0 -2
  184. package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
  185. package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
  186. package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
  187. package/dist/custom-pages-D-oErw57.mjs +0 -4
  188. package/dist/d1-C95ckPKI.mjs +0 -3
  189. package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
  190. package/dist/diagnostics-DEEhPnXj.mjs +0 -3
  191. package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
  192. package/dist/dist-DNBSHor6.mjs +0 -301
  193. package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
  194. package/dist/dns-qW-3TZOT.mjs +0 -29
  195. package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
  196. package/dist/email-routing-tdNJaCpJ.mjs +0 -10
  197. package/dist/email-security-DTVHNr2h.mjs +0 -60
  198. package/dist/email-sending-DsFTvE31.mjs +0 -3
  199. package/dist/filters-DO1Is_tI.mjs +0 -4
  200. package/dist/firewall-DbUhVTCg.mjs +0 -11
  201. package/dist/fraud-Bzr4njYb.mjs +0 -8
  202. package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
  203. package/dist/healthchecks-BBAs-lS_.mjs +0 -4
  204. package/dist/hostnames-Dz9PEUKS.mjs +0 -3
  205. package/dist/hyperdrive-B1iUJddG.mjs +0 -18
  206. package/dist/iam-CJM8gHpG.mjs +0 -6
  207. package/dist/images-DEoBmtFS.mjs +0 -5
  208. package/dist/intel-BM6xkZ0C.mjs +0 -3
  209. package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
  210. package/dist/kv-BTceLtWZ.mjs +0 -5
  211. package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
  212. package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
  213. package/dist/logpush-CSYhgevA.mjs +0 -4
  214. package/dist/logs-DlIwmMpt.mjs +0 -3
  215. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
  216. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
  217. package/dist/magic-transit-qQmA-981.mjs +0 -89
  218. package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
  219. package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
  220. package/dist/network-interconnects-CxG2deY0.mjs +0 -36
  221. package/dist/organizations-DyEAiGiR.mjs +0 -41
  222. package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
  223. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
  224. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
  225. package/dist/output-D7_yAFVR.mjs +0 -2
  226. package/dist/page-rules-DP-w6TAm.mjs +0 -18
  227. package/dist/page-shield-Bf7kFp8c.mjs +0 -37
  228. package/dist/pages-D0Y_XRqW.mjs +0 -10
  229. package/dist/pipelines-C-SPESAk.mjs +0 -6
  230. package/dist/queues-wv6CZsi8.mjs +0 -6
  231. package/dist/r2-DuXjp9n5.mjs +0 -21
  232. package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
  233. package/dist/radar-BW_ZHP8X.mjs +0 -2
  234. package/dist/rate-limits-DLTkIvwr.mjs +0 -5
  235. package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
  236. package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
  237. package/dist/registrar-DIIv6fWd.mjs +0 -46
  238. package/dist/request-tracers-DMej0Drs.mjs +0 -2
  239. package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
  240. package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
  241. package/dist/rules-DLJpOYbC.mjs +0 -4
  242. package/dist/rulesets-D9nqEJT5.mjs +0 -8
  243. package/dist/rum-DBVmdPkp.mjs +0 -4
  244. package/dist/schema-validation-MCd3xdtX.mjs +0 -4
  245. package/dist/scim-DZA3VXog.mjs +0 -3
  246. package/dist/scm-CilfPOue.mjs +0 -2
  247. package/dist/secrets-store-BrvcZSOM.mjs +0 -21
  248. package/dist/security-center-BU6f3Cm1.mjs +0 -2
  249. package/dist/security-txt-BPIbP3dG.mjs +0 -3
  250. package/dist/session-H7IV2BrM.mjs +0 -2
  251. package/dist/shared-DEzmTsEC.mjs +0 -2
  252. package/dist/smart-shield-e8XFBkiF.mjs +0 -3
  253. package/dist/snippets-B4M3MMb8.mjs +0 -4
  254. package/dist/spectrum-B0adfSRI.mjs +0 -59
  255. package/dist/speed-BVcUtkAz.mjs +0 -4
  256. package/dist/ssl-BAa91gsc.mjs +0 -15
  257. package/dist/stream-D53sxKb3.mjs +0 -14
  258. package/dist/tenants-bH5pt3dJ.mjs +0 -2
  259. package/dist/token-validation-M61Vx_Tw.mjs +0 -4
  260. package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
  261. package/dist/url-normalization-DZrWDgB5.mjs +0 -3
  262. package/dist/url-scanner-Zo49edNp.mjs +0 -2
  263. package/dist/user-DbXlVReB.mjs +0 -10
  264. package/dist/vectorize-CUnTM0DT.mjs +0 -4
  265. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  266. package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
  267. package/dist/web3-DueyOQtx.mjs +0 -4
  268. package/dist/workers-builds-BM_aoeUR.mjs +0 -7
  269. package/dist/workers-nV_vBCfV.mjs +0 -16
  270. package/dist/workflows-CQITmo-s.mjs +0 -4
  271. package/dist/zaraz-DIbpF5Op.mjs +0 -2
  272. package/dist/zero-trust-CKp8j512.mjs +0 -119
  273. package/dist/zones-BZ5tZDbH.mjs +0 -28
  274. /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
  275. /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
  276. /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
  277. /package/dist/{metadata-DGdCpUxn.mjs → metadata-jh2EIan8.mjs} +0 -0
  278. /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,n}from"./auth-BqDOIrKX.mjs";import{n as r}from"./body-parser-CBpeIUns.mjs";import{t as i}from"./output-CUxZRM5A.mjs";import{n as a,t as o}from"./progress-Cent9Lsg.mjs";function s(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 c={command:`delete`,describe:`Disables all Managed Transforms.`,builder:s,handler:async r=>{if(r.dryRun){a({command:`cf managed-transforms delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/managed_headers`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`none`});return}let s=await n(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await t({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>s.managedTransforms.delete({zone_id:c})),{successLabel:`Deleted`})}};function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A Managed Transforms patch object. Both fields are optional; only the sections provided will be updated.`})}const u={command:`edit`,describe:`Updates the status of one or more Managed Transforms.`,builder:l,handler:async t=>{if(t.dryRun){a({command:`cf managed-transforms edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/managed_headers`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:r(t.body)});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});if(t.zoneId=c,t.body){let e=r(t.body);i(await o(`Updating`,async()=>s.managedTransforms.edit({...e,zone_id:c})),{successLabel:`Updated`});return}i(await o(`Updating`,async()=>s.managedTransforms.edit({zone_id:c})),{successLabel:`Updated`})}};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:`Fetches a list of all Managed Transforms.`,builder:d,handler:async t=>{if(t.dryRun){a({command:`cf managed-transforms list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/managed_headers`,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.managedTransforms.list({zone_id:s})),{successLabel:`Loaded`})}},p={command:`managed-transforms`,describe:`Cloudflare-managed HTTP header transforms — automatically add security headers, remove server info, etc.`,builder:e=>e.command(c).command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";import{t as f}from"./cli-types-CMNMD1V7.mjs";function p(e){return e.positional(`mtls-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <mtls-certificate-id>`,describe:`Lists all active associations between the certificate and Cloudflare services.`,builder:p,handler:async t=>{if(t.dryRun){c({command:`cf mtls-certificates associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mtls_certificates/${t[`mtls-certificate-id`]==null?`<mtls-certificate-id>`:encodeURIComponent(String(t[`mtls-certificate-id`]))}/associations`,pathParams:{"mtls-certificate-id":String(t[`mtls-certificate-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.mtlsCertificates.associations.get({account_id:a,mtls_certificate_id:t[`mtls-certificate-id`]})),{successLabel:`Loaded`})}},h={command:`associations`,describe:`Operations for associations`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`ca`,{type:`boolean`,description:`Indicates whether the certificate is a CA or leaf certificate.`}).option(`certificates`,{type:`string`,description:`The uploaded root CA certificate.`}).option(`name`,{type:`string`,description:`Optional unique name for the certificate. Only used for human readability.`}).option(`private-key`,{type:`string`,description:`The private key for the certificate. This field is only needed for specific use cases such as using a custom certificate with Zero Trust's block page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`create`,describe:`Upload a certificate that you want to use with mTLS-enabled Cloudflare services, such as Bring Your Own CA (BYO-CA) for mTLS. To create certificates issued by the Cloudflare managed CA, use the [Create Client Certificate endpoint](/api/resources/client_certificates/methods/create/).`,builder:g,handler:async n=>{if(n.dryRun){c({command:`cf mtls-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mtls_certificates`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({ca:n.ca,certificates:u(n.certificates,`certificates`,`text`),name:u(n.name,`name`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.mtlsCertificates.create({...e,account_id:p})),{successLabel:`Created`});return}if(n.ca===void 0)throw Error(`--ca is required (or pass --body with this field set).`);n.certificates===void 0&&(n.certificates=await t(`certificates`,`The uploaded root CA certificate.`));let m=o({ca:n.ca,certificates:u(n.certificates,`certificates`,`text`),name:u(n.name,`name`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)});s(await l(`Creating`,async()=>f.mtlsCertificates.create({...m,account_id:p})),{successLabel:`Created`})}};function v(e){return e.positional(`mtls-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const y={command:`delete <mtls-certificate-id>`,describe:`Deletes the mTLS certificate unless the certificate is in use by one or more Cloudflare services.`,builder:v,handler:async t=>{if(t.dryRun){c({command:`cf mtls-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mtls_certificates/${t[`mtls-certificate-id`]==null?`<mtls-certificate-id>`:encodeURIComponent(String(t[`mtls-certificate-id`]))}`,pathParams:{"mtls-certificate-id":String(t[`mtls-certificate-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>a.mtlsCertificates.delete({account_id:o,mtls_certificate_id:t[`mtls-certificate-id`]})),{successLabel:`Deleted`})}};function b(e){return e.positional(`mtls-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <mtls-certificate-id>`,describe:`Fetches a single mTLS certificate uploaded to your account. To get a certificate issued by the Cloudflare managed CA, use the [Client Certificate Details endpoint](/api/resources/client_certificates/methods/get/).`,builder:b,handler:async t=>{if(t.dryRun){c({command:`cf mtls-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mtls_certificates/${t[`mtls-certificate-id`]==null?`<mtls-certificate-id>`:encodeURIComponent(String(t[`mtls-certificate-id`]))}`,pathParams:{"mtls-certificate-id":String(t[`mtls-certificate-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.mtlsCertificates.get({account_id:a,mtls_certificate_id:t[`mtls-certificate-id`]})),{successLabel:`Loaded`})}};function S(e){return e.option(`type`,{type:`string`,description:`Filters results by certificate type. Multiple types can be comma-separated.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`list`,describe:`Lists all mTLS certificates uploaded to your account, such as Bring Your Own CA (BYO-CA) for mTLS. To list certificates issued by the Cloudflare managed CA, use the [List Client Certificates endpoint](/api/resources/client_certificates/methods/list/).`,builder:f(S),handler:async t=>{let n={type:t.type};if(t.dryRun){c({command:`cf mtls-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mtls_certificates`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.mtlsCertificates.list({account_id:o,...n})),{successLabel:`Loaded`})}},w={command:`mtls-certificates`,describe:`Upload and manage mTLS certificates used by API Shield, Workers, and Gateway for client authentication`,builder:e=>e.command(_).command(y).command(x).command(C).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";function f(e){return e.option(`account`,{type:`string`,description:`Customer account tag`}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Extra set of static prefixes to advertise to the customer's end of the session`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
3
+
4
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
5
+ key is not treated as a secret value. This is *only* supported for preventing
6
+ misconfiguration, not for defending against malicious attacks.
7
+
8
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
9
+ character:
10
+
11
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
12
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
13
+
14
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
15
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
16
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
17
+ these disallowed characters will be rejected.`}).option(`interconnect`,{type:`string`,description:`The interconnect field`}).option(`magic-conduit-name`,{type:`string`,description:`The magic.conduit_name field`}).option(`magic-description`,{type:`string`,description:`The magic.description field`}).option(`magic-mtu`,{type:`number`,description:`The magic.mtu field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5-key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`,`bgp-extra-prefixes`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const p={command:`create`,describe:`Create a new CNI object`,builder:f,handler:async n=>{if(n.dryRun){c({command:`cf network-interconnects cnis create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/cnis`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({account:u(n.account,`account`,`text`),bgp:{customer_asn:n[`bgp-customer-asn`],extra_prefixes:n[`bgp-extra-prefixes`],md5_key:u(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},interconnect:u(n.interconnect,`interconnect`,`text`),magic:{conduit_name:u(n[`magic-conduit-name`],`magic-conduit-name`,`text`),description:u(n[`magic-description`],`magic-description`,`text`),mtu:n[`magic-mtu`]}}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.networkInterconnects.cnis.create({...e,account_id:p})),{successLabel:`Created`});return}if(n.account===void 0&&(n.account=await t(`account`,`Customer account tag`)),n.interconnect===void 0&&(n.interconnect=await t(`interconnect`,`The interconnect field`)),n[`magic-conduit-name`]===void 0&&(n[`magic-conduit-name`]=await t(`magic-conduit-name`,`The magic.conduit_name field`)),n[`magic-description`]===void 0&&(n[`magic-description`]=await t(`magic-description`,`The magic.description field`)),n[`magic-mtu`]===void 0)throw Error(`--magic-mtu is required (or pass --body with this field set).`);let m=o({account:u(n.account,`account`,`text`),bgp:{customer_asn:n[`bgp-customer-asn`],extra_prefixes:n[`bgp-extra-prefixes`],md5_key:u(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},interconnect:u(n.interconnect,`interconnect`,`text`),magic:{conduit_name:u(n[`magic-conduit-name`],`magic-conduit-name`,`text`),description:u(n[`magic-description`],`magic-description`,`text`),mtu:n[`magic-mtu`]}});s(await l(`Creating`,async()=>f.networkInterconnects.cnis.create({...m,account_id:p})),{successLabel:`Created`})}};function m(e){return e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,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 h={command:`delete <cni>`,describe:`Delete a specified CNI object`,builder:m,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects cnis delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/cnis/${t.cni==null?`<cni>`:encodeURIComponent(String(t.cni))}`,pathParams:{cni:String(t.cni??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
18
+ `);return}s(await l(`Deleting`,async()=>a.networkInterconnects.cnis.delete({account_id:o,cni:t.cni})),{successLabel:`Deleted`})}};function g(e){return e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <cni>`,describe:`Get information about a CNI object`,builder:g,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects cnis get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/cnis/${t.cni==null?`<cni>`:encodeURIComponent(String(t.cni))}`,pathParams:{cni:String(t.cni??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.cnis.get({account_id:a,cni:t.cni})),{successLabel:`Loaded`})}};function v(e){return e.option(`slot`,{type:`string`,description:`If specified, only show CNIs associated with the specified slot`}).option(`tunnel-id`,{type:`string`,description:`If specified, only show cnis associated with the specified tunnel id`}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List existing CNI objects`,builder:v,handler:async t=>{let n={slot:t.slot,tunnel_id:t[`tunnel-id`],cursor:t.cursor,limit:t.limit};if(t.dryRun){c({command:`cf network-interconnects cnis list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/cnis`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.networkInterconnects.cnis.list({account_id:o,...n})),{successLabel:`Loaded`})}};function b(e){return e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,demandOption:!0}).option(`account`,{type:`string`,description:`Customer account tag`}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Extra set of static prefixes to advertise to the customer's end of the session`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
19
+
20
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
21
+ key is not treated as a secret value. This is *only* supported for preventing
22
+ misconfiguration, not for defending against malicious attacks.
23
+
24
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
25
+ character:
26
+
27
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
28
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
29
+
30
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
31
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
32
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
33
+ these disallowed characters will be rejected.`}).option(`cust-ip`,{type:`string`,description:`Customer end of the point-to-point link
34
+
35
+ This should always be inside the same prefix as \`p2p_ip\`.`}).option(`id`,{type:`string`,description:`The id field`}).option(`interconnect`,{type:`string`,description:`Interconnect identifier hosting this CNI`}).option(`magic-conduit-name`,{type:`string`,description:`The magic.conduit_name field`}).option(`magic-description`,{type:`string`,description:`The magic.description field`}).option(`magic-mtu`,{type:`number`,description:`The magic.mtu field`}).option(`p2p-ip`,{type:`string`,description:`Cloudflare end of the point-to-point link`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5-key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`,`bgp-extra-prefixes`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const x={command:`update <cni>`,describe:`Modify stored information about a CNI object`,builder:b,handler:async n=>{if(n.dryRun){c({command:`cf network-interconnects cnis update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/cnis/${n.cni==null?`<cni>`:encodeURIComponent(String(n.cni))}`,pathParams:{cni:String(n.cni??``)},bodyKind:`json`,body:n.body===void 0?o({account:u(n.account,`account`,`text`),bgp:{customer_asn:n[`bgp-customer-asn`],extra_prefixes:n[`bgp-extra-prefixes`],md5_key:u(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},cust_ip:u(n[`cust-ip`],`cust-ip`,`text`),id:u(n.id,`id`,`text`),interconnect:u(n.interconnect,`interconnect`,`text`),magic:{conduit_name:u(n[`magic-conduit-name`],`magic-conduit-name`,`text`),description:u(n[`magic-description`],`magic-description`,`text`),mtu:n[`magic-mtu`]},p2p_ip:u(n[`p2p-ip`],`p2p-ip`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Updating`,async()=>f.networkInterconnects.cnis.update({body:e,account_id:p,cni:n.cni})),{successLabel:`Updated`});return}if(n.account===void 0&&(n.account=await t(`account`,`Customer account tag`)),n[`cust-ip`]===void 0&&(n[`cust-ip`]=await t(`cust-ip`,"Customer end of the point-to-point link This should always be inside the same prefix as `p2p_ip`.")),n.id===void 0&&(n.id=await t(`id`,`The id field`)),n.interconnect===void 0&&(n.interconnect=await t(`interconnect`,`Interconnect identifier hosting this CNI`)),n[`magic-conduit-name`]===void 0&&(n[`magic-conduit-name`]=await t(`magic-conduit-name`,`The magic.conduit_name field`)),n[`magic-description`]===void 0&&(n[`magic-description`]=await t(`magic-description`,`The magic.description field`)),n[`magic-mtu`]===void 0)throw Error(`--magic-mtu is required (or pass --body with this field set).`);n[`p2p-ip`]===void 0&&(n[`p2p-ip`]=await t(`p2p-ip`,`Cloudflare end of the point-to-point link`));let m=o({account:u(n.account,`account`,`text`),bgp:{customer_asn:n[`bgp-customer-asn`],extra_prefixes:n[`bgp-extra-prefixes`],md5_key:u(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},cust_ip:u(n[`cust-ip`],`cust-ip`,`text`),id:u(n.id,`id`,`text`),interconnect:u(n.interconnect,`interconnect`,`text`),magic:{conduit_name:u(n[`magic-conduit-name`],`magic-conduit-name`,`text`),description:u(n[`magic-description`],`magic-description`,`text`),mtu:n[`magic-mtu`]},p2p_ip:u(n[`p2p-ip`],`p2p-ip`,`text`)});s(await l(`Updating`,async()=>f.networkInterconnects.cnis.update({body:m,account_id:p,cni:n.cni})),{successLabel:`Updated`})}},S={command:`cnis`,describe:`Cloud Network Interconnect (CNI) connections — private links from cloud providers to Cloudflare`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`account`,{type:`string`,description:`The account field`}).option(`type`,{type:`string`,description:`The type field`}).option(`slot-id`,{type:`string`,description:`The slot_id field`}).option(`speed`,{type:`string`,description:`The speed field`}).option(`bandwidth`,{type:`string`,description:`Bandwidth structure as visible through the customer-facing API.`,choices:[`50M`,`100M`,`200M`,`300M`,`400M`,`500M`,`1G`,`2G`,`5G`,`10G`,`20G`,`50G`]}).option(`pairing-key`,{type:`string`,description:`Pairing key provided by GCP`}).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(`slot-id`,[`bandwidth`,`pairing-key`]).conflicts(`speed`,[`bandwidth`,`pairing-key`]).conflicts(`bandwidth`,[`slot-id`,`speed`]).implies(`bandwidth`,[`pairing-key`]).conflicts(`pairing-key`,[`slot-id`,`speed`]).implies(`pairing-key`,[`bandwidth`])}const w={command:`create`,describe:`Create a new interconnect`,builder:C,handler:async n=>{if(n.dryRun){c({command:`cf network-interconnects interconnects create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({account:u(n.account,`account`,`text`),type:u(n.type,`type`,`text`),slot_id:u(n[`slot-id`],`slot-id`,`text`),speed:u(n.speed,`speed`,`text`),bandwidth:u(n.bandwidth,`bandwidth`,`text`),pairing_key:u(n[`pairing-key`],`pairing-key`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.networkInterconnects.interconnects.create({body:e,account_id:p})),{successLabel:`Created`});return}n.account===void 0&&(n.account=await t(`account`,`The account field`)),n.type===void 0&&(n.type=await t(`type`,`The type field`));let m=o({account:u(n.account,`account`,`text`),type:u(n.type,`type`,`text`),slot_id:u(n[`slot-id`],`slot-id`,`text`),speed:u(n.speed,`speed`,`text`),bandwidth:u(n.bandwidth,`bandwidth`,`text`),pairing_key:u(n[`pairing-key`],`pairing-key`,`text`)});s(await l(`Creating`,async()=>f.networkInterconnects.interconnects.create({body:m,account_id:p})),{successLabel:`Created`})}};function T(e){return e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,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 <icon>`,describe:`Delete an interconnect object`,builder:T,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects interconnects delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects/${t.icon==null?`<icon>`:encodeURIComponent(String(t.icon))}`,pathParams:{icon:String(t.icon??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
36
+ `);return}s(await l(`Deleting`,async()=>a.networkInterconnects.interconnects.delete({account_id:o,icon:t.icon})),{successLabel:`Deleted`})}};function D(e){return e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <icon>`,describe:`Get information about an interconnect object`,builder:D,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects interconnects get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects/${t.icon==null?`<icon>`:encodeURIComponent(String(t.icon))}`,pathParams:{icon:String(t.icon??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.interconnects.get({account_id:a,icon:t.icon})),{successLabel:`Loaded`})}};function k(e){return e.option(`site`,{type:`string`,description:`If specified, only show interconnects located at the given site`}).option(`type`,{type:`string`,description:`If specified, only show interconnects of the given type`}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`List existing interconnects`,builder:k,handler:async t=>{let n={site:t.site,type:t.type,cursor:t.cursor,limit:t.limit};if(t.dryRun){c({command:`cf network-interconnects interconnects list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.networkInterconnects.interconnects.list({account_id:o,...n})),{successLabel:`Loaded`})}};function j(e){return e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`loa <icon>`,describe:`Generate the Letter of Authorization (LOA) for a given interconnect`,builder:j,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects interconnects loa`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects/${t.icon==null?`<icon>`:encodeURIComponent(String(t.icon))}/loa`,pathParams:{icon:String(t.icon??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.interconnects.loa({account_id:a,icon:t.icon})),{successLabel:`Loaded`})}};function N(e){return e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`status <icon>`,describe:`Get the current status of an interconnect object`,builder:N,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects interconnects status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/interconnects/${t.icon==null?`<icon>`:encodeURIComponent(String(t.icon))}/status`,pathParams:{icon:String(t.icon??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.interconnects.status({account_id:a,icon:t.icon})),{successLabel:`Loaded`})}},F={command:`interconnects`,describe:`Physical cross-connect and partner interconnect sessions with LOA and status tracking`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get`,describe:`Get the current settings for the active account`,builder:I,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/settings`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.settings.get({account_id:a})),{successLabel:`Loaded`})}};function R(e){return e.option(`default-asn`,{type:`number`,description:`The default_asn field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`update`,describe:`Update the current settings for the active account`,builder:R,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/settings`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({default_asn:t[`default-asn`]}):a(t.body)});return}let n=await i(t),u=t.local?d:await r(n);if(t.accountId=u,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.networkInterconnects.settings.update({...e,account_id:u})),{successLabel:`Updated`});return}let f=o({default_asn:t[`default-asn`]});s(await l(`Updating`,async()=>n.networkInterconnects.settings.update({...f,account_id:u})),{successLabel:`Updated`})}},B={command:`settings`,describe:`Account-level interconnect settings and default configurations`,builder:e=>e.command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.positional(`slot`,{type:`string`,description:`Slot`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <slot>`,describe:`Get information about the specified slot`,builder:V,handler:async t=>{if(t.dryRun){c({command:`cf network-interconnects slots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/slots/${t.slot==null?`<slot>`:encodeURIComponent(String(t.slot))}`,pathParams:{slot:String(t.slot??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.networkInterconnects.slots.get({account_id:a,slot:t.slot})),{successLabel:`Loaded`})}};function U(e){return e.option(`address-contains`,{type:`string`,description:`If specified, only show slots with the given text in their address field`}).option(`site`,{type:`string`,description:`If specified, only show slots located at the given site`}).option(`speed`,{type:`string`,description:`If specified, only show slots that support the given speed`}).option(`occupied`,{type:`boolean`,description:`If specified, only show slots with a specific occupied/unoccupied state`}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`Retrieve a list of all slots matching the specified parameters`,builder:U,handler:async t=>{let n={address_contains:t[`address-contains`],site:t.site,speed:t.speed,occupied:t.occupied,cursor:t.cursor,limit:t.limit};if(t.dryRun){c({command:`cf network-interconnects slots list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/cni/slots`,pathParams:{},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.networkInterconnects.slots.list({account_id:o,...n})),{successLabel:`Loaded`})}},G={command:`slots`,describe:`Available interconnect facility slots showing port capacity at Cloudflare data centers`,builder:e=>e.command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`network-interconnects`,describe:`Physical and virtual private interconnects between your infrastructure and Cloudflare's network`,builder:e=>e.command(S).command(F).command(B).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(e){return e.option(`configuration-type`,{type:`string`,description:`The configuration.type field`,choices:[`logpush`]}).option(`configuration-url`,{type:`string`,description:`The configuration.url field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`skip-preflight-check`,{type:`boolean`,description:`The skipPreflightCheck field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create`,describe:`Create a new Workers Observability Telemetry Destination.`,builder:m,handler:async r=>{if(r.dryRun){l({command:`cf observability destinations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/destinations`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({configuration:{type:d(r[`configuration-type`],`configuration-type`,`text`),url:d(r[`configuration-url`],`configuration-url`,`text`)},enabled:r.enabled,name:d(r.name,`name`,`text`),skipPreflightCheck:r[`skip-preflight-check`]}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.observability.destinations.create({...e,account_id:m})),{successLabel:`Created`});return}if(r[`configuration-type`]===void 0&&(r[`configuration-type`]=await n(`configuration-type`,`The configuration.type field`,[`logpush`])),r[`configuration-url`]===void 0&&(r[`configuration-url`]=await t(`configuration-url`,`The configuration.url field`)),r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await t(`name`,`The name field`));let h=s({configuration:{type:d(r[`configuration-type`],`configuration-type`,`text`),url:d(r[`configuration-url`],`configuration-url`,`text`)},enabled:r.enabled,name:d(r.name,`name`,`text`),skipPreflightCheck:r[`skip-preflight-check`]});c(await u(`Creating`,async()=>p.observability.destinations.create({...h,account_id:m})),{successLabel:`Created`})}};function g(e){return e.positional(`slug`,{type:`string`,description:`Slug`,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 _={command:`delete <slug>`,describe:`Delete a Workers Observability Telemetry Destination.`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf observability destinations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/destinations/${t.slug==null?`<slug>`:encodeURIComponent(String(t.slug))}`,pathParams:{slug:String(t.slug??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>n.observability.destinations.delete({account_id:o,slug:t.slug})),{successLabel:`Deleted`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`PerPage`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`order-by`,{type:`string`,description:`OrderBy`,choices:[`created`,`updated`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List your Workers Observability Telemetry Destinations.`,builder:p(v),handler:async t=>{let n={page:t.page,perPage:t[`per-page`],order:t.order,orderBy:t[`order-by`]};if(t.dryRun){l({command:`cf observability destinations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/destinations`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.observability.destinations.list({account_id:o,...n})),{successLabel:`Loaded`})}};function b(e){return e.positional(`slug`,{type:`string`,description:`Slug`,demandOption:!0}).option(`configuration-type`,{type:`string`,description:`The configuration.type field`,choices:[`logpush`]}).option(`configuration-url`,{type:`string`,description:`The configuration.url field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`update <slug>`,describe:`Update an existing Workers Observability Telemetry Destination.`,builder:b,handler:async r=>{if(r.dryRun){l({command:`cf observability destinations update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/destinations/${r.slug==null?`<slug>`:encodeURIComponent(String(r.slug))}`,pathParams:{slug:String(r.slug??``)},bodyKind:`json`,body:r.body===void 0?s({configuration:{type:d(r[`configuration-type`],`configuration-type`,`text`),url:d(r[`configuration-url`],`configuration-url`,`text`)},enabled:r.enabled}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.observability.destinations.update({...e,account_id:m,slug:r.slug})),{successLabel:`Updated`});return}if(r[`configuration-type`]===void 0&&(r[`configuration-type`]=await n(`configuration-type`,`The configuration.type field`,[`logpush`])),r[`configuration-url`]===void 0&&(r[`configuration-url`]=await t(`configuration-url`,`The configuration.url field`)),r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let h=s({configuration:{type:d(r[`configuration-type`],`configuration-type`,`text`),url:d(r[`configuration-url`],`configuration-url`,`text`)},enabled:r.enabled});c(await u(`Updating`,async()=>p.observability.destinations.update({...h,account_id:m,slug:r.slug})),{successLabel:`Updated`})}},S={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`Query name`}).option(`parameters-datasets`,{type:`string`,array:!0,description:`Set the Datasets to query. Leave it empty to query all the datasets.`}).option(`parameters-filter-combination`,{type:`string`,description:`Set a Flag to describe how to combine the filters on the query.`,choices:[`and`,`or`,`AND`,`OR`]}).option(`parameters-limit`,{type:`number`,description:`Set a limit on the number of results / records returned by the query`}).option(`parameters-needle-is-regex`,{type:`boolean`,description:`The parameters.needle.isRegex field`}).option(`parameters-needle-match-case`,{type:`boolean`,description:`The parameters.needle.matchCase field`}).option(`parameters-order-by-order`,{type:`string`,description:`Set the order of the results`,choices:[`asc`,`desc`]}).option(`parameters-order-by-value`,{type:`string`,description:`Configure which Calculation to order the results by.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Specify the new contents of the query.`})}const w={command:`create`,describe:`Persist query for later use.`,builder:C,handler:async n=>{if(n.dryRun){l({command:`cf observability queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/queries`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`),name:d(n.name,`name`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}}}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.observability.queries.create({...e,account_id:p})),{successLabel:`Created`});return}n.description===void 0&&(n.description=await t(`description`,`The description field`)),n.name===void 0&&(n.name=await t(`name`,`Query name`)),n[`parameters-order-by-value`]===void 0&&(n[`parameters-order-by-value`]=await t(`parameters-order-by-value`,`Configure which Calculation to order the results by.`));let m=s({description:d(n.description,`description`,`text`),name:d(n.name,`name`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}}});c(await u(`Creating`,async()=>r.observability.queries.create({...m,account_id:p})),{successLabel:`Created`})}};function T(e){return e.positional(`query-id`,{type:`string`,description:`QueryId`,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 <queryId>`,describe:`Delete a saved query.`,builder:T,handler:async t=>{if(t.dryRun){l({command:`cf observability queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/queries/${t[`query-id`]==null?`<query-id>`:encodeURIComponent(String(t[`query-id`]))}`,pathParams:{"query-id":String(t[`query-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>n.observability.queries.delete({account_id:o,queryId:t[`query-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`query-id`,{type:`string`,description:`QueryId`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`Query name`}).option(`parameters-datasets`,{type:`string`,array:!0,description:`Set the Datasets to query. Leave it empty to query all the datasets.`}).option(`parameters-filter-combination`,{type:`string`,description:`Set a Flag to describe how to combine the filters on the query.`,choices:[`and`,`or`,`AND`,`OR`]}).option(`parameters-limit`,{type:`number`,description:`Set a limit on the number of results / records returned by the query`}).option(`parameters-needle-is-regex`,{type:`boolean`,description:`The parameters.needle.isRegex field`}).option(`parameters-needle-match-case`,{type:`boolean`,description:`The parameters.needle.matchCase field`}).option(`parameters-order-by-order`,{type:`string`,description:`Set the order of the results`,choices:[`asc`,`desc`]}).option(`parameters-order-by-value`,{type:`string`,description:`Configure which Calculation to order the results by.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Specify the new contents of the query.`})}const O={command:`edit <queryId>`,describe:`Update saved query.`,builder:D,handler:async n=>{if(n.dryRun){l({command:`cf observability queries edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/queries/${n[`query-id`]==null?`<query-id>`:encodeURIComponent(String(n[`query-id`]))}`,pathParams:{"query-id":String(n[`query-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`),name:d(n.name,`name`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}}}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.observability.queries.edit({...e,account_id:p,queryId:n[`query-id`]})),{successLabel:`Updated`});return}n.description===void 0&&(n.description=await t(`description`,`The description field`)),n.name===void 0&&(n.name=await t(`name`,`Query name`)),n[`parameters-order-by-value`]===void 0&&(n[`parameters-order-by-value`]=await t(`parameters-order-by-value`,`Configure which Calculation to order the results by.`));let m=s({description:d(n.description,`description`,`text`),name:d(n.name,`name`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}}});c(await u(`Updating`,async()=>r.observability.queries.edit({...m,account_id:p,queryId:n[`query-id`]})),{successLabel:`Updated`})}};function k(e){return e.positional(`query-id`,{type:`string`,description:`QueryId`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <queryId>`,describe:`Retrieve a saved query.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf observability queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/queries/${t[`query-id`]==null?`<query-id>`:encodeURIComponent(String(t[`query-id`]))}`,pathParams:{"query-id":String(t[`query-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.observability.queries.get({account_id:r,queryId:t[`query-id`]})),{successLabel:`Loaded`})}};function j(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`PerPage`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`order-by`,{type:`string`,description:`OrderBy`,choices:[`created`,`updated`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`List saved queries.`,builder:p(j),handler:async t=>{let n={page:t.page,perPage:t[`per-page`],order:t.order,orderBy:t[`order-by`]};if(t.dryRun){l({command:`cf observability queries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/queries`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.observability.queries.list({account_id:o,...n})),{successLabel:`Loaded`})}},N={command:`queries`,describe:`Operations for queries`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`datasets`,{type:`string`,array:!0,description:`Leave this empty to use the default datasets`}).option(`from`,{type:`number`,description:`The from field`}).option(`key-needle-is-regex`,{type:`boolean`,description:`When true, treats the value as a regular expression (RE2 syntax).`}).option(`key-needle-match-case`,{type:`boolean`,description:`When true, performs a case-sensitive search. Defaults to case-insensitive.`}).option(`limit`,{type:`number`,description:`Advanced usage: set limit=1000+ to retrieve comprehensive key options without needing additional filtering.`}).option(`needle-is-regex`,{type:`boolean`,description:`When true, treats the value as a regular expression (RE2 syntax).`}).option(`needle-match-case`,{type:`boolean`,description:`When true, performs a case-sensitive search. Defaults to case-insensitive.`}).option(`to`,{type:`number`,description:`The to field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Find keys in your telemetry events matching a specific filter or needle.`})}const F={command:`keys`,describe:`List all the keys in your telemetry events.`,builder:P,handler:async t=>{if(t.dryRun){l({command:`cf observability telemetry keys`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/telemetry/keys`,pathParams:{},bodyKind:`json`,body:t.body===void 0?s({datasets:t.datasets,from:t.from,keyNeedle:{isRegex:t[`key-needle-is-regex`],matchCase:t[`key-needle-match-case`]},limit:t.limit,needle:{isRegex:t[`needle-is-regex`],matchCase:t[`needle-match-case`]},to:t.to}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.observability.telemetry.keys({...e,account_id:r})),{successLabel:`Created`});return}let d=s({datasets:t.datasets,from:t.from,keyNeedle:{isRegex:t[`key-needle-is-regex`],matchCase:t[`key-needle-match-case`]},limit:t.limit,needle:{isRegex:t[`needle-is-regex`],matchCase:t[`needle-match-case`]},to:t.to});c(await u(`Creating`,async()=>n.observability.telemetry.keys({...d,account_id:r})),{successLabel:`Created`})}};function I(e){return e.option(`chart`,{type:`boolean`,description:`When true, includes time-series data in the response.`}).option(`compare`,{type:`boolean`,description:`When true, includes a comparison dataset from the previous time period of equal length.`}).option(`dry`,{type:`boolean`,description:`When true, executes the query without persisting the results. Useful for validation or previewing.`,default:!1}).option(`granularity`,{type:`number`,description:`Number of time-series buckets. Only used when view is 'calculations'. Omit to let the system auto-detect an appropriate granularity.`}).option(`ignore-series`,{type:`boolean`,description:`When true, omits time-series data from the response and returns only aggregated values. Reduces response size when series are not needed.`,default:!1}).option(`limit`,{type:`number`,description:`Maximum number of events to return when view is 'events'. Also controls the number of group-by rows when view is 'calculations'.`,default:50}).option(`offset`,{type:`string`,description:`Cursor for pagination in event, trace, and invocation views. Pass the $metadata.id of the last returned item to fetch the next page.`}).option(`offset-by`,{type:`number`,description:`Numeric offset for paginating grouped/pattern results (top-N lists). Use together with limit. Not used by cursor-based pagination.`}).option(`offset-direction`,{type:`string`,description:`Pagination direction: 'next' for forward, 'prev' for backward.`}).option(`parameters-datasets`,{type:`string`,array:!0,description:`Datasets to query. Leave empty to query all available datasets.`}).option(`parameters-filter-combination`,{type:`string`,description:`Logical operator for combining top-level filters: 'and' (all must match) or 'or' (any must match). Defaults to 'and'.`,choices:[`and`,`or`,`AND`,`OR`]}).option(`parameters-limit`,{type:`number`,description:`Maximum number of group-by rows to return in calculation results. A value of 10 is a sensible default for most use cases.`}).option(`parameters-needle-is-regex`,{type:`boolean`,description:`When true, treats the value as a regular expression (RE2 syntax).`}).option(`parameters-needle-match-case`,{type:`boolean`,description:`When true, performs a case-sensitive search. Defaults to case-insensitive.`}).option(`parameters-order-by-order`,{type:`string`,description:`Sort direction: 'asc' for ascending, 'desc' for descending.`,choices:[`asc`,`desc`]}).option(`parameters-order-by-value`,{type:`string`,description:`Alias of the calculation to order results by. Must match the alias (or operator) of a calculation in the query.`}).option(`query-id`,{type:`string`,description:`Identifier for the query. When parameters are omitted, this ID is used to load a previously saved query's parameters. When providing parameters inline, pass any identifier (e.g. an ad-hoc ID).`}).option(`timeframe-from`,{type:`number`,description:`Start timestamp for the query timeframe (Unix timestamp in milliseconds)`}).option(`timeframe-to`,{type:`number`,description:`End timestamp for the query timeframe (Unix timestamp in milliseconds)`}).option(`view`,{type:`string`,description:`Controls the shape of the response. 'events': individual log lines matching the query. 'calculations': aggregated metrics (count, avg, p99, etc.) with optional group-by breakdowns and time-series. 'invocations': events grouped by request ID. 'traces': distributed trace summaries. 'agents': Durable Object agent summaries.`,choices:[`traces`,`events`,`calculations`,`invocations`,`requests`,`agents`],default:`calculations`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query your observability events, requests, and traces to build visualizations and identify insights.`}).check(e=>{if([`parameters-datasets`,`parameters-filter-combination`,`parameters-limit`,`parameters-needle-is-regex`,`parameters-needle-match-case`,`parameters-order-by-order`,`parameters-order-by-value`].some(t=>e[t]!==void 0)){let t=[`parameters-order-by-value`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --parameters-* flag is set`)}return!0})}const L={command:`query`,describe:`Run a temporary or saved query.`,builder:I,handler:async n=>{if(n.dryRun){l({command:`cf observability telemetry query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/telemetry/query`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({chart:n.chart,compare:n.compare,dry:n.dry,granularity:n.granularity,ignoreSeries:n[`ignore-series`],limit:n.limit,offset:d(n.offset,`offset`,`text`),offsetBy:n[`offset-by`],offsetDirection:d(n[`offset-direction`],`offset-direction`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}},queryId:d(n[`query-id`],`query-id`,`text`),timeframe:{from:n[`timeframe-from`],to:n[`timeframe-to`]},view:d(n.view,`view`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Loading`,async()=>r.observability.telemetry.query({...e,account_id:p})),{successLabel:`Loaded`});return}if(n[`query-id`]===void 0&&(n[`query-id`]=await t(`query-id`,`Identifier for the query. When parameters are omitted, this ID is used to load a previously saved query's parameters. When providing parameters inline, pass any identifier (e.g. an ad-hoc ID).`)),n[`timeframe-from`]===void 0)throw Error(`--timeframe-from is required (or pass --body with this field set).`);if(n[`timeframe-to`]===void 0)throw Error(`--timeframe-to is required (or pass --body with this field set).`);let m=s({chart:n.chart,compare:n.compare,dry:n.dry,granularity:n.granularity,ignoreSeries:n[`ignore-series`],limit:n.limit,offset:d(n.offset,`offset`,`text`),offsetBy:n[`offset-by`],offsetDirection:d(n[`offset-direction`],`offset-direction`,`text`),parameters:{datasets:n[`parameters-datasets`],filterCombination:d(n[`parameters-filter-combination`],`parameters-filter-combination`,`text`),limit:n[`parameters-limit`],needle:{isRegex:n[`parameters-needle-is-regex`],matchCase:n[`parameters-needle-match-case`]},orderBy:{order:d(n[`parameters-order-by-order`],`parameters-order-by-order`,`text`),value:d(n[`parameters-order-by-value`],`parameters-order-by-value`,`text`)}},queryId:d(n[`query-id`],`query-id`,`text`),timeframe:{from:n[`timeframe-from`],to:n[`timeframe-to`]},view:d(n.view,`view`,`text`)});c(await u(`Loading`,async()=>r.observability.telemetry.query({...m,account_id:p})),{successLabel:`Loaded`})}};function R(e){return e.option(`datasets`,{type:`string`,array:!0,description:`Leave this empty to use the default datasets`}).option(`key`,{type:`string`,description:`The key field`}).option(`limit`,{type:`number`,description:`The limit field`,default:50}).option(`needle-is-regex`,{type:`boolean`,description:`When true, treats the value as a regular expression (RE2 syntax).`}).option(`needle-match-case`,{type:`boolean`,description:`When true, performs a case-sensitive search. Defaults to case-insensitive.`}).option(`timeframe-from`,{type:`number`,description:`The timeframe.from field`}).option(`timeframe-to`,{type:`number`,description:`The timeframe.to field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`string`,`boolean`,`number`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Retrieve values from your telemetry events.`})}const z={command:`values`,describe:`List unique values found in your events.`,builder:R,handler:async r=>{if(r.dryRun){l({command:`cf observability telemetry values`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/workers/observability/telemetry/values`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({datasets:r.datasets,key:d(r.key,`key`,`text`),limit:r.limit,needle:{isRegex:r[`needle-is-regex`],matchCase:r[`needle-match-case`]},timeframe:{from:r[`timeframe-from`],to:r[`timeframe-to`]},type:d(r.type,`type`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.observability.telemetry.values({...e,account_id:m})),{successLabel:`Created`});return}if(r.datasets===void 0)throw Error(`--datasets is required (or pass --body with this field set).`);if(r.key===void 0&&(r.key=await t(`key`,`The key field`)),r[`timeframe-from`]===void 0)throw Error(`--timeframe-from is required (or pass --body with this field set).`);if(r[`timeframe-to`]===void 0)throw Error(`--timeframe-to is required (or pass --body with this field set).`);r.type===void 0&&(r.type=await n(`type`,`The type field`,[`string`,`boolean`,`number`]));let h=s({datasets:r.datasets,key:d(r.key,`key`,`text`),limit:r.limit,needle:{isRegex:r[`needle-is-regex`],matchCase:r[`needle-match-case`]},timeframe:{from:r[`timeframe-from`],to:r[`timeframe-to`]},type:d(r.type,`type`,`text`)});c(await u(`Creating`,async()=>p.observability.telemetry.values({...h,account_id:m})),{successLabel:`Created`})}},B={command:`telemetry`,describe:`Operations for telemetry`,builder:e=>e.command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`observability`,describe:`observability`,builder:e=>e.command(S).command(N).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{V as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{n as e}from"./chunk-6IEM75FG-U3L9fKgi.mjs";import t from"node:fs";import n from"node:os";import r from"node:path";import i,{execFile as a}from"node:child_process";import{promisify as o}from"node:util";import{Buffer as s}from"node:buffer";import{fileURLToPath as c}from"node:url";import l,{constants as u}from"node:fs/promises";import d from"node:process";var f;function p(){try{return t.statSync(`/.dockerenv`),!0}catch{return!1}}e(p,`hasDockerEnv`);function m(){try{return t.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}e(m,`hasDockerCGroup`);function h(){return f===void 0&&(f=p()||m()),f}e(h,`isDocker`);var g,_=e(()=>{try{return t.statSync(`/run/.containerenv`),!0}catch{return!1}},`hasContainerEnv`);function v(){return g===void 0&&(g=_()||h()),g}e(v,`isInsideContainer`);var y=e(()=>{if(d.platform!==`linux`)return!1;if(n.release().toLowerCase().includes(`microsoft`))return!v();try{return t.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`)?!v():!1}catch{return!1}},`isWsl`),b=d.env.__IS_WSL_TEST__?y:y(),ee=o(i.execFile),x=e(()=>`${d.env.SYSTEMROOT||d.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,`powerShellPath`),S=e(async(e,t={})=>{let{powerShellPath:n,...r}=t,i=S.encodeCommand(e);return ee(n??x(),[...S.argumentsPrefix,i],{encoding:`utf8`,...r})},`executePowerShell`);S.argumentsPrefix=[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`],S.encodeCommand=e=>s.from(e,`utf16le`).toString(`base64`),S.escapeArgument=e=>`'${String(e).replaceAll(`'`,`''`)}'`;function C(e){for(let t of e.split(`
3
+ `)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}e(C,`parseMountPointFromConfig`);var te=o(i.execFile),ne=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await l.access(n,u.F_OK),r=!0}catch{}if(!r)return e;let i=C(await l.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),w=b?e(async()=>`${await ne()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,`powerShellPathFromWsl`):x,T,E=e(async()=>(T??=(async()=>{try{let e=await w();return await l.access(e,u.X_OK),!0}catch{return!1}})(),T),`canAccessPowerShell`),D=e(async()=>{let e=await w(),{stdout:t}=await S(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},`wslDefaultBrowser`),O=e(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await te(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}},`convertWslPathToWindows`);function k(t,n,r){let i=e(e=>Object.defineProperty(t,n,{value:e,enumerable:!0,writable:!0}),`define`);return Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){let e=r();return i(e),e},set(e){i(e)}}),t}e(k,`defineLazyProperty`);var A=o(a);async function j(){if(d.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await A(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}e(j,`defaultBrowserId`);var M=o(a);async function N(e,{humanReadableOutput:t=!0,signal:n}={}){if(d.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await M(`osascript`,[`-e`,e,r],i);return a.trim()}e(N,`runAppleScript`);async function P(e){return N(`tell application "Finder" to set app_path to application file id "${e}" as string
4
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}e(P,`bundleName`);var F=o(a),I={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},L=new Map(Object.entries(I)),R=class extends Error{static{e(this,`UnknownBrowserError`)}};async function z(e=F){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new R(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=I[r];if(!i)throw new R(`Unknown browser ID: ${r}`);return i}e(z,`defaultBrowser`);var B=o(a),V=e(e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),`titleize`);async function H(){if(d.platform===`darwin`){let e=await j();return{name:await P(e),id:e}}if(d.platform===`linux`){let{stdout:e}=await B(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:V(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(d.platform===`win32`)return z();throw Error(`Only macOS, Linux, and Windows are supported`)}e(H,`defaultBrowser`);var U=!!(d.env.SSH_CONNECTION||d.env.SSH_CLIENT||d.env.SSH_TTY),W=Symbol(`fallbackAttempt`),G=import.meta.url?r.dirname(c(import.meta.url)):``,K=r.join(G,`xdg-open`),{platform:q,arch:J}=d,Y=e(async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},`tryEachApp`),X=e(async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[W]===!0;if(delete e[W],Array.isArray(e.app))return Y(e.app,t=>X({...e,app:t,[W]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Y(n,t=>X({...e,app:{name:t,arguments:r},[W]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(b){let e=await D();a=L.get(e)??{}}else a=await H();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return X({...e,app:{name:$[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let a,o=[],s={},c=!1;if(b&&!v()&&!U&&!n&&(c=await E()),q===`darwin`)a=`open`,e.wait&&o.push(`--wait-apps`),e.background&&o.push(`--background`),e.newInstance&&o.push(`--new`),n&&o.push(`-a`,n);else if(q===`win32`||c){a=await w(),o.push(...S.argumentsPrefix),b||(s.windowsVerbatimArguments=!0),b&&e.target&&(e.target=await O(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(S.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(S.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>S.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=S.encodeCommand(t.join(` `)),e.wait||(s.stdio=`ignore`)}else{if(n)a=n;else{let e=!G||G===`/`,t=!1;try{await l.access(K,u.X_OK),t=!0}catch{}a=d.versions.electron??(q===`android`||e||!t)?`xdg-open`:K}r.length>0&&o.push(...r),e.wait||(s.stdio=`ignore`,s.detached=!0)}q===`darwin`&&r.length>0&&o.push(`--args`,...r),e.target&&o.push(e.target);let f=i.spawn(a,o,s);return e.wait?new Promise((t,n)=>{f.once(`error`,n),f.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r!==0){n(Error(`Exited with code ${r}`));return}t(f)})}):t?new Promise((e,t)=>{f.once(`error`,t),f.once(`spawn`,()=>{f.once(`close`,n=>{if(f.off(`error`,t),n!==0){t(Error(`Exited with code ${n}`));return}f.unref(),e(f)})})}):(f.unref(),new Promise((e,t)=>{f.once(`error`,t),f.once(`spawn`,()=>{f.off(`error`,t),e(f)})}))},`baseOpen`),re=e((e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return X({...t,target:e})},`open`);function Z(e){if(typeof e==`string`||Array.isArray(e))return e;let{[J]:t}=e;if(!t)throw Error(`${J} is not supported`);return t}e(Z,`detectArchBinary`);function Q({[q]:e},{wsl:t}={}){if(t&&b)return Z(t);if(!e)throw Error(`${q} is not supported`);return Z(e)}e(Q,`detectPlatformBinary`);var $={browser:`browser`,browserPrivate:`browserPrivate`};k($,`chrome`,()=>Q({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),k($,`brave`,()=>Q({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),k($,`firefox`,()=>Q({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),k($,`edge`,()=>Q({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),k($,`safari`,()=>Q({darwin:`Safari`}));var ie=re;export{ie as default};
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";import{t as f}from"./cli-types-CMNMD1V7.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`list`,describe:`Retrieve a list of the organizations that "contain" this account or are managing it. The returned list will be in order from "root" to "leaf", where the "leaf" will be the organization that _immediately_ contains the specified account.`,builder:p,handler:async t=>{if(t.dryRun){c({command:`cf organizations account-organizations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/organizations`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.organizations.accountOrganizations.list({account_id:a})),{successLabel:`Loaded`})}},h={command:`account-organizations`,describe:`Operations for account-organizations`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`name`,{type:`string`,description:`The name field`}).option(`parent-id`,{type:`string`,description:`The parent.id field`}).option(`profile-business-address`,{type:`string`,description:`The profile.business_address field`}).option(`profile-business-email`,{type:`string`,description:`The profile.business_email field`}).option(`profile-business-name`,{type:`string`,description:`The profile.business_name field`}).option(`profile-business-phone`,{type:`string`,description:`The profile.business_phone field`}).option(`profile-external-metadata`,{type:`string`,description:`The profile.external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`References an Organization in the Cloudflare data model.`}).check(e=>{if([`parent-id`].some(t=>e[t]!==void 0)){let t=[`parent-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --parent-* flag is set`)}return!0}).check(e=>{if([`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].some(t=>e[t]!==void 0)){let t=[`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --profile-* flag is set`)}return!0})}const _={command:`create`,describe:`Create a new organization for a user. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:g,handler:async e=>{if(e.dryRun){c({command:`cf organizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({name:u(e.name,`name`,`text`),parent:{id:u(e[`parent-id`],`parent-id`,`text`)},profile:{business_address:u(e[`profile-business-address`],`profile-business-address`,`text`),business_email:u(e[`profile-business-email`],`profile-business-email`,`text`),business_name:u(e[`profile-business-name`],`profile-business-name`,`text`),business_phone:u(e[`profile-business-phone`],`profile-business-phone`,`text`),external_metadata:u(e[`profile-external-metadata`],`profile-external-metadata`,`text`)}}):a(e.body)});return}let n=await i(e);if(e.body){let t=a(e.body);s(await l(`Creating`,async()=>n.organizations.create({...t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The name field`));let r=o({name:u(e.name,`name`,`text`),parent:{id:u(e[`parent-id`],`parent-id`,`text`)},profile:{business_address:u(e[`profile-business-address`],`profile-business-address`,`text`),business_email:u(e[`profile-business-email`],`profile-business-email`,`text`),business_name:u(e[`profile-business-name`],`profile-business-name`,`text`),business_phone:u(e[`profile-business-phone`],`profile-business-phone`,`text`),external_metadata:u(e[`profile-external-metadata`],`profile-external-metadata`,`text`)}});s(await l(`Creating`,async()=>n.organizations.create({...r})),{successLabel:`Created`})}};function v(e){return e.positional(`organization-id`,{type:`string`,description:`The ID of the organization to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const y={command:`delete <organization-id>`,describe:`Delete an organization. The organization MUST be empty before deleting. It must not contain any sub-organizations, accounts, members or users. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/) **Access Control:** Restricted to enterprise organizations.`,builder:v,handler:async e=>{if(e.dryRun){c({command:`cf organizations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`none`});return}let t=await i(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>t.organizations.delete({organization_id:e[`organization-id`]})),{successLabel:`Deleted`})}};function b(e){return e.positional(`organization-id`,{type:`string`,description:`The ID of the organization to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <organization-id>`,describe:`Retrieve the details of a certain organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:b,handler:async e=>{if(e.dryRun){c({command:`cf organizations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.organizations.get({organization_id:e[`organization-id`]})),{successLabel:`Loaded`})}};function S(e){return e.option(`id`,{type:`string`,description:`Only return organizations with the specified IDs (ex. id=foo&id=bar). Send multiple elements
4
+ by repeating the query value.`}).option(`name`,{type:`string`,description:`(case-sensitive) Filter the list of organizations to where the name is equal to a
5
+ particular string.`}).option(`name-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name starts with a
6
+ particular string.`}).option(`name-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name ends with a particular
7
+ string.`}).option(`name-contains`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name contains a particular
8
+ string.`}).option(`containing-account`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular
9
+ account.`}).option(`containing-user`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular
10
+ user.
11
+
12
+ IMPORTANT: Just because an organization "contains" a user is not a
13
+ representation of any authorization or privilege to manage any resources
14
+ therein. An organization "containing" a user simply means the user is managed by
15
+ that organization.`}).option(`containing-organization`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular
16
+ organization.`}).option(`parent-id`,{type:`string`,description:`Filter the list of organizations to the ones that are a sub-organization
17
+ of the specified organization.
18
+
19
+ "null" is a valid value to provide for this parameter. It means "where
20
+ an organization has no parent (i.e. it is a 'root' organization)."`}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when
21
+ provided will retrieve the next page.
22
+
23
+ Parameters used to filter the retrieved list must remain in subsequent
24
+ requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`list`,describe:`Retrieve a list of organizations a particular user has access to. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:f(S),handler:async e=>{let t={id:e.id,name:e.name,"name.startsWith":e[`name-starts-with`],"name.endsWith":e[`name-ends-with`],"name.contains":e[`name-contains`],"containing.account":e[`containing-account`],"containing.user":e[`containing-user`],"containing.organization":e[`containing-organization`],"parent.id":e[`parent-id`],page_token:e[`page-token`],page_size:e[`page-size`]};if(e.dryRun){c({command:`cf organizations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.organizations.list(t)),{successLabel:`Loaded`})}};function w(e){return e.positional(`organization-id`,{type:`string`,description:`The unique id that identifies the organization.`,demandOption:!0}).option(`action-result`,{type:`string`,description:`Filters by whether the action was successful or not.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-context`,{type:`string`,description:`Filters by the actor context.`}).option(`actor-email`,{type:`string`,description:`Filters by the actor's email address.`}).option(`actor-id`,{type:`string`,description:`Filters by the actor's user ID.`}).option(`actor-ip-address`,{type:`string`,description:`The IP address where the action was initiated.`}).option(`actor-token-id`,{type:`string`,description:`Filters by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name`,{type:`string`,description:`Filters by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type`,{type:`string`,description:`Filters by the actor type.`}).option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`raw-cf-ray-id`,{type:`string`,description:`Filters by the response CF Ray ID.`}).option(`raw-method`,{type:`string`,description:`The HTTP method for the API call.`}).option(`raw-status-code`,{type:`string`,description:`The response status code that was returned.`}).option(`raw-uri`,{type:`string`,description:`Filters by the request URI.`}).option(`resource-id`,{type:`string`,description:`Filters by the resource ID.`}).option(`resource-product`,{type:`string`,description:`Filters audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type`,{type:`string`,description:`Filters audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope`,{type:`string`,description:`Filters by the resource scope, specifying whether the resource is associated with an organization.`}).option(`action-result-not`,{type:`string`,description:`Filters out audit logs by whether the action was successful or not.`}).option(`action-type-not`,{type:`string`,description:`Filters out audit logs by the action type.`}).option(`actor-context-not`,{type:`string`,description:`Filters out audit logs by the actor context.`}).option(`actor-email-not`,{type:`string`,description:`Filters out audit logs by the actor's email address.`}).option(`actor-id-not`,{type:`string`,description:`Filters out audit logs by the actor's user ID.`}).option(`actor-ip-address-not`,{type:`string`,description:`Filters out audit logs IP address where the action was initiated.`}).option(`actor-token-id-not`,{type:`string`,description:`Filters out audit logs by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name-not`,{type:`string`,description:`Filters out audit logs by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type-not`,{type:`string`,description:`Filters out audit logs by the actor type.`}).option(`id-not`,{type:`string`,description:`Filters out audit logs by their IDs.`}).option(`raw-cf-ray-id-not`,{type:`string`,description:`Filters out audit logs by the response CF Ray ID.`}).option(`raw-method-not`,{type:`string`,description:`Filters out audit logs by the HTTP method for the API call.`}).option(`raw-status-code-not`,{type:`string`,description:`Filters out audit logs by the response status code that was returned.`}).option(`raw-uri-not`,{type:`string`,description:`Filters out audit logs by the request URI.`}).option(`resource-id-not`,{type:`string`,description:`Filters out audit logs by the resource ID.`}).option(`resource-product-not`,{type:`string`,description:`Filters out audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type-not`,{type:`string`,description:`Filters out audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope-not`,{type:`string`,description:`Filters out audit logs by the resource scope, specifying whether the resource is associated with an organization.`}).option(`since`,{type:`string`,description:`Limits the returned results to logs newer than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`before`,{type:`string`,description:`Limits the returned results to logs older than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Sets sorting order.`,choices:[`desc`,`asc`]}).option(`limit`,{type:`number`,description:`The number limits the objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit.`}).option(`cursor`,{type:`string`,description:`The cursor is an opaque token used to paginate through large sets of records. It indicates the position from which to continue when requesting the next set of records. A valid cursor value can be obtained from the cursor object in the result_info structure of a previous response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <organization-id>`,describe:`Gets a list of audit logs for an organization.`,builder:f(w),handler:async e=>{let t={action_result:e[`action-result`],action_type:e[`action-type`],actor_context:e[`actor-context`],actor_email:e[`actor-email`],actor_id:e[`actor-id`],actor_ip_address:e[`actor-ip-address`],actor_token_id:e[`actor-token-id`],actor_token_name:e[`actor-token-name`],actor_type:e[`actor-type`],id:e.id,raw_cf_ray_id:e[`raw-cf-ray-id`],raw_method:e[`raw-method`],raw_status_code:e[`raw-status-code`],raw_uri:e[`raw-uri`],resource_id:e[`resource-id`],resource_product:e[`resource-product`],resource_type:e[`resource-type`],resource_scope:e[`resource-scope`],"action_result.not":e[`action-result-not`],"action_type.not":e[`action-type-not`],"actor_context.not":e[`actor-context-not`],"actor_email.not":e[`actor-email-not`],"actor_id.not":e[`actor-id-not`],"actor_ip_address.not":e[`actor-ip-address-not`],"actor_token_id.not":e[`actor-token-id-not`],"actor_token_name.not":e[`actor-token-name-not`],"actor_type.not":e[`actor-type-not`],"id.not":e[`id-not`],"raw_cf_ray_id.not":e[`raw-cf-ray-id-not`],"raw_method.not":e[`raw-method-not`],"raw_status_code.not":e[`raw-status-code-not`],"raw_uri.not":e[`raw-uri-not`],"resource_id.not":e[`resource-id-not`],"resource_product.not":e[`resource-product-not`],"resource_type.not":e[`resource-type-not`],"resource_scope.not":e[`resource-scope-not`],since:e.since,before:e.before,direction:e.direction,limit:e.limit,cursor:e.cursor};if(e.dryRun){c({command:`cf organizations logs audit get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/logs/audit`,pathParams:{"organization-id":String(e[`organization-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.organizations.logs.audit.get({organization_id:e[`organization-id`],...t})),{successLabel:`Loaded`})}},E={command:`audit`,describe:`Logs operations`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`logs`,describe:`Operations for logs`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`create <organization-id>`,describe:`Batch create multiple memberships that grant access to a specific Organization.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf organizations members-batch-create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/members:batchCreate`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.organizations.membersBatchCreate.create({...n,organization_id:e[`organization-id`]})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`members-batch-create`,describe:`Operations for members-batch-create`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`member-status`,{type:`string`,description:`The member.status field`,choices:[`active`,`canceled`]}).option(`member-user-email`,{type:`string`,description:`The member.user.email field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`create <organization-id>`,describe:`Create a membership that grants access to a specific Organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:j,handler:async e=>{if(e.dryRun){c({command:`cf organizations members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/members`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({member:{status:u(e[`member-status`],`member-status`,`text`),user:{email:u(e[`member-user-email`],`member-user-email`,`text`)}}}):a(e.body)});return}let n=await i(e);if(e.body){let t=a(e.body);s(await l(`Creating`,async()=>n.organizations.members.create({...t,organization_id:e[`organization-id`]})),{successLabel:`Created`});return}e[`member-user-email`]===void 0&&(e[`member-user-email`]=await t(`member-user-email`,`The member.user.email field`));let r=o({member:{status:u(e[`member-status`],`member-status`,`text`),user:{email:u(e[`member-user-email`],`member-user-email`,`text`)}}});s(await l(`Creating`,async()=>n.organizations.members.create({...r,organization_id:e[`organization-id`]})),{successLabel:`Created`})}};function N(e){return e.positional(`member-id`,{type:`string`,description:`Organization Member ID`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`delete <member-id>`,describe:`Delete a membership to a particular Organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:N,handler:async e=>{if(e.dryRun){c({command:`cf organizations members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/members/${e[`member-id`]==null?`<member-id>`:encodeURIComponent(String(e[`member-id`]))}`,pathParams:{"organization-id":String(e[`organization-id`]??``),"member-id":String(e[`member-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
25
+ `);return}if(e.body){let n=a(e.body);s(await l(`Deleting`,async()=>t.organizations.members.delete({...n,organization_id:e[`organization-id`],member_id:e[`member-id`]})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>t.organizations.members.delete({organization_id:e[`organization-id`],member_id:e[`member-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`member-id`,{type:`string`,description:`Organization Member ID`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <member-id>`,describe:`Retrieve a single membership from an Organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:F,handler:async e=>{if(e.dryRun){c({command:`cf organizations members get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/members/${e[`member-id`]==null?`<member-id>`:encodeURIComponent(String(e[`member-id`]))}`,pathParams:{"organization-id":String(e[`organization-id`]??``),"member-id":String(e[`member-id`]??``)},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.organizations.members.get({organization_id:e[`organization-id`],member_id:e[`member-id`]})),{successLabel:`Loaded`})}};function L(e){return e.option(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter the list of memberships by membership status.`}).option(`user-email`,{type:`string`,description:`Filter the list of memberships for a specific email.`}).option(`user-email-contains`,{type:`string`,description:`Filter the list of memberships for a specific email that contains a substring.`}).option(`user-email-starts-with`,{type:`string`,description:`Filter the list of memberships for a specific email that starts with a substring.`}).option(`user-email-ends-with`,{type:`string`,description:`Filter the list of memberships for a specific email that ends with a substring.`}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when
26
+ provided will retrieve the next page.
27
+
28
+ Parameters used to filter the retrieved list must remain in subsequent
29
+ requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`List memberships for an Organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:f(L),handler:async e=>{let t={status:e.status,"user.email":e[`user-email`],"user.email.contains":e[`user-email-contains`],"user.email.startsWith":e[`user-email-starts-with`],"user.email.endsWith":e[`user-email-ends-with`],page_token:e[`page-token`],page_size:e[`page-size`]};if(e.dryRun){c({command:`cf organizations members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/members`,pathParams:{"organization-id":String(e[`organization-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.organizations.members.list({organization_id:e[`organization-id`],...t})),{successLabel:`Loaded`})}},z={command:`members`,describe:`Operations for members`,builder:e=>e.command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`organization-id`,{type:`string`,description:`The ID of the organization to retrieve a list of accounts for.`,demandOption:!0}).option(`account-pubname`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname is equal to
30
+ a particular string.`}).option(`account-pubname-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname starts with
31
+ a particular string.`}).option(`account-pubname-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname ends with
32
+ a particular string.`}).option(`account-pubname-contains`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname contains
33
+ a particular string.`}).option(`name`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name is equal to a
34
+ particular string.`}).option(`name-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name starts with a
35
+ particular string.`}).option(`name-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name ends with a particular
36
+ string.`}).option(`name-contains`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name contains a particular
37
+ string.`}).option(`order-by`,{type:`string`,description:"Field to order results by. Currently supported values: `account_name`.\nWhen not specified, results are ordered by internal account ID.",choices:[`account_name`]}).option(`direction`,{type:`string`,description:"Sort direction for the order_by field. Valid values: `asc`, `desc`.\nDefaults to `asc` when order_by is specified.",choices:[`asc`,`desc`]}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when
38
+ provided will retrieve the next page.
39
+
40
+ Parameters used to filter the retrieved list must remain in subsequent
41
+ requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <organization-id>`,describe:`Retrieve a list of accounts that belong to a specific organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:f(B),handler:async e=>{let t={account_pubname:e[`account-pubname`],"account_pubname.startsWith":e[`account-pubname-starts-with`],"account_pubname.endsWith":e[`account-pubname-ends-with`],"account_pubname.contains":e[`account-pubname-contains`],name:e.name,"name.startsWith":e[`name-starts-with`],"name.endsWith":e[`name-ends-with`],"name.contains":e[`name-contains`],order_by:e[`order-by`],direction:e.direction,page_token:e[`page-token`],page_size:e[`page-size`]};if(e.dryRun){c({command:`cf organizations organization-accounts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/accounts`,pathParams:{"organization-id":String(e[`organization-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.organizations.organizationAccounts.get({organization_id:e[`organization-id`],...t})),{successLabel:`Loaded`})}},H={command:`organization-accounts`,describe:`Operations for organization-accounts`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`organization-id`,{type:`string`,description:`The ID of the organization to retrieve a profile for.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`get <organization-id>`,describe:`Get an organizations profile if it exists. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:U,handler:async e=>{if(e.dryRun){c({command:`cf organizations organization-profile get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/profile`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.organizations.organizationProfile.get({organization_id:e[`organization-id`]})),{successLabel:`Loaded`})}};function G(e){return e.positional(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`business-address`,{type:`string`,description:`The business_address field`}).option(`business-email`,{type:`string`,description:`The business_email field`}).option(`business-name`,{type:`string`,description:`The business_name field`}).option(`business-phone`,{type:`string`,description:`The business_phone field`}).option(`external-metadata`,{type:`string`,description:`The external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`update <organization-id>`,describe:`Modify organization profile. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:G,handler:async e=>{if(e.dryRun){c({command:`cf organizations organization-profile update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/profile`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({business_address:u(e[`business-address`],`business-address`,`text`),business_email:u(e[`business-email`],`business-email`,`text`),business_name:u(e[`business-name`],`business-name`,`text`),business_phone:u(e[`business-phone`],`business-phone`,`text`),external_metadata:u(e[`external-metadata`],`external-metadata`,`text`)}):a(e.body)});return}let n=await i(e);if(e.body){let t=a(e.body);s(await l(`Updating`,async()=>n.organizations.organizationProfile.update({body:t,organization_id:e[`organization-id`]})),{successLabel:`Updated`});return}e[`business-address`]===void 0&&(e[`business-address`]=await t(`business-address`,`The business_address field`)),e[`business-email`]===void 0&&(e[`business-email`]=await t(`business-email`,`The business_email field`)),e[`business-name`]===void 0&&(e[`business-name`]=await t(`business-name`,`The business_name field`)),e[`business-phone`]===void 0&&(e[`business-phone`]=await t(`business-phone`,`The business_phone field`)),e[`external-metadata`]===void 0&&(e[`external-metadata`]=await t(`external-metadata`,`The external_metadata field`));let r=o({business_address:u(e[`business-address`],`business-address`,`text`),business_email:u(e[`business-email`],`business-email`,`text`),business_name:u(e[`business-name`],`business-name`,`text`),business_phone:u(e[`business-phone`],`business-phone`,`text`),external_metadata:u(e[`external-metadata`],`external-metadata`,`text`)});s(await l(`Updating`,async()=>n.organizations.organizationProfile.update({body:r,organization_id:e[`organization-id`]})),{successLabel:`Updated`})}},q={command:`organization-profile`,describe:`Operations for organization-profile`,builder:e=>e.command(W).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`organization-id`,{type:`string`,description:`Organization identifier.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter shares by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`kind`,{type:`string`,description:`Filter shares by kind.`,choices:[`sent`,`received`]}).option(`target-type`,{type:`string`,description:`Filter shares by target_type.`,choices:[`account`,`organization`]}).option(`resource-types`,{type:`string`,description:`Filter share resources by resource_types.`}).option(`order`,{type:`string`,description:`Order shares by values in the given field.`,choices:[`name`,`created`]}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`list`,describe:`Lists all organization shares.`,builder:f(J),handler:async e=>{let t={status:e.status,kind:e.kind,target_type:e[`target-type`],resource_types:e[`resource-types`],order:e.order,direction:e.direction,page:e.page,per_page:e[`per-page`]};if(e.dryRun){c({command:`cf organizations shares list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}/shares`,pathParams:{"organization-id":String(e[`organization-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.organizations.shares.list({organization_id:e[`organization-id`],...t})),{successLabel:`Loaded`})}},X={command:`shares`,describe:`Operations for shares`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`organization-id`,{type:`string`,description:`The ID of the organization to modify.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`parent-id`,{type:`string`,description:`The parent.id field`}).option(`profile-business-address`,{type:`string`,description:`The profile.business_address field`}).option(`profile-business-email`,{type:`string`,description:`The profile.business_email field`}).option(`profile-business-name`,{type:`string`,description:`The profile.business_name field`}).option(`profile-business-phone`,{type:`string`,description:`The profile.business_phone field`}).option(`profile-external-metadata`,{type:`string`,description:`The profile.external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new details of the organization. Only accepts updates to "name" currently.`}).check(e=>{if([`parent-id`].some(t=>e[t]!==void 0)){let t=[`parent-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --parent-* flag is set`)}return!0}).check(e=>{if([`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].some(t=>e[t]!==void 0)){let t=[`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --profile-* flag is set`)}return!0})}const Q={command:`update <organization-id>`,describe:`Modify organization. (Currently in Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:Z,handler:async e=>{if(e.dryRun){c({command:`cf organizations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/organizations/${e[`organization-id`]==null?`<organization-id>`:encodeURIComponent(String(e[`organization-id`]))}`,pathParams:{"organization-id":String(e[`organization-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({name:u(e.name,`name`,`text`),parent:{id:u(e[`parent-id`],`parent-id`,`text`)},profile:{business_address:u(e[`profile-business-address`],`profile-business-address`,`text`),business_email:u(e[`profile-business-email`],`profile-business-email`,`text`),business_name:u(e[`profile-business-name`],`profile-business-name`,`text`),business_phone:u(e[`profile-business-phone`],`profile-business-phone`,`text`),external_metadata:u(e[`profile-external-metadata`],`profile-external-metadata`,`text`)}}):a(e.body)});return}let n=await i(e);if(e.body){let t=a(e.body);s(await l(`Updating`,async()=>n.organizations.update({body:t,organization_id:e[`organization-id`]})),{successLabel:`Updated`});return}e.name===void 0&&(e.name=await t(`name`,`The name field`));let r=o({name:u(e.name,`name`,`text`),parent:{id:u(e[`parent-id`],`parent-id`,`text`)},profile:{business_address:u(e[`profile-business-address`],`profile-business-address`,`text`),business_email:u(e[`profile-business-email`],`profile-business-email`,`text`),business_name:u(e[`profile-business-name`],`profile-business-name`,`text`),business_phone:u(e[`profile-business-phone`],`profile-business-phone`,`text`),external_metadata:u(e[`profile-external-metadata`],`profile-external-metadata`,`text`)}});s(await l(`Updating`,async()=>n.organizations.update({body:r,organization_id:e[`organization-id`]})),{successLabel:`Updated`})}},$={command:`organizations`,describe:`Multi-user organizations that group accounts, members, and shared settings under a single entity`,builder:e=>e.command(_).command(y).command(x).command(C).command(Q).command(h).command(D).command(z).command(A).command(H).command(q).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$ as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,E 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(`csr`,{type:`string`,description:`The Certificate Signing Request (CSR). Must be newline-encoded.`}).option(`hostnames`,{type:`string`,array:!0,description:"Array of hostnames or wildcard names bound to the certificate.\nHostnames must be fully qualified domain names (FQDNs) belonging to zones on your account (e.g., `example.com` or `sub.example.com`). Wildcards are supported only as a `*.` prefix for a single level (e.g., `*.example.com`). Double wildcards (`*.*.example.com`) and interior wildcards (`foo.*.example.com`) are not allowed. The wildcard suffix must be a multi-label domain (`*.example.com` is valid, but `*.com` is not). Unicode/IDN hostnames are accepted and automatically converted to punycode."}).option(`request-type`,{type:`string`,description:`Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).`,choices:[`origin-rsa`,`origin-ecc`,`keyless-certificate`]}).option(`requested-validity`,{type:`number`,description:`The number of days for which the certificate should be valid.`,default:5475}).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 f={command:`create`,describe:`Create an Origin CA certificate. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:d,handler:async n=>{if(n.dryRun){s({command:`cf origin-ca-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/certificates`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({csr:l(n.csr,`csr`,`text`),hostnames:n.hostnames,request_type:l(n[`request-type`],`request-type`,`text`),requested_validity:n[`requested-validity`]}):i(n.body)});return}let u=await r(n);if(n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.originCaCertificates.create({...e})),{successLabel:`Created`});return}if(n.csr===void 0&&(n.csr=await e(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),n.hostnames===void 0)throw Error(`--hostnames is required (or pass --body with this field set).`);n[`request-type`]===void 0&&(n[`request-type`]=await t(`request-type`,`Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).`,[`origin-rsa`,`origin-ecc`,`keyless-certificate`]));let d=a({csr:l(n.csr,`csr`,`text`),hostnames:n.hostnames,request_type:l(n[`request-type`],`request-type`,`text`),requested_validity:n[`requested-validity`]});o(await c(`Creating`,async()=>u.originCaCertificates.create({...d})),{successLabel:`Created`})}};function p(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const m={command:`delete <certificate-id>`,describe:`Revoke an existing Origin CA certificate by its serial number. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:p,handler:async e=>{if(e.dryRun){s({command:`cf origin-ca-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/certificates/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``)},bodyKind:`none`});return}let t=await r(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}o(await c(`Deleting`,async()=>t.originCaCertificates.delete({certificate_id:e[`certificate-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <certificate-id>`,describe:`Get an existing Origin CA certificate by its serial number. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf origin-ca-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/certificates/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``)},bodyKind:`none`});return}let t=await r(e);o(await c(`Loading`,async()=>t.originCaCertificates.get({certificate_id:e[`certificate-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`zone-id`,{type:`string`,description:`Identifier.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of records per page.`}).option(`limit`,{type:`number`,description:`Limit to the number of records returned.`}).option(`offset`,{type:`number`,description:`Offset the results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`List all existing Origin CA certificates for a given zone. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:u(_),handler:async e=>{let t={zone_id:e[`zone-id`],page:e.page,per_page:e[`per-page`],limit:e.limit,offset:e.offset};if(e.dryRun){s({command:`cf origin-ca-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/certificates`,pathParams:{},query:t,bodyKind:`none`});return}let n=await r(e);o(await c(`Loading`,async()=>n.originCaCertificates.list(t)),{successLabel:`Loaded`})}},y={command:`origin-ca-certificates`,describe:`Free Cloudflare-signed certificates installed on your origin server for Full (strict) SSL mode`,builder:e=>e.command(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{E as e,S as t,n}from"./auth-BqDOIrKX.mjs";import{n as r,t 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}from"./input-validation-CTqtyiY9.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically send a Post-Quantum keyshare in the first message to the origin (for fastest connections when the origin supports and prefers PQ), supported means that PQ algorithms are advertised but only used when requested by the origin, and off means that PQ algorithms are not advertised.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf origin-post-quantum-encryption get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/origin_post_quantum_encryption`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.originPostQuantumEncryption.get({zone_id:i})),{successLabel:`Loaded`})}};function d(e){return e.option(`value`,{type:`string`,description:`Value of the Origin Post Quantum Encryption Setting.`,choices:[`preferred`,`supported`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`update`,describe:`Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically send a Post-Quantum keyshare in the first message to the origin (for fastest connections when the origin supports and prefers PQ), supported means that PQ algorithms are advertised but only used when requested by the origin, and off means that PQ algorithms are not advertised.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf origin-post-quantum-encryption update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/cache/origin_post_quantum_encryption`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({value:c(l.value,`value`,`text`)}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.originPostQuantumEncryption.update({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await e(`value`,`Value of the Origin Post Quantum Encryption Setting.`,[`preferred`,`supported`,`off`]));let f=i({value:c(l.value,`value`,`text`)});a(await s(`Updating`,async()=>u.originPostQuantumEncryption.update({...f,zone_id:d})),{successLabel:`Updated`})}},p={command:`origin-post-quantum-encryption`,describe:`Enable post-quantum key exchange for connections between Cloudflare and your origin server`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,T as n,i as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of associations per page.`}).option(`status`,{type:`string`,description:`Filter associations by status. Use comma-separated values to filter by multiple statuses, or "all" to include every status. Defaults to "active" if not provided.`,choices:[`active`,`pending_deployment`,`pending_deletion`,`deleted`,`deployment_timed_out`,`deletion_timed_out`,`all`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`list`,describe:`List certificate ID - hostname associations for the given zone. Shows which hostnames are associated to which certificates for authenticated origin pulls.`,builder:d(f),handler:async e=>{let n={page:e.page,per_page:e[`per-page`],status:e.status};if(e.dryRun){c({command:`cf origin-tls-client-auth hostname-associations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(e),a=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>r.originTlsClientAuth.hostnameAssociations.list({zone_id:a,...n})),{successLabel:`Loaded`})}},m={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`certificate`,{type:`string`,description:`The hostname certificate.`}).option(`private-key`,{type:`string`,description:`The hostname certificate's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`create`,describe:`Upload a certificate to be used for client authentication on a hostname. 10 hostname certificates per zone are allowed.`,builder:h,handler:async n=>{if(n.dryRun){c({command:`cf origin-tls-client-auth hostname-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/origin_tls_client_auth/hostnames/certificates`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({certificate:u(n.certificate,`certificate`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)}):a(n.body)});return}let r=await i(n),d=await t({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=a(n.body);s(await l(`Creating`,async()=>r.originTlsClientAuth.hostnameCertificates.create({...e,zone_id:d})),{successLabel:`Created`});return}n.certificate===void 0&&(n.certificate=await e(`certificate`,`The hostname certificate.`)),n[`private-key`]===void 0&&(n[`private-key`]=await e(`private-key`,`The hostname certificate's private key.`,{kind:`secret`}));let f=o({certificate:u(n.certificate,`certificate`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)});s(await l(`Creating`,async()=>r.originTlsClientAuth.hostnameCertificates.create({...f,zone_id:d})),{successLabel:`Created`})}};function _(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <certificate-id>`,describe:"Removes a client certificate used for authenticated origin pulls on a specific hostname. Note: Before deleting the certificate, you must first invalidate the hostname for client authentication by sending a PUT request with `enabled` set to null. After invalidating the association, the certificate can be safely deleted.",builder:_,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth hostname-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames/certificates/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=await t({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}s(await l(`Deleting`,async()=>r.originTlsClientAuth.hostnameCertificates.delete({zone_id:a,certificate_id:e[`certificate-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <certificate-id>`,describe:`Get the certificate by ID to be used for client authentication on a hostname.`,builder:y,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth hostname-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames/certificates/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.hostnameCertificates.get({zone_id:r,certificate_id:e[`certificate-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Lists all client certificates configured for per-hostname authenticated origin pulls on the zone.`,builder:x,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth hostname-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames/certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.hostnameCertificates.list({zone_id:r})),{successLabel:`Loaded`})}},C={command:`hostname-certificates`,describe:`Operations for hostname-certificates`,builder:e=>e.command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`hostname`,{type:`string`,description:`The hostname on the origin for which the client certificate uploaded will be used.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <hostname>`,describe:`Retrieves the client certificate authentication status for a specific hostname, showing whether authenticated origin pulls are enabled.`,builder:w,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth hostnames get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{hostname:String(e.hostname??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.hostnames.get({zone_id:r,hostname:e.hostname})),{successLabel:`Loaded`})}};function E(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`update`,describe:`Associate a hostname to a certificate and enable, disable or invalidate the association. If disabled, client certificate will not be sent to the hostname even if activated at the zone level. 100 maximum associations on a single certificate are allowed. Note: Use a null value for parameter *enabled* to invalidate the association.`,builder:E,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth hostnames update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/hostnames`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let n=await i(e),o=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=o,e.body){let t=a(e.body);s(await l(`Updating`,async()=>n.originTlsClientAuth.hostnames.update({...t,zone_id:o})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>r(n,`PUT`,`/zones/${e.zoneId}/origin_tls_client_auth/hostnames`)),{successLabel:`Updated`})}},O={command:`hostnames`,describe:`Operations for hostnames`,builder:e=>e.command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get`,describe:`Get whether zone-level authenticated origin pulls is enabled or not. It is false by default.`,builder:k,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.settings.get({zone_id:r})),{successLabel:`Loaded`})}};function j(e){return e.option(`enabled`,{type:`boolean`,description:`Indicates whether zone-level authenticated origin pulls is enabled.`}).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:`update`,describe:`Enable or disable zone-level authenticated origin pulls. 'enabled' should be set true either before/after the certificate is uploaded to see the certificate in use.`,builder:j,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/settings`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({enabled:e.enabled}):a(e.body)});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=r,e.body){let t=a(e.body);s(await l(`Updating`,async()=>n.originTlsClientAuth.settings.update({...t,zone_id:r})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let u=o({enabled:e.enabled});s(await l(`Updating`,async()=>n.originTlsClientAuth.settings.update({...u,zone_id:r})),{successLabel:`Updated`})}},N={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`certificate`,{type:`string`,description:`The zone's leaf certificate.`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).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 F={command:`create`,describe:`Upload your own certificate you want Cloudflare to use for edge-to-origin communication to override the shared certificate. Please note that it is important to keep only one certificate active. Also, make sure to enable zone-level authenticated origin pulls by making a PUT call to settings endpoint to see the uploaded certificate in use.`,builder:P,handler:async n=>{if(n.dryRun){c({command:`cf origin-tls-client-auth zone-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/origin_tls_client_auth`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({certificate:u(n.certificate,`certificate`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)}):a(n.body)});return}let r=await i(n),d=await t({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=a(n.body);s(await l(`Creating`,async()=>r.originTlsClientAuth.zoneCertificates.create({...e,zone_id:d})),{successLabel:`Created`});return}n.certificate===void 0&&(n.certificate=await e(`certificate`,`The zone's leaf certificate.`)),n[`private-key`]===void 0&&(n[`private-key`]=await e(`private-key`,`The zone's private key.`,{kind:`secret`}));let f=o({certificate:u(n.certificate,`certificate`,`text`),private_key:u(n[`private-key`],`private-key`,`text`)});s(await l(`Creating`,async()=>r.originTlsClientAuth.zoneCertificates.create({...f,zone_id:d})),{successLabel:`Created`})}};function I(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const L={command:`delete <certificate-id>`,describe:`Removes a client certificate used for zone-level authenticated origin pulls.`,builder:I,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth zone-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=await t({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}s(await l(`Deleting`,async()=>r.originTlsClientAuth.zoneCertificates.delete({zone_id:a,certificate_id:e[`certificate-id`]})),{successLabel:`Deleted`})}};function R(e){return e.positional(`certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get <certificate-id>`,describe:`Retrieves details for a specific client certificate used in zone-level authenticated origin pulls.`,builder:R,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth zone-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth/${e[`certificate-id`]==null?`<certificate-id>`:encodeURIComponent(String(e[`certificate-id`]))}`,pathParams:{"certificate-id":String(e[`certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.zoneCertificates.get({zone_id:r,certificate_id:e[`certificate-id`]})),{successLabel:`Loaded`})}};function B(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`list`,describe:`Lists all client certificates configured for zone-level authenticated origin pulls.`,builder:B,handler:async e=>{if(e.dryRun){c({command:`cf origin-tls-client-auth zone-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin_tls_client_auth`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(e),r=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>n.originTlsClientAuth.zoneCertificates.list({zone_id:r})),{successLabel:`Loaded`})}},H={command:`zone-certificates`,describe:`Operations for zone-certificates`,builder:e=>e.command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`origin-tls-client-auth`,describe:`Authenticated Origin Pulls — require Cloudflare to present a client certificate when connecting to your origin`,builder:e=>e.command(m).command(C).command(O).command(N).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{U as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{n as e,r as t,t as n}from"./theme-CFHr0Dh9.mjs";function r(e){return typeof e==`object`&&e&&`result`in e&&Array.isArray(e.result)&&`result_info`in e?e.result:e}function i(t,i={}){if(!i.quiet){if(t=r(t),t==null){if(i.successLabel&&process.stderr.isTTY){let t=e();process.stderr.write(`${t.hex(n.success)(`✓`)} ${i.successLabel}\n`)}return}console.log(a(t))}}function a(n){let r=JSON.stringify(n,null,2);if(!t()||r.length>5e4)return r;let i=e();return r.replace(/"([^"]+)":/g,(e,t)=>`${i.cyan(`"${t}"`)}:`).replace(/: "([^"]*)"/g,(e,t)=>`: ${i.green(`"${t}"`)}`).replace(/: (-?\d+\.?\d*)/g,(e,t)=>`: ${i.yellow(t)}`).replace(/: (true|false)/g,(e,t)=>`: ${i.magenta(t)}`).replace(/: (null)/g,(e,t)=>`: ${i.dim(t)}`)}export{i as t};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,n}from"./auth-BqDOIrKX.mjs";import{n as r,t 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}from"./input-validation-CTqtyiY9.mjs";import{t as l}from"./cli-types-CMNMD1V7.mjs";function u(e){return e.option(`priority`,{type:`number`,description:`The priority of the rule, used to define which Page Rule is processed
3
+ over another. A higher number indicates a higher priority. For example,
4
+ if you have a catch-all Page Rule (rule A: \`/images/*\`) but want a more
5
+ specific Page Rule to take precedence (rule B: \`/images/special/*\`),
6
+ specify a higher priority for rule B so it overrides rule A.
7
+ `,default:1}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`],default:`disabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Creates a new Page Rule.`,builder:u,handler:async t=>{if(t.dryRun){o({command:`cf page-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/pagerules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({priority:t.priority,status:c(t.status,`status`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Creating`,async()=>l.pageRules.create({...e,zone_id:u})),{successLabel:`Created`});return}let d=i({priority:t.priority,status:c(t.status,`status`,`text`)});a(await s(`Creating`,async()=>l.pageRules.create({...d,zone_id:u})),{successLabel:`Created`})}};function f(e){return e.positional(`pagerule-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <pagerule-id>`,describe:`Deletes an existing Page Rule.`,builder:f,handler:async r=>{if(r.dryRun){o({command:`cf page-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/pagerules/${r[`pagerule-id`]==null?`<pagerule-id>`:encodeURIComponent(String(r[`pagerule-id`]))}`,pathParams:{"pagerule-id":String(r[`pagerule-id`]??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await e({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await t({force:!!r.force})){process.stderr.write(`Aborted.
8
+ `);return}a(await s(`Deleting`,async()=>i.pageRules.delete({zone_id:c,pagerule_id:r[`pagerule-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`pagerule-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`priority`,{type:`number`,description:`The priority of the rule, used to define which Page Rule is processed
9
+ over another. A higher number indicates a higher priority. For example,
10
+ if you have a catch-all Page Rule (rule A: \`/images/*\`) but want a more
11
+ specific Page Rule to take precedence (rule B: \`/images/special/*\`),
12
+ specify a higher priority for rule B so it overrides rule A.
13
+ `}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <pagerule-id>`,describe:`Updates one or more fields of an existing Page Rule.`,builder:m,handler:async t=>{if(t.dryRun){o({command:`cf page-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/pagerules/${t[`pagerule-id`]==null?`<pagerule-id>`:encodeURIComponent(String(t[`pagerule-id`]))}`,pathParams:{"pagerule-id":String(t[`pagerule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({priority:t.priority,status:c(t.status,`status`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Updating`,async()=>l.pageRules.edit({...e,zone_id:u,pagerule_id:t[`pagerule-id`]})),{successLabel:`Updated`});return}let d=i({priority:t.priority,status:c(t.status,`status`,`text`)});a(await s(`Updating`,async()=>l.pageRules.edit({...d,zone_id:u,pagerule_id:t[`pagerule-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`pagerule-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <pagerule-id>`,describe:`Fetches the details of a Page Rule.`,builder:g,handler:async t=>{if(t.dryRun){o({command:`cf page-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/pagerules/${t[`pagerule-id`]==null?`<pagerule-id>`:encodeURIComponent(String(t[`pagerule-id`]))}`,pathParams:{"pagerule-id":String(t[`pagerule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.pageRules.get({zone_id:i,pagerule_id:t[`pagerule-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`order`,{type:`string`,description:`The field used to sort returned Page Rules.`,choices:[`status`,`priority`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned Page Rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`Fetches Page Rules in a zone.`,builder:l(v),handler:async t=>{let r={order:t.order,direction:t.direction,match:t.match,status:t.status};if(t.dryRun){o({command:`cf page-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/pagerules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(t),c=await e({zone:t.zone},i,{quiet:t.quiet});t.zoneId=c,a(await s(`Loading`,async()=>i.pageRules.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function b(e){return e.positional(`pagerule-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`priority`,{type:`number`,description:`The priority of the rule, used to define which Page Rule is processed
14
+ over another. A higher number indicates a higher priority. For example,
15
+ if you have a catch-all Page Rule (rule A: \`/images/*\`) but want a more
16
+ specific Page Rule to take precedence (rule B: \`/images/special/*\`),
17
+ specify a higher priority for rule B so it overrides rule A.
18
+ `}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`update <pagerule-id>`,describe:`Replaces the configuration of an existing Page Rule. The configuration of the updated Page Rule will exactly match the data passed in the API request.`,builder:b,handler:async t=>{if(t.dryRun){o({command:`cf page-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/pagerules/${t[`pagerule-id`]==null?`<pagerule-id>`:encodeURIComponent(String(t[`pagerule-id`]))}`,pathParams:{"pagerule-id":String(t[`pagerule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({priority:t.priority,status:c(t.status,`status`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Updating`,async()=>l.pageRules.update({...e,zone_id:u,pagerule_id:t[`pagerule-id`]})),{successLabel:`Updated`});return}let d=i({priority:t.priority,status:c(t.status,`status`,`text`)});a(await s(`Updating`,async()=>l.pageRules.update({...d,zone_id:u,pagerule_id:t[`pagerule-id`]})),{successLabel:`Updated`})}},S={command:`page-rules`,describe:`Legacy URL-pattern rules that override zone settings for matching requests — prefer Rules/Transform Rules instead`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{S as default};
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,E as t,S as n,T as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(e){return e.positional(`connection-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get <connection-id>`,describe:`Fetches a connection detected by Page Shield by connection ID.`,builder:f,handler:async e=>{if(e.dryRun){c({command:`cf page-shield connections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/connections/${e[`connection-id`]==null?`<connection-id>`:encodeURIComponent(String(e[`connection-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"connection-id":String(e[`connection-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.connections.get({zone_id:r,connection_id:e[`connection-id`]})),{successLabel:`Loaded`})}};function m(e){return e.option(`exclude-urls`,{type:`string`,description:`Excludes connections whose URL contains one of the URL-encoded URLs separated by commas.`}).option(`urls`,{type:`string`,description:`Includes connections whose URL contain one or more URL-encoded URLs separated by commas.`}).option(`hosts`,{type:`string`,description:`Includes connections that match one or more URL-encoded hostnames separated by commas.
3
+
4
+ Wildcards are supported at the start and end of each hostname to support starts with, ends with
5
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results.
6
+
7
+ We additionally support a special value "all". When "all" is used, the API will return all the connections
8
+ with the applied filters in a single page. This feature is best-effort and it may only work for zones with
9
+ a low number of connections`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned connections.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned connections.`,choices:[`asc`,`desc`]}).option(`prioritize-malicious`,{type:`boolean`,description:`When true, malicious connections appear first in the returned connections.`}).option(`exclude-cdn-cgi`,{type:`boolean`,description:"When true, excludes connections seen in a `/cdn-cgi` path from the returned connections. The default value is true."}).option(`status`,{type:`string`,description:"Filters the returned connections using a comma-separated list of connection statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default value is `active`."}).option(`page-url`,{type:`string`,description:`Includes connections that match one or more page URLs (separated by commas) where they were last seen
10
+
11
+ Wildcards are supported at the start and end of each page URL to support starts with, ends with
12
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of connections as a file, limited to 50000 entries.`,choices:[`csv`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`list`,describe:`Lists all connections detected by Page Shield.`,builder:d(m),handler:async e=>{let t={exclude_urls:e[`exclude-urls`],urls:e.urls,hosts:e.hosts,page:e.page,per_page:e[`per-page`],order_by:e[`order-by`],direction:e.direction,prioritize_malicious:e[`prioritize-malicious`],exclude_cdn_cgi:e[`exclude-cdn-cgi`],status:e.status,page_url:e[`page-url`],export:e.export};if(e.dryRun){c({command:`cf page-shield connections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/connections`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>r.pageShield.connections.list({zone_id:a,...t})),{successLabel:`Loaded`})}},g={command:`connections`,describe:`Third-party connections made by scripts on your pages — track data exfiltration risks`,builder:e=>e.command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.positional(`cookie-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <cookie-id>`,describe:`Fetches a cookie collected by Page Shield by cookie ID.`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf page-shield cookies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/cookies/${e[`cookie-id`]==null?`<cookie-id>`:encodeURIComponent(String(e[`cookie-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"cookie-id":String(e[`cookie-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.cookies.get({zone_id:r,cookie_id:e[`cookie-id`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`hosts`,{type:`string`,description:`Includes cookies that match one or more URL-encoded hostnames separated by commas.
13
+
14
+ Wildcards are supported at the start and end of each hostname to support starts with, ends with
15
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results.
16
+
17
+ We additionally support a special value "all". When "all" is used, the API will return all the cookies
18
+ with the applied filters in a single page. This feature is best-effort and it may only work for zones with
19
+ a low number of cookies`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned cookies.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned cookies.'`,choices:[`asc`,`desc`]}).option(`page-url`,{type:`string`,description:`Includes connections that match one or more page URLs (separated by commas) where they were last seen
20
+
21
+ Wildcards are supported at the start and end of each page URL to support starts with, ends with
22
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of cookies as a file, limited to 50000 entries.`,choices:[`csv`]}).option(`name`,{type:`string`,description:`Filters the returned cookies that match the specified name.
23
+ Wildcards are supported at the start and end to support starts with, ends with
24
+ and contains. e.g. session*`}).option(`secure`,{type:`boolean`,description:`Filters the returned cookies that are set with Secure`}).option(`http-only`,{type:`boolean`,description:`Filters the returned cookies that are set with HttpOnly`}).option(`same-site`,{type:`string`,description:`Filters the returned cookies that match the specified same_site attribute`,choices:[`lax`,`strict`,`none`]}).option(`type`,{type:`string`,description:`Filters the returned cookies that match the specified type attribute`,choices:[`first_party`,`unknown`]}).option(`path`,{type:`string`,description:`Filters the returned cookies that match the specified path attribute`}).option(`domain`,{type:`string`,description:`Filters the returned cookies that match the specified domain attribute`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Lists all cookies collected by Page Shield.`,builder:d(y),handler:async e=>{let t={hosts:e.hosts,page:e.page,per_page:e[`per-page`],order_by:e[`order-by`],direction:e.direction,page_url:e[`page-url`],export:e.export,name:e.name,secure:e.secure,http_only:e[`http-only`],same_site:e[`same-site`],type:e.type,path:e.path,domain:e.domain};if(e.dryRun){c({command:`cf page-shield cookies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/cookies`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>r.pageShield.cookies.list({zone_id:a,...t})),{successLabel:`Loaded`})}},x={command:`cookies`,describe:`Cookies set by scripts on your pages with classification and same-site attribute tracking`,builder:e=>e.command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Fetches the Page Shield settings.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf page-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.get({zone_id:r})),{successLabel:`Loaded`})}};function w(e){return e.option(`action`,{type:`string`,description:`The action to take if the expression matches`,choices:[`allow`,`log`,`add_reporting_directives`]}).option(`description`,{type:`string`,description:`A description for the policy`}).option(`enabled`,{type:`boolean`,description:`Whether the policy is enabled`}).option(`expression`,{type:`string`,description:`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`}).option(`value`,{type:`string`,description:`The policy which will be applied`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Create a Page Shield policy.`,builder:w,handler:async r=>{if(r.dryRun){c({command:`cf page-shield policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/page_shield/policies`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?o({action:u(r.action,`action`,`text`),description:u(r.description,`description`,`text`),enabled:r.enabled,expression:u(r.expression,`expression`,`text`),value:u(r.value,`value`,`text`)}):a(r.body)});return}let d=await i(r),f=await n({zone:r.zone},d,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=a(r.body);s(await l(`Creating`,async()=>d.pageShield.policies.create({...e,zone_id:f})),{successLabel:`Created`});return}if(r.action===void 0&&(r.action=await t(`action`,`The action to take if the expression matches`,[`allow`,`log`,`add_reporting_directives`])),r.description===void 0&&(r.description=await e(`description`,`A description for the policy`)),r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);r.expression===void 0&&(r.expression=await e(`expression`,`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`)),r.value===void 0&&(r.value=await e(`value`,`The policy which will be applied`));let p=o({action:u(r.action,`action`,`text`),description:u(r.description,`description`,`text`),enabled:r.enabled,expression:u(r.expression,`expression`,`text`),value:u(r.value,`value`,`text`)});s(await l(`Creating`,async()=>d.pageShield.policies.create({...p,zone_id:f})),{successLabel:`Created`})}};function E(e){return e.positional(`policy-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 D={command:`delete <policy-id>`,describe:`Delete a Page Shield policy by ID.`,builder:E,handler:async e=>{if(e.dryRun){c({command:`cf page-shield policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"policy-id":String(e[`policy-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await r({force:!!e.force})){process.stderr.write(`Aborted.
25
+ `);return}s(await l(`Deleting`,async()=>t.pageShield.policies.delete({zone_id:a,policy_id:e[`policy-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`policy-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <policy-id>`,describe:`Fetches a Page Shield policy by ID.`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf page-shield policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"policy-id":String(e[`policy-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.policies.get({zone_id:r,policy_id:e[`policy-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists all Page Shield policies.`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf page-shield policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/policies`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.policies.list({zone_id:r})),{successLabel:`Loaded`})}};function M(e){return e.positional(`policy-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`action`,{type:`string`,description:`The action to take if the expression matches`,choices:[`allow`,`log`,`add_reporting_directives`]}).option(`description`,{type:`string`,description:`A description for the policy`}).option(`enabled`,{type:`boolean`,description:`Whether the policy is enabled`}).option(`expression`,{type:`string`,description:`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`}).option(`value`,{type:`string`,description:`The policy which will be applied`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`update <policy-id>`,describe:`Update a Page Shield policy by ID.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf page-shield policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"policy-id":String(e[`policy-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({action:u(e.action,`action`,`text`),description:u(e.description,`description`,`text`),enabled:e.enabled,expression:u(e.expression,`expression`,`text`),value:u(e.value,`value`,`text`)}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.pageShield.policies.update({...n,zone_id:r,policy_id:e[`policy-id`]})),{successLabel:`Updated`});return}let d=o({action:u(e.action,`action`,`text`),description:u(e.description,`description`,`text`),enabled:e.enabled,expression:u(e.expression,`expression`,`text`),value:u(e.value,`value`,`text`)});s(await l(`Updating`,async()=>t.pageShield.policies.update({...d,zone_id:r,policy_id:e[`policy-id`]})),{successLabel:`Updated`})}},P={command:`policies`,describe:`Content Security Policies that control which scripts and connections are allowed on your pages`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.positional(`script-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <script-id>`,describe:`Fetches a script detected by Page Shield by script ID.`,builder:F,handler:async e=>{if(e.dryRun){c({command:`cf page-shield scripts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/scripts/${e[`script-id`]==null?`<script-id>`:encodeURIComponent(String(e[`script-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"script-id":String(e[`script-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.pageShield.scripts.get({zone_id:r,script_id:e[`script-id`]})),{successLabel:`Loaded`})}};function L(e){return e.option(`exclude-urls`,{type:`string`,description:`Excludes scripts whose URL contains one of the URL-encoded URLs separated by commas.`}).option(`urls`,{type:`string`,description:`Includes scripts whose URL contain one or more URL-encoded URLs separated by commas.`}).option(`hosts`,{type:`string`,description:`Includes scripts that match one or more URL-encoded hostnames separated by commas.
26
+
27
+ Wildcards are supported at the start and end of each hostname to support starts with, ends with
28
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results.
29
+
30
+ We additionally support a special value "all". When "all" is used, the API will return all the scripts
31
+ with the applied filters in a single page. This feature is best-effort and it may only work for zones with
32
+ a low number of scripts`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned scripts.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned scripts.`,choices:[`asc`,`desc`]}).option(`prioritize-malicious`,{type:`boolean`,description:`When true, malicious scripts appear first in the returned scripts.`}).option(`exclude-cdn-cgi`,{type:`boolean`,description:"When true, excludes scripts seen in a `/cdn-cgi` path from the returned scripts. The default value is true."}).option(`exclude-duplicates`,{type:`boolean`,description:`When true, excludes duplicate scripts. We consider a script duplicate of another if their javascript
33
+ content matches and they share the same url host and zone hostname. In such case, we return the most
34
+ recent script for the URL host and zone hostname combination.`}).option(`status`,{type:`string`,description:"Filters the returned scripts using a comma-separated list of scripts statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default value is `active`."}).option(`page-url`,{type:`string`,description:`Includes scripts that match one or more page URLs (separated by commas) where they were last seen
35
+
36
+ Wildcards are supported at the start and end of each page URL to support starts with, ends with
37
+ and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of scripts as a file, limited to 50000 entries.`,choices:[`csv`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`Lists all scripts detected by Page Shield.`,builder:d(L),handler:async e=>{let t={exclude_urls:e[`exclude-urls`],urls:e.urls,hosts:e.hosts,page:e.page,per_page:e[`per-page`],order_by:e[`order-by`],direction:e.direction,prioritize_malicious:e[`prioritize-malicious`],exclude_cdn_cgi:e[`exclude-cdn-cgi`],exclude_duplicates:e[`exclude-duplicates`],status:e.status,page_url:e[`page-url`],export:e.export};if(e.dryRun){c({command:`cf page-shield scripts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield/scripts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>r.pageShield.scripts.list({zone_id:a,...t})),{successLabel:`Loaded`})}},z={command:`scripts`,describe:`JavaScript files detected on your pages with change tracking and malicious code detection`,builder:e=>e.command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`enabled`,{type:`boolean`,description:`When true, indicates that Page Shield is enabled.`}).option(`use-cloudflare-reporting-endpoint`,{type:`boolean`,description:`When true, CSP reports will be sent to https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report`}).option(`use-connection-url-path`,{type:`boolean`,description:`When true, the paths associated with connections URLs will also be analyzed.`}).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:`update`,describe:`Updates Page Shield settings.`,builder:B,handler:async e=>{if(e.dryRun){c({command:`cf page-shield update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/page_shield`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({enabled:e.enabled,use_cloudflare_reporting_endpoint:e[`use-cloudflare-reporting-endpoint`],use_connection_url_path:e[`use-connection-url-path`]}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.pageShield.update({...n,zone_id:r})),{successLabel:`Updated`});return}let u=o({enabled:e.enabled,use_cloudflare_reporting_endpoint:e[`use-cloudflare-reporting-endpoint`],use_connection_url_path:e[`use-connection-url-path`]});s(await l(`Updating`,async()=>t.pageShield.update({...u,zone_id:r})),{successLabel:`Updated`})}},H={command:`page-shield`,describe:`Client-side security — monitor JavaScript, connections, and cookies on your pages for supply-chain attacks`,builder:e=>e.command(C).command(V).command(g).command(x).command(P).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{H as default};