cf 0.4.0 → 0.5.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 (220) hide show
  1. package/README.md +7 -1
  2. package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
  3. package/dist/{accounts-CjtZ8x1z.mjs → accounts-B_joQcMi.mjs} +9 -9
  4. package/dist/{acm-C2lYIWs1.mjs → acm-_kIHqYME.mjs} +2 -2
  5. package/dist/{addressing-CHFK6uxW.mjs → addressing-CaFlw8y1.mjs} +10 -10
  6. package/dist/{agent-context-CgGCT0xU.mjs → agent-context-DMPfi54f.mjs} +1 -1
  7. package/dist/ai-CqnhNb_c.mjs +2 -0
  8. package/dist/ai-gateway-pgYGI519.mjs +8 -0
  9. package/dist/ai-search-eqQMPQol.mjs +7 -0
  10. package/dist/ai_gateway--vuVLnOm.mjs +4 -0
  11. package/dist/{alerting-Bk85NNf5.mjs → alerting-CPxHiYHb.mjs} +5 -5
  12. package/dist/{analytics-CkhhhZWZ.mjs → analytics-DSSRDZz8.mjs} +1 -1
  13. package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
  14. package/dist/{api-gateway-CWdR4Ne7.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
  15. package/dist/argo-aC6A3JyX.mjs +2 -0
  16. package/dist/artifacts-HD4V2xpK.mjs +4 -0
  17. package/dist/audit-logs-BuExU_nz.mjs +2 -0
  18. package/dist/auth-CSC4yhEJ.mjs +9 -0
  19. package/dist/auth-D5hNsOFq.mjs +5 -0
  20. package/dist/billing-COaghyxl.mjs +2 -0
  21. package/dist/bot-management-DmEzeV1Y.mjs +5 -0
  22. package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
  23. package/dist/brand-protection-dPrGe8sL.mjs +3 -0
  24. package/dist/{browser-rendering-Rae0AUt0.mjs → browser-rendering-BiSGnpBf.mjs} +3 -3
  25. package/dist/{build-BE4o4imx.mjs → build-HuS9-R0V.mjs} +2 -2
  26. package/dist/{cache-B7pRbpTy.mjs → cache-CY-7Lt71.mjs} +4 -4
  27. package/dist/{calls-DXRWsZ8n.mjs → calls-wOQGDWPl.mjs} +3 -3
  28. package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
  29. package/dist/client-certificates-CRf41xLe.mjs +3 -0
  30. package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
  31. package/dist/{cloudforce-one-B6HYfk5Z.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
  32. package/dist/{completions-D_9WsLG7.mjs → completions-DOeHPdCG.mjs} +2 -2
  33. package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
  34. package/dist/connectivity-Bx3MgTHX.mjs +3 -0
  35. package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
  36. package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
  37. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
  38. package/dist/connectors-DRt4e6d_.mjs +3 -0
  39. package/dist/{content-scanning-CnW2A0pv.mjs → content-scanning-Cd2vy5Sz.mjs} +3 -3
  40. package/dist/context-jpewmual.mjs +2 -0
  41. package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
  42. package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
  43. package/dist/custom-nameservers-CWqA51in.mjs +3 -0
  44. package/dist/custom-pages-DeUKEFGe.mjs +4 -0
  45. package/dist/d1-DvWY9Gp4.mjs +4 -0
  46. package/dist/data-security-BPo6dIWu.mjs +6 -0
  47. package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
  48. package/dist/{deploy-KBRFIatG.mjs → deploy-dVrgDUOp.mjs} +1 -1
  49. package/dist/{dev-pPazzZvt.mjs → dev-C01_Lby6.mjs} +1 -1
  50. package/dist/diagnostics-6nKPmVgz.mjs +3 -0
  51. package/dist/{dispatch-namespaces-Cz2rajnP.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
  52. package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
  53. package/dist/{dist-DA54ZQu0.mjs → dist-t_YrL25p.mjs} +1 -1
  54. package/dist/{dns-62t95Xif.mjs → dns-ClciFGxx.mjs} +13 -13
  55. package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
  56. package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
  57. package/dist/{email-routing-BDUYYeV3.mjs → email-routing-CGXhFqF5.mjs} +9 -9
  58. package/dist/{email-security-ChHA6eqQ.mjs → email-security-D5viPq8S.mjs} +7 -7
  59. package/dist/email-sending-C2jpc3gh.mjs +3 -0
  60. package/dist/{filters-qJpU9uAS.mjs → filters-bzsFcWt0.mjs} +3 -3
  61. package/dist/{firewall-C3DDwfwh.mjs → firewall-DYZcTtIC.mjs} +10 -10
  62. package/dist/{fraud-DY3YXFVf.mjs → fraud-C03MtdZb.mjs} +1 -1
  63. package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
  64. package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
  65. package/dist/hostnames-CFgIVI3s.mjs +3 -0
  66. package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
  67. package/dist/iam-DqVPzGrb.mjs +6 -0
  68. package/dist/{images-D1jI3r3O.mjs → images-BYfl4YgR.mjs} +6 -6
  69. package/dist/index.mjs +1 -1
  70. package/dist/intel-duTEPIHc.mjs +3 -0
  71. package/dist/{ips-B6JETVOY.mjs → ips-nv9INuWZ.mjs} +1 -1
  72. package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
  73. package/dist/{kv-CSWoD9ks.mjs → kv-CZoV4tiv.mjs} +4 -4
  74. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
  75. package/dist/{load-balancers-Du1tNuUt.mjs → load-balancers--OMg0HNt.mjs} +5 -5
  76. package/dist/{logpush-SuJyO-uX.mjs → logpush-C0_lZTyY.mjs} +3 -3
  77. package/dist/{logs-DcDNRPRl.mjs → logs-BtpWZQfV.mjs} +2 -2
  78. package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
  79. package/dist/{magic-network-monitoring-CqtvOePQ.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
  80. package/dist/{magic-transit-BTbkhBtF.mjs → magic-transit-CLhMcJ_-.mjs} +32 -32
  81. package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
  82. package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
  83. package/dist/{network-interconnects-DsiNytOU.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
  84. package/dist/oauth-Bk-F-tIO.mjs +52 -0
  85. package/dist/{observability-CLqZ7OSi.mjs → observability-BynRbTF4.mjs} +3 -3
  86. package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
  87. package/dist/{organizations-aRi1bhFC.mjs → organizations-BqJHyvMK.mjs} +3 -3
  88. package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
  90. package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
  91. package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
  92. package/dist/{page-rules-CYqtPU1p.mjs → page-rules-EZHJePmn.mjs} +4 -4
  93. package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CXJioWPs.mjs} +5 -5
  94. package/dist/{pages-ChurJ2H7.mjs → pages-D4aYteKk.mjs} +8 -8
  95. package/dist/{pipelines-CeyujvRf.mjs → pipelines-G8Iusxq-.mjs} +5 -5
  96. package/dist/progress-DrDErV9w.mjs +2 -0
  97. package/dist/queues-DEkbKqZX.mjs +6 -0
  98. package/dist/{r2-BtuTO3vQ.mjs → r2-CV0IkCAW.mjs} +9 -9
  99. package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
  100. package/dist/{radar-CzGM92uM.mjs → radar-D986zPJr.mjs} +1 -1
  101. package/dist/{rate-limits-Bbk7HxP7.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
  102. package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
  103. package/dist/{realtime-kit-CivLpkpg.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
  104. package/dist/{registrar-8IeA5DKd.mjs → registrar-CDIwTz3G.mjs} +6 -6
  105. package/dist/request-tracers-D7SFMDik.mjs +2 -0
  106. package/dist/{resource-sharing-B-Pcto7-.mjs → resource-sharing-YIQ04jXE.mjs} +4 -4
  107. package/dist/{resource-tagging-Bpb6Qq1M.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
  108. package/dist/rules-DHjLP5Kx.mjs +4 -0
  109. package/dist/{rulesets-lYczEcJp.mjs → rulesets-q4QABpKs.mjs} +7 -7
  110. package/dist/rum-SmT4HZmM.mjs +4 -0
  111. package/dist/{schema-hefO-tzo.mjs → schema-BR31o4P6.mjs} +1 -1
  112. package/dist/{schema-validation-DTq517Em.mjs → schema-validation-vVetgC_P.mjs} +5 -5
  113. package/dist/{scim-BiLfOQ89.mjs → scim-ChOkZpNx.mjs} +2 -2
  114. package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
  115. package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-BAK9G12O.mjs} +12 -12
  116. package/dist/security-center-eScuYDKP.mjs +2 -0
  117. package/dist/security-txt-x7R4gmQu.mjs +3 -0
  118. package/dist/session-DHYCE-PM.mjs +93 -0
  119. package/dist/shared-BAjo72Lz.mjs +2 -0
  120. package/dist/{smart-shield-DblHIce0.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
  121. package/dist/snippets-DrlgYJYp.mjs +4 -0
  122. package/dist/{spawn-DK7pott_.mjs → spawn-CCGzKlC4.mjs} +1 -1
  123. package/dist/{spectrum-CnrG0jIC.mjs → spectrum-pVGxb7u5.mjs} +6 -6
  124. package/dist/speed-ZFrMWDgd.mjs +4 -0
  125. package/dist/src-DU7FBCOX.mjs +108 -0
  126. package/dist/ssl-9JY05sYt.mjs +15 -0
  127. package/dist/{stream-CGTRN4ZN.mjs → stream-tRU39b8K.mjs} +13 -13
  128. package/dist/{tenants-o_M62Y1n.mjs → tenants-HLGUazms.mjs} +1 -1
  129. package/dist/{token-validation-Ca5AGEns.mjs → token-validation-_VdamKpz.mjs} +4 -4
  130. package/dist/{tools-DtNNmO6l.mjs → tools-D_hfUU_Z.mjs} +1 -1
  131. package/dist/{turnstile-l7mo9BWL.mjs → turnstile-BRzXd28B.mjs} +4 -4
  132. package/dist/{ui-B97lRnOv.mjs → ui-erjBdVKL.mjs} +1 -1
  133. package/dist/url-normalization-D-NxuLtN.mjs +3 -0
  134. package/dist/url-scanner-BzzR6iDx.mjs +2 -0
  135. package/dist/{user-CiyYZ69X.mjs → user-C4omq__w.mjs} +1 -1
  136. package/dist/vectorize-By6EqcNR.mjs +4 -0
  137. package/dist/{versions-B6E8WQyA.mjs → versions-CBHwWPAM.mjs} +1 -1
  138. package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
  139. package/dist/{web3-DlHE0CZc.mjs → web3-DQ5dmE9W.mjs} +3 -3
  140. package/dist/{workers-DRAkU6YR.mjs → workers-D8Be7_as.mjs} +14 -14
  141. package/dist/workers-builds-BE3W3qNk.mjs +7 -0
  142. package/dist/{workflows-z6oapEJs.mjs → workflows-BWWufqFA.mjs} +3 -3
  143. package/dist/zaraz-Bsa9AvVL.mjs +2 -0
  144. package/dist/{zero-trust-fyyIelWx.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
  145. package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
  146. package/dist/{zones-MSULnDwW.mjs → zones-BXtdwt6E.mjs} +6 -6
  147. package/package.json +1 -1
  148. package/dist/ai-DS3i-I1a.mjs +0 -2
  149. package/dist/ai-gateway-RIsegO2x.mjs +0 -8
  150. package/dist/ai-search-Dcj4BauG.mjs +0 -7
  151. package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
  152. package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
  153. package/dist/argo-DnJRVnGX.mjs +0 -2
  154. package/dist/artifacts-BVWKiJUl.mjs +0 -4
  155. package/dist/audit-logs-DjTstbzL.mjs +0 -2
  156. package/dist/auth-BqDOIrKX.mjs +0 -150
  157. package/dist/auth-DKkSwnxh.mjs +0 -5
  158. package/dist/billing-3rEqF83h.mjs +0 -2
  159. package/dist/bot-management-CJxD1pqi.mjs +0 -5
  160. package/dist/botnet-feed-MG91D7BR.mjs +0 -3
  161. package/dist/brand-protection-CK7gJi06.mjs +0 -3
  162. package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
  163. package/dist/client-certificates-B0ebLJdk.mjs +0 -3
  164. package/dist/cloud-connector-BOjaggJk.mjs +0 -2
  165. package/dist/connectivity-welFvZ7X.mjs +0 -3
  166. package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
  167. package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
  168. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
  169. package/dist/connectors-3vjrdFLB.mjs +0 -3
  170. package/dist/context-CONbNKO-.mjs +0 -2
  171. package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
  172. package/dist/custom-pages-5fCSP8in.mjs +0 -4
  173. package/dist/d1-CyiRbZZn.mjs +0 -4
  174. package/dist/data-security-Casx4OS_.mjs +0 -6
  175. package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
  176. package/dist/diagnostics-BqYDoDfw.mjs +0 -3
  177. package/dist/dns-firewall-Coy8d47t.mjs +0 -57
  178. package/dist/durable-objects-BSuRERkw.mjs +0 -2
  179. package/dist/email-sending-CVrRqn6S.mjs +0 -3
  180. package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
  181. package/dist/hostnames-BdAQo1Mr.mjs +0 -3
  182. package/dist/hyperdrive-99OJV9nl.mjs +0 -18
  183. package/dist/iam-BRbpg3lN.mjs +0 -6
  184. package/dist/intel-C3ajLpXd.mjs +0 -3
  185. package/dist/keyless-certificates-C4MZ4xnf.mjs +0 -3
  186. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
  187. package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
  188. package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
  189. package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
  190. package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
  191. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
  192. package/dist/progress-Cent9Lsg.mjs +0 -2
  193. package/dist/queues-Rf_n11Cx.mjs +0 -6
  194. package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
  195. package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
  196. package/dist/request-tracers-D1aH4NmL.mjs +0 -2
  197. package/dist/rules-B10XWY10.mjs +0 -4
  198. package/dist/rum-B5GUKa4I.mjs +0 -4
  199. package/dist/security-center-AVpTOBK3.mjs +0 -2
  200. package/dist/security-txt-DVlh8y9l.mjs +0 -3
  201. package/dist/shared-0bwWVDLo.mjs +0 -2
  202. package/dist/snippets-DrpqSXYC.mjs +0 -4
  203. package/dist/speed-BzRY3Xlh.mjs +0 -4
  204. package/dist/src-D9_Gq68b.mjs +0 -108
  205. package/dist/ssl-Cp6tQkZH.mjs +0 -15
  206. package/dist/url-normalization-D1CogSIG.mjs +0 -3
  207. package/dist/url-scanner-BnJHJqcz.mjs +0 -2
  208. package/dist/vectorize-D3LgMLOn.mjs +0 -4
  209. package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
  210. package/dist/zaraz-CyzfYOEU.mjs +0 -2
  211. package/dist/zero_trust-BAhlNkjo.mjs +0 -3
  212. /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  213. /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
  214. /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-BeyOc81z.mjs} +0 -0
  215. /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
  216. /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
  217. /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
  218. /package/dist/{metadata-jh2EIan8.mjs → metadata-OOwvpR8m.mjs} +0 -0
  219. /package/dist/{resolve-D1mG0REg.mjs → resolve-C3h-mwp7.mjs} +0 -0
  220. /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,D as t,T as n,_ as r,i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d,t as f}from"./input-validation-CTqtyiY9.mjs";import{t as p}from"./local-D8bhHUMK.mjs";import{t as m}from"./cli-types-CMNMD1V7.mjs";import{n as h,t as g}from"./raw-fetch-DnbAMFBp.mjs";function _(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`delete <namespace-id>`,describe:`Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let s=await a(t),d=t.local?p:await r(s);if(t.accountId=d,!await n({force:!!t.force,message:`This operation deletes the specified keys from the namespace.`})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=o(t.body);if(Array.isArray(e)&&e.length>1e4){let n=Math.ceil(e.length/1e4),r=null;for(let a=0;a<e.length;a+=1e4){let o=e.slice(a,a+1e4);r=await u(`Deleting: batch ${Math.floor(a/1e4)+1}/${n}`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:o}))}c(r,{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:e})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function y(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`keys`,{type:`string`,array:!0,description:`Array of keys to retrieve (maximum of 100).`}).option(`type`,{type:`string`,description:`Whether to parse JSON values in the response.`,choices:[`text`,`json`],default:`text`}).option(`with-metadata`,{type:`boolean`,description:`Whether to include metadata in the response.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`get <namespace-id>`,describe:"Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true.",builder:y,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk/get`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({keys:t.keys,type:d(t.type,`type`,`text`),withMetadata:t[`with-metadata`]}):o(t.body)});return}let n=await a(t),i=t.local?p:await r(n);if(t.accountId=i,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.kv.bulk.get({...e,account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Created`});return}if(t.keys===void 0)throw Error(`--keys is required (or pass --body with this field set).`);let f=s({keys:t.keys,type:d(t.type,`type`,`text`),withMetadata:t[`with-metadata`]});c(await u(`Creating`,async()=>n.kv.bulk.get({...f,account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Created`})}};function x(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`update <namespace-id>`,describe:"Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less.",builder:x,handler:async t=>{if(t.dryRun){l({command:`cf kv bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),s=t.local?p:await r(n);if(t.accountId=s,t.body){let e=o(t.body);if(Array.isArray(e)&&e.length>1e4){let r=Math.ceil(e.length/1e4),a=null;for(let o=0;o<e.length;o+=1e4){let c=e.slice(o,o+1e4);a=await u(`Updating: batch ${Math.floor(o/1e4)+1}/${r}`,async()=>i(n,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk`,{body:c}))}c(a,{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i(n,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk`,{body:e})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},C={command:`bulk`,describe:`Bulk read, write, and delete operations on multiple KV key-value pairs at once`,builder:e=>e.command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const T={command:`delete <key-name>`,describe:"Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:w,handler:async t=>{if(t.dryRun){l({command:`cf kv keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>i.kv.keys.delete({account_id:o,namespace_id:t[`namespace-id`],key_name:t[`key-name`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const D={command:`get <key-name>`,describe:"Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header.",builder:E,handler:async t=>{if(t.dryRun){l({command:`cf kv keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i;let o=await u(`Loading`,async()=>g(`/accounts/${i}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));h(t.text===!0?o.toString(`utf-8`):o)}};function O(e){return e.option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limits the number of keys returned in the response. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit.`}).option(`prefix`,{type:`string`,description:`Filters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned.`}).option(`cursor`,{type:`string`,description:"Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the `cursors` object in the `result_info` structure."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists a namespace's keys.`,builder:O,handler:async t=>{let n={limit:t.limit,prefix:t.prefix,cursor:t.cursor};if(t.dryRun){l({command:`cf kv keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/keys`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);t.accountId=o,c(await u(`Loading`,async()=>i.kv.keys.list({account_id:o,namespace_id:t[`namespace-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`expiration`,{type:`number`,description:`Expires the key at a certain time, measured in number of seconds since the UNIX epoch.`}).option(`expiration-ttl`,{type:`number`,description:`Expires the key after a number of seconds. Must be at least 60.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A byte sequence to be stored, up to 25 MiB in length.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`The metadata`})}const j={command:`update <key-name>`,describe:"Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use `multipart/form-data` content type for your PUT request (see dropdown below in `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored.",builder:A,handler:async t=>{let n={expiration:t.expiration,expiration_ttl:t[`expiration-ttl`]};if(t.dryRun){l({command:`cf kv keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},query:n,bodyKind:t.metadata===void 0?`octet-stream`:`multipart`,body:t.metadata===void 0?t.body:{body:t.body,file:t.file,metadata:t.metadata}});return}let o=await a(t),s=t.local?p:await r(o);if(t.accountId=s,t.metadata!==void 0){let e=new FormData;if(t.file){let n=f(t.file);e.append(`value`,new Blob([n]),t.file.split(/[\\/]/).filter(Boolean).pop())}else t.body!==void 0&&e.append(`value`,t.body);t.metadata!==void 0&&e.append(`metadata`,String(d(t.metadata,`metadata`,`text`)??``)),c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{body:e})),{successLabel:`Updated`});return}if(t.file){let e=f(t.file);c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(t.body){let e=d(t.body,`body`,`binary`),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}${r?`?`+r:``}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},M={command:`keys`,describe:`Read, write, and delete individual key-value pairs in a KV namespace. Pass --namespace-id to scope.`,builder:e=>e.command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <key-name>`,describe:"Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:N,handler:async t=>{if(t.dryRun){l({command:`cf kv metadata get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/metadata/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i,c(await u(`Loading`,async()=>n.kv.metadata.get({account_id:i,namespace_id:t[`namespace-id`],key_name:t[`key-name`]})),{successLabel:`Loaded`})}},F={command:`metadata`,describe:`Read the metadata associated with a KV key without fetching its value`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`create`,describe:"Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.",builder:I,handler:async n=>{if(n.dryRun){l({command:`cf kv namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({title:d(n.title,`title`,`text`)}):o(n.body)});return}let i=await a(n),f=n.local?p:await r(i);if(n.accountId=f,n.body){let e=o(n.body);c(await u(`Creating`,async()=>i.kv.namespaces.create({body:e,account_id:f})),{successLabel:`Created`});return}n.title===void 0&&(n.title=await t(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(n.title,`title`,`text`)});c(await u(`Creating`,async()=>i.kv.namespaces.create({body:m,account_id:f})),{successLabel:`Created`})}};function R(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const z={command:`delete <namespace-id>`,describe:`Deletes the namespace corresponding to the given ID.`,builder:R,handler:async t=>{if(t.dryRun){l({command:`cf kv namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>i.kv.namespaces.delete({account_id:o,namespace_id:t[`namespace-id`]})),{successLabel:`Deleted`})}};function B(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <namespace-id>`,describe:`Get the namespace corresponding to the given ID.`,builder:B,handler:async t=>{if(t.dryRun){l({command:`cf kv namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`none`});return}let n=await a(t),i=t.local?p:await r(n);t.accountId=i,c(await u(`Loading`,async()=>n.kv.namespaces.get({account_id:i,namespace_id:t[`namespace-id`]})),{successLabel:`Loaded`})}};function H(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`id`,`title`]}).option(`direction`,{type:`string`,description:`Direction to order namespaces.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:`Returns the namespaces owned by an account.`,builder:m(H),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){l({command:`cf kv namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(t),o=t.local?p:await r(i);t.accountId=o,c(await u(`Loading`,async()=>i.kv.namespaces.list({account_id:o,...n})),{successLabel:`Loaded`})}};function W(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const G={command:`update <namespace-id>`,describe:`Modifies a namespace's title.`,builder:W,handler:async n=>{if(n.dryRun){l({command:`cf kv namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/storage/kv/namespaces/${n[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(n[`namespace-id`]))}`,pathParams:{"namespace-id":String(n[`namespace-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({title:d(n.title,`title`,`text`)}):o(n.body)});return}let i=await a(n),f=n.local?p:await r(i);if(n.accountId=f,n.body){let e=o(n.body);c(await u(`Updating`,async()=>i.kv.namespaces.update({body:e,account_id:f,namespace_id:n[`namespace-id`]})),{successLabel:`Updated`});return}n.title===void 0&&(n.title=await t(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(n.title,`title`,`text`)});c(await u(`Updating`,async()=>i.kv.namespaces.update({body:m,account_id:f,namespace_id:n[`namespace-id`]})),{successLabel:`Updated`})}},K={command:`namespaces`,describe:`KV namespaces — create, read, rename, and delete the containers that hold your key-value pairs`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`kv`,describe:`Global, low-latency key-value storage for Workers — namespaces, keys, values, and bulk operations`,builder:e=>e.command(C).command(M).command(F).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};
2
+ import{E as e,S as t,g as n,w as r}from"./oauth-Bk-F-tIO.mjs";import{i,n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d,t as f}from"./input-validation-_fMCApaH.mjs";import{t as p}from"./local-CYc9q7l2.mjs";import{t as m}from"./cli-types-BeyOc81z.mjs";import{n as h,t as g}from"./raw-fetch-_n0lMAnD.mjs";function _(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`delete <namespace-id>`,describe:`Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf kv bulk delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/bulk/delete`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let s=await a(e),d=e.local?p:await n(s);if(e.accountId=d,!await r({force:!!e.force,message:`This operation deletes the specified keys from the namespace.`})){process.stderr.write(`Aborted.
3
+ `);return}if(e.body){let t=o(e.body);if(Array.isArray(t)&&t.length>1e4){let n=Math.ceil(t.length/1e4),r=null;for(let a=0;a<t.length;a+=1e4){let o=t.slice(a,a+1e4);r=await u(`Deleting: batch ${Math.floor(a/1e4)+1}/${n}`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk/delete`,{body:o}))}c(r,{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i(s,`POST`,`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk/delete`,{body:t})),{successLabel:`Deleted`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function y(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`keys`,{type:`string`,array:!0,description:`Array of keys to retrieve (maximum of 100).`}).option(`type`,{type:`string`,description:`Whether to parse JSON values in the response.`,choices:[`text`,`json`],default:`text`}).option(`with-metadata`,{type:`boolean`,description:`Whether to include metadata in the response.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`get <namespace-id>`,describe:"Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true.",builder:y,handler:async e=>{if(e.dryRun){l({command:`cf kv bulk get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/bulk/get`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({keys:e.keys,type:d(e.type,`type`,`text`),withMetadata:e[`with-metadata`]}):o(e.body)});return}let r=await a(e),i=e.local?p:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.kv.bulk.get({...t,account_id:i,namespace_id:e[`namespace-id`]})),{successLabel:`Created`});return}if(e.keys===void 0)throw Error(`--keys is required (or pass --body with this field set).`);let f=s({keys:e.keys,type:d(e.type,`type`,`text`),withMetadata:e[`with-metadata`]});c(await u(`Creating`,async()=>r.kv.bulk.get({...f,account_id:i,namespace_id:e[`namespace-id`]})),{successLabel:`Created`})}};function x(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`update <namespace-id>`,describe:"Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less.",builder:x,handler:async e=>{if(e.dryRun){l({command:`cf kv bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/bulk`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let r=await a(e),s=e.local?p:await n(r);if(e.accountId=s,e.body){let t=o(e.body);if(Array.isArray(t)&&t.length>1e4){let n=Math.ceil(t.length/1e4),a=null;for(let o=0;o<t.length;o+=1e4){let c=t.slice(o,o+1e4);a=await u(`Updating: batch ${Math.floor(o/1e4)+1}/${n}`,async()=>i(r,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk`,{body:c}))}c(a,{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i(r,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk`,{body:t})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},C={command:`bulk`,describe:`Bulk read, write, and delete operations on multiple KV key-value pairs at once`,builder:e=>e.command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const T={command:`delete <key-name>`,describe:"Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:w,handler:async e=>{if(e.dryRun){l({command:`cf kv keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/values/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(e),o=e.local?p:await n(i);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>i.kv.keys.delete({account_id:o,namespace_id:e[`namespace-id`],key_name:e[`key-name`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const D={command:`get <key-name>`,describe:"Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header.",builder:E,handler:async e=>{if(e.dryRun){l({command:`cf kv keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/values/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?p:await n(r);e.accountId=i;let o=await u(`Loading`,async()=>g(`/accounts/${i}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));h(e.text===!0?o.toString(`utf-8`):o)}};function O(e){return e.option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limits the number of keys returned in the response. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit.`}).option(`prefix`,{type:`string`,description:`Filters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned.`}).option(`cursor`,{type:`string`,description:"Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the `cursors` object in the `result_info` structure."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists a namespace's keys.`,builder:O,handler:async e=>{let r={limit:e.limit,prefix:e.prefix,cursor:e.cursor};if(e.dryRun){l({command:`cf kv keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/keys`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},query:r,bodyKind:`none`});return}let i=await a(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.kv.keys.list({account_id:o,namespace_id:e[`namespace-id`],...r})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`expiration`,{type:`number`,description:`Expires the key at a certain time, measured in number of seconds since the UNIX epoch.`}).option(`expiration-ttl`,{type:`number`,description:`Expires the key after a number of seconds. Must be at least 60.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A byte sequence to be stored, up to 25 MiB in length.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`The metadata`})}const j={command:`update <key-name>`,describe:"Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use `multipart/form-data` content type for your PUT request (see dropdown below in `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored.",builder:A,handler:async e=>{let r={expiration:e.expiration,expiration_ttl:e[`expiration-ttl`]};if(e.dryRun){l({command:`cf kv keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/values/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},query:r,bodyKind:e.metadata===void 0?`octet-stream`:`multipart`,body:e.metadata===void 0?e.body:{body:e.body,file:e.file,metadata:e.metadata}});return}let o=await a(e),s=e.local?p:await n(o);if(e.accountId=s,e.metadata!==void 0){let t=new FormData;if(e.file){let n=f(e.file);t.append(`value`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`value`,e.body);e.metadata!==void 0&&t.append(`metadata`,String(d(e.metadata,`metadata`,`text`)??``)),c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{body:t})),{successLabel:`Updated`});return}if(e.file){let t=f(e.file);c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body){let t=d(e.body,`body`,`binary`),n=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Updating`,async()=>i(o,`PUT`,`/accounts/${s}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}${n?`?`+n:``}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},M={command:`keys`,describe:`Read, write, and delete individual key-value pairs in a KV namespace. Pass --namespace-id to scope.`,builder:e=>e.command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <key-name>`,describe:"Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:N,handler:async e=>{if(e.dryRun){l({command:`cf kv metadata get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/metadata/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?p:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.kv.metadata.get({account_id:i,namespace_id:e[`namespace-id`],key_name:e[`key-name`]})),{successLabel:`Loaded`})}},F={command:`metadata`,describe:`Read the metadata associated with a KV key without fetching its value`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`create`,describe:"Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.",builder:I,handler:async r=>{if(r.dryRun){l({command:`cf kv namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({title:d(r.title,`title`,`text`)}):o(r.body)});return}let i=await a(r),f=r.local?p:await n(i);if(r.accountId=f,r.body){let e=o(r.body);c(await u(`Creating`,async()=>i.kv.namespaces.create({body:e,account_id:f})),{successLabel:`Created`});return}r.title===void 0&&(r.title=await e(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(r.title,`title`,`text`)});c(await u(`Creating`,async()=>i.kv.namespaces.create({body:m,account_id:f})),{successLabel:`Created`})}};function R(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const z={command:`delete <namespace-id>`,describe:`Deletes the namespace corresponding to the given ID.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf kv namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let i=await a(e),o=e.local?p:await n(i);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>i.kv.namespaces.delete({account_id:o,namespace_id:e[`namespace-id`]})),{successLabel:`Deleted`})}};function B(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <namespace-id>`,describe:`Get the namespace corresponding to the given ID.`,builder:B,handler:async e=>{if(e.dryRun){l({command:`cf kv namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?p:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.kv.namespaces.get({account_id:i,namespace_id:e[`namespace-id`]})),{successLabel:`Loaded`})}};function H(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`id`,`title`]}).option(`direction`,{type:`string`,description:`Direction to order namespaces.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:`Returns the namespaces owned by an account.`,builder:m(H),handler:async e=>{let r={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){l({command:`cf kv namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},query:r,bodyKind:`none`});return}let i=await a(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.kv.namespaces.list({account_id:o,...r})),{successLabel:`Loaded`})}};function W(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const G={command:`update <namespace-id>`,describe:`Modifies a namespace's title.`,builder:W,handler:async r=>{if(r.dryRun){l({command:`cf kv namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/storage/kv/namespaces/${r[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(r[`namespace-id`]))}`,pathParams:{"namespace-id":String(r[`namespace-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({title:d(r.title,`title`,`text`)}):o(r.body)});return}let i=await a(r),f=r.local?p:await n(i);if(r.accountId=f,r.body){let e=o(r.body);c(await u(`Updating`,async()=>i.kv.namespaces.update({body:e,account_id:f,namespace_id:r[`namespace-id`]})),{successLabel:`Updated`});return}r.title===void 0&&(r.title=await e(`title`,`A human-readable string name for a Namespace.`));let m=s({title:d(r.title,`title`,`text`)});c(await u(`Updating`,async()=>i.kv.namespaces.update({body:m,account_id:f,namespace_id:r[`namespace-id`]})),{successLabel:`Updated`})}},K={command:`namespaces`,describe:`KV namespaces — create, read, rename, and delete the containers that hold your key-value pairs`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`kv`,describe:`Global, low-latency key-value storage for Workers — namespaces, keys, values, and bulk operations`,builder:e=>e.command(C).command(M).command(F).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{w as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";function l(e){return e.option(`enabled`,{type:`boolean`,description:`Determines whether or not Leaked Credential Checks are enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines the overall status for Leaked Credential Checks.`})}const u={command:`create`,describe:`Updates the current status of Leaked Credential Checks.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({enabled:e.enabled}):r(e.body)});return}let c=await n(e),l=await t({zone:e.zone},c,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=r(e.body);a(await s(`Creating`,async()=>c.leakedCredentialChecks.create({body:t,zone_id:l})),{successLabel:`Created`});return}let u=i({enabled:e.enabled});a(await s(`Creating`,async()=>c.leakedCredentialChecks.create({body:u,zone_id:l})),{successLabel:`Created`})}};function d(e){return e.option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const f={command:`create`,describe:`Create user-defined detection pattern for Leaked Credential Checks.`,builder:d,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({password:c(e.password,`password`,`text`),username:c(e.username,`username`,`text`)}):r(e.body)});return}let l=await n(e),u=await t({zone:e.zone},l,{quiet:e.quiet});if(e.zoneId=u,e.body){let t=r(e.body);a(await s(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:t,zone_id:u})),{successLabel:`Created`});return}let d=i({password:c(e.password,`password`,`text`),username:c(e.username,`username`,`text`)});a(await s(`Creating`,async()=>l.leakedCredentialChecks.detections.create({body:d,zone_id:u})),{successLabel:`Created`})}};function p(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const m={command:`delete <detection-id>`,describe:`Remove user-defined detection pattern for Leaked Credential Checks.`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf leaked-credential-checks detections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/leaked-credential-checks/detections/${r[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(r[`detection-id`]))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"detection-id":String(r[`detection-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await t({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await e({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>i.leakedCredentialChecks.detections.delete({zone_id:c,detection_id:r[`detection-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <detection-id>`,describe:`Get user-defined detection pattern for Leaked Credential Checks.`,builder:h,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections/${e[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(e[`detection-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"detection-id":String(e[`detection-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.get({zone_id:i,detection_id:e[`detection-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`List user-defined detection patterns for Leaked Credential Checks.`,builder:_,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.list({zone_id:i})),{successLabel:`Loaded`})}};function y(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const b={command:`update <detection-id>`,describe:`Update user-defined detection pattern for Leaked Credential Checks.`,builder:y,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections/${e[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(e[`detection-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"detection-id":String(e[`detection-id`]??``)},bodyKind:`json`,body:e.body===void 0?i({password:c(e.password,`password`,`text`),username:c(e.username,`username`,`text`)}):r(e.body)});return}let l=await n(e),u=await t({zone:e.zone},l,{quiet:e.quiet});if(e.zoneId=u,e.body){let t=r(e.body);a(await s(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:t,zone_id:u,detection_id:e[`detection-id`]})),{successLabel:`Updated`});return}let d=i({password:c(e.password,`password`,`text`),username:c(e.username,`username`,`text`)});a(await s(`Updating`,async()=>l.leakedCredentialChecks.detections.update({body:d,zone_id:u,detection_id:e[`detection-id`]})),{successLabel:`Updated`})}},x={command:`detections`,describe:`Operations for detections`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Retrieves the current status of Leaked Credential Checks.`,builder:S,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.get({zone_id:i})),{successLabel:`Loaded`})}},w={command:`leaked-credential-checks`,describe:`leaked-credential-checks`,builder:e=>e.command(u).command(C).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};