cf 0.0.6 → 0.1.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 (273) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +7 -7
  4. package/dist/_meta/commands.json +9051 -1085
  5. package/dist/abuse-reports-ChV_yD7f.mjs +8 -0
  6. package/dist/accounts-BCYecXFh.mjs +21 -0
  7. package/dist/acm-DD8zSds2.mjs +3 -0
  8. package/dist/addressing-D4Eqw5Bi.mjs +13 -0
  9. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  10. package/dist/ai-DfXMOMx_.mjs +2 -0
  11. package/dist/ai-gateway-DdRFthMo.mjs +8 -0
  12. package/dist/ai-search-C_68CDj1.mjs +7 -0
  13. package/dist/alerting-DbhqhVCp.mjs +6 -0
  14. package/dist/analytics-BSBBc7ep.mjs +20 -0
  15. package/dist/api-gateway-CZ4swbkQ.mjs +33 -0
  16. package/dist/argo-tms9ZwHO.mjs +2 -0
  17. package/dist/audit-logs-24qyW8cl.mjs +2 -0
  18. package/dist/auth-BlSmtIKd.mjs +112 -0
  19. package/dist/auth-DQ8miey6.mjs +6 -0
  20. package/dist/autorag-kgNt06GD.mjs +2 -0
  21. package/dist/billing-lwBHNTXC.mjs +2 -0
  22. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  23. package/dist/bot-management-LKf7BqUr.mjs +5 -0
  24. package/dist/botnet-feed-nQ-gErTS.mjs +3 -0
  25. package/dist/brand-protection-DOKv9GRr.mjs +3 -0
  26. package/dist/browser-rendering-CBExtgGt.mjs +4 -0
  27. package/dist/build-C_48VvoK.mjs +1056 -0
  28. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  29. package/dist/cache-BBiiNZHP.mjs +5 -0
  30. package/dist/calls-DA5Xzwev.mjs +4 -0
  31. package/dist/certificate-authorities-sXyR_yGp.mjs +2 -0
  32. package/dist/chunk-DH-VkVmc.mjs +2 -0
  33. package/dist/client-certificates-tV0aCLQJ.mjs +3 -0
  34. package/dist/cloud-connector-DZfHcSso.mjs +2 -0
  35. package/dist/cloudforce-one-y1PgQmI9.mjs +21 -0
  36. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  37. package/dist/config-BIfdEY0E.mjs +2 -0
  38. package/dist/connectivity-8SOqaFDn.mjs +3 -0
  39. package/dist/content-scanning-B9y6K_G5.mjs +4 -0
  40. package/dist/context-DTIbtQn5.mjs +2 -0
  41. package/dist/custom-certificates-sWksR8Ys.mjs +5 -0
  42. package/dist/custom-hostnames-91QZkdqN.mjs +5 -0
  43. package/dist/custom-nameservers-DajZaZvE.mjs +3 -0
  44. package/dist/custom-pages-Cu7gmwzT.mjs +4 -0
  45. package/dist/d1-H_VRsVmF.mjs +3 -0
  46. package/dist/dcv-delegation-C-qhEYEZ.mjs +2 -0
  47. package/dist/delegate.mjs +2 -0
  48. package/dist/deploy--9wYOkHg.mjs +2 -0
  49. package/dist/dev-BfKYB-R_.mjs +6 -0
  50. package/dist/diagnostics-D2B2LPZZ.mjs +3 -0
  51. package/dist/dispatch-namespaces-CyrXBU_w.mjs +7 -0
  52. package/dist/dist-C_bu5HwZ.mjs +82 -0
  53. package/dist/dist-DvKjT2TT.mjs +303 -0
  54. package/dist/dns-Bn9Uz_Nj.mjs +29 -0
  55. package/dist/dns-firewall-BslP4p-j.mjs +57 -0
  56. package/dist/durable-objects-BN1ZnHhm.mjs +2 -0
  57. package/dist/email-routing-n2TnTaRR.mjs +10 -0
  58. package/dist/email-security-C9SEx0kh.mjs +60 -0
  59. package/dist/email-sending-DayZ7u3I.mjs +3 -0
  60. package/dist/filters-CI_XTgfQ.mjs +4 -0
  61. package/dist/firewall-CcaayGig.mjs +11 -0
  62. package/dist/fraud-Cr7aPCV8.mjs +8 -0
  63. package/dist/google-tag-gateway-B3GpYgQ4.mjs +2 -0
  64. package/dist/healthchecks-CVTsR_OC.mjs +4 -0
  65. package/dist/hostnames-Bd_Wa5l6.mjs +3 -0
  66. package/dist/hyperdrive-BBJhEDZd.mjs +18 -0
  67. package/dist/iam-D_FN0pDF.mjs +6 -0
  68. package/dist/images-CAP2hAlZ.mjs +5 -0
  69. package/dist/index.mjs +1 -1
  70. package/dist/input-validation-zEO81MWN.mjs +2 -0
  71. package/dist/intel-CkxfzqmJ.mjs +3 -0
  72. package/dist/ips-B0cK7D0_.mjs +2 -0
  73. package/dist/keyless-certificates-LcLmHZsX.mjs +3 -0
  74. package/dist/kv-_TkUQ6fs.mjs +5 -0
  75. package/dist/leaked-credential-checks-Dhvaen22.mjs +3 -0
  76. package/dist/lib-Eu1wXxuh.mjs +68 -0
  77. package/dist/load-balancers-Ckr0UIpk.mjs +6 -0
  78. package/dist/local-VJaJ3BZ1.mjs +2 -0
  79. package/dist/logpush-Cj946hxT.mjs +4 -0
  80. package/dist/logs-DgC9hjvJ.mjs +3 -0
  81. package/dist/magic-cloud-networking-WbDvPzuG.mjs +5 -0
  82. package/dist/magic-network-monitoring-BcHShvGQ.mjs +4 -0
  83. package/dist/magic-transit-B8sCOkt_.mjs +89 -0
  84. package/dist/managed-transforms-BpOr-8HY.mjs +3 -0
  85. package/dist/mtls-certificates-fOul8D5g.mjs +3 -0
  86. package/dist/network-interconnects-BSW65xlh.mjs +36 -0
  87. package/dist/organizations-T4vKGFAb.mjs +41 -0
  88. package/dist/origin-ca-certificates-ChM0lZ64.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +2 -0
  90. package/dist/origin-tls-client-auth-D32dpZk_.mjs +5 -0
  91. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  92. package/dist/page-rules-RFoj8CjN.mjs +18 -0
  93. package/dist/page-shield-VTktzKDN.mjs +37 -0
  94. package/dist/pages-L1ITjXDZ.mjs +10 -0
  95. package/dist/pipelines-BPO0Lnil.mjs +6 -0
  96. package/dist/progress-DZfTxbrx.mjs +2 -0
  97. package/dist/queues-B0C06L9r.mjs +6 -0
  98. package/dist/r2-DP020Tmq.mjs +21 -0
  99. package/dist/r2-data-catalog-Dmipvz5F.mjs +14 -0
  100. package/dist/radar-DR3VMknH.mjs +2 -0
  101. package/dist/rate-limits-DnHPBPgU.mjs +5 -0
  102. package/dist/raw-fetch-DlXYwVA8.mjs +2 -0
  103. package/dist/realtime-kit-C430aq2d.mjs +6 -0
  104. package/dist/registrar-7Qy50zbW.mjs +46 -0
  105. package/dist/request-tracers-sv99NDIl.mjs +2 -0
  106. package/dist/resolve-BuJRWSk0.mjs +2 -0
  107. package/dist/resource-sharing-uEjC7lnQ.mjs +5 -0
  108. package/dist/resource-tagging-CiODdP3N.mjs +16 -0
  109. package/dist/rules-FXAyTrwk.mjs +4 -0
  110. package/dist/rulesets-B6aUsFFB.mjs +8 -0
  111. package/dist/rum-CyyGJhp5.mjs +4 -0
  112. package/dist/{schema-qJlCfmo8.mjs → schema-D0_cbcDt.mjs} +1 -1
  113. package/dist/schema-validation-ByU49h--.mjs +4 -0
  114. package/dist/scim-DdTS65_C.mjs +3 -0
  115. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  116. package/dist/secrets-store-ClOUVhBJ.mjs +18 -0
  117. package/dist/security-center-4iSBqTrf.mjs +2 -0
  118. package/dist/security-txt-kGxdkDY6.mjs +3 -0
  119. package/dist/session-mW-s8ghP.mjs +2 -0
  120. package/dist/smart-shield-B-SQd2Qp.mjs +3 -0
  121. package/dist/snippets-Aq58ojqw.mjs +4 -0
  122. package/dist/spawn-D_cjG87Z.mjs +10 -0
  123. package/dist/spectrum-0gFvGI6y.mjs +59 -0
  124. package/dist/speed-DAZU8w3T.mjs +4 -0
  125. package/dist/src-C5qivNKH.mjs +108 -0
  126. package/dist/ssl-BRlXa-5w.mjs +15 -0
  127. package/dist/stream-BAxsVeBX.mjs +14 -0
  128. package/dist/tenants-Df6xDqoA.mjs +2 -0
  129. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  130. package/dist/token-validation-pO4dCjCy.mjs +4 -0
  131. package/dist/{tools-CawscCBu.mjs → tools-CtKbk6VS.mjs} +1 -1
  132. package/dist/turnstile-B1dmO8wE.mjs +23 -0
  133. package/dist/{ui-Dj3No2vN.mjs → ui-mP_arYIg.mjs} +1 -1
  134. package/dist/url-normalization-sUDVmrUt.mjs +3 -0
  135. package/dist/url-scanner-CwOKRkYo.mjs +2 -0
  136. package/dist/user-D_UrIdNq.mjs +10 -0
  137. package/dist/vectorize-BEbBn9G9.mjs +4 -0
  138. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  139. package/dist/waiting-rooms-BQC-urV4.mjs +11 -0
  140. package/dist/web3-CIH2iQeX.mjs +4 -0
  141. package/dist/workers-B9EvrpH3.mjs +16 -0
  142. package/dist/workers-builds-DzWSiRd2.mjs +7 -0
  143. package/dist/workflows-aD81gA4k.mjs +4 -0
  144. package/dist/zaraz-Cg1dsvrZ.mjs +2 -0
  145. package/dist/zero-trust-D-xQXWcy.mjs +119 -0
  146. package/dist/zones-DQzucJDd.mjs +28 -0
  147. package/package.json +13 -3
  148. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  149. package/dist/accounts-BjGtCB8T.mjs +0 -6
  150. package/dist/acm-h4YPDN7k.mjs +0 -3
  151. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  152. package/dist/ai-BPln2Yka.mjs +0 -2
  153. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  154. package/dist/ai-search-EjrONI5a.mjs +0 -7
  155. package/dist/alerting-CPWMKr-m.mjs +0 -6
  156. package/dist/analytics-3dX9-scQ.mjs +0 -2
  157. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  158. package/dist/argo-Dxz9P37E.mjs +0 -2
  159. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  160. package/dist/auth-BHD_B2p9.mjs +0 -277
  161. package/dist/auth-caVo2j1K.mjs +0 -6
  162. package/dist/autorag-D7nMweNF.mjs +0 -2
  163. package/dist/billing-yaIBp1Xq.mjs +0 -2
  164. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  165. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  166. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  167. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  168. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  169. package/dist/cache-B6M_pm_D.mjs +0 -5
  170. package/dist/calls-C5XCC0i1.mjs +0 -4
  171. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  172. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  173. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  174. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  175. package/dist/config-BmTd_qeU.mjs +0 -2
  176. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  177. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  178. package/dist/context-6lBIck1r.mjs +0 -2
  179. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  180. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  181. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  182. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  183. package/dist/d1-c_zhZGWf.mjs +0 -3
  184. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  185. package/dist/dev-Bu26u5Jm.mjs +0 -14
  186. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  187. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  188. package/dist/dns-CrvIxztB.mjs +0 -11
  189. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  190. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  191. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  192. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  193. package/dist/email-security-CnpAHWpj.mjs +0 -8
  194. package/dist/email-sending-MeCKsktR.mjs +0 -3
  195. package/dist/filters-Sx2Po1UP.mjs +0 -4
  196. package/dist/firewall-B0_012XO.mjs +0 -9
  197. package/dist/fraud-CG0G_VG-.mjs +0 -2
  198. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  199. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  200. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  201. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  202. package/dist/iam-4LhJianW.mjs +0 -6
  203. package/dist/images-BqXyIycX.mjs +0 -5
  204. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  205. package/dist/intel-CiO3Sy4x.mjs +0 -3
  206. package/dist/ips-DLuGN7Mr.mjs +0 -2
  207. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  208. package/dist/kv-CVYCrk7L.mjs +0 -5
  209. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  210. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  211. package/dist/local-OqhVQbv0.mjs +0 -2
  212. package/dist/logpush-BX7z2xWz.mjs +0 -4
  213. package/dist/logs-C7vxr6Kp.mjs +0 -3
  214. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  215. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  216. package/dist/magic-transit-troGMFb9.mjs +0 -30
  217. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  218. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  219. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  220. package/dist/organizations-BtlEchi-.mjs +0 -4
  221. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  222. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  223. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  224. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  225. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  226. package/dist/pages-F1vdzqgC.mjs +0 -6
  227. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  228. package/dist/progress-5sHFvwez.mjs +0 -2
  229. package/dist/queues-BuvkxFPX.mjs +0 -6
  230. package/dist/r2-Du-fgHiT.mjs +0 -9
  231. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  232. package/dist/radar-C0eqNmWR.mjs +0 -2
  233. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  234. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  235. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  236. package/dist/registrar-B7V7i89n.mjs +0 -2
  237. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  238. package/dist/resolve-GtphSYWh.mjs +0 -2
  239. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  240. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  241. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  242. package/dist/rules-DzJFHGW1.mjs +0 -4
  243. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  244. package/dist/rum-CQ_rJ96u.mjs +0 -4
  245. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  246. package/dist/scim-ByZ5kqXS.mjs +0 -3
  247. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  248. package/dist/security-center-OUrILUnx.mjs +0 -2
  249. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  250. package/dist/session-Dxi_LbAk.mjs +0 -2
  251. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  252. package/dist/snippets-FDPiBMWc.mjs +0 -4
  253. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  254. package/dist/speed-BuEappVX.mjs +0 -4
  255. package/dist/src-D8_cWUwt.mjs +0 -104
  256. package/dist/ssl-bJbzEoRv.mjs +0 -3
  257. package/dist/stream-DuYGiGk6.mjs +0 -13
  258. package/dist/tenants-BYqEutrr.mjs +0 -2
  259. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  260. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  261. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  262. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  263. package/dist/user-Cduf3VRi.mjs +0 -7
  264. package/dist/vectorize-CMLobU9V.mjs +0 -4
  265. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  266. package/dist/web3-Bcx68Kq3.mjs +0 -4
  267. package/dist/workers-D5fOQsUA.mjs +0 -16
  268. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  269. package/dist/workflows-qFD80noW.mjs +0 -4
  270. package/dist/zaraz-C0iJimA4.mjs +0 -2
  271. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  272. package/dist/zones-Nu3wMtds.mjs +0 -5
  273. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create-v1`,describe:`Create a new Pipeline.`,builder:e=>e.option(`name`,{type:`string`,description:`Specifies the name of the Pipeline.`}).option(`sql`,{type:`string`,description:`Specifies SQL for the Pipeline processing flow.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines create-v1`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines/v1/pipelines`,pathParams:{},bodyKind:`json`,body:{name:n.name,sql:n.sql,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating v1`,async()=>i.post(`/accounts/${m}/pipelines/v1/pipelines`,{body:e})),{successLabel:`Created v1`});return}n.name===void 0&&(n.name=await t(`name`,`Specifies the name of the Pipeline.`)),n.sql===void 0&&(n.sql=await t(`sql`,`Specifies SQL for the Pipeline processing flow.`));let h={};n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.sql!==void 0&&c(h,[`sql`],o(n.sql,`sql`,`text`)),u(await p(`Creating v1`,async()=>i.post(`/accounts/${m}/pipelines/v1/pipelines`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created v1`})}},h={command:`create`,describe:`[DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint instead.`,builder:e=>e.option(`destination-batch-max-bytes`,{type:`number`,description:`Specifies rough maximum size of files.`,default:1e8}).option(`destination-batch-max-duration-s`,{type:`number`,description:`Specifies duration to wait to aggregate batches files.`,default:300}).option(`destination-batch-max-rows`,{type:`number`,description:`Specifies rough maximum number of rows per file.`,default:1e7}).option(`destination-compression-type`,{type:`string`,description:`Specifies the desired compression algorithm and format.`,choices:[`none`,`gzip`,`deflate`],default:`gzip`}).option(`destination-credentials-access-key-id`,{type:`string`,description:`Specifies the R2 Bucket Access Key Id.`}).option(`destination-credentials-endpoint`,{type:`string`,description:`Specifies the R2 Endpoint.`}).option(`destination-credentials-secret-access-key`,{type:`string`,description:`Specifies the R2 Bucket Secret Access Key.`}).option(`destination-format`,{type:`string`,description:`Specifies the format of data to deliver.`,choices:[`json`]}).option(`destination-path-bucket`,{type:`string`,description:`Specifies the R2 Bucket to store files.`}).option(`destination-path-filepath`,{type:`string`,description:`Specifies the name pattern for directory.`}).option(`destination-path-prefix`,{type:`string`,description:`Specifies the base directory within the bucket.`}).option(`destination-type`,{type:`string`,description:`Specifies the type of destination.`,choices:[`r2`]}).option(`name`,{type:`string`,description:`Defines the name of the pipeline.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines`,pathParams:{},bodyKind:`json`,body:{destinationBatchMaxBytes:i.destinationBatchMaxBytes,destinationBatchMaxDurationS:i.destinationBatchMaxDurationS,destinationBatchMaxRows:i.destinationBatchMaxRows,destinationCompressionType:i.destinationCompressionType,destinationCredentialsAccessKeyId:i.destinationCredentialsAccessKeyId,destinationCredentialsEndpoint:i.destinationCredentialsEndpoint,destinationCredentialsSecretAccessKey:i.destinationCredentialsSecretAccessKey,destinationFormat:i.destinationFormat,destinationPathBucket:i.destinationPathBucket,destinationPathFilepath:i.destinationPathFilepath,destinationPathPrefix:i.destinationPathPrefix,destinationType:i.destinationType,name:i.name,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating pipeline`,async()=>m.post(`/accounts/${h}/pipelines`,{body:e})),{successLabel:`Created pipeline`});return}i.destinationCredentialsAccessKeyId===void 0&&(i.destinationCredentialsAccessKeyId=await t(`destination-credentials-access-key-id`,`Specifies the R2 Bucket Access Key Id.`)),i.destinationCredentialsEndpoint===void 0&&(i.destinationCredentialsEndpoint=await t(`destination-credentials-endpoint`,`Specifies the R2 Endpoint.`)),i.destinationCredentialsSecretAccessKey===void 0&&(i.destinationCredentialsSecretAccessKey=await t(`destination-credentials-secret-access-key`,`Specifies the R2 Bucket Secret Access Key.`)),i.destinationFormat===void 0&&(i.destinationFormat=await n(`destination-format`,`Specifies the format of data to deliver.`,[`json`])),i.destinationPathBucket===void 0&&(i.destinationPathBucket=await t(`destination-path-bucket`,`Specifies the R2 Bucket to store files.`)),i.destinationType===void 0&&(i.destinationType=await n(`destination-type`,`Specifies the type of destination.`,[`r2`])),i.name===void 0&&(i.name=await t(`name`,`Defines the name of the pipeline.`));let g={};i.destinationBatchMaxBytes!==void 0&&c(g,[`destination`,`batch`,`max_bytes`],i.destinationBatchMaxBytes),i.destinationBatchMaxDurationS!==void 0&&c(g,[`destination`,`batch`,`max_duration_s`],i.destinationBatchMaxDurationS),i.destinationBatchMaxRows!==void 0&&c(g,[`destination`,`batch`,`max_rows`],i.destinationBatchMaxRows),i.destinationCompressionType!==void 0&&c(g,[`destination`,`compression`,`type`],o(i.destinationCompressionType,`destinationCompressionType`,`text`)),i.destinationCredentialsAccessKeyId!==void 0&&c(g,[`destination`,`credentials`,`access_key_id`],o(i.destinationCredentialsAccessKeyId,`destinationCredentialsAccessKeyId`,`text`)),i.destinationCredentialsEndpoint!==void 0&&c(g,[`destination`,`credentials`,`endpoint`],o(i.destinationCredentialsEndpoint,`destinationCredentialsEndpoint`,`text`)),i.destinationCredentialsSecretAccessKey!==void 0&&c(g,[`destination`,`credentials`,`secret_access_key`],o(i.destinationCredentialsSecretAccessKey,`destinationCredentialsSecretAccessKey`,`text`)),i.destinationFormat!==void 0&&c(g,[`destination`,`format`],o(i.destinationFormat,`destinationFormat`,`text`)),i.destinationPathBucket!==void 0&&c(g,[`destination`,`path`,`bucket`],o(i.destinationPathBucket,`destinationPathBucket`,`text`)),i.destinationPathFilepath!==void 0&&c(g,[`destination`,`path`,`filepath`],o(i.destinationPathFilepath,`destinationPathFilepath`,`text`)),i.destinationPathPrefix!==void 0&&c(g,[`destination`,`path`,`prefix`],o(i.destinationPathPrefix,`destinationPathPrefix`,`text`)),i.destinationType!==void 0&&c(g,[`destination`,`type`],o(i.destinationType,`destinationType`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),u(await p(`Creating pipeline`,async()=>m.post(`/accounts/${h}/pipelines`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created pipeline`})}},g={command:`delete-v1 <pipelineId>`,describe:`Delete Pipeline in Account.`,builder:e=>e.positional(`pipelineId`,{type:`string`,description:`Specifies the public ID of the pipeline.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.pipelineId,`pipelineId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf pipelines delete-v1`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pipelines/v1/pipelines/${t.pipelineId??`<pipelineId>`}`,pathParams:{pipelineId:String(t.pipelineId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`v1`,String(t.pipelineId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting v1`,async()=>n.pipelines.deleteV1(o,t.pipelineId)),{successLabel:`Deleted v1`})}},_={command:`delete <pipelineName>`,describe:`[DEPRECATED] Delete a pipeline. Use the new /pipelines/v1/pipelines endpoint instead.`,builder:e=>e.positional(`pipelineName`,{type:`string`,description:`Defines the name of the pipeline.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.pipelineName,`pipelineName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf pipelines delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pipelines/${t.pipelineName??`<pipelineName>`}`,pathParams:{pipelineName:String(t.pipelineName??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`pipeline`,String(t.pipelineName??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting pipeline`,async()=>n.pipelines.delete(o,t.pipelineName)),{successLabel:`Deleted pipeline`})}},v={command:`get-v1 <pipelineId>`,describe:`Get Pipelines Details.`,builder:e=>e.positional(`pipelineId`,{type:`string`,description:`Specifies the public ID of the pipeline.`,demandOption:!0}),handler:async e=>{s(e.pipelineId,`pipelineId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading v1`,async()=>t.pipelines.getV1(n,e.pipelineId)),{successLabel:`Loaded v1`})}},y={command:`get <pipelineName>`,describe:`[DEPRECATED] Get configuration of a pipeline. Use the new /pipelines/v1/pipelines endpoint instead.`,builder:e=>e.positional(`pipelineName`,{type:`string`,description:`Defines the name of the pipeline.`,demandOption:!0}),handler:async e=>{s(e.pipelineName,`pipelineName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading pipeline`,async()=>t.pipelines.get(n,e.pipelineName)),{successLabel:`Loaded pipeline`})}},b={command:`list-v1`,describe:`List/Filter Pipelines in Account.`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading v1`,async()=>n.pipelines.listV1(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded v1`})}},x={command:`list`,describe:`[DEPRECATED] List, filter, and paginate pipelines in an account. Use the new /pipelines/v1/pipelines endpoint instead.`,builder:e=>e.option(`search`,{type:`string`,description:`Specifies the prefix of pipeline name to search.`}).option(`page`,{type:`string`,description:`Specifies which page to retrieve.`}).option(`per-page`,{type:`string`,description:`Specifies the number of pipelines per page.`}),handler:async e=>{let t={};e.search!==void 0&&(t.search=e.search),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading pipelines`,async()=>n.pipelines.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded pipelines`})}},S={command:`create`,describe:`Create a new Sink.`,builder:e=>e.option(`config-account-id`,{type:`string`,description:`Cloudflare Account ID for the bucket`}).option(`config-bucket`,{type:`string`,description:`R2 Bucket to write to`}).option(`config-credentials-access-key-id`,{type:`string`,description:`Cloudflare Account ID for the bucket`}).option(`config-credentials-secret-access-key`,{type:`string`,description:`Cloudflare Account ID for the bucket`}).option(`config-file-naming-prefix`,{type:`string`,description:`The prefix to use in file name. i.e prefix-<uuid>.parquet`}).option(`config-file-naming-strategy`,{type:`string`,description:`Filename generation strategy.`,choices:[`serial`,`uuid`,`uuid_v7`,`ulid`]}).option(`config-file-naming-suffix`,{type:`string`,description:`This will overwrite the default file suffix. i.e .parquet, use with caution`}).option(`config-jurisdiction`,{type:`string`,description:`Jurisdiction this bucket is hosted in`}).option(`config-partitioning-time-pattern`,{type:`string`,description:`The pattern of the date string`}).option(`config-path`,{type:`string`,description:`Subpath within the bucket to write to`}).option(`config-rolling-policy-file-size-bytes`,{type:`number`,description:`Files will be rolled after reaching this number of bytes`}).option(`config-rolling-policy-inactivity-seconds`,{type:`number`,description:`Number of seconds of inactivity to wait before rolling over to a new file`}).option(`config-rolling-policy-interval-seconds`,{type:`number`,description:`Number of seconds to wait before rolling over to a new file`}).option(`config-namespace`,{type:`string`,description:`Table namespace`}).option(`config-table-name`,{type:`string`,description:`Table name`}).option(`config-token`,{type:`string`,description:`Authentication token`}).option(`format-decimal-encoding`,{type:`string`,description:`The format.decimal_encoding field`,choices:[`number`,`string`,`bytes`]}).option(`format-timestamp-format`,{type:`string`,description:`The format.timestamp_format field`,choices:[`rfc3339`,`unix_millis`]}).option(`format-unstructured`,{type:`boolean`,description:`The format.unstructured field`}).option(`format-type`,{type:`string`,description:`The format.type field`,choices:[`json`,`parquet`]}).option(`format-compression`,{type:`string`,description:`The format.compression field`,choices:[`uncompressed`,`snappy`,`gzip`,`zstd`,`lz4`]}).option(`format-row-group-bytes`,{type:`number`,description:`The format.row_group_bytes field`}).option(`name`,{type:`string`,description:`Defines the name of the Sink.`}).option(`schema-format-decimal-encoding`,{type:`string`,description:`The schema.format.decimal_encoding field`,choices:[`number`,`string`,`bytes`]}).option(`schema-format-timestamp-format`,{type:`string`,description:`The schema.format.timestamp_format field`,choices:[`rfc3339`,`unix_millis`]}).option(`schema-format-unstructured`,{type:`boolean`,description:`The schema.format.unstructured field`}).option(`schema-format-type`,{type:`string`,description:`The schema.format.type field`,choices:[`json`,`parquet`]}).option(`schema-format-compression`,{type:`string`,description:`The schema.format.compression field`,choices:[`uncompressed`,`snappy`,`gzip`,`zstd`,`lz4`]}).option(`schema-format-row-group-bytes`,{type:`number`,description:`The schema.format.row_group_bytes field`}).option(`schema-inferred`,{type:`boolean`,description:`The schema.inferred field`}).option(`type`,{type:`string`,description:`Specifies the type of sink.`,choices:[`r2`,`r2_data_catalog`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`config-credentials-access-key-id`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-credentials-secret-access-key`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-file-naming-prefix`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-file-naming-strategy`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-file-naming-suffix`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-jurisdiction`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-partitioning-time-pattern`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-path`,[`config-namespace`,`config-table-name`,`config-token`]).conflicts(`config-namespace`,[`config-credentials-access-key-id`,`config-credentials-secret-access-key`,`config-file-naming-prefix`,`config-file-naming-strategy`,`config-file-naming-suffix`,`config-jurisdiction`,`config-partitioning-time-pattern`,`config-path`]).conflicts(`config-table-name`,[`config-credentials-access-key-id`,`config-credentials-secret-access-key`,`config-file-naming-prefix`,`config-file-naming-strategy`,`config-file-naming-suffix`,`config-jurisdiction`,`config-partitioning-time-pattern`,`config-path`]).implies(`config-table-name`,[`config-token`]).conflicts(`config-token`,[`config-credentials-access-key-id`,`config-credentials-secret-access-key`,`config-file-naming-prefix`,`config-file-naming-strategy`,`config-file-naming-suffix`,`config-jurisdiction`,`config-partitioning-time-pattern`,`config-path`]).implies(`config-token`,[`config-table-name`]).conflicts(`format-decimal-encoding`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-timestamp-format`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-unstructured`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-compression`,[`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`]).conflicts(`format-row-group-bytes`,[`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`]).conflicts(`schema-format-decimal-encoding`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-timestamp-format`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-unstructured`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-compression`,[`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`]).conflicts(`schema-format-row-group-bytes`,[`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`]).check(e=>{if([`config-account-id`,`config-bucket`,`config-credentials-access-key-id`,`config-credentials-secret-access-key`,`config-file-naming-prefix`,`config-file-naming-strategy`,`config-file-naming-suffix`,`config-jurisdiction`,`config-partitioning-time-pattern`,`config-path`,`config-rolling-policy-file-size-bytes`,`config-rolling-policy-inactivity-seconds`,`config-rolling-policy-interval-seconds`,`config-namespace`,`config-table-name`,`config-token`].some(t=>e[t]!==void 0)){let t=[`config-account-id`,`config-bucket`,`config-credentials-access-key-id`,`config-credentials-secret-access-key`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --config-* flag is set`)}return!0}).check(e=>{if([`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`,`format-type`,`format-compression`,`format-row-group-bytes`].some(t=>e[t]!==void 0)){let t=[`format-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --format-* flag is set`)}return!0}).check(e=>{if([`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`,`schema-format-type`,`schema-format-compression`,`schema-format-row-group-bytes`,`schema-inferred`].some(t=>e[t]!==void 0)){let t=[`schema-format-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --schema-* flag is set`)}return!0}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines sinks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines/v1/sinks`,pathParams:{},bodyKind:`json`,body:{configAccountId:i.configAccountId,configBucket:i.configBucket,configCredentialsAccessKeyId:i.configCredentialsAccessKeyId,configCredentialsSecretAccessKey:i.configCredentialsSecretAccessKey,configFileNamingPrefix:i.configFileNamingPrefix,configFileNamingStrategy:i.configFileNamingStrategy,configFileNamingSuffix:i.configFileNamingSuffix,configJurisdiction:i.configJurisdiction,configPartitioningTimePattern:i.configPartitioningTimePattern,configPath:i.configPath,configRollingPolicyFileSizeBytes:i.configRollingPolicyFileSizeBytes,configRollingPolicyInactivitySeconds:i.configRollingPolicyInactivitySeconds,configRollingPolicyIntervalSeconds:i.configRollingPolicyIntervalSeconds,configNamespace:i.configNamespace,configTableName:i.configTableName,configToken:i.configToken,formatDecimalEncoding:i.formatDecimalEncoding,formatTimestampFormat:i.formatTimestampFormat,formatUnstructured:i.formatUnstructured,formatType:i.formatType,formatCompression:i.formatCompression,formatRowGroupBytes:i.formatRowGroupBytes,name:i.name,schemaFormatDecimalEncoding:i.schemaFormatDecimalEncoding,schemaFormatTimestampFormat:i.schemaFormatTimestampFormat,schemaFormatUnstructured:i.schemaFormatUnstructured,schemaFormatType:i.schemaFormatType,schemaFormatCompression:i.schemaFormatCompression,schemaFormatRowGroupBytes:i.schemaFormatRowGroupBytes,schemaInferred:i.schemaInferred,type:i.type,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating sink`,async()=>m.post(`/accounts/${h}/pipelines/v1/sinks`,{body:e})),{successLabel:`Created sink`});return}i.name===void 0&&(i.name=await t(`name`,`Defines the name of the Sink.`)),i.type===void 0&&(i.type=await n(`type`,`Specifies the type of sink.`,[`r2`,`r2_data_catalog`]));let g={};i.configAccountId!==void 0&&c(g,[`config`,`account_id`],o(i.configAccountId,`configAccountId`,`text`)),i.configBucket!==void 0&&c(g,[`config`,`bucket`],o(i.configBucket,`configBucket`,`text`)),i.configCredentialsAccessKeyId!==void 0&&c(g,[`config`,`credentials`,`access_key_id`],o(i.configCredentialsAccessKeyId,`configCredentialsAccessKeyId`,`text`)),i.configCredentialsSecretAccessKey!==void 0&&c(g,[`config`,`credentials`,`secret_access_key`],o(i.configCredentialsSecretAccessKey,`configCredentialsSecretAccessKey`,`text`)),i.configFileNamingPrefix!==void 0&&c(g,[`config`,`file_naming`,`prefix`],o(i.configFileNamingPrefix,`configFileNamingPrefix`,`text`)),i.configFileNamingStrategy!==void 0&&c(g,[`config`,`file_naming`,`strategy`],o(i.configFileNamingStrategy,`configFileNamingStrategy`,`text`)),i.configFileNamingSuffix!==void 0&&c(g,[`config`,`file_naming`,`suffix`],o(i.configFileNamingSuffix,`configFileNamingSuffix`,`text`)),i.configJurisdiction!==void 0&&c(g,[`config`,`jurisdiction`],o(i.configJurisdiction,`configJurisdiction`,`text`)),i.configPartitioningTimePattern!==void 0&&c(g,[`config`,`partitioning`,`time_pattern`],o(i.configPartitioningTimePattern,`configPartitioningTimePattern`,`text`)),i.configPath!==void 0&&c(g,[`config`,`path`],o(i.configPath,`configPath`,`text`)),i.configRollingPolicyFileSizeBytes!==void 0&&c(g,[`config`,`rolling_policy`,`file_size_bytes`],i.configRollingPolicyFileSizeBytes),i.configRollingPolicyInactivitySeconds!==void 0&&c(g,[`config`,`rolling_policy`,`inactivity_seconds`],i.configRollingPolicyInactivitySeconds),i.configRollingPolicyIntervalSeconds!==void 0&&c(g,[`config`,`rolling_policy`,`interval_seconds`],i.configRollingPolicyIntervalSeconds),i.configNamespace!==void 0&&c(g,[`config`,`namespace`],o(i.configNamespace,`configNamespace`,`text`)),i.configTableName!==void 0&&c(g,[`config`,`table_name`],o(i.configTableName,`configTableName`,`text`)),i.configToken!==void 0&&c(g,[`config`,`token`],o(i.configToken,`configToken`,`text`)),i.formatDecimalEncoding!==void 0&&c(g,[`format`,`decimal_encoding`],o(i.formatDecimalEncoding,`formatDecimalEncoding`,`text`)),i.formatTimestampFormat!==void 0&&c(g,[`format`,`timestamp_format`],o(i.formatTimestampFormat,`formatTimestampFormat`,`text`)),i.formatUnstructured!==void 0&&c(g,[`format`,`unstructured`],i.formatUnstructured),i.formatType!==void 0&&c(g,[`format`,`type`],o(i.formatType,`formatType`,`text`)),i.formatCompression!==void 0&&c(g,[`format`,`compression`],o(i.formatCompression,`formatCompression`,`text`)),i.formatRowGroupBytes!==void 0&&c(g,[`format`,`row_group_bytes`],i.formatRowGroupBytes),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.schemaFormatDecimalEncoding!==void 0&&c(g,[`schema`,`format`,`decimal_encoding`],o(i.schemaFormatDecimalEncoding,`schemaFormatDecimalEncoding`,`text`)),i.schemaFormatTimestampFormat!==void 0&&c(g,[`schema`,`format`,`timestamp_format`],o(i.schemaFormatTimestampFormat,`schemaFormatTimestampFormat`,`text`)),i.schemaFormatUnstructured!==void 0&&c(g,[`schema`,`format`,`unstructured`],i.schemaFormatUnstructured),i.schemaFormatType!==void 0&&c(g,[`schema`,`format`,`type`],o(i.schemaFormatType,`schemaFormatType`,`text`)),i.schemaFormatCompression!==void 0&&c(g,[`schema`,`format`,`compression`],o(i.schemaFormatCompression,`schemaFormatCompression`,`text`)),i.schemaFormatRowGroupBytes!==void 0&&c(g,[`schema`,`format`,`row_group_bytes`],i.schemaFormatRowGroupBytes),i.schemaInferred!==void 0&&c(g,[`schema`,`inferred`],i.schemaInferred),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),u(await p(`Creating sink`,async()=>m.post(`/accounts/${h}/pipelines/v1/sinks`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created sink`})}},C={command:`delete <sinkId>`,describe:`Delete Pipeline in Account.`,builder:e=>e.positional(`sinkId`,{type:`string`,description:`Specifies the publid ID of the sink.`,demandOption:!0}).option(`force`,{type:`string`,description:`Delete sink forcefully, including deleting any dependent pipelines.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.sinkId,`sinkId`);let n={};if(t.force!==void 0&&(n.force=t.force),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf pipelines sinks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/pipelines/v1/sinks/${t.sinkId??`<sinkId>`}`,pathParams:{sinkId:String(t.sinkId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`sink`,String(t.sinkId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting sink`,async()=>o.pipelines.sinks.delete(c,t.sinkId,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted sink`})}},w={command:`get <sinkId>`,describe:`Get Sink Details.`,builder:e=>e.positional(`sinkId`,{type:`string`,description:`Specifies the publid ID of the sink.`,demandOption:!0}),handler:async e=>{s(e.sinkId,`sinkId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading sink`,async()=>t.pipelines.sinks.get(n,e.sinkId)),{successLabel:`Loaded sink`})}},T={command:`list`,describe:`List/Filter Sinks in Account.`,builder:e=>e.option(`pipeline-id`,{type:`string`,description:`Pipeline ID`}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{let t={};e.pipelineId!==void 0&&(t.pipeline_id=e.pipelineId),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading sinks`,async()=>n.pipelines.sinks.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded sinks`})}},E={command:`sinks`,describe:`Destinations where pipeline data is written — R2 buckets, HTTP endpoints, or other storage`,builder:e=>e.command(S).command(C).command(w).command(T).demandCommand(1),handler:()=>{}},D={command:`create`,describe:`Create a new Stream.`,builder:e=>e.option(`format-decimal-encoding`,{type:`string`,description:`The format.decimal_encoding field`,choices:[`number`,`string`,`bytes`]}).option(`format-timestamp-format`,{type:`string`,description:`The format.timestamp_format field`,choices:[`rfc3339`,`unix_millis`]}).option(`format-unstructured`,{type:`boolean`,description:`The format.unstructured field`}).option(`format-type`,{type:`string`,description:`The format.type field`,choices:[`json`,`parquet`]}).option(`format-compression`,{type:`string`,description:`The format.compression field`,choices:[`uncompressed`,`snappy`,`gzip`,`zstd`,`lz4`]}).option(`format-row-group-bytes`,{type:`number`,description:`The format.row_group_bytes field`}).option(`http-authentication`,{type:`boolean`,description:`Indicates that authentication is required for the HTTP endpoint.`,default:!1}).option(`http-cors-origins`,{type:`string`,array:!0,description:`The http.cors.origins field`}).option(`http-enabled`,{type:`boolean`,description:`Indicates that the HTTP endpoint is enabled.`,default:!1}).option(`name`,{type:`string`,description:`Specifies the name of the Stream.`}).option(`schema-format-decimal-encoding`,{type:`string`,description:`The schema.format.decimal_encoding field`,choices:[`number`,`string`,`bytes`]}).option(`schema-format-timestamp-format`,{type:`string`,description:`The schema.format.timestamp_format field`,choices:[`rfc3339`,`unix_millis`]}).option(`schema-format-unstructured`,{type:`boolean`,description:`The schema.format.unstructured field`}).option(`schema-format-type`,{type:`string`,description:`The schema.format.type field`,choices:[`json`,`parquet`]}).option(`schema-format-compression`,{type:`string`,description:`The schema.format.compression field`,choices:[`uncompressed`,`snappy`,`gzip`,`zstd`,`lz4`]}).option(`schema-format-row-group-bytes`,{type:`number`,description:`The schema.format.row_group_bytes field`}).option(`schema-inferred`,{type:`boolean`,description:`The schema.inferred field`}).option(`worker-binding-enabled`,{type:`boolean`,description:`Indicates that the worker binding is enabled.`,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)`}).conflicts(`format-decimal-encoding`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-timestamp-format`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-unstructured`,[`format-compression`,`format-row-group-bytes`]).conflicts(`format-compression`,[`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`]).conflicts(`format-row-group-bytes`,[`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`]).conflicts(`schema-format-decimal-encoding`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-timestamp-format`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-unstructured`,[`schema-format-compression`,`schema-format-row-group-bytes`]).conflicts(`schema-format-compression`,[`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`]).conflicts(`schema-format-row-group-bytes`,[`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`]).check(e=>{if([`format-decimal-encoding`,`format-timestamp-format`,`format-unstructured`,`format-type`,`format-compression`,`format-row-group-bytes`].some(t=>e[t]!==void 0)){let t=[`format-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --format-* flag is set`)}return!0}).check(e=>{if([`http-authentication`,`http-cors-origins`,`http-enabled`].some(t=>e[t]!==void 0)){let t=[`http-authentication`,`http-enabled`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --http-* flag is set`)}return!0}).check(e=>{if([`schema-format-decimal-encoding`,`schema-format-timestamp-format`,`schema-format-unstructured`,`schema-format-type`,`schema-format-compression`,`schema-format-row-group-bytes`,`schema-inferred`].some(t=>e[t]!==void 0)){let t=[`schema-format-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --schema-* flag is set`)}return!0}).check(e=>{if([`worker-binding-enabled`].some(t=>e[t]!==void 0)){let t=[`worker-binding-enabled`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --worker_binding-* flag is set`)}return!0}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines streams create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines/v1/streams`,pathParams:{},bodyKind:`json`,body:{formatDecimalEncoding:n.formatDecimalEncoding,formatTimestampFormat:n.formatTimestampFormat,formatUnstructured:n.formatUnstructured,formatType:n.formatType,formatCompression:n.formatCompression,formatRowGroupBytes:n.formatRowGroupBytes,httpAuthentication:n.httpAuthentication,httpCorsOrigins:n.httpCorsOrigins,httpEnabled:n.httpEnabled,name:n.name,schemaFormatDecimalEncoding:n.schemaFormatDecimalEncoding,schemaFormatTimestampFormat:n.schemaFormatTimestampFormat,schemaFormatUnstructured:n.schemaFormatUnstructured,schemaFormatType:n.schemaFormatType,schemaFormatCompression:n.schemaFormatCompression,schemaFormatRowGroupBytes:n.schemaFormatRowGroupBytes,schemaInferred:n.schemaInferred,workerBindingEnabled:n.workerBindingEnabled,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating stream`,async()=>i.post(`/accounts/${m}/pipelines/v1/streams`,{body:e})),{successLabel:`Created stream`});return}n.name===void 0&&(n.name=await t(`name`,`Specifies the name of the Stream.`));let h={};n.formatDecimalEncoding!==void 0&&c(h,[`format`,`decimal_encoding`],o(n.formatDecimalEncoding,`formatDecimalEncoding`,`text`)),n.formatTimestampFormat!==void 0&&c(h,[`format`,`timestamp_format`],o(n.formatTimestampFormat,`formatTimestampFormat`,`text`)),n.formatUnstructured!==void 0&&c(h,[`format`,`unstructured`],n.formatUnstructured),n.formatType!==void 0&&c(h,[`format`,`type`],o(n.formatType,`formatType`,`text`)),n.formatCompression!==void 0&&c(h,[`format`,`compression`],o(n.formatCompression,`formatCompression`,`text`)),n.formatRowGroupBytes!==void 0&&c(h,[`format`,`row_group_bytes`],n.formatRowGroupBytes),n.httpAuthentication!==void 0&&c(h,[`http`,`authentication`],n.httpAuthentication),n.httpCorsOrigins!==void 0&&c(h,[`http`,`cors`,`origins`],n.httpCorsOrigins),n.httpEnabled!==void 0&&c(h,[`http`,`enabled`],n.httpEnabled),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.schemaFormatDecimalEncoding!==void 0&&c(h,[`schema`,`format`,`decimal_encoding`],o(n.schemaFormatDecimalEncoding,`schemaFormatDecimalEncoding`,`text`)),n.schemaFormatTimestampFormat!==void 0&&c(h,[`schema`,`format`,`timestamp_format`],o(n.schemaFormatTimestampFormat,`schemaFormatTimestampFormat`,`text`)),n.schemaFormatUnstructured!==void 0&&c(h,[`schema`,`format`,`unstructured`],n.schemaFormatUnstructured),n.schemaFormatType!==void 0&&c(h,[`schema`,`format`,`type`],o(n.schemaFormatType,`schemaFormatType`,`text`)),n.schemaFormatCompression!==void 0&&c(h,[`schema`,`format`,`compression`],o(n.schemaFormatCompression,`schemaFormatCompression`,`text`)),n.schemaFormatRowGroupBytes!==void 0&&c(h,[`schema`,`format`,`row_group_bytes`],n.schemaFormatRowGroupBytes),n.schemaInferred!==void 0&&c(h,[`schema`,`inferred`],n.schemaInferred),n.workerBindingEnabled!==void 0&&c(h,[`worker_binding`,`enabled`],n.workerBindingEnabled),u(await p(`Creating stream`,async()=>i.post(`/accounts/${m}/pipelines/v1/streams`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created stream`})}},O={command:`delete <streamId>`,describe:`Delete Stream in Account.`,builder:e=>e.positional(`streamId`,{type:`string`,description:`Specifies the public ID of the stream.`,demandOption:!0}).option(`force`,{type:`string`,description:`Delete stream forcefully, including deleting any dependent pipelines.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.streamId,`streamId`);let n={};if(t.force!==void 0&&(n.force=t.force),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf pipelines streams delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/pipelines/v1/streams/${t.streamId??`<streamId>`}`,pathParams:{streamId:String(t.streamId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`stream`,String(t.streamId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting stream`,async()=>o.pipelines.streams.delete(c,t.streamId,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted stream`})}},k={command:`get <streamId>`,describe:`Get Stream Details.`,builder:e=>e.positional(`streamId`,{type:`string`,description:`Specifies the public ID of the stream.`,demandOption:!0}),handler:async e=>{s(e.streamId,`streamId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading stream`,async()=>t.pipelines.streams.get(n,e.streamId)),{successLabel:`Loaded stream`})}},A={command:`list`,describe:`List/Filter Streams in Account.`,builder:e=>e.option(`pipeline-id`,{type:`string`,description:`Specifies the public ID of the pipeline.`}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{let t={};e.pipelineId!==void 0&&(t.pipeline_id=e.pipelineId),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading streams`,async()=>n.pipelines.streams.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded streams`})}},j={command:`update <streamId>`,describe:`Update a Stream.`,builder:e=>e.positional(`streamId`,{type:`string`,description:`Specifies the public ID of the stream.`,demandOption:!0}).option(`http-authentication`,{type:`boolean`,description:`Indicates that authentication is required for the HTTP endpoint.`,default:!1}).option(`http-cors-origins`,{type:`string`,array:!0,description:`The http.cors.origins field`}).option(`http-enabled`,{type:`boolean`,description:`Indicates that the HTTP endpoint is enabled.`,default:!1}).option(`worker-binding-enabled`,{type:`boolean`,description:`Indicates that the worker binding is enabled.`,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)`}).check(e=>{if([`http-authentication`,`http-cors-origins`,`http-enabled`].some(t=>e[t]!==void 0)){let t=[`http-authentication`,`http-enabled`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --http-* flag is set`)}return!0}).check(e=>{if([`worker-binding-enabled`].some(t=>e[t]!==void 0)){let t=[`worker-binding-enabled`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --worker_binding-* flag is set`)}return!0}),handler:async t=>{if(s(t.streamId,`streamId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf pipelines streams update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pipelines/v1/streams/${t.streamId??`<streamId>`}`,pathParams:{streamId:String(t.streamId??``)},bodyKind:`json`,body:{httpAuthentication:t.httpAuthentication,httpCorsOrigins:t.httpCorsOrigins,httpEnabled:t.httpEnabled,workerBindingEnabled:t.workerBindingEnabled,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating stream`,async()=>n.patch(`/accounts/${i}/pipelines/v1/streams/${t.streamId}`,{body:e})),{successLabel:`Updated stream`});return}let o={};t.httpAuthentication!==void 0&&c(o,[`http`,`authentication`],t.httpAuthentication),t.httpCorsOrigins!==void 0&&c(o,[`http`,`cors`,`origins`],t.httpCorsOrigins),t.httpEnabled!==void 0&&c(o,[`http`,`enabled`],t.httpEnabled),t.workerBindingEnabled!==void 0&&c(o,[`worker_binding`,`enabled`],t.workerBindingEnabled),u(await p(`Updating stream`,async()=>n.patch(`/accounts/${i}/pipelines/v1/streams/${t.streamId}`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated stream`})}},M={command:`streams`,describe:`Inbound data streams that feed events into a pipeline for processing`,builder:e=>e.command(D).command(O).command(k).command(A).command(j).demandCommand(1),handler:()=>{}},N={command:`update <pipelineName>`,describe:`[DEPRECATED] Update an existing pipeline. Use the new /pipelines/v1/pipelines endpoint instead.`,builder:e=>e.positional(`pipelineName`,{type:`string`,description:`Defines the name of the pipeline.`,demandOption:!0}).option(`destination-batch-max-bytes`,{type:`number`,description:`Specifies rough maximum size of files.`}).option(`destination-batch-max-duration-s`,{type:`number`,description:`Specifies duration to wait to aggregate batches files.`}).option(`destination-batch-max-rows`,{type:`number`,description:`Specifies rough maximum number of rows per file.`}).option(`destination-compression-type`,{type:`string`,description:`Specifies the desired compression algorithm and format.`,choices:[`none`,`gzip`,`deflate`]}).option(`destination-credentials-access-key-id`,{type:`string`,description:`Specifies the R2 Bucket Access Key Id.`}).option(`destination-credentials-endpoint`,{type:`string`,description:`Specifies the R2 Endpoint.`}).option(`destination-credentials-secret-access-key`,{type:`string`,description:`Specifies the R2 Bucket Secret Access Key.`}).option(`destination-format`,{type:`string`,description:`Specifies the format of data to deliver.`,choices:[`json`]}).option(`destination-path-bucket`,{type:`string`,description:`Specifies the R2 Bucket to store files.`}).option(`destination-path-filepath`,{type:`string`,description:`Specifies the name pattern for directory.`}).option(`destination-path-prefix`,{type:`string`,description:`Specifies the base directory within the bucket.`}).option(`destination-type`,{type:`string`,description:`Specifies the type of destination.`,choices:[`r2`]}).option(`name`,{type:`string`,description:`Defines the name of the pipeline.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(s(i.pipelineName,`pipelineName`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines/${i.pipelineName??`<pipelineName>`}`,pathParams:{pipelineName:String(i.pipelineName??``)},bodyKind:`json`,body:{destinationBatchMaxBytes:i.destinationBatchMaxBytes,destinationBatchMaxDurationS:i.destinationBatchMaxDurationS,destinationBatchMaxRows:i.destinationBatchMaxRows,destinationCompressionType:i.destinationCompressionType,destinationCredentialsAccessKeyId:i.destinationCredentialsAccessKeyId,destinationCredentialsEndpoint:i.destinationCredentialsEndpoint,destinationCredentialsSecretAccessKey:i.destinationCredentialsSecretAccessKey,destinationFormat:i.destinationFormat,destinationPathBucket:i.destinationPathBucket,destinationPathFilepath:i.destinationPathFilepath,destinationPathPrefix:i.destinationPathPrefix,destinationType:i.destinationType,name:i.name,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating pipeline`,async()=>m.put(`/accounts/${h}/pipelines/${i.pipelineName}`,{body:e})),{successLabel:`Updated pipeline`});return}i.destinationCredentialsAccessKeyId===void 0&&(i.destinationCredentialsAccessKeyId=await t(`destination-credentials-access-key-id`,`Specifies the R2 Bucket Access Key Id.`)),i.destinationCredentialsEndpoint===void 0&&(i.destinationCredentialsEndpoint=await t(`destination-credentials-endpoint`,`Specifies the R2 Endpoint.`)),i.destinationCredentialsSecretAccessKey===void 0&&(i.destinationCredentialsSecretAccessKey=await t(`destination-credentials-secret-access-key`,`Specifies the R2 Bucket Secret Access Key.`)),i.destinationFormat===void 0&&(i.destinationFormat=await n(`destination-format`,`Specifies the format of data to deliver.`,[`json`])),i.destinationPathBucket===void 0&&(i.destinationPathBucket=await t(`destination-path-bucket`,`Specifies the R2 Bucket to store files.`)),i.destinationType===void 0&&(i.destinationType=await n(`destination-type`,`Specifies the type of destination.`,[`r2`])),i.name===void 0&&(i.name=await t(`name`,`Defines the name of the pipeline.`));let g={};i.destinationBatchMaxBytes!==void 0&&c(g,[`destination`,`batch`,`max_bytes`],i.destinationBatchMaxBytes),i.destinationBatchMaxDurationS!==void 0&&c(g,[`destination`,`batch`,`max_duration_s`],i.destinationBatchMaxDurationS),i.destinationBatchMaxRows!==void 0&&c(g,[`destination`,`batch`,`max_rows`],i.destinationBatchMaxRows),i.destinationCompressionType!==void 0&&c(g,[`destination`,`compression`,`type`],o(i.destinationCompressionType,`destinationCompressionType`,`text`)),i.destinationCredentialsAccessKeyId!==void 0&&c(g,[`destination`,`credentials`,`access_key_id`],o(i.destinationCredentialsAccessKeyId,`destinationCredentialsAccessKeyId`,`text`)),i.destinationCredentialsEndpoint!==void 0&&c(g,[`destination`,`credentials`,`endpoint`],o(i.destinationCredentialsEndpoint,`destinationCredentialsEndpoint`,`text`)),i.destinationCredentialsSecretAccessKey!==void 0&&c(g,[`destination`,`credentials`,`secret_access_key`],o(i.destinationCredentialsSecretAccessKey,`destinationCredentialsSecretAccessKey`,`text`)),i.destinationFormat!==void 0&&c(g,[`destination`,`format`],o(i.destinationFormat,`destinationFormat`,`text`)),i.destinationPathBucket!==void 0&&c(g,[`destination`,`path`,`bucket`],o(i.destinationPathBucket,`destinationPathBucket`,`text`)),i.destinationPathFilepath!==void 0&&c(g,[`destination`,`path`,`filepath`],o(i.destinationPathFilepath,`destinationPathFilepath`,`text`)),i.destinationPathPrefix!==void 0&&c(g,[`destination`,`path`,`prefix`],o(i.destinationPathPrefix,`destinationPathPrefix`,`text`)),i.destinationType!==void 0&&c(g,[`destination`,`type`],o(i.destinationType,`destinationType`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),u(await p(`Updating pipeline`,async()=>m.put(`/accounts/${h}/pipelines/${i.pipelineName}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated pipeline`})}},P={command:`validate-sql`,describe:`Validate Arroyo SQL.`,builder:e=>e.option(`sql`,{type:`string`,description:`Specifies SQL to validate.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf pipelines validate-sql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pipelines/v1/validate_sql`,pathParams:{},bodyKind:`json`,body:{sql:n.sql,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating sql`,async()=>i.post(`/accounts/${m}/pipelines/v1/validate_sql`,{body:e})),{successLabel:`Created sql`});return}n.sql===void 0&&(n.sql=await t(`sql`,`Specifies SQL to validate.`));let h={};n.sql!==void 0&&c(h,[`sql`],o(n.sql,`sql`,`text`)),u(await p(`Creating sql`,async()=>i.post(`/accounts/${m}/pipelines/v1/validate_sql`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created sql`})}},F={command:`pipelines`,describe:`Ingest, transform, and route event streams into R2, analytics, or other destinations in real time`,builder:e=>e.command(h).command(m).command(_).command(g).command(y).command(v).command(x).command(b).command(N).command(P).command(E).command(M).demandCommand(1),handler:()=>{}};export{F as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{r as e,t}from"./session-Dxi_LbAk.mjs";import{g as n}from"./auth-BHD_B2p9.mjs";import{r}from"./theme-BKCxTQTe.mjs";const i=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`];function a(){return!(!r()||!process.stdout.isTTY||process.env.CF_QUIET===`1`)}async function o(r,o){if(!a())return o();t(e);let s=n({frames:[...i],indicator:`timer`,delay:80});s.start(r);try{let e=await o();return s.stop(r),e}catch(e){throw s.error(r),e}}export{o as t};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create <queueId>`,describe:`Creates a new consumer for a Queue`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dead-letter-queue`,{type:`string`,description:`The dead_letter_queue field`}).option(`script-name`,{type:`string`,description:`Name of a Worker`}).option(`settings-batch-size`,{type:`number`,description:`The maximum number of messages to include in a batch.`}).option(`settings-max-concurrency`,{type:`number`,description:"Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended)."}).option(`settings-max-retries`,{type:`number`,description:`The maximum number of retries`}).option(`settings-max-wait-time-ms`,{type:`number`,description:`The number of milliseconds to wait for a batch to fill up before attempting to deliver it`}).option(`settings-retry-delay`,{type:`number`,description:`The number of seconds to delay before making the message available for another attempt.`}).option(`settings-visibility-timeout-ms`,{type:`number`,description:`The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt.`}).option(`type`,{type:`string`,description:`The type field`,choices:[`worker`,`http_pull`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating or updating a consumer`}).conflicts(`script-name`,[`settings-visibility-timeout-ms`]).conflicts(`settings-max-concurrency`,[`settings-visibility-timeout-ms`]).conflicts(`settings-max-wait-time-ms`,[`settings-visibility-timeout-ms`]).conflicts(`settings-visibility-timeout-ms`,[`script-name`,`settings-max-concurrency`,`settings-max-wait-time-ms`]),handler:async i=>{if(s(i.queueId,`queueId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf queues consumers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/queues/${i.queueId??`<queueId>`}/consumers`,pathParams:{queueId:String(i.queueId??``)},bodyKind:`json`,body:{deadLetterQueue:i.deadLetterQueue,scriptName:i.scriptName,settingsBatchSize:i.settingsBatchSize,settingsMaxConcurrency:i.settingsMaxConcurrency,settingsMaxRetries:i.settingsMaxRetries,settingsMaxWaitTimeMs:i.settingsMaxWaitTimeMs,settingsRetryDelay:i.settingsRetryDelay,settingsVisibilityTimeoutMs:i.settingsVisibilityTimeoutMs,type:i.type,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating consumer`,async()=>m.post(`/accounts/${h}/queues/${i.queueId}/consumers`,{body:e})),{successLabel:`Created consumer`});return}i.type===void 0&&(i.type=await n(`type`,``,[`worker`,`http_pull`])),i.type===`worker`&&i.scriptName===void 0&&(i.scriptName=await t(`script-name`,`Name of a Worker`,{question:`Enter value for --script-name`}));let g={};i.deadLetterQueue!==void 0&&c(g,[`dead_letter_queue`],o(i.deadLetterQueue,`deadLetterQueue`,`text`)),i.scriptName!==void 0&&c(g,[`script_name`],o(i.scriptName,`scriptName`,`text`)),i.settingsBatchSize!==void 0&&c(g,[`settings`,`batch_size`],i.settingsBatchSize),i.settingsMaxConcurrency!==void 0&&c(g,[`settings`,`max_concurrency`],i.settingsMaxConcurrency),i.settingsMaxRetries!==void 0&&c(g,[`settings`,`max_retries`],i.settingsMaxRetries),i.settingsMaxWaitTimeMs!==void 0&&c(g,[`settings`,`max_wait_time_ms`],i.settingsMaxWaitTimeMs),i.settingsRetryDelay!==void 0&&c(g,[`settings`,`retry_delay`],i.settingsRetryDelay),i.settingsVisibilityTimeoutMs!==void 0&&c(g,[`settings`,`visibility_timeout_ms`],i.settingsVisibilityTimeoutMs),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),u(await p(`Creating consumer`,async()=>m.post(`/accounts/${h}/queues/${i.queueId}/consumers`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created consumer`})}},h={command:`delete <consumerId>`,describe:`Deletes the consumer for a queue.`,builder:e=>e.positional(`consumerId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`queue-id`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.consumerId,`consumerId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues consumers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/consumers/${t.consumerId??`<consumerId>`}`,pathParams:{consumerId:String(t.consumerId??``),queueId:String(t.queueId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`consumer`,String(t.consumerId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting consumer`,async()=>n.queues.consumers.delete(t.consumerId,t.queueId,o)),{successLabel:`Deleted consumer`})}},g={command:`get <consumerId>`,describe:`Fetches the consumer for a queue by consumer id`,builder:e=>e.positional(`consumerId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`queue-id`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}),handler:async e=>{s(e.consumerId,`consumerId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading consumer`,async()=>t.queues.consumers.get(e.consumerId,e.queueId,n)),{successLabel:`Loaded consumer`})}},_={command:`list`,describe:`Returns the consumers for a Queue`,builder:e=>e.option(`queue-id`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}),handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading consumers`,async()=>t.queues.consumers.list(e.queueId,n)),{successLabel:`Loaded consumers`})}},v={command:`update <consumerId>`,describe:`Updates the consumer for a queue, or creates one if it does not exist.`,builder:e=>e.positional(`consumerId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`queue-id`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dead-letter-queue`,{type:`string`,description:`The dead_letter_queue field`}).option(`script-name`,{type:`string`,description:`Name of a Worker`}).option(`settings-batch-size`,{type:`number`,description:`The maximum number of messages to include in a batch.`}).option(`settings-max-concurrency`,{type:`number`,description:"Maximum number of concurrent consumers that may consume from this Queue. Set to `null` to automatically opt in to the platform's maximum (recommended)."}).option(`settings-max-retries`,{type:`number`,description:`The maximum number of retries`}).option(`settings-max-wait-time-ms`,{type:`number`,description:`The number of milliseconds to wait for a batch to fill up before attempting to deliver it`}).option(`settings-retry-delay`,{type:`number`,description:`The number of seconds to delay before making the message available for another attempt.`}).option(`settings-visibility-timeout-ms`,{type:`number`,description:`The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt.`}).option(`type`,{type:`string`,description:`The type field`,choices:[`worker`,`http_pull`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating or updating a consumer`}).conflicts(`script-name`,[`settings-visibility-timeout-ms`]).conflicts(`settings-max-concurrency`,[`settings-visibility-timeout-ms`]).conflicts(`settings-max-wait-time-ms`,[`settings-visibility-timeout-ms`]).conflicts(`settings-visibility-timeout-ms`,[`script-name`,`settings-max-concurrency`,`settings-max-wait-time-ms`]),handler:async i=>{if(s(i.consumerId,`consumerId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf queues consumers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/queues/${i.queueId??`<queueId>`}/consumers/${i.consumerId??`<consumerId>`}`,pathParams:{consumerId:String(i.consumerId??``),queueId:String(i.queueId??``)},bodyKind:`json`,body:{deadLetterQueue:i.deadLetterQueue,scriptName:i.scriptName,settingsBatchSize:i.settingsBatchSize,settingsMaxConcurrency:i.settingsMaxConcurrency,settingsMaxRetries:i.settingsMaxRetries,settingsMaxWaitTimeMs:i.settingsMaxWaitTimeMs,settingsRetryDelay:i.settingsRetryDelay,settingsVisibilityTimeoutMs:i.settingsVisibilityTimeoutMs,type:i.type,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating consumer`,async()=>m.put(`/accounts/${h}/queues/${i.queueId}/consumers/${i.consumerId}`,{body:e})),{successLabel:`Updated consumer`});return}i.type===void 0&&(i.type=await n(`type`,``,[`worker`,`http_pull`])),i.type===`worker`&&i.scriptName===void 0&&(i.scriptName=await t(`script-name`,`Name of a Worker`,{question:`Enter value for --script-name`}));let g={};i.deadLetterQueue!==void 0&&c(g,[`dead_letter_queue`],o(i.deadLetterQueue,`deadLetterQueue`,`text`)),i.scriptName!==void 0&&c(g,[`script_name`],o(i.scriptName,`scriptName`,`text`)),i.settingsBatchSize!==void 0&&c(g,[`settings`,`batch_size`],i.settingsBatchSize),i.settingsMaxConcurrency!==void 0&&c(g,[`settings`,`max_concurrency`],i.settingsMaxConcurrency),i.settingsMaxRetries!==void 0&&c(g,[`settings`,`max_retries`],i.settingsMaxRetries),i.settingsMaxWaitTimeMs!==void 0&&c(g,[`settings`,`max_wait_time_ms`],i.settingsMaxWaitTimeMs),i.settingsRetryDelay!==void 0&&c(g,[`settings`,`retry_delay`],i.settingsRetryDelay),i.settingsVisibilityTimeoutMs!==void 0&&c(g,[`settings`,`visibility_timeout_ms`],i.settingsVisibilityTimeoutMs),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),u(await p(`Updating consumer`,async()=>m.put(`/accounts/${h}/queues/${i.queueId}/consumers/${i.consumerId}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated consumer`})}},y={command:`consumers`,describe:`Workers that automatically receive and process messages from a queue`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).demandCommand(1),handler:()=>{}},b={command:`create`,describe:`Create a new queue`,builder:e=>e.option(`queue-name`,{type:`string`,description:`The queue_name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf queues create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/queues`,pathParams:{},bodyKind:`json`,body:{queueName:n.queueName,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating queue`,async()=>i.post(`/accounts/${m}/queues`,{body:e})),{successLabel:`Created queue`});return}n.queueName===void 0&&(n.queueName=await t(`queue-name`,``));let h={};n.queueName!==void 0&&c(h,[`queue_name`],o(n.queueName,`queueName`,`text`)),u(await p(`Creating queue`,async()=>i.post(`/accounts/${m}/queues`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created queue`})}},x={command:`delete <queueId>`,describe:`Deletes a queue`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`queue`,String(t.queueId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting queue`,async()=>n.queues.delete(t.queueId,o)),{successLabel:`Deleted queue`})}},S={command:`edit <queueId>`,describe:`Updates a Queue.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`queue-name`,{type:`string`,description:`The queue_name field`}).option(`settings-delivery-delay`,{type:`number`,description:`Number of seconds to delay delivery of all messages to consumers.`}).option(`settings-delivery-paused`,{type:`boolean`,description:`Indicates if message delivery to consumers is currently paused.`}).option(`settings-message-retention-period`,{type:`number`,description:`Number of seconds after which an unconsumed message will be delayed.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{queueName:t.queueName,settingsDeliveryDelay:t.settingsDeliveryDelay,settingsDeliveryPaused:t.settingsDeliveryPaused,settingsMessageRetentionPeriod:t.settingsMessageRetentionPeriod,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating queue`,async()=>n.patch(`/accounts/${i}/queues/${t.queueId}`,{body:e})),{successLabel:`Updated queue`});return}let m={};t.queueName!==void 0&&c(m,[`queue_name`],o(t.queueName,`queueName`,`text`)),t.settingsDeliveryDelay!==void 0&&c(m,[`settings`,`delivery_delay`],t.settingsDeliveryDelay),t.settingsDeliveryPaused!==void 0&&c(m,[`settings`,`delivery_paused`],t.settingsDeliveryPaused),t.settingsMessageRetentionPeriod!==void 0&&c(m,[`settings`,`message_retention_period`],t.settingsMessageRetentionPeriod),u(await p(`Updating queue`,async()=>n.patch(`/accounts/${i}/queues/${t.queueId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated queue`})}},C={command:`get <queueId>`,describe:`Get details about a specific queue.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}),handler:async e=>{s(e.queueId,`queueId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading queue`,async()=>t.queues.get(e.queueId,n)),{successLabel:`Loaded queue`})}},w={command:`list`,describe:`Returns the queues owned by an account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading queues`,async()=>t.queues.list(n)),{successLabel:`Loaded queues`})}},T={command:`ack-preview <queueId>`,describe:`Delete previewed messages from a Queue. Note that messages acknowledged this way aren't considered delivered, they are instantly deleted from this queue and do not affect metrics.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages ack-preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages/preview/ack`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/preview/ack`,{body:e})),{successLabel:`Created message`});return}u(await p(`Creating message`,async()=>n.queues.messages.ackPreview(t.queueId,i)),{successLabel:`Created message`})}},E={command:`ack <queueId>`,describe:`Acknowledge + Retry messages from a Queue`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages ack`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages/ack`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/ack`,{body:e})),{successLabel:`Created message`});return}u(await p(`Creating message`,async()=>n.queues.messages.ack(t.queueId,i)),{successLabel:`Created message`})}},D={command:`bulk-push`,describe:`Push a batch of message to a Queue`,builder:e=>e.option(`queue-id`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`delay-seconds`,{type:`number`,description:`The number of seconds to wait for attempting to deliver this batch to consumers`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages bulk-push`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages/batch`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{delaySeconds:t.delaySeconds,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating messages`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/batch`,{body:e})),{successLabel:`Created messages`});return}let o={};t.delaySeconds!==void 0&&c(o,[`delay_seconds`],t.delaySeconds),u(await p(`Creating messages`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/batch`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created messages`})}},O={command:`preview <queueId>`,describe:`Preview messages from a Queue without leasing them. Messages remain available for subsequent preview or pull operations.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`batch-size`,{type:`number`,description:`The maximum number of messages to include in a batch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages/preview`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{batchSize:t.batchSize,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Loading message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/preview`,{body:e})),{successLabel:`Loaded message`});return}let o={};t.batchSize!==void 0&&c(o,[`batch_size`],t.batchSize),u(await p(`Loading message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/preview`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Loaded message`})}},k={command:`pull <queueId>`,describe:`Pull a batch of messages from a Queue`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`batch-size`,{type:`number`,description:`The maximum number of messages to include in a batch.`}).option(`visibility-timeout-ms`,{type:`number`,description:`The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages pull`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages/pull`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{batchSize:t.batchSize,visibilityTimeoutMs:t.visibilityTimeoutMs,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/pull`,{body:e})),{successLabel:`Created message`});return}let o={};t.batchSize!==void 0&&c(o,[`batch_size`],t.batchSize),t.visibilityTimeoutMs!==void 0&&c(o,[`visibility_timeout_ms`],t.visibilityTimeoutMs),u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages/pull`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created message`})}},A={command:`push <queueId>`,describe:`Push a message to a Queue`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`delay-seconds`,{type:`number`,description:`The number of seconds to wait for attempting to deliver this message to consumers`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues messages push`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/messages`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{delaySeconds:t.delaySeconds,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages`,{body:e})),{successLabel:`Created message`});return}let o={};t.delaySeconds!==void 0&&c(o,[`delay_seconds`],t.delaySeconds),u(await p(`Creating message`,async()=>n.post(`/accounts/${i}/queues/${t.queueId}/messages`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created message`})}},j={command:`messages`,describe:`Push messages to a queue and pull or acknowledge them from consumers`,builder:e=>e.command(E).command(T).command(D).command(O).command(k).command(A).demandCommand(1),handler:()=>{}},M={command:`start <queueId>`,describe:`Deletes all messages from the Queue.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`delete-messages-permanently`,{type:`boolean`,description:`Confimation that all messages will be deleted permanently.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues purge start`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}/purge`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{deleteMessagesPermanently:t.deleteMessagesPermanently,body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`queue`,String(t.queueId??``),{force:!!t.force,message:`This operation drops every message in the queue.`})){process.stderr.write(`Aborted.
5
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting queue`,async()=>n.post(`/accounts/${o}/queues/${t.queueId}/purge`,{body:e})),{successLabel:`Deleted queue`});return}let m={};t.deleteMessagesPermanently!==void 0&&c(m,[`delete_messages_permanently`],t.deleteMessagesPermanently),u(await p(`Deleting queue`,async()=>n.post(`/accounts/${o}/queues/${t.queueId}/purge`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted queue`})}},N={command:`status <queueId>`,describe:`Get details about a Queue's purge status.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}),handler:async e=>{s(e.queueId,`queueId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading queue`,async()=>t.queues.purge.status(e.queueId,n)),{successLabel:`Loaded queue`})}},P={command:`purge`,describe:`Remove all pending messages from a queue`,builder:e=>e.command(M).command(N).demandCommand(1),handler:()=>{}},F={command:`create`,describe:`Create a new event subscription for a queue`,builder:e=>e.option(`destination-queue-id`,{type:`string`,description:`ID of the target queue`}).option(`destination-type`,{type:`string`,description:`Type of destination`,choices:[`queues.queue`]}).option(`enabled`,{type:`boolean`,description:`Whether the subscription is active`}).option(`events`,{type:`string`,array:!0,description:`List of event types this subscription handles`}).option(`name`,{type:`string`,description:`Name of the subscription`}).option(`source-type`,{type:`string`,description:`Type of source`,choices:[`images`,`kv`,`r2`,`superSlurper`,`vectorize`,`workersAi.model`,`workersBuilds.worker`,`workflows.workflow`]}).option(`source-model-name`,{type:`string`,description:`Name of the Workers AI model`}).option(`source-worker-name`,{type:`string`,description:`Name of the worker`}).option(`source-workflow-name`,{type:`string`,description:`Name of the workflow`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`source-model-name`,[`source-worker-name`,`source-workflow-name`]).conflicts(`source-worker-name`,[`source-model-name`,`source-workflow-name`]).conflicts(`source-workflow-name`,[`source-model-name`,`source-worker-name`]).check(e=>{if([`destination-queue-id`,`destination-type`].some(t=>e[t]!==void 0)){let t=[`destination-queue-id`,`destination-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --destination-* flag is set`)}return!0}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues subscriptions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/event_subscriptions/subscriptions`,pathParams:{},bodyKind:`json`,body:{destinationQueueId:t.destinationQueueId,destinationType:t.destinationType,enabled:t.enabled,events:t.events,name:t.name,sourceType:t.sourceType,sourceModelName:t.sourceModelName,sourceWorkerName:t.sourceWorkerName,sourceWorkflowName:t.sourceWorkflowName,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating subscription`,async()=>n.post(`/accounts/${i}/event_subscriptions/subscriptions`,{body:e})),{successLabel:`Created subscription`});return}let m={};t.destinationQueueId!==void 0&&c(m,[`destination`,`queue_id`],o(t.destinationQueueId,`destinationQueueId`,`text`)),t.destinationType!==void 0&&c(m,[`destination`,`type`],o(t.destinationType,`destinationType`,`text`)),t.enabled!==void 0&&c(m,[`enabled`],t.enabled),t.events!==void 0&&c(m,[`events`],t.events),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.sourceType!==void 0&&c(m,[`source`,`type`],o(t.sourceType,`sourceType`,`text`)),t.sourceModelName!==void 0&&c(m,[`source`,`model_name`],o(t.sourceModelName,`sourceModelName`,`text`)),t.sourceWorkerName!==void 0&&c(m,[`source`,`worker_name`],o(t.sourceWorkerName,`sourceWorkerName`,`text`)),t.sourceWorkflowName!==void 0&&c(m,[`source`,`workflow_name`],o(t.sourceWorkflowName,`sourceWorkflowName`,`text`)),u(await p(`Creating subscription`,async()=>n.post(`/accounts/${i}/event_subscriptions/subscriptions`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created subscription`})}},I={command:`delete <subscriptionId>`,describe:`Delete an existing event subscription`,builder:e=>e.positional(`subscriptionId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.subscriptionId,`subscriptionId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues subscriptions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/event_subscriptions/subscriptions/${t.subscriptionId??`<subscriptionId>`}`,pathParams:{subscriptionId:String(t.subscriptionId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`subscription`,String(t.subscriptionId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting subscription`,async()=>n.queues.subscriptions.delete(o,t.subscriptionId)),{successLabel:`Deleted subscription`})}},L={command:`get <subscriptionId>`,describe:`Get details about an existing event subscription`,builder:e=>e.positional(`subscriptionId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}),handler:async e=>{s(e.subscriptionId,`subscriptionId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading subscription`,async()=>t.queues.subscriptions.get(n,e.subscriptionId)),{successLabel:`Loaded subscription`})}},R={command:`list`,describe:`Get a paginated list of event subscriptions with optional sorting and filtering`,builder:e=>e.option(`page`,{type:`number`,description:`Page number for pagination`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`order`,{type:`string`,description:`Field to sort by`,choices:[`created_at`,`name`,`enabled`,`source`]}).option(`direction`,{type:`string`,description:`Sort direction`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading subscriptions`,async()=>n.queues.subscriptions.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded subscriptions`})}},z={command:`update <subscriptionId>`,describe:`Update an existing event subscription`,builder:e=>e.positional(`subscriptionId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`destination-queue-id`,{type:`string`,description:`ID of the target queue`}).option(`destination-type`,{type:`string`,description:`Type of destination`,choices:[`queues.queue`]}).option(`enabled`,{type:`boolean`,description:`Whether the subscription is active`}).option(`events`,{type:`string`,array:!0,description:`List of event types this subscription handles`}).option(`name`,{type:`string`,description:`Name of the subscription`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`destination-queue-id`,`destination-type`].some(t=>e[t]!==void 0)){let t=[`destination-queue-id`,`destination-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --destination-* flag is set`)}return!0}),handler:async t=>{if(s(t.subscriptionId,`subscriptionId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues subscriptions update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/event_subscriptions/subscriptions/${t.subscriptionId??`<subscriptionId>`}`,pathParams:{subscriptionId:String(t.subscriptionId??``)},bodyKind:`json`,body:{destinationQueueId:t.destinationQueueId,destinationType:t.destinationType,enabled:t.enabled,events:t.events,name:t.name,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating subscription`,async()=>n.patch(`/accounts/${i}/event_subscriptions/subscriptions/${t.subscriptionId}`,{body:e})),{successLabel:`Updated subscription`});return}let m={};t.destinationQueueId!==void 0&&c(m,[`destination`,`queue_id`],o(t.destinationQueueId,`destinationQueueId`,`text`)),t.destinationType!==void 0&&c(m,[`destination`,`type`],o(t.destinationType,`destinationType`,`text`)),t.enabled!==void 0&&c(m,[`enabled`],t.enabled),t.events!==void 0&&c(m,[`events`],t.events),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),u(await p(`Updating subscription`,async()=>n.patch(`/accounts/${i}/event_subscriptions/subscriptions/${t.subscriptionId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated subscription`})}},B={command:`subscriptions`,describe:`Manage queue subscriptions for event-driven message routing`,builder:e=>e.command(F).command(I).command(L).command(R).command(z).demandCommand(1),handler:()=>{}},V={command:`update <queueId>`,describe:`Updates a Queue. Note that this endpoint does not support partial updates. If successful, the Queue's configuration is overwritten with the supplied configuration.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`A Resource identifier.`,demandOption:!0}).option(`queue-name`,{type:`string`,description:`The queue_name field`}).option(`settings-delivery-delay`,{type:`number`,description:`Number of seconds to delay delivery of all messages to consumers.`}).option(`settings-delivery-paused`,{type:`boolean`,description:`Indicates if message delivery to consumers is currently paused.`}).option(`settings-message-retention-period`,{type:`number`,description:`Number of seconds after which an unconsumed message will be delayed.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.queueId,`queueId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf queues update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/queues/${t.queueId??`<queueId>`}`,pathParams:{queueId:String(t.queueId??``)},bodyKind:`json`,body:{queueName:t.queueName,settingsDeliveryDelay:t.settingsDeliveryDelay,settingsDeliveryPaused:t.settingsDeliveryPaused,settingsMessageRetentionPeriod:t.settingsMessageRetentionPeriod,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating queue`,async()=>n.put(`/accounts/${i}/queues/${t.queueId}`,{body:e})),{successLabel:`Updated queue`});return}let m={};t.queueName!==void 0&&c(m,[`queue_name`],o(t.queueName,`queueName`,`text`)),t.settingsDeliveryDelay!==void 0&&c(m,[`settings`,`delivery_delay`],t.settingsDeliveryDelay),t.settingsDeliveryPaused!==void 0&&c(m,[`settings`,`delivery_paused`],t.settingsDeliveryPaused),t.settingsMessageRetentionPeriod!==void 0&&c(m,[`settings`,`message_retention_period`],t.settingsMessageRetentionPeriod),u(await p(`Updating queue`,async()=>n.put(`/accounts/${i}/queues/${t.queueId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated queue`})}},H={command:`queues`,describe:`Reliable message queuing between Workers — produce, consume, and batch-process messages at scale`,builder:e=>e.command(b).command(x).command(S).command(C).command(w).command(V).command(y).command(j).command(P).command(B).demandCommand(1),handler:()=>{}};export{H as default};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`delete <bucketName>`,describe:`Delete the CORS policy for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets cors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/cors`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`cor`,String(t.bucketName??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting cor`,async()=>o.delete(`/accounts/${c}/r2/buckets/${t.bucketName}/cors`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted cor`})}},h={command:`get <bucketName>`,describe:`Get the CORS policy for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.bucketName,`bucketName`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading cor`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/cors`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded cor`})}},g={command:`update <bucketName>`,describe:`Set the CORS policy for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets cors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/cors`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);if(t.accountId=o,t.body){let e=l(t.body);u(await p(`Updating cor`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/cors`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated cor`});return}u(await p(`Updating cor`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/cors`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated cor`})}},ee={command:`cors`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(m).command(h).command(g).demandCommand(1),handler:()=>{}},_={command:`create`,describe:`Creates a new R2 bucket.`,builder:e=>e.option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`location-hint`,{type:`string`,description:`Location of the bucket.`,choices:[`apac`,`eeur`,`enam`,`weur`,`wnam`,`oc`]}).option(`name`,{type:`string`,description:`Name of the bucket.`}).option(`storage-class`,{type:`string`,description:`Storage class for newly uploaded objects, unless specified otherwise.`,choices:[`Standard`,`InfrequentAccess`],default:`Standard`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let i={};if(n.cfR2Jurisdiction!==void 0&&(i[`cf-r2-jurisdiction`]=String(n.cfR2Jurisdiction)),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 buckets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/r2/buckets`,pathParams:{},bodyKind:`json`,body:{locationHint:n.locationHint,name:n.name,storageClass:n.storageClass,body:n.body},validation:`passed`});return}let m=await a(n),h=n.local?f:await r(m);if(n.accountId=h,n.body){let e=l(n.body);u(await p(`Creating bucket`,async()=>m.post(`/accounts/${h}/r2/buckets`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created bucket`});return}n.name===void 0&&(n.name=await t(`name`,`Name of the bucket.`));let g={};n.locationHint!==void 0&&c(g,[`locationHint`],o(n.locationHint,`locationHint`,`text`)),n.name!==void 0&&c(g,[`name`],o(n.name,`name`,`text`)),n.storageClass!==void 0&&c(g,[`storageClass`],o(n.storageClass,`storageClass`,`text`)),u(await p(`Creating bucket`,async()=>m.post(`/accounts/${h}/r2/buckets`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created bucket`})}},v={command:`delete <bucketName>`,describe:`Deletes an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`bucket`,String(t.bucketName??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting bucket`,async()=>o.delete(`/accounts/${c}/r2/buckets/${t.bucketName}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted bucket`})}},y={command:`create <bucketName>`,describe:`Register a new custom domain for an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`domain`,{type:`string`,description:`Name of the custom domain to be added.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable public bucket access at the custom domain. If undefined, the domain will be enabled.`}).option(`min-tls`,{type:`string`,description:`Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to 1.0.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{s(n.bucketName,`bucketName`);let i={};if(n.cfR2Jurisdiction!==void 0&&(i[`cf-r2-jurisdiction`]=String(n.cfR2Jurisdiction)),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 buckets domains custom create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/r2/buckets/${n.bucketName??`<bucketName>`}/domains/custom`,pathParams:{bucketName:String(n.bucketName??``)},bodyKind:`json`,body:{ciphers:n.ciphers,domain:n.domain,enabled:n.enabled,minTls:n.minTls,body:n.body},validation:`passed`});return}let m=await a(n),h=n.local?f:await r(m);if(n.accountId=h,n.body){let e=l(n.body);u(await p(`Creating custom`,async()=>m.post(`/accounts/${h}/r2/buckets/${n.bucketName}/domains/custom`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created custom`});return}if(n.domain===void 0&&(n.domain=await t(`domain`,`Name of the custom domain to be added.`)),n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let g={};n.ciphers!==void 0&&c(g,[`ciphers`],n.ciphers),n.domain!==void 0&&c(g,[`domain`],o(n.domain,`domain`,`text`)),n.enabled!==void 0&&c(g,[`enabled`],n.enabled),n.minTls!==void 0&&c(g,[`minTLS`],o(n.minTls,`minTls`,`text`)),u(await p(`Creating custom`,async()=>m.post(`/accounts/${h}/r2/buckets/${n.bucketName}/domains/custom`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created custom`})}},b={command:`delete <domain>`,describe:`Remove custom domain registration from an existing R2 bucket.`,builder:e=>e.positional(`domain`,{type:`string`,description:`Name of the custom domain.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{s(t.domain,`domain`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets domains custom delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/domains/custom/${t.domain??`<domain>`}`,pathParams:{bucketName:String(t.bucketName??``),domain:String(t.domain??``)},bodyKind:`none`,validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`custom`,String(t.domain??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting custom`,async()=>o.delete(`/accounts/${c}/r2/buckets/${t.bucketName}/domains/custom/${t.domain}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted custom`})}},x={command:`get <domain>`,describe:`Get the configuration for a custom domain on an existing R2 bucket.`,builder:e=>e.positional(`domain`,{type:`string`,description:`Name of the custom domain.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.domain,`domain`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading custom`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/domains/custom/${e.domain}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded custom`})}},S={command:`list`,describe:`Gets a list of all custom domains registered with an existing R2 bucket.`,builder:e=>e.option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading custom`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/domains/custom`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded custom`})}},C={command:`update <domain>`,describe:`Edit the configuration for a custom domain on an existing R2 bucket.`,builder:e=>e.positional(`domain`,{type:`string`,description:`Name of the custom domain.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable public bucket access at the specified custom domain.`}).option(`min-tls`,{type:`string`,description:`Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to previous value.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.domain,`domain`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets domains custom update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/domains/custom/${t.domain??`<domain>`}`,pathParams:{bucketName:String(t.bucketName??``),domain:String(t.domain??``)},bodyKind:`json`,body:{ciphers:t.ciphers,enabled:t.enabled,minTls:t.minTls,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating custom`,async()=>i.put(`/accounts/${m}/r2/buckets/${t.bucketName}/domains/custom/${t.domain}`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated custom`});return}let h={};t.ciphers!==void 0&&c(h,[`ciphers`],t.ciphers),t.enabled!==void 0&&c(h,[`enabled`],t.enabled),t.minTls!==void 0&&c(h,[`minTLS`],o(t.minTls,`minTls`,`text`)),u(await p(`Updating custom`,async()=>i.put(`/accounts/${m}/r2/buckets/${t.bucketName}/domains/custom/${t.domain}`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated custom`})}},w={command:`custom`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(y).command(b).command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`list`,describe:`Gets state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:e=>e.option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading managed`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/domains/managed`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded managed`})}},E={command:`update <bucketName>`,describe:`Updates state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable public bucket access at the r2.dev domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets domains managed update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/domains/managed`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{enabled:t.enabled,body:t.body},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);if(t.accountId=o,t.body){let e=l(t.body);u(await p(`Updating managed`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/domains/managed`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated managed`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let m={};t.enabled!==void 0&&c(m,[`enabled`],t.enabled),u(await p(`Updating managed`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/domains/managed`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated managed`})}},D={command:`managed`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`domains`,describe:`Operations for buckets.domains`,builder:e=>e.command(w).command(D).demandCommand(1),handler:()=>{}},k={command:`edit <bucketName>`,describe:`Updates properties of an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`cf-r2-storage-class`,{type:`string`,description:`The cf-r2-storage-class header`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.cfR2StorageClass!==void 0&&(n[`cf-r2-storage-class`]=String(t.cfR2StorageClass)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);t.accountId=o,u(await p(`Updating bucket`,async()=>i.patch(`/accounts/${o}/r2/buckets/${t.bucketName}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated bucket`})}},A={command:`delete <queueId>`,describe:`Delete an event notification rule. **If no body is provided, all rules for specified queue will be deleted**.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`Queue ID.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`rule-ids`,{type:`string`,array:!0,description:`Array of rule ids 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:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.queueId,`queueId`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets event-notifications delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/event_notifications/r2/${t.bucketName??`<bucketName>`}/configuration/queues/${t.queueId??`<queueId>`}`,pathParams:{queueId:String(t.queueId??``),bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{ruleIds:t.ruleIds,body:t.body},validation:`passed`});return}let o=await a(t),m=t.local?f:await r(o);if(t.accountId=m,!await i(`event notification`,String(t.queueId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting event notification`,async()=>o.delete(`/accounts/${m}/event_notifications/r2/${t.bucketName}/configuration/queues/${t.queueId}`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted event notification`});return}let h={};t.ruleIds!==void 0&&c(h,[`ruleIds`],t.ruleIds),u(await p(`Deleting event notification`,async()=>o.delete(`/accounts/${m}/event_notifications/r2/${t.bucketName}/configuration/queues/${t.queueId}`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted event notification`})}},j={command:`get <queueId>`,describe:`Get a single event notification rule.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`Queue ID.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`The bucket jurisdiction.`}),handler:async e=>{s(e.queueId,`queueId`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading event notification`,async()=>n.get(`/accounts/${i}/event_notifications/r2/${e.bucketName}/configuration/queues/${e.queueId}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded event notification`})}},M={command:`list`,describe:`List all event notification rules for a bucket.`,builder:e=>e.option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading event notifications`,async()=>n.get(`/accounts/${i}/event_notifications/r2/${e.bucketName}/configuration`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded event notifications`})}},N={command:`update <queueId>`,describe:`Create event notification rule.`,builder:e=>e.positional(`queueId`,{type:`string`,description:`Queue ID.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.queueId,`queueId`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets event-notifications update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/event_notifications/r2/${t.bucketName??`<bucketName>`}/configuration/queues/${t.queueId??`<queueId>`}`,pathParams:{queueId:String(t.queueId??``),bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);if(t.accountId=o,t.body){let e=l(t.body);u(await p(`Updating event notification`,async()=>i.put(`/accounts/${o}/event_notifications/r2/${t.bucketName}/configuration/queues/${t.queueId}`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated event notification`});return}u(await p(`Updating event notification`,async()=>i.put(`/accounts/${o}/event_notifications/r2/${t.bucketName}/configuration/queues/${t.queueId}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated event notification`})}},P={command:`event-notifications`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(A).command(j).command(M).command(N).demandCommand(1),handler:()=>{}},F={command:`get <bucketName>`,describe:`Gets properties of an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.bucketName,`bucketName`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading bucket`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded bucket`})}},I={command:`get <bucketName>`,describe:`Get object lifecycle rules for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.bucketName,`bucketName`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading lifecycle`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/lifecycle`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded lifecycle`})}},L={command:`update <bucketName>`,describe:`Set the object lifecycle rules for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets lifecycle update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/lifecycle`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);if(t.accountId=o,t.body){let e=l(t.body);u(await p(`Updating lifecycle`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/lifecycle`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated lifecycle`});return}u(await p(`Updating lifecycle`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/lifecycle`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated lifecycle`})}},R={command:`lifecycle`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(I).command(L).demandCommand(1),handler:()=>{}},z={command:`list`,describe:`Lists all R2 buckets on your account.`,builder:e=>e.option(`name-contains`,{type:`string`,description:`Bucket names to filter by. Only buckets with this phrase in their name will be returned.`}).option(`start-after`,{type:`string`,description:`Bucket name to start searching after. Buckets are ordered lexicographically.`}).option(`per-page`,{type:`number`,description:`Maximum number of buckets to return in a single call.`}).option(`order`,{type:`string`,description:`Field to order buckets by.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`Direction to order buckets.`,choices:[`asc`,`desc`]}).option(`cursor`,{type:`string`,description:`Pagination cursor received during the last List Buckets call. R2 buckets are paginated using cursors instead of page numbers.`}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{let t={};e.nameContains!==void 0&&(t.name_contains=e.nameContains),e.startAfter!==void 0&&(t.start_after=e.startAfter),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.cursor!==void 0&&(t.cursor=e.cursor);let n={};e.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let i=await a(e),o=e.local?f:await r(i);e.accountId=o,u(await p(`Loading buckets`,async()=>i.get(`/accounts/${o}/r2/buckets`,{query:Object.keys(t).length>0?t:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded buckets`})}},B={command:`get <bucketName>`,describe:`Get the local uploads configuration for a bucket. When enabled, object's data is written to the nearest region first, then asynchronously replicated to the bucket's primary region.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}),handler:async e=>{s(e.bucketName,`bucketName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading local upload`,async()=>t.r2.buckets.localUploads.get(e.bucketName,n)),{successLabel:`Loaded local upload`})}},te={command:`update <bucketName>`,describe:`Set the local uploads configuration for a bucket. When enabled, object's data is written to the nearest region first, then asynchronously replicated to the bucket's primary region.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Whether to enable local uploads for this bucket.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.bucketName,`bucketName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets local-uploads update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/local-uploads`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{enabled:t.enabled,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating local upload`,async()=>n.put(`/accounts/${i}/r2/buckets/${t.bucketName}/local-uploads`,{body:e})),{successLabel:`Updated local upload`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let o={};t.enabled!==void 0&&c(o,[`enabled`],t.enabled),u(await p(`Updating local upload`,async()=>n.put(`/accounts/${i}/r2/buckets/${t.bucketName}/local-uploads`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated local upload`})}},V={command:`local-uploads`,describe:`R2 bucket local upload configuration`,builder:e=>e.command(B).command(te).demandCommand(1),handler:()=>{}},H={command:`get <bucketName>`,describe:`Get lock rules for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.bucketName,`bucketName`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading lock`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/lock`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded lock`})}},U={command:`update <bucketName>`,describe:`Set lock rules for a bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets locks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/lock`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);if(t.accountId=o,t.body){let e=l(t.body);u(await p(`Updating lock`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/lock`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated lock`});return}u(await p(`Updating lock`,async()=>i.put(`/accounts/${o}/r2/buckets/${t.bucketName}/lock`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated lock`})}},W={command:`locks`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(H).command(U).demandCommand(1),handler:()=>{}},G={command:`list`,describe:`Get Storage/Object Count Metrics across all buckets in your account. Note that Account-Level Metrics may not immediately reflect the latest data.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading metrics`,async()=>t.r2.buckets.metrics.list(n)),{successLabel:`Loaded metrics`})}},K={command:`metrics`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(G).demandCommand(1),handler:()=>{}},q={command:`delete <bucketName>`,describe:`Disables Sippy on this bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets sippy delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/sippy`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`sippy`,String(t.bucketName??``),{force:!!t.force})){process.stderr.write(`Aborted.
7
- `);return}u(await p(`Deleting sippy`,async()=>o.delete(`/accounts/${c}/r2/buckets/${t.bucketName}/sippy`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted sippy`})}},J={command:`get <bucketName>`,describe:`Gets configuration for Sippy for an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}),handler:async e=>{s(e.bucketName,`bucketName`);let t={};e.cfR2Jurisdiction!==void 0&&(t[`cf-r2-jurisdiction`]=String(e.cfR2Jurisdiction));let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading sippy`,async()=>n.get(`/accounts/${i}/r2/buckets/${e.bucketName}/sippy`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded sippy`})}},Y={command:`update <bucketName>`,describe:`Sets configuration for Sippy for an existing R2 bucket.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`cf-r2-jurisdiction`,{type:`string`,description:`Jurisdiction where objects in this bucket are guaranteed to be stored.`}).option(`destination-access-key-id`,{type:`string`,description:`ID of a Cloudflare API token. This is the value labelled "Access Key ID" when creating an API. token from the [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). Sippy will use this token when writing objects to R2, so it is best to scope this token to the bucket you're enabling Sippy for. `}).option(`destination-provider`,{type:`string`,description:`The destination.provider field`,choices:[`r2`]}).option(`destination-secret-access-key`,{type:`string`,description:`Value of a Cloudflare API token. This is the value labelled "Secret Access Key" when creating an API. token from the [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens). Sippy will use this token when writing objects to R2, so it is best to scope this token to the bucket you're enabling Sippy for. `}).option(`source-access-key-id`,{type:`string`,description:`Access Key ID of an IAM credential (ideally scoped to a single S3 bucket).`}).option(`source-bucket`,{type:`string`,description:`Name of the AWS S3 bucket.`}).option(`source-provider`,{type:`string`,description:`The source.provider field`,choices:[`aws`,`gcs`,`s3`]}).option(`source-region`,{type:`string`,description:`Name of the AWS availability zone.`}).option(`source-secret-access-key`,{type:`string`,description:`Secret Access Key of an IAM credential (ideally scoped to a single S3 bucket).`}).option(`source-client-email`,{type:`string`,description:`Client email of an IAM credential (ideally scoped to a single GCS bucket).`}).option(`source-private-key`,{type:`string`,description:`Private Key of an IAM credential (ideally scoped to a single GCS bucket).`}).option(`source-bucket-url`,{type:`string`,description:`URL to the S3-compatible API of the bucket.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`source-bucket`,[`source-bucket-url`]).conflicts(`source-region`,[`source-client-email`,`source-private-key`,`source-bucket-url`]).conflicts(`source-client-email`,[`source-region`,`source-bucket-url`]).conflicts(`source-private-key`,[`source-region`,`source-bucket-url`]).conflicts(`source-bucket-url`,[`source-bucket`,`source-region`,`source-client-email`,`source-private-key`]),handler:async t=>{s(t.bucketName,`bucketName`);let n={};if(t.cfR2Jurisdiction!==void 0&&(n[`cf-r2-jurisdiction`]=String(t.cfR2Jurisdiction)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 buckets sippy update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2/buckets/${t.bucketName??`<bucketName>`}/sippy`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{destinationAccessKeyId:t.destinationAccessKeyId,destinationProvider:t.destinationProvider,destinationSecretAccessKey:t.destinationSecretAccessKey,sourceAccessKeyId:t.sourceAccessKeyId,sourceBucket:t.sourceBucket,sourceProvider:t.sourceProvider,sourceRegion:t.sourceRegion,sourceSecretAccessKey:t.sourceSecretAccessKey,sourceClientEmail:t.sourceClientEmail,sourcePrivateKey:t.sourcePrivateKey,sourceBucketUrl:t.sourceBucketUrl,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating sippy`,async()=>i.put(`/accounts/${m}/r2/buckets/${t.bucketName}/sippy`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated sippy`});return}let h={};t.destinationAccessKeyId!==void 0&&c(h,[`destination`,`accessKeyId`],o(t.destinationAccessKeyId,`destinationAccessKeyId`,`text`)),t.destinationProvider!==void 0&&c(h,[`destination`,`provider`],o(t.destinationProvider,`destinationProvider`,`text`)),t.destinationSecretAccessKey!==void 0&&c(h,[`destination`,`secretAccessKey`],o(t.destinationSecretAccessKey,`destinationSecretAccessKey`,`text`)),t.sourceAccessKeyId!==void 0&&c(h,[`source`,`accessKeyId`],o(t.sourceAccessKeyId,`sourceAccessKeyId`,`text`)),t.sourceBucket!==void 0&&c(h,[`source`,`bucket`],o(t.sourceBucket,`sourceBucket`,`text`)),t.sourceProvider!==void 0&&c(h,[`source`,`provider`],o(t.sourceProvider,`sourceProvider`,`text`)),t.sourceRegion!==void 0&&c(h,[`source`,`region`],o(t.sourceRegion,`sourceRegion`,`text`)),t.sourceSecretAccessKey!==void 0&&c(h,[`source`,`secretAccessKey`],o(t.sourceSecretAccessKey,`sourceSecretAccessKey`,`text`)),t.sourceClientEmail!==void 0&&c(h,[`source`,`clientEmail`],o(t.sourceClientEmail,`sourceClientEmail`,`text`)),t.sourcePrivateKey!==void 0&&c(h,[`source`,`privateKey`],o(t.sourcePrivateKey,`sourcePrivateKey`,`text`)),t.sourceBucketUrl!==void 0&&c(h,[`source`,`bucketUrl`],o(t.sourceBucketUrl,`sourceBucketUrl`,`text`)),u(await p(`Updating sippy`,async()=>i.put(`/accounts/${m}/r2/buckets/${t.bucketName}/sippy`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated sippy`})}},X={command:`sippy`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(q).command(J).command(Y).demandCommand(1),handler:()=>{}},Z={command:`buckets`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(_).command(v).command(k).command(F).command(z).command(ee).command(O).command(P).command(R).command(V).command(W).command(K).command(X).demandCommand(1),handler:()=>{}},Q={command:`source`,describe:`Check whether tokens are valid against the source bucket`,builder:e=>e.option(`bucket`,{type:`string`,description:`The bucket field`}).option(`endpoint`,{type:`string`,description:`The endpoint field`}).option(`keys`,{type:`string`,array:!0,description:`The keys field`}).option(`path-prefix`,{type:`string`,description:`The pathPrefix field`}).option(`region`,{type:`string`,description:`The region field`}).option(`secret-access-key-id`,{type:`string`,description:`The secret.accessKeyId field`}).option(`secret-secret-access-key`,{type:`string`,description:`The secret.secretAccessKey field`}).option(`secret-client-email`,{type:`string`,description:`The secret.clientEmail field`}).option(`secret-private-key`,{type:`string`,description:`The secret.privateKey field`}).option(`vendor`,{type:`string`,description:`The vendor field`,choices:[`s3`,`gcs`,`r2`]}).option(`jurisdiction`,{type:`string`,description:`The jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`endpoint`,[`secret-client-email`,`secret-private-key`,`jurisdiction`]).conflicts(`region`,[`secret-client-email`,`secret-private-key`,`jurisdiction`]).conflicts(`secret-access-key-id`,[`secret-client-email`,`secret-private-key`]).conflicts(`secret-secret-access-key`,[`secret-client-email`,`secret-private-key`]).conflicts(`secret-client-email`,[`endpoint`,`region`,`secret-access-key-id`,`secret-secret-access-key`,`jurisdiction`]).conflicts(`secret-private-key`,[`endpoint`,`region`,`secret-access-key-id`,`secret-secret-access-key`,`jurisdiction`]).conflicts(`jurisdiction`,[`endpoint`,`region`,`secret-client-email`,`secret-private-key`]),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 super-slurper connectivity-precheck source`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/slurper/source/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:{bucket:i.bucket,endpoint:i.endpoint,keys:i.keys,pathPrefix:i.pathPrefix,region:i.region,secretAccessKeyId:i.secretAccessKeyId,secretSecretAccessKey:i.secretSecretAccessKey,secretClientEmail:i.secretClientEmail,secretPrivateKey:i.secretPrivateKey,vendor:i.vendor,jurisdiction:i.jurisdiction,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating connectivity precheck`,async()=>m.put(`/accounts/${h}/slurper/source/connectivity-precheck`,{body:e})),{successLabel:`Updated connectivity precheck`});return}i.bucket===void 0&&(i.bucket=await t(`bucket`,``)),i.vendor===void 0&&(i.vendor=await n(`vendor`,``,[`s3`,`gcs`,`r2`]));let g={};i.bucket!==void 0&&c(g,[`bucket`],o(i.bucket,`bucket`,`text`)),i.endpoint!==void 0&&c(g,[`endpoint`],o(i.endpoint,`endpoint`,`text`)),i.keys!==void 0&&c(g,[`keys`],i.keys),i.pathPrefix!==void 0&&c(g,[`pathPrefix`],o(i.pathPrefix,`pathPrefix`,`text`)),i.region!==void 0&&c(g,[`region`],o(i.region,`region`,`text`)),i.secretAccessKeyId!==void 0&&c(g,[`secret`,`accessKeyId`],o(i.secretAccessKeyId,`secretAccessKeyId`,`text`)),i.secretSecretAccessKey!==void 0&&c(g,[`secret`,`secretAccessKey`],o(i.secretSecretAccessKey,`secretSecretAccessKey`,`text`)),i.secretClientEmail!==void 0&&c(g,[`secret`,`clientEmail`],o(i.secretClientEmail,`secretClientEmail`,`text`)),i.secretPrivateKey!==void 0&&c(g,[`secret`,`privateKey`],o(i.secretPrivateKey,`secretPrivateKey`,`text`)),i.vendor!==void 0&&c(g,[`vendor`],o(i.vendor,`vendor`,`text`)),i.jurisdiction!==void 0&&c(g,[`jurisdiction`],o(i.jurisdiction,`jurisdiction`,`text`)),u(await p(`Updating connectivity precheck`,async()=>m.put(`/accounts/${h}/slurper/source/connectivity-precheck`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated connectivity precheck`})}},ne={command:`target`,describe:`Check whether tokens are valid against the target bucket`,builder:e=>e.option(`bucket`,{type:`string`,description:`The bucket field`}).option(`jurisdiction`,{type:`string`,description:`The jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`secret-access-key-id`,{type:`string`,description:`The secret.accessKeyId field`}).option(`secret-secret-access-key`,{type:`string`,description:`The secret.secretAccessKey field`}).option(`vendor`,{type:`string`,description:`The vendor field`,choices:[`r2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 super-slurper connectivity-precheck target`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/slurper/target/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:{bucket:i.bucket,jurisdiction:i.jurisdiction,secretAccessKeyId:i.secretAccessKeyId,secretSecretAccessKey:i.secretSecretAccessKey,vendor:i.vendor,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating connectivity precheck`,async()=>m.put(`/accounts/${h}/slurper/target/connectivity-precheck`,{body:e})),{successLabel:`Updated connectivity precheck`});return}i.bucket===void 0&&(i.bucket=await t(`bucket`,``)),i.secretAccessKeyId===void 0&&(i.secretAccessKeyId=await t(`secret-access-key-id`,``)),i.secretSecretAccessKey===void 0&&(i.secretSecretAccessKey=await t(`secret-secret-access-key`,``,{kind:`secret`})),i.vendor===void 0&&(i.vendor=await n(`vendor`,``,[`r2`]));let g={};i.bucket!==void 0&&c(g,[`bucket`],o(i.bucket,`bucket`,`text`)),i.jurisdiction!==void 0&&c(g,[`jurisdiction`],o(i.jurisdiction,`jurisdiction`,`text`)),i.secretAccessKeyId!==void 0&&c(g,[`secret`,`accessKeyId`],o(i.secretAccessKeyId,`secretAccessKeyId`,`text`)),i.secretSecretAccessKey!==void 0&&c(g,[`secret`,`secretAccessKey`],o(i.secretSecretAccessKey,`secretSecretAccessKey`,`text`)),i.vendor!==void 0&&c(g,[`vendor`],o(i.vendor,`vendor`,`text`)),u(await p(`Updating connectivity precheck`,async()=>m.put(`/accounts/${h}/slurper/target/connectivity-precheck`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated connectivity precheck`})}},re={command:`connectivity-precheck`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(Q).command(ne).demandCommand(1),handler:()=>{}},ie={command:`abort-all`,describe:`Cancels all running R2 Super Slurper migration jobs for the account. Any objects in the middle of a transfer will finish, but no new objects will start transferring.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 super-slurper jobs abort-all`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/slurper/jobs/abortAll`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`job`,``,{force:!!t.force,message:`This operation stops every running migration job.`})){process.stderr.write(`Aborted.
8
- `);return}u(await p(`Deleting job`,async()=>n.r2.superSlurper.jobs.abortAll(o)),{successLabel:`Deleted job`})}},ae={command:`abort <jobId>`,describe:`Cancels a specific R2 Super Slurper migration job. Any objects in the middle of a transfer will finish, but no new objects will start transferring.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.jobId,`jobId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 super-slurper jobs abort`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/slurper/jobs/${t.jobId??`<jobId>`}/abort`,pathParams:{jobId:String(t.jobId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`job`,String(t.jobId??``),{force:!!t.force,message:`This operation stops a running migration job.`})){process.stderr.write(`Aborted.
9
- `);return}u(await p(`Deleting job`,async()=>n.r2.superSlurper.jobs.abort(o,t.jobId)),{successLabel:`Deleted job`})}},oe={command:`create`,describe:`Creates a new R2 Super Slurper migration job to transfer objects from a source bucket (e.g. S3, GCS, R2) to R2.`,builder:e=>e.option(`overwrite`,{type:`boolean`,description:`The overwrite field`,default:!0}).option(`source-bucket`,{type:`string`,description:`The source.bucket field`}).option(`source-endpoint`,{type:`string`,description:`The source.endpoint field`}).option(`source-keys`,{type:`string`,array:!0,description:`The source.keys field`}).option(`source-path-prefix`,{type:`string`,description:`The source.pathPrefix field`}).option(`source-region`,{type:`string`,description:`The source.region field`}).option(`source-secret-access-key-id`,{type:`string`,description:`The source.secret.accessKeyId field`}).option(`source-secret-secret-access-key`,{type:`string`,description:`The source.secret.secretAccessKey field`}).option(`source-secret-client-email`,{type:`string`,description:`The source.secret.clientEmail field`}).option(`source-secret-private-key`,{type:`string`,description:`The source.secret.privateKey field`}).option(`source-vendor`,{type:`string`,description:`The source.vendor field`,choices:[`s3`,`gcs`,`r2`]}).option(`source-jurisdiction`,{type:`string`,description:`The source.jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`target-bucket`,{type:`string`,description:`The target.bucket field`}).option(`target-jurisdiction`,{type:`string`,description:`The target.jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`target-secret-access-key-id`,{type:`string`,description:`The target.secret.accessKeyId field`}).option(`target-secret-secret-access-key`,{type:`string`,description:`The target.secret.secretAccessKey field`}).option(`target-vendor`,{type:`string`,description:`The target.vendor field`,choices:[`r2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`source-endpoint`,[`source-secret-client-email`,`source-secret-private-key`,`source-jurisdiction`]).conflicts(`source-region`,[`source-secret-client-email`,`source-secret-private-key`,`source-jurisdiction`]).conflicts(`source-secret-access-key-id`,[`source-secret-client-email`,`source-secret-private-key`]).conflicts(`source-secret-secret-access-key`,[`source-secret-client-email`,`source-secret-private-key`]).conflicts(`source-secret-client-email`,[`source-endpoint`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-jurisdiction`]).conflicts(`source-secret-private-key`,[`source-endpoint`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-jurisdiction`]).conflicts(`source-jurisdiction`,[`source-endpoint`,`source-region`,`source-secret-client-email`,`source-secret-private-key`]).check(e=>{if([`source-bucket`,`source-endpoint`,`source-keys`,`source-path-prefix`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-secret-client-email`,`source-secret-private-key`,`source-vendor`,`source-jurisdiction`].some(t=>e[t]!==void 0)){let t=[`source-bucket`,`source-vendor`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --source-* flag is set`)}return!0}).check(e=>{if([`target-bucket`,`target-jurisdiction`,`target-secret-access-key-id`,`target-secret-secret-access-key`,`target-vendor`].some(t=>e[t]!==void 0)){let t=[`target-bucket`,`target-secret-access-key-id`,`target-secret-secret-access-key`,`target-vendor`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --target-* flag is set`)}return!0}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 super-slurper jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/slurper/jobs`,pathParams:{},bodyKind:`json`,body:{overwrite:t.overwrite,sourceBucket:t.sourceBucket,sourceEndpoint:t.sourceEndpoint,sourceKeys:t.sourceKeys,sourcePathPrefix:t.sourcePathPrefix,sourceRegion:t.sourceRegion,sourceSecretAccessKeyId:t.sourceSecretAccessKeyId,sourceSecretSecretAccessKey:t.sourceSecretSecretAccessKey,sourceSecretClientEmail:t.sourceSecretClientEmail,sourceSecretPrivateKey:t.sourceSecretPrivateKey,sourceVendor:t.sourceVendor,sourceJurisdiction:t.sourceJurisdiction,targetBucket:t.targetBucket,targetJurisdiction:t.targetJurisdiction,targetSecretAccessKeyId:t.targetSecretAccessKeyId,targetSecretSecretAccessKey:t.targetSecretSecretAccessKey,targetVendor:t.targetVendor,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating job`,async()=>n.post(`/accounts/${i}/slurper/jobs`,{body:e})),{successLabel:`Created job`});return}let m={};t.overwrite!==void 0&&c(m,[`overwrite`],t.overwrite),t.sourceBucket!==void 0&&c(m,[`source`,`bucket`],o(t.sourceBucket,`sourceBucket`,`text`)),t.sourceEndpoint!==void 0&&c(m,[`source`,`endpoint`],o(t.sourceEndpoint,`sourceEndpoint`,`text`)),t.sourceKeys!==void 0&&c(m,[`source`,`keys`],t.sourceKeys),t.sourcePathPrefix!==void 0&&c(m,[`source`,`pathPrefix`],o(t.sourcePathPrefix,`sourcePathPrefix`,`text`)),t.sourceRegion!==void 0&&c(m,[`source`,`region`],o(t.sourceRegion,`sourceRegion`,`text`)),t.sourceSecretAccessKeyId!==void 0&&c(m,[`source`,`secret`,`accessKeyId`],o(t.sourceSecretAccessKeyId,`sourceSecretAccessKeyId`,`text`)),t.sourceSecretSecretAccessKey!==void 0&&c(m,[`source`,`secret`,`secretAccessKey`],o(t.sourceSecretSecretAccessKey,`sourceSecretSecretAccessKey`,`text`)),t.sourceSecretClientEmail!==void 0&&c(m,[`source`,`secret`,`clientEmail`],o(t.sourceSecretClientEmail,`sourceSecretClientEmail`,`text`)),t.sourceSecretPrivateKey!==void 0&&c(m,[`source`,`secret`,`privateKey`],o(t.sourceSecretPrivateKey,`sourceSecretPrivateKey`,`text`)),t.sourceVendor!==void 0&&c(m,[`source`,`vendor`],o(t.sourceVendor,`sourceVendor`,`text`)),t.sourceJurisdiction!==void 0&&c(m,[`source`,`jurisdiction`],o(t.sourceJurisdiction,`sourceJurisdiction`,`text`)),t.targetBucket!==void 0&&c(m,[`target`,`bucket`],o(t.targetBucket,`targetBucket`,`text`)),t.targetJurisdiction!==void 0&&c(m,[`target`,`jurisdiction`],o(t.targetJurisdiction,`targetJurisdiction`,`text`)),t.targetSecretAccessKeyId!==void 0&&c(m,[`target`,`secret`,`accessKeyId`],o(t.targetSecretAccessKeyId,`targetSecretAccessKeyId`,`text`)),t.targetSecretSecretAccessKey!==void 0&&c(m,[`target`,`secret`,`secretAccessKey`],o(t.targetSecretSecretAccessKey,`targetSecretSecretAccessKey`,`text`)),t.targetVendor!==void 0&&c(m,[`target`,`vendor`],o(t.targetVendor,`targetVendor`,`text`)),u(await p(`Creating job`,async()=>n.post(`/accounts/${i}/slurper/jobs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created job`})}},se={command:`get <jobId>`,describe:`Retrieves detailed status and configuration for a specific R2 Super Slurper migration job.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}),handler:async e=>{s(e.jobId,`jobId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading job`,async()=>t.r2.superSlurper.jobs.get(n,e.jobId)),{successLabel:`Loaded job`})}},ce={command:`list`,describe:`Lists all R2 Super Slurper migration jobs for the account with their status.`,builder:e=>e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}),handler:async e=>{let t={};e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading jobs`,async()=>n.r2.superSlurper.jobs.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded jobs`})}},le={command:`list`,describe:`Gets log entries for an R2 Super Slurper migration job, showing migration status changes, errors, etc.`,builder:e=>e.option(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}),handler:async e=>{let t={};e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading logs`,async()=>n.r2.superSlurper.jobs.logs.list(i,e.jobId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded logs`})}},ue={command:`logs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(le).demandCommand(1),handler:()=>{}},de={command:`pause <jobId>`,describe:`Pauses a running R2 Super Slurper migration job. The job can be resumed later to continue transferring.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.jobId,`jobId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 super-slurper jobs pause`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/slurper/jobs/${t.jobId??`<jobId>`}/pause`,pathParams:{jobId:String(t.jobId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Updating job`,async()=>n.r2.superSlurper.jobs.pause(i,t.jobId)),{successLabel:`Updated job`})}},fe={command:`progress <jobId>`,describe:`Retrieves current progress metrics for an R2 Super Slurper migration job`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}),handler:async e=>{s(e.jobId,`jobId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading job`,async()=>t.r2.superSlurper.jobs.progress(n,e.jobId)),{successLabel:`Loaded job`})}},pe={command:`resume <jobId>`,describe:`Resumes a paused R2 Super Slurper migration job, continuing the transfer from where it stopped.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.jobId,`jobId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf r2 super-slurper jobs resume`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/slurper/jobs/${t.jobId??`<jobId>`}/resume`,pathParams:{jobId:String(t.jobId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Updating job`,async()=>n.r2.superSlurper.jobs.resume(i,t.jobId)),{successLabel:`Updated job`})}},$={command:`jobs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(ae).command(ie).command(oe).command(se).command(ce).command(de).command(fe).command(pe).command(ue).demandCommand(1),handler:()=>{}},me={command:`super-slurper`,describe:`Operations for super-slurper`,builder:e=>e.command(re).command($).demandCommand(1),handler:()=>{}},he={command:`create`,describe:`Creates temporary access credentials on a bucket that can be optionally scoped to prefixes or objects.`,builder:e=>e.option(`bucket`,{type:`string`,description:`Name of the R2 bucket.`}).option(`objects`,{type:`string`,array:!0,description:`Optional object paths to scope the credentials to.`}).option(`parent-access-key-id`,{type:`string`,description:`The parent access key id to use for signing.`}).option(`permission`,{type:`string`,description:`Permissions allowed on the credentials.`,choices:[`admin-read-write`,`admin-read-only`,`object-read-write`,`object-read-only`]}).option(`prefixes`,{type:`string`,array:!0,description:`Optional prefix paths to scope the credentials to.`}).option(`ttl-seconds`,{type:`number`,description:`How long the credentials will live for in seconds.`,default:900}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf r2 temporary-credentials create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/r2/temp-access-credentials`,pathParams:{},bodyKind:`json`,body:{bucket:i.bucket,objects:i.objects,parentAccessKeyId:i.parentAccessKeyId,permission:i.permission,prefixes:i.prefixes,ttlSeconds:i.ttlSeconds,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating temporary credential`,async()=>m.post(`/accounts/${h}/r2/temp-access-credentials`,{body:e})),{successLabel:`Created temporary credential`});return}if(i.bucket===void 0&&(i.bucket=await t(`bucket`,`Name of the R2 bucket.`)),i.parentAccessKeyId===void 0&&(i.parentAccessKeyId=await t(`parent-access-key-id`,`The parent access key id to use for signing.`)),i.permission===void 0&&(i.permission=await n(`permission`,`Permissions allowed on the credentials.`,[`admin-read-write`,`admin-read-only`,`object-read-write`,`object-read-only`])),i.ttlSeconds===void 0)throw Error(`--ttl-seconds is required (or pass --body with this field set).`);let g={};i.bucket!==void 0&&c(g,[`bucket`],o(i.bucket,`bucket`,`text`)),i.objects!==void 0&&c(g,[`objects`],i.objects),i.parentAccessKeyId!==void 0&&c(g,[`parentAccessKeyId`],o(i.parentAccessKeyId,`parentAccessKeyId`,`text`)),i.permission!==void 0&&c(g,[`permission`],o(i.permission,`permission`,`text`)),i.prefixes!==void 0&&c(g,[`prefixes`],i.prefixes),i.ttlSeconds!==void 0&&c(g,[`ttlSeconds`],i.ttlSeconds),u(await p(`Creating temporary credential`,async()=>m.post(`/accounts/${h}/r2/temp-access-credentials`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created temporary credential`})}},ge={command:`temporary-credentials`,describe:`Generate short-lived S3-compatible credentials scoped to specific buckets and operations`,builder:e=>e.command(he).demandCommand(1),handler:()=>{}},_e={command:`r2`,describe:`S3-compatible object storage with zero egress fees — buckets, lifecycle rules, event notifications, and data migration`,builder:e=>e.command(Z).command(me).command(ge).demandCommand(1),handler:()=>{}};export{_e as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`create <bucketName>`,describe:`Store authentication credentials for a catalog. These credentials are used to authenticate with R2 storage when performing catalog operations.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`token`,{type:`string`,description:`Provides the Cloudflare API token for accessing R2.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Contains request to store catalog credentials.`}),handler:async r=>{if(o(r.bucketName,`bucketName`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf r2-data-catalog credentials create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/r2-catalog/${r.bucketName??`<bucketName>`}/credential`,pathParams:{bucketName:String(r.bucketName??``)},bodyKind:`json`,body:{token:r.token,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating credential`,async()=>p.post(`/accounts/${m}/r2-catalog/${r.bucketName}/credential`,{body:e})),{successLabel:`Created credential`});return}r.token===void 0&&(r.token=await t(`token`,`Provides the Cloudflare API token for accessing R2.`));let h={};r.token!==void 0&&s(h,[`token`],a(r.token,`token`,`text`)),l(await f(`Creating credential`,async()=>p.post(`/accounts/${m}/r2-catalog/${r.bucketName}/credential`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created credential`})}},m={command:`credentials`,describe:`Catalog access credentials for external query engines (Spark, Trino, etc.)`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}},h={command:`disable <bucketName>`,describe:`Disable an R2 bucket as a catalog. This operation deactivates the catalog but preserves existing metadata and data files. The catalog can be re-enabled later.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name to disable as catalog.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.bucketName,`bucketName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf r2-data-catalog disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2-catalog/${t.bucketName??`<bucketName>`}/disable`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`r2 data catalog`,String(t.bucketName??``),{force:!!t.force,message:`This operation turns off the data catalog for the bucket. Existing namespace or table state remains, but writes stop.`})){process.stderr.write(`Aborted.
3
- `);return}l(await f(`Deleting r2 data catalog`,async()=>a.r2DataCatalog.disable(s,t.bucketName)),{successLabel:`Deleted r2 data catalog`})}},g={command:`enable <bucketName>`,describe:`Enable an R2 bucket as an Apache Iceberg catalog. This operation creates the necessary catalog infrastructure and activates the bucket for storing Iceberg metadata and data files.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name to enable as catalog.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.bucketName,`bucketName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf r2-data-catalog enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2-catalog/${t.bucketName??`<bucketName>`}/enable`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating r2 data catalog`,async()=>r.r2DataCatalog.enable(a,t.bucketName)),{successLabel:`Created r2 data catalog`})}},_={command:`get <bucketName>`,describe:`Retrieve detailed information about a specific R2 catalog by bucket name. Returns catalog status, maintenance configuration, and credential status.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}),handler:async e=>{o(e.bucketName,`bucketName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading r2 data catalog`,async()=>t.r2DataCatalog.get(r,e.bucketName)),{successLabel:`Loaded r2 data catalog`})}},v={command:`list`,describe:`Returns a list of R2 buckets that have been enabled as Apache Iceberg catalogs for the specified account. Each catalog represents an R2 bucket configured to store Iceberg metadata and data files.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading r2 data catalog`,async()=>t.r2DataCatalog.list(r)),{successLabel:`Loaded r2 data catalog`})}},y={command:`get <bucketName>`,describe:`Retrieve the maintenance configuration for a specific catalog, including compaction settings and credential status.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}),handler:async e=>{o(e.bucketName,`bucketName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading maintenance config`,async()=>t.r2DataCatalog.maintenanceConfigs.get(r,e.bucketName)),{successLabel:`Loaded maintenance config`})}},b={command:`update <bucketName>`,describe:`Update the maintenance configuration for a catalog. This allows you to enable or disable compaction and adjust target file sizes for optimization.`,builder:e=>e.positional(`bucketName`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`snapshot-expiration-max-snapshot-age`,{type:`string`,description:`Updates the maximum age for snapshots optionally.`}).option(`snapshot-expiration-min-snapshots-to-keep`,{type:`number`,description:`Updates the minimum number of snapshots to retain optionally.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Contains request to update catalog maintenance configuration.`}),handler:async t=>{if(o(t.bucketName,`bucketName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf r2-data-catalog maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2-catalog/${t.bucketName??`<bucketName>`}/maintenance-configs`,pathParams:{bucketName:String(t.bucketName??``)},bodyKind:`json`,body:{snapshotExpirationMaxSnapshotAge:t.snapshotExpirationMaxSnapshotAge,snapshotExpirationMinSnapshotsToKeep:t.snapshotExpirationMinSnapshotsToKeep,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating maintenance config`,async()=>r.post(`/accounts/${p}/r2-catalog/${t.bucketName}/maintenance-configs`,{body:e})),{successLabel:`Created maintenance config`});return}let m={};t.snapshotExpirationMaxSnapshotAge!==void 0&&s(m,[`snapshot_expiration`,`max_snapshot_age`],a(t.snapshotExpirationMaxSnapshotAge,`snapshotExpirationMaxSnapshotAge`,`text`)),t.snapshotExpirationMinSnapshotsToKeep!==void 0&&s(m,[`snapshot_expiration`,`min_snapshots_to_keep`],t.snapshotExpirationMinSnapshotsToKeep),l(await f(`Creating maintenance config`,async()=>r.post(`/accounts/${p}/r2-catalog/${t.bucketName}/maintenance-configs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created maintenance config`})}},x={command:`maintenance-configs`,describe:`Table maintenance settings — compaction schedules and snapshot expiration policies`,builder:e=>e.command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`list`,describe:`Returns a list of namespaces in the specified R2 catalog. Supports hierarchical filtering and pagination for efficient traversal of large namespace hierarchies.`,builder:e=>e.option(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`page-token`,{type:`string`,description:`Opaque pagination token from a previous response. Use this to fetch the next page of results.`}).option(`page-size`,{type:`number`,description:`Maximum number of namespaces to return per page. Defaults to 100, maximum 1000.`}).option(`parent`,{type:`string`,description:`Parent namespace to filter by. Only returns direct children of this namespace. For nested namespaces, use %1F as separator (e.g., "bronze%1Fanalytics"). Omit this parameter to list top-level namespaces.`}).option(`return-uuids`,{type:`boolean`,description:`Whether to include namespace UUIDs in the response. Set to true to receive the namespace_uuids array.`,default:!1}).option(`return-details`,{type:`boolean`,description:`Whether to include additional metadata (timestamps). When true, response includes created_at and updated_at arrays.`,default:!1}),handler:async e=>{let t={};e.pageToken!==void 0&&(t.page_token=e.pageToken),e.pageSize!==void 0&&(t.page_size=e.pageSize),e.parent!==void 0&&(t.parent=e.parent),e.returnUuids!==void 0&&(t.return_uuids=e.returnUuids),e.returnDetails!==void 0&&(t.return_details=e.returnDetails);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading namespaces`,async()=>r.r2DataCatalog.namespaces.list(a,e.bucketName,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded namespaces`})}},C={command:`list`,describe:`Returns a list of tables in the specified namespace within an R2 catalog. Supports pagination for efficient traversal of large table collections.`,builder:e=>e.option(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`The namespace identifier. For nested namespaces, use %1F as separator (e.g., "bronze%1Fanalytics").`,demandOption:!0}).option(`page-token`,{type:`string`,description:`Opaque pagination token from a previous response. Use this to fetch the next page of results.`}).option(`page-size`,{type:`number`,description:`Maximum number of tables to return per page. Defaults to 100, maximum 1000.`}).option(`return-uuids`,{type:`boolean`,description:`Whether to include table UUIDs in the response. Set to true to receive the table_uuids array.`,default:!1}).option(`return-details`,{type:`boolean`,description:`Whether to include additional metadata (timestamps, locations). When true, response includes created_at, updated_at, metadata_locations, and locations arrays.`,default:!1}),handler:async e=>{let t={};e.pageToken!==void 0&&(t.page_token=e.pageToken),e.pageSize!==void 0&&(t.page_size=e.pageSize),e.returnUuids!==void 0&&(t.return_uuids=e.returnUuids),e.returnDetails!==void 0&&(t.return_details=e.returnDetails);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading tables`,async()=>r.r2DataCatalog.namespaces.tables.list(a,e.bucketName,e.namespace,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded tables`})}},w={command:`get <tableName>`,describe:`Retrieve the maintenance configuration for a specific table, including compaction settings.`,builder:e=>e.positional(`tableName`,{type:`string`,description:`The table name.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`The namespace identifier (use %1F as separator for nested namespaces).`,demandOption:!0}),handler:async e=>{o(e.tableName,`tableName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading maintenance config`,async()=>t.r2DataCatalog.namespaces.tables.maintenanceConfigs.get(r,e.bucketName,e.namespace,e.tableName)),{successLabel:`Loaded maintenance config`})}},T={command:`update <tableName>`,describe:`Update the maintenance configuration for a specific table. This allows you to enable or disable compaction and adjust target file sizes for optimization.`,builder:e=>e.positional(`tableName`,{type:`string`,description:`The table name.`,demandOption:!0}).option(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`The namespace identifier (use %1F as separator for nested namespaces).`,demandOption:!0}).option(`snapshot-expiration-max-snapshot-age`,{type:`string`,description:`Updates the maximum age for snapshots optionally.`}).option(`snapshot-expiration-min-snapshots-to-keep`,{type:`number`,description:`Updates the minimum number of snapshots to retain optionally.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Contains request to update table maintenance configuration.`}),handler:async t=>{if(o(t.tableName,`tableName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf r2-data-catalog namespaces tables maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/r2-catalog/${t.bucketName??`<bucketName>`}/namespaces/${t.namespace??`<namespace>`}/tables/${t.tableName??`<tableName>`}/maintenance-configs`,pathParams:{bucketName:String(t.bucketName??``),namespace:String(t.namespace??``),tableName:String(t.tableName??``)},bodyKind:`json`,body:{snapshotExpirationMaxSnapshotAge:t.snapshotExpirationMaxSnapshotAge,snapshotExpirationMinSnapshotsToKeep:t.snapshotExpirationMinSnapshotsToKeep,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Creating maintenance config`,async()=>r.post(`/accounts/${p}/r2-catalog/${t.bucketName}/namespaces/${t.namespace}/tables/${t.tableName}/maintenance-configs`,{body:e})),{successLabel:`Created maintenance config`});return}let m={};t.snapshotExpirationMaxSnapshotAge!==void 0&&s(m,[`snapshot_expiration`,`max_snapshot_age`],a(t.snapshotExpirationMaxSnapshotAge,`snapshotExpirationMaxSnapshotAge`,`text`)),t.snapshotExpirationMinSnapshotsToKeep!==void 0&&s(m,[`snapshot_expiration`,`min_snapshots_to_keep`],t.snapshotExpirationMinSnapshotsToKeep),l(await f(`Creating maintenance config`,async()=>r.post(`/accounts/${p}/r2-catalog/${t.bucketName}/namespaces/${t.namespace}/tables/${t.tableName}/maintenance-configs`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created maintenance config`})}},E={command:`maintenance-configs`,describe:`Logical namespaces that group related tables within the data catalog`,builder:e=>e.command(w).command(T).demandCommand(1),handler:()=>{}},D={command:`tables`,describe:`Logical namespaces that group related tables within the data catalog`,builder:e=>e.command(C).command(E).demandCommand(1),handler:()=>{}},O={command:`namespaces`,describe:`Logical namespaces that group related tables within the data catalog`,builder:e=>e.command(S).command(D).demandCommand(1),handler:()=>{}},k={command:`r2-data-catalog`,describe:`Iceberg-compatible data catalog for R2 — organize objects into tables and namespaces for SQL query engines`,builder:e=>e.command(h).command(g).command(_).command(v).command(m).command(x).command(O).demandCommand(1),handler:()=>{}};export{k as default};