cf 0.6.0 → 0.7.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.
- package/dist/_meta/agent-context.json +78 -41
- package/dist/_meta/commands.json +19888 -21071
- package/dist/_meta/schemas.json +14305 -15328
- package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
- package/dist/account-D8mYiWxQ.mjs +2 -0
- package/dist/accounts-CJci1Oez.mjs +23 -0
- package/dist/acm-CmCd985Q.mjs +3 -0
- package/dist/addressing-R7p6TRBe.mjs +12 -0
- package/dist/{agent-context-CKb6w43K.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
- package/dist/ai-BzJg0RIX.mjs +3 -0
- package/dist/ai-audit-B0vJNOZG.mjs +2 -0
- package/dist/ai-gateway-D3vJR3My.mjs +10 -0
- package/dist/ai-search-CNg7W7U4.mjs +7 -0
- package/dist/alerting-_sdM0B0S.mjs +6 -0
- package/dist/alerts-dpT6Qsdu.mjs +2 -0
- package/dist/{analytics-CwFrx-Dr.mjs → analytics-BFBJhDrP.mjs} +1 -1
- package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
- package/dist/{api-gateway-D9PMVVqL.mjs → api-gateway-D4AIEtUq.mjs} +10 -10
- package/dist/argo-Bjk6nFfs.mjs +2 -0
- package/dist/artifacts-Ba4b3iOa.mjs +4 -0
- package/dist/{audit-logs-BvQ9uwuy.mjs → audit-logs-BE0T5All.mjs} +1 -1
- package/dist/{auth-DX9KnJ0P.mjs → auth-CZ0E51rF.mjs} +3 -3
- package/dist/auth-D_zyQbDR.mjs +5 -0
- package/dist/autorag-Cnpp8PAG.mjs +2 -0
- package/dist/billing-Dz6Zj8Eq.mjs +2 -0
- package/dist/bot-management-pFwIbFi-.mjs +5 -0
- package/dist/botnet-feed-BY9uGChY.mjs +3 -0
- package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
- package/dist/brands-CGpk9nZB.mjs +2 -0
- package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
- package/dist/browser-run-DhHtz4y3.mjs +4 -0
- package/dist/build-CWuStmDi.mjs +2 -0
- package/dist/{cache-CeN5t6_W.mjs → cache-DVhkiIGK.mjs} +4 -4
- package/dist/calls-95zjvIcO.mjs +4 -0
- package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
- package/dist/cf-BLT7uKJF.mjs +18 -0
- package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
- package/dist/clear-DXx8WBAN.mjs +2 -0
- package/dist/client-certificates-D6mE4vJu.mjs +3 -0
- package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
- package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
- package/dist/{completions-Bvzav4Mj.mjs → completions-DMc_PlIw.mjs} +2 -2
- package/dist/connectivity-DJkE3crz.mjs +3 -0
- package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
- package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
- package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
- package/dist/connectors-zWaZTi2A.mjs +3 -0
- package/dist/content-scanning-CGvGf04y.mjs +4 -0
- package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
- package/dist/{custom-certificates-CfRj7QZb.mjs → custom-certificates-CWUrPYLP.mjs} +4 -4
- package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
- package/dist/{custom-hostnames-CcK7_17e.mjs → custom-hostnames-CVQSksqq.mjs} +4 -4
- package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
- package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
- package/dist/d1-78Ym1P6D.mjs +4 -0
- package/dist/data-security-zmFoMwRU.mjs +6 -0
- package/dist/{dcv-delegation-BYsNl3qc.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
- package/dist/{deploy-BzlPv3ro.mjs → deploy-CVvkZFjR.mjs} +1 -1
- package/dist/{dev-IOg-_s5_.mjs → dev-DSslyDXx.mjs} +1 -1
- package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
- package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
- package/dist/dist-BH-4NQOV.mjs +134 -0
- package/dist/dns-D7VAaCyO.mjs +29 -0
- package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
- package/dist/domain-info-CRvKc2Lg.mjs +2 -0
- package/dist/durable-objects-BIpvyu9m.mjs +2 -0
- package/dist/email-auth-Cx--s8W4.mjs +2 -0
- package/dist/email-routing-CiDbivcN.mjs +10 -0
- package/dist/email-security-BYeAuSc6.mjs +12 -0
- package/dist/email-sending-Dg2rSmHH.mjs +4 -0
- package/dist/{filters-DKs-wEzt.mjs → filters-DZ8YnQ90.mjs} +3 -3
- package/dist/firewall-DEd1hs_I.mjs +11 -0
- package/dist/flagship-DVw7xGoP.mjs +4 -0
- package/dist/{fraud-D8WmLKyH.mjs → fraud-BbGS3FZs.mjs} +2 -2
- package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
- package/dist/{healthchecks-BBtW8vRh.mjs → healthchecks-Da9N3ix4.mjs} +3 -3
- package/dist/{hostnames-Bh2IFxIw.mjs → hostnames-mimZu2tB.mjs} +2 -2
- package/dist/hyperdrive-BNdvxOos.mjs +21 -0
- package/dist/iam-DGQ-OgRl.mjs +6 -0
- package/dist/images-CI6Iy9ho.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-BDB-aRtU.mjs +3 -0
- package/dist/internal-Czlp5Ekb.mjs +2 -0
- package/dist/{ips-BE7JbAnc.mjs → ips-B9UuPvsY.mjs} +1 -1
- package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
- package/dist/kv-BHerx4dZ.mjs +5 -0
- package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
- package/dist/live-Ce7dZW7p.mjs +2 -0
- package/dist/load-balancers-DSjS5WKw.mjs +6 -0
- package/dist/logexplorer-DBIfTlRP.mjs +24 -0
- package/dist/logo-matches-C00iGpzW.mjs +2 -0
- package/dist/logos-CJLhx1go.mjs +3 -0
- package/dist/logpush-Cr1U-eK-.mjs +5 -0
- package/dist/logs-DMvtchc6.mjs +3 -0
- package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
- package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
- package/dist/magic-transit-DiKiPUax.mjs +110 -0
- package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
- package/dist/matches-B0yHbQ2I.mjs +2 -0
- package/dist/moq-UgBawOXe.mjs +13 -0
- package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
- package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
- package/dist/oauth-DBJ5GSFk.mjs +40 -0
- package/dist/observability-B-1y36QS.mjs +4 -0
- package/dist/organization-Dq3PClZ7.mjs +41 -0
- package/dist/organizations-AhsQkHyX.mjs +2 -0
- package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
- package/dist/{origin-tls-client-auth-B30_2_dO.mjs → origin-tls-client-auth-BDw5q-6G.mjs} +3 -3
- package/dist/{page-rules-zQJGmTCd.mjs → page-rules-DqYQ23eg.mjs} +5 -5
- package/dist/{page-shield-CxQk5k9X.mjs → page-shield-DKdlZOLO.mjs} +5 -5
- package/dist/pages-BsXF11Kv.mjs +11 -0
- package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
- package/dist/pipelines-D_QhSnGW.mjs +6 -0
- package/dist/progress-O88q63Bk.mjs +2 -0
- package/dist/{prompt-q3B7sM2A.mjs → prompt-DTAWiEm2.mjs} +1 -1
- package/dist/queries-CAE95-OH.mjs +3 -0
- package/dist/queues-BBz35Mqd.mjs +6 -0
- package/dist/r2-Zp99S5xF.mjs +21 -0
- package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
- package/dist/radar-Cij-XVQJ.mjs +2 -0
- package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
- package/dist/rate-limits-DSdToIWv.mjs +5 -0
- package/dist/raw-fetch-DgezeshQ.mjs +2 -0
- package/dist/ready-DMpJvyaz.mjs +2 -0
- package/dist/realtime-kit-9rJcapfM.mjs +18 -0
- package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
- package/dist/refute-BGTpr5sy.mjs +2 -0
- package/dist/registrar-CXViZlah.mjs +83 -0
- package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
- package/dist/request-tracers-DATfBnE9.mjs +2 -0
- package/dist/{resolve-DGD57PFH.mjs → resolve-Bs2sMRYS.mjs} +1 -1
- package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
- package/dist/resource-tagging-BTn05AOj.mjs +16 -0
- package/dist/rules-ens3OHme.mjs +4 -0
- package/dist/rulesets-bkreZRao.mjs +8 -0
- package/dist/rum-CpgXFcwl.mjs +4 -0
- package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
- package/dist/scan-page-BqoQTk3R.mjs +2 -0
- package/dist/{schema-D8o6HcCr.mjs → schema-DCF4yEp_.mjs} +1 -1
- package/dist/{schema-validation-BWNDnnIT.mjs → schema-validation-Ca6o94ts.mjs} +5 -5
- package/dist/scim-C4oT8TMc.mjs +4 -0
- package/dist/sdk-pQ5kaGUX.mjs +3 -0
- package/dist/search-C4T5riPh.mjs +2 -0
- package/dist/secrets-store-CWEuiDNo.mjs +7 -0
- package/dist/security-center-BOvm7xy6.mjs +2 -0
- package/dist/{security-txt-CVpmJo29.mjs → security-txt-BCAUBctN.mjs} +2 -2
- package/dist/session-B1ARgLG7.mjs +2 -0
- package/dist/share-DhmVspmL.mjs +5 -0
- package/dist/{shared-DQI8NGja.mjs → shared-Bod3-Exx.mjs} +332 -332
- package/dist/signed-url-DA509wgp.mjs +2 -0
- package/dist/{smart-shield-BreBC1Ap.mjs → smart-shield-DZm4fn6z.mjs} +2 -2
- package/dist/{snippets-BAJoWMSJ.mjs → snippets-oQ0u26-z.mjs} +3 -3
- package/dist/{spawn-pmGERpdB.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
- package/dist/{spectrum-DnIRLY95.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
- package/dist/speed-DqNnvLBD.mjs +4 -0
- package/dist/{src-BQ1dr9xR.mjs → src-By-zTCHz.mjs} +9 -9
- package/dist/ssl-tS3CYZsZ.mjs +15 -0
- package/dist/state-OsdDJvdj.mjs +2 -0
- package/dist/stream-Bud9Os5V.mjs +14 -0
- package/dist/submission-info-DfIXmu-M.mjs +2 -0
- package/dist/submit-BtP8she2.mjs +2 -0
- package/dist/tenant-CMwHa-tU.mjs +2 -0
- package/dist/{token-validation-DUvtXWur.mjs → token-validation-BYC7HTok.mjs} +5 -5
- package/dist/{tools-CQtA5-cr.mjs → tools-Dru4l8yh.mjs} +1 -1
- package/dist/total-queries-DdLBNJzd.mjs +2 -0
- package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
- package/dist/turnstile-CP4nScaL.mjs +23 -0
- package/dist/{ui-BrNwNHX9.mjs → ui-BNoF0KpD.mjs} +2 -2
- package/dist/url-info-Chs9h7Y-.mjs +2 -0
- package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
- package/dist/url-scanner-D4pYNlO-.mjs +2 -0
- package/dist/user-DtefniLc.mjs +11 -0
- package/dist/vectorize-BeAY2g-7.mjs +4 -0
- package/dist/verify-D7J3F_NZ.mjs +2 -0
- package/dist/{versions-NUXxCr0s.mjs → versions-dMW3bLVv.mjs} +1 -1
- package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
- package/dist/{web3-n3GW50u-.mjs → web3-Dhw79l4S.mjs} +3 -3
- package/dist/workers-builds-CuOAB3u4.mjs +7 -0
- package/dist/workers-l3zMNOU6.mjs +20 -0
- package/dist/workflows-rb7RYBKP.mjs +6 -0
- package/dist/{zaraz-9l7KuLqh.mjs → zaraz-CHecMYuo.mjs} +1 -1
- package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
- package/dist/zone-BnnqJwW-.mjs +2 -0
- package/dist/zones-DpI2YikF.mjs +21 -0
- package/package.json +1 -1
- package/dist/abuse-reports-DUs4SKVx.mjs +0 -8
- package/dist/accounts-BIY8wNGA.mjs +0 -22
- package/dist/acm-SqcV8o5o.mjs +0 -3
- package/dist/addressing-CygRm0pN.mjs +0 -12
- package/dist/ai-BAmEAjN3.mjs +0 -2
- package/dist/ai-gateway-BENwPvvB.mjs +0 -8
- package/dist/ai-search-Bv_Whw3E.mjs +0 -7
- package/dist/ai_gateway-C6WP9oBH.mjs +0 -4
- package/dist/alerting-D_qWrsoY.mjs +0 -6
- package/dist/analytics_engine-BjV6XLyG.mjs +0 -2
- package/dist/argo-DwYGbyld.mjs +0 -2
- package/dist/artifacts-DKAjY_n4.mjs +0 -4
- package/dist/auth-TYwGydWg.mjs +0 -5
- package/dist/billing-CRTlRU88.mjs +0 -2
- package/dist/bot-management-DgW--8wM.mjs +0 -5
- package/dist/botnet-feed-CIX6ZORT.mjs +0 -3
- package/dist/brand-protection-ZikBtl0y.mjs +0 -3
- package/dist/browser-rendering-D_ZQVWn8.mjs +0 -4
- package/dist/build-Bgw8TV1p.mjs +0 -134
- package/dist/calls-Cv0ieVg4.mjs +0 -4
- package/dist/certificate-authorities-BzZnWCac.mjs +0 -2
- package/dist/client-certificates-BFuzeBrj.mjs +0 -3
- package/dist/cloud-connector-D5h8Dzzg.mjs +0 -2
- package/dist/cloudforce-one-aqDCIBMp.mjs +0 -21
- package/dist/config-B5k-XbwS.mjs +0 -2
- package/dist/connectivity-CjkXmEhO.mjs +0 -3
- package/dist/connector-interrupts-B7eSface.mjs +0 -2
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +0 -2
- package/dist/connectors-YYu_Vx3H.mjs +0 -3
- package/dist/content-scanning-BorfRGKT.mjs +0 -4
- package/dist/context-C-WbewL6.mjs +0 -2
- package/dist/custom-nameservers-BkKx0THn.mjs +0 -3
- package/dist/custom-pages-DamGVA75.mjs +0 -4
- package/dist/d1-sK0O5THv.mjs +0 -4
- package/dist/data-security-DsWpoWiS.mjs +0 -6
- package/dist/diagnostics-CH7T2WR3.mjs +0 -3
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +0 -7
- package/dist/dist-C6zxsVdY.mjs +0 -306
- package/dist/dns-firewall-VmQf3UVP.mjs +0 -57
- package/dist/dns-o7hUPMCG.mjs +0 -29
- package/dist/durable-objects-DgrTbvoF.mjs +0 -2
- package/dist/email-routing-owCvAEpf.mjs +0 -10
- package/dist/email-security-Dng3DVuf.mjs +0 -8
- package/dist/email-sending-bExMH4lu.mjs +0 -3
- package/dist/firewall-BLaTtX3r.mjs +0 -11
- package/dist/google-tag-gateway-DyCY43k0.mjs +0 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +0 -18
- package/dist/iam-apCCcy7R.mjs +0 -6
- package/dist/images-Cxe45OHm.mjs +0 -7
- package/dist/intel-8V4h6H46.mjs +0 -3
- package/dist/keyless-certificates-CfJmXccT.mjs +0 -3
- package/dist/kv-Dz6then8.mjs +0 -5
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +0 -3
- package/dist/load-balancers-ilsGgudX.mjs +0 -6
- package/dist/logpush-BH14TtuA.mjs +0 -4
- package/dist/logs-B8-mkf_I.mjs +0 -3
- package/dist/magic-cloud-networking-DylCXoG4.mjs +0 -5
- package/dist/magic-network-monitoring-DnyrZy77.mjs +0 -4
- package/dist/magic-transit-B-kU5e3s.mjs +0 -89
- package/dist/managed-transforms-GC9Pq5dg.mjs +0 -3
- package/dist/mtls-certificates-BRlhWw_G.mjs +0 -3
- package/dist/network-interconnects-DuyoFD9_.mjs +0 -36
- package/dist/oauth-B5k80sip.mjs +0 -61
- package/dist/observability-9APhqFHo.mjs +0 -4
- package/dist/organizations-Dy3kiV_z.mjs +0 -41
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +0 -3
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +0 -2
- package/dist/pages-5DKLs7CQ.mjs +0 -11
- package/dist/pipelines-DfGE44xo.mjs +0 -6
- package/dist/progress-CL8I-7YK.mjs +0 -2
- package/dist/queues-BoenUGIw.mjs +0 -6
- package/dist/r2-Cq_JCjK0.mjs +0 -21
- package/dist/r2-data-catalog-eLxltWdO.mjs +0 -14
- package/dist/radar-YNOCio6T.mjs +0 -2
- package/dist/rate-limits-CcAF3tMl.mjs +0 -5
- package/dist/raw-fetch-bIXC9D1m.mjs +0 -2
- package/dist/realtime-kit-4bCGviO5.mjs +0 -18
- package/dist/registrar-CfHlaOOf.mjs +0 -46
- package/dist/request-tracers-DlHawg5l.mjs +0 -2
- package/dist/resource-sharing-7FhuboJE.mjs +0 -5
- package/dist/resource-tagging-divcugVb.mjs +0 -16
- package/dist/rules-CAXkege8.mjs +0 -4
- package/dist/rulesets-CBsdc8IV.mjs +0 -8
- package/dist/rum-D0hHPNl9.mjs +0 -4
- package/dist/scim-CWLli4fi.mjs +0 -3
- package/dist/sdk-DhIhH6GB.mjs +0 -5
- package/dist/secrets-store-B7_HkE8I.mjs +0 -25
- package/dist/security-center-BQT21oiM.mjs +0 -2
- package/dist/session-B8r8LNQN.mjs +0 -93
- package/dist/speed-UYEVue28.mjs +0 -4
- package/dist/ssl-D3Pixs8M.mjs +0 -15
- package/dist/stream-BUsuOfQh.mjs +0 -14
- package/dist/tenants-BdWJTtcg.mjs +0 -2
- package/dist/turnstile-CAKVnS1L.mjs +0 -23
- package/dist/url-normalization-DA-RAxs4.mjs +0 -3
- package/dist/url-scanner-DmYu43f7.mjs +0 -2
- package/dist/user-Bah4wGGN.mjs +0 -10
- package/dist/vectorize-DhvVG2By.mjs +0 -4
- package/dist/waiting-rooms-DoOkT4Mu.mjs +0 -11
- package/dist/workers-D6IaQ_F0.mjs +0 -18
- package/dist/workers-builds-DYi0OMMU.mjs +0 -7
- package/dist/workflows-DrdXUQ2g.mjs +0 -4
- package/dist/zero-trust-D6V9GH2W.mjs +0 -118
- package/dist/zero_trust-BzXKAX_x.mjs +0 -3
- package/dist/zones-0MTkuaFk.mjs +0 -21
- /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
- /package/dist/{cli-types-DGgEbf8K.mjs → cli-types-CFw6Xygp.mjs} +0 -0
- /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
- /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
- /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
- /package/dist/{metadata-MPDDi08e.mjs → metadata-Cnyws6iO.mjs} +0 -0
- /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
package/dist/r2-Cq_JCjK0.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.mjs";import{n as i,r as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-CL8I-7YK.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{n as f,r as p,t as m}from"./prompt-q3B7sM2A.mjs";function h(e){return e.positional(`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})}const g={command:`delete <bucket-name>`,describe:`Delete the CORS policy for a bucket.`,builder:h,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets cors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/cors`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function _(e){return e.positional(`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})}const ee={command:`get <bucket-name>`,describe:`Get the CORS policy for a bucket.`,builder:_,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets cors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/cors`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function te(e){return e.positional(`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)`})}const v={command:`update <bucket-name>`,describe:`Set the CORS policy for a bucket.`,builder:te,handler:async a=>{let o={};if(a[`cf-r2-jurisdiction`]!==void 0&&(o[`cf-r2-jurisdiction`]=String(a[`cf-r2-jurisdiction`])),a.dryRun){c({command:`cf r2 buckets cors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${a[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(a[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(a[`bucket-name`]??``)},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/cors`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/cors`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}},y={command:`cors`,describe:`Operations for buckets.cors`,builder:e=>e.command(g).command(ee).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return 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)`})}const x={command:`create`,describe:`Creates a new R2 bucket.`,builder:b,handler:async f=>{let m={};if(f[`cf-r2-jurisdiction`]!==void 0&&(m[`cf-r2-jurisdiction`]=String(f[`cf-r2-jurisdiction`])),f.dryRun){c({command:`cf r2 buckets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets`,pathParams:{},bodyKind:`json`,body:f.body===void 0?o({locationHint:u(f[`location-hint`],`location-hint`,`text`),name:u(f.name,`name`,`text`),storageClass:u(f[`storage-class`],`storage-class`,`text`)}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/r2/buckets`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}f.name===void 0&&(f.name=await p(`name`,`Name of the bucket.`));let _={};f[`location-hint`]!==void 0&&a(_,[`locationHint`],u(f[`location-hint`],`location-hint`,`text`)),f.name!==void 0&&a(_,[`name`],u(f.name,`name`,`text`)),f[`storage-class`]!==void 0&&a(_,[`storageClass`],u(f[`storage-class`],`storage-class`,`text`)),s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/r2/buckets`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function S(e){return e.positional(`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})}const C={command:`delete <bucket-name>`,describe:`Deletes an existing R2 bucket.`,builder:S,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function w(e){return e.positional(`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(`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(`zone-id`,{type:`string`,description:`Zone ID of the custom 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)`})}const T={command:`create <bucket-name>`,describe:`Register a new custom domain for an existing R2 bucket.`,builder:w,handler:async f=>{let m={};if(f[`cf-r2-jurisdiction`]!==void 0&&(m[`cf-r2-jurisdiction`]=String(f[`cf-r2-jurisdiction`])),f.dryRun){c({command:`cf r2 buckets domains custom create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${f[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(f[`bucket-name`]))}/domains/custom`,pathParams:{"bucket-name":String(f[`bucket-name`]??``)},bodyKind:`json`,body:f.body===void 0?o({ciphers:f.ciphers,domain:u(f.domain,`domain`,`text`),enabled:f.enabled,minTLS:u(f[`min-tls`],`min-tls`,`text`),zoneId:u(f[`zone-id`],`zone-id`,`text`)}):i(f.body)});return}let h=await r(f),g=f.local?d:await e();if(f.accountId=g,f.body){let e=i(f.body);s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/domains/custom`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}if(f.domain===void 0&&(f.domain=await p(`domain`,`Name of the custom domain to be added.`)),f.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);f[`zone-id`]===void 0&&(f[`zone-id`]=await p(`zone-id`,`Zone ID of the custom domain.`));let _={};f.ciphers!==void 0&&a(_,[`ciphers`],f.ciphers),f.domain!==void 0&&a(_,[`domain`],u(f.domain,`domain`,`text`)),f.enabled!==void 0&&a(_,[`enabled`],f.enabled),f[`min-tls`]!==void 0&&a(_,[`minTLS`],u(f[`min-tls`],`min-tls`,`text`)),f[`zone-id`]!==void 0&&a(_,[`zoneId`],u(f[`zone-id`],`zone-id`,`text`)),s(await l(`Creating`,async()=>n(h,`POST`,`/accounts/${g}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/domains/custom`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function E(e){return 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})}const D={command:`delete <domain>`,describe:`Remove custom domain registration from an existing R2 bucket.`,builder:E,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets domains custom delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/domains/custom/${i.domain==null?`<domain>`:encodeURIComponent(String(i.domain))}`,pathParams:{"bucket-name":String(i[`bucket-name`]??``),domain:String(i.domain??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(i.domain))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function O(e){return 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})}const k={command:`get <domain>`,describe:`Get the configuration for a custom domain on an existing R2 bucket.`,builder:O,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets domains custom get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/domains/custom/${i.domain==null?`<domain>`:encodeURIComponent(String(i.domain))}`,pathParams:{"bucket-name":String(i[`bucket-name`]??``),domain:String(i.domain??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(i.domain))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function A(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Gets a list of all custom domains registered with an existing R2 bucket.`,builder:A,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets domains custom list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/domains/custom`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/domains/custom`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function M(e){return 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)`})}const N={command:`update <domain>`,describe:`Edit the configuration for a custom domain on an existing R2 bucket.`,builder:M,handler:async f=>{let p={};if(f[`cf-r2-jurisdiction`]!==void 0&&(p[`cf-r2-jurisdiction`]=String(f[`cf-r2-jurisdiction`])),f.dryRun){c({command:`cf r2 buckets domains custom update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${f[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(f[`bucket-name`]))}/domains/custom/${f.domain==null?`<domain>`:encodeURIComponent(String(f.domain))}`,pathParams:{"bucket-name":String(f[`bucket-name`]??``),domain:String(f.domain??``)},bodyKind:`json`,body:f.body===void 0?o({ciphers:f.ciphers,enabled:f.enabled,minTLS:u(f[`min-tls`],`min-tls`,`text`)}):i(f.body)});return}let m=await r(f),h=f.local?d:await e();if(f.accountId=h,f.body){let e=i(f.body);s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(f.domain))}`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`});return}let g={};f.ciphers!==void 0&&a(g,[`ciphers`],f.ciphers),f.enabled!==void 0&&a(g,[`enabled`],f.enabled),f[`min-tls`]!==void 0&&a(g,[`minTLS`],u(f[`min-tls`],`min-tls`,`text`)),s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(f.domain))}`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},P={command:`custom`,describe:`Operations for buckets.domains.custom`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.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})}const I={command:`list`,describe:`Gets state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:F,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets domains managed list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/domains/managed`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/domains/managed`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function L(e){return e.positional(`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(`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)`})}const R={command:`update <bucket-name>`,describe:`Updates state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:L,handler:async u=>{let f={};if(u[`cf-r2-jurisdiction`]!==void 0&&(f[`cf-r2-jurisdiction`]=String(u[`cf-r2-jurisdiction`])),u.dryRun){c({command:`cf r2 buckets domains managed update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${u[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(u[`bucket-name`]))}/domains/managed`,pathParams:{"bucket-name":String(u[`bucket-name`]??``)},bodyKind:`json`,body:u.body===void 0?o({enabled:u.enabled}):i(u.body)});return}let p=await r(u),m=u.local?d:await e();if(u.accountId=m,u.body){let e=i(u.body);s(await l(`Updating`,async()=>n(p,`PUT`,`/accounts/${m}/r2/buckets/${encodeURIComponent(String(u[`bucket-name`]))}/domains/managed`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`});return}if(u.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let h={};u.enabled!==void 0&&a(h,[`enabled`],u.enabled),s(await l(`Updating`,async()=>n(p,`PUT`,`/accounts/${m}/r2/buckets/${encodeURIComponent(String(u[`bucket-name`]))}/domains/managed`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},z={command:`managed`,describe:`Operations for buckets.domains.managed`,builder:e=>e.command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`domains`,describe:`Operations for buckets.domains`,builder:e=>e.command(P).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.positional(`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(`cf-r2-storage-class`,{type:`string`,description:`Storage class for newly uploaded objects, unless specified otherwise.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`edit <bucket-name>`,describe:`Updates properties of an existing R2 bucket.`,builder:V,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i[`cf-r2-storage-class`]!==void 0&&(a[`cf-r2-storage-class`]=String(i[`cf-r2-storage-class`])),i.dryRun){c({command:`cf r2 buckets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Updating`,async()=>n(o,`PATCH`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Updated`})}};function U(e){return e.positional(`queue-id`,{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)`})}const W={command:`delete <queue-id>`,describe:`Delete an event notification rule. **If no body is provided, all rules for specified queue will be deleted**.`,builder:U,handler:async u=>{let f={};if(u[`cf-r2-jurisdiction`]!==void 0&&(f[`cf-r2-jurisdiction`]=String(u[`cf-r2-jurisdiction`])),u.dryRun){c({command:`cf r2 buckets event-notifications delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/event_notifications/r2/${u[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(u[`bucket-name`]))}/configuration/queues/${u[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(u[`queue-id`]))}`,pathParams:{"queue-id":String(u[`queue-id`]??``),"bucket-name":String(u[`bucket-name`]??``)},bodyKind:`json`,body:u.body===void 0?o({ruleIds:u[`rule-ids`]}):i(u.body)});return}let p=await r(u),h=u.local?d:await e();if(u.accountId=h,!await m({force:!!u.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}if(u.body){let e=i(u.body);s(await l(`Deleting`,async()=>n(p,`DELETE`,`/accounts/${h}/event_notifications/r2/${encodeURIComponent(String(u[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(u[`queue-id`]))}`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Deleted`});return}let g={};u[`rule-ids`]!==void 0&&a(g,[`ruleIds`],u[`rule-ids`]),s(await l(`Deleting`,async()=>n(p,`DELETE`,`/accounts/${h}/event_notifications/r2/${encodeURIComponent(String(u[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(u[`queue-id`]))}`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Deleted`})}};function G(e){return e.positional(`queue-id`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <queue-id>`,describe:`Get a single event notification rule.`,builder:G,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets event-notifications get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/event_notifications/r2/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/configuration/queues/${i[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(i[`queue-id`]))}`,pathParams:{"queue-id":String(i[`queue-id`]??``),"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/event_notifications/r2/${encodeURIComponent(String(i[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(i[`queue-id`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function q(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`List all event notification rules for a bucket.`,builder:q,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets event-notifications list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/event_notifications/r2/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/configuration`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/event_notifications/r2/${encodeURIComponent(String(i[`bucket-name`]))}/configuration`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`queue-id`,{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)`})}const X={command:`update <queue-id>`,describe:`Create event notification rule.`,builder:Y,handler:async a=>{let o={};if(a[`cf-r2-jurisdiction`]!==void 0&&(o[`cf-r2-jurisdiction`]=String(a[`cf-r2-jurisdiction`])),a.dryRun){c({command:`cf r2 buckets event-notifications update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/event_notifications/r2/${a[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(a[`bucket-name`]))}/configuration/queues/${a[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(a[`queue-id`]))}`,pathParams:{"queue-id":String(a[`queue-id`]??``),"bucket-name":String(a[`bucket-name`]??``)},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/event_notifications/r2/${encodeURIComponent(String(a[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(a[`queue-id`]))}`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/event_notifications/r2/${encodeURIComponent(String(a[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(a[`queue-id`]))}`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}},Z={command:`event-notifications`,describe:`Operations for buckets.event-notifications`,builder:e=>e.command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.positional(`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})}const ne={command:`get <bucket-name>`,describe:`Gets properties of an existing R2 bucket.`,builder:Q,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function re(e){return e.positional(`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})}const ie={command:`get <bucket-name>`,describe:`Get object lifecycle rules for a bucket.`,builder:re,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets lifecycle get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/lifecycle`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/lifecycle`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`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)`})}const oe={command:`update <bucket-name>`,describe:`Set the object lifecycle rules for a bucket.`,builder:ae,handler:async a=>{let o={};if(a[`cf-r2-jurisdiction`]!==void 0&&(o[`cf-r2-jurisdiction`]=String(a[`cf-r2-jurisdiction`])),a.dryRun){c({command:`cf r2 buckets lifecycle update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${a[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(a[`bucket-name`]))}/lifecycle`,pathParams:{"bucket-name":String(a[`bucket-name`]??``)},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/lifecycle`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/lifecycle`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}},se={command:`lifecycle`,describe:`Operations for buckets.lifecycle`,builder:e=>e.command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`list`,describe:`Lists all R2 buckets on your account.`,builder:ce,handler:async i=>{let a={name_contains:i[`name-contains`],start_after:i[`start-after`],per_page:i[`per-page`],order:i.order,direction:i.direction,cursor:i.cursor},o={};if(i[`cf-r2-jurisdiction`]!==void 0&&(o[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets`,pathParams:{},query:a,bodyKind:`none`});return}let u=await r(i),f=i.local?d:await e();i.accountId=f,s(await l(`Loading`,async()=>n(u,`GET`,`/accounts/${f}/r2/buckets`,{query:a,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Loaded`})}};function ue(e){return e.positional(`bucket-name`,{type:`string`,description:`Name of the bucket.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`get <bucket-name>`,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:ue,handler:async n=>{if(n.dryRun){c({command:`cf r2 buckets local-uploads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${n[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(n[`bucket-name`]))}/local-uploads`,pathParams:{"bucket-name":String(n[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.r2.buckets.localUploads.get({account_id:a,bucket_name:n[`bucket-name`]})),{successLabel:`Loaded`})}};function fe(e){return e.positional(`bucket-name`,{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)`})}const pe={command:`update <bucket-name>`,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:fe,handler:async n=>{if(n.dryRun){c({command:`cf r2 buckets local-uploads update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${n[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(n[`bucket-name`]))}/local-uploads`,pathParams:{"bucket-name":String(n[`bucket-name`]??``)},bodyKind:`json`,body:n.body===void 0?o({enabled:n.enabled}):i(n.body)});return}let a=await r(n),u=n.local?d:await e();if(n.accountId=u,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.r2.buckets.localUploads.update({...e,account_id:u,bucket_name:n[`bucket-name`]})),{successLabel:`Updated`});return}if(n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let f=o({enabled:n.enabled});s(await l(`Updating`,async()=>a.r2.buckets.localUploads.update({...f,account_id:u,bucket_name:n[`bucket-name`]})),{successLabel:`Updated`})}},me={command:`local-uploads`,describe:`Operations for buckets.local-uploads`,builder:e=>e.command(de).command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.positional(`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})}const ge={command:`get <bucket-name>`,describe:`Get lock rules for a bucket.`,builder:he,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets locks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/lock`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/lock`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function _e(e){return e.positional(`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)`})}const ve={command:`update <bucket-name>`,describe:`Set lock rules for a bucket.`,builder:_e,handler:async a=>{let o={};if(a[`cf-r2-jurisdiction`]!==void 0&&(o[`cf-r2-jurisdiction`]=String(a[`cf-r2-jurisdiction`])),a.dryRun){c({command:`cf r2 buckets locks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${a[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(a[`bucket-name`]))}/lock`,pathParams:{"bucket-name":String(a[`bucket-name`]??``)},bodyKind:`json`,body:a.body===void 0?void 0:i(a.body)});return}let u=await r(a),f=a.local?d:await e();if(a.accountId=f,a.body){let e=i(a.body);s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/lock`,{body:e,headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n(u,`PUT`,`/accounts/${f}/r2/buckets/${encodeURIComponent(String(a[`bucket-name`]))}/lock`,{headers:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated`})}},ye={command:`locks`,describe:`Operations for buckets.locks`,builder:e=>e.command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={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:be,handler:async n=>{if(n.dryRun){c({command:`cf r2 buckets metrics list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/metrics`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.r2.buckets.metrics.list({account_id:a})),{successLabel:`Loaded`})}},Se={command:`metrics`,describe:`Operations for buckets.metrics`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.positional(`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})}const we={command:`delete <bucket-name>`,describe:`Disables Sippy on this bucket.`,builder:Ce,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets sippy delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();if(i.accountId=u,!await m({force:!!i.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}s(await l(`Deleting`,async()=>n(o,`DELETE`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/sippy`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function Te(e){return e.positional(`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})}const Ee={command:`get <bucket-name>`,describe:`Gets configuration for Sippy for an existing R2 bucket.`,builder:Te,handler:async i=>{let a={};if(i[`cf-r2-jurisdiction`]!==void 0&&(a[`cf-r2-jurisdiction`]=String(i[`cf-r2-jurisdiction`])),i.dryRun){c({command:`cf r2 buckets sippy get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${i[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(i[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(i[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(i),u=i.local?d:await e();i.accountId=u,s(await l(`Loading`,async()=>n(o,`GET`,`/accounts/${u}/r2/buckets/${encodeURIComponent(String(i[`bucket-name`]))}/sippy`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}};function De(e){return e.positional(`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(`destination-access-key-id`,{type:`string`,description:`ID of a Cloudflare API token.
|
|
8
|
-
This is the value labelled "Access Key ID" when creating an API.
|
|
9
|
-
token from the [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens).
|
|
10
|
-
|
|
11
|
-
Sippy will use this token when writing objects to R2, so it is
|
|
12
|
-
best to scope this token to the bucket you're enabling Sippy for.
|
|
13
|
-
`}).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.
|
|
14
|
-
This is the value labelled "Secret Access Key" when creating an API.
|
|
15
|
-
token from the [R2 dashboard](https://dash.cloudflare.com/?to=/:account/r2/api-tokens).
|
|
16
|
-
|
|
17
|
-
Sippy will use this token when writing objects to R2, so it is
|
|
18
|
-
best to scope this token to the bucket you're enabling Sippy for.
|
|
19
|
-
`}).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`])}const Oe={command:`update <bucket-name>`,describe:`Sets configuration for Sippy for an existing R2 bucket.`,builder:De,handler:async f=>{let p={};if(f[`cf-r2-jurisdiction`]!==void 0&&(p[`cf-r2-jurisdiction`]=String(f[`cf-r2-jurisdiction`])),f.dryRun){c({command:`cf r2 buckets sippy update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2/buckets/${f[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(f[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(f[`bucket-name`]??``)},bodyKind:`json`,body:f.body===void 0?o({destination:{accessKeyId:u(f[`destination-access-key-id`],`destination-access-key-id`,`text`),provider:u(f[`destination-provider`],`destination-provider`,`text`),secretAccessKey:u(f[`destination-secret-access-key`],`destination-secret-access-key`,`text`)},source:{accessKeyId:u(f[`source-access-key-id`],`source-access-key-id`,`text`),bucket:u(f[`source-bucket`],`source-bucket`,`text`),provider:u(f[`source-provider`],`source-provider`,`text`),region:u(f[`source-region`],`source-region`,`text`),secretAccessKey:u(f[`source-secret-access-key`],`source-secret-access-key`,`text`),clientEmail:u(f[`source-client-email`],`source-client-email`,`text`),privateKey:u(f[`source-private-key`],`source-private-key`,`text`),bucketUrl:u(f[`source-bucket-url`],`source-bucket-url`,`text`)}}):i(f.body)});return}let m=await r(f),h=f.local?d:await e();if(f.accountId=h,f.body){let e=i(f.body);s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/sippy`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`});return}let g={};f[`destination-access-key-id`]!==void 0&&a(g,[`destination`,`accessKeyId`],u(f[`destination-access-key-id`],`destination-access-key-id`,`text`)),f[`destination-provider`]!==void 0&&a(g,[`destination`,`provider`],u(f[`destination-provider`],`destination-provider`,`text`)),f[`destination-secret-access-key`]!==void 0&&a(g,[`destination`,`secretAccessKey`],u(f[`destination-secret-access-key`],`destination-secret-access-key`,`text`)),f[`source-access-key-id`]!==void 0&&a(g,[`source`,`accessKeyId`],u(f[`source-access-key-id`],`source-access-key-id`,`text`)),f[`source-bucket`]!==void 0&&a(g,[`source`,`bucket`],u(f[`source-bucket`],`source-bucket`,`text`)),f[`source-provider`]!==void 0&&a(g,[`source`,`provider`],u(f[`source-provider`],`source-provider`,`text`)),f[`source-region`]!==void 0&&a(g,[`source`,`region`],u(f[`source-region`],`source-region`,`text`)),f[`source-secret-access-key`]!==void 0&&a(g,[`source`,`secretAccessKey`],u(f[`source-secret-access-key`],`source-secret-access-key`,`text`)),f[`source-client-email`]!==void 0&&a(g,[`source`,`clientEmail`],u(f[`source-client-email`],`source-client-email`,`text`)),f[`source-private-key`]!==void 0&&a(g,[`source`,`privateKey`],u(f[`source-private-key`],`source-private-key`,`text`)),f[`source-bucket-url`]!==void 0&&a(g,[`source`,`bucketUrl`],u(f[`source-bucket-url`],`source-bucket-url`,`text`)),s(await l(`Updating`,async()=>n(m,`PUT`,`/accounts/${h}/r2/buckets/${encodeURIComponent(String(f[`bucket-name`]))}/sippy`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},ke={command:`sippy`,describe:`Operations for buckets.sippy`,builder:e=>e.command(we).command(Ee).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ae={command:`buckets`,describe:`Operations for buckets`,builder:e=>e.command(x).command(C).command(H).command(ne).command(le).command(y).command(B).command(Z).command(se).command(me).command(ye).command(Se).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.option(`bucket`,{type:`string`,description:`The bucket field`}).option(`endpoint`,{type:`string`,description:`Custom S3-compatible endpoint that must use https://.`}).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`])}const Me={command:`source`,describe:`Check whether tokens are valid against the source bucket`,builder:je,handler:async n=>{if(n.dryRun){c({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:n.body===void 0?o({bucket:u(n.bucket,`bucket`,`text`),endpoint:u(n.endpoint,`endpoint`,`text`),keys:n.keys,pathPrefix:u(n[`path-prefix`],`path-prefix`,`text`),region:u(n.region,`region`,`text`),secret:{accessKeyId:u(n[`secret-access-key-id`],`secret-access-key-id`,`text`),secretAccessKey:u(n[`secret-secret-access-key`],`secret-secret-access-key`,`text`),clientEmail:u(n[`secret-client-email`],`secret-client-email`,`text`),privateKey:u(n[`secret-private-key`],`secret-private-key`,`text`)},vendor:u(n.vendor,`vendor`,`text`),jurisdiction:u(n.jurisdiction,`jurisdiction`,`text`)}):i(n.body)});return}let a=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.r2.superSlurper.connectivityPrecheck.source({body:e,account_id:m})),{successLabel:`Updated`});return}n.bucket===void 0&&(n.bucket=await p(`bucket`,`The bucket field`)),n.vendor===void 0&&(n.vendor=await f(`vendor`,`The vendor field`,[`s3`,`gcs`,`r2`]));let h=o({bucket:u(n.bucket,`bucket`,`text`),endpoint:u(n.endpoint,`endpoint`,`text`),keys:n.keys,pathPrefix:u(n[`path-prefix`],`path-prefix`,`text`),region:u(n.region,`region`,`text`),secret:{accessKeyId:u(n[`secret-access-key-id`],`secret-access-key-id`,`text`),secretAccessKey:u(n[`secret-secret-access-key`],`secret-secret-access-key`,`text`),clientEmail:u(n[`secret-client-email`],`secret-client-email`,`text`),privateKey:u(n[`secret-private-key`],`secret-private-key`,`text`)},vendor:u(n.vendor,`vendor`,`text`),jurisdiction:u(n.jurisdiction,`jurisdiction`,`text`)});s(await l(`Updating`,async()=>a.r2.superSlurper.connectivityPrecheck.source({body:h,account_id:m})),{successLabel:`Updated`})}};function Ne(e){return 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)`})}const Pe={command:`target`,describe:`Check whether tokens are valid against the target bucket`,builder:Ne,handler:async n=>{if(n.dryRun){c({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:n.body===void 0?o({bucket:u(n.bucket,`bucket`,`text`),jurisdiction:u(n.jurisdiction,`jurisdiction`,`text`),secret:{accessKeyId:u(n[`secret-access-key-id`],`secret-access-key-id`,`text`),secretAccessKey:u(n[`secret-secret-access-key`],`secret-secret-access-key`,`text`)},vendor:u(n.vendor,`vendor`,`text`)}):i(n.body)});return}let a=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);s(await l(`Updating`,async()=>a.r2.superSlurper.connectivityPrecheck.target({body:e,account_id:m})),{successLabel:`Updated`});return}n.bucket===void 0&&(n.bucket=await p(`bucket`,`The bucket field`)),n[`secret-access-key-id`]===void 0&&(n[`secret-access-key-id`]=await p(`secret-access-key-id`,`The secret.accessKeyId field`)),n[`secret-secret-access-key`]===void 0&&(n[`secret-secret-access-key`]=await p(`secret-secret-access-key`,`The secret.secretAccessKey field`,{kind:`secret`})),n.vendor===void 0&&(n.vendor=await f(`vendor`,`The vendor field`,[`r2`]));let h=o({bucket:u(n.bucket,`bucket`,`text`),jurisdiction:u(n.jurisdiction,`jurisdiction`,`text`),secret:{accessKeyId:u(n[`secret-access-key-id`],`secret-access-key-id`,`text`),secretAccessKey:u(n[`secret-secret-access-key`],`secret-secret-access-key`,`text`)},vendor:u(n.vendor,`vendor`,`text`)});s(await l(`Updating`,async()=>a.r2.superSlurper.connectivityPrecheck.target({body:h,account_id:m})),{successLabel:`Updated`})}},Fe={command:`connectivity-precheck`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Le={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:Ie,handler:async n=>{if(n.dryRun){c({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`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation stops every running migration job.`})){process.stderr.write(`Aborted.
|
|
20
|
-
`);return}s(await l(`Deleting`,async()=>i.r2.superSlurper.jobs.abortAll({account_id:a})),{successLabel:`Deleted`})}};function Re(e){return e.positional(`job-id`,{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})}const ze={command:`abort <job-id>`,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:Re,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs abort`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/abort`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation stops a running migration job.`})){process.stderr.write(`Aborted.
|
|
21
|
-
`);return}s(await l(`Deleting`,async()=>i.r2.superSlurper.jobs.abort({account_id:a,job_id:n[`job-id`]})),{successLabel:`Deleted`})}};function Be(e){return 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:`Custom S3-compatible endpoint that must use https://.`}).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})}const Ve={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:Be,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({overwrite:n.overwrite,source:{bucket:u(n[`source-bucket`],`source-bucket`,`text`),endpoint:u(n[`source-endpoint`],`source-endpoint`,`text`),keys:n[`source-keys`],pathPrefix:u(n[`source-path-prefix`],`source-path-prefix`,`text`),region:u(n[`source-region`],`source-region`,`text`),secret:{accessKeyId:u(n[`source-secret-access-key-id`],`source-secret-access-key-id`,`text`),secretAccessKey:u(n[`source-secret-secret-access-key`],`source-secret-secret-access-key`,`text`),clientEmail:u(n[`source-secret-client-email`],`source-secret-client-email`,`text`),privateKey:u(n[`source-secret-private-key`],`source-secret-private-key`,`text`)},vendor:u(n[`source-vendor`],`source-vendor`,`text`),jurisdiction:u(n[`source-jurisdiction`],`source-jurisdiction`,`text`)},target:{bucket:u(n[`target-bucket`],`target-bucket`,`text`),jurisdiction:u(n[`target-jurisdiction`],`target-jurisdiction`,`text`),secret:{accessKeyId:u(n[`target-secret-access-key-id`],`target-secret-access-key-id`,`text`),secretAccessKey:u(n[`target-secret-secret-access-key`],`target-secret-secret-access-key`,`text`)},vendor:u(n[`target-vendor`],`target-vendor`,`text`)}}):i(n.body)});return}let a=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.r2.superSlurper.jobs.create({...e,account_id:f})),{successLabel:`Created`});return}let p=o({overwrite:n.overwrite,source:{bucket:u(n[`source-bucket`],`source-bucket`,`text`),endpoint:u(n[`source-endpoint`],`source-endpoint`,`text`),keys:n[`source-keys`],pathPrefix:u(n[`source-path-prefix`],`source-path-prefix`,`text`),region:u(n[`source-region`],`source-region`,`text`),secret:{accessKeyId:u(n[`source-secret-access-key-id`],`source-secret-access-key-id`,`text`),secretAccessKey:u(n[`source-secret-secret-access-key`],`source-secret-secret-access-key`,`text`),clientEmail:u(n[`source-secret-client-email`],`source-secret-client-email`,`text`),privateKey:u(n[`source-secret-private-key`],`source-secret-private-key`,`text`)},vendor:u(n[`source-vendor`],`source-vendor`,`text`),jurisdiction:u(n[`source-jurisdiction`],`source-jurisdiction`,`text`)},target:{bucket:u(n[`target-bucket`],`target-bucket`,`text`),jurisdiction:u(n[`target-jurisdiction`],`target-jurisdiction`,`text`),secret:{accessKeyId:u(n[`target-secret-access-key-id`],`target-secret-access-key-id`,`text`),secretAccessKey:u(n[`target-secret-secret-access-key`],`target-secret-secret-access-key`,`text`)},vendor:u(n[`target-vendor`],`target-vendor`,`text`)}});s(await l(`Creating`,async()=>a.r2.superSlurper.jobs.create({...p,account_id:f})),{successLabel:`Created`})}};function He(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ue={command:`get <job-id>`,describe:`Retrieves detailed status and configuration for a specific R2 Super Slurper migration job.`,builder:He,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.r2.superSlurper.jobs.get({account_id:a,job_id:n[`job-id`]})),{successLabel:`Loaded`})}};function We(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`list`,describe:`Lists all R2 Super Slurper migration jobs for the account with their status.`,builder:We,handler:async n=>{let i={limit:n.limit,offset:n.offset};if(n.dryRun){c({command:`cf r2 super-slurper jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.r2.superSlurper.jobs.list({account_id:o,...i})),{successLabel:`Loaded`})}};function Ke(e){return e.option(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qe={command:`list`,describe:`Gets log entries for an R2 Super Slurper migration job, showing migration status changes, errors, etc.`,builder:Ke,handler:async n=>{let i={limit:n.limit,offset:n.offset};if(n.dryRun){c({command:`cf r2 super-slurper jobs logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/logs`,pathParams:{"job-id":String(n[`job-id`]??``)},query:i,bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e();n.accountId=o,s(await l(`Loading`,async()=>a.r2.superSlurper.jobs.logs.list({account_id:o,job_id:n[`job-id`],...i})),{successLabel:`Loaded`})}},Je={command:`logs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`pause <job-id>`,describe:`Pauses a running R2 Super Slurper migration job. The job can be resumed later to continue transferring.`,builder:$,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs pause`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/pause`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Updating`,async()=>i.r2.superSlurper.jobs.pause({account_id:a,job_id:n[`job-id`]})),{successLabel:`Updated`})}};function Xe(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`progress <job-id>`,describe:`Retrieves current progress metrics for an R2 Super Slurper migration job`,builder:Xe,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs progress`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/progress`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Loading`,async()=>i.r2.superSlurper.jobs.progress({account_id:a,job_id:n[`job-id`]})),{successLabel:`Loaded`})}};function Qe(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $e={command:`resume <job-id>`,describe:`Resumes a paused R2 Super Slurper migration job, continuing the transfer from where it stopped.`,builder:Qe,handler:async n=>{if(n.dryRun){c({command:`cf r2 super-slurper jobs resume`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/slurper/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/resume`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,s(await l(`Updating`,async()=>i.r2.superSlurper.jobs.resume({account_id:a,job_id:n[`job-id`]})),{successLabel:`Updated`})}},et={command:`jobs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(ze).command(Le).command(Ve).command(Ue).command(Ge).command(Ye).command(Ze).command($e).command(Je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},tt={command:`super-slurper`,describe:`Operations for super-slurper`,builder:e=>e.command(Fe).command(et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nt(e){return 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)`})}const rt={command:`create`,describe:`Creates temporary access credentials on a bucket that can be optionally scoped to prefixes or objects.`,builder:nt,handler:async n=>{if(n.dryRun){c({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:n.body===void 0?o({bucket:u(n.bucket,`bucket`,`text`),objects:n.objects,parentAccessKeyId:u(n[`parent-access-key-id`],`parent-access-key-id`,`text`),permission:u(n.permission,`permission`,`text`),prefixes:n.prefixes,ttlSeconds:n[`ttl-seconds`]}):i(n.body)});return}let a=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);s(await l(`Creating`,async()=>a.r2.temporaryCredentials.create({...e,account_id:m})),{successLabel:`Created`});return}if(n.bucket===void 0&&(n.bucket=await p(`bucket`,`Name of the R2 bucket.`)),n[`parent-access-key-id`]===void 0&&(n[`parent-access-key-id`]=await p(`parent-access-key-id`,`The parent access key id to use for signing.`)),n.permission===void 0&&(n.permission=await f(`permission`,`Permissions allowed on the credentials.`,[`admin-read-write`,`admin-read-only`,`object-read-write`,`object-read-only`])),n[`ttl-seconds`]===void 0)throw Error(`--ttl-seconds is required (or pass --body with this field set).`);let h=o({bucket:u(n.bucket,`bucket`,`text`),objects:n.objects,parentAccessKeyId:u(n[`parent-access-key-id`],`parent-access-key-id`,`text`),permission:u(n.permission,`permission`,`text`),prefixes:n.prefixes,ttlSeconds:n[`ttl-seconds`]});s(await l(`Creating`,async()=>a.r2.temporaryCredentials.create({...h,account_id:m})),{successLabel:`Created`})}},it={command:`temporary-credentials`,describe:`Operations for temporary-credentials`,builder:e=>e.command(rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},at={command:`r2`,describe:`S3-compatible object storage with zero egress fees — buckets, lifecycle rules, event notifications, and data migration`,builder:e=>e.command(Ae).command(tt).command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{at as default};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{r as u,t as d}from"./prompt-q3B7sM2A.mjs";function f(e){return e.positional(`bucket-name`,{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.`})}const p={command:`create <bucket-name>`,describe:`Store authentication credentials for a catalog. These credentials are used to authenticate with R2 storage when performing catalog operations.`,builder:f,handler:async d=>{if(d.dryRun){o({command:`cf r2-data-catalog credentials create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${d[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(d[`bucket-name`]))}/credential`,pathParams:{"bucket-name":String(d[`bucket-name`]??``)},bodyKind:`json`,body:d.body===void 0?i({token:c(d.token,`token`,`text`)}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.r2DataCatalog.credentials.create({...e,account_id:p,bucket_name:d[`bucket-name`]})),{successLabel:`Created`});return}d.token===void 0&&(d.token=await u(`token`,`Provides the Cloudflare API token for accessing R2.`));let m=i({token:c(d.token,`token`,`text`)});a(await s(`Creating`,async()=>f.r2DataCatalog.credentials.create({...m,account_id:p,bucket_name:d[`bucket-name`]})),{successLabel:`Created`})}},m={command:`credentials`,describe:`Operations for credentials`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.positional(`bucket-name`,{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})}const g={command:`disable <bucket-name>`,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:h,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/disable`,pathParams:{"bucket-name":String(r[`bucket-name`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await d({force:!!r.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}a(await s(`Deleting`,async()=>i.r2DataCatalog.disable({account_id:c,bucket_name:r[`bucket-name`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`bucket-name`,{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})}const v={command:`enable <bucket-name>`,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:_,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/enable`,pathParams:{"bucket-name":String(r[`bucket-name`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Creating`,async()=>i.r2DataCatalog.enable({account_id:c,bucket_name:r[`bucket-name`]})),{successLabel:`Created`})}};function y(e){return e.positional(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <bucket-name>`,describe:`Retrieve detailed information about a specific R2 catalog by bucket name. Returns catalog status, maintenance configuration, and credential status.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}`,pathParams:{"bucket-name":String(r[`bucket-name`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.r2DataCatalog.get({account_id:c,bucket_name:r[`bucket-name`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`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:x,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog`,pathParams:{},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.r2DataCatalog.list({account_id:c})),{successLabel:`Loaded`})}};function C(e){return e.positional(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <bucket-name>`,describe:`Retrieve the maintenance configuration for a specific catalog, including compaction settings and credential status.`,builder:C,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog maintenance-configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(r[`bucket-name`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.r2DataCatalog.maintenanceConfigs.get({account_id:c,bucket_name:r[`bucket-name`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`bucket-name`,{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.`})}const E={command:`update <bucket-name>`,describe:`Update the maintenance configuration for a catalog. This allows you to enable or disable compaction and adjust target file sizes for optimization.`,builder:T,handler:async u=>{if(u.dryRun){o({command:`cf r2-data-catalog maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${u[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(u[`bucket-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(u[`bucket-name`]??``)},bodyKind:`json`,body:u.body===void 0?i({snapshot_expiration:{max_snapshot_age:c(u[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`),min_snapshots_to_keep:u[`snapshot-expiration-min-snapshots-to-keep`]}}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Creating`,async()=>d.r2DataCatalog.maintenanceConfigs.update({...e,account_id:f,bucket_name:u[`bucket-name`]})),{successLabel:`Created`});return}let p=i({snapshot_expiration:{max_snapshot_age:c(u[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`),min_snapshots_to_keep:u[`snapshot-expiration-min-snapshots-to-keep`]}});a(await s(`Creating`,async()=>d.r2DataCatalog.maintenanceConfigs.update({...p,account_id:f,bucket_name:u[`bucket-name`]})),{successLabel:`Created`})}},D={command:`maintenance-configs`,describe:`Operations for maintenance-configs`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return 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.
|
|
4
|
-
Use this to fetch the next page of results.`}).option(`page-size`,{type:`number`,description:`Maximum number of namespaces to return per page.
|
|
5
|
-
Defaults to 100, maximum 1000.`}).option(`parent`,{type:`string`,description:`Parent namespace to filter by. Only returns direct children of this namespace.
|
|
6
|
-
For nested namespaces, use %1F as separator (e.g., "bronze%1Fanalytics").
|
|
7
|
-
Omit this parameter to list top-level namespaces.`}).option(`return-uuids`,{type:`boolean`,description:`Whether to include namespace UUIDs in the response.
|
|
8
|
-
Set to true to receive the namespace_uuids array.`}).option(`return-details`,{type:`boolean`,description:`Whether to include additional metadata (timestamps).
|
|
9
|
-
When true, response includes created_at and updated_at arrays.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={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:O,handler:async r=>{let i={page_token:r[`page-token`],page_size:r[`page-size`],parent:r.parent,return_uuids:r[`return-uuids`],return_details:r[`return-details`]};if(r.dryRun){o({command:`cf r2-data-catalog namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/namespaces`,pathParams:{"bucket-name":String(r[`bucket-name`]??``)},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.r2DataCatalog.namespaces.list({account_id:u,bucket_name:r[`bucket-name`],...i})),{successLabel:`Loaded`})}};function A(e){return e.option(`bucket-name`,{type:`string`,description:`Specifies the R2 bucket name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`The namespace identifier.
|
|
10
|
-
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.
|
|
11
|
-
Use this to fetch the next page of results.`}).option(`page-size`,{type:`number`,description:`Maximum number of tables to return per page.
|
|
12
|
-
Defaults to 100, maximum 1000.`}).option(`return-uuids`,{type:`boolean`,description:`Whether to include table UUIDs in the response.
|
|
13
|
-
Set to true to receive the table_uuids array.`}).option(`return-details`,{type:`boolean`,description:`Whether to include additional metadata (timestamps, locations).
|
|
14
|
-
When true, response includes created_at, updated_at, metadata_locations, and locations arrays.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={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:A,handler:async r=>{let i={page_token:r[`page-token`],page_size:r[`page-size`],return_uuids:r[`return-uuids`],return_details:r[`return-details`]};if(r.dryRun){o({command:`cf r2-data-catalog namespaces tables list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/tables`,pathParams:{"bucket-name":String(r[`bucket-name`]??``),namespace:String(r.namespace??``)},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.r2DataCatalog.namespaces.tables.list({account_id:u,bucket_name:r[`bucket-name`],namespace:r.namespace,...i})),{successLabel:`Loaded`})}};function M(e){return e.positional(`table-name`,{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(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <table-name>`,describe:`Retrieve the maintenance configuration for a specific table, including compaction settings.`,builder:M,handler:async r=>{if(r.dryRun){o({command:`cf r2-data-catalog namespaces tables maintenance-configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${r[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(r[`bucket-name`]))}/namespaces/${r.namespace==null?`<namespace>`:encodeURIComponent(String(r.namespace))}/tables/${r[`table-name`]==null?`<table-name>`:encodeURIComponent(String(r[`table-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(r[`bucket-name`]??``),namespace:String(r.namespace??``),"table-name":String(r[`table-name`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.r2DataCatalog.namespaces.tables.maintenanceConfigs.get({account_id:c,bucket_name:r[`bucket-name`],namespace:r.namespace,table_name:r[`table-name`]})),{successLabel:`Loaded`})}};function P(e){return e.positional(`table-name`,{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.`})}const F={command:`update <table-name>`,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:P,handler:async u=>{if(u.dryRun){o({command:`cf r2-data-catalog namespaces tables maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/r2-catalog/${u[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(u[`bucket-name`]))}/namespaces/${u.namespace==null?`<namespace>`:encodeURIComponent(String(u.namespace))}/tables/${u[`table-name`]==null?`<table-name>`:encodeURIComponent(String(u[`table-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(u[`bucket-name`]??``),namespace:String(u.namespace??``),"table-name":String(u[`table-name`]??``)},bodyKind:`json`,body:u.body===void 0?i({snapshot_expiration:{max_snapshot_age:c(u[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`),min_snapshots_to_keep:u[`snapshot-expiration-min-snapshots-to-keep`]}}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Creating`,async()=>d.r2DataCatalog.namespaces.tables.maintenanceConfigs.update({...e,account_id:f,bucket_name:u[`bucket-name`],namespace:u.namespace,table_name:u[`table-name`]})),{successLabel:`Created`});return}let p=i({snapshot_expiration:{max_snapshot_age:c(u[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`),min_snapshots_to_keep:u[`snapshot-expiration-min-snapshots-to-keep`]}});a(await s(`Creating`,async()=>d.r2DataCatalog.namespaces.tables.maintenanceConfigs.update({...p,account_id:f,bucket_name:u[`bucket-name`],namespace:u.namespace,table_name:u[`table-name`]})),{successLabel:`Created`})}},I={command:`maintenance-configs`,describe:`Operations for namespaces.tables.maintenance-configs`,builder:e=>e.command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`tables`,describe:`Operations for namespaces.tables`,builder:e=>e.command(j).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`namespaces`,describe:`Operations for namespaces`,builder:e=>e.command(k).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={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(g).command(v).command(b).command(S).command(m).command(D).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
|