cf 0.2.0 → 0.3.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 +63 -62
- package/dist/_meta/commands.json +12365 -9690
- package/dist/_meta/schemas.json +19206 -15404
- package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
- package/dist/accounts-Kx1epdA1.mjs +22 -0
- package/dist/acm-Utu252kC.mjs +3 -0
- package/dist/addressing-CBq7Z7Vq.mjs +12 -0
- package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
- package/dist/ai-DOOKLPkG.mjs +2 -0
- package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
- package/dist/ai-search-CQF_Sn7d.mjs +7 -0
- package/dist/ai_gateway-C3fH22C0.mjs +4 -0
- package/dist/alerting-CqmEIaKn.mjs +6 -0
- package/dist/analytics-Dv-X8x7D.mjs +20 -0
- package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
- package/dist/api-gateway-CNv0IHTU.mjs +33 -0
- package/dist/argo-CX_A4kcn.mjs +2 -0
- package/dist/audit-logs-BfBf3oo-.mjs +2 -0
- package/dist/auth-SyWhMmPu.mjs +6 -0
- package/dist/auth-ffdf9yR0.mjs +135 -0
- package/dist/autorag-BuGhGTeZ.mjs +2 -0
- package/dist/billing-PoG81XaQ.mjs +2 -0
- package/dist/body-parser-DKa8Ipg1.mjs +2 -0
- package/dist/bot-management-CFvtVx62.mjs +5 -0
- package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
- package/dist/brand-protection-D05Eg-_6.mjs +3 -0
- package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
- package/dist/{build-5jmmOZhm.mjs → build-DYkGW4dh.mjs} +1 -1
- package/dist/cache-DsoW6Xwv.mjs +5 -0
- package/dist/calls-CZbO7TyR.mjs +4 -0
- package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
- package/dist/cli-types-CRIDdDw3.mjs +2 -0
- package/dist/client-certificates-MJcDsTId.mjs +3 -0
- package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
- package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
- package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
- package/dist/connectivity-BX8C7tvK.mjs +3 -0
- package/dist/content-scanning-r6uzMO1r.mjs +4 -0
- package/dist/context-DGlHRGWM.mjs +2 -0
- package/dist/custom-certificates-aAiEguR7.mjs +5 -0
- package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
- package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
- package/dist/custom-pages-DQCi2plU.mjs +4 -0
- package/dist/d1-DbnYhw45.mjs +4 -0
- package/dist/data-security-D_EtYBfo.mjs +6 -0
- package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
- package/dist/{deploy-DbkiIzUr.mjs → deploy-CQial3kN.mjs} +1 -1
- package/dist/{dev-C6iSuQZm.mjs → dev-B38LfCTl.mjs} +1 -1
- package/dist/diagnostics-BJQGjVJn.mjs +3 -0
- package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
- package/dist/{dist-CnSubA1Z.mjs → dist-AIcZFk0U.mjs} +7 -7
- package/dist/dns-VMhQSr5n.mjs +29 -0
- package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
- package/dist/durable-objects-CTboySEo.mjs +2 -0
- package/dist/email-routing-tIR2SFu-.mjs +10 -0
- package/dist/email-security-Ca1id3rZ.mjs +8 -0
- package/dist/email-sending-DwWKc5jC.mjs +3 -0
- package/dist/filters-A4dg_a68.mjs +4 -0
- package/dist/firewall-DWPQgYd9.mjs +11 -0
- package/dist/fraud-BMkSsJGU.mjs +20 -0
- package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
- package/dist/healthchecks-CtIfrFql.mjs +4 -0
- package/dist/hostnames-BiomxukN.mjs +3 -0
- package/dist/hyperdrive-Da104VaQ.mjs +18 -0
- package/dist/iam-BIGKo0WW.mjs +6 -0
- package/dist/images-BO8FbDAa.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-CY6_79v8.mjs +3 -0
- package/dist/{ips-B8fwxKZD.mjs → ips-K4bzaGqd.mjs} +1 -1
- package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
- package/dist/kv-8o27w_pY.mjs +5 -0
- package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
- package/dist/load-balancers-DtG8nj25.mjs +6 -0
- package/dist/logpush-4L0njy1d.mjs +4 -0
- package/dist/logs-B_Yp95hv.mjs +3 -0
- package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
- package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
- package/dist/magic-transit-CXDyvhxq.mjs +90 -0
- package/dist/managed-transforms-D15yVbZx.mjs +3 -0
- package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
- package/dist/network-interconnects-rrr7red3.mjs +36 -0
- package/dist/observability-DWvpqnQJ.mjs +4 -0
- package/dist/organizations-T77D50Sq.mjs +41 -0
- package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
- package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
- package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
- package/dist/output-BJFNwj7b.mjs +2 -0
- package/dist/page-rules-CjZPTMQX.mjs +18 -0
- package/dist/page-shield-D5RRNJCY.mjs +37 -0
- package/dist/pages-CWJtJnL0.mjs +11 -0
- package/dist/pipelines-B0L_7j9e.mjs +6 -0
- package/dist/{progress-CjcQ6ato.mjs → progress-CrCGTq7N.mjs} +1 -1
- package/dist/queues-CN6DPhRR.mjs +6 -0
- package/dist/r2-DQIcyRtA.mjs +21 -0
- package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
- package/dist/radar-Bxb0WX8V.mjs +2 -0
- package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
- package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
- package/dist/realtime-kit-CaquuVOE.mjs +18 -0
- package/dist/registrar-Ko-xZemf.mjs +46 -0
- package/dist/request-tracers-DOW_reTJ.mjs +2 -0
- package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
- package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
- package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
- package/dist/rules-BXRADHL5.mjs +4 -0
- package/dist/rulesets-CBgpeSvJ.mjs +8 -0
- package/dist/rum-BjPptTUP.mjs +4 -0
- package/dist/{schema-CHBfkARI.mjs → schema-D16TgWBg.mjs} +1 -1
- package/dist/schema-validation-Dgv_opM3.mjs +24 -0
- package/dist/scim-DdSEr4kZ.mjs +3 -0
- package/dist/secrets-store-7BfyvJLb.mjs +25 -0
- package/dist/security-center-DAy6AKtT.mjs +2 -0
- package/dist/security-txt-xAMb7K6Y.mjs +3 -0
- package/dist/session-COHHdS7A.mjs +5 -0
- package/dist/{shared-DEzmTsEC.mjs → shared-AGtpXwwL.mjs} +1 -1
- package/dist/smart-shield-TeWZFnH2.mjs +3 -0
- package/dist/snippets-CCSsCXVs.mjs +4 -0
- package/dist/{spawn-13QQ0IwO.mjs → spawn-DcppKGI5.mjs} +1 -1
- package/dist/spectrum-CTTZID8u.mjs +63 -0
- package/dist/speed-CuzTE0AL.mjs +4 -0
- package/dist/{src-B9cKsgsg.mjs → src-BW6vfAwE.mjs} +10 -10
- package/dist/ssl-BWA2LdwC.mjs +15 -0
- package/dist/stream-GFsIZ-pP.mjs +14 -0
- package/dist/tenants-Bd7NGQ_m.mjs +2 -0
- package/dist/token-validation-DAgtFOvs.mjs +10 -0
- package/dist/{tools-B7QiNu-d.mjs → tools-DXQmfFuE.mjs} +1 -1
- package/dist/turnstile-cfdaO4ca.mjs +23 -0
- package/dist/{ui-BXjU1dX1.mjs → ui-D4KtlMh9.mjs} +1 -1
- package/dist/url-normalization-B5RN4nLD.mjs +3 -0
- package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
- package/dist/user-CAo-yCJA.mjs +10 -0
- package/dist/vectorize-C7_oQlaI.mjs +4 -0
- package/dist/{versions-DzyrlUAi.mjs → versions-CUwWJWmy.mjs} +1 -1
- package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
- package/dist/web3-HQJRm38W.mjs +4 -0
- package/dist/workers-Dg7ddG2Q.mjs +18 -0
- package/dist/workers-builds-AVfx8IyL.mjs +7 -0
- package/dist/workflows-VquuSh2J.mjs +4 -0
- package/dist/zaraz-xYSWIV4P.mjs +2 -0
- package/dist/zero-trust-CP96wnSh.mjs +118 -0
- package/dist/zones-BSgmZ9WC.mjs +21 -0
- package/package.json +4 -3
- package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
- package/dist/accounts-BopMfODC.mjs +0 -21
- package/dist/acm-BT4vlnEJ.mjs +0 -3
- package/dist/addressing-B3uFxHst.mjs +0 -13
- package/dist/ai-DWHqwMap.mjs +0 -2
- package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
- package/dist/ai-search-VnOQ5n--.mjs +0 -7
- package/dist/alerting-BmmgIlIO.mjs +0 -6
- package/dist/analytics-isY03taL.mjs +0 -20
- package/dist/api-gateway-DXurEbA-.mjs +0 -33
- package/dist/argo-B02BL_hp.mjs +0 -2
- package/dist/audit-logs-DcgR9xUc.mjs +0 -2
- package/dist/auth-CQcAgnOy.mjs +0 -135
- package/dist/auth-DenWm_X0.mjs +0 -6
- package/dist/autorag-CmrwnGVj.mjs +0 -2
- package/dist/billing-CaW1ZAB1.mjs +0 -2
- package/dist/body-parser-Br-BoYk-.mjs +0 -2
- package/dist/bot-management-CeBsFx68.mjs +0 -5
- package/dist/botnet-feed-B396vQeQ.mjs +0 -3
- package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
- package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
- package/dist/builds-C_ySULja.mjs +0 -2
- package/dist/cache-DmXizSMi.mjs +0 -5
- package/dist/calls-x4KQpTB4.mjs +0 -4
- package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
- package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
- package/dist/cloud-connector-BClQpEzI.mjs +0 -2
- package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
- package/dist/connectivity-G0NP6LtW.mjs +0 -3
- package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
- package/dist/context-CC0Rhkhy.mjs +0 -2
- package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
- package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
- package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
- package/dist/custom-pages-D-oErw57.mjs +0 -4
- package/dist/d1-C95ckPKI.mjs +0 -3
- package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
- package/dist/diagnostics-DEEhPnXj.mjs +0 -3
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
- package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
- package/dist/dns-qW-3TZOT.mjs +0 -29
- package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
- package/dist/email-routing-tdNJaCpJ.mjs +0 -10
- package/dist/email-security-DTVHNr2h.mjs +0 -60
- package/dist/email-sending-DsFTvE31.mjs +0 -3
- package/dist/filters-DO1Is_tI.mjs +0 -4
- package/dist/firewall-DbUhVTCg.mjs +0 -11
- package/dist/fraud-Bzr4njYb.mjs +0 -8
- package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
- package/dist/healthchecks-BBAs-lS_.mjs +0 -4
- package/dist/hostnames-Dz9PEUKS.mjs +0 -3
- package/dist/hyperdrive-B1iUJddG.mjs +0 -18
- package/dist/iam-CJM8gHpG.mjs +0 -6
- package/dist/images-DEoBmtFS.mjs +0 -5
- package/dist/intel-BM6xkZ0C.mjs +0 -3
- package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
- package/dist/kv-BTceLtWZ.mjs +0 -5
- package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
- package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
- package/dist/logpush-CSYhgevA.mjs +0 -4
- package/dist/logs-DlIwmMpt.mjs +0 -3
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
- package/dist/magic-transit-qQmA-981.mjs +0 -89
- package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
- package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
- package/dist/network-interconnects-CxG2deY0.mjs +0 -36
- package/dist/organizations-DyEAiGiR.mjs +0 -41
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
- package/dist/output-D7_yAFVR.mjs +0 -2
- package/dist/page-rules-DP-w6TAm.mjs +0 -18
- package/dist/page-shield-Bf7kFp8c.mjs +0 -37
- package/dist/pages-D0Y_XRqW.mjs +0 -10
- package/dist/pipelines-C-SPESAk.mjs +0 -6
- package/dist/queues-wv6CZsi8.mjs +0 -6
- package/dist/r2-DuXjp9n5.mjs +0 -21
- package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
- package/dist/radar-BW_ZHP8X.mjs +0 -2
- package/dist/rate-limits-DLTkIvwr.mjs +0 -5
- package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
- package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
- package/dist/registrar-DIIv6fWd.mjs +0 -46
- package/dist/request-tracers-DMej0Drs.mjs +0 -2
- package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
- package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
- package/dist/rules-DLJpOYbC.mjs +0 -4
- package/dist/rulesets-D9nqEJT5.mjs +0 -8
- package/dist/rum-DBVmdPkp.mjs +0 -4
- package/dist/schema-validation-MCd3xdtX.mjs +0 -4
- package/dist/scim-DZA3VXog.mjs +0 -3
- package/dist/scm-CilfPOue.mjs +0 -2
- package/dist/secrets-store-BrvcZSOM.mjs +0 -21
- package/dist/security-center-BU6f3Cm1.mjs +0 -2
- package/dist/security-txt-BPIbP3dG.mjs +0 -3
- package/dist/session-H7IV2BrM.mjs +0 -2
- package/dist/smart-shield-e8XFBkiF.mjs +0 -3
- package/dist/snippets-B4M3MMb8.mjs +0 -4
- package/dist/spectrum-B0adfSRI.mjs +0 -59
- package/dist/speed-BVcUtkAz.mjs +0 -4
- package/dist/ssl-BAa91gsc.mjs +0 -15
- package/dist/stream-D53sxKb3.mjs +0 -14
- package/dist/tenants-bH5pt3dJ.mjs +0 -2
- package/dist/token-validation-M61Vx_Tw.mjs +0 -4
- package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
- package/dist/url-normalization-DZrWDgB5.mjs +0 -3
- package/dist/url-scanner-Zo49edNp.mjs +0 -2
- package/dist/user-DbXlVReB.mjs +0 -10
- package/dist/vectorize-CUnTM0DT.mjs +0 -4
- package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
- package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
- package/dist/web3-DueyOQtx.mjs +0 -4
- package/dist/workers-builds-BM_aoeUR.mjs +0 -7
- package/dist/workers-nV_vBCfV.mjs +0 -16
- package/dist/workflows-CQITmo-s.mjs +0 -4
- package/dist/zaraz-DIbpF5Op.mjs +0 -2
- package/dist/zero-trust-CKp8j512.mjs +0 -119
- package/dist/zones-BZ5tZDbH.mjs +0 -28
- /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
package/dist/r2-DuXjp9n5.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(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 m={command:`delete <bucket-name>`,describe:`Delete the CORS policy for a bucket.`,builder:p,handler:async t=>{let i={};if(t[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(t[`cf-r2-jurisdiction`])),t.dryRun){l({command:`cf r2 buckets cors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(t[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(t),s=t.local?f:await n(o);if(t.accountId=s,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await u(`Deleting`,async()=>o.delete(`/accounts/${s}/r2/buckets/${encodeURIComponent(String(t[`bucket-name`]))}/cors`,{headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`})}};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})}const ee={command:`get <bucket-name>`,describe:`Get the CORS policy for a bucket.`,builder:h,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets cors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/cors`,{headers:Object.keys(t).length>0?t: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 g={command:`update <bucket-name>`,describe:`Set the CORS policy for a bucket.`,builder:te,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets cors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/cors`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{body:e.body}});return}let i=await r(e),o=e.local?f:await n(i);if(e.accountId=o,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/cors`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/cors`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},_={command:`cors`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(m).command(ee).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(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 y={command:`create`,describe:`Creates a new R2 bucket.`,builder:v,handler:async e=>{let i={};if(e[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets`,pathParams:{},bodyKind:`json`,body:{"location-hint":e[`location-hint`],name:e.name,"storage-class":e[`storage-class`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/buckets`,{body:t,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`Name of the bucket.`));let h={};e[`location-hint`]!==void 0&&o(h,[`locationHint`],d(e[`location-hint`],`location-hint`,`text`)),e.name!==void 0&&o(h,[`name`],d(e.name,`name`,`text`)),e[`storage-class`]!==void 0&&o(h,[`storageClass`],d(e[`storage-class`],`storage-class`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/buckets`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}};function b(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 x={command:`delete <bucket-name>`,describe:`Deletes an existing R2 bucket.`,builder:b,handler:async t=>{let i={};if(t[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(t[`cf-r2-jurisdiction`])),t.dryRun){l({command:`cf r2 buckets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}`,pathParams:{"bucket-name":String(t[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(t),s=t.local?f:await n(o);if(t.accountId=s,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}c(await u(`Deleting`,async()=>o.delete(`/accounts/${s}/r2/buckets/${encodeURIComponent(String(t[`bucket-name`]))}`,{headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`})}};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(`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 C={command:`create <bucket-name>`,describe:`Register a new custom domain for an existing R2 bucket.`,builder:S,handler:async e=>{let i={};if(e[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains custom create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/custom`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{ciphers:e.ciphers,domain:e.domain,enabled:e.enabled,"min-tls":e[`min-tls`],"zone-id":e[`zone-id`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom`,{body:t,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`});return}if(e.domain===void 0&&(e.domain=await t(`domain`,`Name of the custom domain to be added.`)),e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);e[`zone-id`]===void 0&&(e[`zone-id`]=await t(`zone-id`,`Zone ID of the custom domain.`));let h={};e.ciphers!==void 0&&o(h,[`ciphers`],e.ciphers),e.domain!==void 0&&o(h,[`domain`],d(e.domain,`domain`,`text`)),e.enabled!==void 0&&o(h,[`enabled`],e.enabled),e[`min-tls`]!==void 0&&o(h,[`minTLS`],d(e[`min-tls`],`min-tls`,`text`)),e[`zone-id`]!==void 0&&o(h,[`zoneId`],d(e[`zone-id`],`zone-id`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}};function w(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 T={command:`delete <domain>`,describe:`Remove custom domain registration from an existing R2 bucket.`,builder:w,handler:async t=>{let i={};if(t[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(t[`cf-r2-jurisdiction`])),t.dryRun){l({command:`cf r2 buckets domains custom delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}/domains/custom/${t.domain==null?`<domain>`:encodeURIComponent(String(t.domain))}`,pathParams:{"bucket-name":String(t[`bucket-name`]??``),domain:String(t.domain??``)},bodyKind:`none`});return}let o=await r(t),s=t.local?f:await n(o);if(t.accountId=s,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}c(await u(`Deleting`,async()=>o.delete(`/accounts/${s}/r2/buckets/${encodeURIComponent(String(t[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(t.domain))}`,{headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`})}};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})}const D={command:`get <domain>`,describe:`Get the configuration for a custom domain on an existing R2 bucket.`,builder:E,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains custom get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/custom/${e.domain==null?`<domain>`:encodeURIComponent(String(e.domain))}`,pathParams:{"bucket-name":String(e[`bucket-name`]??``),domain:String(e.domain??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(e.domain))}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};function O(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 k={command:`list`,describe:`Gets a list of all custom domains registered with an existing R2 bucket.`,builder:O,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains custom list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/custom`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};function A(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 j={command:`update <domain>`,describe:`Edit the configuration for a custom domain on an existing R2 bucket.`,builder:A,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains custom update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/custom/${e.domain==null?`<domain>`:encodeURIComponent(String(e.domain))}`,pathParams:{"bucket-name":String(e[`bucket-name`]??``),domain:String(e.domain??``)},bodyKind:`json`,body:{ciphers:e.ciphers,enabled:e.enabled,"min-tls":e[`min-tls`],body:e.body}});return}let i=await r(e),p=e.local?f:await n(i);if(e.accountId=p,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${p}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(e.domain))}`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}let m={};e.ciphers!==void 0&&o(m,[`ciphers`],e.ciphers),e.enabled!==void 0&&o(m,[`enabled`],e.enabled),e[`min-tls`]!==void 0&&o(m,[`minTLS`],d(e[`min-tls`],`min-tls`,`text`)),c(await u(`Updating`,async()=>i.put(`/accounts/${p}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/custom/${encodeURIComponent(String(e.domain))}`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},M={command:`custom`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.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 P={command:`list`,describe:`Gets state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:N,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains managed list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/managed`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/managed`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};function F(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 I={command:`update <bucket-name>`,describe:`Updates state of public access over the bucket's R2-managed (r2.dev) domain.`,builder:F,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets domains managed update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/domains/managed`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let i=await r(e),d=e.local?f:await n(i);if(e.accountId=d,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${d}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/managed`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let p={};e.enabled!==void 0&&o(p,[`enabled`],e.enabled),c(await u(`Updating`,async()=>i.put(`/accounts/${d}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/domains/managed`,{body:Object.keys(p).length>0?p:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},L={command:`managed`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`domains`,describe:`Operations for buckets.domains`,builder:e=>e.command(M).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(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:`The cf-r2-storage-class header`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`edit <bucket-name>`,describe:`Updates properties of an existing R2 bucket.`,builder:z,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e[`cf-r2-storage-class`]!==void 0&&(t[`cf-r2-storage-class`]=String(e[`cf-r2-storage-class`])),e.dryRun){l({command:`cf r2 buckets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Updating`,async()=>i.patch(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}};function V(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 H={command:`delete <queue-id>`,describe:`Delete an event notification rule. **If no body is provided, all rules for specified queue will be deleted**.`,builder:V,handler:async t=>{let i={};if(t[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(t[`cf-r2-jurisdiction`])),t.dryRun){l({command:`cf r2 buckets event-notifications delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/event_notifications/r2/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}/configuration/queues/${t[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(t[`queue-id`]))}`,pathParams:{"queue-id":String(t[`queue-id`]??``),"bucket-name":String(t[`bucket-name`]??``)},bodyKind:`json`,body:{"rule-ids":t[`rule-ids`],body:t.body}});return}let d=await r(t),p=t.local?f:await n(d);if(t.accountId=p,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>d.delete(`/accounts/${p}/event_notifications/r2/${encodeURIComponent(String(t[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(t[`queue-id`]))}`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`});return}let m={};t[`rule-ids`]!==void 0&&o(m,[`ruleIds`],t[`rule-ids`]),c(await u(`Deleting`,async()=>d.delete(`/accounts/${p}/event_notifications/r2/${encodeURIComponent(String(t[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(t[`queue-id`]))}`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`})}};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:`The bucket jurisdiction.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`get <queue-id>`,describe:`Get a single event notification rule.`,builder:U,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets event-notifications get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/event_notifications/r2/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/configuration/queues/${e[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(e[`queue-id`]))}`,pathParams:{"queue-id":String(e[`queue-id`]??``),"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/event_notifications/r2/${encodeURIComponent(String(e[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(e[`queue-id`]))}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};function G(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 K={command:`list`,describe:`List all event notification rules for a bucket.`,builder:G,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets event-notifications list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/event_notifications/r2/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/configuration`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/event_notifications/r2/${encodeURIComponent(String(e[`bucket-name`]))}/configuration`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};function q(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 J={command:`update <queue-id>`,describe:`Create event notification rule.`,builder:q,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets event-notifications update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/event_notifications/r2/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/configuration/queues/${e[`queue-id`]==null?`<queue-id>`:encodeURIComponent(String(e[`queue-id`]))}`,pathParams:{"queue-id":String(e[`queue-id`]??``),"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{body:e.body}});return}let i=await r(e),o=e.local?f:await n(i);if(e.accountId=o,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${o}/event_notifications/r2/${encodeURIComponent(String(e[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(e[`queue-id`]))}`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i.put(`/accounts/${o}/event_notifications/r2/${encodeURIComponent(String(e[`bucket-name`]))}/configuration/queues/${encodeURIComponent(String(e[`queue-id`]))}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},Y={command:`event-notifications`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(H).command(W).command(K).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(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 Z={command:`get <bucket-name>`,describe:`Gets properties of an existing R2 bucket.`,builder:X,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};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:`Get object lifecycle rules for a bucket.`,builder:Q,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets lifecycle get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/lifecycle`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lifecycle`,{headers:Object.keys(t).length>0?t: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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`update <bucket-name>`,describe:`Set the object lifecycle rules for a bucket.`,builder:re,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets lifecycle update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/lifecycle`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{body:e.body}});return}let i=await r(e),o=e.local?f:await n(i);if(e.accountId=o,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lifecycle`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lifecycle`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},ae={command:`lifecycle`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(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 se={command:`list`,describe:`Lists all R2 buckets on your account.`,builder:oe,handler:async e=>{let t={name_contains:e[`name-contains`],start_after:e[`start-after`],per_page:e[`per-page`],order:e.order,direction:e.direction,cursor:e.cursor},i={};if(e[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets`,pathParams:{},query:t,bodyKind:`none`});return}let o=await r(e),s=e.local?f:await n(o);e.accountId=s,c(await u(`Loading`,async()=>o.get(`/accounts/${s}/r2/buckets`,{query:t,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Loaded`})}};function ce(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 le={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:ce,handler:async e=>{if(e.dryRun){l({command:`cf r2 buckets local-uploads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/local-uploads`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.r2.buckets.localUploads.get(e[`bucket-name`],i)),{successLabel:`Loaded`})}};function ue(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 de={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:ue,handler:async e=>{if(e.dryRun){l({command:`cf r2 buckets local-uploads update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/local-uploads`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${i}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/local-uploads`,{body:n})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d={};e.enabled!==void 0&&o(d,[`enabled`],e.enabled),c(await u(`Updating`,async()=>t.put(`/accounts/${i}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/local-uploads`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},fe={command:`local-uploads`,describe:`R2 bucket local upload configuration`,builder:e=>e.command(le).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(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 me={command:`get <bucket-name>`,describe:`Get lock rules for a bucket.`,builder:pe,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets locks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/lock`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lock`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Loaded`})}};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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`update <bucket-name>`,describe:`Set lock rules for a bucket.`,builder:he,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets locks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/lock`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{body:e.body}});return}let i=await r(e),o=e.local?f:await n(i);if(e.accountId=o,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lock`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i.put(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/lock`,{headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},_e={command:`locks`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(me).command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={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:ve,handler:async e=>{if(e.dryRun){l({command:`cf r2 buckets metrics list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/metrics`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.r2.buckets.metrics.list(i)),{successLabel:`Loaded`})}},be={command:`metrics`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(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 Se={command:`delete <bucket-name>`,describe:`Disables Sippy on this bucket.`,builder:xe,handler:async t=>{let i={};if(t[`cf-r2-jurisdiction`]!==void 0&&(i[`cf-r2-jurisdiction`]=String(t[`cf-r2-jurisdiction`])),t.dryRun){l({command:`cf r2 buckets sippy delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(t[`bucket-name`]??``)},bodyKind:`none`});return}let o=await r(t),s=t.local?f:await n(o);if(t.accountId=s,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}c(await u(`Deleting`,async()=>o.delete(`/accounts/${s}/r2/buckets/${encodeURIComponent(String(t[`bucket-name`]))}/sippy`,{headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Deleted`})}};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})}const we={command:`get <bucket-name>`,describe:`Gets configuration for Sippy for an existing R2 bucket.`,builder:Ce,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets sippy get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.get(`/accounts/${o}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/sippy`,{headers:Object.keys(t).length>0?t: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(`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 Ee={command:`update <bucket-name>`,describe:`Sets configuration for Sippy for an existing R2 bucket.`,builder:Te,handler:async e=>{let t={};if(e[`cf-r2-jurisdiction`]!==void 0&&(t[`cf-r2-jurisdiction`]=String(e[`cf-r2-jurisdiction`])),e.dryRun){l({command:`cf r2 buckets sippy update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/buckets/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/sippy`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{"destination-access-key-id":e[`destination-access-key-id`],"destination-provider":e[`destination-provider`],"destination-secret-access-key":e[`destination-secret-access-key`],"source-access-key-id":e[`source-access-key-id`],"source-bucket":e[`source-bucket`],"source-provider":e[`source-provider`],"source-region":e[`source-region`],"source-secret-access-key":e[`source-secret-access-key`],"source-client-email":e[`source-client-email`],"source-private-key":e[`source-private-key`],"source-bucket-url":e[`source-bucket-url`],body:e.body}});return}let i=await r(e),p=e.local?f:await n(i);if(e.accountId=p,e.body){let n=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${p}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/sippy`,{body:n,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`});return}let m={};e[`destination-access-key-id`]!==void 0&&o(m,[`destination`,`accessKeyId`],d(e[`destination-access-key-id`],`destination-access-key-id`,`text`)),e[`destination-provider`]!==void 0&&o(m,[`destination`,`provider`],d(e[`destination-provider`],`destination-provider`,`text`)),e[`destination-secret-access-key`]!==void 0&&o(m,[`destination`,`secretAccessKey`],d(e[`destination-secret-access-key`],`destination-secret-access-key`,`text`)),e[`source-access-key-id`]!==void 0&&o(m,[`source`,`accessKeyId`],d(e[`source-access-key-id`],`source-access-key-id`,`text`)),e[`source-bucket`]!==void 0&&o(m,[`source`,`bucket`],d(e[`source-bucket`],`source-bucket`,`text`)),e[`source-provider`]!==void 0&&o(m,[`source`,`provider`],d(e[`source-provider`],`source-provider`,`text`)),e[`source-region`]!==void 0&&o(m,[`source`,`region`],d(e[`source-region`],`source-region`,`text`)),e[`source-secret-access-key`]!==void 0&&o(m,[`source`,`secretAccessKey`],d(e[`source-secret-access-key`],`source-secret-access-key`,`text`)),e[`source-client-email`]!==void 0&&o(m,[`source`,`clientEmail`],d(e[`source-client-email`],`source-client-email`,`text`)),e[`source-private-key`]!==void 0&&o(m,[`source`,`privateKey`],d(e[`source-private-key`],`source-private-key`,`text`)),e[`source-bucket-url`]!==void 0&&o(m,[`source`,`bucketUrl`],d(e[`source-bucket-url`],`source-bucket-url`,`text`)),c(await u(`Updating`,async()=>i.put(`/accounts/${p}/r2/buckets/${encodeURIComponent(String(e[`bucket-name`]))}/sippy`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(t).length>0?t:void 0})),{successLabel:`Updated`})}},De={command:`sippy`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(Se).command(we).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Oe={command:`buckets`,describe:`Create and configure R2 buckets including CORS, lifecycle, custom domains, event notifications, and object locks`,builder:e=>e.command(y).command(x).command(B).command(Z).command(se).command(_).command(R).command(Y).command(ae).command(fe).command(_e).command(be).command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.option(`bucket`,{type:`string`,description:`The bucket field`}).option(`endpoint`,{type:`string`,description:`The endpoint field`}).option(`keys`,{type:`string`,array:!0,description:`The keys field`}).option(`path-prefix`,{type:`string`,description:`The pathPrefix field`}).option(`region`,{type:`string`,description:`The region field`}).option(`secret-access-key-id`,{type:`string`,description:`The secret.accessKeyId field`}).option(`secret-secret-access-key`,{type:`string`,description:`The secret.secretAccessKey field`}).option(`secret-client-email`,{type:`string`,description:`The secret.clientEmail field`}).option(`secret-private-key`,{type:`string`,description:`The secret.privateKey field`}).option(`vendor`,{type:`string`,description:`The vendor field`,choices:[`s3`,`gcs`,`r2`]}).option(`jurisdiction`,{type:`string`,description:`The jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`endpoint`,[`secret-client-email`,`secret-private-key`,`jurisdiction`]).conflicts(`region`,[`secret-client-email`,`secret-private-key`,`jurisdiction`]).conflicts(`secret-access-key-id`,[`secret-client-email`,`secret-private-key`]).conflicts(`secret-secret-access-key`,[`secret-client-email`,`secret-private-key`]).conflicts(`secret-client-email`,[`endpoint`,`region`,`secret-access-key-id`,`secret-secret-access-key`,`jurisdiction`]).conflicts(`secret-private-key`,[`endpoint`,`region`,`secret-access-key-id`,`secret-secret-access-key`,`jurisdiction`]).conflicts(`jurisdiction`,[`endpoint`,`region`,`secret-client-email`,`secret-private-key`])}const Ae={command:`source`,describe:`Check whether tokens are valid against the source bucket`,builder:ke,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper connectivity-precheck source`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/source/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:{bucket:e.bucket,endpoint:e.endpoint,keys:e.keys,"path-prefix":e[`path-prefix`],region:e.region,"secret-access-key-id":e[`secret-access-key-id`],"secret-secret-access-key":e[`secret-secret-access-key`],"secret-client-email":e[`secret-client-email`],"secret-private-key":e[`secret-private-key`],vendor:e.vendor,jurisdiction:e.jurisdiction,body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Updating`,async()=>p.put(`/accounts/${m}/slurper/source/connectivity-precheck`,{body:t})),{successLabel:`Updated`});return}e.bucket===void 0&&(e.bucket=await t(`bucket`,`The bucket field`)),e.vendor===void 0&&(e.vendor=await i(`vendor`,`The vendor field`,[`s3`,`gcs`,`r2`]));let h={};e.bucket!==void 0&&o(h,[`bucket`],d(e.bucket,`bucket`,`text`)),e.endpoint!==void 0&&o(h,[`endpoint`],d(e.endpoint,`endpoint`,`text`)),e.keys!==void 0&&o(h,[`keys`],e.keys),e[`path-prefix`]!==void 0&&o(h,[`pathPrefix`],d(e[`path-prefix`],`path-prefix`,`text`)),e.region!==void 0&&o(h,[`region`],d(e.region,`region`,`text`)),e[`secret-access-key-id`]!==void 0&&o(h,[`secret`,`accessKeyId`],d(e[`secret-access-key-id`],`secret-access-key-id`,`text`)),e[`secret-secret-access-key`]!==void 0&&o(h,[`secret`,`secretAccessKey`],d(e[`secret-secret-access-key`],`secret-secret-access-key`,`text`)),e[`secret-client-email`]!==void 0&&o(h,[`secret`,`clientEmail`],d(e[`secret-client-email`],`secret-client-email`,`text`)),e[`secret-private-key`]!==void 0&&o(h,[`secret`,`privateKey`],d(e[`secret-private-key`],`secret-private-key`,`text`)),e.vendor!==void 0&&o(h,[`vendor`],d(e.vendor,`vendor`,`text`)),e.jurisdiction!==void 0&&o(h,[`jurisdiction`],d(e.jurisdiction,`jurisdiction`,`text`)),c(await u(`Updating`,async()=>p.put(`/accounts/${m}/slurper/source/connectivity-precheck`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}};function je(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 Me={command:`target`,describe:`Check whether tokens are valid against the target bucket`,builder:je,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper connectivity-precheck target`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/target/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:{bucket:e.bucket,jurisdiction:e.jurisdiction,"secret-access-key-id":e[`secret-access-key-id`],"secret-secret-access-key":e[`secret-secret-access-key`],vendor:e.vendor,body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Updating`,async()=>p.put(`/accounts/${m}/slurper/target/connectivity-precheck`,{body:t})),{successLabel:`Updated`});return}e.bucket===void 0&&(e.bucket=await t(`bucket`,`The bucket field`)),e[`secret-access-key-id`]===void 0&&(e[`secret-access-key-id`]=await t(`secret-access-key-id`,`The secret.accessKeyId field`)),e[`secret-secret-access-key`]===void 0&&(e[`secret-secret-access-key`]=await t(`secret-secret-access-key`,`The secret.secretAccessKey field`,{kind:`secret`})),e.vendor===void 0&&(e.vendor=await i(`vendor`,`The vendor field`,[`r2`]));let h={};e.bucket!==void 0&&o(h,[`bucket`],d(e.bucket,`bucket`,`text`)),e.jurisdiction!==void 0&&o(h,[`jurisdiction`],d(e.jurisdiction,`jurisdiction`,`text`)),e[`secret-access-key-id`]!==void 0&&o(h,[`secret`,`accessKeyId`],d(e[`secret-access-key-id`],`secret-access-key-id`,`text`)),e[`secret-secret-access-key`]!==void 0&&o(h,[`secret`,`secretAccessKey`],d(e[`secret-secret-access-key`],`secret-secret-access-key`,`text`)),e.vendor!==void 0&&o(h,[`vendor`],d(e.vendor,`vendor`,`text`)),c(await u(`Updating`,async()=>p.put(`/accounts/${m}/slurper/target/connectivity-precheck`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},Ne={command:`connectivity-precheck`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(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 Fe={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:Pe,handler:async t=>{if(t.dryRun){l({command:`cf r2 super-slurper jobs abort-all`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/abortAll`,pathParams:{},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force,message:`This operation stops every running migration job.`})){process.stderr.write(`Aborted.
|
|
20
|
-
`);return}c(await u(`Deleting`,async()=>i.r2.superSlurper.jobs.abortAll(o)),{successLabel:`Deleted`})}};function Ie(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 Le={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:Ie,handler:async t=>{if(t.dryRun){l({command:`cf r2 super-slurper jobs abort`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}/abort`,pathParams:{"job-id":String(t[`job-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force,message:`This operation stops a running migration job.`})){process.stderr.write(`Aborted.
|
|
21
|
-
`);return}c(await u(`Deleting`,async()=>i.r2.superSlurper.jobs.abort(o,t[`job-id`])),{successLabel:`Deleted`})}};function Re(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:`The source.endpoint field`}).option(`source-keys`,{type:`string`,array:!0,description:`The source.keys field`}).option(`source-path-prefix`,{type:`string`,description:`The source.pathPrefix field`}).option(`source-region`,{type:`string`,description:`The source.region field`}).option(`source-secret-access-key-id`,{type:`string`,description:`The source.secret.accessKeyId field`}).option(`source-secret-secret-access-key`,{type:`string`,description:`The source.secret.secretAccessKey field`}).option(`source-secret-client-email`,{type:`string`,description:`The source.secret.clientEmail field`}).option(`source-secret-private-key`,{type:`string`,description:`The source.secret.privateKey field`}).option(`source-vendor`,{type:`string`,description:`The source.vendor field`,choices:[`s3`,`gcs`,`r2`]}).option(`source-jurisdiction`,{type:`string`,description:`The source.jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`target-bucket`,{type:`string`,description:`The target.bucket field`}).option(`target-jurisdiction`,{type:`string`,description:`The target.jurisdiction field`,choices:[`default`,`eu`,`fedramp`]}).option(`target-secret-access-key-id`,{type:`string`,description:`The target.secret.accessKeyId field`}).option(`target-secret-secret-access-key`,{type:`string`,description:`The target.secret.secretAccessKey field`}).option(`target-vendor`,{type:`string`,description:`The target.vendor field`,choices:[`r2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`source-endpoint`,[`source-secret-client-email`,`source-secret-private-key`,`source-jurisdiction`]).conflicts(`source-region`,[`source-secret-client-email`,`source-secret-private-key`,`source-jurisdiction`]).conflicts(`source-secret-access-key-id`,[`source-secret-client-email`,`source-secret-private-key`]).conflicts(`source-secret-secret-access-key`,[`source-secret-client-email`,`source-secret-private-key`]).conflicts(`source-secret-client-email`,[`source-endpoint`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-jurisdiction`]).conflicts(`source-secret-private-key`,[`source-endpoint`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-jurisdiction`]).conflicts(`source-jurisdiction`,[`source-endpoint`,`source-region`,`source-secret-client-email`,`source-secret-private-key`]).check(e=>{if([`source-bucket`,`source-endpoint`,`source-keys`,`source-path-prefix`,`source-region`,`source-secret-access-key-id`,`source-secret-secret-access-key`,`source-secret-client-email`,`source-secret-private-key`,`source-vendor`,`source-jurisdiction`].some(t=>e[t]!==void 0)){let t=[`source-bucket`,`source-vendor`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --source-* flag is set`)}return!0}).check(e=>{if([`target-bucket`,`target-jurisdiction`,`target-secret-access-key-id`,`target-secret-secret-access-key`,`target-vendor`].some(t=>e[t]!==void 0)){let t=[`target-bucket`,`target-secret-access-key-id`,`target-secret-secret-access-key`,`target-vendor`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --target-* flag is set`)}return!0})}const ze={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:Re,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs`,pathParams:{},bodyKind:`json`,body:{overwrite:e.overwrite,"source-bucket":e[`source-bucket`],"source-endpoint":e[`source-endpoint`],"source-keys":e[`source-keys`],"source-path-prefix":e[`source-path-prefix`],"source-region":e[`source-region`],"source-secret-access-key-id":e[`source-secret-access-key-id`],"source-secret-secret-access-key":e[`source-secret-secret-access-key`],"source-secret-client-email":e[`source-secret-client-email`],"source-secret-private-key":e[`source-secret-private-key`],"source-vendor":e[`source-vendor`],"source-jurisdiction":e[`source-jurisdiction`],"target-bucket":e[`target-bucket`],"target-jurisdiction":e[`target-jurisdiction`],"target-secret-access-key-id":e[`target-secret-access-key-id`],"target-secret-secret-access-key":e[`target-secret-secret-access-key`],"target-vendor":e[`target-vendor`],body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/slurper/jobs`,{body:n})),{successLabel:`Created`});return}let p={};e.overwrite!==void 0&&o(p,[`overwrite`],e.overwrite),e[`source-bucket`]!==void 0&&o(p,[`source`,`bucket`],d(e[`source-bucket`],`source-bucket`,`text`)),e[`source-endpoint`]!==void 0&&o(p,[`source`,`endpoint`],d(e[`source-endpoint`],`source-endpoint`,`text`)),e[`source-keys`]!==void 0&&o(p,[`source`,`keys`],e[`source-keys`]),e[`source-path-prefix`]!==void 0&&o(p,[`source`,`pathPrefix`],d(e[`source-path-prefix`],`source-path-prefix`,`text`)),e[`source-region`]!==void 0&&o(p,[`source`,`region`],d(e[`source-region`],`source-region`,`text`)),e[`source-secret-access-key-id`]!==void 0&&o(p,[`source`,`secret`,`accessKeyId`],d(e[`source-secret-access-key-id`],`source-secret-access-key-id`,`text`)),e[`source-secret-secret-access-key`]!==void 0&&o(p,[`source`,`secret`,`secretAccessKey`],d(e[`source-secret-secret-access-key`],`source-secret-secret-access-key`,`text`)),e[`source-secret-client-email`]!==void 0&&o(p,[`source`,`secret`,`clientEmail`],d(e[`source-secret-client-email`],`source-secret-client-email`,`text`)),e[`source-secret-private-key`]!==void 0&&o(p,[`source`,`secret`,`privateKey`],d(e[`source-secret-private-key`],`source-secret-private-key`,`text`)),e[`source-vendor`]!==void 0&&o(p,[`source`,`vendor`],d(e[`source-vendor`],`source-vendor`,`text`)),e[`source-jurisdiction`]!==void 0&&o(p,[`source`,`jurisdiction`],d(e[`source-jurisdiction`],`source-jurisdiction`,`text`)),e[`target-bucket`]!==void 0&&o(p,[`target`,`bucket`],d(e[`target-bucket`],`target-bucket`,`text`)),e[`target-jurisdiction`]!==void 0&&o(p,[`target`,`jurisdiction`],d(e[`target-jurisdiction`],`target-jurisdiction`,`text`)),e[`target-secret-access-key-id`]!==void 0&&o(p,[`target`,`secret`,`accessKeyId`],d(e[`target-secret-access-key-id`],`target-secret-access-key-id`,`text`)),e[`target-secret-secret-access-key`]!==void 0&&o(p,[`target`,`secret`,`secretAccessKey`],d(e[`target-secret-secret-access-key`],`target-secret-secret-access-key`,`text`)),e[`target-vendor`]!==void 0&&o(p,[`target`,`vendor`],d(e[`target-vendor`],`target-vendor`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/slurper/jobs`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function Be(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 Ve={command:`get <job-id>`,describe:`Retrieves detailed status and configuration for a specific R2 Super Slurper migration job.`,builder:Be,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.r2.superSlurper.jobs.get(i,e[`job-id`])),{successLabel:`Loaded`})}};function He(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 Ue={command:`list`,describe:`Lists all R2 Super Slurper migration jobs for the account with their status.`,builder:He,handler:async e=>{let t={limit:e.limit,offset:e.offset};if(e.dryRun){l({command:`cf r2 super-slurper jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.r2.superSlurper.jobs.list(o,t)),{successLabel:`Loaded`})}};function We(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 Ge={command:`list`,describe:`Gets log entries for an R2 Super Slurper migration job, showing migration status changes, errors, etc.`,builder:We,handler:async e=>{let t={limit:e.limit,offset:e.offset};if(e.dryRun){l({command:`cf r2 super-slurper jobs logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/logs`,pathParams:{"job-id":String(e[`job-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.r2.superSlurper.jobs.logs.list(o,e[`job-id`],t)),{successLabel:`Loaded`})}},Ke={command:`logs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};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 Je={command:`pause <job-id>`,describe:`Pauses a running R2 Super Slurper migration job. The job can be resumed later to continue transferring.`,builder:qe,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper jobs pause`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/pause`,pathParams:{"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Updating`,async()=>t.r2.superSlurper.jobs.pause(i,e[`job-id`])),{successLabel:`Updated`})}};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:`progress <job-id>`,describe:`Retrieves current progress metrics for an R2 Super Slurper migration job`,builder:$,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper jobs progress`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/progress`,pathParams:{"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.r2.superSlurper.jobs.progress(i,e[`job-id`])),{successLabel:`Loaded`})}};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:`resume <job-id>`,describe:`Resumes a paused R2 Super Slurper migration job, continuing the transfer from where it stopped.`,builder:Xe,handler:async e=>{if(e.dryRun){l({command:`cf r2 super-slurper jobs resume`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/slurper/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/resume`,pathParams:{"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Updating`,async()=>t.r2.superSlurper.jobs.resume(i,e[`job-id`])),{successLabel:`Updated`})}},Qe={command:`jobs`,describe:`Migrate data from external S3-compatible storage into R2 buckets with resumable transfer jobs`,builder:e=>e.command(Le).command(Fe).command(ze).command(Ve).command(Ue).command(Je).command(Ye).command(Ze).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`super-slurper`,describe:`Operations for super-slurper`,builder:e=>e.command(Ne).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(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 tt={command:`create`,describe:`Creates temporary access credentials on a bucket that can be optionally scoped to prefixes or objects.`,builder:et,handler:async e=>{if(e.dryRun){l({command:`cf r2 temporary-credentials create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/r2/temp-access-credentials`,pathParams:{},bodyKind:`json`,body:{bucket:e.bucket,objects:e.objects,"parent-access-key-id":e[`parent-access-key-id`],permission:e.permission,prefixes:e.prefixes,"ttl-seconds":e[`ttl-seconds`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/temp-access-credentials`,{body:t})),{successLabel:`Created`});return}if(e.bucket===void 0&&(e.bucket=await t(`bucket`,`Name of the R2 bucket.`)),e[`parent-access-key-id`]===void 0&&(e[`parent-access-key-id`]=await t(`parent-access-key-id`,`The parent access key id to use for signing.`)),e.permission===void 0&&(e.permission=await i(`permission`,`Permissions allowed on the credentials.`,[`admin-read-write`,`admin-read-only`,`object-read-write`,`object-read-only`])),e[`ttl-seconds`]===void 0)throw Error(`--ttl-seconds is required (or pass --body with this field set).`);let h={};e.bucket!==void 0&&o(h,[`bucket`],d(e.bucket,`bucket`,`text`)),e.objects!==void 0&&o(h,[`objects`],e.objects),e[`parent-access-key-id`]!==void 0&&o(h,[`parentAccessKeyId`],d(e[`parent-access-key-id`],`parent-access-key-id`,`text`)),e.permission!==void 0&&o(h,[`permission`],d(e.permission,`permission`,`text`)),e.prefixes!==void 0&&o(h,[`prefixes`],e.prefixes),e[`ttl-seconds`]!==void 0&&o(h,[`ttlSeconds`],e[`ttl-seconds`]),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/r2/temp-access-credentials`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},nt={command:`temporary-credentials`,describe:`Generate short-lived S3-compatible credentials scoped to specific buckets and operations`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},rt={command:`r2`,describe:`S3-compatible object storage with zero egress fees — buckets, lifecycle rules, event notifications, and data migration`,builder:e=>e.command(Oe).command($e).command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{rt as default};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog credentials create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/credential`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{token:e.token,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/credential`,{body:t})),{successLabel:`Created`});return}e.token===void 0&&(e.token=await t(`token`,`Provides the Cloudflare API token for accessing R2.`));let m={};e.token!==void 0&&a(m,[`token`],u(e.token,`token`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/credential`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},m={command:`credentials`,describe:`Catalog access credentials for external query engines (Spark, Trino, etc.)`,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 t=>{if(t.dryRun){c({command:`cf r2-data-catalog disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${t[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(t[`bucket-name`]))}/disable`,pathParams:{"bucket-name":String(t[`bucket-name`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force,message:`This operation turns off the data catalog for the bucket. Existing namespace or table state remains, but writes stop.`})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>a.r2DataCatalog.disable(o,t[`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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/enable`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.r2DataCatalog.enable(a,e[`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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.r2DataCatalog.get(a,e[`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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.r2DataCatalog.list(a)),{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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog maintenance-configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.r2DataCatalog.maintenanceConfigs.get(a,e[`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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},bodyKind:`json`,body:{"snapshot-expiration-max-snapshot-age":e[`snapshot-expiration-max-snapshot-age`],"snapshot-expiration-min-snapshots-to-keep":e[`snapshot-expiration-min-snapshots-to-keep`],body:e.body}});return}let t=await r(e),f=e.local?d:await n(t);if(e.accountId=f,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${f}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/maintenance-configs`,{body:n})),{successLabel:`Created`});return}let p={};e[`snapshot-expiration-max-snapshot-age`]!==void 0&&a(p,[`snapshot_expiration`,`max_snapshot_age`],u(e[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`)),e[`snapshot-expiration-min-snapshots-to-keep`]!==void 0&&a(p,[`snapshot_expiration`,`min_snapshots_to_keep`],e[`snapshot-expiration-min-snapshots-to-keep`]),s(await l(`Creating`,async()=>t.post(`/accounts/${f}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/maintenance-configs`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},D={command:`maintenance-configs`,describe:`Table maintenance settings — compaction schedules and snapshot expiration policies`,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 e=>{let t={page_token:e[`page-token`],page_size:e[`page-size`],parent:e.parent,return_uuids:e[`return-uuids`],return_details:e[`return-details`]};if(e.dryRun){c({command:`cf r2-data-catalog namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/namespaces`,pathParams:{"bucket-name":String(e[`bucket-name`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.r2DataCatalog.namespaces.list(o,e[`bucket-name`],t)),{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 e=>{let t={page_token:e[`page-token`],page_size:e[`page-size`],return_uuids:e[`return-uuids`],return_details:e[`return-details`]};if(e.dryRun){c({command:`cf r2-data-catalog namespaces tables list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/tables`,pathParams:{"bucket-name":String(e[`bucket-name`]??``),namespace:String(e.namespace??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.r2DataCatalog.namespaces.tables.list(o,e[`bucket-name`],e.namespace,t)),{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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog namespaces tables maintenance-configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/tables/${e[`table-name`]==null?`<table-name>`:encodeURIComponent(String(e[`table-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(e[`bucket-name`]??``),namespace:String(e.namespace??``),"table-name":String(e[`table-name`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.r2DataCatalog.namespaces.tables.maintenanceConfigs.get(a,e[`bucket-name`],e.namespace,e[`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 e=>{if(e.dryRun){c({command:`cf r2-data-catalog namespaces tables maintenance-configs update`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/r2-catalog/${e[`bucket-name`]==null?`<bucket-name>`:encodeURIComponent(String(e[`bucket-name`]))}/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/tables/${e[`table-name`]==null?`<table-name>`:encodeURIComponent(String(e[`table-name`]))}/maintenance-configs`,pathParams:{"bucket-name":String(e[`bucket-name`]??``),namespace:String(e.namespace??``),"table-name":String(e[`table-name`]??``)},bodyKind:`json`,body:{"snapshot-expiration-max-snapshot-age":e[`snapshot-expiration-max-snapshot-age`],"snapshot-expiration-min-snapshots-to-keep":e[`snapshot-expiration-min-snapshots-to-keep`],body:e.body}});return}let t=await r(e),f=e.local?d:await n(t);if(e.accountId=f,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${f}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/namespaces/${encodeURIComponent(String(e.namespace))}/tables/${encodeURIComponent(String(e[`table-name`]))}/maintenance-configs`,{body:n})),{successLabel:`Created`});return}let p={};e[`snapshot-expiration-max-snapshot-age`]!==void 0&&a(p,[`snapshot_expiration`,`max_snapshot_age`],u(e[`snapshot-expiration-max-snapshot-age`],`snapshot-expiration-max-snapshot-age`,`text`)),e[`snapshot-expiration-min-snapshots-to-keep`]!==void 0&&a(p,[`snapshot_expiration`,`min_snapshots_to_keep`],e[`snapshot-expiration-min-snapshots-to-keep`]),s(await l(`Creating`,async()=>t.post(`/accounts/${f}/r2-catalog/${encodeURIComponent(String(e[`bucket-name`]))}/namespaces/${encodeURIComponent(String(e.namespace))}/tables/${encodeURIComponent(String(e[`table-name`]))}/maintenance-configs`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},I={command:`maintenance-configs`,describe:`Logical namespaces that group related tables within the data catalog`,builder:e=>e.command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`tables`,describe:`Logical namespaces that group related tables within the data catalog`,builder:e=>e.command(j).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`namespaces`,describe:`Logical namespaces that group related tables within the data catalog`,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};
|