cf 0.7.0 → 0.8.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 (174) hide show
  1. package/dist/_meta/agent-context.json +1 -1
  2. package/dist/_meta/commands.json +9 -112
  3. package/dist/{abuse-reports-BsF9JZPW.mjs → abuse-reports-C6GFnuYE.mjs} +1 -1
  4. package/dist/{account-D8mYiWxQ.mjs → account-DxzpnGA8.mjs} +1 -1
  5. package/dist/{accounts-CJci1Oez.mjs → accounts-6RFDuFLF.mjs} +1 -1
  6. package/dist/{acm-CmCd985Q.mjs → acm-Bndi5Jqo.mjs} +1 -1
  7. package/dist/{addressing-R7p6TRBe.mjs → addressing-C8HB4n_n.mjs} +1 -1
  8. package/dist/ai-B4La9Oqk.mjs +8 -0
  9. package/dist/{ai-audit-B0vJNOZG.mjs → ai-audit-B9kKFhoY.mjs} +1 -1
  10. package/dist/{ai-gateway-D3vJR3My.mjs → ai-gateway-Bx9MzNxL.mjs} +1 -1
  11. package/dist/{ai-search-CNg7W7U4.mjs → ai-search-BgIOIgXd.mjs} +1 -1
  12. package/dist/{alerting-_sdM0B0S.mjs → alerting-DVI-v6mE.mjs} +1 -1
  13. package/dist/{analytics-BFBJhDrP.mjs → analytics-B98epmDb.mjs} +1 -1
  14. package/dist/{analytics_engine-CWhFvyeK.mjs → analytics_engine-DwDePA2c.mjs} +1 -1
  15. package/dist/{api-gateway-D4AIEtUq.mjs → api-gateway-DW2GX64w.mjs} +1 -1
  16. package/dist/{argo-Bjk6nFfs.mjs → argo-DKEx-B66.mjs} +1 -1
  17. package/dist/{artifacts-Ba4b3iOa.mjs → artifacts-BEU8fBqt.mjs} +1 -1
  18. package/dist/{audit-logs-BE0T5All.mjs → audit-logs-DZiEPYL0.mjs} +1 -1
  19. package/dist/{auth-D_zyQbDR.mjs → auth-009DISzb.mjs} +1 -1
  20. package/dist/{auth-CZ0E51rF.mjs → auth-B1CY5zpC.mjs} +2 -2
  21. package/dist/{billing-Dz6Zj8Eq.mjs → billing-10B4_1qb.mjs} +1 -1
  22. package/dist/{bot-management-pFwIbFi-.mjs → bot-management-D51WzJBO.mjs} +1 -1
  23. package/dist/{botnet-feed-BY9uGChY.mjs → botnet-feed-Dw-leAwX.mjs} +1 -1
  24. package/dist/{brand-protection-DkPAk2Cz.mjs → brand-protection-BTYkTsER.mjs} +1 -1
  25. package/dist/{browser-extension-D9P6Yv8i.mjs → browser-extension-BFa5Ky8u.mjs} +1 -1
  26. package/dist/{browser-run-DhHtz4y3.mjs → browser-run-BMA8Z_hI.mjs} +1 -1
  27. package/dist/build-C1FOoThn.mjs +70 -0
  28. package/dist/{cache-DVhkiIGK.mjs → cache-DrX4gWvg.mjs} +1 -1
  29. package/dist/{calls-95zjvIcO.mjs → calls-m4WyL1Rb.mjs} +1 -1
  30. package/dist/{certificate-authorities-BowBqbVq.mjs → certificate-authorities-BA-S8NE-.mjs} +1 -1
  31. package/dist/{cf-BLT7uKJF.mjs → cf-BhDnTcDR.mjs} +7 -7
  32. package/dist/chunk-2SIGYDH3-_JSHaszR.mjs +473 -0
  33. package/dist/{chunk-6IEM75FG-BEjRFMGh.mjs → chunk-Q72B4Q5Z-B-N_eqrM.mjs} +1 -1
  34. package/dist/{client-certificates-D6mE4vJu.mjs → client-certificates-5h-fXoNq.mjs} +1 -1
  35. package/dist/{cloud-connector-DmwsjeFN.mjs → cloud-connector-ywFQuqtV.mjs} +1 -1
  36. package/dist/{cloudforce-one-CG3TT7IN.mjs → cloudforce-one-CPx4C-r3.mjs} +1 -1
  37. package/dist/{completions-DMc_PlIw.mjs → completions-CCRu-jvY.mjs} +1 -1
  38. package/dist/{connectivity-DJkE3crz.mjs → connectivity-y-Gav-Ge.mjs} +1 -1
  39. package/dist/{connector-interrupts-DTgQ7onV.mjs → connector-interrupts-Bs-jfuh8.mjs} +1 -1
  40. package/dist/{connector-telemetry-events-D0rTHDou.mjs → connector-telemetry-events-Bc6f3xpx.mjs} +1 -1
  41. package/dist/{connector-telemetry-snapshots--0QmD3z6.mjs → connector-telemetry-snapshots-Bl54XZ3h.mjs} +1 -1
  42. package/dist/{connectors-zWaZTi2A.mjs → connectors-BnQq_R19.mjs} +1 -1
  43. package/dist/{content-scanning-CGvGf04y.mjs → content-scanning-Bxk-WkSL.mjs} +1 -1
  44. package/dist/{ct-alerting-ebSPSWNC.mjs → ct-alerting-BSn2Jqou.mjs} +1 -1
  45. package/dist/{custom-certificates-CWUrPYLP.mjs → custom-certificates-BBqr4S9W.mjs} +1 -1
  46. package/dist/{custom-csrs-CRtdrF9R.mjs → custom-csrs-CXeBzLUy.mjs} +1 -1
  47. package/dist/{custom-hostnames-CVQSksqq.mjs → custom-hostnames-CfCOedoN.mjs} +1 -1
  48. package/dist/{custom-nameservers-BRwbIdsX.mjs → custom-nameservers-RPXeu7f_.mjs} +1 -1
  49. package/dist/{custom-pages-Ci8sTQX7.mjs → custom-pages-xGG1xo88.mjs} +1 -1
  50. package/dist/{d1-78Ym1P6D.mjs → d1-CRIOfBsJ.mjs} +1 -1
  51. package/dist/{data-security-zmFoMwRU.mjs → data-security-D5Sw5rwj.mjs} +1 -1
  52. package/dist/{dcv-delegation-Dd4FZ2IG.mjs → dcv-delegation-BBnlgr6F.mjs} +1 -1
  53. package/dist/deploy-D0_KIUpW.mjs +2 -0
  54. package/dist/deploy-input-CdWrpzPA.mjs +1178 -0
  55. package/dist/{dev-DSslyDXx.mjs → dev-Bz87BeKt.mjs} +1 -1
  56. package/dist/{diagnostics-B8Ev5m_o.mjs → diagnostics-C1qryRf4.mjs} +1 -1
  57. package/dist/{dispatch-namespaces-Dm5vGeEP.mjs → dispatch-namespaces-DbosPgPV.mjs} +1 -1
  58. package/dist/{dist-BH-4NQOV.mjs → dist-C-6VkMPZ.mjs} +35 -35
  59. package/dist/dist-CnaLMpVH.mjs +18 -0
  60. package/dist/{dns-D7VAaCyO.mjs → dns-ByufYrJH.mjs} +1 -1
  61. package/dist/{dns-firewall-ByLCsf0q.mjs → dns-firewall-CiokCKRr.mjs} +1 -1
  62. package/dist/{durable-objects-BIpvyu9m.mjs → durable-objects-DjF-WAD3.mjs} +1 -1
  63. package/dist/{email-auth-Cx--s8W4.mjs → email-auth-B4BIYMb-.mjs} +1 -1
  64. package/dist/{email-routing-CiDbivcN.mjs → email-routing-BbbtpVyS.mjs} +1 -1
  65. package/dist/{email-security-BYeAuSc6.mjs → email-security-DuBVypAO.mjs} +1 -1
  66. package/dist/{email-sending-Dg2rSmHH.mjs → email-sending-5g-k05Lv.mjs} +1 -1
  67. package/dist/{filters-DZ8YnQ90.mjs → filters-CzJmLFcS.mjs} +1 -1
  68. package/dist/{firewall-DEd1hs_I.mjs → firewall-CjmeWA2M.mjs} +1 -1
  69. package/dist/{flagship-DVw7xGoP.mjs → flagship-BfyVrWP-.mjs} +1 -1
  70. package/dist/{fraud-BbGS3FZs.mjs → fraud-reRvxNg-.mjs} +1 -1
  71. package/dist/{google-tag-gateway-CBnRGYQR.mjs → google-tag-gateway-CGwzMZU1.mjs} +1 -1
  72. package/dist/{healthchecks-Da9N3ix4.mjs → healthchecks-BhCsPWcG.mjs} +1 -1
  73. package/dist/{hostnames-mimZu2tB.mjs → hostnames-JpgQW4kn.mjs} +1 -1
  74. package/dist/{hyperdrive-BNdvxOos.mjs → hyperdrive-iwYttuwV.mjs} +1 -1
  75. package/dist/{iam-DGQ-OgRl.mjs → iam-ffI98_4v.mjs} +1 -1
  76. package/dist/{images-CI6Iy9ho.mjs → images-Bgb9DGlr.mjs} +1 -1
  77. package/dist/index.mjs +1 -1
  78. package/dist/{intel-BDB-aRtU.mjs → intel-DVRjKpyU.mjs} +1 -1
  79. package/dist/{ips-B9UuPvsY.mjs → ips-BtLRO19r.mjs} +1 -1
  80. package/dist/{keyless-certificates-Ua9uJgPt.mjs → keyless-certificates-13w8KOcC.mjs} +1 -1
  81. package/dist/{kv-BHerx4dZ.mjs → kv-CvQyF_NB.mjs} +1 -1
  82. package/dist/{leaked-credential-checks-B8Vunj9h.mjs → leaked-credential-checks-DvY8VReW.mjs} +1 -1
  83. package/dist/{load-balancers-DSjS5WKw.mjs → load-balancers-6lgExyS7.mjs} +1 -1
  84. package/dist/{logexplorer-DBIfTlRP.mjs → logexplorer-DBfrK1hn.mjs} +1 -1
  85. package/dist/{logo-matches-C00iGpzW.mjs → logo-matches-XS2RaxQu.mjs} +1 -1
  86. package/dist/{logos-CJLhx1go.mjs → logos-COtlpbRq.mjs} +1 -1
  87. package/dist/{logpush-Cr1U-eK-.mjs → logpush-CIpiK3Xl.mjs} +1 -1
  88. package/dist/{logs-DMvtchc6.mjs → logs-0KjIf_3g.mjs} +1 -1
  89. package/dist/{magic-cloud-networking-FQfO8QWH.mjs → magic-cloud-networking-q_d9-he-.mjs} +1 -1
  90. package/dist/{magic-network-monitoring-CDd70fJQ.mjs → magic-network-monitoring-DLNCrUsn.mjs} +1 -1
  91. package/dist/{magic-transit-DiKiPUax.mjs → magic-transit-sIwSlzoK.mjs} +1 -1
  92. package/dist/{managed-transforms-fPVUTrAv.mjs → managed-transforms-BKRjmzJS.mjs} +1 -1
  93. package/dist/{matches-B0yHbQ2I.mjs → matches-DZLS60M2.mjs} +1 -1
  94. package/dist/{moq-UgBawOXe.mjs → moq-Dbb9QhC1.mjs} +1 -1
  95. package/dist/{mtls-certificates-xKUbC5EL.mjs → mtls-certificates-BpIqoWpc.mjs} +1 -1
  96. package/dist/{network-interconnects-BJzOE2ny.mjs → network-interconnects-DZwGJFYT.mjs} +1 -1
  97. package/dist/{oauth-DBJ5GSFk.mjs → oauth-DC9g9uK_.mjs} +1 -1
  98. package/dist/{observability-B-1y36QS.mjs → observability-CVLjPAir.mjs} +1 -1
  99. package/dist/{open-YWOUIZ5Y-CFRcYALi.mjs → open-PBXRGS4R-D5C2-7de.mjs} +1 -1
  100. package/dist/{organization-Dq3PClZ7.mjs → organization-BGF8N1QQ.mjs} +1 -1
  101. package/dist/{organizations-AhsQkHyX.mjs → organizations-BInE8nlx.mjs} +1 -1
  102. package/dist/{origin-ca-certificates-CRgF0UyU.mjs → origin-ca-certificates-wPzWcEa0.mjs} +1 -1
  103. package/dist/{origin-post-quantum-encryption-BXTx7DPa.mjs → origin-post-quantum-encryption-t1Cl9hiy.mjs} +1 -1
  104. package/dist/{origin-tls-client-auth-BDw5q-6G.mjs → origin-tls-client-auth-Cvr9D8eq.mjs} +1 -1
  105. package/dist/{page-rules-DqYQ23eg.mjs → page-rules-CMo73oVb.mjs} +1 -1
  106. package/dist/{page-shield-DKdlZOLO.mjs → page-shield-Z23iqabu.mjs} +1 -1
  107. package/dist/{pages-BsXF11Kv.mjs → pages-ByaZvYjA.mjs} +1 -1
  108. package/dist/{pay-per-crawl-BGAwuAP3.mjs → pay-per-crawl-BXTenh_d.mjs} +1 -1
  109. package/dist/{pipelines-D_QhSnGW.mjs → pipelines-7KWm5BYN.mjs} +1 -1
  110. package/dist/{progress-O88q63Bk.mjs → progress-BLQ2xXwD.mjs} +1 -1
  111. package/dist/{prompt-DTAWiEm2.mjs → prompt-DcfYBioA.mjs} +1 -1
  112. package/dist/{queries-CAE95-OH.mjs → queries-Cgx1lQbn.mjs} +1 -1
  113. package/dist/{queues-BBz35Mqd.mjs → queues-jnugmCYI.mjs} +1 -1
  114. package/dist/{r2-Zp99S5xF.mjs → r2-Dllx7F7a.mjs} +1 -1
  115. package/dist/{r2-data-catalog-BeVLZwrE.mjs → r2-data-catalog-CaAAPwKp.mjs} +1 -1
  116. package/dist/{radar-Cij-XVQJ.mjs → radar-DLSHX2_1.mjs} +1 -1
  117. package/dist/{rate-limits-DSdToIWv.mjs → rate-limits-DlVTd6QY.mjs} +1 -1
  118. package/dist/{raw-fetch-DgezeshQ.mjs → raw-fetch-CeW1mW_u.mjs} +1 -1
  119. package/dist/{realtime-kit-9rJcapfM.mjs → realtime-kit-ct8Fu2kO.mjs} +1 -1
  120. package/dist/{registrar-CXViZlah.mjs → registrar-CKTB7QTM.mjs} +1 -1
  121. package/dist/{registrar-sandbox-CvQyjXLJ.mjs → registrar-sandbox-1-nNk6Uy.mjs} +1 -1
  122. package/dist/{request-tracers-DATfBnE9.mjs → request-tracers-DO6lno0x.mjs} +1 -1
  123. package/dist/{resource-sharing-Cmhn6ghR.mjs → resource-sharing-DYhXJw44.mjs} +1 -1
  124. package/dist/{resource-tagging-BTn05AOj.mjs → resource-tagging-CcKWMF9l.mjs} +1 -1
  125. package/dist/{rules-ens3OHme.mjs → rules-DQKR3qb7.mjs} +1 -1
  126. package/dist/{rulesets-bkreZRao.mjs → rulesets-B9fZb_JY.mjs} +1 -1
  127. package/dist/{rum-CpgXFcwl.mjs → rum-BaJio_GD.mjs} +1 -1
  128. package/dist/{schema-validation-Ca6o94ts.mjs → schema-validation-Cqv8KT1B.mjs} +1 -1
  129. package/dist/{scim-C4oT8TMc.mjs → scim-DkYH1dep.mjs} +1 -1
  130. package/dist/{secrets-store-CWEuiDNo.mjs → secrets-store-CMR_pA1t.mjs} +1 -1
  131. package/dist/{security-center-BOvm7xy6.mjs → security-center-DCHfgCq6.mjs} +1 -1
  132. package/dist/{security-txt-BCAUBctN.mjs → security-txt-D19uTyaf.mjs} +1 -1
  133. package/dist/{session-B1ARgLG7.mjs → session-CQpgz61H.mjs} +1 -1
  134. package/dist/{share-DhmVspmL.mjs → share-CfJbt0WU.mjs} +1 -1
  135. package/dist/shared-D0xvDsDl.mjs +2 -0
  136. package/dist/{smart-shield-DZm4fn6z.mjs → smart-shield-BG5WOmi1.mjs} +1 -1
  137. package/dist/{snippets-oQ0u26-z.mjs → snippets-CYiSdx7R.mjs} +1 -1
  138. package/dist/{spawn-ChG5Xi9Z.mjs → spawn-j3dn7A69.mjs} +1 -1
  139. package/dist/{spectrum-Cnkee5Ww.mjs → spectrum-Qvq3yJax.mjs} +1 -1
  140. package/dist/{speed-DqNnvLBD.mjs → speed-vpoB9msm.mjs} +1 -1
  141. package/dist/{src-By-zTCHz.mjs → src-Bn0FyQIp.mjs} +5 -5
  142. package/dist/{ssl-tS3CYZsZ.mjs → ssl-Qw8eVAiS.mjs} +1 -1
  143. package/dist/{state-OsdDJvdj.mjs → state-C2cBU9iK.mjs} +1 -1
  144. package/dist/{stream-Bud9Os5V.mjs → stream-BNbkY3zI.mjs} +1 -1
  145. package/dist/{submit-BtP8she2.mjs → submit-pQNW7uWj.mjs} +1 -1
  146. package/dist/{tenant-CMwHa-tU.mjs → tenant-xkvdAutS.mjs} +1 -1
  147. package/dist/{token-validation-BYC7HTok.mjs → token-validation-5F2AbQCz.mjs} +1 -1
  148. package/dist/triggers-CYdZhJYr.mjs +2 -0
  149. package/dist/{turnstile-CP4nScaL.mjs → turnstile-BSIaunXn.mjs} +1 -1
  150. package/dist/{ui-BNoF0KpD.mjs → ui-CTo5OG9r.mjs} +1 -1
  151. package/dist/{url-info-Chs9h7Y-.mjs → url-info-Q7m7AVih.mjs} +1 -1
  152. package/dist/{url-normalization-XYxW5Gj0.mjs → url-normalization-Bs2m5jlD.mjs} +1 -1
  153. package/dist/{url-scanner-D4pYNlO-.mjs → url-scanner-CYmT3C99.mjs} +1 -1
  154. package/dist/{user-DtefniLc.mjs → user-Bay_0p3C.mjs} +1 -1
  155. package/dist/{vectorize-BeAY2g-7.mjs → vectorize-cP2OuB5N.mjs} +1 -1
  156. package/dist/{versions-dMW3bLVv.mjs → versions-D7F26fhH.mjs} +1 -1
  157. package/dist/{waiting-rooms-K78HeeTg.mjs → waiting-rooms-B5HR1-37.mjs} +1 -1
  158. package/dist/{web3-Dhw79l4S.mjs → web3-DqCXM4sx.mjs} +1 -1
  159. package/dist/{workers-l3zMNOU6.mjs → workers-Cu-A8AZc.mjs} +1 -1
  160. package/dist/{workers-builds-CuOAB3u4.mjs → workers-builds-CmCg27M-.mjs} +1 -1
  161. package/dist/{workflows-rb7RYBKP.mjs → workflows-DavS4SEh.mjs} +1 -1
  162. package/dist/{zaraz-CHecMYuo.mjs → zaraz-CKcVy5Xa.mjs} +1 -1
  163. package/dist/{zero-trust-DAZoa-Aj.mjs → zero-trust-BKVqb2yq.mjs} +1 -1
  164. package/dist/{zone-BnnqJwW-.mjs → zone-BOcuY4sU.mjs} +1 -1
  165. package/dist/{zones-DpI2YikF.mjs → zones-BR-9WaY7.mjs} +1 -1
  166. package/package.json +5 -4
  167. package/dist/ai-BzJg0RIX.mjs +0 -3
  168. package/dist/build-CWuStmDi.mjs +0 -2
  169. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +0 -397
  170. package/dist/deploy-CVvkZFjR.mjs +0 -2
  171. package/dist/lib-Og5sB51C.mjs +0 -68
  172. package/dist/shared-Bod3-Exx.mjs +0 -990
  173. /package/dist/{schema-DCF4yEp_.mjs → schema-DAW-B7wT.mjs} +0 -0
  174. /package/dist/{tools-Dru4l8yh.mjs → tools-BpNGzfj2.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{i as t,n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{n as o,t as s}from"./body-parser-BO6mfo_W.mjs";import{n as c}from"./input-validation-BwUR9z8e.mjs";import{n as l,r as u,t as d}from"./prompt-DTAWiEm2.mjs";import{t as f}from"./cli-types-CFw6Xygp.mjs";function p(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema 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:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:p,handler:async t=>{if(t.dryRun){i({command:`cf schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({kind:c(t.kind,`kind`,`text`),name:c(t.name,`name`,`text`),source:c(t.source,`source`,`text`),validation_enabled:t[`validation-enabled`]}):o(t.body)});return}let d=await n(t),f=await e({zone:t.zone},d,{quiet:t.quiet});if(t.zoneId=f,t.body){let e=o(t.body);r(await a(`Creating`,async()=>d.schemaValidation.schemas.create({...e,zone_id:f})),{successLabel:`Created`});return}if(t.kind===void 0&&(t.kind=await l(`kind`,`The kind of the schema`,[`openapi_v3`])),t.name===void 0&&(t.name=await u(`name`,`A human-readable name for the schema`)),t.source===void 0&&(t.source=await u(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),t[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let p=s({kind:c(t.kind,`kind`,`text`),name:c(t.name,`name`,`text`),source:c(t.source,`source`,`text`),validation_enabled:t[`validation-enabled`]});r(await a(`Creating`,async()=>d.schemaValidation.schemas.create({...p,zone_id:f})),{successLabel:`Created`})}};function h(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield. Operations using this schema will lose their validation rules.`,builder:h,handler:async t=>{if(t.dryRun){i({command:`cf schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"schema-id":String(t[`schema-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await d({force:!!t.force})){process.stderr.write(`Aborted.
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{i as t,n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{n as o,t as s}from"./body-parser-BO6mfo_W.mjs";import{n as c}from"./input-validation-BwUR9z8e.mjs";import{n as l,r as u,t as d}from"./prompt-DcfYBioA.mjs";import{t as f}from"./cli-types-CFw6Xygp.mjs";function p(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema 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:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:p,handler:async t=>{if(t.dryRun){i({command:`cf schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({kind:c(t.kind,`kind`,`text`),name:c(t.name,`name`,`text`),source:c(t.source,`source`,`text`),validation_enabled:t[`validation-enabled`]}):o(t.body)});return}let d=await n(t),f=await e({zone:t.zone},d,{quiet:t.quiet});if(t.zoneId=f,t.body){let e=o(t.body);r(await a(`Creating`,async()=>d.schemaValidation.schemas.create({...e,zone_id:f})),{successLabel:`Created`});return}if(t.kind===void 0&&(t.kind=await l(`kind`,`The kind of the schema`,[`openapi_v3`])),t.name===void 0&&(t.name=await u(`name`,`A human-readable name for the schema`)),t.source===void 0&&(t.source=await u(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),t[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let p=s({kind:c(t.kind,`kind`,`text`),name:c(t.name,`name`,`text`),source:c(t.source,`source`,`text`),validation_enabled:t[`validation-enabled`]});r(await a(`Creating`,async()=>d.schemaValidation.schemas.create({...p,zone_id:f})),{successLabel:`Created`})}};function h(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield. Operations using this schema will lose their validation rules.`,builder:h,handler:async t=>{if(t.dryRun){i({command:`cf schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"schema-id":String(t[`schema-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await d({force:!!t.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>o.schemaValidation.schemas.delete({zone_id:s,schema_id:t[`schema-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`validation-enabled`,{type:`boolean`,description:`Flag whether schema is enabled for validation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <schema-id>`,describe:`Modifies an existing OpenAPI schema in API Shield, updating the validation rules for associated API operations.`,builder:_,handler:async t=>{if(t.dryRun){i({command:`cf schema-validation schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"schema-id":String(t[`schema-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({validation_enabled:t[`validation-enabled`]}):o(t.body)});return}let c=await n(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=o(t.body);r(await a(`Updating`,async()=>c.schemaValidation.schemas.edit({...e,zone_id:l,schema_id:t[`schema-id`]})),{successLabel:`Updated`});return}let u=s({validation_enabled:t[`validation-enabled`]});r(await a(`Updating`,async()=>c.schemaValidation.schemas.edit({...u,zone_id:l,schema_id:t[`schema-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <schema-id>`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Shield.`,builder:y,handler:async t=>{let o={omit_source:t[`omit-source`]};if(t.dryRun){i({command:`cf schema-validation schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"schema-id":String(t[`schema-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.schemaValidation.schemas.get({zone_id:c,schema_id:t[`schema-id`],...o})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:x,handler:async t=>{let o={page:t.page,per_page:t[`per-page`]};if(t.dryRun){i({command:`cf schema-validation schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/hosts`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.schemaValidation.schemas.hosts.list({zone_id:c,...o})),{successLabel:`Loaded`})}},C={command:`hosts`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`validation-enabled`,{type:`boolean`,description:`Filter for enabled schemas`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield with pagination support.`,builder:w,handler:async t=>{let o={page:t.page,per_page:t[`per-page`],omit_source:t[`omit-source`],validation_enabled:t[`validation-enabled`]};if(t.dryRun){i({command:`cf schema-validation schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.schemaValidation.schemas.list({zone_id:c,...o})),{successLabel:`Loaded`})}};function E(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <schema-id>`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:f(E),handler:async t=>{let o={feature:t.feature,host:t.host,method:t.method,endpoint:t.endpoint,page:t.page,per_page:t[`per-page`],operation_status:t[`operation-status`]};if(t.dryRun){i({command:`cf schema-validation schemas operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/schema_validation/schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}/operations`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"schema-id":String(t[`schema-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.schemaValidation.schemas.operations.get({zone_id:c,schema_id:t[`schema-id`],...o})),{successLabel:`Loaded`})}},O={command:`operations`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},k={command:`schemas`,describe:`Uploaded API schemas used to validate incoming requests against expected formats`,builder:e=>e.command(m).command(g).command(v).command(b).command(T).command(C).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
4
4
  Mitigation actions are as follows:
5
5
 
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{i as n,n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./input-validation-BwUR9z8e.mjs";import{t as u}from"./prompt-DTAWiEm2.mjs";import{t as d}from"./cli-types-CFw6Xygp.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const p={command:`create`,describe:"Creates a new SCIM Group (user group) for the account. The `displayName` must not be empty and must not begin with `CF` (reserved for system groups).",builder:f,handler:async u=>{if(u.dryRun){a({command:`cf scim groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function m(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <group-id>`,describe:`Deletes a SCIM Group (custom user groups only). System groups backed by Cloudflare permission groups cannot be deleted via SCIM. Returns 204 No Content on success.`,builder:m,handler:async n=>{if(n.dryRun){a({command:`cf scim groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups/${n[`group-id`]==null?`<group-id>`:encodeURIComponent(String(n[`group-id`]))}`,pathParams:{"group-id":String(n[`group-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await u({force:!!n.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{i as n,n as r}from"./auth-B1CY5zpC.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-BLQ2xXwD.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./input-validation-BwUR9z8e.mjs";import{t as u}from"./prompt-DcfYBioA.mjs";import{t as d}from"./cli-types-CFw6Xygp.mjs";function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const p={command:`create`,describe:"Creates a new SCIM Group (user group) for the account. The `displayName` must not be empty and must not begin with `CF` (reserved for system groups).",builder:f,handler:async u=>{if(u.dryRun){a({command:`cf scim groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function m(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <group-id>`,describe:`Deletes a SCIM Group (custom user groups only). System groups backed by Cloudflare permission groups cannot be deleted via SCIM. Returns 204 No Content on success.`,builder:m,handler:async n=>{if(n.dryRun){a({command:`cf scim groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups/${n[`group-id`]==null?`<group-id>`:encodeURIComponent(String(n[`group-id`]))}`,pathParams:{"group-id":String(n[`group-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await u({force:!!n.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
3
3
  `);return}i(await o(`Deleting`,async()=>c.scim.groups.delete({account_id:l,group_id:n[`group-id`]})),{successLabel:`Deleted`})}};function g(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const _={command:`edit <group-id>`,describe:"Partially updates a SCIM Group via PATCH operations (RFC 7644 Section 3.5.2). Supports add, remove, and replace operations on `members`, `displayName`, and `externalId`. For system groups (prefixed `cloudflare-v1-`), only member management operations are supported.",builder:g,handler:async u=>{if(u.dryRun){a({command:`cf scim groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups/${u[`group-id`]==null?`<group-id>`:encodeURIComponent(String(u[`group-id`]))}`,pathParams:{"group-id":String(u[`group-id`]??``)},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Updating`,async()=>n(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(u[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Updating`,async()=>n(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(u[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <group-id>`,describe:`Retrieves a single SCIM Group resource by group ID.`,builder:v,handler:async n=>{if(n.dryRun){a({command:`cf scim groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups/${n[`group-id`]==null?`<group-id>`:encodeURIComponent(String(n[`group-id`]))}`,pathParams:{"group-id":String(n[`group-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.groups.get({account_id:l,group_id:n[`group-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `displayName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:"Lists SCIM Group resources for the account. Returns both system groups (backed by Cloudflare permission groups, prefixed `cloudflare-v1-`) and custom user groups. Supports filtering by `displayName` using SCIM filter syntax.",builder:b,handler:async n=>{let c={startIndex:n[`start-index`],count:n.count,filter:n.filter};if(n.dryRun){a({command:`cf scim groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.scim.groups.list({account_id:u,...c})),{successLabel:`Loaded`})}},S={command:`groups`,describe:`Groups operations`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`resource-type-id`,{type:`string`,description:`The resource type identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <resource-type-id>`,describe:"Returns a single SCIM resource type by ID (RFC 7643 Section 6). Valid IDs are `User` and `Group`.",builder:d(C),handler:async n=>{if(n.dryRun){a({command:`cf scim resource-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/ResourceTypes/${n[`resource-type-id`]==null?`<resource-type-id>`:encodeURIComponent(String(n[`resource-type-id`]))}`,pathParams:{"resource-type-id":String(n[`resource-type-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.resourceTypes.get({account_id:l,resource_type_id:n[`resource-type-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Returns the list of SCIM resource types supported by the Cloudflare SCIM service (RFC 7643 Section 6, RFC 7644 Section 4). Clients use this to discover available resource categories (e.g. Users, Groups) and their associated schemas. Query parameters are not supported on this endpoint.`,builder:T,handler:async n=>{if(n.dryRun){a({command:`cf scim resource-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/ResourceTypes`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.resourceTypes.list({account_id:l})),{successLabel:`Loaded`})}},D={command:`resource-types`,describe:`Resource Types operations`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`schema-id`,{type:`string`,description:`The schema URI identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <schema-id>`,describe:"Returns a single SCIM schema definition by schema URI ID (RFC 7643 Section 7). Valid IDs are `urn:ietf:params:scim:schemas:core:2.0:User` and `urn:ietf:params:scim:schemas:core:2.0:Group`.",builder:O,handler:async n=>{if(n.dryRun){a({command:`cf scim schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Schemas/${n[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(n[`schema-id`]))}`,pathParams:{"schema-id":String(n[`schema-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.schemas.get({account_id:l,schema_id:n[`schema-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:`Returns the list of SCIM schemas supported by the Cloudflare SCIM service (RFC 7643 Section 7, RFC 7644 Section 4). Clients use this to introspect the attributes of each resource type. Query parameters are not supported on this endpoint.`,builder:A,handler:async n=>{if(n.dryRun){a({command:`cf scim schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Schemas`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.schemas.list({account_id:l})),{successLabel:`Loaded`})}},M={command:`schemas`,describe:`Schemas operations`,builder:e=>e.command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get`,describe:`Returns the SCIM 2.0 Service Provider configuration (RFC 7643 Section 5). IdPs use this endpoint to auto-configure their SCIM integration with Cloudflare, discovering which optional features (patch, bulk, filter, etc.) are supported.`,builder:N,handler:async n=>{if(n.dryRun){a({command:`cf scim service-provider-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/ServiceProviderConfig`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.serviceProviderConfig.get({account_id:l})),{successLabel:`Loaded`})}},F={command:`service-provider-config`,describe:`Service Provider Config operations`,builder:e=>e.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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const L={command:`create`,describe:"Provisions a new account member via SCIM. The `userName` field must be a valid email address and must match the primary email in `emails`. The account must be an Enterprise account with SCIM entitlements enabled.",builder:I,handler:async u=>{if(u.dryRun){a({command:`cf scim users create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function R(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const z={command:`delete <user-id>`,describe:`Deprovisions a SCIM User by removing their membership from this account (RFC 7644 Section 3.6). This does not delete the global Cloudflare user.`,builder:R,handler:async n=>{if(n.dryRun){a({command:`cf scim users delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users/${n[`user-id`]==null?`<user-id>`:encodeURIComponent(String(n[`user-id`]))}`,pathParams:{"user-id":String(n[`user-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await u({force:!!n.force,message:`Are you sure you want to remove this user from the account?`})){process.stderr.write(`Aborted.
4
4
  `);return}i(await o(`Deleting`,async()=>c.scim.users.delete({account_id:l,user_id:n[`user-id`]})),{successLabel:`Deleted`})}};function B(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const V={command:`edit <user-id>`,describe:'Partially updates a SCIM User via PATCH operations (RFC 7644 Section 3.5.2). Supports updating `userName`, `name.givenName`, `name.familyName`, and `active`. Setting `active: false` deprovisions the user (removes them from the account). For IdP compatibility, `emails[type eq "work"].value` is also accepted as an alias for `userName`.',builder:B,handler:async u=>{if(u.dryRun){a({command:`cf scim users edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users/${u[`user-id`]==null?`<user-id>`:encodeURIComponent(String(u[`user-id`]))}`,pathParams:{"user-id":String(u[`user-id`]??``)},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Updating`,async()=>n(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(u[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Updating`,async()=>n(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(u[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function H(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get <user-id>`,describe:`Retrieves a single account member as a SCIM User resource by user tag.`,builder:H,handler:async n=>{if(n.dryRun){a({command:`cf scim users get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users/${n[`user-id`]==null?`<user-id>`:encodeURIComponent(String(n[`user-id`]))}`,pathParams:{"user-id":String(n[`user-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.scim.users.get({account_id:l,user_id:n[`user-id`]})),{successLabel:`Loaded`})}};function W(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `userName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`list`,describe:'Lists account members as SCIM User resources. Supports optional filtering by `userName` (email) using the SCIM filter syntax (e.g. `userName eq "user@example.com"`). Pagination is controlled via `startIndex` and `count` query parameters per RFC 7644 Section 3.4.2.4.',builder:W,handler:async n=>{let c={startIndex:n[`start-index`],count:n.count,filter:n.filter};if(n.dryRun){a({command:`cf scim users list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.scim.users.list({account_id:u,...c})),{successLabel:`Loaded`})}};function K(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const q={command:`update <user-id>`,describe:"Replaces a SCIM User resource (RFC 7644 Section 3.5.1). Fully replaces the mutable attributes of the user. Supports updating `userName`, `name`, `emails`, and `active`.",builder:K,handler:async u=>{if(u.dryRun){a({command:`cf scim users update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/scim/v2/Users/${u[`user-id`]==null?`<user-id>`:encodeURIComponent(String(u[`user-id`]))}`,pathParams:{"user-id":String(u[`user-id`]??``)},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?s:await t();if(u.accountId=f,u.file){let e=l(u.file);i(await o(`Updating`,async()=>n(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(u[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body){let e=c(u.body,`body`,`binary`);i(await o(`Updating`,async()=>n(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(u[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(u.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},J={command:`users`,describe:`Users operations`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Y={command:`scim`,describe:`SCIM 2.0 provisioning — manage users, groups, and identity provider sync for your account`,builder:e=>e.command(S).command(D).command(M).command(F).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Y as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DTAWiEm2.mjs";import{t as f}from"./cli-types-CFw6Xygp.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:`get`,describe:`Lists the number of secrets used in the account.`,builder:p,handler:async s=>{if(s.dryRun){i({command:`cf secrets-store quota get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/quota`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.secretsStore.quota.get({account_id:l})),{successLabel:`Loaded`})}},h={command:`quota`,describe:`Account quota limits for secrets stores, secrets count, and storage capacity`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.positional(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`create <store-id>`,describe:`Creates a secret in the account.`,builder:g,handler:async c=>{if(c.dryRun){i({command:`cf secrets-store secrets bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${c[`store-id`]==null?`<store-id>`:encodeURIComponent(String(c[`store-id`]))}/secrets`,pathParams:{"store-id":String(c[`store-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,c.body){let e=s(c.body);r(await a(`Creating`,async()=>l.secretsStore.secrets.bulk.create({body:e,account_id:u,store_id:c[`store-id`]})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.positional(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`List of secret identifier tags to delete.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk deleting secrets.`})}const y={command:`delete <store-id>`,describe:`Deletes one or more secrets.`,builder:v,handler:async l=>{if(l.dryRun){i({command:`cf secrets-store secrets bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${l[`store-id`]==null?`<store-id>`:encodeURIComponent(String(l[`store-id`]))}/secrets`,pathParams:{"store-id":String(l[`store-id`]??``)},bodyKind:`json`,body:l.body===void 0?c({ids:l.ids}):s(l.body)});return}let u=await n(l),f=l.local?o:await t();if(l.accountId=f,!await d({force:!!l.force})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DcfYBioA.mjs";import{t as f}from"./cli-types-CFw6Xygp.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:`get`,describe:`Lists the number of secrets used in the account.`,builder:p,handler:async s=>{if(s.dryRun){i({command:`cf secrets-store quota get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/quota`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.secretsStore.quota.get({account_id:l})),{successLabel:`Loaded`})}},h={command:`quota`,describe:`Account quota limits for secrets stores, secrets count, and storage capacity`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.positional(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`create <store-id>`,describe:`Creates a secret in the account.`,builder:g,handler:async c=>{if(c.dryRun){i({command:`cf secrets-store secrets bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${c[`store-id`]==null?`<store-id>`:encodeURIComponent(String(c[`store-id`]))}/secrets`,pathParams:{"store-id":String(c[`store-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,c.body){let e=s(c.body);r(await a(`Creating`,async()=>l.secretsStore.secrets.bulk.create({body:e,account_id:u,store_id:c[`store-id`]})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.positional(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`List of secret identifier tags to delete.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk deleting secrets.`})}const y={command:`delete <store-id>`,describe:`Deletes one or more secrets.`,builder:v,handler:async l=>{if(l.dryRun){i({command:`cf secrets-store secrets bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${l[`store-id`]==null?`<store-id>`:encodeURIComponent(String(l[`store-id`]))}/secrets`,pathParams:{"store-id":String(l[`store-id`]??``)},bodyKind:`json`,body:l.body===void 0?c({ids:l.ids}):s(l.body)});return}let u=await n(l),f=l.local?o:await t();if(l.accountId=f,!await d({force:!!l.force})){process.stderr.write(`Aborted.
3
3
  `);return}if(l.body){let e=s(l.body);r(await a(`Deleting`,async()=>u.secretsStore.secrets.bulk.delete({...e,account_id:f,store_id:l[`store-id`]})),{successLabel:`Deleted`});return}if(l.ids===void 0)throw Error(`--ids is required (or pass --body with this field set).`);let p=c({ids:l.ids});r(await a(`Deleting`,async()=>u.secretsStore.secrets.bulk.delete({...p,account_id:f,store_id:l[`store-id`]})),{successLabel:`Deleted`})}},b={command:`bulk`,describe:`Encrypted key-value secrets within a store. Pass --store-id to scope.`,builder:e=>e.command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.positional(`secret-id`,{type:`string`,description:`Secret identifier.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete <secret-id>`,describe:`Deletes a single secret.`,builder:x,handler:async s=>{if(s.dryRun){i({command:`cf secrets-store secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${s[`store-id`]==null?`<store-id>`:encodeURIComponent(String(s[`store-id`]))}/secrets/${s[`secret-id`]==null?`<secret-id>`:encodeURIComponent(String(s[`secret-id`]))}`,pathParams:{"store-id":String(s[`store-id`]??``),"secret-id":String(s[`secret-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
4
4
  `);return}r(await a(`Deleting`,async()=>c.secretsStore.secrets.delete({account_id:l,store_id:s[`store-id`],secret_id:s[`secret-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`secret-id`,{type:`string`,description:`Secret identifier.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret.`}).option(`name`,{type:`string`,description:`The name of the secret.`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`duplicate <secret-id>`,describe:`Creates a duplicate of the secret, keeping the value.`,builder:C,handler:async d=>{if(d.dryRun){i({command:`cf secrets-store secrets duplicate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${d[`store-id`]==null?`<store-id>`:encodeURIComponent(String(d[`store-id`]))}/secrets/${d[`secret-id`]==null?`<secret-id>`:encodeURIComponent(String(d[`secret-id`]))}/duplicate`,pathParams:{"store-id":String(d[`store-id`]??``),"secret-id":String(d[`secret-id`]??``)},bodyKind:`json`,body:d.body===void 0?c({comment:l(d.comment,`comment`,`text`),name:l(d.name,`name`,`text`),scopes:d.scopes}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.secretsStore.secrets.duplicate({...e,account_id:p,store_id:d[`store-id`],secret_id:d[`secret-id`]})),{successLabel:`Created`});return}if(d.name===void 0&&(d.name=await u(`name`,`The name of the secret.`)),d.scopes===void 0)throw Error(`--scopes is required (or pass --body with this field set).`);let m=c({comment:l(d.comment,`comment`,`text`),name:l(d.name,`name`,`text`),scopes:d.scopes});r(await a(`Creating`,async()=>f.secretsStore.secrets.duplicate({...m,account_id:p,store_id:d[`store-id`],secret_id:d[`secret-id`]})),{successLabel:`Created`})}};function T(e){return e.positional(`secret-id`,{type:`string`,description:`Secret identifier.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`comment`,{type:`string`,description:`Freeform text describing the secret.`}).option(`scopes`,{type:`string`,array:!0,description:`The list of services that can use this secret.`}).option(`value`,{type:`string`,description:`The value of the secret. Maximum 64 KiB (65,536 bytes). Note that this is 'write only' - the API never returns this value; it exists only to create or modify secrets.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`edit <secret-id>`,describe:`Updates a single secret.`,builder:T,handler:async u=>{if(u.dryRun){i({command:`cf secrets-store secrets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${u[`store-id`]==null?`<store-id>`:encodeURIComponent(String(u[`store-id`]))}/secrets/${u[`secret-id`]==null?`<secret-id>`:encodeURIComponent(String(u[`secret-id`]))}`,pathParams:{"store-id":String(u[`store-id`]??``),"secret-id":String(u[`secret-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({comment:l(u.comment,`comment`,`text`),scopes:u.scopes,value:l(u.value,`value`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Updating`,async()=>d.secretsStore.secrets.edit({...e,account_id:f,store_id:u[`store-id`],secret_id:u[`secret-id`]})),{successLabel:`Updated`});return}let p=c({comment:l(u.comment,`comment`,`text`),scopes:u.scopes,value:l(u.value,`value`,`text`)});r(await a(`Updating`,async()=>d.secretsStore.secrets.edit({...p,account_id:f,store_id:u[`store-id`],secret_id:u[`secret-id`]})),{successLabel:`Updated`})}};function D(e){return e.positional(`secret-id`,{type:`string`,description:`Secret identifier.`,demandOption:!0}).option(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <secret-id>`,describe:`Returns details of a single secret.`,builder:D,handler:async s=>{if(s.dryRun){i({command:`cf secrets-store secrets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${s[`store-id`]==null?`<store-id>`:encodeURIComponent(String(s[`store-id`]))}/secrets/${s[`secret-id`]==null?`<secret-id>`:encodeURIComponent(String(s[`secret-id`]))}`,pathParams:{"store-id":String(s[`store-id`]??``),"secret-id":String(s[`secret-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.secretsStore.secrets.get({account_id:l,store_id:s[`store-id`],secret_id:s[`secret-id`]})),{successLabel:`Loaded`})}};function k(e){return e.option(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page.`}).option(`search`,{type:`string`,description:`Search secrets using a filter string, filtering across name and comment.`}).option(`order`,{type:`string`,description:`Order secrets by values in the given field.`,choices:[`name`,`comment`,`created`,`modified`,`status`]}).option(`scopes`,{type:`string`,description:`Only secrets with the given scopes will be returned.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Lists all store secrets.`,builder:f(k),handler:async s=>{let c={direction:s.direction,page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,scopes:s.scopes};if(s.dryRun){i({command:`cf secrets-store secrets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores/${s[`store-id`]==null?`<store-id>`:encodeURIComponent(String(s[`store-id`]))}/secrets`,pathParams:{"store-id":String(s[`store-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.secretsStore.secrets.list({account_id:u,store_id:s[`store-id`],...c})),{successLabel:`Loaded`})}},j={command:`secrets`,describe:`Encrypted key-value secrets within a store. Pass --store-id to scope.`,builder:e=>e.command(S).command(w).command(E).command(O).command(A).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`name`,{type:`string`,description:`The name of the store.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`create`,describe:`Creates a store in the account.`,builder:M,handler:async d=>{if(d.dryRun){i({command:`cf secrets-store stores create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/secrets_store/stores`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`)}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.secretsStore.stores.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`The name of the store.`));let m=c({name:l(d.name,`name`,`text`)});r(await a(`Creating`,async()=>f.secretsStore.stores.create({...m,account_id:p})),{successLabel:`Created`})}};function P(e){return e.positional(`store-id`,{type:`string`,description:`Store identifier.`,demandOption:!0}).option(`force`,{type:`boolean`,description:`When true, cascade-deletes all secrets in the store before deleting the store itself.
5
5
  Required when deleting a non-empty store. Without this parameter, attempting to
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{D as e,O as t,w as n}from"./oauth-DBJ5GSFk.mjs";import{n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./body-parser-BO6mfo_W.mjs";import{t as u}from"./cli-types-CFw6Xygp.mjs";function d(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves Security Center insight counts aggregated by classification class.`,builder:u(d),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/class`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.class.get({account_id:u,...c})),{successLabel:`Loaded`})}},p={command:`class`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`dismiss <issue-id>`,describe:`Archives a Security Center insight for an account, removing it from the active insights list while preserving historical data.`,builder:m,handler:async e=>{if(e.dryRun){a({command:`cf security-center insights dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(e[`issue-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({dismiss:e.dismiss}):c(e.body)});return}let u=await r(e),d=e.local?s:await n();if(e.accountId=d,e.body){let t=c(e.body);i(await o(`Updating`,async()=>u.securityCenter.insights.dismiss({...t,account_id:d,issue_id:e[`issue-id`]})),{successLabel:`Updated`});return}let f=l({dismiss:e.dismiss});i(await o(`Updating`,async()=>u.securityCenter.insights.dismiss({...f,account_id:d,issue_id:e[`issue-id`]})),{successLabel:`Updated`})}};function g(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`list`,describe:`Lists all Security Center insights for the account, showing security findings and recommendations.`,builder:u(g),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject,page:e.page,per_page:e[`per-page`]};if(e.dryRun){a({command:`cf security-center insights list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.list({account_id:u,...c})),{successLabel:`Loaded`})}};function v(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves Security Center insight counts aggregated by severity level (critical, high, medium, low).`,builder:u(v),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/severity`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.severity.get({account_id:u,...c})),{successLabel:`Loaded`})}},b={command:`severity`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Retrieves Security Center insight counts aggregated by insight type.`,builder:u(x),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/type`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.type.get({account_id:u,...c})),{successLabel:`Loaded`})}},C={command:`type`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},w={command:`insights`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(h).command(_).command(p).command(b).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get`,describe:`Returns account-level Security Center state: whether scans are enabled for the account and whether the account was recently reactivated from a dormant state.`,builder:T,handler:async e=>{if(e.dryRun){a({command:`cf security-center state get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/state`,pathParams:{},bodyKind:`none`});return}let c=await r(e),l=e.local?s:await n();e.accountId=l,i(await o(`Loading`,async()=>c.securityCenter.state.get({account_id:l})),{successLabel:`Loaded`})}};function D(e){return e.option(`scans-enabled`,{type:`boolean`,description:`Enable or disable scans for the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update`,describe:`Updates account-level Security Center state. Currently supports enabling or disabling scans for the account. Returns the account's state after the update.`,builder:D,handler:async e=>{if(e.dryRun){a({command:`cf security-center state update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/state`,pathParams:{},bodyKind:`json`,body:e.body===void 0?l({scans_enabled:e[`scans-enabled`]}):c(e.body)});return}let u=await r(e),d=e.local?s:await n();if(e.accountId=d,e.body){let t=c(e.body);i(await o(`Updating`,async()=>u.securityCenter.state.update({...t,account_id:d})),{successLabel:`Updated`});return}if(e[`scans-enabled`]===void 0)throw Error(`--scans-enabled is required (or pass --body with this field set).`);let f=l({scans_enabled:e[`scans-enabled`]});i(await o(`Updating`,async()=>u.securityCenter.state.update({...f,account_id:d})),{successLabel:`Updated`})}},k={command:`state`,describe:`Operations for state`,builder:e=>e.command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by classification class.`,builder:u(A),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/class`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.class.get({zone_id:c,...n})),{successLabel:`Loaded`})}},M={command:`class`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <issue-id>`,describe:`Returns the full context payload for an insight. This endpoint is used for insights with large payloads that are not included inline in the list response.`,builder:N,handler:async e=>{if(e.dryRun){a({command:`cf security-center zone-insights context get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/context`,pathParams:{"issue-id":String(e[`issue-id`]??``)},bodyKind:`none`});return}let c=await r(e),l=e.local?s:await n();e.accountId=l,i(await o(`Loading`,async()=>c.securityCenter.zoneInsights.context.get({account_id:l,issue_id:e[`issue-id`]})),{successLabel:`Loaded`})}},F={command:`context`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`update <issue-id>`,describe:`Archives a zone-specific Security Center insight, removing it from the active zone insights while preserving historical data.`,builder:I,handler:async t=>{if(t.dryRun){a({command:`cf security-center zone-insights dismiss update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/${t[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(t[`issue-id`]))}/dismiss`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"issue-id":String(t[`issue-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({dismiss:t.dismiss}):c(t.body)});return}let n=await r(t),s=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=s,t.body){let e=c(t.body);i(await o(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...e,zone_id:s,issue_id:t[`issue-id`]})),{successLabel:`Updated`});return}let u=l({dismiss:t.dismiss});i(await o(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...u,zone_id:s,issue_id:t[`issue-id`]})),{successLabel:`Updated`})}},R={command:`dismiss`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Lists Security Center insights for a specific zone, showing zone-level security findings.`,builder:u(z),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject,page:t.page,per_page:t[`per-page`]};if(t.dryRun){a({command:`cf security-center zone-insights get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.get({zone_id:c,...n})),{successLabel:`Loaded`})}};function V(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by severity level.`,builder:u(V),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/severity`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.severity.get({zone_id:c,...n})),{successLabel:`Loaded`})}},U={command:`severity`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by insight type.`,builder:u(W),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/type`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.type.get({zone_id:c,...n})),{successLabel:`Loaded`})}},K={command:`type`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`zone-insights`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(B).command(M).command(F).command(R).command(U).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`security-center`,describe:`Security posture dashboard — view and manage security insights, misconfigurations, and vulnerabilities`,builder:e=>e.command(w).command(k).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{J as default};
2
+ import{D as e,O as t,w as n}from"./oauth-DC9g9uK_.mjs";import{n as r}from"./auth-B1CY5zpC.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-BLQ2xXwD.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./body-parser-BO6mfo_W.mjs";import{t as u}from"./cli-types-CFw6Xygp.mjs";function d(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves Security Center insight counts aggregated by classification class.`,builder:u(d),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/class`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.class.get({account_id:u,...c})),{successLabel:`Loaded`})}},p={command:`class`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`dismiss <issue-id>`,describe:`Archives a Security Center insight for an account, removing it from the active insights list while preserving historical data.`,builder:m,handler:async e=>{if(e.dryRun){a({command:`cf security-center insights dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(e[`issue-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({dismiss:e.dismiss}):c(e.body)});return}let u=await r(e),d=e.local?s:await n();if(e.accountId=d,e.body){let t=c(e.body);i(await o(`Updating`,async()=>u.securityCenter.insights.dismiss({...t,account_id:d,issue_id:e[`issue-id`]})),{successLabel:`Updated`});return}let f=l({dismiss:e.dismiss});i(await o(`Updating`,async()=>u.securityCenter.insights.dismiss({...f,account_id:d,issue_id:e[`issue-id`]})),{successLabel:`Updated`})}};function g(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`list`,describe:`Lists all Security Center insights for the account, showing security findings and recommendations.`,builder:u(g),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject,page:e.page,per_page:e[`per-page`]};if(e.dryRun){a({command:`cf security-center insights list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.list({account_id:u,...c})),{successLabel:`Loaded`})}};function v(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves Security Center insight counts aggregated by severity level (critical, high, medium, low).`,builder:u(v),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/severity`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.severity.get({account_id:u,...c})),{successLabel:`Loaded`})}},b={command:`severity`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Retrieves Security Center insight counts aggregated by insight type.`,builder:u(x),handler:async e=>{let c={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){a({command:`cf security-center insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/type`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(e),u=e.local?s:await n();e.accountId=u,i(await o(`Loading`,async()=>l.securityCenter.insights.type.get({account_id:u,...c})),{successLabel:`Loaded`})}},C={command:`type`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},w={command:`insights`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(h).command(_).command(p).command(b).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get`,describe:`Returns account-level Security Center state: whether scans are enabled for the account and whether the account was recently reactivated from a dormant state.`,builder:T,handler:async e=>{if(e.dryRun){a({command:`cf security-center state get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/state`,pathParams:{},bodyKind:`none`});return}let c=await r(e),l=e.local?s:await n();e.accountId=l,i(await o(`Loading`,async()=>c.securityCenter.state.get({account_id:l})),{successLabel:`Loaded`})}};function D(e){return e.option(`scans-enabled`,{type:`boolean`,description:`Enable or disable scans for the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update`,describe:`Updates account-level Security Center state. Currently supports enabling or disabling scans for the account. Returns the account's state after the update.`,builder:D,handler:async e=>{if(e.dryRun){a({command:`cf security-center state update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/state`,pathParams:{},bodyKind:`json`,body:e.body===void 0?l({scans_enabled:e[`scans-enabled`]}):c(e.body)});return}let u=await r(e),d=e.local?s:await n();if(e.accountId=d,e.body){let t=c(e.body);i(await o(`Updating`,async()=>u.securityCenter.state.update({...t,account_id:d})),{successLabel:`Updated`});return}if(e[`scans-enabled`]===void 0)throw Error(`--scans-enabled is required (or pass --body with this field set).`);let f=l({scans_enabled:e[`scans-enabled`]});i(await o(`Updating`,async()=>u.securityCenter.state.update({...f,account_id:d})),{successLabel:`Updated`})}},k={command:`state`,describe:`Operations for state`,builder:e=>e.command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by classification class.`,builder:u(A),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/class`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.class.get({zone_id:c,...n})),{successLabel:`Loaded`})}},M={command:`class`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <issue-id>`,describe:`Returns the full context payload for an insight. This endpoint is used for insights with large payloads that are not included inline in the list response.`,builder:N,handler:async e=>{if(e.dryRun){a({command:`cf security-center zone-insights context get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/security-center/insights/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/context`,pathParams:{"issue-id":String(e[`issue-id`]??``)},bodyKind:`none`});return}let c=await r(e),l=e.local?s:await n();e.accountId=l,i(await o(`Loading`,async()=>c.securityCenter.zoneInsights.context.get({account_id:l,issue_id:e[`issue-id`]})),{successLabel:`Loaded`})}},F={command:`context`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`update <issue-id>`,describe:`Archives a zone-specific Security Center insight, removing it from the active zone insights while preserving historical data.`,builder:I,handler:async t=>{if(t.dryRun){a({command:`cf security-center zone-insights dismiss update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/${t[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(t[`issue-id`]))}/dismiss`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"issue-id":String(t[`issue-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({dismiss:t.dismiss}):c(t.body)});return}let n=await r(t),s=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=s,t.body){let e=c(t.body);i(await o(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...e,zone_id:s,issue_id:t[`issue-id`]})),{successLabel:`Updated`});return}let u=l({dismiss:t.dismiss});i(await o(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...u,zone_id:s,issue_id:t[`issue-id`]})),{successLabel:`Updated`})}},R={command:`dismiss`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Lists Security Center insights for a specific zone, showing zone-level security findings.`,builder:u(z),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject,page:t.page,per_page:t[`per-page`]};if(t.dryRun){a({command:`cf security-center zone-insights get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.get({zone_id:c,...n})),{successLabel:`Loaded`})}};function V(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by severity level.`,builder:u(V),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/severity`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.severity.get({zone_id:c,...n})),{successLabel:`Loaded`})}},U={command:`severity`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by insight type.`,builder:u(W),handler:async t=>{let n={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){a({command:`cf security-center zone-insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/insights/type`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let s=await r(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.securityCenter.zoneInsights.type.get({zone_id:c,...n})),{successLabel:`Loaded`})}},K={command:`type`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`zone-insights`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(B).command(M).command(F).command(R).command(U).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`security-center`,describe:`Security posture dashboard — view and manage security insights, misconfigurations, and vulnerabilities`,builder:e=>e.command(w).command(k).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{J as default};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{t as c}from"./prompt-DTAWiEm2.mjs";function l(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 u={command:`delete`,describe:`Removes the security.txt file configuration for a zone. The /.well-known/security.txt endpoint will no longer be served.`,builder:l,handler:async a=>{if(a.dryRun){r({command:`cf security-txt delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await c({force:!!a.force})){process.stderr.write(`Aborted.
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{n as t}from"./auth-B1CY5zpC.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-BLQ2xXwD.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{t as c}from"./prompt-DcfYBioA.mjs";function l(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 u={command:`delete`,describe:`Removes the security.txt file configuration for a zone. The /.well-known/security.txt endpoint will no longer be served.`,builder:l,handler:async a=>{if(a.dryRun){r({command:`cf security-txt delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await c({force:!!a.force})){process.stderr.write(`Aborted.
3
3
  `);return}n(await i(`Deleting`,async()=>o.securityTxt.delete({zone_id:s})),{successLabel:`Deleted`})}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves the current security.txt file configuration for a zone, used for security vulnerability reporting.`,builder:d,handler:async a=>{if(a.dryRun){r({command:`cf security-txt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.securityTxt.get({zone_id:s})),{successLabel:`Loaded`})}};function p(e){return e.option(`acknowledgments`,{type:`string`,array:!0,description:`The acknowledgments field`}).option(`canonical`,{type:`string`,array:!0,description:`The canonical field`}).option(`contact`,{type:`string`,array:!0,description:`The contact field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`encryption`,{type:`string`,array:!0,description:`The encryption field`}).option(`expires`,{type:`string`,description:`The expires field`}).option(`hiring`,{type:`string`,array:!0,description:`The hiring field`}).option(`policy`,{type:`string`,array:!0,description:`The policy field`}).option(`preferred-languages`,{type:`string`,description:`The preferred_languages field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`update`,describe:`Updates the security.txt file configuration for a zone, which provides security researchers with vulnerability reporting information.`,builder:p,handler:async c=>{if(c.dryRun){r({command:`cf security-txt update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({acknowledgments:c.acknowledgments,canonical:c.canonical,contact:c.contact,enabled:c.enabled,encryption:c.encryption,expires:s(c.expires,`expires`,`text`),hiring:c.hiring,policy:c.policy,preferred_languages:s(c[`preferred-languages`],`preferred-languages`,`text`)}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.securityTxt.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=o({acknowledgments:c.acknowledgments,canonical:c.canonical,contact:c.contact,enabled:c.enabled,encryption:c.encryption,expires:s(c.expires,`expires`,`text`),hiring:c.hiring,policy:c.policy,preferred_languages:s(c[`preferred-languages`],`preferred-languages`,`text`)});n(await i(`Updating`,async()=>l.securityTxt.update({body:d,zone_id:u})),{successLabel:`Updated`})}},h={command:`security-txt`,describe:`Manage the /.well-known/security.txt file that tells security researchers how to report vulnerabilities`,builder:e=>e.command(u).command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{o as e}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import"./delegate.mjs";import{a as t,n,t as r}from"./theme-DbNbIY4d.mjs";import{stripVTControlCharacters as i}from"node:util";function a({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const o=a();function s(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(o,``)}const c=(e=0)=>t=>`\u001B[${t+e}m`,l=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,u=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,d={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(d.modifier);const f=Object.keys(d.color),p=Object.keys(d.bgColor);[...f,...p];function m(){let e=new Map;for(let[t,n]of Object.entries(d)){for(let[t,r]of Object.entries(n))d[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=d[t],e.set(r[0],r[1]);Object.defineProperty(d,t,{value:n,enumerable:!1})}return Object.defineProperty(d,`codes`,{value:e,enumerable:!1}),d.color.close=`\x1B[39m`,d.bgColor.close=`\x1B[49m`,d.color.ansi=c(),d.color.ansi256=l(),d.color.ansi16m=u(),d.bgColor.ansi=c(10),d.bgColor.ansi256=l(10),d.bgColor.ansi16m=u(10),Object.defineProperties(d,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>d.rgbToAnsi256(...d.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>d.ansi256ToAnsi(d.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>d.ansi256ToAnsi(d.hexToAnsi256(e)),enumerable:!1}}),d}const h=m(),g=process.env.CLI_VERSION??`0.7.0`,_=`cf-cli/${g}`;function v(e){let t=n(),a=process.env.CF_DELEGATION?` ${t.dim(`·`)} ${t.dim(`delegated`)}`:``,o=`🍊☁️ ${t.bold.hex(r.orange)(`cf`)} ${t.dim(`·`)} ${t.dim(`v${e}`)}${a}`,s=i(o).length,c=`─`.repeat(s);return`${o}\n${t.hex(r.orange)(c)}`}let y=!1,b=!1,x=!1;function S(e,t={}){if(!(y||b)){if(t.quiet||!process.stderr.isTTY){b=!0;return}process.stderr.write(`${v(e)}\n`),y=!0}}function C(n){!y||b||x||n===`default`||e({allowGlobalAuthKey:!1})!==void 0||(process.stderr.write(`${t.muted(`Active profile:`)} ${t.info(n)}\n`),x=!0)}export{g as a,_ as i,C as n,h as o,v as r,s,S as t};
2
+ import{o as e}from"./chunk-2SIGYDH3-_JSHaszR.mjs";import"./delegate.mjs";import{a as t,n,t as r}from"./theme-DbNbIY4d.mjs";import{stripVTControlCharacters as i}from"node:util";function a({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const o=a();function s(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(o,``)}const c=(e=0)=>t=>`\u001B[${t+e}m`,l=(e=0)=>t=>`\u001B[${38+e};5;${t}m`,u=(e=0)=>(t,n,r)=>`\u001B[${38+e};2;${t};${n};${r}m`,d={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(d.modifier);const f=Object.keys(d.color),p=Object.keys(d.bgColor);[...f,...p];function m(){let e=new Map;for(let[t,n]of Object.entries(d)){for(let[t,r]of Object.entries(n))d[t]={open:`\u001B[${r[0]}m`,close:`\u001B[${r[1]}m`},n[t]=d[t],e.set(r[0],r[1]);Object.defineProperty(d,t,{value:n,enumerable:!1})}return Object.defineProperty(d,`codes`,{value:e,enumerable:!1}),d.color.close=`\x1B[39m`,d.bgColor.close=`\x1B[49m`,d.color.ansi=c(),d.color.ansi256=l(),d.color.ansi16m=u(),d.bgColor.ansi=c(10),d.bgColor.ansi256=l(10),d.bgColor.ansi16m=u(10),Object.defineProperties(d,{rgbToAnsi256:{value(e,t,n){return e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>d.rgbToAnsi256(...d.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>d.ansi256ToAnsi(d.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>d.ansi256ToAnsi(d.hexToAnsi256(e)),enumerable:!1}}),d}const h=m(),g=process.env.CLI_VERSION??`0.8.0`,_=`cf-cli/${g}`;function v(e){let t=n(),a=process.env.CF_DELEGATION?` ${t.dim(`·`)} ${t.dim(`delegated`)}`:``,o=`🍊☁️ ${t.bold.hex(r.orange)(`cf`)} ${t.dim(`·`)} ${t.dim(`v${e}`)}${a}`,s=i(o).length,c=`─`.repeat(s);return`${o}\n${t.hex(r.orange)(c)}`}let y=!1,b=!1,x=!1;function S(e,t={}){if(!(y||b)){if(t.quiet||!process.stderr.isTTY){b=!0;return}process.stderr.write(`${v(e)}\n`),y=!0}}function C(n){!y||b||x||n===`default`||e({allowGlobalAuthKey:!1})!==void 0||(process.stderr.write(`${t.muted(`Active profile:`)} ${t.info(n)}\n`),x=!0)}export{g as a,_ as i,C as n,h as o,v as r,s,S as t};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{n as u,r as d,t as f}from"./prompt-DTAWiEm2.mjs";import{t as p}from"./cli-types-CFw6Xygp.mjs";function m(e){return e.option(`name`,{type:`string`,description:`The name of the share.`}).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:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:m,handler:async u=>{if(u.dryRun){i({command:`cf share create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let f=await n(u),p=u.local?o:await t();if(u.accountId=p,u.body){let e=s(u.body);r(await a(`Creating`,async()=>f.share.create({...e,account_id:p})),{successLabel:`Created`});return}u.name===void 0&&(u.name=await d(`name`,`The name of the share.`));let m=c({name:l(u.name,`name`,`text`)});r(await a(`Creating`,async()=>f.share.create({...m,account_id:p})),{successLabel:`Created`})}};function g(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <share-id>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf share delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await f({force:!!s.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
2
+ import{O as e,w as t}from"./oauth-DC9g9uK_.mjs";import{n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{n as u,r as d,t as f}from"./prompt-DcfYBioA.mjs";import{t as p}from"./cli-types-CFw6Xygp.mjs";function m(e){return e.option(`name`,{type:`string`,description:`The name of the share.`}).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:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:m,handler:async u=>{if(u.dryRun){i({command:`cf share create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let f=await n(u),p=u.local?o:await t();if(u.accountId=p,u.body){let e=s(u.body);r(await a(`Creating`,async()=>f.share.create({...e,account_id:p})),{successLabel:`Created`});return}u.name===void 0&&(u.name=await d(`name`,`The name of the share.`));let m=c({name:l(u.name,`name`,`text`)});r(await a(`Creating`,async()=>f.share.create({...m,account_id:p})),{successLabel:`Created`})}};function g(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <share-id>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf share delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await f({force:!!s.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>c.share.delete({account_id:l,share_id:s[`share-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <share-id>`,describe:`Fetches share by ID.`,builder:v,handler:async s=>{let c={include_resources:s[`include-resources`],include_recipient_counts:s[`include-recipient-counts`]};if(s.dryRun){i({command:`cf share get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.share.get({account_id:u,share_id:s[`share-id`],...c})),{successLabel:`Loaded`})}};function b(e){return e.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(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`tag`,{type:`string`,description:"Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all account shares.`,builder:p(b),handler:async s=>{let c={status:s.status,kind:s.kind,target_type:s[`target-type`],resource_types:s[`resource-types`],order:s.order,direction:s.direction,page:s.page,per_page:s[`per-page`],include_resources:s[`include-resources`],include_recipient_counts:s[`include-recipient-counts`],tag:s.tag};if(s.dryRun){i({command:`cf share list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.share.list({account_id:u,...c})),{successLabel:`Loaded`})}};function S(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Optionally specify `recipient_account_id` to target a specific account, or `organization_id` to target the caller's whole organization. If neither is provided, the caller's organization is used. The legacy field `account_id` is accepted as a synonym for `recipient_account_id` during the deprecation period (see `x-sunset` on that field). "})}const C={command:`create <share-id>`,describe:"Adds a single recipient to an account-targeted resource share, granting them access to the shared resources. The recipient account must belong to the same organization as the share owner. To replace the entire recipient list in one call, use `PUT /accounts/{account_id}/shares/{share_id}/recipients` instead.",builder:S,handler:async u=>{if(u.dryRun){i({command:`cf share recipient create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${u[`share-id`]==null?`<share-id>`:encodeURIComponent(String(u[`share-id`]))}/recipients`,pathParams:{"share-id":String(u[`share-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({organization_id:l(u[`organization-id`],`organization-id`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Creating`,async()=>d.share.recipient.create({body:e,account_id:f,share_id:u[`share-id`]})),{successLabel:`Created`});return}let p=c({organization_id:l(u[`organization-id`],`organization-id`,`text`)});r(await a(`Creating`,async()=>d.share.recipient.create({body:p,account_id:f,share_id:u[`share-id`]})),{successLabel:`Created`})}};function w(e){return e.positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const T={command:`delete <recipient-id>`,describe:"Performs a **soft delete**: sets the recipient's `desired_association_status` to `disassociated`, which signals the background reconciliation workflow (Temporal) to remove the shared resources from the recipient account. The recipient record remains in the database for audit purposes and is still returned by `GET /accounts/{account_id}/shares/{share_id}/recipients` with its updated status. Resource access is not fully removed until the workflow completes and `current_association_status` transitions to `disassociated`. The recipient record itself is never physically deleted.",builder:w,handler:async s=>{if(s.dryRun){i({command:`cf share recipient delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/recipients/${s[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(s[`recipient-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``),"recipient-id":String(s[`recipient-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await f({force:!!s.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
4
4
  `);return}r(await a(`Deleting`,async()=>c.share.recipient.delete({account_id:l,share_id:s[`share-id`],recipient_id:s[`recipient-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <recipient-id>`,describe:`Get share recipient by ID.`,builder:E,handler:async s=>{let c={include_resources:s[`include-resources`]};if(s.dryRun){i({command:`cf share recipient get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/recipients/${s[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(s[`recipient-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``),"recipient-id":String(s[`recipient-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.share.recipient.get({account_id:u,share_id:s[`share-id`],recipient_id:s[`recipient-id`],...c})),{successLabel:`Loaded`})}};function O(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).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 k={command:`list`,describe:'List share recipients by share ID. Returns **all** recipients regardless of their `association_status` (associating, associated, disassociating, disassociated). Callers that want only "active" recipients must filter client-side on the `association_status` field.',builder:O,handler:async s=>{let c={include_resources:s[`include-resources`],page:s.page,per_page:s[`per-page`]};if(s.dryRun){i({command:`cf share recipient list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/recipients`,pathParams:{"share-id":String(s[`share-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.share.recipient.list({account_id:u,share_id:s[`share-id`],...c})),{successLabel:`Loaded`})}};function A(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`update <share-id>`,describe:"Replaces the full recipient list for an account-targeted share. The server computes the diff between the current and desired recipients: new accounts are added, accounts no longer in the list are marked for disassociation, and unchanged accounts are left as-is. Returns an error if the share targets an organization (`target_type=organization`); org-targeted shares derive their recipients dynamically from org membership and cannot be modified through this endpoint.",builder:A,handler:async c=>{if(c.dryRun){i({command:`cf share recipient update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${c[`share-id`]==null?`<share-id>`:encodeURIComponent(String(c[`share-id`]))}/recipients`,pathParams:{"share-id":String(c[`share-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,c.body){let e=s(c.body);r(await a(`Updating`,async()=>l.share.recipient.update({body:e,account_id:u,share_id:c[`share-id`]})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},M={command:`recipient`,describe:`Operations for recipient`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`resource-account-id`,{type:`string`,description:`Account identifier.`}).option(`resource-id`,{type:`string`,description:`Share Resource identifier.`}).option(`resource-type`,{type:`string`,description:`Resource Type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]}).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 P={command:`create <share-id>`,describe:`Adds a resource to an existing share, making it available to share recipients.`,builder:N,handler:async f=>{if(f.dryRun){i({command:`cf share resource create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${f[`share-id`]==null?`<share-id>`:encodeURIComponent(String(f[`share-id`]))}/resources`,pathParams:{"share-id":String(f[`share-id`]??``)},bodyKind:`json`,body:f.body===void 0?c({resource_account_id:l(f[`resource-account-id`],`resource-account-id`,`text`),resource_id:l(f[`resource-id`],`resource-id`,`text`),resource_type:l(f[`resource-type`],`resource-type`,`text`)}):s(f.body)});return}let p=await n(f),m=f.local?o:await t();if(f.accountId=m,f.body){let e=s(f.body);r(await a(`Creating`,async()=>p.share.resource.create({body:e,account_id:m,share_id:f[`share-id`]})),{successLabel:`Created`});return}f[`resource-account-id`]===void 0&&(f[`resource-account-id`]=await d(`resource-account-id`,`Account identifier.`)),f[`resource-id`]===void 0&&(f[`resource-id`]=await d(`resource-id`,`Share Resource identifier.`)),f[`resource-type`]===void 0&&(f[`resource-type`]=await u(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]));let h=c({resource_account_id:l(f[`resource-account-id`],`resource-account-id`,`text`),resource_id:l(f[`resource-id`],`resource-id`,`text`),resource_type:l(f[`resource-type`],`resource-type`,`text`)});r(await a(`Creating`,async()=>p.share.resource.create({body:h,account_id:m,share_id:f[`share-id`]})),{successLabel:`Created`})}};function F(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const I={command:`delete <share-resource-id>`,describe:`Deletion is not immediate, an updated share resource object with a new status will be returned.`,builder:F,handler:async s=>{if(s.dryRun){i({command:`cf share resource delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/resources/${s[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(s[`share-resource-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``),"share-resource-id":String(s[`share-resource-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await f({force:!!s.force,message:`Are you sure? This action cannot be undone.`})){process.stderr.write(`Aborted.
5
5
  `);return}r(await a(`Deleting`,async()=>c.share.resource.delete({account_id:l,share_id:s[`share-id`],share_resource_id:s[`share-resource-id`]})),{successLabel:`Deleted`})}};function L(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get <share-resource-id>`,describe:`Get share resource by ID.`,builder:L,handler:async s=>{if(s.dryRun){i({command:`cf share resource get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/resources/${s[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(s[`share-resource-id`]))}`,pathParams:{"share-id":String(s[`share-id`]??``),"share-resource-id":String(s[`share-resource-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.share.resource.get({account_id:l,share_id:s[`share-id`],share_resource_id:s[`share-resource-id`]})),{successLabel:`Loaded`})}};function z(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter share resources by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`resource-type`,{type:`string`,description:`Filter share resources by resource_type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]}).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 B={command:`list`,describe:`List share resources by share ID.`,builder:p(z),handler:async s=>{let c={status:s.status,resource_type:s[`resource-type`],page:s.page,per_page:s[`per-page`]};if(s.dryRun){i({command:`cf share resource list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${s[`share-id`]==null?`<share-id>`:encodeURIComponent(String(s[`share-id`]))}/resources`,pathParams:{"share-id":String(s[`share-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.share.resource.list({account_id:u,share_id:s[`share-id`],...c})),{successLabel:`Loaded`})}};function V(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`update <share-resource-id>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:V,handler:async c=>{if(c.dryRun){i({command:`cf share resource update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${c[`share-id`]==null?`<share-id>`:encodeURIComponent(String(c[`share-id`]))}/resources/${c[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(c[`share-resource-id`]))}`,pathParams:{"share-id":String(c[`share-id`]??``),"share-resource-id":String(c[`share-resource-id`]??``)},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,c.body){let e=s(c.body);r(await a(`Updating`,async()=>l.share.resource.update({...e,account_id:u,share_id:c[`share-id`],share_resource_id:c[`share-resource-id`]})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},U={command:`resource`,describe:`Operations for resource`,builder:e=>e.command(P).command(I).command(R).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the share.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for `PUT /accounts/{account_id}/shares/{share_id}`. The share's display `name` and `tags` can be updated via this endpoint. To modify recipients, use the `/accounts/{account_id}/shares/{share_id}/recipients` subresource endpoints (POST, PUT, DELETE). "})}const G={command:`update <share-id>`,describe:"Updates the share's display name and tags. This endpoint does **not** modify recipients or resources — those are managed via dedicated subresource endpoints: - **Recipients**: Use `POST /accounts/{account_id}/shares/{share_id}/recipients` to add a single recipient, `PUT /accounts/{account_id}/shares/{share_id}/recipients` to replace the full recipient list, or `DELETE /accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` to remove a recipient. - **Resources**: Use the share's resource subresource endpoints. Updating is not immediate; an updated share object with a new status will be returned.",builder:W,handler:async u=>{if(u.dryRun){i({command:`cf share update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/shares/${u[`share-id`]==null?`<share-id>`:encodeURIComponent(String(u[`share-id`]))}`,pathParams:{"share-id":String(u[`share-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let f=await n(u),p=u.local?o:await t();if(u.accountId=p,u.body){let e=s(u.body);r(await a(`Updating`,async()=>f.share.update({...e,account_id:p,share_id:u[`share-id`]})),{successLabel:`Updated`});return}u.name===void 0&&(u.name=await d(`name`,`The name of the share.`));let m=c({name:l(u.name,`name`,`text`)});r(await a(`Updating`,async()=>f.share.update({...m,account_id:p,share_id:u[`share-id`]})),{successLabel:`Updated`})}},K={command:`share`,describe:`share`,builder:e=>e.command(h).command(_).command(y).command(x).command(G).command(M).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,o as t}from"./theme-DbNbIY4d.mjs";import"./ui-CTo5OG9r.mjs";import{w as n}from"./oauth-DC9g9uK_.mjs";import{n as r}from"./dist-B7hsuvbF.mjs";import{r as i}from"./auth-B1CY5zpC.mjs";import{a,i as o,n as s}from"./build-C1FOoThn.mjs";import{a as c,c as l,i as u,l as d,n as f,o as p,t as m}from"./deploy-input-CdWrpzPA.mjs";function h(e){return e.option(`mode`,{type:`string`,alias:`m`,description:`Deployment mode (e.g. production, staging, preview)`}).option(`prebuilt`,{type:`boolean`,description:`Deploy existing Build Output API files without building`,default:!1}).option(`tag`,{type:`string`,description:`A tag to associate with this Worker Version`,requiresArg:!0}).option(`message`,{type:`string`,description:`A message to associate with this Worker Version`,requiresArg:!0}).option(`secrets-file`,{type:`string`,description:`Path to a file containing secrets to upload with the version (JSON or .env format)`,requiresArg:!0}).option(`dry-run`,{describe:`Build a project and run checks without actually uploading the Worker`,type:`boolean`,default:!1})}async function g(h,g){h.prebuilt||(await s(h.mode),r.message(``,{spacing:0}));let{workers:[_],settings:v}=await a(process.cwd()),{wranglerConfig:y,builtConfig:b}=o(_,v),x=m(_,b),S=await i(),C=await n();if(d(c(S)),g.command===`Deploy`){let n=f(_,y,C,h);r.message(e.bold(`Deploy`),{symbol:t.dim(`├`),spacing:0}),await p(n,y,x,{syncWorkersSite:void 0,getNormalizedContainerOptions:void 0,buildContainer:void 0,deployContainers:void 0,analyseBundle:void 0})}else{let n=u(_,y,C,h);r.message(e.bold(`Upload`),{symbol:t.dim(`├`),spacing:0}),await l(n,y,x,{analyseBundle:void 0})}r.success(h[`dry-run`]?`Dry run complete`:`${g.command} complete`)}export{h as n,g as t};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{r as c,t as l}from"./prompt-DTAWiEm2.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:u,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Creating`,async()=>o.smartShield.cacheReserveClear.clear({zone_id:s})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield cache-reserve-clear status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.smartShield.cacheReserveClear.status({zone_id:s})),{successLabel:`Loaded`})}},m={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.smartShield.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Create a new health check.`,builder:_,handler:async l=>{if(l.dryRun){r({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Creating`,async()=>u.smartShield.healthChecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});n(await i(`Creating`,async()=>u.smartShield.healthChecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function y(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:y,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/healthchecks/${a[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(a[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(a[`healthcheck-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await l({force:!!a.force})){process.stderr.write(`Aborted.
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{n as t}from"./auth-B1CY5zpC.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-BLQ2xXwD.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{r as c,t as l}from"./prompt-DcfYBioA.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:u,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield cache-reserve-clear clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Creating`,async()=>o.smartShield.cacheReserveClear.clear({zone_id:s})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield cache-reserve-clear status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/cache_reserve_clear`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.smartShield.cacheReserveClear.status({zone_id:s})),{successLabel:`Loaded`})}},m={command:`cache-reserve-clear`,describe:`Cache Reserve Clear operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve Smart Shield Settings.`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.smartShield.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Create a new health check.`,builder:_,handler:async l=>{if(l.dryRun){r({command:`cf smart-shield health-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Creating`,async()=>u.smartShield.healthChecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});n(await i(`Creating`,async()=>u.smartShield.healthChecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function y(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:y,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield health-checks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/healthchecks/${a[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(a[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(a[`healthcheck-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await l({force:!!a.force})){process.stderr.write(`Aborted.
3
3
  `);return}n(await i(`Deleting`,async()=>o.smartShield.healthChecks.delete({zone_id:s,healthcheck_id:a[`healthcheck-id`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:x,handler:async l=>{if(l.dryRun){r({command:`cf smart-shield health-checks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/smart_shield/healthchecks/${l[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(l[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(l[`healthcheck-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Updating`,async()=>u.smartShield.healthChecks.edit({body:e,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=o({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});n(await i(`Updating`,async()=>u.smartShield.healthChecks.edit({body:f,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`})}};function C(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:C,handler:async a=>{if(a.dryRun){r({command:`cf smart-shield health-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/healthchecks/${a[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(a[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(a[`healthcheck-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.smartShield.healthChecks.get({zone_id:s,healthcheck_id:a[`healthcheck-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`List configured health checks.`,builder:T,handler:async a=>{let o={page:a.page,per_page:a[`per-page`]};if(a.dryRun){r({command:`cf smart-shield health-checks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/smart_shield/healthchecks`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.smartShield.healthChecks.list({zone_id:c,...o})),{successLabel:`Loaded`})}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`result-address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`result-check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`result-consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`result-consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`result-description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`result-http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`result-http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`result-http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`result-http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`result-http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`result-http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`result-http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`result-interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`result-name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`result-retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`result-suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`result-tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`result-tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`result-timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`result-type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`success`,{type:`boolean`,description:`Whether the API call was successful.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async c=>{if(c.dryRun){r({command:`cf smart-shield health-checks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/smart_shield/healthchecks/${c[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(c[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(c[`healthcheck-id`]??``),"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({result:{address:s(c[`result-address`],`result-address`,`text`),check_regions:c[`result-check-regions`],consecutive_fails:c[`result-consecutive-fails`],consecutive_successes:c[`result-consecutive-successes`],description:s(c[`result-description`],`result-description`,`text`),http_config:{allow_insecure:c[`result-http-config-allow-insecure`],expected_body:s(c[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:c[`result-http-config-expected-codes`],follow_redirects:c[`result-http-config-follow-redirects`],method:s(c[`result-http-config-method`],`result-http-config-method`,`text`),path:s(c[`result-http-config-path`],`result-http-config-path`,`text`),port:c[`result-http-config-port`]},interval:c[`result-interval`],name:s(c[`result-name`],`result-name`,`text`),retries:c[`result-retries`],suspended:c[`result-suspended`],tcp_config:{method:s(c[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:c[`result-tcp-config-port`]},timeout:c[`result-timeout`],type:s(c[`result-type`],`result-type`,`text`)},success:c.success}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.smartShield.healthChecks.update({...e,zone_id:u,healthcheck_id:c[`healthcheck-id`]})),{successLabel:`Updated`});return}if(c.success===void 0)throw Error(`--success is required (or pass --body with this field set).`);let d=o({result:{address:s(c[`result-address`],`result-address`,`text`),check_regions:c[`result-check-regions`],consecutive_fails:c[`result-consecutive-fails`],consecutive_successes:c[`result-consecutive-successes`],description:s(c[`result-description`],`result-description`,`text`),http_config:{allow_insecure:c[`result-http-config-allow-insecure`],expected_body:s(c[`result-http-config-expected-body`],`result-http-config-expected-body`,`text`),expected_codes:c[`result-http-config-expected-codes`],follow_redirects:c[`result-http-config-follow-redirects`],method:s(c[`result-http-config-method`],`result-http-config-method`,`text`),path:s(c[`result-http-config-path`],`result-http-config-path`,`text`),port:c[`result-http-config-port`]},interval:c[`result-interval`],name:s(c[`result-name`],`result-name`,`text`),retries:c[`result-retries`],suspended:c[`result-suspended`],tcp_config:{method:s(c[`result-tcp-config-method`],`result-tcp-config-method`,`text`),port:c[`result-tcp-config-port`]},timeout:c[`result-timeout`],type:s(c[`result-type`],`result-type`,`text`)},success:c.success});n(await i(`Updating`,async()=>l.smartShield.healthChecks.update({...d,zone_id:u,healthcheck_id:c[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`health-checks`,describe:`Health checks operations`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`cache-reserve-value`,{type:`string`,description:`Specifies the enablement value of Cache Reserve.`,choices:[`on`,`off`]}).option(`regional-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Regional Tiered Cache.`,choices:[`on`,`off`]}).option(`smart-routing-value`,{type:`string`,description:`Specifies the enablement value of Smart Routing.`,choices:[`on`,`off`]}).option(`smart-tiered-cache-value`,{type:`string`,description:`Specifies the enablement value of Smart Tiered Cache.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The patch body for Smart Shield.`})}const j={command:`update`,describe:`Set Smart Shield Settings.`,builder:A,handler:async c=>{if(c.dryRun){r({command:`cf smart-shield update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/smart_shield`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({cache_reserve:{value:s(c[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:s(c[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:s(c[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:s(c[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.smartShield.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=o({cache_reserve:{value:s(c[`cache-reserve-value`],`cache-reserve-value`,`text`)},regional_tiered_cache:{value:s(c[`regional-tiered-cache-value`],`regional-tiered-cache-value`,`text`)},smart_routing:{value:s(c[`smart-routing-value`],`smart-routing-value`,`text`)},smart_tiered_cache:{value:s(c[`smart-tiered-cache-value`],`smart-tiered-cache-value`,`text`)}});n(await i(`Updating`,async()=>l.smartShield.update({...d,zone_id:u})),{successLabel:`Updated`})}},M={command:`smart-shield`,describe:`Smart Shield settings, health checks, and cache reserve management`,builder:e=>e.command(g).command(j).command(m).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{i as t,n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{n as o}from"./body-parser-BO6mfo_W.mjs";import{n as s,t as c}from"./input-validation-BwUR9z8e.mjs";import{t as l}from"./prompt-DTAWiEm2.mjs";import{n as u,t as d}from"./raw-fetch-DgezeshQ.mjs";function f(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const p={command:`get <snippet-name>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:f,handler:async t=>{if(t.dryRun){i({command:`cf snippets content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}/content`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(t);t.zoneId=await e({zone:t.zone},r,{quiet:t.quiet});let o=await a(`Loading`,async()=>d(`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}/content`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));u(t.text===!0?o.toString(`utf-8`):o)}},m={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <snippet-name>`,describe:`Deletes a snippet belonging to the zone.`,builder:h,handler:async t=>{if(t.dryRun){i({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await l({force:!!t.force})){process.stderr.write(`Aborted.
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{i as t,n}from"./auth-B1CY5zpC.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-BLQ2xXwD.mjs";import{n as o}from"./body-parser-BO6mfo_W.mjs";import{n as s,t as c}from"./input-validation-BwUR9z8e.mjs";import{t as l}from"./prompt-DcfYBioA.mjs";import{n as u,t as d}from"./raw-fetch-CeW1mW_u.mjs";function f(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const p={command:`get <snippet-name>`,describe:`Fetches the content of a snippet belonging to the zone.`,builder:f,handler:async t=>{if(t.dryRun){i({command:`cf snippets content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}/content`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let r=await n(t);t.zoneId=await e({zone:t.zone},r,{quiet:t.quiet});let o=await a(`Loading`,async()=>d(`/zones/${t.zoneId}/snippets/${encodeURIComponent(String(t[`snippet-name`]))}/content`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));u(t.text===!0?o.toString(`utf-8`):o)}},m={command:`content`,describe:`Raw JavaScript source code content of individual snippets`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <snippet-name>`,describe:`Deletes a snippet belonging to the zone.`,builder:h,handler:async t=>{if(t.dryRun){i({command:`cf snippets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await l({force:!!t.force})){process.stderr.write(`Aborted.
3
3
  `);return}r(await a(`Deleting`,async()=>o.snippets.delete({zone_id:s,snippet_name:t[`snippet-name`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <snippet-name>`,describe:`Fetches a snippet belonging to the zone.`,builder:_,handler:async t=>{if(t.dryRun){i({command:`cf snippets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/${t[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(t[`snippet-name`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"snippet-name":String(t[`snippet-name`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.snippets.get({zone_id:s,snippet_name:t[`snippet-name`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`page`,{type:`number`,description:`Specifies the current page number.`}).option(`per-page`,{type:`number`,description:`Specifies how many results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Fetches all snippets belonging to the zone.`,builder:y,handler:async t=>{let o={page:t.page,per_page:t[`per-page`]};if(t.dryRun){i({command:`cf snippets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.snippets.list({zone_id:c,...o})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete`,describe:`Deletes all snippet rules belonging to the zone.`,builder:x,handler:async t=>{if(t.dryRun){i({command:`cf snippets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await l({force:!!t.force})){process.stderr.write(`Aborted.
4
4
  `);return}r(await a(`Deleting`,async()=>o.snippets.rules.delete({zone_id:s})),{successLabel:`Deleted`})}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Fetches all snippet rules belonging to the zone.`,builder:C,handler:async t=>{if(t.dryRun){i({command:`cf snippets rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.snippets.rules.list({zone_id:s})),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet rules object.`})}const E={command:`update`,describe:`Updates all snippet rules belonging to the zone.`,builder:T,handler:async s=>{if(s.dryRun){i({command:`cf snippets rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/snippets/snippet_rules`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:o(s.body)});return}let c=await n(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,s.body){let e=o(s.body);r(await a(`Updating`,async()=>c.snippets.rules.update({...e,zone_id:l})),{successLabel:`Updated`});return}r(await a(`Updating`,async()=>t(c,`PUT`,`/zones/${s.zoneId}/snippets/snippet_rules`)),{successLabel:`Updated`})}},D={command:`rules`,describe:`Rules that determine which requests trigger specific snippets based on URL patterns`,builder:e=>e.command(S).command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`snippet-name`,{type:`string`,description:`Identify the snippet.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Define a snippet object.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`Provide metadata about the snippet.`})}const k={command:`update <snippet-name>`,describe:`Creates or updates a snippet belonging to the zone.`,builder:O,handler:async o=>{if(o.dryRun){i({command:`cf snippets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/snippets/${o[`snippet-name`]==null?`<snippet-name>`:encodeURIComponent(String(o[`snippet-name`]))}`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``),"snippet-name":String(o[`snippet-name`]??``)},bodyKind:`multipart`,body:{body:o.body,file:o.file,metadata:o.metadata}});return}let l=await n(o);if(o.zoneId=await e({zone:o.zone},l,{quiet:o.quiet}),o.file!==void 0||o.body!==void 0||o.metadata!==void 0){let e=new FormData;if(o.file){let t=c(o.file);e.append(`file`,new Blob([t]),o.file.split(/[\\/]/).filter(Boolean).pop())}else o.body!==void 0&&e.append(`file`,o.body);if(o.metadata!==void 0){let t=typeof o.metadata==`string`?s(o.metadata,`metadata`,`text`):o.metadata;e.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}r(await a(`Updating`,async()=>t(l,`PUT`,`/zones/${o.zoneId}/snippets/${encodeURIComponent(String(o[`snippet-name`]))}`,{body:e})),{successLabel:`Updated`});return}if(o.body){let e=s(o.body,`body`,`binary`);r(await a(`Updating`,async()=>t(l,`PUT`,`/zones/${o.zoneId}/snippets/${encodeURIComponent(String(o[`snippet-name`]))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`snippets`,describe:`Lightweight JavaScript snippets that run on requests before Workers — for quick header modifications and redirects`,builder:e=>e.command(g).command(v).command(b).command(k).command(m).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{A as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./src-By-zTCHz.mjs";import{a as t}from"./theme-DbNbIY4d.mjs";import"./ui-BNoF0KpD.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{homedir as i}from"node:os";import{join as a}from"node:path";import{execFileSync as o,spawn as s}from"node:child_process";function c(e){return t=>{if(!t.pkgRoot)return null;let r=a(t.pkgRoot,`bin`,e);return n(r)?r:null}}function l(){let e=a(process.env.CARGO_HOME??a(i(),`.cargo`),`bin`,`cloudflare-rs-dev-server`);return n(e)?e:null}const u=[{ecosystem:`npm`,pkg:`@cloudflare/vite-plugin`,minimumVersion:`1.42.0`,description:`Vite-based dev server (recommended for JavaScript/TypeScript)`,manifest:`package.json`,binary:c(`cf-vite`),installHint:`npm install --save-dev @cloudflare/vite-plugin@latest`},{ecosystem:`npm`,pkg:`wrangler`,fallback:!0,minimumVersion:`4.102.0`,description:`Wrangler-based dev server (legacy Worker projects)`,manifest:`package.json`,binary:c(`cf-wrangler.js`),installHint:`npm install --save-dev wrangler@latest`},{ecosystem:`pypi`,pkg:`cloudflare-py-dev-server`,description:`Python dev server (Pyodide via workerd)`,manifest:`pyproject.toml`,binary:()=>null,installHint:`pip install cloudflare-py-dev-server (or: uv add --dev cloudflare-py-dev-server)`},{ecosystem:`cargo`,pkg:`cloudflare-rs-dev-server`,description:`Rust dev server (wasm-bindgen + workerd)`,manifest:`Cargo.toml`,binary:l,installHint:`cargo install cloudflare-rs-dev-server`}];function d(e){return u.find(t=>t.pkg===e)}function f(e){let t=[];t.push(...p(e)),t.push(...g(e)),t.push(...b(e));let n=t.filter(e=>!e.impl.fallback);return n.length>0?n:t}function p(e){let t=a(e,`package.json`);if(!n(t))return[];let i;try{let e=r(t,`utf-8`);i=JSON.parse(e)}catch{return[]}let o=m(i),s=[];for(let n of o){let r=d(n);if(!r||r.ecosystem!==`npm`)continue;let i=h(e,n),a=i?r.binary({cwd:e,pkgRoot:i}):null;s.push({impl:r,binary:a,installed:!!i,manifestPath:t})}return s}function m(e){let t=new Set;for(let n of[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`]){let r=e[n];if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(e)}return t}function h(e,t){if(n(a(e,`node_modules`,t,`package.json`)))return a(e,`node_modules`,t)}function g(e){let t=a(e,`pyproject.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of _()){if(!v(i,n.pkg))continue;let r=y(e,n.pkg);o.push({impl:n,binary:r,manifestPath:t})}return o}function _(){let e=[],t=new Set;for(let n of S())n.ecosystem===`pypi`&&!t.has(n.pkg)&&(e.push(n),t.add(n.pkg));return e}function v(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`["']${n}(?=[\\s\\[<>=!~"';])`,`m`).test(e)}function y(e,t){if(n(a(e,`uv.lock`)))return`uv:${t}`;try{let r=o(`python3`,[`-c`,`import shutil, sys; p = shutil.which(${JSON.stringify(t)}); sys.stdout.write(p or "")`],{cwd:e,stdio:[`ignore`,`pipe`,`ignore`],encoding:`utf-8`}).trim();if(r&&n(r))return r}catch{}return null}function b(e){let t=a(e,`Cargo.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of S()){if(n.ecosystem!==`cargo`||!x(i,n.pkg))continue;let r=n.binary({cwd:e});o.push({impl:n,binary:r,manifestPath:t})}return o}function x(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^\\s*${n}\\s*=)|(^\\s*\\[[^\\]]*\\.${n}\\s*\\])`,`m`).test(e)}function S(){return u}function C(t){let n=f(t);if(n.length===0)throw w(t),new e(1);if(n.length>1)throw T(n),new e(1);let[r]=n;if(!r)throw new e(1);if(!r.binary)throw E(r),new e(1);return r}function w(e){console.error(`
2
+ import{t as e}from"./src-Bn0FyQIp.mjs";import{a as t}from"./theme-DbNbIY4d.mjs";import"./ui-CTo5OG9r.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{homedir as i}from"node:os";import{join as a}from"node:path";import{execFileSync as o,spawn as s}from"node:child_process";function c(e){return t=>{if(!t.pkgRoot)return null;let r=a(t.pkgRoot,`bin`,e);return n(r)?r:null}}function l(){let e=a(process.env.CARGO_HOME??a(i(),`.cargo`),`bin`,`cloudflare-rs-dev-server`);return n(e)?e:null}const u=[{ecosystem:`npm`,pkg:`@cloudflare/vite-plugin`,minimumVersion:`1.42.0`,description:`Vite-based dev server (recommended for JavaScript/TypeScript)`,manifest:`package.json`,binary:c(`cf-vite`),installHint:`npm install --save-dev @cloudflare/vite-plugin@latest`},{ecosystem:`npm`,pkg:`wrangler`,fallback:!0,minimumVersion:`4.102.0`,description:`Wrangler-based dev server (legacy Worker projects)`,manifest:`package.json`,binary:c(`cf-wrangler.js`),installHint:`npm install --save-dev wrangler@latest`},{ecosystem:`pypi`,pkg:`cloudflare-py-dev-server`,description:`Python dev server (Pyodide via workerd)`,manifest:`pyproject.toml`,binary:()=>null,installHint:`pip install cloudflare-py-dev-server (or: uv add --dev cloudflare-py-dev-server)`},{ecosystem:`cargo`,pkg:`cloudflare-rs-dev-server`,description:`Rust dev server (wasm-bindgen + workerd)`,manifest:`Cargo.toml`,binary:l,installHint:`cargo install cloudflare-rs-dev-server`}];function d(e){return u.find(t=>t.pkg===e)}function f(e){let t=[];t.push(...p(e)),t.push(...g(e)),t.push(...b(e));let n=t.filter(e=>!e.impl.fallback);return n.length>0?n:t}function p(e){let t=a(e,`package.json`);if(!n(t))return[];let i;try{let e=r(t,`utf-8`);i=JSON.parse(e)}catch{return[]}let o=m(i),s=[];for(let n of o){let r=d(n);if(!r||r.ecosystem!==`npm`)continue;let i=h(e,n),a=i?r.binary({cwd:e,pkgRoot:i}):null;s.push({impl:r,binary:a,installed:!!i,manifestPath:t})}return s}function m(e){let t=new Set;for(let n of[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`]){let r=e[n];if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(e)}return t}function h(e,t){if(n(a(e,`node_modules`,t,`package.json`)))return a(e,`node_modules`,t)}function g(e){let t=a(e,`pyproject.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of _()){if(!v(i,n.pkg))continue;let r=y(e,n.pkg);o.push({impl:n,binary:r,manifestPath:t})}return o}function _(){let e=[],t=new Set;for(let n of S())n.ecosystem===`pypi`&&!t.has(n.pkg)&&(e.push(n),t.add(n.pkg));return e}function v(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`["']${n}(?=[\\s\\[<>=!~"';])`,`m`).test(e)}function y(e,t){if(n(a(e,`uv.lock`)))return`uv:${t}`;try{let r=o(`python3`,[`-c`,`import shutil, sys; p = shutil.which(${JSON.stringify(t)}); sys.stdout.write(p or "")`],{cwd:e,stdio:[`ignore`,`pipe`,`ignore`],encoding:`utf-8`}).trim();if(r&&n(r))return r}catch{}return null}function b(e){let t=a(e,`Cargo.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of S()){if(n.ecosystem!==`cargo`||!x(i,n.pkg))continue;let r=n.binary({cwd:e});o.push({impl:n,binary:r,manifestPath:t})}return o}function x(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^\\s*${n}\\s*=)|(^\\s*\\[[^\\]]*\\.${n}\\s*\\])`,`m`).test(e)}function S(){return u}function C(t){let n=f(t);if(n.length===0)throw w(t),new e(1);if(n.length>1)throw T(n),new e(1);let[r]=n;if(!r)throw new e(1);if(!r.binary)throw E(r),new e(1);return r}function w(e){console.error(`
3
3
  No Cloudflare dev-server is installed in this project.
4
4
 
5
5
  A project must declare exactly one of the following in its manifest:
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{r as c,t as l}from"./prompt-DTAWiEm2.mjs";import{t as u}from"./cli-types-CFw6Xygp.mjs";function d(e){return e.option(`app-id`,{type:`string`,description:`Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match.`}).option(`colo-name`,{type:`string`,description:`Co-location identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:d,handler:async a=>{let o={appID:a[`app-id`],colo_name:a[`colo-name`]};if(a.dryRun){r({command:`cf spectrum analytics aggregates currents get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/spectrum/analytics/aggregate/current`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.spectrum.analytics.aggregates.currents.get({zone_id:c,...o})),{successLabel:`Loaded`})}},p={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
2
+ import{D as e}from"./oauth-DC9g9uK_.mjs";import{n as t}from"./auth-B1CY5zpC.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-BLQ2xXwD.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{r as c,t as l}from"./prompt-DcfYBioA.mjs";import{t as u}from"./cli-types-CFw6Xygp.mjs";function d(e){return e.option(`app-id`,{type:`string`,description:`Comma-delimited list of Spectrum Application Id(s). If provided, the response will be limited to Spectrum Application Id(s) that match.`}).option(`colo-name`,{type:`string`,description:`Co-location identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves analytics aggregated from the last minute of usage on Spectrum applications underneath a given zone.`,builder:d,handler:async a=>{let o={appID:a[`app-id`],colo_name:a[`colo-name`]};if(a.dryRun){r({command:`cf spectrum analytics aggregates currents get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/spectrum/analytics/aggregate/current`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.spectrum.analytics.aggregates.currents.get({zone_id:c,...o})),{successLabel:`Loaded`})}},p={command:`currents`,describe:`Real-time and historical connection analytics for Spectrum applications`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`aggregates`,describe:`Operations for analytics.aggregates`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dimensions`,{type:`string`,description:`Can be used to break down the data by given attributes. Options are:
3
3
 
4
4
  Dimension | Name | Example
5
5
  --------------------------|---------------------------------|--------------------------