cf 0.0.6 → 0.2.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/README.md +2 -4
- package/bin/cf +11 -0
- package/dist/_meta/agent-context.json +89 -89
- package/dist/_meta/commands.json +12866 -4982
- package/dist/_meta/schemas.json +33572 -1148
- package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
- package/dist/accounts-BopMfODC.mjs +21 -0
- package/dist/acm-BT4vlnEJ.mjs +3 -0
- package/dist/addressing-B3uFxHst.mjs +13 -0
- package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
- package/dist/ai-DWHqwMap.mjs +2 -0
- package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
- package/dist/ai-search-VnOQ5n--.mjs +7 -0
- package/dist/alerting-BmmgIlIO.mjs +6 -0
- package/dist/analytics-isY03taL.mjs +20 -0
- package/dist/api-gateway-DXurEbA-.mjs +33 -0
- package/dist/argo-B02BL_hp.mjs +2 -0
- package/dist/audit-logs-DcgR9xUc.mjs +2 -0
- package/dist/auth-CQcAgnOy.mjs +135 -0
- package/dist/auth-DenWm_X0.mjs +6 -0
- package/dist/autorag-CmrwnGVj.mjs +2 -0
- package/dist/billing-CaW1ZAB1.mjs +2 -0
- package/dist/body-parser-Br-BoYk-.mjs +2 -0
- package/dist/bot-management-CeBsFx68.mjs +5 -0
- package/dist/botnet-feed-B396vQeQ.mjs +3 -0
- package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
- package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
- package/dist/build-5jmmOZhm.mjs +1054 -0
- package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
- package/dist/cache-DmXizSMi.mjs +5 -0
- package/dist/calls-x4KQpTB4.mjs +4 -0
- package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
- package/dist/chunk-DH-VkVmc.mjs +2 -0
- package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
- package/dist/cloud-connector-BClQpEzI.mjs +2 -0
- package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
- package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
- package/dist/config-DYzlVxcB.mjs +2 -0
- package/dist/connectivity-G0NP6LtW.mjs +3 -0
- package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
- package/dist/context-CC0Rhkhy.mjs +2 -0
- package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
- package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
- package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
- package/dist/custom-pages-D-oErw57.mjs +4 -0
- package/dist/d1-C95ckPKI.mjs +3 -0
- package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
- package/dist/delegate.mjs +2 -0
- package/dist/deploy-DbkiIzUr.mjs +2 -0
- package/dist/dev-C6iSuQZm.mjs +6 -0
- package/dist/diagnostics-DEEhPnXj.mjs +3 -0
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
- package/dist/dist-CnSubA1Z.mjs +82 -0
- package/dist/dist-DNBSHor6.mjs +301 -0
- package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
- package/dist/dns-qW-3TZOT.mjs +29 -0
- package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
- package/dist/email-routing-tdNJaCpJ.mjs +10 -0
- package/dist/email-security-DTVHNr2h.mjs +60 -0
- package/dist/email-sending-DsFTvE31.mjs +3 -0
- package/dist/filters-DO1Is_tI.mjs +4 -0
- package/dist/firewall-DbUhVTCg.mjs +11 -0
- package/dist/fraud-Bzr4njYb.mjs +8 -0
- package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
- package/dist/healthchecks-BBAs-lS_.mjs +4 -0
- package/dist/hostnames-Dz9PEUKS.mjs +3 -0
- package/dist/hyperdrive-B1iUJddG.mjs +18 -0
- package/dist/iam-CJM8gHpG.mjs +6 -0
- package/dist/images-DEoBmtFS.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/input-validation-zEO81MWN.mjs +2 -0
- package/dist/intel-BM6xkZ0C.mjs +3 -0
- package/dist/ips-B8fwxKZD.mjs +2 -0
- package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
- package/dist/kv-BTceLtWZ.mjs +5 -0
- package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
- package/dist/lib-Eu1wXxuh.mjs +68 -0
- package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
- package/dist/local-VJaJ3BZ1.mjs +2 -0
- package/dist/logpush-CSYhgevA.mjs +4 -0
- package/dist/logs-DlIwmMpt.mjs +3 -0
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
- package/dist/magic-transit-qQmA-981.mjs +89 -0
- package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
- package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
- package/dist/network-interconnects-CxG2deY0.mjs +36 -0
- package/dist/organizations-DyEAiGiR.mjs +41 -0
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
- package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
- package/dist/page-rules-DP-w6TAm.mjs +18 -0
- package/dist/page-shield-Bf7kFp8c.mjs +37 -0
- package/dist/pages-D0Y_XRqW.mjs +10 -0
- package/dist/pipelines-C-SPESAk.mjs +6 -0
- package/dist/progress-CjcQ6ato.mjs +2 -0
- package/dist/queues-wv6CZsi8.mjs +6 -0
- package/dist/r2-DuXjp9n5.mjs +21 -0
- package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
- package/dist/radar-BW_ZHP8X.mjs +2 -0
- package/dist/rate-limits-DLTkIvwr.mjs +5 -0
- package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
- package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
- package/dist/registrar-DIIv6fWd.mjs +46 -0
- package/dist/request-tracers-DMej0Drs.mjs +2 -0
- package/dist/resolve-BuJRWSk0.mjs +2 -0
- package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
- package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
- package/dist/rules-DLJpOYbC.mjs +4 -0
- package/dist/rulesets-D9nqEJT5.mjs +8 -0
- package/dist/rum-DBVmdPkp.mjs +4 -0
- package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
- package/dist/schema-validation-MCd3xdtX.mjs +4 -0
- package/dist/scim-DZA3VXog.mjs +3 -0
- package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
- package/dist/secrets-store-BrvcZSOM.mjs +21 -0
- package/dist/security-center-BU6f3Cm1.mjs +2 -0
- package/dist/security-txt-BPIbP3dG.mjs +3 -0
- package/dist/session-H7IV2BrM.mjs +2 -0
- package/dist/shared-DEzmTsEC.mjs +2 -0
- package/dist/smart-shield-e8XFBkiF.mjs +3 -0
- package/dist/snippets-B4M3MMb8.mjs +4 -0
- package/dist/spawn-13QQ0IwO.mjs +10 -0
- package/dist/spectrum-B0adfSRI.mjs +59 -0
- package/dist/speed-BVcUtkAz.mjs +4 -0
- package/dist/src-B9cKsgsg.mjs +108 -0
- package/dist/ssl-BAa91gsc.mjs +15 -0
- package/dist/stream-D53sxKb3.mjs +14 -0
- package/dist/tenants-bH5pt3dJ.mjs +2 -0
- package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
- package/dist/token-validation-M61Vx_Tw.mjs +4 -0
- package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
- package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
- package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
- package/dist/url-normalization-DZrWDgB5.mjs +3 -0
- package/dist/url-scanner-Zo49edNp.mjs +2 -0
- package/dist/user-DbXlVReB.mjs +10 -0
- package/dist/vectorize-CUnTM0DT.mjs +4 -0
- package/dist/versions-DzyrlUAi.mjs +2 -0
- package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
- package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
- package/dist/web3-DueyOQtx.mjs +4 -0
- package/dist/workers-builds-BM_aoeUR.mjs +7 -0
- package/dist/workers-nV_vBCfV.mjs +16 -0
- package/dist/workflows-CQITmo-s.mjs +4 -0
- package/dist/zaraz-DIbpF5Op.mjs +2 -0
- package/dist/zero-trust-CKp8j512.mjs +119 -0
- package/dist/zones-BZ5tZDbH.mjs +28 -0
- package/package.json +13 -3
- package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
- package/dist/accounts-BjGtCB8T.mjs +0 -6
- package/dist/acm-h4YPDN7k.mjs +0 -3
- package/dist/addressing-BiEnQ1o1.mjs +0 -11
- package/dist/ai-BPln2Yka.mjs +0 -2
- package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
- package/dist/ai-search-EjrONI5a.mjs +0 -7
- package/dist/alerting-CPWMKr-m.mjs +0 -6
- package/dist/analytics-3dX9-scQ.mjs +0 -2
- package/dist/api-gateway-7FKFHdI-.mjs +0 -9
- package/dist/argo-Dxz9P37E.mjs +0 -2
- package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
- package/dist/auth-BHD_B2p9.mjs +0 -277
- package/dist/auth-caVo2j1K.mjs +0 -6
- package/dist/autorag-D7nMweNF.mjs +0 -2
- package/dist/billing-yaIBp1Xq.mjs +0 -2
- package/dist/body-parser-iA3vRFmh.mjs +0 -2
- package/dist/bot-management-C0H6U0t4.mjs +0 -2
- package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
- package/dist/brand-protection-CI0NQa_l.mjs +0 -3
- package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
- package/dist/cache-B6M_pm_D.mjs +0 -5
- package/dist/calls-C5XCC0i1.mjs +0 -4
- package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
- package/dist/client-certificates-CwpzEnCT.mjs +0 -3
- package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
- package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
- package/dist/config-BmTd_qeU.mjs +0 -2
- package/dist/connectivity-C4tXPkW_.mjs +0 -3
- package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
- package/dist/context-6lBIck1r.mjs +0 -2
- package/dist/custom-certificates-pllRyU2y.mjs +0 -3
- package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
- package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
- package/dist/custom-pages-XWwfn7hV.mjs +0 -4
- package/dist/d1-c_zhZGWf.mjs +0 -3
- package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
- package/dist/dev-Bu26u5Jm.mjs +0 -14
- package/dist/diagnostics-BU07Jnku.mjs +0 -3
- package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
- package/dist/dns-CrvIxztB.mjs +0 -11
- package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
- package/dist/dry-run-FV0pZwdg.mjs +0 -2
- package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
- package/dist/email-routing-CxU5JlXT.mjs +0 -10
- package/dist/email-security-CnpAHWpj.mjs +0 -8
- package/dist/email-sending-MeCKsktR.mjs +0 -3
- package/dist/filters-Sx2Po1UP.mjs +0 -4
- package/dist/firewall-B0_012XO.mjs +0 -9
- package/dist/fraud-CG0G_VG-.mjs +0 -2
- package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
- package/dist/healthchecks-C0LgExxa.mjs +0 -4
- package/dist/hostnames-D4K6s9EX.mjs +0 -3
- package/dist/hyperdrive-D7XvTRys.mjs +0 -3
- package/dist/iam-4LhJianW.mjs +0 -6
- package/dist/images-BqXyIycX.mjs +0 -5
- package/dist/input-validation-BpVQi9rR.mjs +0 -2
- package/dist/intel-CiO3Sy4x.mjs +0 -3
- package/dist/ips-DLuGN7Mr.mjs +0 -2
- package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
- package/dist/kv-CVYCrk7L.mjs +0 -5
- package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
- package/dist/load-balancers-cxodJuI2.mjs +0 -6
- package/dist/local-OqhVQbv0.mjs +0 -2
- package/dist/logpush-BX7z2xWz.mjs +0 -4
- package/dist/logs-C7vxr6Kp.mjs +0 -3
- package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
- package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
- package/dist/magic-transit-troGMFb9.mjs +0 -30
- package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
- package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
- package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
- package/dist/organizations-BtlEchi-.mjs +0 -4
- package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
- package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
- package/dist/page-rules-CcMmrvY4.mjs +0 -3
- package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
- package/dist/pages-F1vdzqgC.mjs +0 -6
- package/dist/pipelines-DsF1HHMY.mjs +0 -6
- package/dist/progress-5sHFvwez.mjs +0 -2
- package/dist/queues-BuvkxFPX.mjs +0 -6
- package/dist/r2-Du-fgHiT.mjs +0 -9
- package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
- package/dist/radar-C0eqNmWR.mjs +0 -2
- package/dist/rate-limits-CUv2cxXV.mjs +0 -3
- package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
- package/dist/realtime-kit-C-jix3I_.mjs +0 -6
- package/dist/registrar-B7V7i89n.mjs +0 -2
- package/dist/request-tracers-D2V7QUrC.mjs +0 -2
- package/dist/resolve-GtphSYWh.mjs +0 -2
- package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
- package/dist/resource-tagging-BOknFugv.mjs +0 -4
- package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
- package/dist/rules-DzJFHGW1.mjs +0 -4
- package/dist/rulesets-BzI1dUiq.mjs +0 -8
- package/dist/rum-CQ_rJ96u.mjs +0 -4
- package/dist/schema-validation-TmikfxS9.mjs +0 -4
- package/dist/scim-ByZ5kqXS.mjs +0 -3
- package/dist/secrets-store-D7HL4VXw.mjs +0 -8
- package/dist/security-center-OUrILUnx.mjs +0 -2
- package/dist/security-txt-Ca13oCJ8.mjs +0 -3
- package/dist/session-Dxi_LbAk.mjs +0 -2
- package/dist/smart-shield-foPT0J9L.mjs +0 -3
- package/dist/snippets-FDPiBMWc.mjs +0 -4
- package/dist/spectrum-DPoh_BPx.mjs +0 -3
- package/dist/speed-BuEappVX.mjs +0 -4
- package/dist/src-D8_cWUwt.mjs +0 -104
- package/dist/ssl-bJbzEoRv.mjs +0 -3
- package/dist/stream-DuYGiGk6.mjs +0 -13
- package/dist/tenants-BYqEutrr.mjs +0 -2
- package/dist/token-validation-DwmtbWUB.mjs +0 -4
- package/dist/turnstile-Dy91RVTn.mjs +0 -3
- package/dist/url-normalization-DoD9iHWH.mjs +0 -3
- package/dist/url-scanner-qwL64FIo.mjs +0 -2
- package/dist/user-Cduf3VRi.mjs +0 -7
- package/dist/vectorize-CMLobU9V.mjs +0 -4
- package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
- package/dist/web3-Bcx68Kq3.mjs +0 -4
- package/dist/workers-D5fOQsUA.mjs +0 -16
- package/dist/workers-builds-2kdzxjlN.mjs +0 -7
- package/dist/workflows-qFD80noW.mjs +0 -4
- package/dist/zaraz-C0iJimA4.mjs +0 -2
- package/dist/zero-trust-Btix6zOy.mjs +0 -73
- package/dist/zones-Nu3wMtds.mjs +0 -5
- /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{t as i}from"./output-CqGQp2r6.mjs";import{t as a}from"./dry-run-FV0pZwdg.mjs";import{t as o}from"./progress-5sHFvwez.mjs";const s={command:`delete`,describe:`Disables all Managed Transforms.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(r.dryRun){a({command:`cf managed-transforms delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/managed_headers`,pathParams:{zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let s=await t(r),c=await n({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e(`managed transform`,String(c??``),{force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting managed transform`,async()=>s.managedTransforms.delete(c)),{successLabel:`Deleted managed transform`})}},c={command:`edit`,describe:`Updates the status of one or more Managed Transforms.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A Managed Transforms object.`}),handler:async e=>{if(e.dryRun){a({command:`cf managed-transforms edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/managed_headers`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let s=await t(e),c=await n({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body,`body`,`binary`);i(await o(`Updating managed transform`,async()=>s.patch(`/zones/${e.zoneId}/managed_headers`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated managed transform`});return}i(await o(`Updating managed transform`,async()=>s.managedTransforms.edit(c)),{successLabel:`Updated managed transform`})}},l={command:`list`,describe:`Fetches a list of all Managed Transforms.`,builder:e=>e,handler:async e=>{let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,i(await o(`Loading managed transforms`,async()=>r.managedTransforms.list(a)),{successLabel:`Loaded managed transforms`})}},u={command:`managed-transforms`,describe:`Cloudflare-managed HTTP header transforms — automatically add security headers, remove server info, etc.`,builder:e=>e.command(s).command(c).command(l).demandCommand(1),handler:()=>{}};export{u as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`get <mtlsCertificateId>`,describe:`Lists all active associations between the certificate and Cloudflare services.`,builder:e=>e.positional(`mtlsCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{o(e.mtlsCertificateId,`mtlsCertificateId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading association`,async()=>t.mtlsCertificates.associations.get(e.mtlsCertificateId,r)),{successLabel:`Loaded association`})}},m={command:`associations`,describe:`View which Cloudflare services and hostnames are using a specific mTLS certificate`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}},h={command:`create`,describe:`Upload a certificate that you want to use with mTLS-enabled Cloudflare services, such as Bring Your Own CA (BYO-CA) for mTLS. To create certificates issued by the Cloudflare managed CA, use the [Create Client Certificate endpoint](/api/resources/client_certificates/methods/create/).`,builder:e=>e.option(`ca`,{type:`boolean`,description:`Indicates whether the certificate is a CA or leaf certificate.`}).option(`certificates`,{type:`string`,description:`The uploaded root CA certificate.`}).option(`name`,{type:`string`,description:`Optional unique name for the certificate. Only used for human readability.`}).option(`private-key`,{type:`string`,description:`The private key for the certificate. This field is only needed for specific use cases such as using a custom certificate with Zero Trust's block page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf mtls-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mtls_certificates`,pathParams:{},bodyKind:`json`,body:{ca:r.ca,certificates:r.certificates,name:r.name,privateKey:r.privateKey,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating mtls certificate`,async()=>p.post(`/accounts/${m}/mtls_certificates`,{body:e})),{successLabel:`Created mtls certificate`});return}if(r.ca===void 0)throw Error(`--ca is required (or pass --body with this field set).`);r.certificates===void 0&&(r.certificates=await t(`certificates`,`The uploaded root CA certificate.`));let h={};r.ca!==void 0&&s(h,[`ca`],r.ca),r.certificates!==void 0&&s(h,[`certificates`],a(r.certificates,`certificates`,`text`)),r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),r.privateKey!==void 0&&s(h,[`private_key`],a(r.privateKey,`privateKey`,`text`)),l(await f(`Creating mtls certificate`,async()=>p.post(`/accounts/${m}/mtls_certificates`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created mtls certificate`})}},g={command:`delete <mtlsCertificateId>`,describe:`Deletes the mTLS certificate unless the certificate is in use by one or more Cloudflare services.`,builder:e=>e.positional(`mtlsCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(o(t.mtlsCertificateId,`mtlsCertificateId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf mtls-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/mtls_certificates/${t.mtlsCertificateId??`<mtlsCertificateId>`}`,pathParams:{mtlsCertificateId:String(t.mtlsCertificateId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`mtls certificate`,String(t.mtlsCertificateId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(t.body){let e=c(t.body);l(await f(`Deleting mtls certificate`,async()=>a.delete(`/accounts/${s}/mtls_certificates/${t.mtlsCertificateId}`,{body:e})),{successLabel:`Deleted mtls certificate`});return}l(await f(`Deleting mtls certificate`,async()=>a.mtlsCertificates.delete(t.mtlsCertificateId,s)),{successLabel:`Deleted mtls certificate`})}},_={command:`get <mtlsCertificateId>`,describe:`Fetches a single mTLS certificate uploaded to your account. To get a certificate issued by the Cloudflare managed CA, use the [Client Certificate Details endpoint](/api/resources/client_certificates/methods/get/).`,builder:e=>e.positional(`mtlsCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{o(e.mtlsCertificateId,`mtlsCertificateId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading mtls certificate`,async()=>t.mtlsCertificates.get(e.mtlsCertificateId,r)),{successLabel:`Loaded mtls certificate`})}},v={command:`list`,describe:`Lists all mTLS certificates uploaded to your account, such as Bring Your Own CA (BYO-CA) for mTLS. To list certificates issued by the Cloudflare managed CA, use the [List Client Certificates endpoint](/api/resources/client_certificates/methods/list/).`,builder:e=>e.option(`type`,{type:`string`,description:`Filters results by certificate type. Multiple types can be comma-separated.`}),handler:async e=>{let t={};e.type!==void 0&&(t.type=e.type);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading mtls certificates`,async()=>r.mtlsCertificates.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded mtls certificates`})}},y={command:`mtls-certificates`,describe:`Upload and manage mTLS certificates used by API Shield, Workers, and Gateway for client authentication`,builder:e=>e.command(h).command(g).command(_).command(v).command(m).demandCommand(1),handler:()=>{}};export{y as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`create`,describe:`Creates a new Cloud Network Interconnect (CNI) for private network connectivity between Cloudflare and your infrastructure. CNIs enable dedicated, high-performance network links.`,builder:e=>e.option(`account`,{type:`string`,description:`Customer account tag`}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Extra set of static prefixes to advertise to the customer's end of the session`}).option(`bgp-md5-key`,{type:`string`,description:"MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= \\|` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`\"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected."}).option(`interconnect`,{type:`string`,description:`The interconnect field`}).option(`magic-conduit-name`,{type:`string`,description:`The magic.conduit_name field`}).option(`magic-description`,{type:`string`,description:`The magic.description field`}).option(`magic-mtu`,{type:`number`,description:`The magic.mtu field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`,`bgp-extra-prefixes`].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 --bgp-* flag is set`)}return!0}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf network-interconnects cnis create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cni/cnis`,pathParams:{},bodyKind:`json`,body:{account:r.account,bgpCustomerAsn:r.bgpCustomerAsn,bgpExtraPrefixes:r.bgpExtraPrefixes,bgpMd5Key:r.bgpMd5Key,interconnect:r.interconnect,magicConduitName:r.magicConduitName,magicDescription:r.magicDescription,magicMtu:r.magicMtu,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating cni`,async()=>p.post(`/accounts/${m}/cni/cnis`,{body:e})),{successLabel:`Created cni`});return}if(r.account===void 0&&(r.account=await t(`account`,`Customer account tag`)),r.interconnect===void 0&&(r.interconnect=await t(`interconnect`,``)),r.magicConduitName===void 0&&(r.magicConduitName=await t(`magic-conduit-name`,``)),r.magicDescription===void 0&&(r.magicDescription=await t(`magic-description`,``)),r.magicMtu===void 0)throw Error(`--magic-mtu is required (or pass --body with this field set).`);let h={};r.account!==void 0&&s(h,[`account`],a(r.account,`account`,`text`)),r.bgpCustomerAsn!==void 0&&s(h,[`bgp`,`customer_asn`],r.bgpCustomerAsn),r.bgpExtraPrefixes!==void 0&&s(h,[`bgp`,`extra_prefixes`],r.bgpExtraPrefixes),r.bgpMd5Key!==void 0&&s(h,[`bgp`,`md5_key`],a(r.bgpMd5Key,`bgpMd5Key`,`text`)),r.interconnect!==void 0&&s(h,[`interconnect`],a(r.interconnect,`interconnect`,`text`)),r.magicConduitName!==void 0&&s(h,[`magic`,`conduit_name`],a(r.magicConduitName,`magicConduitName`,`text`)),r.magicDescription!==void 0&&s(h,[`magic`,`description`],a(r.magicDescription,`magicDescription`,`text`)),r.magicMtu!==void 0&&s(h,[`magic`,`mtu`],r.magicMtu),l(await f(`Creating cni`,async()=>p.post(`/accounts/${m}/cni/cnis`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created cni`})}},m={command:`delete <cni>`,describe:`Permanently removes a Cloud Network Interconnect (CNI) configuration. The private network connection will be terminated.`,builder:e=>e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.cni,`cni`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf network-interconnects cnis delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cni/cnis/${t.cni??`<cni>`}`,pathParams:{cni:String(t.cni??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`cni`,String(t.cni??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await f(`Deleting cni`,async()=>a.networkInterconnects.cnis.delete(t.cni,s)),{successLabel:`Deleted cni`})}},h={command:`get <cni>`,describe:`Retrieves configuration details for a specific Cloud Network Interconnect (CNI), including connection status and parameters.`,builder:e=>e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,demandOption:!0}),handler:async e=>{o(e.cni,`cni`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading cni`,async()=>t.networkInterconnects.cnis.get(e.cni,r)),{successLabel:`Loaded cni`})}},g={command:`list`,describe:`Lists all Cloud Network Interconnects (CNIs) configured for the account, showing connection status and parameters.`,builder:e=>e.option(`slot`,{type:`string`,description:`If specified, only show CNIs associated with the specified slot`}).option(`tunnel-id`,{type:`string`,description:`If specified, only show cnis associated with the specified tunnel id`}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}),handler:async e=>{let t={};e.slot!==void 0&&(t.slot=e.slot),e.tunnelId!==void 0&&(t.tunnel_id=e.tunnelId),e.cursor!==void 0&&(t.cursor=e.cursor),e.limit!==void 0&&(t.limit=e.limit);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading cnis`,async()=>r.networkInterconnects.cnis.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded cnis`})}},_={command:`update <cni>`,describe:`Updates the configuration of an existing Cloud Network Interconnect (CNI), including connection parameters and routing settings.`,builder:e=>e.positional(`cni`,{type:`string`,description:`CNI ID to retrieve information about`,demandOption:!0}).option(`account`,{type:`string`,description:`Customer account tag`}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Extra set of static prefixes to advertise to the customer's end of the session`}).option(`bgp-md5-key`,{type:`string`,description:"MD5 key to use for session authentication. Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks. The MD5 key, if set, must be of non-zero length and consist only of the following types of character: * ASCII alphanumerics: `[a-zA-Z0-9]` * Special characters in the set `'!@#$%^&*()+[]{}<>/.,;:_-~`= \\|` In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (`\"`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (`?`). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected."}).option(`cust-ip`,{type:`string`,description:"Customer end of the point-to-point link This should always be inside the same prefix as `p2p_ip`."}).option(`id`,{type:`string`,description:`The id field`}).option(`interconnect`,{type:`string`,description:`Interconnect identifier hosting this CNI`}).option(`magic-conduit-name`,{type:`string`,description:`The magic.conduit_name field`}).option(`magic-description`,{type:`string`,description:`The magic.description field`}).option(`magic-mtu`,{type:`number`,description:`The magic.mtu field`}).option(`p2p-ip`,{type:`string`,description:`Cloudflare end of the point-to-point link`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`,`bgp-extra-prefixes`].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 --bgp-* flag is set`)}return!0}),handler:async r=>{if(o(r.cni,`cni`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf network-interconnects cnis update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cni/cnis/${r.cni??`<cni>`}`,pathParams:{cni:String(r.cni??``)},bodyKind:`json`,body:{account:r.account,bgpCustomerAsn:r.bgpCustomerAsn,bgpExtraPrefixes:r.bgpExtraPrefixes,bgpMd5Key:r.bgpMd5Key,custIp:r.custIp,id:r.id,interconnect:r.interconnect,magicConduitName:r.magicConduitName,magicDescription:r.magicDescription,magicMtu:r.magicMtu,p2pIp:r.p2pIp,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Updating cni`,async()=>p.put(`/accounts/${m}/cni/cnis/${r.cni}`,{body:e})),{successLabel:`Updated cni`});return}if(r.account===void 0&&(r.account=await t(`account`,`Customer account tag`)),r.custIp===void 0&&(r.custIp=await t(`cust-ip`,"Customer end of the point-to-point link This should always be inside the same prefix as `p2p_ip`.")),r.id===void 0&&(r.id=await t(`id`,``)),r.interconnect===void 0&&(r.interconnect=await t(`interconnect`,`Interconnect identifier hosting this CNI`)),r.magicConduitName===void 0&&(r.magicConduitName=await t(`magic-conduit-name`,``)),r.magicDescription===void 0&&(r.magicDescription=await t(`magic-description`,``)),r.magicMtu===void 0)throw Error(`--magic-mtu is required (or pass --body with this field set).`);r.p2pIp===void 0&&(r.p2pIp=await t(`p2p-ip`,`Cloudflare end of the point-to-point link`));let h={};r.account!==void 0&&s(h,[`account`],a(r.account,`account`,`text`)),r.bgpCustomerAsn!==void 0&&s(h,[`bgp`,`customer_asn`],r.bgpCustomerAsn),r.bgpExtraPrefixes!==void 0&&s(h,[`bgp`,`extra_prefixes`],r.bgpExtraPrefixes),r.bgpMd5Key!==void 0&&s(h,[`bgp`,`md5_key`],a(r.bgpMd5Key,`bgpMd5Key`,`text`)),r.custIp!==void 0&&s(h,[`cust_ip`],a(r.custIp,`custIp`,`text`)),r.id!==void 0&&s(h,[`id`],a(r.id,`id`,`text`)),r.interconnect!==void 0&&s(h,[`interconnect`],a(r.interconnect,`interconnect`,`text`)),r.magicConduitName!==void 0&&s(h,[`magic`,`conduit_name`],a(r.magicConduitName,`magicConduitName`,`text`)),r.magicDescription!==void 0&&s(h,[`magic`,`description`],a(r.magicDescription,`magicDescription`,`text`)),r.magicMtu!==void 0&&s(h,[`magic`,`mtu`],r.magicMtu),r.p2pIp!==void 0&&s(h,[`p2p_ip`],a(r.p2pIp,`p2pIp`,`text`)),l(await f(`Updating cni`,async()=>p.put(`/accounts/${m}/cni/cnis/${r.cni}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated cni`})}},v={command:`cnis`,describe:`Cloud Network Interconnect (CNI) connections — private links from cloud providers to Cloudflare`,builder:e=>e.command(p).command(m).command(h).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`create`,describe:`Creates a new network interconnect for connecting Cloudflare's network to external networks. Interconnects provide dedicated bandwidth and reduced latency for traffic exchange.`,builder:e=>e.option(`account`,{type:`string`,description:`The account field`}).option(`type`,{type:`string`,description:`The type field`}).option(`slot-id`,{type:`string`,description:`The slot_id field`}).option(`speed`,{type:`string`,description:`The speed field`}).option(`bandwidth`,{type:`string`,description:`Bandwidth structure as visible through the customer-facing API.`,choices:[`50M`,`100M`,`200M`,`300M`,`400M`,`500M`,`1G`,`2G`,`5G`,`10G`,`20G`,`50G`]}).option(`pairing-key`,{type:`string`,description:`Pairing key provided by GCP`}).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(`slot-id`,[`bandwidth`,`pairing-key`]).conflicts(`speed`,[`bandwidth`,`pairing-key`]).conflicts(`bandwidth`,[`slot-id`,`speed`]).implies(`bandwidth`,[`pairing-key`]).conflicts(`pairing-key`,[`slot-id`,`speed`]).implies(`pairing-key`,[`bandwidth`]),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf network-interconnects interconnects create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cni/interconnects`,pathParams:{},bodyKind:`json`,body:{account:r.account,type:r.type,slotId:r.slotId,speed:r.speed,bandwidth:r.bandwidth,pairingKey:r.pairingKey,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating interconnect`,async()=>p.post(`/accounts/${m}/cni/interconnects`,{body:e})),{successLabel:`Created interconnect`});return}r.account===void 0&&(r.account=await t(`account`,``)),r.type===void 0&&(r.type=await t(`type`,``));let h={};r.account!==void 0&&s(h,[`account`],a(r.account,`account`,`text`)),r.type!==void 0&&s(h,[`type`],a(r.type,`type`,`text`)),r.slotId!==void 0&&s(h,[`slot_id`],a(r.slotId,`slotId`,`text`)),r.speed!==void 0&&s(h,[`speed`],a(r.speed,`speed`,`text`)),r.bandwidth!==void 0&&s(h,[`bandwidth`],a(r.bandwidth,`bandwidth`,`text`)),r.pairingKey!==void 0&&s(h,[`pairing_key`],a(r.pairingKey,`pairingKey`,`text`)),l(await f(`Creating interconnect`,async()=>p.post(`/accounts/${m}/cni/interconnects`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created interconnect`})}},b={command:`delete <icon>`,describe:`Permanently removes a network interconnect configuration. The physical or virtual connection will be terminated.`,builder:e=>e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.icon,`icon`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf network-interconnects interconnects delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cni/interconnects/${t.icon??`<icon>`}`,pathParams:{icon:String(t.icon??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`interconnect`,String(t.icon??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await f(`Deleting interconnect`,async()=>a.networkInterconnects.interconnects.delete(t.icon,s)),{successLabel:`Deleted interconnect`})}},x={command:`get <icon>`,describe:`Retrieves configuration and status details for a specific network interconnect.`,builder:e=>e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}),handler:async e=>{o(e.icon,`icon`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading interconnect`,async()=>t.networkInterconnects.interconnects.get(e.icon,r)),{successLabel:`Loaded interconnect`})}},S={command:`list`,describe:`Lists all network interconnects configured for the account, including physical and virtual connections.`,builder:e=>e.option(`site`,{type:`string`,description:`If specified, only show interconnects located at the given site`}).option(`type`,{type:`string`,description:`If specified, only show interconnects of the given type`}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}),handler:async e=>{let t={};e.site!==void 0&&(t.site=e.site),e.type!==void 0&&(t.type=e.type),e.cursor!==void 0&&(t.cursor=e.cursor),e.limit!==void 0&&(t.limit=e.limit);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading interconnects`,async()=>r.networkInterconnects.interconnects.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded interconnects`})}},C={command:`loa <icon>`,describe:`Downloads the Letter of Authorization (LOA) for a network interconnect, required for physical cross-connect provisioning.`,builder:e=>e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}),handler:async e=>{o(e.icon,`icon`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading interconnect`,async()=>t.networkInterconnects.interconnects.loa(e.icon,r)),{successLabel:`Loaded interconnect`})}},w={command:`status <icon>`,describe:`Gets the current operational status of a network interconnect, including link state and traffic metrics.`,builder:e=>e.positional(`icon`,{type:`string`,description:`Interconnect name to retrieve information about`,demandOption:!0}),handler:async e=>{o(e.icon,`icon`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading interconnect`,async()=>t.networkInterconnects.interconnects.status(e.icon,r)),{successLabel:`Loaded interconnect`})}},T={command:`interconnects`,describe:`Physical cross-connect and partner interconnect sessions with LOA and status tracking`,builder:e=>e.command(y).command(b).command(x).command(S).command(C).command(w).demandCommand(1),handler:()=>{}},E={command:`get`,describe:`Retrieves current settings configuration for the specified resource or service.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading setting`,async()=>t.networkInterconnects.settings.get(r)),{successLabel:`Loaded setting`})}},D={command:`update`,describe:`Updates configuration settings for the specified resource or service.`,builder:e=>e.option(`default-asn`,{type:`number`,description:`The default_asn field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf network-interconnects settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cni/settings`,pathParams:{},bodyKind:`json`,body:{defaultAsn:t.defaultAsn,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);if(t.accountId=a,t.body){let e=c(t.body);l(await f(`Updating setting`,async()=>r.put(`/accounts/${a}/cni/settings`,{body:e})),{successLabel:`Updated setting`});return}let p={};t.defaultAsn!==void 0&&s(p,[`default_asn`],t.defaultAsn),l(await f(`Updating setting`,async()=>r.put(`/accounts/${a}/cni/settings`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated setting`})}},O={command:`settings`,describe:`Account-level interconnect settings and default configurations`,builder:e=>e.command(E).command(D).demandCommand(1),handler:()=>{}},k={command:`get <slot>`,describe:`Gets information about a specific infrastructure slot allocation.`,builder:e=>e.positional(`slot`,{type:`string`,description:`Slot`,demandOption:!0}),handler:async e=>{o(e.slot,`slot`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading slot`,async()=>t.networkInterconnects.slots.get(e.slot,r)),{successLabel:`Loaded slot`})}},A={command:`list`,describe:`Lists all available infrastructure slots for the account, showing allocation status and capacity.`,builder:e=>e.option(`address-contains`,{type:`string`,description:`If specified, only show slots with the given text in their address field`}).option(`site`,{type:`string`,description:`If specified, only show slots located at the given site`}).option(`speed`,{type:`string`,description:`If specified, only show slots that support the given speed`}).option(`occupied`,{type:`boolean`,description:`If specified, only show slots with a specific occupied/unoccupied state`,default:!1}).option(`cursor`,{type:`number`,description:`Cursor`}).option(`limit`,{type:`number`,description:`Limit`}),handler:async e=>{let t={};e.addressContains!==void 0&&(t.address_contains=e.addressContains),e.site!==void 0&&(t.site=e.site),e.speed!==void 0&&(t.speed=e.speed),e.occupied!==void 0&&(t.occupied=e.occupied),e.cursor!==void 0&&(t.cursor=e.cursor),e.limit!==void 0&&(t.limit=e.limit);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading slots`,async()=>r.networkInterconnects.slots.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded slots`})}},j={command:`slots`,describe:`Available interconnect facility slots showing port capacity at Cloudflare data centers`,builder:e=>e.command(k).command(A).demandCommand(1),handler:()=>{}},M={command:`network-interconnects`,describe:`Physical and virtual private interconnects between your infrastructure and Cloudflare's network`,builder:e=>e.command(v).command(T).command(O).command(j).demandCommand(1),handler:()=>{}};export{M as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`list`,describe:`Retrieve a list of the organizations that "contain" this account or are managing it. The returned list will be in order from "root" to "leaf", where the "leaf" will be the organization that _immediately_ contains the specified account.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading account organizations`,async()=>n.organizations.accountOrganizations.list(i)),{successLabel:`Loaded account organizations`})}},p={command:`account-organizations`,describe:`List organizations associated with a specific account`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`create`,describe:`Create a new organization for a user. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.option(`name`,{type:`string`,description:`The name field`}).option(`parent-id`,{type:`string`,description:`The parent.id field`}).option(`profile-business-address`,{type:`string`,description:`The profile.business_address field`}).option(`profile-business-email`,{type:`string`,description:`The profile.business_email field`}).option(`profile-business-name`,{type:`string`,description:`The profile.business_name field`}).option(`profile-business-phone`,{type:`string`,description:`The profile.business_phone field`}).option(`profile-external-metadata`,{type:`string`,description:`The profile.external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`References an Organization in the Cloudflare data model.`}).check(e=>{if([`parent-id`].some(t=>e[t]!==void 0)){let t=[`parent-id`].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 --parent-* flag is set`)}return!0}).check(e=>{if([`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].some(t=>e[t]!==void 0)){let t=[`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].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 --profile-* flag is set`)}return!0}),handler:async t=>{if(t.dryRun){l({command:`cf organizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations`,pathParams:{},bodyKind:`json`,body:{name:t.name,parentId:t.parentId,profileBusinessAddress:t.profileBusinessAddress,profileBusinessEmail:t.profileBusinessEmail,profileBusinessName:t.profileBusinessName,profileBusinessPhone:t.profileBusinessPhone,profileExternalMetadata:t.profileExternalMetadata,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await d(`Creating organization`,async()=>n.post(`/organizations`,{body:e})),{successLabel:`Created organization`});return}t.name===void 0&&(t.name=await e(`name`,``));let a={};t.name!==void 0&&o(a,[`name`],i(t.name,`name`,`text`)),t.parentId!==void 0&&o(a,[`parent`,`id`],i(t.parentId,`parentId`,`text`)),t.profileBusinessAddress!==void 0&&o(a,[`profile`,`business_address`],i(t.profileBusinessAddress,`profileBusinessAddress`,`text`)),t.profileBusinessEmail!==void 0&&o(a,[`profile`,`business_email`],i(t.profileBusinessEmail,`profileBusinessEmail`,`text`)),t.profileBusinessName!==void 0&&o(a,[`profile`,`business_name`],i(t.profileBusinessName,`profileBusinessName`,`text`)),t.profileBusinessPhone!==void 0&&o(a,[`profile`,`business_phone`],i(t.profileBusinessPhone,`profileBusinessPhone`,`text`)),t.profileExternalMetadata!==void 0&&o(a,[`profile`,`external_metadata`],i(t.profileExternalMetadata,`profileExternalMetadata`,`text`)),c(await d(`Creating organization`,async()=>n.post(`/organizations`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created organization`})}},h={command:`delete <organizationId>`,describe:`Delete an organization. The organization MUST be empty before deleting. It must not contain any sub-organizations, accounts, members or users. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The ID of the organization to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(a(e.organizationId,`organizationId`),e.dryRun){l({command:`cf organizations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/organizations/${e.organizationId??`<organizationId>`}`,pathParams:{organizationId:String(e.organizationId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e);if(!await n(`organization`,String(e.organizationId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await d(`Deleting organization`,async()=>t.organizations.delete(e.organizationId)),{successLabel:`Deleted organization`})}},g={command:`get <organizationId>`,describe:`Retrieve the details of a certain organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The ID of the organization to retrieve.`,demandOption:!0}),handler:async e=>{a(e.organizationId,`organizationId`);let t=await r(e);c(await d(`Loading organization`,async()=>t.organizations.get(e.organizationId)),{successLabel:`Loaded organization`})}},_={command:`list`,describe:`Retrieve a list of organizations a particular user has access to. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.option(`id`,{type:`string`,description:`Only return organizations with the specified IDs (ex. id=foo&id=bar). Send multiple elements by repeating the query value.`}).option(`name`,{type:`string`,description:`(case-sensitive) Filter the list of organizations to where the name is equal to a particular string.`}).option(`name-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name starts with a particular string.`}).option(`name-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name ends with a particular string.`}).option(`name-contains`,{type:`string`,description:`(case-insensitive) Filter the list of organizations to where the name contains a particular string.`}).option(`containing-account`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular account.`}).option(`containing-user`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular user. IMPORTANT: Just because an organization "contains" a user is not a representation of any authorization or privilege to manage any resources therein. An organization "containing" a user simply means the user is managed by that organization.`}).option(`containing-organization`,{type:`string`,description:`Filter the list of organizations to the ones that contain this particular organization.`}).option(`parent-id`,{type:`string`,description:`Filter the list of organizations to the ones that are a sub-organization of the specified organization. "null" is a valid value to provide for this parameter. It means "where an organization has no parent (i.e. it is a 'root' organization)."`}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.name!==void 0&&(t.name=e.name),e.nameStartswith!==void 0&&(t.nameStartswith=e.nameStartswith),e.nameEndswith!==void 0&&(t.nameEndswith=e.nameEndswith),e.nameContains!==void 0&&(t.nameContains=e.nameContains),e.containingAccount!==void 0&&(t.containingAccount=e.containingAccount),e.containingUser!==void 0&&(t.containingUser=e.containingUser),e.containingOrganization!==void 0&&(t.containingOrganization=e.containingOrganization),e.parentId!==void 0&&(t.parentId=e.parentId),e.pageToken!==void 0&&(t.page_token=e.pageToken),e.pageSize!==void 0&&(t.page_size=e.pageSize);let n=await r(e);c(await d(`Loading organizations`,async()=>n.organizations.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded organizations`})}},v={command:`get <organizationId>`,describe:`Gets a list of audit logs for an organization.`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The unique id that identifies the organization.`,demandOption:!0}).option(`action-result`,{type:`string`,description:`Filters by whether the action was successful or not.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-context`,{type:`string`,description:`Filters by the actor context.`}).option(`actor-email`,{type:`string`,description:`Filters by the actor's email address.`}).option(`actor-id`,{type:`string`,description:`Filters by the actor's user ID.`}).option(`actor-ip-address`,{type:`string`,description:`The IP address where the action was initiated.`}).option(`actor-token-id`,{type:`string`,description:`Filters by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name`,{type:`string`,description:`Filters by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type`,{type:`string`,description:`Filters by the actor type.`}).option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`raw-cf-ray-id`,{type:`string`,description:`Filters by the response CF Ray ID.`}).option(`raw-method`,{type:`string`,description:`The HTTP method for the API call.`}).option(`raw-status-code`,{type:`string`,description:`The response status code that was returned.`}).option(`raw-uri`,{type:`string`,description:`Filters by the request URI.`}).option(`resource-id`,{type:`string`,description:`Filters by the resource ID.`}).option(`resource-product`,{type:`string`,description:`Filters audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type`,{type:`string`,description:`Filters audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope`,{type:`string`,description:`Filters by the resource scope, specifying whether the resource is associated with an organization.`}).option(`action-result-not`,{type:`string`,description:`Filters out audit logs by whether the action was successful or not.`}).option(`action-type-not`,{type:`string`,description:`Filters out audit logs by the action type.`}).option(`actor-context-not`,{type:`string`,description:`Filters out audit logs by the actor context.`}).option(`actor-email-not`,{type:`string`,description:`Filters out audit logs by the actor's email address.`}).option(`actor-id-not`,{type:`string`,description:`Filters out audit logs by the actor's user ID.`}).option(`actor-ip-address-not`,{type:`string`,description:`Filters out audit logs IP address where the action was initiated.`}).option(`actor-token-id-not`,{type:`string`,description:`Filters out audit logs by the API token ID when the actor context is an api_token or oauth.`}).option(`actor-token-name-not`,{type:`string`,description:`Filters out audit logs by the API token name when the actor context is an api_token or oauth.`}).option(`actor-type-not`,{type:`string`,description:`Filters out audit logs by the actor type.`}).option(`id-not`,{type:`string`,description:`Filters out audit logs by their IDs.`}).option(`raw-cf-ray-id-not`,{type:`string`,description:`Filters out audit logs by the response CF Ray ID.`}).option(`raw-method-not`,{type:`string`,description:`Filters out audit logs by the HTTP method for the API call.`}).option(`raw-status-code-not`,{type:`string`,description:`Filters out audit logs by the response status code that was returned.`}).option(`raw-uri-not`,{type:`string`,description:`Filters out audit logs by the request URI.`}).option(`resource-id-not`,{type:`string`,description:`Filters out audit logs by the resource ID.`}).option(`resource-product-not`,{type:`string`,description:`Filters out audit logs by the Cloudflare product associated with the changed resource.`}).option(`resource-type-not`,{type:`string`,description:`Filters out audit logs based on the unique type of resource changed by the action.`}).option(`resource-scope-not`,{type:`string`,description:`Filters out audit logs by the resource scope, specifying whether the resource is associated with an organization.`}).option(`since`,{type:`string`,description:`Limits the returned results to logs newer than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`before`,{type:`string`,description:`Limits the returned results to logs older than the specified date. This can be a date string 2019-04-30 (interpreted in UTC) or an absolute timestamp that conforms to RFC3339.`,demandOption:!0}).option(`direction`,{type:`string`,description:`Sets sorting order.`,choices:[`desc`,`asc`]}).option(`limit`,{type:`number`,description:`The number limits the objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit.`}).option(`cursor`,{type:`string`,description:`The cursor is an opaque token used to paginate through large sets of records. It indicates the position from which to continue when requesting the next set of records. A valid cursor value can be obtained from the cursor object in the result_info structure of a previous response.`}),handler:async e=>{a(e.organizationId,`organizationId`);let t={};e.actionResult!==void 0&&(t.action_result=e.actionResult),e.actionType!==void 0&&(t.action_type=e.actionType),e.actorContext!==void 0&&(t.actor_context=e.actorContext),e.actorEmail!==void 0&&(t.actor_email=e.actorEmail),e.actorId!==void 0&&(t.actor_id=e.actorId),e.actorIpAddress!==void 0&&(t.actor_ip_address=e.actorIpAddress),e.actorTokenId!==void 0&&(t.actor_token_id=e.actorTokenId),e.actorTokenName!==void 0&&(t.actor_token_name=e.actorTokenName),e.actorType!==void 0&&(t.actor_type=e.actorType),e.id!==void 0&&(t.id=e.id),e.rawCfRayId!==void 0&&(t.raw_cf_ray_id=e.rawCfRayId),e.rawMethod!==void 0&&(t.raw_method=e.rawMethod),e.rawStatusCode!==void 0&&(t.raw_status_code=e.rawStatusCode),e.rawUri!==void 0&&(t.raw_uri=e.rawUri),e.resourceId!==void 0&&(t.resource_id=e.resourceId),e.resourceProduct!==void 0&&(t.resource_product=e.resourceProduct),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.resourceScope!==void 0&&(t.resource_scope=e.resourceScope),e.actionResultNot!==void 0&&(t.actionResultNot=e.actionResultNot),e.actionTypeNot!==void 0&&(t.actionTypeNot=e.actionTypeNot),e.actorContextNot!==void 0&&(t.actorContextNot=e.actorContextNot),e.actorEmailNot!==void 0&&(t.actorEmailNot=e.actorEmailNot),e.actorIdNot!==void 0&&(t.actorIdNot=e.actorIdNot),e.actorIpAddressNot!==void 0&&(t.actorIpAddressNot=e.actorIpAddressNot),e.actorTokenIdNot!==void 0&&(t.actorTokenIdNot=e.actorTokenIdNot),e.actorTokenNameNot!==void 0&&(t.actorTokenNameNot=e.actorTokenNameNot),e.actorTypeNot!==void 0&&(t.actorTypeNot=e.actorTypeNot),e.idNot!==void 0&&(t.idNot=e.idNot),e.rawCfRayIdNot!==void 0&&(t.rawCfRayIdNot=e.rawCfRayIdNot),e.rawMethodNot!==void 0&&(t.rawMethodNot=e.rawMethodNot),e.rawStatusCodeNot!==void 0&&(t.rawStatusCodeNot=e.rawStatusCodeNot),e.rawUriNot!==void 0&&(t.rawUriNot=e.rawUriNot),e.resourceIdNot!==void 0&&(t.resourceIdNot=e.resourceIdNot),e.resourceProductNot!==void 0&&(t.resourceProductNot=e.resourceProductNot),e.resourceTypeNot!==void 0&&(t.resourceTypeNot=e.resourceTypeNot),e.resourceScopeNot!==void 0&&(t.resourceScopeNot=e.resourceScopeNot),e.since!==void 0&&(t.since=e.since),e.before!==void 0&&(t.before=e.before),e.direction!==void 0&&(t.direction=e.direction),e.limit!==void 0&&(t.limit=e.limit),e.cursor!==void 0&&(t.cursor=e.cursor);let n=await r(e);c(await d(`Loading audit`,async()=>n.organizations.logs.audit.get(e.organizationId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded audit`})}},y={command:`audit`,describe:`Logs operations`,builder:e=>e.command(v).demandCommand(1),handler:()=>{}},b={command:`logs`,describe:`Operations for logs`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`create <organizationId>`,describe:`Batch create multiple memberships that grant access to a specific Organization.`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.organizationId,`organizationId`),e.dryRun){l({command:`cf organizations members-batch-create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations/${e.organizationId??`<organizationId>`}/members:batchCreate`,pathParams:{organizationId:String(e.organizationId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(e.body){let n=s(e.body);c(await d(`Creating members batch create`,async()=>t.post(`/organizations/${e.organizationId}/members:batchCreate`,{body:n})),{successLabel:`Created members batch create`});return}c(await d(`Creating members batch create`,async()=>t.organizations.membersBatchCreate.create(e.organizationId)),{successLabel:`Created members batch create`})}},S={command:`members-batch-create`,describe:`Members Batch Create operations`,builder:e=>e.command(x).demandCommand(1),handler:()=>{}},C={command:`create <organizationId>`,describe:`Create a membership that grants access to a specific Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`member-status`,{type:`string`,description:`The member.status field`,choices:[`active`,`canceled`]}).option(`member-user-email`,{type:`string`,description:`The member.user.email field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(a(t.organizationId,`organizationId`),t.dryRun){l({command:`cf organizations members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/organizations/${t.organizationId??`<organizationId>`}/members`,pathParams:{organizationId:String(t.organizationId??``)},bodyKind:`json`,body:{memberStatus:t.memberStatus,memberUserEmail:t.memberUserEmail,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await d(`Creating member`,async()=>n.post(`/organizations/${t.organizationId}/members`,{body:e})),{successLabel:`Created member`});return}t.memberUserEmail===void 0&&(t.memberUserEmail=await e(`member-user-email`,``));let u={};t.memberStatus!==void 0&&o(u,[`member`,`status`],i(t.memberStatus,`memberStatus`,`text`)),t.memberUserEmail!==void 0&&o(u,[`member`,`user`,`email`],i(t.memberUserEmail,`memberUserEmail`,`text`)),c(await d(`Creating member`,async()=>n.post(`/organizations/${t.organizationId}/members`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created member`})}},w={command:`delete <memberId>`,describe:`Delete a membership to a particular Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`memberId`,{type:`string`,description:`Organization Member ID`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.memberId,`memberId`),e.dryRun){l({command:`cf organizations members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/organizations/${e.organizationId??`<organizationId>`}/members/${e.memberId??`<memberId>`}`,pathParams:{organizationId:String(e.organizationId??``),memberId:String(e.memberId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`member`,String(e.memberId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(e.body){let n=s(e.body);c(await d(`Deleting member`,async()=>t.delete(`/organizations/${e.organizationId}/members/${e.memberId}`,{body:n})),{successLabel:`Deleted member`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},T={command:`get <memberId>`,describe:`Retrieve a single membership from an Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`memberId`,{type:`string`,description:`Organization Member ID`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}),handler:async e=>{a(e.memberId,`memberId`);let t=await r(e);c(await d(`Loading member`,async()=>t.organizations.members.get(e.organizationId,e.memberId)),{successLabel:`Loaded member`})}},E={command:`list`,describe:`List memberships for an Organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.option(`organization-id`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter the list of memberships by membership status.`}).option(`user-email`,{type:`string`,description:`Filter the list of memberships for a specific email.`}).option(`user-email-contains`,{type:`string`,description:`Filter the list of memberships for a specific email that contains a substring.`}).option(`user-email-starts-with`,{type:`string`,description:`Filter the list of memberships for a specific email that starts with a substring.`}).option(`user-email-ends-with`,{type:`string`,description:`Filter the list of memberships for a specific email that ends with a substring.`}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.userEmail!==void 0&&(t.userEmail=e.userEmail),e.userEmailContains!==void 0&&(t.userEmailContains=e.userEmailContains),e.userEmailStartswith!==void 0&&(t.userEmailStartswith=e.userEmailStartswith),e.userEmailEndswith!==void 0&&(t.userEmailEndswith=e.userEmailEndswith),e.pageToken!==void 0&&(t.page_token=e.pageToken),e.pageSize!==void 0&&(t.page_size=e.pageSize);let n=await r(e);c(await d(`Loading members`,async()=>n.organizations.members.list(e.organizationId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded members`})}},D={command:`members`,describe:`Members operations`,builder:e=>e.command(C).command(w).command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`get <organizationId>`,describe:`Retrieve a list of accounts that belong to a specific organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The ID of the organization to retrieve a list of accounts for.`,demandOption:!0}).option(`account-pubname`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname is equal to a particular string.`}).option(`account-pubname-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname starts with a particular string.`}).option(`account-pubname-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname ends with a particular string.`}).option(`account-pubname-contains`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the account_pubname contains a particular string.`}).option(`name`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name is equal to a particular string.`}).option(`name-starts-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name starts with a particular string.`}).option(`name-ends-with`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name ends with a particular string.`}).option(`name-contains`,{type:`string`,description:`(case-insensitive) Filter the list of accounts to where the name contains a particular string.`}).option(`order-by`,{type:`string`,description:"Field to order results by. Currently supported values: `account_name`. When not specified, results are ordered by internal account ID.",choices:[`account_name`]}).option(`direction`,{type:`string`,description:"Sort direction for the order_by field. Valid values: `asc`, `desc`. Defaults to `asc` when order_by is specified.",choices:[`asc`,`desc`]}).option(`page-token`,{type:`string`,description:`An opaque token returned from the last list response that when provided will retrieve the next page. Parameters used to filter the retrieved list must remain in subsequent requests with a page token.`}).option(`page-size`,{type:`number`,description:`The amount of items to return. Defaults to 10.`}),handler:async e=>{a(e.organizationId,`organizationId`);let t={};e.accountPubname!==void 0&&(t.account_pubname=e.accountPubname),e.accountPubnameStartswith!==void 0&&(t.accountPubnameStartswith=e.accountPubnameStartswith),e.accountPubnameEndswith!==void 0&&(t.accountPubnameEndswith=e.accountPubnameEndswith),e.accountPubnameContains!==void 0&&(t.accountPubnameContains=e.accountPubnameContains),e.name!==void 0&&(t.name=e.name),e.nameStartswith!==void 0&&(t.nameStartswith=e.nameStartswith),e.nameEndswith!==void 0&&(t.nameEndswith=e.nameEndswith),e.nameContains!==void 0&&(t.nameContains=e.nameContains),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.direction!==void 0&&(t.direction=e.direction),e.pageToken!==void 0&&(t.page_token=e.pageToken),e.pageSize!==void 0&&(t.page_size=e.pageSize);let n=await r(e);c(await d(`Loading organization account`,async()=>n.organizations.organizationAccounts.get(e.organizationId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded organization account`})}},k={command:`organization-accounts`,describe:`Accounts operations`,builder:e=>e.command(O).demandCommand(1),handler:()=>{}},A={command:`get <organizationId>`,describe:`Get an organizations profile if it exists. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The ID of the organization to retrieve a profile for.`,demandOption:!0}),handler:async e=>{a(e.organizationId,`organizationId`);let t=await r(e);c(await d(`Loading organization profile`,async()=>t.organizations.organizationProfile.get(e.organizationId)),{successLabel:`Loaded organization profile`})}},j={command:`update <organizationId>`,describe:`Modify organization profile. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`Organization ID`,demandOption:!0}).option(`business-address`,{type:`string`,description:`The business_address field`}).option(`business-email`,{type:`string`,description:`The business_email field`}).option(`business-name`,{type:`string`,description:`The business_name field`}).option(`business-phone`,{type:`string`,description:`The business_phone field`}).option(`external-metadata`,{type:`string`,description:`The external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(a(t.organizationId,`organizationId`),t.dryRun){l({command:`cf organizations organization-profile update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/organizations/${t.organizationId??`<organizationId>`}/profile`,pathParams:{organizationId:String(t.organizationId??``)},bodyKind:`json`,body:{businessAddress:t.businessAddress,businessEmail:t.businessEmail,businessName:t.businessName,businessPhone:t.businessPhone,externalMetadata:t.externalMetadata,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await d(`Updating organization profile`,async()=>n.put(`/organizations/${t.organizationId}/profile`,{body:e})),{successLabel:`Updated organization profile`});return}t.businessAddress===void 0&&(t.businessAddress=await e(`business-address`,``)),t.businessEmail===void 0&&(t.businessEmail=await e(`business-email`,``)),t.businessName===void 0&&(t.businessName=await e(`business-name`,``)),t.businessPhone===void 0&&(t.businessPhone=await e(`business-phone`,``)),t.externalMetadata===void 0&&(t.externalMetadata=await e(`external-metadata`,``));let u={};t.businessAddress!==void 0&&o(u,[`business_address`],i(t.businessAddress,`businessAddress`,`text`)),t.businessEmail!==void 0&&o(u,[`business_email`],i(t.businessEmail,`businessEmail`,`text`)),t.businessName!==void 0&&o(u,[`business_name`],i(t.businessName,`businessName`,`text`)),t.businessPhone!==void 0&&o(u,[`business_phone`],i(t.businessPhone,`businessPhone`,`text`)),t.externalMetadata!==void 0&&o(u,[`external_metadata`],i(t.externalMetadata,`externalMetadata`,`text`)),c(await d(`Updating organization profile`,async()=>n.put(`/organizations/${t.organizationId}/profile`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated organization profile`})}},M={command:`organization-profile`,describe:`View and update the public profile information for an organization`,builder:e=>e.command(A).command(j).demandCommand(1),handler:()=>{}},N={command:`list`,describe:`Lists all organization shares.`,builder:e=>e.option(`organization-id`,{type:`string`,description:`Organization identifier.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter shares by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`kind`,{type:`string`,description:`Filter shares by kind.`,choices:[`sent`,`received`]}).option(`target-type`,{type:`string`,description:`Filter shares by target_type.`,choices:[`account`,`organization`]}).option(`resource-types`,{type:`string`,description:`Filter share resources by resource_types.`}).option(`order`,{type:`string`,description:`Order shares by values in the given field.`,choices:[`name`,`created`]}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Number of objects to return per page.`}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.kind!==void 0&&(t.kind=e.kind),e.targetType!==void 0&&(t.target_type=e.targetType),e.resourceTypes!==void 0&&(t.resource_types=e.resourceTypes),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await r(e);c(await d(`Loading shares`,async()=>n.organizations.shares.list(e.organizationId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded shares`})}},P={command:`shares`,describe:`Shares operations`,builder:e=>e.command(N).demandCommand(1),handler:()=>{}},F={command:`update <organizationId>`,describe:`Modify organization. (Currently in Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/)`,builder:e=>e.positional(`organizationId`,{type:`string`,description:`The ID of the organization to modify.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`parent-id`,{type:`string`,description:`The parent.id field`}).option(`profile-business-address`,{type:`string`,description:`The profile.business_address field`}).option(`profile-business-email`,{type:`string`,description:`The profile.business_email field`}).option(`profile-business-name`,{type:`string`,description:`The profile.business_name field`}).option(`profile-business-phone`,{type:`string`,description:`The profile.business_phone field`}).option(`profile-external-metadata`,{type:`string`,description:`The profile.external_metadata field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new details of the organization. Only accepts updates to "name" currently.`}).check(e=>{if([`parent-id`].some(t=>e[t]!==void 0)){let t=[`parent-id`].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 --parent-* flag is set`)}return!0}).check(e=>{if([`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].some(t=>e[t]!==void 0)){let t=[`profile-business-address`,`profile-business-email`,`profile-business-name`,`profile-business-phone`,`profile-external-metadata`].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 --profile-* flag is set`)}return!0}),handler:async t=>{if(a(t.organizationId,`organizationId`),t.dryRun){l({command:`cf organizations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/organizations/${t.organizationId??`<organizationId>`}`,pathParams:{organizationId:String(t.organizationId??``)},bodyKind:`json`,body:{name:t.name,parentId:t.parentId,profileBusinessAddress:t.profileBusinessAddress,profileBusinessEmail:t.profileBusinessEmail,profileBusinessName:t.profileBusinessName,profileBusinessPhone:t.profileBusinessPhone,profileExternalMetadata:t.profileExternalMetadata,body:t.body},validation:`passed`});return}let n=await r(t);if(t.body){let e=s(t.body);c(await d(`Updating organization`,async()=>n.put(`/organizations/${t.organizationId}`,{body:e})),{successLabel:`Updated organization`});return}t.name===void 0&&(t.name=await e(`name`,``));let u={};t.name!==void 0&&o(u,[`name`],i(t.name,`name`,`text`)),t.parentId!==void 0&&o(u,[`parent`,`id`],i(t.parentId,`parentId`,`text`)),t.profileBusinessAddress!==void 0&&o(u,[`profile`,`business_address`],i(t.profileBusinessAddress,`profileBusinessAddress`,`text`)),t.profileBusinessEmail!==void 0&&o(u,[`profile`,`business_email`],i(t.profileBusinessEmail,`profileBusinessEmail`,`text`)),t.profileBusinessName!==void 0&&o(u,[`profile`,`business_name`],i(t.profileBusinessName,`profileBusinessName`,`text`)),t.profileBusinessPhone!==void 0&&o(u,[`profile`,`business_phone`],i(t.profileBusinessPhone,`profileBusinessPhone`,`text`)),t.profileExternalMetadata!==void 0&&o(u,[`profile`,`external_metadata`],i(t.profileExternalMetadata,`profileExternalMetadata`,`text`)),c(await d(`Updating organization`,async()=>n.put(`/organizations/${t.organizationId}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated organization`})}},I={command:`organizations`,describe:`Multi-user organizations that group accounts, members, and shared settings under a single entity`,builder:e=>e.command(m).command(h).command(g).command(_).command(F).command(p).command(b).command(D).command(S).command(k).command(M).command(P).demandCommand(1),handler:()=>{}};export{I as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,m as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Create an Origin CA certificate. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:e=>e.option(`csr`,{type:`string`,description:`The Certificate Signing Request (CSR). Must be newline-encoded.`}).option(`hostnames`,{type:`string`,array:!0,description:"Array of hostnames or wildcard names bound to the certificate. Hostnames must be fully qualified domain names (FQDNs) belonging to zones on your account (e.g., `example.com` or `sub.example.com`). Wildcards are supported only as a `*.` prefix for a single level (e.g., `*.example.com`). Double wildcards (`*.*.example.com`) and interior wildcards (`foo.*.example.com`) are not allowed. The wildcard suffix must be a multi-label domain (`*.example.com` is valid, but `*.com` is not). Unicode/IDN hostnames are accepted and automatically converted to punycode."}).option(`request-type`,{type:`string`,description:`Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).`,choices:[`origin-rsa`,`origin-ecc`,`keyless-certificate`]}).option(`requested-validity`,{type:`number`,description:`The number of days for which the certificate should be valid.`,default:5475}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){l({command:`cf origin-ca-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/certificates`,pathParams:{},bodyKind:`json`,body:{csr:n.csr,hostnames:n.hostnames,requestType:n.requestType,requestedValidity:n.requestedValidity,body:n.body},validation:`passed`});return}let a=await r(n);if(n.body){let e=s(n.body);c(await u(`Creating origin ca certificate`,async()=>a.post(`/certificates`,{body:e})),{successLabel:`Created origin ca certificate`});return}if(n.csr===void 0&&(n.csr=await e(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),n.hostnames===void 0)throw Error(`--hostnames is required (or pass --body with this field set).`);n.requestType===void 0&&(n.requestType=await t(`request-type`,`Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).`,[`origin-rsa`,`origin-ecc`,`keyless-certificate`]));let d={};n.csr!==void 0&&o(d,[`csr`],i(n.csr,`csr`,`text`)),n.hostnames!==void 0&&o(d,[`hostnames`],n.hostnames),n.requestType!==void 0&&o(d,[`request_type`],i(n.requestType,`requestType`,`text`)),n.requestedValidity!==void 0&&o(d,[`requested_validity`],n.requestedValidity),c(await u(`Creating origin ca certificate`,async()=>a.post(`/certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created origin ca certificate`})}},f={command:`delete <certificateId>`,describe:`Revoke an existing Origin CA certificate by its serial number. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.certificateId,`certificateId`),e.dryRun){l({command:`cf origin-ca-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/certificates/${e.certificateId??`<certificateId>`}`,pathParams:{certificateId:String(e.certificateId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(!await n(`origin ca certificate`,String(e.certificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let n=s(e.body);c(await u(`Deleting origin ca certificate`,async()=>t.delete(`/certificates/${e.certificateId}`,{body:n})),{successLabel:`Deleted origin ca certificate`});return}c(await u(`Deleting origin ca certificate`,async()=>t.originCaCertificates.delete(e.certificateId)),{successLabel:`Deleted origin ca certificate`})}},p={command:`get <certificateId>`,describe:`Get an existing Origin CA certificate by its serial number. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.certificateId,`certificateId`);let t=await r(e);c(await u(`Loading origin ca certificate`,async()=>t.originCaCertificates.get(e.certificateId)),{successLabel:`Loaded origin ca certificate`})}},m={command:`list`,describe:`List all existing Origin CA certificates for a given zone. You can use an Origin CA Key as your User Service Key or an API token when calling this endpoint ([see above](#requests)).`,builder:e=>e.option(`zone-id`,{type:`string`,description:`Identifier.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of records per page.`}).option(`limit`,{type:`number`,description:`Limit to the number of records returned.`}).option(`offset`,{type:`number`,description:`Offset the results`}),handler:async e=>{let t={};e.zoneId!==void 0&&(t.zone_id=e.zoneId),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset);let n=await r(e);c(await u(`Loading origin ca certificates`,async()=>n.originCaCertificates.list(Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded origin ca certificates`})}},h={command:`origin-ca-certificates`,describe:`Free Cloudflare-signed certificates installed on your origin server for Full (strict) SSL mode`,builder:e=>e.command(d).command(f).command(p).command(m).demandCommand(1),handler:()=>{}};export{h as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{m as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{n as i,t as a}from"./body-parser-iA3vRFmh.mjs";import{t as o}from"./output-CqGQp2r6.mjs";import{t as s}from"./dry-run-FV0pZwdg.mjs";import{t as c}from"./progress-5sHFvwez.mjs";const l={command:`get`,describe:`Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically send a Post-Quantum keyshare in the first message to the origin (for fastest connections when the origin supports and prefers PQ), supported means that PQ algorithms are advertised but only used when requested by the origin, and off means that PQ algorithms are not advertised.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading origin post quantum encryption`,async()=>r.originPostQuantumEncryption.get(i)),{successLabel:`Loaded origin post quantum encryption`})}},u={command:`update`,describe:`Instructs Cloudflare to use Post-Quantum (PQ) key agreement algorithms when connecting to your origin. Preferred instructs Cloudflare to opportunistically send a Post-Quantum keyshare in the first message to the origin (for fastest connections when the origin supports and prefers PQ), supported means that PQ algorithms are advertised but only used when requested by the origin, and off means that PQ algorithms are not advertised.`,builder:e=>e.option(`value`,{type:`string`,description:`Value of the Origin Post Quantum Encryption Setting.`,choices:[`preferred`,`supported`,`off`],default:`supported`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async l=>{if(l.dryRun){s({command:`cf origin-post-quantum-encryption update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zoneId??`<zoneId>`}/cache/origin_post_quantum_encryption`,pathParams:{zoneId:String(l.zoneId??``)},bodyKind:`json`,body:{value:l.value,body:l.body},validation:`passed`});return}let u=await t(l);if(l.zoneId=await n({zone:l.zone},u,{quiet:l.quiet}),l.body){let e=a(l.body);o(await c(`Updating origin post quantum encryption`,async()=>u.put(`/zones/${l.zoneId}/cache/origin_post_quantum_encryption`,{body:e})),{successLabel:`Updated origin post quantum encryption`});return}l.value===void 0&&(l.value=await e(`value`,`Value of the Origin Post Quantum Encryption Setting.`,[`preferred`,`supported`,`off`]));let d={};l.value!==void 0&&i(d,[`value`],r(l.value,`value`,`text`)),o(await c(`Updating origin post quantum encryption`,async()=>u.put(`/zones/${l.zoneId}/cache/origin_post_quantum_encryption`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated origin post quantum encryption`})}},d={command:`origin-post-quantum-encryption`,describe:`Enable post-quantum key exchange for connections between Cloudflare and your origin server`,builder:e=>e.command(l).command(u).demandCommand(1),handler:()=>{}};export{d as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`create`,describe:`Upload your own certificate you want Cloudflare to use for edge-to-origin communication to override the shared certificate. Please note that it is important to keep only one certificate active. Also, make sure to enable zone-level authenticated origin pulls by making a PUT call to settings endpoint to see the uploaded certificate in use.`,builder:e=>e.option(`certificate`,{type:`string`,description:`The zone's leaf certificate.`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf origin-tls-client-auth create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/origin_tls_client_auth`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{certificate:t.certificate,privateKey:t.privateKey,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating origin tls client auth`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth`,{body:e})),{successLabel:`Created origin tls client auth`});return}t.certificate===void 0&&(t.certificate=await e(`certificate`,`The zone's leaf certificate.`)),t.privateKey===void 0&&(t.privateKey=await e(`private-key`,`The zone's private key.`,{kind:`secret`}));let d={};t.certificate!==void 0&&o(d,[`certificate`],i(t.certificate,`certificate`,`text`)),t.privateKey!==void 0&&o(d,[`private_key`],i(t.privateKey,`privateKey`,`text`)),c(await u(`Creating origin tls client auth`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created origin tls client auth`})}},f={command:`delete <certificateId>`,describe:`Removes a client certificate used for zone-level authenticated origin pulls.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.certificateId,`certificateId`),e.dryRun){l({command:`cf origin-tls-client-auth delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/origin_tls_client_auth/${e.certificateId??`<certificateId>`}`,pathParams:{certificateId:String(e.certificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`origin tls client auth`,String(e.certificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting origin tls client auth`,async()=>i.delete(`/zones/${e.zoneId}/origin_tls_client_auth/${e.certificateId}`,{body:t})),{successLabel:`Deleted origin tls client auth`});return}c(await u(`Deleting origin tls client auth`,async()=>i.originTLSClientAuth.delete(e.certificateId,o)),{successLabel:`Deleted origin tls client auth`})}},p={command:`get <certificateId>`,describe:`Retrieves details for a specific client certificate used in zone-level authenticated origin pulls.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.certificateId,`certificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading origin tls client auth`,async()=>t.originTLSClientAuth.get(e.certificateId,i)),{successLabel:`Loaded origin tls client auth`})}},m={command:`list`,describe:`List certificate ID - hostname associations for the given zone. Shows which hostnames are associated to which certificates for authenticated origin pulls.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of associations per page.`}).option(`status`,{type:`string`,description:`Filter associations by status. Use comma-separated values to filter by multiple statuses, or "all" to include every status. Defaults to "active" if not provided.`,choices:[`active`,`pending_deployment`,`pending_deletion`,`deleted`,`deployment_timed_out`,`deletion_timed_out`,`all`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.status!==void 0&&(t.status=e.status);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading hostname associations`,async()=>i.originTLSClientAuth.hostnameAssociations.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded hostname associations`})}},h={command:`hostname-associations`,describe:`List hostname associations for authenticated origin pull certificates`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`create`,describe:`Upload a certificate to be used for client authentication on a hostname. 10 hostname certificates per zone are allowed.`,builder:e=>e.option(`certificate`,{type:`string`,description:`The hostname certificate.`}).option(`private-key`,{type:`string`,description:`The hostname certificate's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf origin-tls-client-auth hostname-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/origin_tls_client_auth/hostnames/certificates`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{certificate:t.certificate,privateKey:t.privateKey,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating hostname certificate`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth/hostnames/certificates`,{body:e})),{successLabel:`Created hostname certificate`});return}t.certificate===void 0&&(t.certificate=await e(`certificate`,`The hostname certificate.`)),t.privateKey===void 0&&(t.privateKey=await e(`private-key`,`The hostname certificate's private key.`,{kind:`secret`}));let d={};t.certificate!==void 0&&o(d,[`certificate`],i(t.certificate,`certificate`,`text`)),t.privateKey!==void 0&&o(d,[`private_key`],i(t.privateKey,`privateKey`,`text`)),c(await u(`Creating hostname certificate`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth/hostnames/certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created hostname certificate`})}},_={command:`delete <certificateId>`,describe:"Removes a client certificate used for authenticated origin pulls on a specific hostname. Note: Before deleting the certificate, you must first invalidate the hostname for client authentication by sending a PUT request with `enabled` set to null. After invalidating the association, the certificate can be safely deleted.",builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.certificateId,`certificateId`),e.dryRun){l({command:`cf origin-tls-client-auth hostname-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/origin_tls_client_auth/hostnames/certificates/${e.certificateId??`<certificateId>`}`,pathParams:{certificateId:String(e.certificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`hostname certificate`,String(e.certificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting hostname certificate`,async()=>i.delete(`/zones/${e.zoneId}/origin_tls_client_auth/hostnames/certificates/${e.certificateId}`,{body:t})),{successLabel:`Deleted hostname certificate`});return}c(await u(`Deleting hostname certificate`,async()=>i.originTLSClientAuth.hostnameCertificates.delete(e.certificateId,o)),{successLabel:`Deleted hostname certificate`})}},v={command:`get <certificateId>`,describe:`Get the certificate by ID to be used for client authentication on a hostname.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.certificateId,`certificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading hostname certificate`,async()=>t.originTLSClientAuth.hostnameCertificates.get(e.certificateId,i)),{successLabel:`Loaded hostname certificate`})}},y={command:`list`,describe:`Lists all client certificates configured for per-hostname authenticated origin pulls on the zone.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading hostname certificates`,async()=>t.originTLSClientAuth.hostnameCertificates.list(i)),{successLabel:`Loaded hostname certificates`})}},b={command:`hostname-certificates`,describe:`Per-hostname client certificates for granular authenticated origin pull configurations`,builder:e=>e.command(g).command(_).command(v).command(y).demandCommand(1),handler:()=>{}},x={command:`get <hostname>`,describe:`Retrieves the client certificate authentication status for a specific hostname, showing whether authenticated origin pulls are enabled.`,builder:e=>e.positional(`hostname`,{type:`string`,description:`The hostname on the origin for which the client certificate uploaded will be used.`,demandOption:!0}),handler:async e=>{a(e.hostname,`hostname`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading hostname`,async()=>t.originTLSClientAuth.hostnames.get(e.hostname,i)),{successLabel:`Loaded hostname`})}},S={command:`update`,describe:`Associate a hostname to a certificate and enable, disable or invalidate the association. If disabled, client certificate will not be sent to the hostname even if activated at the zone level. 100 maximum associations on a single certificate are allowed. Note: Use a null value for parameter *enabled* to invalidate the association.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf origin-tls-client-auth hostnames update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/origin_tls_client_auth/hostnames`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=s(e.body);c(await u(`Updating hostname`,async()=>t.put(`/zones/${e.zoneId}/origin_tls_client_auth/hostnames`,{body:n})),{successLabel:`Updated hostname`});return}c(await u(`Updating hostname`,async()=>t.originTLSClientAuth.hostnames.update(i)),{successLabel:`Updated hostname`})}},C={command:`hostnames`,describe:`Enable or disable authenticated origin pulls on individual hostnames`,builder:e=>e.command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`list`,describe:`Lists all client certificates configured for zone-level authenticated origin pulls.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading origin tls client auth`,async()=>t.originTLSClientAuth.list(i)),{successLabel:`Loaded origin tls client auth`})}},T={command:`get`,describe:`Get whether zone-level authenticated origin pulls is enabled or not. It is false by default.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading setting`,async()=>t.originTLSClientAuth.settings.get(i)),{successLabel:`Loaded setting`})}},E={command:`update`,describe:`Enable or disable zone-level authenticated origin pulls. 'enabled' should be set true either before/after the certificate is uploaded to see the certificate in use.`,builder:e=>e.option(`enabled`,{type:`boolean`,description:`Indicates whether zone-level authenticated origin pulls is enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf origin-tls-client-auth settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/origin_tls_client_auth/settings`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating setting`,async()=>t.put(`/zones/${e.zoneId}/origin_tls_client_auth/settings`,{body:n})),{successLabel:`Updated setting`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let i={};e.enabled!==void 0&&o(i,[`enabled`],e.enabled),c(await u(`Updating setting`,async()=>t.put(`/zones/${e.zoneId}/origin_tls_client_auth/settings`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated setting`})}},D={command:`settings`,describe:`Zone-wide toggle to enable or disable authenticated origin pulls`,builder:e=>e.command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`create`,describe:`Upload your own certificate you want Cloudflare to use for edge-to-origin communication to override the shared certificate. Please note that it is important to keep only one certificate active. Also, make sure to enable zone-level authenticated origin pulls by making a PUT call to settings endpoint to see the uploaded certificate in use.`,builder:e=>e.option(`certificate`,{type:`string`,description:`The zone's leaf certificate.`}).option(`private-key`,{type:`string`,description:`The zone's private key.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){l({command:`cf origin-tls-client-auth zone-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/origin_tls_client_auth`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{certificate:t.certificate,privateKey:t.privateKey,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating zone certificate`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth`,{body:e})),{successLabel:`Created zone certificate`});return}t.certificate===void 0&&(t.certificate=await e(`certificate`,`The zone's leaf certificate.`)),t.privateKey===void 0&&(t.privateKey=await e(`private-key`,`The zone's private key.`,{kind:`secret`}));let d={};t.certificate!==void 0&&o(d,[`certificate`],i(t.certificate,`certificate`,`text`)),t.privateKey!==void 0&&o(d,[`private_key`],i(t.privateKey,`privateKey`,`text`)),c(await u(`Creating zone certificate`,async()=>a.post(`/zones/${t.zoneId}/origin_tls_client_auth`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created zone certificate`})}},k={command:`delete <certificateId>`,describe:`Removes a client certificate used for zone-level authenticated origin pulls.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(a(e.certificateId,`certificateId`),e.dryRun){l({command:`cf origin-tls-client-auth zone-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/origin_tls_client_auth/${e.certificateId??`<certificateId>`}`,pathParams:{certificateId:String(e.certificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`zone certificate`,String(e.certificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting zone certificate`,async()=>i.delete(`/zones/${e.zoneId}/origin_tls_client_auth/${e.certificateId}`,{body:t})),{successLabel:`Deleted zone certificate`});return}c(await u(`Deleting zone certificate`,async()=>i.originTLSClientAuth.zoneCertificates.delete(e.certificateId,o)),{successLabel:`Deleted zone certificate`})}},A={command:`get <certificateId>`,describe:`Retrieves details for a specific client certificate used in zone-level authenticated origin pulls.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.certificateId,`certificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading zone certificate`,async()=>t.originTLSClientAuth.zoneCertificates.get(e.certificateId,i)),{successLabel:`Loaded zone certificate`})}},j={command:`list`,describe:`Lists all client certificates configured for zone-level authenticated origin pulls.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading zone certificates`,async()=>t.originTLSClientAuth.zoneCertificates.list(i)),{successLabel:`Loaded zone certificates`})}},M={command:`zone-certificates`,describe:`Zone-level client certificates used for authenticated origin pulls across all hostnames`,builder:e=>e.command(O).command(k).command(A).command(j).demandCommand(1),handler:()=>{}},N={command:`origin-tls-client-auth`,describe:`Authenticated Origin Pulls — require Cloudflare to present a client certificate when connecting to your origin`,builder:e=>e.command(d).command(f).command(p).command(w).command(h).command(b).command(C).command(D).command(M).demandCommand(1),handler:()=>{}};export{N as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r,r as i}from"./input-validation-BpVQi9rR.mjs";import{n as a,t as o}from"./body-parser-iA3vRFmh.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./progress-5sHFvwez.mjs";const u={command:`create`,describe:`Creates a new Page Rule.`,builder:e=>e.option(`priority`,{type:`number`,description:"The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to take precedence (rule B: `/images/special/*`), specify a higher priority for rule B so it overrides rule A. ",default:1}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`],default:`disabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){c({command:`cf page-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/pagerules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{priority:e.priority,status:e.status,body:e.body},validation:`passed`});return}let i=await t(e);if(e.zoneId=await n({zone:e.zone},i,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Creating page rule`,async()=>i.post(`/zones/${e.zoneId}/pagerules`,{body:t})),{successLabel:`Created page rule`});return}let u={};e.priority!==void 0&&a(u,[`priority`],e.priority),e.status!==void 0&&a(u,[`status`],r(e.status,`status`,`text`)),s(await l(`Creating page rule`,async()=>i.post(`/zones/${e.zoneId}/pagerules`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created page rule`})}},d={command:`delete <pageruleId>`,describe:`Deletes an existing Page Rule.`,builder:e=>e.positional(`pageruleId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async r=>{if(i(r.pageruleId,`pageruleId`),r.dryRun){c({command:`cf page-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/pagerules/${r.pageruleId??`<pageruleId>`}`,pathParams:{pageruleId:String(r.pageruleId??``),zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let a=await t(r),o=await n({zone:r.zone},a,{quiet:r.quiet});if(r.zoneId=o,!await e(`page rule`,String(r.pageruleId??``),{force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting page rule`,async()=>a.pageRules.delete(r.pageruleId,o)),{successLabel:`Deleted page rule`})}},f={command:`edit <pageruleId>`,describe:`Updates one or more fields of an existing Page Rule.`,builder:e=>e.positional(`pageruleId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`priority`,{type:`number`,description:"The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to take precedence (rule B: `/images/special/*`), specify a higher priority for rule B so it overrides rule A. ",default:1}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`],default:`disabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(i(e.pageruleId,`pageruleId`),e.dryRun){c({command:`cf page-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/pagerules/${e.pageruleId??`<pageruleId>`}`,pathParams:{pageruleId:String(e.pageruleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{priority:e.priority,status:e.status,body:e.body},validation:`passed`});return}let u=await t(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating page rule`,async()=>u.patch(`/zones/${e.zoneId}/pagerules/${e.pageruleId}`,{body:t})),{successLabel:`Updated page rule`});return}let d={};e.priority!==void 0&&a(d,[`priority`],e.priority),e.status!==void 0&&a(d,[`status`],r(e.status,`status`,`text`)),s(await l(`Updating page rule`,async()=>u.patch(`/zones/${e.zoneId}/pagerules/${e.pageruleId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated page rule`})}},p={command:`get <pageruleId>`,describe:`Fetches the details of a Page Rule.`,builder:e=>e.positional(`pageruleId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{i(e.pageruleId,`pageruleId`);let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading page rule`,async()=>r.pageRules.get(e.pageruleId,a)),{successLabel:`Loaded page rule`})}},m={command:`list`,describe:`Fetches Page Rules in a zone.`,builder:e=>e.option(`order`,{type:`string`,description:`The field used to sort returned Page Rules.`,choices:[`status`,`priority`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned Page Rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`]}),handler:async e=>{let r={};e.order!==void 0&&(r.order=e.order),e.direction!==void 0&&(r.direction=e.direction),e.match!==void 0&&(r.match=e.match),e.status!==void 0&&(r.status=e.status);let i=await t(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading page rules`,async()=>i.pageRules.list(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded page rules`})}},h={command:`update <pageruleId>`,describe:`Replaces the configuration of an existing Page Rule. The configuration of the updated Page Rule will exactly match the data passed in the API request.`,builder:e=>e.positional(`pageruleId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`priority`,{type:`number`,description:"The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to take precedence (rule B: `/images/special/*`), specify a higher priority for rule B so it overrides rule A. ",default:1}).option(`status`,{type:`string`,description:`The status of the Page Rule.`,choices:[`active`,`disabled`],default:`disabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(i(e.pageruleId,`pageruleId`),e.dryRun){c({command:`cf page-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/pagerules/${e.pageruleId??`<pageruleId>`}`,pathParams:{pageruleId:String(e.pageruleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{priority:e.priority,status:e.status,body:e.body},validation:`passed`});return}let u=await t(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating page rule`,async()=>u.put(`/zones/${e.zoneId}/pagerules/${e.pageruleId}`,{body:t})),{successLabel:`Updated page rule`});return}let d={};e.priority!==void 0&&a(d,[`priority`],e.priority),e.status!==void 0&&a(d,[`status`],r(e.status,`status`,`text`)),s(await l(`Updating page rule`,async()=>u.put(`/zones/${e.zoneId}/pagerules/${e.pageruleId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated page rule`})}},g={command:`page-rules`,describe:`Legacy URL-pattern rules that override zone settings for matching requests — prefer Rules/Transform Rules instead`,builder:e=>e.command(u).command(d).command(f).command(p).command(m).command(h).demandCommand(1),handler:()=>{}};export{g as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,m as t,p as n,t as r,u as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`get <connectionId>`,describe:`Fetches a connection detected by Page Shield by connection ID.`,builder:e=>e.positional(`connectionId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{o(e.connectionId,`connectionId`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading connection`,async()=>t.pageShield.connections.get(n,e.connectionId)),{successLabel:`Loaded connection`})}},p={command:`list`,describe:`Lists all connections detected by Page Shield.`,builder:e=>e.option(`exclude-urls`,{type:`string`,description:`Excludes connections whose URL contains one of the URL-encoded URLs separated by commas.`}).option(`urls`,{type:`string`,description:`Includes connections whose URL contain one or more URL-encoded URLs separated by commas.`}).option(`hosts`,{type:`string`,description:`Includes connections that match one or more URL-encoded hostnames separated by commas. Wildcards are supported at the start and end of each hostname to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results. We additionally support a special value "all". When "all" is used, the API will return all the connections with the applied filters in a single page. This feature is best-effort and it may only work for zones with a low number of connections`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned connections.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned connections.`,choices:[`asc`,`desc`]}).option(`prioritize-malicious`,{type:`boolean`,description:`When true, malicious connections appear first in the returned connections.`,default:!1}).option(`exclude-cdn-cgi`,{type:`boolean`,description:"When true, excludes connections seen in a `/cdn-cgi` path from the returned connections. The default value is true.",default:!1}).option(`status`,{type:`string`,description:"Filters the returned connections using a comma-separated list of connection statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default value is `active`."}).option(`page-url`,{type:`string`,description:`Includes connections that match one or more page URLs (separated by commas) where they were last seen Wildcards are supported at the start and end of each page URL to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of connections as a file, limited to 50000 entries.`,choices:[`csv`]}),handler:async e=>{let t={};e.excludeUrls!==void 0&&(t.exclude_urls=e.excludeUrls),e.urls!==void 0&&(t.urls=e.urls),e.hosts!==void 0&&(t.hosts=e.hosts),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.direction!==void 0&&(t.direction=e.direction),e.prioritizeMalicious!==void 0&&(t.prioritize_malicious=e.prioritizeMalicious),e.excludeCdnCgi!==void 0&&(t.exclude_cdn_cgi=e.excludeCdnCgi),e.status!==void 0&&(t.status=e.status),e.pageUrl!==void 0&&(t.page_url=e.pageUrl),e.export!==void 0&&(t.export=e.export);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,l(await d(`Loading connections`,async()=>n.pageShield.connections.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded connections`})}},m={command:`connections`,describe:`Third-party connections made by scripts on your pages — track data exfiltration risks`,builder:e=>e.command(f).command(p).demandCommand(1),handler:()=>{}},h={command:`get <cookieId>`,describe:`Fetches a cookie collected by Page Shield by cookie ID.`,builder:e=>e.positional(`cookieId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{o(e.cookieId,`cookieId`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading cooky`,async()=>t.pageShield.cookies.get(n,e.cookieId)),{successLabel:`Loaded cooky`})}},g={command:`list`,describe:`Lists all cookies collected by Page Shield.`,builder:e=>e.option(`hosts`,{type:`string`,description:`Includes cookies that match one or more URL-encoded hostnames separated by commas. Wildcards are supported at the start and end of each hostname to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results. We additionally support a special value "all". When "all" is used, the API will return all the cookies with the applied filters in a single page. This feature is best-effort and it may only work for zones with a low number of cookies`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned cookies.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned cookies.'`,choices:[`asc`,`desc`]}).option(`page-url`,{type:`string`,description:`Includes connections that match one or more page URLs (separated by commas) where they were last seen Wildcards are supported at the start and end of each page URL to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of cookies as a file, limited to 50000 entries.`,choices:[`csv`]}).option(`name`,{type:`string`,description:`Filters the returned cookies that match the specified name. Wildcards are supported at the start and end to support starts with, ends with and contains. e.g. session*`}).option(`secure`,{type:`boolean`,description:`Filters the returned cookies that are set with Secure`,default:!1}).option(`http-only`,{type:`boolean`,description:`Filters the returned cookies that are set with HttpOnly`,default:!1}).option(`same-site`,{type:`string`,description:`Filters the returned cookies that match the specified same_site attribute`,choices:[`lax`,`strict`,`none`]}).option(`type`,{type:`string`,description:`Filters the returned cookies that match the specified type attribute`,choices:[`first_party`,`unknown`]}).option(`path`,{type:`string`,description:`Filters the returned cookies that match the specified path attribute`}).option(`domain`,{type:`string`,description:`Filters the returned cookies that match the specified domain attribute`}),handler:async e=>{let t={};e.hosts!==void 0&&(t.hosts=e.hosts),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.direction!==void 0&&(t.direction=e.direction),e.pageUrl!==void 0&&(t.page_url=e.pageUrl),e.export!==void 0&&(t.export=e.export),e.name!==void 0&&(t.name=e.name),e.secure!==void 0&&(t.secure=e.secure),e.httpOnly!==void 0&&(t.http_only=e.httpOnly),e.sameSite!==void 0&&(t.same_site=e.sameSite),e.type!==void 0&&(t.type=e.type),e.path!==void 0&&(t.path=e.path),e.domain!==void 0&&(t.domain=e.domain);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,l(await d(`Loading cookies`,async()=>n.pageShield.cookies.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded cookies`})}},_={command:`cookies`,describe:`Cookies set by scripts on your pages with classification and same-site attribute tracking`,builder:e=>e.command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`get`,describe:`Fetches the Page Shield settings.`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading page shield`,async()=>t.pageShield.get(n)),{successLabel:`Loaded page shield`})}},y={command:`create`,describe:`Create a Page Shield policy.`,builder:e=>e.option(`action`,{type:`string`,description:`The action to take if the expression matches`,choices:[`allow`,`log`,`add_reporting_directives`]}).option(`description`,{type:`string`,description:`A description for the policy`}).option(`enabled`,{type:`boolean`,description:`Whether the policy is enabled`}).option(`expression`,{type:`string`,description:`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`}).option(`value`,{type:`string`,description:`The policy which will be applied`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){u({command:`cf page-shield policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/page_shield/policies`,pathParams:{zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{action:n.action,description:n.description,enabled:n.enabled,expression:n.expression,value:n.value,body:n.body},validation:`passed`});return}let o=await r(n);if(n.zoneId=await i({zone:n.zone},o,{quiet:n.quiet}),n.body){let e=c(n.body);l(await d(`Creating policy`,async()=>o.post(`/zones/${n.zoneId}/page_shield/policies`,{body:e})),{successLabel:`Created policy`});return}if(n.action===void 0&&(n.action=await t(`action`,`The action to take if the expression matches`,[`allow`,`log`,`add_reporting_directives`])),n.description===void 0&&(n.description=await e(`description`,`A description for the policy`)),n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);n.expression===void 0&&(n.expression=await e(`expression`,`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`)),n.value===void 0&&(n.value=await e(`value`,`The policy which will be applied`));let f={};n.action!==void 0&&s(f,[`action`],a(n.action,`action`,`text`)),n.description!==void 0&&s(f,[`description`],a(n.description,`description`,`text`)),n.enabled!==void 0&&s(f,[`enabled`],n.enabled),n.expression!==void 0&&s(f,[`expression`],a(n.expression,`expression`,`text`)),n.value!==void 0&&s(f,[`value`],a(n.value,`value`,`text`)),l(await d(`Creating policy`,async()=>o.post(`/zones/${n.zoneId}/page_shield/policies`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created policy`})}},b={command:`delete <policyId>`,describe:`Delete a Page Shield policy by ID.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(o(e.policyId,`policyId`),e.dryRun){u({command:`cf page-shield policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/page_shield/policies/${e.policyId??`<policyId>`}`,pathParams:{zoneId:String(e.zoneId??``),policyId:String(e.policyId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`policy`,String(e.policyId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting policy`,async()=>t.pageShield.policies.delete(a,e.policyId)),{successLabel:`Deleted policy`})}},x={command:`get <policyId>`,describe:`Fetches a Page Shield policy by ID.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{o(e.policyId,`policyId`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading policy`,async()=>t.pageShield.policies.get(n,e.policyId)),{successLabel:`Loaded policy`})}},S={command:`list`,describe:`Lists all Page Shield policies.`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading policies`,async()=>t.pageShield.policies.list(n)),{successLabel:`Loaded policies`})}},C={command:`update <policyId>`,describe:`Update a Page Shield policy by ID.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`action`,{type:`string`,description:`The action to take if the expression matches`,choices:[`allow`,`log`,`add_reporting_directives`]}).option(`description`,{type:`string`,description:`A description for the policy`}).option(`enabled`,{type:`boolean`,description:`Whether the policy is enabled`}).option(`expression`,{type:`string`,description:`The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax`}).option(`value`,{type:`string`,description:`The policy which will be applied`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(o(e.policyId,`policyId`),e.dryRun){u({command:`cf page-shield policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/page_shield/policies/${e.policyId??`<policyId>`}`,pathParams:{zoneId:String(e.zoneId??``),policyId:String(e.policyId??``)},bodyKind:`json`,body:{action:e.action,description:e.description,enabled:e.enabled,expression:e.expression,value:e.value,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Updating policy`,async()=>t.put(`/zones/${e.zoneId}/page_shield/policies/${e.policyId}`,{body:n})),{successLabel:`Updated policy`});return}let n={};e.action!==void 0&&s(n,[`action`],a(e.action,`action`,`text`)),e.description!==void 0&&s(n,[`description`],a(e.description,`description`,`text`)),e.enabled!==void 0&&s(n,[`enabled`],e.enabled),e.expression!==void 0&&s(n,[`expression`],a(e.expression,`expression`,`text`)),e.value!==void 0&&s(n,[`value`],a(e.value,`value`,`text`)),l(await d(`Updating policy`,async()=>t.put(`/zones/${e.zoneId}/page_shield/policies/${e.policyId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated policy`})}},w={command:`policies`,describe:`Content Security Policies that control which scripts and connections are allowed on your pages`,builder:e=>e.command(y).command(b).command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`get <scriptId>`,describe:`Fetches a script detected by Page Shield by script ID.`,builder:e=>e.positional(`scriptId`,{type:`string`,description:`Identifier`,demandOption:!0}),handler:async e=>{o(e.scriptId,`scriptId`);let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading script`,async()=>t.pageShield.scripts.get(n,e.scriptId)),{successLabel:`Loaded script`})}},E={command:`list`,describe:`Lists all scripts detected by Page Shield.`,builder:e=>e.option(`exclude-urls`,{type:`string`,description:`Excludes scripts whose URL contains one of the URL-encoded URLs separated by commas.`}).option(`urls`,{type:`string`,description:`Includes scripts whose URL contain one or more URL-encoded URLs separated by commas.`}).option(`hosts`,{type:`string`,description:`Includes scripts that match one or more URL-encoded hostnames separated by commas. Wildcards are supported at the start and end of each hostname to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`page`,{type:`string`,description:`The current page number of the paginated results. We additionally support a special value "all". When "all" is used, the API will return all the scripts with the applied filters in a single page. This feature is best-effort and it may only work for zones with a low number of scripts`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order-by`,{type:`string`,description:`The field used to sort returned scripts.`,choices:[`first_seen_at`,`last_seen_at`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned scripts.`,choices:[`asc`,`desc`]}).option(`prioritize-malicious`,{type:`boolean`,description:`When true, malicious scripts appear first in the returned scripts.`,default:!1}).option(`exclude-cdn-cgi`,{type:`boolean`,description:"When true, excludes scripts seen in a `/cdn-cgi` path from the returned scripts. The default value is true.",default:!1}).option(`exclude-duplicates`,{type:`boolean`,description:`When true, excludes duplicate scripts. We consider a script duplicate of another if their javascript content matches and they share the same url host and zone hostname. In such case, we return the most recent script for the URL host and zone hostname combination.`,default:!1}).option(`status`,{type:`string`,description:"Filters the returned scripts using a comma-separated list of scripts statuses. Accepted values: `active`, `infrequent`, and `inactive`. The default value is `active`."}).option(`page-url`,{type:`string`,description:`Includes scripts that match one or more page URLs (separated by commas) where they were last seen Wildcards are supported at the start and end of each page URL to support starts with, ends with and contains. If no wildcards are used, results will be filtered by exact match`}).option(`export`,{type:`string`,description:`Export the list of scripts as a file, limited to 50000 entries.`,choices:[`csv`]}),handler:async e=>{let t={};e.excludeUrls!==void 0&&(t.exclude_urls=e.excludeUrls),e.urls!==void 0&&(t.urls=e.urls),e.hosts!==void 0&&(t.hosts=e.hosts),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.direction!==void 0&&(t.direction=e.direction),e.prioritizeMalicious!==void 0&&(t.prioritize_malicious=e.prioritizeMalicious),e.excludeCdnCgi!==void 0&&(t.exclude_cdn_cgi=e.excludeCdnCgi),e.excludeDuplicates!==void 0&&(t.exclude_duplicates=e.excludeDuplicates),e.status!==void 0&&(t.status=e.status),e.pageUrl!==void 0&&(t.page_url=e.pageUrl),e.export!==void 0&&(t.export=e.export);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,l(await d(`Loading scripts`,async()=>n.pageShield.scripts.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded scripts`})}},D={command:`scripts`,describe:`JavaScript files detected on your pages with change tracking and malicious code detection`,builder:e=>e.command(T).command(E).demandCommand(1),handler:()=>{}},O={command:`update`,describe:`Updates Page Shield settings.`,builder:e=>e.option(`enabled`,{type:`boolean`,description:`When true, indicates that Page Shield is enabled.`}).option(`use-cloudflare-reporting-endpoint`,{type:`boolean`,description:`When true, CSP reports will be sent to https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report`}).option(`use-connection-url-path`,{type:`boolean`,description:`When true, the paths associated with connections URLs will also be analyzed.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){u({command:`cf page-shield update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/page_shield`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,useCloudflareReportingEndpoint:e.useCloudflareReportingEndpoint,useConnectionUrlPath:e.useConnectionUrlPath,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=c(e.body);l(await d(`Updating page shield`,async()=>t.put(`/zones/${e.zoneId}/page_shield`,{body:n})),{successLabel:`Updated page shield`});return}let n={};e.enabled!==void 0&&s(n,[`enabled`],e.enabled),e.useCloudflareReportingEndpoint!==void 0&&s(n,[`use_cloudflare_reporting_endpoint`],e.useCloudflareReportingEndpoint),e.useConnectionUrlPath!==void 0&&s(n,[`use_connection_url_path`],e.useConnectionUrlPath),l(await d(`Updating page shield`,async()=>t.put(`/zones/${e.zoneId}/page_shield`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated page shield`})}},k={command:`page-shield`,describe:`Client-side security — monitor JavaScript, connections, and cookies on your pages for supply-chain attacks`,builder:e=>e.command(v).command(O).command(m).command(_).command(w).command(D).demandCommand(1),handler:()=>{}};export{k as default};
|
package/dist/pages-F1vdzqgC.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`create`,describe:`Create a new project.`,builder:e=>e.option(`build-config-build-caching`,{type:`boolean`,description:`Enable build caching for the project.`}).option(`build-config-build-command`,{type:`string`,description:`Command used to build project.`}).option(`build-config-destination-dir`,{type:`string`,description:`Output directory of the build.`}).option(`build-config-root-dir`,{type:`string`,description:`Directory to run the command.`}).option(`build-config-web-analytics-tag`,{type:`string`,description:`The classifying tag for analytics.`}).option(`build-config-web-analytics-token`,{type:`string`,description:`The auth token for analytics.`}).option(`deployment-configs-preview-always-use-latest-compatibility-date`,{type:`boolean`,description:`Whether to always use the latest compatibility date for Pages Functions.`,default:!1}).option(`deployment-configs-preview-build-image-major-version`,{type:`number`,description:`The major version of the build image to use for Pages Functions.`,default:3}).option(`deployment-configs-preview-compatibility-date`,{type:`string`,description:`Compatibility date used for Pages Functions.`}).option(`deployment-configs-preview-compatibility-flags`,{type:`string`,array:!0,description:`Compatibility flags used for Pages Functions.`}).option(`deployment-configs-preview-fail-open`,{type:`boolean`,description:`Whether to fail open when the deployment config cannot be applied.`,default:!0}).option(`deployment-configs-preview-limits-cpu-ms`,{type:`number`,description:`CPU time limit in milliseconds.`}).option(`deployment-configs-preview-placement-mode`,{type:`string`,description:`Placement mode.`}).option(`deployment-configs-preview-usage-model`,{type:`string`,description:`The usage model for Pages Functions.`,choices:[`standard`,`bundled`,`unbound`],default:`standard`}).option(`deployment-configs-preview-wrangler-config-hash`,{type:`string`,description:`Hash of the Wrangler configuration used for the deployment.`}).option(`deployment-configs-production-always-use-latest-compatibility-date`,{type:`boolean`,description:`Whether to always use the latest compatibility date for Pages Functions.`,default:!1}).option(`deployment-configs-production-build-image-major-version`,{type:`number`,description:`The major version of the build image to use for Pages Functions.`,default:3}).option(`deployment-configs-production-compatibility-date`,{type:`string`,description:`Compatibility date used for Pages Functions.`}).option(`deployment-configs-production-compatibility-flags`,{type:`string`,array:!0,description:`Compatibility flags used for Pages Functions.`}).option(`deployment-configs-production-fail-open`,{type:`boolean`,description:`Whether to fail open when the deployment config cannot be applied.`,default:!0}).option(`deployment-configs-production-limits-cpu-ms`,{type:`number`,description:`CPU time limit in milliseconds.`}).option(`deployment-configs-production-placement-mode`,{type:`string`,description:`Placement mode.`}).option(`deployment-configs-production-usage-model`,{type:`string`,description:`The usage model for Pages Functions.`,choices:[`standard`,`bundled`,`unbound`],default:`standard`}).option(`deployment-configs-production-wrangler-config-hash`,{type:`string`,description:`Hash of the Wrangler configuration used for the deployment.`}).option(`name`,{type:`string`,description:`Name of the project.`}).option(`production-branch`,{type:`string`,description:`Production branch of the project. Used to identify production deployments.`}).option(`source-config-deployments-enabled`,{type:`boolean`,description:`Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. `}).option(`source-config-owner`,{type:`string`,description:`The owner of the repository.`}).option(`source-config-owner-id`,{type:`string`,description:`The owner ID of the repository.`}).option(`source-config-path-excludes`,{type:`string`,array:!0,description:"A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported."}).option(`source-config-path-includes`,{type:`string`,array:!0,description:"A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported."}).option(`source-config-pr-comments-enabled`,{type:`boolean`,description:`Whether to enable PR comments.`}).option(`source-config-preview-branch-excludes`,{type:`string`,array:!0,description:"A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`."}).option(`source-config-preview-branch-includes`,{type:`string`,array:!0,description:"A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`."}).option(`source-config-preview-deployment-setting`,{type:`string`,description:`Controls whether commits to preview branches trigger a preview deployment.`,choices:[`all`,`none`,`custom`]}).option(`source-config-production-branch`,{type:`string`,description:`The production branch of the repository.`}).option(`source-config-production-deployments-enabled`,{type:`boolean`,description:`Whether to trigger a production deployment on commits to the production branch.`}).option(`source-config-repo-id`,{type:`string`,description:`The ID of the repository.`}).option(`source-config-repo-name`,{type:`string`,description:`The name of the repository.`}).option(`source-type`,{type:`string`,description:`The source control management provider.`,choices:[`github`,`gitlab`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`deployment-configs-preview-compatibility-date`,`deployment-configs-preview-compatibility-flags`,`deployment-configs-preview-limits-cpu-ms`,`deployment-configs-preview-placement-mode`,`deployment-configs-preview-wrangler-config-hash`,`deployment-configs-production-compatibility-date`,`deployment-configs-production-compatibility-flags`,`deployment-configs-production-limits-cpu-ms`,`deployment-configs-production-placement-mode`,`deployment-configs-production-wrangler-config-hash`].some(t=>e[t]!==void 0)){let t=[`deployment-configs-preview-limits-cpu-ms`,`deployment-configs-preview-placement-mode`,`deployment-configs-production-limits-cpu-ms`,`deployment-configs-production-placement-mode`].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 --deployment_configs-* flag is set`)}return!0}).check(e=>{if([`source-config-deployments-enabled`,`source-config-owner`,`source-config-owner-id`,`source-config-path-excludes`,`source-config-path-includes`,`source-config-pr-comments-enabled`,`source-config-preview-branch-excludes`,`source-config-preview-branch-includes`,`source-config-preview-deployment-setting`,`source-config-production-branch`,`source-config-production-deployments-enabled`,`source-config-repo-id`,`source-config-repo-name`,`source-type`].some(t=>e[t]!==void 0)){let t=[`source-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --source-* flag is set`)}return!0}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf pages projects create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pages/projects`,pathParams:{},bodyKind:`json`,body:{buildConfigBuildCaching:r.buildConfigBuildCaching,buildConfigBuildCommand:r.buildConfigBuildCommand,buildConfigDestinationDir:r.buildConfigDestinationDir,buildConfigRootDir:r.buildConfigRootDir,buildConfigWebAnalyticsTag:r.buildConfigWebAnalyticsTag,buildConfigWebAnalyticsToken:r.buildConfigWebAnalyticsToken,deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate:r.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate,deploymentConfigsPreviewBuildImageMajorVersion:r.deploymentConfigsPreviewBuildImageMajorVersion,deploymentConfigsPreviewCompatibilityDate:r.deploymentConfigsPreviewCompatibilityDate,deploymentConfigsPreviewCompatibilityFlags:r.deploymentConfigsPreviewCompatibilityFlags,deploymentConfigsPreviewFailOpen:r.deploymentConfigsPreviewFailOpen,deploymentConfigsPreviewLimitsCpuMs:r.deploymentConfigsPreviewLimitsCpuMs,deploymentConfigsPreviewPlacementMode:r.deploymentConfigsPreviewPlacementMode,deploymentConfigsPreviewUsageModel:r.deploymentConfigsPreviewUsageModel,deploymentConfigsPreviewWranglerConfigHash:r.deploymentConfigsPreviewWranglerConfigHash,deploymentConfigsProductionAlwaysUseLatestCompatibilityDate:r.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate,deploymentConfigsProductionBuildImageMajorVersion:r.deploymentConfigsProductionBuildImageMajorVersion,deploymentConfigsProductionCompatibilityDate:r.deploymentConfigsProductionCompatibilityDate,deploymentConfigsProductionCompatibilityFlags:r.deploymentConfigsProductionCompatibilityFlags,deploymentConfigsProductionFailOpen:r.deploymentConfigsProductionFailOpen,deploymentConfigsProductionLimitsCpuMs:r.deploymentConfigsProductionLimitsCpuMs,deploymentConfigsProductionPlacementMode:r.deploymentConfigsProductionPlacementMode,deploymentConfigsProductionUsageModel:r.deploymentConfigsProductionUsageModel,deploymentConfigsProductionWranglerConfigHash:r.deploymentConfigsProductionWranglerConfigHash,name:r.name,productionBranch:r.productionBranch,sourceConfigDeploymentsEnabled:r.sourceConfigDeploymentsEnabled,sourceConfigOwner:r.sourceConfigOwner,sourceConfigOwnerId:r.sourceConfigOwnerId,sourceConfigPathExcludes:r.sourceConfigPathExcludes,sourceConfigPathIncludes:r.sourceConfigPathIncludes,sourceConfigPrCommentsEnabled:r.sourceConfigPrCommentsEnabled,sourceConfigPreviewBranchExcludes:r.sourceConfigPreviewBranchExcludes,sourceConfigPreviewBranchIncludes:r.sourceConfigPreviewBranchIncludes,sourceConfigPreviewDeploymentSetting:r.sourceConfigPreviewDeploymentSetting,sourceConfigProductionBranch:r.sourceConfigProductionBranch,sourceConfigProductionDeploymentsEnabled:r.sourceConfigProductionDeploymentsEnabled,sourceConfigRepoId:r.sourceConfigRepoId,sourceConfigRepoName:r.sourceConfigRepoName,sourceType:r.sourceType,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating project`,async()=>p.post(`/accounts/${m}/pages/projects`,{body:e})),{successLabel:`Created project`});return}r.name===void 0&&(r.name=await t(`name`,`Name of the project.`)),r.productionBranch===void 0&&(r.productionBranch=await t(`production-branch`,`Production branch of the project. Used to identify production deployments.`));let h={};r.buildConfigBuildCaching!==void 0&&s(h,[`build_config`,`build_caching`],r.buildConfigBuildCaching),r.buildConfigBuildCommand!==void 0&&s(h,[`build_config`,`build_command`],a(r.buildConfigBuildCommand,`buildConfigBuildCommand`,`text`)),r.buildConfigDestinationDir!==void 0&&s(h,[`build_config`,`destination_dir`],a(r.buildConfigDestinationDir,`buildConfigDestinationDir`,`text`)),r.buildConfigRootDir!==void 0&&s(h,[`build_config`,`root_dir`],a(r.buildConfigRootDir,`buildConfigRootDir`,`text`)),r.buildConfigWebAnalyticsTag!==void 0&&s(h,[`build_config`,`web_analytics_tag`],a(r.buildConfigWebAnalyticsTag,`buildConfigWebAnalyticsTag`,`text`)),r.buildConfigWebAnalyticsToken!==void 0&&s(h,[`build_config`,`web_analytics_token`],a(r.buildConfigWebAnalyticsToken,`buildConfigWebAnalyticsToken`,`text`)),r.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate!==void 0&&s(h,[`deployment_configs`,`preview`,`always_use_latest_compatibility_date`],r.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate),r.deploymentConfigsPreviewBuildImageMajorVersion!==void 0&&s(h,[`deployment_configs`,`preview`,`build_image_major_version`],r.deploymentConfigsPreviewBuildImageMajorVersion),r.deploymentConfigsPreviewCompatibilityDate!==void 0&&s(h,[`deployment_configs`,`preview`,`compatibility_date`],a(r.deploymentConfigsPreviewCompatibilityDate,`deploymentConfigsPreviewCompatibilityDate`,`text`)),r.deploymentConfigsPreviewCompatibilityFlags!==void 0&&s(h,[`deployment_configs`,`preview`,`compatibility_flags`],r.deploymentConfigsPreviewCompatibilityFlags),r.deploymentConfigsPreviewFailOpen!==void 0&&s(h,[`deployment_configs`,`preview`,`fail_open`],r.deploymentConfigsPreviewFailOpen),r.deploymentConfigsPreviewLimitsCpuMs!==void 0&&s(h,[`deployment_configs`,`preview`,`limits`,`cpu_ms`],r.deploymentConfigsPreviewLimitsCpuMs),r.deploymentConfigsPreviewPlacementMode!==void 0&&s(h,[`deployment_configs`,`preview`,`placement`,`mode`],a(r.deploymentConfigsPreviewPlacementMode,`deploymentConfigsPreviewPlacementMode`,`text`)),r.deploymentConfigsPreviewUsageModel!==void 0&&s(h,[`deployment_configs`,`preview`,`usage_model`],a(r.deploymentConfigsPreviewUsageModel,`deploymentConfigsPreviewUsageModel`,`text`)),r.deploymentConfigsPreviewWranglerConfigHash!==void 0&&s(h,[`deployment_configs`,`preview`,`wrangler_config_hash`],a(r.deploymentConfigsPreviewWranglerConfigHash,`deploymentConfigsPreviewWranglerConfigHash`,`text`)),r.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate!==void 0&&s(h,[`deployment_configs`,`production`,`always_use_latest_compatibility_date`],r.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate),r.deploymentConfigsProductionBuildImageMajorVersion!==void 0&&s(h,[`deployment_configs`,`production`,`build_image_major_version`],r.deploymentConfigsProductionBuildImageMajorVersion),r.deploymentConfigsProductionCompatibilityDate!==void 0&&s(h,[`deployment_configs`,`production`,`compatibility_date`],a(r.deploymentConfigsProductionCompatibilityDate,`deploymentConfigsProductionCompatibilityDate`,`text`)),r.deploymentConfigsProductionCompatibilityFlags!==void 0&&s(h,[`deployment_configs`,`production`,`compatibility_flags`],r.deploymentConfigsProductionCompatibilityFlags),r.deploymentConfigsProductionFailOpen!==void 0&&s(h,[`deployment_configs`,`production`,`fail_open`],r.deploymentConfigsProductionFailOpen),r.deploymentConfigsProductionLimitsCpuMs!==void 0&&s(h,[`deployment_configs`,`production`,`limits`,`cpu_ms`],r.deploymentConfigsProductionLimitsCpuMs),r.deploymentConfigsProductionPlacementMode!==void 0&&s(h,[`deployment_configs`,`production`,`placement`,`mode`],a(r.deploymentConfigsProductionPlacementMode,`deploymentConfigsProductionPlacementMode`,`text`)),r.deploymentConfigsProductionUsageModel!==void 0&&s(h,[`deployment_configs`,`production`,`usage_model`],a(r.deploymentConfigsProductionUsageModel,`deploymentConfigsProductionUsageModel`,`text`)),r.deploymentConfigsProductionWranglerConfigHash!==void 0&&s(h,[`deployment_configs`,`production`,`wrangler_config_hash`],a(r.deploymentConfigsProductionWranglerConfigHash,`deploymentConfigsProductionWranglerConfigHash`,`text`)),r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),r.productionBranch!==void 0&&s(h,[`production_branch`],a(r.productionBranch,`productionBranch`,`text`)),r.sourceConfigDeploymentsEnabled!==void 0&&s(h,[`source`,`config`,`deployments_enabled`],r.sourceConfigDeploymentsEnabled),r.sourceConfigOwner!==void 0&&s(h,[`source`,`config`,`owner`],a(r.sourceConfigOwner,`sourceConfigOwner`,`text`)),r.sourceConfigOwnerId!==void 0&&s(h,[`source`,`config`,`owner_id`],a(r.sourceConfigOwnerId,`sourceConfigOwnerId`,`text`)),r.sourceConfigPathExcludes!==void 0&&s(h,[`source`,`config`,`path_excludes`],r.sourceConfigPathExcludes),r.sourceConfigPathIncludes!==void 0&&s(h,[`source`,`config`,`path_includes`],r.sourceConfigPathIncludes),r.sourceConfigPrCommentsEnabled!==void 0&&s(h,[`source`,`config`,`pr_comments_enabled`],r.sourceConfigPrCommentsEnabled),r.sourceConfigPreviewBranchExcludes!==void 0&&s(h,[`source`,`config`,`preview_branch_excludes`],r.sourceConfigPreviewBranchExcludes),r.sourceConfigPreviewBranchIncludes!==void 0&&s(h,[`source`,`config`,`preview_branch_includes`],r.sourceConfigPreviewBranchIncludes),r.sourceConfigPreviewDeploymentSetting!==void 0&&s(h,[`source`,`config`,`preview_deployment_setting`],a(r.sourceConfigPreviewDeploymentSetting,`sourceConfigPreviewDeploymentSetting`,`text`)),r.sourceConfigProductionBranch!==void 0&&s(h,[`source`,`config`,`production_branch`],a(r.sourceConfigProductionBranch,`sourceConfigProductionBranch`,`text`)),r.sourceConfigProductionDeploymentsEnabled!==void 0&&s(h,[`source`,`config`,`production_deployments_enabled`],r.sourceConfigProductionDeploymentsEnabled),r.sourceConfigRepoId!==void 0&&s(h,[`source`,`config`,`repo_id`],a(r.sourceConfigRepoId,`sourceConfigRepoId`,`text`)),r.sourceConfigRepoName!==void 0&&s(h,[`source`,`config`,`repo_name`],a(r.sourceConfigRepoName,`sourceConfigRepoName`,`text`)),r.sourceType!==void 0&&s(h,[`source`,`type`],a(r.sourceType,`sourceType`,`text`)),l(await f(`Creating project`,async()=>p.post(`/accounts/${m}/pages/projects`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created project`})}},m={command:`delete <projectName>`,describe:`Delete a project by name.`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.projectName,`projectName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}`,pathParams:{projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`project`,String(t.projectName??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await f(`Deleting project`,async()=>a.pages.projects.delete(t.projectName,s)),{successLabel:`Deleted project`})}},h={command:`create <projectName>`,describe:`Start a new deployment from production. The repository and account must have already been authorized on the Cloudflare Pages dashboard.`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`branch`,{type:`string`,description:"The branch to build the new deployment from. The `HEAD` of the branch will be used. If omitted, the production branch will be used by default."}).option(`commit-dirty`,{type:`string`,description:`Boolean string indicating if the working directory has uncommitted changes.`}).option(`commit-hash`,{type:`string`,description:`Git commit SHA associated with this deployment.`}).option(`commit-message`,{type:`string`,description:`Git commit message associated with this deployment.`}).option(`manifest`,{type:`string`,description:`JSON string containing a manifest of files to deploy. Maps file paths to their content hashes. Required for direct upload deployments. Maximum 20,000 entries. `}).option(`pages-build-output-dir`,{type:`string`,description:`The build output directory path.`}).option(`wrangler-config-hash`,{type:`string`,description:`Hash of the Wrangler configuration file used for this deployment.`}),handler:async t=>{if(o(t.projectName,`projectName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects deployments create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/deployments`,pathParams:{projectName:String(t.projectName??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,branch:t.branch,commitDirty:t.commitDirty,commitHash:t.commitHash,commitMessage:t.commitMessage,manifest:t.manifest,pagesBuildOutputDir:t.pagesBuildOutputDir,wranglerConfigHash:t.wranglerConfigHash},validation:`passed`});return}let r=await i(t),s=t.local?d:await n(r);if(t.accountId=s,t.file!==void 0||t.body!==void 0||t.branch!==void 0||t.commitDirty!==void 0||t.commitHash!==void 0||t.commitMessage!==void 0||t.manifest!==void 0||t.pagesBuildOutputDir!==void 0||t.wranglerConfigHash!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`_headers`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`_headers`,t.body);t.branch!==void 0&&e.append(`branch`,String(a(t.branch,`branch`,`text`)??``)),t.commitDirty!==void 0&&e.append(`commit_dirty`,String(a(t.commitDirty,`commitDirty`,`text`)??``)),t.commitHash!==void 0&&e.append(`commit_hash`,String(a(t.commitHash,`commitHash`,`text`)??``)),t.commitMessage!==void 0&&e.append(`commit_message`,String(a(t.commitMessage,`commitMessage`,`text`)??``)),t.manifest!==void 0&&e.append(`manifest`,String(a(t.manifest,`manifest`,`text`)??``)),t.pagesBuildOutputDir!==void 0&&e.append(`pages_build_output_dir`,String(a(t.pagesBuildOutputDir,`pagesBuildOutputDir`,`text`)??``)),t.wranglerConfigHash!==void 0&&e.append(`wrangler_config_hash`,String(a(t.wranglerConfigHash,`wranglerConfigHash`,`text`)??``)),l(await f(`Creating deployment`,async()=>r.post(`/accounts/${s}/pages/projects/${t.projectName}/deployments`,{body:e})),{successLabel:`Created deployment`});return}if(t.body){let e=a(t.body,`body`,`binary`);l(await f(`Creating deployment`,async()=>r.post(`/accounts/${s}/pages/projects/${t.projectName}/deployments`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created deployment`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`delete <deploymentId>`,describe:`Delete a deployment.`,builder:e=>e.positional(`deploymentId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`force`,{type:`boolean`,description:`Allow deletion of aliased non-production deployments when a normal delete would be rejected.`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{o(t.deploymentId,`deploymentId`);let a={};if(t.force!==void 0&&(a.force=t.force),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects deployments delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/deployments/${t.deploymentId??`<deploymentId>`}`,pathParams:{deploymentId:String(t.deploymentId??``),projectName:String(t.projectName??``)},bodyKind:`json`,body:{...a},validation:`passed`});return}let s=await i(t),c=t.local?d:await n(s);if(t.accountId=c,!await r(`deployment`,String(t.deploymentId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await f(`Deleting deployment`,async()=>s.pages.projects.deployments.delete(t.deploymentId,t.projectName,c,Object.keys(a).length>0?a:void 0)),{successLabel:`Deleted deployment`})}},_={command:`get <deploymentId>`,describe:`Fetch information about a deployment.`,builder:e=>e.positional(`deploymentId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}),handler:async e=>{o(e.deploymentId,`deploymentId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading deployment`,async()=>t.pages.projects.deployments.get(e.deploymentId,e.projectName,r)),{successLabel:`Loaded deployment`})}},v={command:`get <deploymentId>`,describe:`Fetch deployment logs for a project.`,builder:e=>e.positional(`deploymentId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}),handler:async e=>{o(e.deploymentId,`deploymentId`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading log`,async()=>t.pages.projects.deployments.history.logs.get(e.deploymentId,e.projectName,r)),{successLabel:`Loaded log`})}},y={command:`logs`,describe:`Pages projects, deployments, build logs, and custom domain bindings`,builder:e=>e.command(v).demandCommand(1),handler:()=>{}},b={command:`history`,describe:`Operations for projects.deployments.history`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`list`,describe:`Fetch a list of project deployments.`,builder:e=>e.option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`env`,{type:`string`,description:`What type of deployments to fetch.`,choices:[`production`,`preview`]}).option(`page`,{type:`number`,description:`Which page of deployments to fetch.`}).option(`per-page`,{type:`number`,description:`How many deployments to return per page.`}),handler:async e=>{let t={};e.env!==void 0&&(t.env=e.env),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading deployments`,async()=>r.pages.projects.deployments.list(e.projectName,a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded deployments`})}},S={command:`retry <deploymentId>`,describe:`Retry a previous deployment.`,builder:e=>e.positional(`deploymentId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.deploymentId,`deploymentId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects deployments retry`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/deployments/${t.deploymentId??`<deploymentId>`}/retry`,pathParams:{deploymentId:String(t.deploymentId??``),projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating deployment`,async()=>r.pages.projects.deployments.retry(t.deploymentId,t.projectName,a)),{successLabel:`Created deployment`})}},C={command:`rollback <deploymentId>`,describe:`Rollback the production deployment to a previous deployment. You can only rollback to succesful builds on production.`,builder:e=>e.positional(`deploymentId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.deploymentId,`deploymentId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects deployments rollback`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/deployments/${t.deploymentId??`<deploymentId>`}/rollback`,pathParams:{deploymentId:String(t.deploymentId??``),projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Creating deployment`,async()=>r.pages.projects.deployments.rollback(t.deploymentId,t.projectName,a)),{successLabel:`Created deployment`})}},w={command:`deployments`,describe:`Pages projects, deployments, build logs, and custom domain bindings`,builder:e=>e.command(h).command(g).command(_).command(x).command(S).command(C).command(b).demandCommand(1),handler:()=>{}},T={command:`create <projectName>`,describe:`Add a new domain for the Pages project.`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`name`,{type:`string`,description:`The domain name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async r=>{if(o(r.projectName,`projectName`),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf pages projects domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pages/projects/${r.projectName??`<projectName>`}/domains`,pathParams:{projectName:String(r.projectName??``)},bodyKind:`json`,body:{name:r.name,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating domain`,async()=>p.post(`/accounts/${m}/pages/projects/${r.projectName}/domains`,{body:e})),{successLabel:`Created domain`});return}r.name===void 0&&(r.name=await t(`name`,`The domain name.`));let h={};r.name!==void 0&&s(h,[`name`],a(r.name,`name`,`text`)),l(await f(`Creating domain`,async()=>p.post(`/accounts/${m}/pages/projects/${r.projectName}/domains`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created domain`})}},E={command:`delete <domainName>`,describe:`Delete a Pages project's domain.`,builder:e=>e.positional(`domainName`,{type:`string`,description:`The domain name.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.domainName,`domainName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/domains/${t.domainName??`<domainName>`}`,pathParams:{domainName:String(t.domainName??``),projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`domain`,String(t.domainName??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}l(await f(`Deleting domain`,async()=>a.pages.projects.domains.delete(t.domainName,t.projectName,s)),{successLabel:`Deleted domain`})}},D={command:`edit <domainName>`,describe:`Retry the validation status of a single domain.`,builder:e=>e.positional(`domainName`,{type:`string`,description:`The domain name.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(o(t.domainName,`domainName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/domains/${t.domainName??`<domainName>`}`,pathParams:{domainName:String(t.domainName??``),projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let r=await i(t),a=t.local?d:await n(r);t.accountId=a,l(await f(`Updating domain`,async()=>r.pages.projects.domains.edit(t.domainName,t.projectName,a)),{successLabel:`Updated domain`})}},O={command:`get <domainName>`,describe:`Fetch a single domain.`,builder:e=>e.positional(`domainName`,{type:`string`,description:`The domain name.`,demandOption:!0}).option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}),handler:async e=>{o(e.domainName,`domainName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading domain`,async()=>t.pages.projects.domains.get(e.domainName,e.projectName,r)),{successLabel:`Loaded domain`})}},k={command:`list`,describe:`Fetch a list of all domains associated with a Pages project.`,builder:e=>e.option(`project-name`,{type:`string`,description:`Name of the project.`,demandOption:!0}),handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading domains`,async()=>t.pages.projects.domains.list(e.projectName,r)),{successLabel:`Loaded domains`})}},A={command:`domains`,describe:`Pages projects, deployments, build logs, and custom domain bindings`,builder:e=>e.command(T).command(E).command(D).command(O).command(k).demandCommand(1),handler:()=>{}},j={command:`edit <projectName>`,describe:`Set new attributes for an existing project. Modify environment variables. To delete an environment variable, set the key to null.`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`build-config-build-caching`,{type:`boolean`,description:`Enable build caching for the project.`}).option(`build-config-build-command`,{type:`string`,description:`Command used to build project.`}).option(`build-config-destination-dir`,{type:`string`,description:`Output directory of the build.`}).option(`build-config-root-dir`,{type:`string`,description:`Directory to run the command.`}).option(`build-config-web-analytics-tag`,{type:`string`,description:`The classifying tag for analytics.`}).option(`build-config-web-analytics-token`,{type:`string`,description:`The auth token for analytics.`}).option(`deployment-configs-preview-always-use-latest-compatibility-date`,{type:`boolean`,description:`Whether to always use the latest compatibility date for Pages Functions.`,default:!1}).option(`deployment-configs-preview-build-image-major-version`,{type:`number`,description:`The major version of the build image to use for Pages Functions.`,default:3}).option(`deployment-configs-preview-compatibility-date`,{type:`string`,description:`Compatibility date used for Pages Functions.`}).option(`deployment-configs-preview-compatibility-flags`,{type:`string`,array:!0,description:`Compatibility flags used for Pages Functions.`}).option(`deployment-configs-preview-fail-open`,{type:`boolean`,description:`Whether to fail open when the deployment config cannot be applied.`,default:!0}).option(`deployment-configs-preview-limits-cpu-ms`,{type:`number`,description:`CPU time limit in milliseconds.`}).option(`deployment-configs-preview-placement-mode`,{type:`string`,description:`Placement mode.`}).option(`deployment-configs-preview-usage-model`,{type:`string`,description:`The usage model for Pages Functions.`,choices:[`standard`,`bundled`,`unbound`],default:`standard`}).option(`deployment-configs-preview-wrangler-config-hash`,{type:`string`,description:`Hash of the Wrangler configuration used for the deployment.`}).option(`deployment-configs-production-always-use-latest-compatibility-date`,{type:`boolean`,description:`Whether to always use the latest compatibility date for Pages Functions.`,default:!1}).option(`deployment-configs-production-build-image-major-version`,{type:`number`,description:`The major version of the build image to use for Pages Functions.`,default:3}).option(`deployment-configs-production-compatibility-date`,{type:`string`,description:`Compatibility date used for Pages Functions.`}).option(`deployment-configs-production-compatibility-flags`,{type:`string`,array:!0,description:`Compatibility flags used for Pages Functions.`}).option(`deployment-configs-production-fail-open`,{type:`boolean`,description:`Whether to fail open when the deployment config cannot be applied.`,default:!0}).option(`deployment-configs-production-limits-cpu-ms`,{type:`number`,description:`CPU time limit in milliseconds.`}).option(`deployment-configs-production-placement-mode`,{type:`string`,description:`Placement mode.`}).option(`deployment-configs-production-usage-model`,{type:`string`,description:`The usage model for Pages Functions.`,choices:[`standard`,`bundled`,`unbound`],default:`standard`}).option(`deployment-configs-production-wrangler-config-hash`,{type:`string`,description:`Hash of the Wrangler configuration used for the deployment.`}).option(`name`,{type:`string`,description:`Name of the project.`}).option(`production-branch`,{type:`string`,description:`Production branch of the project. Used to identify production deployments.`}).option(`source-config-deployments-enabled`,{type:`boolean`,description:`Whether to enable automatic deployments when pushing to the source repository. When disabled, no deployments (production or preview) will be triggered automatically. `}).option(`source-config-owner`,{type:`string`,description:`The owner of the repository.`}).option(`source-config-owner-id`,{type:`string`,description:`The owner ID of the repository.`}).option(`source-config-path-excludes`,{type:`string`,array:!0,description:"A list of paths that should be excluded from triggering a preview deployment. Wildcard syntax (`*`) is supported."}).option(`source-config-path-includes`,{type:`string`,array:!0,description:"A list of paths that should be watched to trigger a preview deployment. Wildcard syntax (`*`) is supported."}).option(`source-config-pr-comments-enabled`,{type:`boolean`,description:`Whether to enable PR comments.`}).option(`source-config-preview-branch-excludes`,{type:`string`,array:!0,description:"A list of branches that should not trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`."}).option(`source-config-preview-branch-includes`,{type:`string`,array:!0,description:"A list of branches that should trigger a preview deployment. Wildcard syntax (`*`) is supported. Must be used with `preview_deployment_setting` set to `custom`."}).option(`source-config-preview-deployment-setting`,{type:`string`,description:`Controls whether commits to preview branches trigger a preview deployment.`,choices:[`all`,`none`,`custom`]}).option(`source-config-production-branch`,{type:`string`,description:`The production branch of the repository.`}).option(`source-config-production-deployments-enabled`,{type:`boolean`,description:`Whether to trigger a production deployment on commits to the production branch.`}).option(`source-config-repo-id`,{type:`string`,description:`The ID of the repository.`}).option(`source-config-repo-name`,{type:`string`,description:`The name of the repository.`}).option(`source-type`,{type:`string`,description:`The source control management provider.`,choices:[`github`,`gitlab`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`deployment-configs-preview-compatibility-date`,`deployment-configs-preview-compatibility-flags`,`deployment-configs-preview-limits-cpu-ms`,`deployment-configs-preview-placement-mode`,`deployment-configs-preview-wrangler-config-hash`,`deployment-configs-production-compatibility-date`,`deployment-configs-production-compatibility-flags`,`deployment-configs-production-limits-cpu-ms`,`deployment-configs-production-placement-mode`,`deployment-configs-production-wrangler-config-hash`].some(t=>e[t]!==void 0)){let t=[`deployment-configs-preview-limits-cpu-ms`,`deployment-configs-preview-placement-mode`,`deployment-configs-production-limits-cpu-ms`,`deployment-configs-production-placement-mode`].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 --deployment_configs-* flag is set`)}return!0}).check(e=>{if([`source-config-deployments-enabled`,`source-config-owner`,`source-config-owner-id`,`source-config-path-excludes`,`source-config-path-includes`,`source-config-pr-comments-enabled`,`source-config-preview-branch-excludes`,`source-config-preview-branch-includes`,`source-config-preview-deployment-setting`,`source-config-production-branch`,`source-config-production-deployments-enabled`,`source-config-repo-id`,`source-config-repo-name`,`source-type`].some(t=>e[t]!==void 0)){let t=[`source-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --source-* flag is set`)}return!0}),handler:async t=>{if(o(t.projectName,`projectName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}`,pathParams:{projectName:String(t.projectName??``)},bodyKind:`json`,body:{buildConfigBuildCaching:t.buildConfigBuildCaching,buildConfigBuildCommand:t.buildConfigBuildCommand,buildConfigDestinationDir:t.buildConfigDestinationDir,buildConfigRootDir:t.buildConfigRootDir,buildConfigWebAnalyticsTag:t.buildConfigWebAnalyticsTag,buildConfigWebAnalyticsToken:t.buildConfigWebAnalyticsToken,deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate:t.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate,deploymentConfigsPreviewBuildImageMajorVersion:t.deploymentConfigsPreviewBuildImageMajorVersion,deploymentConfigsPreviewCompatibilityDate:t.deploymentConfigsPreviewCompatibilityDate,deploymentConfigsPreviewCompatibilityFlags:t.deploymentConfigsPreviewCompatibilityFlags,deploymentConfigsPreviewFailOpen:t.deploymentConfigsPreviewFailOpen,deploymentConfigsPreviewLimitsCpuMs:t.deploymentConfigsPreviewLimitsCpuMs,deploymentConfigsPreviewPlacementMode:t.deploymentConfigsPreviewPlacementMode,deploymentConfigsPreviewUsageModel:t.deploymentConfigsPreviewUsageModel,deploymentConfigsPreviewWranglerConfigHash:t.deploymentConfigsPreviewWranglerConfigHash,deploymentConfigsProductionAlwaysUseLatestCompatibilityDate:t.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate,deploymentConfigsProductionBuildImageMajorVersion:t.deploymentConfigsProductionBuildImageMajorVersion,deploymentConfigsProductionCompatibilityDate:t.deploymentConfigsProductionCompatibilityDate,deploymentConfigsProductionCompatibilityFlags:t.deploymentConfigsProductionCompatibilityFlags,deploymentConfigsProductionFailOpen:t.deploymentConfigsProductionFailOpen,deploymentConfigsProductionLimitsCpuMs:t.deploymentConfigsProductionLimitsCpuMs,deploymentConfigsProductionPlacementMode:t.deploymentConfigsProductionPlacementMode,deploymentConfigsProductionUsageModel:t.deploymentConfigsProductionUsageModel,deploymentConfigsProductionWranglerConfigHash:t.deploymentConfigsProductionWranglerConfigHash,name:t.name,productionBranch:t.productionBranch,sourceConfigDeploymentsEnabled:t.sourceConfigDeploymentsEnabled,sourceConfigOwner:t.sourceConfigOwner,sourceConfigOwnerId:t.sourceConfigOwnerId,sourceConfigPathExcludes:t.sourceConfigPathExcludes,sourceConfigPathIncludes:t.sourceConfigPathIncludes,sourceConfigPrCommentsEnabled:t.sourceConfigPrCommentsEnabled,sourceConfigPreviewBranchExcludes:t.sourceConfigPreviewBranchExcludes,sourceConfigPreviewBranchIncludes:t.sourceConfigPreviewBranchIncludes,sourceConfigPreviewDeploymentSetting:t.sourceConfigPreviewDeploymentSetting,sourceConfigProductionBranch:t.sourceConfigProductionBranch,sourceConfigProductionDeploymentsEnabled:t.sourceConfigProductionDeploymentsEnabled,sourceConfigRepoId:t.sourceConfigRepoId,sourceConfigRepoName:t.sourceConfigRepoName,sourceType:t.sourceType,body:t.body},validation:`passed`});return}let r=await i(t),p=t.local?d:await n(r);if(t.accountId=p,t.body){let e=c(t.body);l(await f(`Updating project`,async()=>r.patch(`/accounts/${p}/pages/projects/${t.projectName}`,{body:e})),{successLabel:`Updated project`});return}let m={};t.buildConfigBuildCaching!==void 0&&s(m,[`build_config`,`build_caching`],t.buildConfigBuildCaching),t.buildConfigBuildCommand!==void 0&&s(m,[`build_config`,`build_command`],a(t.buildConfigBuildCommand,`buildConfigBuildCommand`,`text`)),t.buildConfigDestinationDir!==void 0&&s(m,[`build_config`,`destination_dir`],a(t.buildConfigDestinationDir,`buildConfigDestinationDir`,`text`)),t.buildConfigRootDir!==void 0&&s(m,[`build_config`,`root_dir`],a(t.buildConfigRootDir,`buildConfigRootDir`,`text`)),t.buildConfigWebAnalyticsTag!==void 0&&s(m,[`build_config`,`web_analytics_tag`],a(t.buildConfigWebAnalyticsTag,`buildConfigWebAnalyticsTag`,`text`)),t.buildConfigWebAnalyticsToken!==void 0&&s(m,[`build_config`,`web_analytics_token`],a(t.buildConfigWebAnalyticsToken,`buildConfigWebAnalyticsToken`,`text`)),t.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate!==void 0&&s(m,[`deployment_configs`,`preview`,`always_use_latest_compatibility_date`],t.deploymentConfigsPreviewAlwaysUseLatestCompatibilityDate),t.deploymentConfigsPreviewBuildImageMajorVersion!==void 0&&s(m,[`deployment_configs`,`preview`,`build_image_major_version`],t.deploymentConfigsPreviewBuildImageMajorVersion),t.deploymentConfigsPreviewCompatibilityDate!==void 0&&s(m,[`deployment_configs`,`preview`,`compatibility_date`],a(t.deploymentConfigsPreviewCompatibilityDate,`deploymentConfigsPreviewCompatibilityDate`,`text`)),t.deploymentConfigsPreviewCompatibilityFlags!==void 0&&s(m,[`deployment_configs`,`preview`,`compatibility_flags`],t.deploymentConfigsPreviewCompatibilityFlags),t.deploymentConfigsPreviewFailOpen!==void 0&&s(m,[`deployment_configs`,`preview`,`fail_open`],t.deploymentConfigsPreviewFailOpen),t.deploymentConfigsPreviewLimitsCpuMs!==void 0&&s(m,[`deployment_configs`,`preview`,`limits`,`cpu_ms`],t.deploymentConfigsPreviewLimitsCpuMs),t.deploymentConfigsPreviewPlacementMode!==void 0&&s(m,[`deployment_configs`,`preview`,`placement`,`mode`],a(t.deploymentConfigsPreviewPlacementMode,`deploymentConfigsPreviewPlacementMode`,`text`)),t.deploymentConfigsPreviewUsageModel!==void 0&&s(m,[`deployment_configs`,`preview`,`usage_model`],a(t.deploymentConfigsPreviewUsageModel,`deploymentConfigsPreviewUsageModel`,`text`)),t.deploymentConfigsPreviewWranglerConfigHash!==void 0&&s(m,[`deployment_configs`,`preview`,`wrangler_config_hash`],a(t.deploymentConfigsPreviewWranglerConfigHash,`deploymentConfigsPreviewWranglerConfigHash`,`text`)),t.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate!==void 0&&s(m,[`deployment_configs`,`production`,`always_use_latest_compatibility_date`],t.deploymentConfigsProductionAlwaysUseLatestCompatibilityDate),t.deploymentConfigsProductionBuildImageMajorVersion!==void 0&&s(m,[`deployment_configs`,`production`,`build_image_major_version`],t.deploymentConfigsProductionBuildImageMajorVersion),t.deploymentConfigsProductionCompatibilityDate!==void 0&&s(m,[`deployment_configs`,`production`,`compatibility_date`],a(t.deploymentConfigsProductionCompatibilityDate,`deploymentConfigsProductionCompatibilityDate`,`text`)),t.deploymentConfigsProductionCompatibilityFlags!==void 0&&s(m,[`deployment_configs`,`production`,`compatibility_flags`],t.deploymentConfigsProductionCompatibilityFlags),t.deploymentConfigsProductionFailOpen!==void 0&&s(m,[`deployment_configs`,`production`,`fail_open`],t.deploymentConfigsProductionFailOpen),t.deploymentConfigsProductionLimitsCpuMs!==void 0&&s(m,[`deployment_configs`,`production`,`limits`,`cpu_ms`],t.deploymentConfigsProductionLimitsCpuMs),t.deploymentConfigsProductionPlacementMode!==void 0&&s(m,[`deployment_configs`,`production`,`placement`,`mode`],a(t.deploymentConfigsProductionPlacementMode,`deploymentConfigsProductionPlacementMode`,`text`)),t.deploymentConfigsProductionUsageModel!==void 0&&s(m,[`deployment_configs`,`production`,`usage_model`],a(t.deploymentConfigsProductionUsageModel,`deploymentConfigsProductionUsageModel`,`text`)),t.deploymentConfigsProductionWranglerConfigHash!==void 0&&s(m,[`deployment_configs`,`production`,`wrangler_config_hash`],a(t.deploymentConfigsProductionWranglerConfigHash,`deploymentConfigsProductionWranglerConfigHash`,`text`)),t.name!==void 0&&s(m,[`name`],a(t.name,`name`,`text`)),t.productionBranch!==void 0&&s(m,[`production_branch`],a(t.productionBranch,`productionBranch`,`text`)),t.sourceConfigDeploymentsEnabled!==void 0&&s(m,[`source`,`config`,`deployments_enabled`],t.sourceConfigDeploymentsEnabled),t.sourceConfigOwner!==void 0&&s(m,[`source`,`config`,`owner`],a(t.sourceConfigOwner,`sourceConfigOwner`,`text`)),t.sourceConfigOwnerId!==void 0&&s(m,[`source`,`config`,`owner_id`],a(t.sourceConfigOwnerId,`sourceConfigOwnerId`,`text`)),t.sourceConfigPathExcludes!==void 0&&s(m,[`source`,`config`,`path_excludes`],t.sourceConfigPathExcludes),t.sourceConfigPathIncludes!==void 0&&s(m,[`source`,`config`,`path_includes`],t.sourceConfigPathIncludes),t.sourceConfigPrCommentsEnabled!==void 0&&s(m,[`source`,`config`,`pr_comments_enabled`],t.sourceConfigPrCommentsEnabled),t.sourceConfigPreviewBranchExcludes!==void 0&&s(m,[`source`,`config`,`preview_branch_excludes`],t.sourceConfigPreviewBranchExcludes),t.sourceConfigPreviewBranchIncludes!==void 0&&s(m,[`source`,`config`,`preview_branch_includes`],t.sourceConfigPreviewBranchIncludes),t.sourceConfigPreviewDeploymentSetting!==void 0&&s(m,[`source`,`config`,`preview_deployment_setting`],a(t.sourceConfigPreviewDeploymentSetting,`sourceConfigPreviewDeploymentSetting`,`text`)),t.sourceConfigProductionBranch!==void 0&&s(m,[`source`,`config`,`production_branch`],a(t.sourceConfigProductionBranch,`sourceConfigProductionBranch`,`text`)),t.sourceConfigProductionDeploymentsEnabled!==void 0&&s(m,[`source`,`config`,`production_deployments_enabled`],t.sourceConfigProductionDeploymentsEnabled),t.sourceConfigRepoId!==void 0&&s(m,[`source`,`config`,`repo_id`],a(t.sourceConfigRepoId,`sourceConfigRepoId`,`text`)),t.sourceConfigRepoName!==void 0&&s(m,[`source`,`config`,`repo_name`],a(t.sourceConfigRepoName,`sourceConfigRepoName`,`text`)),t.sourceType!==void 0&&s(m,[`source`,`type`],a(t.sourceType,`sourceType`,`text`)),l(await f(`Updating project`,async()=>r.patch(`/accounts/${p}/pages/projects/${t.projectName}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated project`})}},M={command:`get <projectName>`,describe:`Fetch a project by name.`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}),handler:async e=>{o(e.projectName,`projectName`);let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading project`,async()=>t.pages.projects.get(e.projectName,r)),{successLabel:`Loaded project`})}},N={command:`list`,describe:`Fetch a list of all user projects.`,builder:e=>e.option(`page`,{type:`number`,description:`Which page of projects to fetch.`}).option(`per-page`,{type:`number`,description:`How many projects to return per page.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading projects`,async()=>r.pages.projects.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded projects`})}},P={command:`purge-build-cache <projectName>`,describe:`Purge all cached build artifacts for a Pages project`,builder:e=>e.positional(`projectName`,{type:`string`,description:`Name of the project.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.projectName,`projectName`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf pages projects purge-build-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pages/projects/${t.projectName??`<projectName>`}/purge_build_cache`,pathParams:{projectName:String(t.projectName??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`project`,String(t.projectName??``),{force:!!t.force,message:`This operation purges the build cache for a Pages project.`})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await f(`Deleting project`,async()=>a.pages.projects.purgeBuildCache(t.projectName,s)),{successLabel:`Deleted project`})}},F={command:`projects`,describe:`Pages projects, deployments, build logs, and custom domain bindings`,builder:e=>e.command(p).command(m).command(j).command(M).command(N).command(P).command(w).command(A).demandCommand(1),handler:()=>{}},I={command:`pages`,describe:`Full-stack application hosting with Git-integrated builds, preview deployments, and custom domains`,builder:e=>e.command(F).demandCommand(1),handler:()=>{}};export{I as default};
|