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
package/dist/auth-caVo2j1K.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,S as n,T as r,_ as i,b as a,n as o,r as s,v as c,w as l,x as u,y as d}from"./auth-BHD_B2p9.mjs";import{a as f}from"./theme-BKCxTQTe.mjs";import{i as p,n as m,r as h,t as g}from"./ui-Dj3No2vN.mjs";import{t as _}from"./output-CqGQp2r6.mjs";const v={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`token`,{type:`string`,description:`API token (skips OAuth flow)`}).option(`force`,{type:`boolean`,description:`Force re-authentication even if already logged in`,default:!1}),handler:async t=>{if(t.token){r(t.token),console.log(h(`API token saved successfully!`)),console.log(`${f.info(`Config file:`)} ${f.muted(n())}`);return}if(t.force)c()&&console.log(m(`Re-authenticating...
|
|
3
|
-
`));else{if(e()){console.log(m(`Already authenticated via API token.`)),console.log(`${f.info(`Config file:`)} ${f.muted(n())}`),console.log(g(`Run ${f.code(`cf auth login --force`)} to switch to OAuth (replaces API token), or ${f.code(`cf auth logout`)} first.`));return}if(d()){if(await i()){let e=l();console.log(m(`You are already logged in.`)),console.log(`${f.info(`Config file:`)} ${f.muted(n())}`),e&&console.log(`${f.info(`Token expires:`)} ${new Date(e.expiresAt).toLocaleString()}`),console.log(g(`Run ${f.code(`cf auth login --force`)} to re-authenticate, or ${f.code(`cf auth logout`)} to log out.`));return}console.log(p(`Existing tokens are invalid or expired. Starting fresh login...
|
|
4
|
-
`))}}console.log(m(`Starting OAuth login flow...
|
|
5
|
-
`));let o=await a();console.log(`
|
|
6
|
-
`+h(`Successfully authenticated!`)),console.log(`${f.info(`Config file:`)} ${f.muted(n())}`),console.log(`${f.info(`Scopes:`)} ${o.scopes.join(`, `)}`),console.log(`${f.info(`Token expires:`)} ${new Date(o.expiresAt).toLocaleString()}`)}},y={command:`logout`,describe:`Log out and remove stored credentials`,handler:async()=>{let t=d(),r=e()!==null,i=!!process.env.CLOUDFLARE_API_TOKEN;if(!t&&!r){i?(console.log(m(`No CF CLI credentials found, but CLOUDFLARE_API_TOKEN environment variable is set.`)),console.log(m(`Unset it with: unset CLOUDFLARE_API_TOKEN`))):s()?(console.log(m(`No CF CLI credentials found, but Wrangler OAuth tokens exist.`)),console.log(m("Run `wrangler logout` to remove Wrangler credentials."))):(console.log(m(`You are not currently logged in.`)),console.log(g(`Run ${f.code(`cf auth login`)} to authenticate.`)));return}console.log(m(`Logging out...`));let a=await u();console.log(h(`Successfully logged out.`)),r?console.log(`${f.info(`Removed:`)} API token from ${f.muted(n())}`):t&&(console.log(`${f.info(`Removed:`)} OAuth tokens from ${f.muted(n())}`),a||console.log(p(`Could not revoke token on server (token may already be expired).`))),i?(console.log(``),console.log(p(`CLOUDFLARE_API_TOKEN environment variable is still set.`)),console.log(m(`You will remain authenticated via the env var. Unset it with: unset CLOUDFLARE_API_TOKEN`))):s()&&(console.log(``),console.log(p(`Wrangler OAuth tokens still exist and will be used as a fallback.`)),console.log(m("Run `wrangler logout` to fully log out, or `cf auth login` to use CF CLI credentials.")))}},b={command:`whoami`,describe:`Show current user and authentication status`,builder:e=>e,handler:async r=>{let i=process.env.CLOUDFLARE_API_TOKEN,a=e(),s=l(),c;c=i?`CLOUDFLARE_API_TOKEN environment variable`:a?`API token from ${n()}`:s?`OAuth token from ${n()}`:`Wrangler OAuth token`;let u;try{u=await o()}catch{_({authenticated:!1,error:`Not logged in`});return}let d=new t({apiToken:u}),f=!1,p;try{let e=await d.get(`/user`);f=!0,p=e.email}catch(e){f=!1,process.env.DEBUG&&console.error(`Token verification error:`,e)}let m={authenticated:!0,authSource:c,tokenValid:f,...p&&{email:p}};s&&(m.scopes=s.scopes,m.expiresAt=s.expiresAt),_(m)}},x={command:`auth`,describe:`Authentication commands (login, logout, whoami)`,builder:e=>e.command(v).command(y).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{x as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o 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:`ai-search <id>`,describe:`AI Search`,builder:e=>e.positional(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`query`,{type:`string`,description:`The query field`}).option(`ranking-options-ranker`,{type:`string`,description:`The ranking_options.ranker field`}).option(`ranking-options-score-threshold`,{type:`number`,description:`The ranking_options.score_threshold field`,default:.4}).option(`reranking-enabled`,{type:`boolean`,description:`The reranking.enabled field`,default:!1}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`stream`,{type:`boolean`,description:`The stream field`,default:!1}).option(`system-prompt`,{type:`string`,description:`The system_prompt 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 f=>{if(a(f.id,`id`),f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf autorag ai-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/autorag/rags/${f.id??`<id>`}/ai-search`,pathParams:{id:String(f.id??``)},bodyKind:`json`,body:{maxNumResults:f.maxNumResults,query:f.query,rankingOptionsRanker:f.rankingOptionsRanker,rankingOptionsScoreThreshold:f.rankingOptionsScoreThreshold,rerankingEnabled:f.rerankingEnabled,rewriteQuery:f.rewriteQuery,stream:f.stream,systemPrompt:f.systemPrompt,body:f.body},validation:`passed`});return}let p=await r(f),m=f.local?u:await n(p);if(f.accountId=m,f.body){let e=s(f.body);c(await d(`Creating search`,async()=>p.post(`/accounts/${m}/autorag/rags/${f.id}/ai-search`,{body:e})),{successLabel:`Created search`});return}f.query===void 0&&(f.query=await t(`query`,``));let h={};f.maxNumResults!==void 0&&o(h,[`max_num_results`],f.maxNumResults),f.query!==void 0&&o(h,[`query`],i(f.query,`query`,`text`)),f.rankingOptionsRanker!==void 0&&o(h,[`ranking_options`,`ranker`],i(f.rankingOptionsRanker,`rankingOptionsRanker`,`text`)),f.rankingOptionsScoreThreshold!==void 0&&o(h,[`ranking_options`,`score_threshold`],f.rankingOptionsScoreThreshold),f.rerankingEnabled!==void 0&&o(h,[`reranking`,`enabled`],f.rerankingEnabled),f.rewriteQuery!==void 0&&o(h,[`rewrite_query`],f.rewriteQuery),f.stream!==void 0&&o(h,[`stream`],f.stream),f.systemPrompt!==void 0&&o(h,[`system_prompt`],i(f.systemPrompt,`systemPrompt`,`text`)),c(await d(`Creating search`,async()=>p.post(`/accounts/${m}/autorag/rags/${f.id}/ai-search`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created search`})}},p={command:`files <id>`,describe:`Files`,builder:e=>e.positional(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`status`,{type:`string`,description:`Status`,choices:[`completed`,`queued`,`running`,`error`]}),handler:async e=>{a(e.id,`id`);let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.search!==void 0&&(t.search=e.search),e.status!==void 0&&(t.status=e.status);let i=await r(e),o=e.local?u:await n(i);e.accountId=o,c(await d(`Loading autorag`,async()=>i.autorag.files(e.id,o,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded autorag`})}},m={command:`get <jobId>`,describe:`Get a Job Details`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`id`,{type:`string`,description:`rag id`,demandOption:!0}),handler:async e=>{a(e.jobId,`jobId`);let t=await r(e),i=e.local?u:await n(t);e.accountId=i,c(await d(`Loading job`,async()=>t.autorag.jobs.get(e.id,e.jobId,i)),{successLabel:`Loaded job`})}},h={command:`list`,describe:`List Jobs`,builder:e=>e.option(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let i=await r(e),a=e.local?u:await n(i);e.accountId=a,c(await d(`Loading jobs`,async()=>i.autorag.jobs.list(e.id,a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded jobs`})}},g={command:`logs <jobId>`,describe:`List Job Logs`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{a(e.jobId,`jobId`);let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let i=await r(e),o=e.local?u:await n(i);e.accountId=o,c(await d(`Loading job`,async()=>i.autorag.jobs.logs(e.id,e.jobId,o,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded job`})}},_={command:`jobs`,describe:`AutoRAG job operations`,builder:e=>e.command(m).command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`search <id>`,describe:`Search`,builder:e=>e.positional(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`query`,{type:`string`,description:`The query field`}).option(`ranking-options-ranker`,{type:`string`,description:`The ranking_options.ranker field`}).option(`ranking-options-score-threshold`,{type:`number`,description:`The ranking_options.score_threshold field`,default:.4}).option(`reranking-enabled`,{type:`boolean`,description:`The reranking.enabled field`,default:!1}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async f=>{if(a(f.id,`id`),f.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf autorag search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/autorag/rags/${f.id??`<id>`}/search`,pathParams:{id:String(f.id??``)},bodyKind:`json`,body:{maxNumResults:f.maxNumResults,query:f.query,rankingOptionsRanker:f.rankingOptionsRanker,rankingOptionsScoreThreshold:f.rankingOptionsScoreThreshold,rerankingEnabled:f.rerankingEnabled,rewriteQuery:f.rewriteQuery,body:f.body},validation:`passed`});return}let p=await r(f),m=f.local?u:await n(p);if(f.accountId=m,f.body){let e=s(f.body);c(await d(`Loading autorag`,async()=>p.post(`/accounts/${m}/autorag/rags/${f.id}/search`,{body:e})),{successLabel:`Loaded autorag`});return}f.query===void 0&&(f.query=await t(`query`,``));let h={};f.maxNumResults!==void 0&&o(h,[`max_num_results`],f.maxNumResults),f.query!==void 0&&o(h,[`query`],i(f.query,`query`,`text`)),f.rankingOptionsRanker!==void 0&&o(h,[`ranking_options`,`ranker`],i(f.rankingOptionsRanker,`rankingOptionsRanker`,`text`)),f.rankingOptionsScoreThreshold!==void 0&&o(h,[`ranking_options`,`score_threshold`],f.rankingOptionsScoreThreshold),f.rerankingEnabled!==void 0&&o(h,[`reranking`,`enabled`],f.rerankingEnabled),f.rewriteQuery!==void 0&&o(h,[`rewrite_query`],f.rewriteQuery),c(await d(`Loading autorag`,async()=>p.post(`/accounts/${m}/autorag/rags/${f.id}/search`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Loaded autorag`})}},y={command:`sync <id>`,describe:`Sync`,builder:e=>e.positional(`id`,{type:`string`,description:`rag id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(a(t.id,`id`),t.dryRun){let n=e();n&&a(n,`accountId`),l({command:`cf autorag sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/autorag/rags/${t.id??`<id>`}/sync`,pathParams:{id:String(t.id??``)},bodyKind:`none`,validation:`passed`});return}let i=await r(t),o=t.local?u:await n(i);t.accountId=o,c(await d(`Updating autorag`,async()=>i.autorag.sync(t.id,o)),{successLabel:`Updated autorag`})}},b={command:`autorag`,describe:`AutoRAG — AI search, file management, job tracking, and sync for retrieval-augmented generation`,builder:e=>e.command(f).command(p).command(v).command(y).command(_).demandCommand(1),handler:()=>{}};export{b as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{o as e,t}from"./auth-BHD_B2p9.mjs";import{t as n}from"./output-CqGQp2r6.mjs";import{t as r}from"./local-OqhVQbv0.mjs";import{t as i}from"./progress-5sHFvwez.mjs";const a={command:`get`,describe:`Gets the current billing profile for the account.`,builder:e=>e,handler:async a=>{let o=await t(a),s=a.local?r:await e(o);a.accountId=s,n(await i(`Loading profile`,async()=>o.billing.profiles.get(s)),{successLabel:`Loaded profile`})}},o={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(a).demandCommand(1),handler:()=>{}},s={command:`paygo`,describe:`Returns billable usage data for PayGo (self-serve) accounts. When no query parameters are provided, returns usage for the current billing period. This endpoint is currently in beta and access is restricted to select accounts.`,builder:e=>e.option(`from`,{type:`string`,description:`Defines the start date for the usage query (e.g., 2025-02-01).`}).option(`to`,{type:`string`,description:`Defines the end date for the usage query (e.g., 2025-03-01).`}),handler:async a=>{let o={};a.from!==void 0&&(o.from=a.from),a.to!==void 0&&(o.to=a.to);let s=await t(a),c=a.local?r:await e(s);a.accountId=c,n(await i(`Loading usage`,async()=>s.billing.usage.paygo(c,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded usage`})}},c={command:`usage`,describe:`Metered usage data for billed services — requests, bandwidth, and feature consumption`,builder:e=>e.command(s).demandCommand(1),handler:()=>{}},l={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(o).command(c).demandCommand(1),handler:()=>{}};export{l as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./input-validation-BpVQi9rR.mjs";import{readFileSync as t}from"node:fs";import{resolve as n}from"node:path";const r=new Set([`__proto__`,`constructor`,`prototype`]);function i(t,n,i){if(n.length===0)return;let a=t;for(let e=0;e<n.length-1;e++){let t=n[e]??``;if(r.has(t))throw Error(`Forbidden key in body path: ${t}`);(!a[t]||typeof a[t]!=`object`)&&(a[t]={}),a=a[t]}let o=n[n.length-1]??``;if(r.has(o))throw Error(`Forbidden key in body path: ${o}`);typeof i==`string`&&e(i,o),a[o]=i}function a(r){let i=r;if(r.startsWith(`@`)){let e=r.slice(1);if(e.length===0)throw Error(`--body '@' must be followed by a file path (got empty path)`);let a=n(e);try{i=t(a,`utf-8`)}catch(t){let n=t instanceof Error?t.message:`unknown read error`;throw Error(`--body: cannot read file at '${e}': ${n}`)}}let a;try{a=JSON.parse(i)}catch{throw Error(`Invalid JSON in --body. Expected valid JSON.`)}return typeof a==`object`&&a&&!Array.isArray(a)?s(a,0):Array.isArray(a)?o(a,0):typeof a==`string`&&e(a,`body`),a}function o(t,n){if(n>5)throw Error(`--body nesting too deep (max depth 5). Flatten your JSON structure.`);for(let r=0;r<t.length;r++){let i=t[r];typeof i==`string`?e(i,`body[${r}]`):typeof i==`object`&&i&&!Array.isArray(i)?s(i,n+1):Array.isArray(i)&&o(i,n+1)}}function s(t,n){if(n>5)throw Error(`--body nesting too deep (max depth 5). Flatten your JSON structure.`);for(let[r,i]of Object.entries(t))if(typeof i==`string`)e(i,`body.${r}`);else if(typeof i==`object`&&i&&!Array.isArray(i))s(i,n+1);else if(Array.isArray(i))for(let t=0;t<i.length;t++){let a=i[t];typeof a==`string`?e(a,`body.${r}[${t}]`):typeof a==`object`&&a&&!Array.isArray(a)&&s(a,n+1)}}export{i as n,a as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,m as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n 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:"Submit a feedback report for the specified zone. Use `type` to indicate whether the report is a false positive (good traffic flagged as bot) or a false negative (bot traffic missed). Furthermore, you can also use `expression` as a wirefilter to identify the affected traffic sample. See more accepted API fields and expression types at https://developers.cloudflare.com/bots/concepts/feedback-loop/#api-fields and https://developers.cloudflare.com/bots/concepts/feedback-loop/#expression-fields, respectively.",builder:e=>e.option(`description`,{type:`string`,description:`The description field`}).option(`expression`,{type:`string`,description:`Wirefilter expression describing the traffic being reported.`}).option(`first-request-seen-at`,{type:`string`,description:`The first_request_seen_at field`}).option(`last-request-seen-at`,{type:`string`,description:`The last_request_seen_at field`}).option(`requests`,{type:`number`,description:`The requests field`}).option(`subtype`,{type:`string`,description:`The subtype field`}).option(`type`,{type:`string`,description:`Type of feedback report.`,choices:[`false_positive`,`false_negative`]}).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 u=>{if(u.dryRun){c({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zoneId??`<zoneId>`}/bot_management/feedback`,pathParams:{zoneId:String(u.zoneId??``)},bodyKind:`json`,body:{description:u.description,expression:u.expression,firstRequestSeenAt:u.firstRequestSeenAt,lastRequestSeenAt:u.lastRequestSeenAt,requests:u.requests,subtype:u.subtype,type:u.type,body:u.body},validation:`passed`});return}let d=await n(u);if(u.zoneId=await r({zone:u.zone},d,{quiet:u.quiet}),u.body){let e=o(u.body);s(await l(`Creating feedback`,async()=>d.post(`/zones/${u.zoneId}/bot_management/feedback`,{body:e})),{successLabel:`Created feedback`});return}if(u.description===void 0&&(u.description=await e(`description`,``)),u.expression===void 0&&(u.expression=await e(`expression`,`Wirefilter expression describing the traffic being reported.`)),u.firstRequestSeenAt===void 0&&(u.firstRequestSeenAt=await e(`first-request-seen-at`,``)),u.lastRequestSeenAt===void 0&&(u.lastRequestSeenAt=await e(`last-request-seen-at`,``)),u.requests===void 0)throw Error(`--requests is required (or pass --body with this field set).`);u.type===void 0&&(u.type=await t(`type`,`Type of feedback report.`,[`false_positive`,`false_negative`]));let f={};u.description!==void 0&&a(f,[`description`],i(u.description,`description`,`text`)),u.expression!==void 0&&a(f,[`expression`],i(u.expression,`expression`,`text`)),u.firstRequestSeenAt!==void 0&&a(f,[`first_request_seen_at`],i(u.firstRequestSeenAt,`firstRequestSeenAt`,`text`)),u.lastRequestSeenAt!==void 0&&a(f,[`last_request_seen_at`],i(u.lastRequestSeenAt,`lastRequestSeenAt`,`text`)),u.requests!==void 0&&a(f,[`requests`],u.requests),u.subtype!==void 0&&a(f,[`subtype`],i(u.subtype,`subtype`,`text`)),u.type!==void 0&&a(f,[`type`],i(u.type,`type`,`text`)),s(await l(`Creating feedback`,async()=>d.post(`/zones/${u.zoneId}/bot_management/feedback`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created feedback`})}},d={command:`list`,describe:`Returns all feedback reports previously submitted for the specified zone. Feedback reports help improve detection by sharing samples of traffic that were misclassified as bots or humans.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading feedback`,async()=>t.botManagement.feedback.list(i)),{successLabel:`Loaded feedback`})}},f={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(u).command(d).demandCommand(1),handler:()=>{}},p={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading bot management`,async()=>t.botManagement.get(i)),{successLabel:`Loaded bot management`})}},m={command:`update`,describe:'Updates the Bot Management configuration for a zone. This API is used to update: - **Bot Fight Mode** - **Super Bot Fight Mode** - **Bot Management for Enterprise** See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more information on the different plans \\ If you recently upgraded or downgraded your plan, refer to the following examples to clean up old configurations. Copy and paste the example body to remove old zone configurations based on your current plan. #### Clean up configuration for Bot Fight Mode plan ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "suppress_session_score": false } ``` #### Clean up configuration for SBFM Pro plan ```json { "sbfm_likely_automated": "allow", "fight_mode": false } ``` #### Clean up configuration for SBFM Biz plan ```json { "fight_mode": false } ``` #### Clean up configuration for BM Enterprise Subscription plan It is strongly recommended that you ensure you have [custom rules](https://developers.cloudflare.com/waf/custom-rules/) in place to protect your zone before disabling the SBFM rules. Without these protections, your zone is vulnerable to attacks. ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "fight_mode": false } ```',builder:e=>e.option(`ai-bots-protection`,{type:`string`,description:"Enable rule to block AI Scrapers and Crawlers. Please note the value `only_on_ad_pages` is currently not available for Enterprise customers.",choices:[`block`,`disabled`,`only_on_ad_pages`]}).option(`cf-robots-variant`,{type:`string`,description:`Specifies the Robots Access Control License variant to use.`,choices:[`off`,`policy_only`]}).option(`content-bots-protection`,{type:`string`,description:`Enable rule to block content bots. When enabled, blocks automated traffic with low bot scores, excluding safe verified bot categories. Exceptions should be managed via skip rules.`,choices:[`block`,`disabled`]}).option(`crawler-protection`,{type:`string`,description:`Enable rule to punish AI Scrapers and Crawlers via a link maze.`,choices:[`enabled`,`disabled`]}).option(`enable-js`,{type:`boolean`,description:`Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).`}).option(`is-robots-txt-managed`,{type:`boolean`,description:`Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.`,default:!1}).option(`fight-mode`,{type:`boolean`,description:`Whether to enable Bot Fight Mode.`}).option(`stale-zone-configuration-optimize-wordpress`,{type:`boolean`,description:`Indicates that the zone's wordpress optimization for SBFM is turned on.`}).option(`stale-zone-configuration-sbfm-definitely-automated`,{type:`string`,description:`Indicates that the zone's definitely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-likely-automated`,{type:`string`,description:`Indicates that the zone's likely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-static-resource-protection`,{type:`string`,description:`Indicates that the zone's static resource protection is turned on.`}).option(`stale-zone-configuration-sbfm-verified-bots`,{type:`string`,description:`Indicates that the zone's verified bot requests are being blocked.`}).option(`stale-zone-configuration-suppress-session-score`,{type:`boolean`,description:`Indicates that the zone's session score tracking is disabled.`}).option(`stale-zone-configuration-fight-mode`,{type:`boolean`,description:`Indicates that the zone's Bot Fight Mode is turned on.`}).option(`optimize-wordpress`,{type:`boolean`,description:`Whether to optimize Super Bot Fight Mode protections for Wordpress.`}).option(`sbfm-definitely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on definitely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`sbfm-static-resource-protection`,{type:`boolean`,description:`Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if static resources on your application need bot protection. Note: Static resource protection can also result in legitimate traffic being blocked. `}).option(`sbfm-verified-bots`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on verified bots requests.`,choices:[`allow`,`block`]}).option(`sbfm-likely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on likely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`auto-update-model`,{type:`boolean`,description:`Automatically update to the newest bot detection models created by Cloudflare as they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)`}).option(`bm-cookie-enabled`,{type:`boolean`,description:`Indicates that the bot management cookie can be placed on end user devices accessing the site. Defaults to true`}).option(`suppress-session-score`,{type:`boolean`,description:`Whether to disable tracking the highest bot score for a session in the Bot Management cookie.`}).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 bot-management update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/bot_management`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{aiBotsProtection:e.aiBotsProtection,cfRobotsVariant:e.cfRobotsVariant,contentBotsProtection:e.contentBotsProtection,crawlerProtection:e.crawlerProtection,enableJs:e.enableJs,isRobotsTxtManaged:e.isRobotsTxtManaged,fightMode:e.fightMode,staleZoneConfigurationOptimizeWordpress:e.staleZoneConfigurationOptimizeWordpress,staleZoneConfigurationSbfmDefinitelyAutomated:e.staleZoneConfigurationSbfmDefinitelyAutomated,staleZoneConfigurationSbfmLikelyAutomated:e.staleZoneConfigurationSbfmLikelyAutomated,staleZoneConfigurationSbfmStaticResourceProtection:e.staleZoneConfigurationSbfmStaticResourceProtection,staleZoneConfigurationSbfmVerifiedBots:e.staleZoneConfigurationSbfmVerifiedBots,staleZoneConfigurationSuppressSessionScore:e.staleZoneConfigurationSuppressSessionScore,staleZoneConfigurationFightMode:e.staleZoneConfigurationFightMode,optimizeWordpress:e.optimizeWordpress,sbfmDefinitelyAutomated:e.sbfmDefinitelyAutomated,sbfmStaticResourceProtection:e.sbfmStaticResourceProtection,sbfmVerifiedBots:e.sbfmVerifiedBots,sbfmLikelyAutomated:e.sbfmLikelyAutomated,autoUpdateModel:e.autoUpdateModel,bmCookieEnabled:e.bmCookieEnabled,suppressSessionScore:e.suppressSessionScore,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=o(e.body);s(await l(`Updating bot management`,async()=>t.put(`/zones/${e.zoneId}/bot_management`,{body:n})),{successLabel:`Updated bot management`});return}let u={};e.aiBotsProtection!==void 0&&a(u,[`ai_bots_protection`],i(e.aiBotsProtection,`aiBotsProtection`,`text`)),e.cfRobotsVariant!==void 0&&a(u,[`cf_robots_variant`],i(e.cfRobotsVariant,`cfRobotsVariant`,`text`)),e.contentBotsProtection!==void 0&&a(u,[`content_bots_protection`],i(e.contentBotsProtection,`contentBotsProtection`,`text`)),e.crawlerProtection!==void 0&&a(u,[`crawler_protection`],i(e.crawlerProtection,`crawlerProtection`,`text`)),e.enableJs!==void 0&&a(u,[`enable_js`],e.enableJs),e.isRobotsTxtManaged!==void 0&&a(u,[`is_robots_txt_managed`],e.isRobotsTxtManaged),e.fightMode!==void 0&&a(u,[`fight_mode`],e.fightMode),e.staleZoneConfigurationOptimizeWordpress!==void 0&&a(u,[`stale_zone_configuration`,`optimize_wordpress`],e.staleZoneConfigurationOptimizeWordpress),e.staleZoneConfigurationSbfmDefinitelyAutomated!==void 0&&a(u,[`stale_zone_configuration`,`sbfm_definitely_automated`],i(e.staleZoneConfigurationSbfmDefinitelyAutomated,`staleZoneConfigurationSbfmDefinitelyAutomated`,`text`)),e.staleZoneConfigurationSbfmLikelyAutomated!==void 0&&a(u,[`stale_zone_configuration`,`sbfm_likely_automated`],i(e.staleZoneConfigurationSbfmLikelyAutomated,`staleZoneConfigurationSbfmLikelyAutomated`,`text`)),e.staleZoneConfigurationSbfmStaticResourceProtection!==void 0&&a(u,[`stale_zone_configuration`,`sbfm_static_resource_protection`],i(e.staleZoneConfigurationSbfmStaticResourceProtection,`staleZoneConfigurationSbfmStaticResourceProtection`,`text`)),e.staleZoneConfigurationSbfmVerifiedBots!==void 0&&a(u,[`stale_zone_configuration`,`sbfm_verified_bots`],i(e.staleZoneConfigurationSbfmVerifiedBots,`staleZoneConfigurationSbfmVerifiedBots`,`text`)),e.staleZoneConfigurationSuppressSessionScore!==void 0&&a(u,[`stale_zone_configuration`,`suppress_session_score`],e.staleZoneConfigurationSuppressSessionScore),e.staleZoneConfigurationFightMode!==void 0&&a(u,[`stale_zone_configuration`,`fight_mode`],e.staleZoneConfigurationFightMode),e.optimizeWordpress!==void 0&&a(u,[`optimize_wordpress`],e.optimizeWordpress),e.sbfmDefinitelyAutomated!==void 0&&a(u,[`sbfm_definitely_automated`],i(e.sbfmDefinitelyAutomated,`sbfmDefinitelyAutomated`,`text`)),e.sbfmStaticResourceProtection!==void 0&&a(u,[`sbfm_static_resource_protection`],e.sbfmStaticResourceProtection),e.sbfmVerifiedBots!==void 0&&a(u,[`sbfm_verified_bots`],i(e.sbfmVerifiedBots,`sbfmVerifiedBots`,`text`)),e.sbfmLikelyAutomated!==void 0&&a(u,[`sbfm_likely_automated`],i(e.sbfmLikelyAutomated,`sbfmLikelyAutomated`,`text`)),e.autoUpdateModel!==void 0&&a(u,[`auto_update_model`],e.autoUpdateModel),e.bmCookieEnabled!==void 0&&a(u,[`bm_cookie_enabled`],e.bmCookieEnabled),e.suppressSessionScore!==void 0&&a(u,[`suppress_session_score`],e.suppressSessionScore),s(await l(`Updating bot management`,async()=>t.put(`/zones/${e.zoneId}/bot_management`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated bot management`})}},h={command:`bot-management`,describe:`Bot detection and mitigation settings — configure bot scores, JavaScript detections, and challenge behavior`,builder:e=>e.command(p).command(m).command(f).demandCommand(1),handler:()=>{}};export{h as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{r as i}from"./input-validation-BpVQi9rR.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./local-OqhVQbv0.mjs";import{t as c}from"./progress-5sHFvwez.mjs";const l={command:`day-report <asnId>`,describe:`Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day.`,builder:e=>e.positional(`asnId`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}),handler:async e=>{i(e.asnId,`asnId`);let n={};e.date!==void 0&&(n.date=e.date);let o=await r(e),l=e.local?s:await t(o);e.accountId=l,a(await c(`Loading asn`,async()=>o.botnetFeed.asn.dayReport(l,e.asnId,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded asn`})}},u={command:`full-report <asnId>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:e=>e.positional(`asnId`,{type:`string`,description:`Asn ID`,demandOption:!0}),handler:async e=>{i(e.asnId,`asnId`);let n=await r(e),o=e.local?s:await t(n);e.accountId=o,a(await c(`Loading asn`,async()=>n.botnetFeed.asn.fullReport(o,e.asnId)),{successLabel:`Loaded asn`})}},d={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(l).command(u).demandCommand(1),handler:()=>{}},f={command:`delete <asnId>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:e=>e.positional(`asnId`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async l=>{if(i(l.asnId,`asnId`),l.dryRun){let t=e();t&&i(t,`accountId`),o({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/botnet_feed/configs/asn/${l.asnId??`<asnId>`}`,pathParams:{asnId:String(l.asnId??``)},bodyKind:`none`,validation:`passed`});return}let u=await r(l),d=l.local?s:await t(u);if(l.accountId=d,!await n(`asn`,String(l.asnId??``),{force:!!l.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}a(await c(`Deleting asn`,async()=>u.botnetFeed.configs.asn.delete(d,l.asnId)),{successLabel:`Deleted asn`})}},p={command:`get`,describe:`Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.`,builder:e=>e,handler:async e=>{let n=await r(e),i=e.local?s:await t(n);e.accountId=i,a(await c(`Loading asn`,async()=>n.botnetFeed.configs.asn.get(i)),{successLabel:`Loaded asn`})}},m={command:`asn`,describe:`Botnet feed subscription configuration and notification preferences`,builder:e=>e.command(f).command(p).demandCommand(1),handler:()=>{}},h={command:`configs`,describe:`Operations for configs`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`botnet-feed`,describe:`Botnet threat intelligence feeds — IP and ASN-level data on known command-and-control infrastructure`,builder:e=>e.command(d).command(h).demandCommand(1),handler:()=>{}};export{g 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:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:e=>e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).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=>{let p={};if(r.showHistoric!==void 0&&(p.showHistoric=r.showHistoric),r.download!==void 0&&(p.download=r.download),r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},bodyKind:`json`,body:{...p,imageData:r.imageData,scoreThreshold:r.scoreThreshold,topK:r.topK,body:r.body},validation:`passed`});return}let m=await i(r),h=r.local?d:await n(m);if(r.accountId=h,r.body){let e=c(r.body),t=new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await f(`Creating brand protection`,async()=>m.post(`/accounts/${h}/cloudforce-one/v2/brand-protection/logo/search${t?`?`+t:``}`,{body:e})),{successLabel:`Created brand protection`});return}r.imageData===void 0&&(r.imageData=await t(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let g={};r.imageData!==void 0&&s(g,[`image_data`],a(r.imageData,`imageData`,`text`)),r.scoreThreshold!==void 0&&s(g,[`score_threshold`],r.scoreThreshold),r.topK!==void 0&&s(g,[`top_k`],r.topK);let _=new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await f(`Creating brand protection`,async()=>m.post(`/accounts/${h}/cloudforce-one/v2/brand-protection/logo/search${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created brand protection`})}},m={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,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 info`,async()=>t.brandProtection.urlInfo(r)),{successLabel:`Loaded info`})}},h={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:e=>e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.offset!==void 0&&(t.offset=e.offset),e.limit!==void 0&&(t.limit=e.limit),e.queryId!==void 0&&(t.query_id=e.queryId),e.download!==void 0&&(t.download=e.download),e.orderBy!==void 0&&(t.orderBy=e.orderBy),e.order!==void 0&&(t.order=e.order);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading logo matche`,async()=>r.brandProtection.v2.logoMatches.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded logo matche`})}},g={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(h).demandCommand(1),handler:()=>{}},_={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:e=>e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).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 brand-protection v2 logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:{imageData:r.imageData,searchLookback:r.searchLookback,similarityThreshold:r.similarityThreshold,tag:r.tag,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 logo`,async()=>p.post(`/accounts/${m}/cloudforce-one/v2/brand-protection/logo/queries`,{body:e})),{successLabel:`Created logo`});return}if(r.imageData===void 0&&(r.imageData=await t(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),r.similarityThreshold===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);r.tag===void 0&&(r.tag=await t(`tag`,`Unique identifier for the logo query`));let h={};r.imageData!==void 0&&s(h,[`image_data`],a(r.imageData,`imageData`,`text`)),r.searchLookback!==void 0&&s(h,[`search_lookback`],r.searchLookback),r.similarityThreshold!==void 0&&s(h,[`similarity_threshold`],r.similarityThreshold),r.tag!==void 0&&s(h,[`tag`],a(r.tag,`tag`,`text`)),l(await f(`Creating logo`,async()=>p.post(`/accounts/${m}/cloudforce-one/v2/brand-protection/logo/queries`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created logo`})}},v={command:`delete <queryId>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:e=>e.positional(`queryId`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(o(t.queryId,`queryId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${t.queryId??`<queryId>`}`,pathParams:{queryId:String(t.queryId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`logo`,String(t.queryId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await f(`Deleting logo`,async()=>a.brandProtection.v2.logos.delete(s,t.queryId)),{successLabel:`Deleted logo`})}},y={command:`get`,describe:`Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data.`,builder:e=>e.option(`id`,{type:`string`,description:`Optional query ID to retrieve a specific logo query`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id),e.download!==void 0&&(t.download=e.download);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading logo`,async()=>r.brandProtection.v2.logos.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded logo`})}},b={command:`logos`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(_).command(v).command(y).demandCommand(1),handler:()=>{}},x={command:`get`,describe:`Get paginated list of domain matches for one or more brand protection queries. When multiple query_ids are provided (comma-separated), matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and individual dismissed state.`,builder:e=>e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID or comma-separated list of Query IDs. When multiple IDs are provided, matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and dismissed state.`,demandOption:!0}).option(`include-domain-id`,{type:`string`,description:`Include domain ID`}).option(`include-dismissed`,{type:`string`,description:`Include dismissed`}).option(`domain-search`,{type:`string`,description:`Filter matches by domain name (substring match)`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'domain', 'first_seen', or 'registrar'`,choices:[`domain`,`first_seen`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.offset!==void 0&&(t.offset=e.offset),e.limit!==void 0&&(t.limit=e.limit),e.queryId!==void 0&&(t.query_id=e.queryId),e.includeDomainId!==void 0&&(t.include_domain_id=e.includeDomainId),e.includeDismissed!==void 0&&(t.include_dismissed=e.includeDismissed),e.domainSearch!==void 0&&(t.domain_search=e.domainSearch),e.orderBy!==void 0&&(t.orderBy=e.orderBy),e.order!==void 0&&(t.order=e.order);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading matche`,async()=>r.brandProtection.v2.matches.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded matche`})}},S={command:`matches`,describe:`Detected brand abuse matches from monitoring queries with evidence downloads`,builder:e=>e.command(x).demandCommand(1),handler:()=>{}},C={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:e=>e.option(`id`,{type:`string`,description:`ID`}),handler:async e=>{let t={};e.id!==void 0&&(t.id=e.id);let r=await i(e),a=e.local?d:await n(r);e.accountId=a,l(await f(`Loading query`,async()=>r.brandProtection.v2.queries.get(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded query`})}},w={command:`queries`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(C).demandCommand(1),handler:()=>{}},T={command:`v2`,describe:`Operations for v2`,builder:e=>e.command(g).command(b).command(S).command(w).demandCommand(1),handler:()=>{}},E={command:`brand-protection`,describe:`Monitor the Internet for phishing sites, lookalike domains, and unauthorized use of your brand assets`,builder:e=>e.command(p).command(m).command(T).demandCommand(1),handler:()=>{}};export{E as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{r as i}from"./input-validation-BpVQi9rR.mjs";import{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"./local-OqhVQbv0.mjs";import{t as l}from"./progress-5sHFvwez.mjs";import{n as u,t as d}from"./raw-fetch-CxFs4i0R.mjs";const f={command:`create`,describe:"Fetches rendered HTML content from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering content create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/content`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating content`,async()=>d.post(`/accounts/${f}/browser-rendering/content${t?`?`+t:``}`,{body:e})),{successLabel:`Created content`});return}o(await l(`Creating content`,async()=>d.browserRendering.content.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created content`})}},p={command:`content`,describe:`Render a page and return its full HTML content after JavaScript execution`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`create`,describe:"Starts a crawl job for the provided URL and its children. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering crawl create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/crawl`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating crawl`,async()=>d.post(`/accounts/${f}/browser-rendering/crawl${t?`?`+t:``}`,{body:e})),{successLabel:`Created crawl`});return}o(await l(`Creating crawl`,async()=>d.browserRendering.crawl.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created crawl`})}},h={command:`delete <jobId>`,describe:`Cancels an ongoing crawl job by setting its status to cancelled and stopping all queued URLs.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`The ID of the crawl job to cancel.`,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 a=>{if(i(a.jobId,`jobId`),a.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering crawl delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/crawl/${a.jobId??`<jobId>`}`,pathParams:{jobId:String(a.jobId??``)},bodyKind:`none`,validation:`passed`});return}let u=await r(a),d=a.local?c:await t(u);if(a.accountId=d,!await n(`crawl`,String(a.jobId??``),{force:!!a.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await l(`Deleting crawl`,async()=>u.browserRendering.crawl.delete(d,a.jobId)),{successLabel:`Deleted crawl`})}},g={command:`get <jobId>`,describe:`Returns the result of a crawl job.`,builder:e=>e.positional(`jobId`,{type:`string`,description:`Crawl job ID.`,demandOption:!0}).option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`status`,{type:`string`,description:`Filter by URL status.`,choices:[`queued`,`errored`,`completed`,`disallowed`,`skipped`,`cancelled`]}).option(`cursor`,{type:`number`,description:`Cursor for pagination.`}).option(`limit`,{type:`number`,description:`Limit for pagination.`}),handler:async e=>{i(e.jobId,`jobId`);let n={};e.cacheTTL!==void 0&&(n.cacheTTL=e.cacheTTL),e.status!==void 0&&(n.status=e.status),e.cursor!==void 0&&(n.cursor=e.cursor),e.limit!==void 0&&(n.limit=e.limit);let a=await r(e),s=e.local?c:await t(a);e.accountId=s,o(await l(`Loading crawl`,async()=>a.browserRendering.crawl.get(s,e.jobId,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded crawl`})}},_={command:`crawl`,describe:`Crawl operations`,builder:e=>e.command(m).command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`connect <sessionId>`,describe:`Establishes a WebSocket connection to an existing browser session.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID to connect to.`,demandOption:!0}).option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`,default:!1}).option(`recording`,{type:`boolean`,description:`Recording`,default:!1}),handler:async e=>{i(e.sessionId,`sessionId`);let n={};e.keepAlive!==void 0&&(n.keep_alive=e.keepAlive),e.lab!==void 0&&(n.lab=e.lab),e.recording!==void 0&&(n.recording=e.recording);let a=await r(e),s=e.local?c:await t(a);e.accountId=s,o(await l(`Loading browser`,async()=>a.browserRendering.devtools.browser.connect(s,e.sessionId,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded browser`})}},y={command:`create`,describe:`Acquire a new browser DevTools session`,builder:e=>e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in milliseconds.`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`,default:!1}).option(`targets`,{type:`boolean`,description:`Include browser targets in response.`,default:!1}).option(`recording`,{type:`boolean`,description:`Recording`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async n=>{let a={};if(n.keepAlive!==void 0&&(a.keep_alive=n.keepAlive),n.lab!==void 0&&(a.lab=n.lab),n.targets!==void 0&&(a.targets=n.targets),n.recording!==void 0&&(a.recording=n.recording),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering devtools browser create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},bodyKind:`json`,body:{...a},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);n.accountId=d,o(await l(`Creating browser`,async()=>u.browserRendering.devtools.browser.create(d,Object.keys(a).length>0?a:void 0)),{successLabel:`Created browser`})}},b={command:`delete <sessionId>`,describe:`Closes an existing browser session.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID to close.`,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 a=>{if(i(a.sessionId,`sessionId`),a.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering devtools browser delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/devtools/browser/${a.sessionId??`<sessionId>`}`,pathParams:{sessionId:String(a.sessionId??``)},bodyKind:`none`,validation:`passed`});return}let u=await r(a),d=a.local?c:await t(u);if(a.accountId=d,!await n(`browser`,String(a.sessionId??``),{force:!!a.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}o(await l(`Deleting browser`,async()=>u.browserRendering.devtools.browser.delete(d,a.sessionId)),{successLabel:`Deleted browser`})}},x={command:`launch`,describe:`Acquires and establishes a WebSocket connection to a browser session.`,builder:e=>e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`,default:!1}).option(`recording`,{type:`boolean`,description:`Recording`,default:!1}),handler:async e=>{let n={};e.keepAlive!==void 0&&(n.keep_alive=e.keepAlive),e.lab!==void 0&&(n.lab=e.lab),e.recording!==void 0&&(n.recording=e.recording);let i=await r(e),a=e.local?c:await t(i);e.accountId=a,o(await l(`Loading browser`,async()=>i.browserRendering.devtools.browser.launch(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded browser`})}},S={command:`get <targetId>`,describe:`Establishes a WebSocket connection to a specific Chrome DevTools target or page.`,builder:e=>e.positional(`targetId`,{type:`string`,description:`Target ID, e.g. page ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.targetId,`targetId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading page`,async()=>n.browserRendering.devtools.browser.page.get(a,e.sessionId,e.targetId)),{successLabel:`Loaded page`})}},C={command:`page`,describe:`Chrome DevTools Protocol endpoints for browser automation and debugging`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`protocol <sessionId>`,describe:`Returns the complete Chrome DevTools Protocol schema including all domains, commands, events, and types. This schema describes the entire CDP API surface.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.sessionId,`sessionId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading browser`,async()=>n.browserRendering.devtools.browser.protocol(a,e.sessionId)),{successLabel:`Loaded browser`})}},T={command:`activate <targetId>`,describe:`Activates (brings to front) a specific browser target by its ID.`,builder:e=>e.positional(`targetId`,{type:`string`,description:`Target ID to activate.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.targetId,`targetId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading target`,async()=>n.browserRendering.devtools.browser.targets.activate(e.sessionId,a,e.targetId)),{successLabel:`Loaded target`})}},E={command:`create <sessionId>`,describe:`Opens a new tab in the browser. Optionally specify a URL to navigate to.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`url`,{type:`string`,description:`Url`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async n=>{i(n.sessionId,`sessionId`);let a={};if(n.url!==void 0&&(a.url=n.url),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering devtools browser targets create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/devtools/browser/${n.sessionId??`<sessionId>`}/json/new`,pathParams:{sessionId:String(n.sessionId??``)},bodyKind:`json`,body:{...a},validation:`passed`});return}let u=await r(n),d=n.local?c:await t(u);n.accountId=d,o(await l(`Updating target`,async()=>u.browserRendering.devtools.browser.targets.create(d,n.sessionId,Object.keys(a).length>0?a:void 0)),{successLabel:`Updated target`})}},D={command:`get <targetId>`,describe:`Returns the debuggable target with the given ID.`,builder:e=>e.positional(`targetId`,{type:`string`,description:`Target ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.targetId,`targetId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading target`,async()=>n.browserRendering.devtools.browser.targets.get(a,e.sessionId,e.targetId)),{successLabel:`Loaded target`})}},O={command:`list`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:e=>e.option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{let n=await r(e),i=e.local?c:await t(n);e.accountId=i,o(await l(`Loading targets`,async()=>n.browserRendering.devtools.browser.targets.list(i,e.sessionId)),{successLabel:`Loaded targets`})}},k={command:`targets`,describe:`Chrome DevTools Protocol endpoints for browser automation and debugging`,builder:e=>e.command(T).command(E).command(D).command(O).demandCommand(1),handler:()=>{}},A={command:`version <sessionId>`,describe:`Get browser version metadata.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.sessionId,`sessionId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading browser`,async()=>n.browserRendering.devtools.browser.version(a,e.sessionId)),{successLabel:`Loaded browser`})}},j={command:`browser`,describe:`Chrome DevTools Protocol endpoints for browser automation and debugging`,builder:e=>e.command(v).command(y).command(b).command(x).command(w).command(A).command(C).command(k).demandCommand(1),handler:()=>{}},M={command:`get <sessionId>`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Browser session ID.`,demandOption:!0}),handler:async e=>{i(e.sessionId,`sessionId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading json`,async()=>n.browserRendering.devtools.json.get(a,e.sessionId)),{successLabel:`Loaded json`})}},N={command:`json`,describe:`Chrome DevTools Protocol endpoints for browser automation and debugging`,builder:e=>e.command(M).demandCommand(1),handler:()=>{}},P={command:`get <sessionId>`,describe:`Get details for a specific browser session.`,builder:e=>e.positional(`sessionId`,{type:`string`,description:`Session ID.`,demandOption:!0}),handler:async e=>{i(e.sessionId,`sessionId`);let n=await r(e),a=e.local?c:await t(n);e.accountId=a,o(await l(`Loading session`,async()=>n.browserRendering.devtools.session.get(a,e.sessionId)),{successLabel:`Loaded session`})}},F={command:`list`,describe:`List active browser sessions.`,builder:e=>e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}),handler:async e=>{let n={};e.limit!==void 0&&(n.limit=e.limit),e.offset!==void 0&&(n.offset=e.offset);let i=await r(e),a=e.local?c:await t(i);e.accountId=a,o(await l(`Loading session`,async()=>i.browserRendering.devtools.session.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded session`})}},I={command:`session`,describe:`Chrome DevTools Protocol endpoints for browser automation and debugging`,builder:e=>e.command(P).command(F).demandCommand(1),handler:()=>{}},L={command:`devtools`,describe:`Operations for devtools`,builder:e=>e.command(j).command(N).command(I).demandCommand(1),handler:()=>{}},R={command:`create`,describe:"Gets json from a webpage from a provided URL or HTML. Pass `prompt` or `schema` in the body. Control page loading with `gotoOptions` and `waitFor*` options.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering json create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/json`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating json`,async()=>d.post(`/accounts/${f}/browser-rendering/json${t?`?`+t:``}`,{body:e})),{successLabel:`Created json`});return}o(await l(`Creating json`,async()=>d.browserRendering.json.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created json`})}},z={command:`json`,describe:`Extract structured JSON data from rendered pages using selectors`,builder:e=>e.command(R).demandCommand(1),handler:()=>{}},B={command:`create`,describe:`Get links from a web page.`,builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering links create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/links`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating link`,async()=>d.post(`/accounts/${f}/browser-rendering/links${t?`?`+t:``}`,{body:e})),{successLabel:`Created link`});return}o(await l(`Creating link`,async()=>d.browserRendering.links.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created link`})}},V={command:`links`,describe:`Extract all links from a rendered web page`,builder:e=>e.command(B).demandCommand(1),handler:()=>{}},H={command:`create`,describe:"Gets markdown of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering markdown create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/markdown`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating markdown`,async()=>d.post(`/accounts/${f}/browser-rendering/markdown${t?`?`+t:``}`,{body:e})),{successLabel:`Created markdown`});return}o(await l(`Creating markdown`,async()=>d.browserRendering.markdown.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created markdown`})}},U={command:`markdown`,describe:`Convert rendered web page content to clean Markdown format`,builder:e=>e.command(H).demandCommand(1),handler:()=>{}},W={command:`create`,describe:"Fetches rendered PDF from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).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(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}),handler:async n=>{let f={};if(n.cacheTTL!==void 0&&(f.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering pdf create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/pdf`,pathParams:{},bodyKind:`json`,body:{...f,body:n.body},validation:`passed`});return}let p=await r(n),m=n.local?c:await t(p);if(n.accountId=m,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating pdf`,async()=>p.post(`/accounts/${m}/browser-rendering/pdf${t?`?`+t:``}`,{body:e})),{successLabel:`Created pdf`});return}let h=await l(`Creating pdf`,async()=>d(`/accounts/${m}/browser-rendering/pdf`,`POST`,n.local?n.localEndpoint:void 0));u(n.text===!0?h.toString(`utf-8`):h)}},G={command:`pdf`,describe:`Generate PDF documents from rendered web pages`,builder:e=>e.command(W).demandCommand(1),handler:()=>{}},K={command:`create`,describe:`Get meta attributes like height, width, text and others of selected elements.`,builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering scrape create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/scrape`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating scrape`,async()=>d.post(`/accounts/${f}/browser-rendering/scrape${t?`?`+t:``}`,{body:e})),{successLabel:`Created scrape`});return}o(await l(`Creating scrape`,async()=>d.browserRendering.scrape.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created scrape`})}},q={command:`scrape`,describe:`Scrape structured data from web pages using CSS selectors`,builder:e=>e.command(K).demandCommand(1),handler:()=>{}},J={command:`create`,describe:"Takes a screenshot of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering screenshot create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/screenshot`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating screenshot`,async()=>d.post(`/accounts/${f}/browser-rendering/screenshot${t?`?`+t:``}`,{body:e})),{successLabel:`Created screenshot`});return}o(await l(`Creating screenshot`,async()=>d.browserRendering.screenshot.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created screenshot`})}},Y={command:`screenshot`,describe:`Capture viewport or full-page screenshots as PNG or JPEG images`,builder:e=>e.command(J).demandCommand(1),handler:()=>{}},X={command:`create`,describe:"Returns the page's HTML content and screenshot. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:e=>e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{let u={};if(n.cacheTTL!==void 0&&(u.cacheTTL=n.cacheTTL),n.dryRun){let t=e();t&&i(t,`accountId`),s({command:`cf browser-rendering snapshot create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/browser-rendering/snapshot`,pathParams:{},bodyKind:`json`,body:{...u,body:n.body},validation:`passed`});return}let d=await r(n),f=n.local?c:await t(d);if(n.accountId=f,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();o(await l(`Creating snapshot`,async()=>d.post(`/accounts/${f}/browser-rendering/snapshot${t?`?`+t:``}`,{body:e})),{successLabel:`Created snapshot`});return}o(await l(`Creating snapshot`,async()=>d.browserRendering.snapshot.create(f,Object.keys(u).length>0?u:void 0)),{successLabel:`Created snapshot`})}},Z={command:`snapshot`,describe:`Capture a complete DOM snapshot including styles and resources`,builder:e=>e.command(X).demandCommand(1),handler:()=>{}},Q={command:`browser-rendering`,describe:`Headless browser API — render pages, take screenshots, generate PDFs, scrape content, and extract structured data`,builder:e=>e.command(p).command(_).command(L).command(z).command(V).command(U).command(G).command(q).command(Y).command(Z).demandCommand(1),handler:()=>{}};export{Q as default};
|
package/dist/cache-B6M_pm_D.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{m as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n 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:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The request body is currently not used.`}),handler:async e=>{if(e.dryRun){c({command:`cf cache cache-reserve clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/cache/cache_reserve_clear`,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=o(e.body);s(await l(`Creating cache reserve`,async()=>t.post(`/zones/${e.zoneId}/cache/cache_reserve_clear`,{body:n})),{successLabel:`Created cache reserve`});return}s(await l(`Creating cache reserve`,async()=>t.cache.cacheReserve.clear(i)),{successLabel:`Created cache reserve`})}},d={command:`edit`,describe:`Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`,builder:e=>e.option(`value`,{type:`string`,description:`Value of the Cache Reserve zone setting.`,choices:[`on`,`off`],default:`off`}).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){c({command:`cf cache cache-reserve edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/cache/cache_reserve`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{value:t.value,body:t.body},validation:`passed`});return}let u=await n(t);if(t.zoneId=await r({zone:t.zone},u,{quiet:t.quiet}),t.body){let e=o(t.body);s(await l(`Updating cache reserve`,async()=>u.patch(`/zones/${t.zoneId}/cache/cache_reserve`,{body:e})),{successLabel:`Updated cache reserve`});return}t.value===void 0&&(t.value=await e(`value`,`Value of the Cache Reserve zone setting.`,[`on`,`off`]));let d={};t.value!==void 0&&a(d,[`value`],i(t.value,`value`,`text`)),s(await l(`Updating cache reserve`,async()=>u.patch(`/zones/${t.zoneId}/cache/cache_reserve`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated cache reserve`})}},f={command:`get`,describe:`Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading cache reserve`,async()=>t.cache.cacheReserve.get(i)),{successLabel:`Loaded cache reserve`})}},p={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading cache reserve`,async()=>t.cache.cacheReserve.status(i)),{successLabel:`Loaded cache reserve`})}},m={command:`cache-reserve`,describe:`Persistent storage tier that keeps cached assets even after eviction from edge caches`,builder:e=>e.command(u).command(d).command(f).command(p).demandCommand(1),handler:()=>{}},h={command:`purge`,describe:'### Purge All Cached Content Removes ALL files from Cloudflare\'s cache. All tiers can purge everything. ``` {"purge_everything": true} ``` ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare\'s cache by specifying URLs. All tiers can purge by URL. To purge files with custom cache keys, include the headers used to compute the cache key as in the example. If you have a device type or geo in your cache key, you will need to include the CF-Device-Type or CF-IPCountry headers. If you have lang in your cache key, you will need to include the Accept-Language header. **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for http, 443 for https), but must be included otherwise. Single file purge example with files: ``` {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} ``` Single file purge example with url and header pairs: ``` {"files": [{url: "http://www.example.com/cat_picture.jpg", headers: { "CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN" }}, {url: "http://www.example.com/dog_picture.jpg", headers: { "CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US" }}]} ``` ### Purge Cached Content by Tag, Host or Prefix Granularly removes one or more files from Cloudflare\'s cache either by specifying the host, the associated Cache-Tag, or a Prefix. Flex purge with tags: ``` {"tags": ["a-cache-tag", "another-cache-tag"]} ``` Flex purge with hosts: ``` {"hosts": ["www.example.com", "images.example.com"]} ``` Flex purge with prefixes: ``` {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} ``` ### Availability and limits please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).',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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){c({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/purge_cache`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t(`cache`,String(a??``),{force:!!e.force,message:`This operation destroys cached content for a zone.`})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let t=o(e.body);s(await l(`Deleting cache`,async()=>i.post(`/zones/${e.zoneId}/purge_cache`,{body:t})),{successLabel:`Deleted cache`});return}s(await l(`Deleting cache`,async()=>i.cache.purge(a)),{successLabel:`Deleted cache`})}},g={command:`edit`,describe:`Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`,builder:e=>e.option(`value`,{type:`string`,description:`Value of the Regional Tiered Cache zone setting.`,choices:[`on`,`off`],default:`off`}).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){c({command:`cf cache regional-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/cache/regional_tiered_cache`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{value:t.value,body:t.body},validation:`passed`});return}let u=await n(t);if(t.zoneId=await r({zone:t.zone},u,{quiet:t.quiet}),t.body){let e=o(t.body);s(await l(`Updating regional tiered cache`,async()=>u.patch(`/zones/${t.zoneId}/cache/regional_tiered_cache`,{body:e})),{successLabel:`Updated regional tiered cache`});return}t.value===void 0&&(t.value=await e(`value`,`Value of the Regional Tiered Cache zone setting.`,[`on`,`off`]));let d={};t.value!==void 0&&a(d,[`value`],i(t.value,`value`,`text`)),s(await l(`Updating regional tiered cache`,async()=>u.patch(`/zones/${t.zoneId}/cache/regional_tiered_cache`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated regional tiered cache`})}},_={command:`get`,describe:`Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading regional tiered cache`,async()=>t.cache.regionalTieredCache.get(i)),{successLabel:`Loaded regional tiered cache`})}},v={command:`regional-tiered-cache`,describe:`Restrict tiered cache topology to data centers within a specific geographic region`,builder:e=>e.command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`delete`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,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 e=>{if(e.dryRun){c({command:`cf cache smart-tiered-cache delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t(`smart tiered cache`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}s(await l(`Deleting smart tiered cache`,async()=>i.cache.smartTieredCache.delete(a)),{successLabel:`Deleted smart tiered cache`})}},b={command:`edit`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,builder:e=>e.option(`value`,{type:`string`,description:`Enable or disable the Smart Tiered Cache.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Smart Tiered Cache.`}),handler:async t=>{if(t.dryRun){c({command:`cf cache smart-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{value:t.value,body:t.body},validation:`passed`});return}let u=await n(t);if(t.zoneId=await r({zone:t.zone},u,{quiet:t.quiet}),t.body){let e=o(t.body);s(await l(`Updating smart tiered cache`,async()=>u.patch(`/zones/${t.zoneId}/cache/tiered_cache_smart_topology_enable`,{body:e})),{successLabel:`Updated smart tiered cache`});return}t.value===void 0&&(t.value=await e(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let d={};t.value!==void 0&&a(d,[`value`],i(t.value,`value`,`text`)),s(await l(`Updating smart tiered cache`,async()=>u.patch(`/zones/${t.zoneId}/cache/tiered_cache_smart_topology_enable`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated smart tiered cache`})}},x={command:`get`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading smart tiered cache`,async()=>t.cache.smartTieredCache.get(i)),{successLabel:`Loaded smart tiered cache`})}},S={command:`smart-tiered-cache`,describe:`Automatically determine the best upper-tier data centers for tiered cache topology`,builder:e=>e.command(y).command(b).command(x).demandCommand(1),handler:()=>{}},C={command:`delete`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,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 e=>{if(e.dryRun){c({command:`cf cache variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/cache/variants`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t(`variant`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}s(await l(`Deleting variant`,async()=>i.cache.variants.delete(a)),{successLabel:`Deleted variant`})}},w={command:`edit`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,builder:e=>e.option(`value-avif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for avif.`}).option(`value-bmp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for bmp.`}).option(`value-gif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for gif.`}).option(`value-jp2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jp2.`}).option(`value-jpeg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpeg.`}).option(`value-jpg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg.`}).option(`value-jpg2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg2.`}).option(`value-png`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for png.`}).option(`value-tif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tif.`}).option(`value-tiff`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tiff.`}).option(`value-webp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for webp.`}).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 cache variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/cache/variants`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{valueAvif:e.valueAvif,valueBmp:e.valueBmp,valueGif:e.valueGif,valueJp2:e.valueJp2,valueJpeg:e.valueJpeg,valueJpg:e.valueJpg,valueJpg2:e.valueJpg2,valuePng:e.valuePng,valueTif:e.valueTif,valueTiff:e.valueTiff,valueWebp:e.valueWebp,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=o(e.body);s(await l(`Updating variant`,async()=>t.patch(`/zones/${e.zoneId}/cache/variants`,{body:n})),{successLabel:`Updated variant`});return}let i={};e.valueAvif!==void 0&&a(i,[`value`,`avif`],e.valueAvif),e.valueBmp!==void 0&&a(i,[`value`,`bmp`],e.valueBmp),e.valueGif!==void 0&&a(i,[`value`,`gif`],e.valueGif),e.valueJp2!==void 0&&a(i,[`value`,`jp2`],e.valueJp2),e.valueJpeg!==void 0&&a(i,[`value`,`jpeg`],e.valueJpeg),e.valueJpg!==void 0&&a(i,[`value`,`jpg`],e.valueJpg),e.valueJpg2!==void 0&&a(i,[`value`,`jpg2`],e.valueJpg2),e.valuePng!==void 0&&a(i,[`value`,`png`],e.valuePng),e.valueTif!==void 0&&a(i,[`value`,`tif`],e.valueTif),e.valueTiff!==void 0&&a(i,[`value`,`tiff`],e.valueTiff),e.valueWebp!==void 0&&a(i,[`value`,`webp`],e.valueWebp),s(await l(`Updating variant`,async()=>t.patch(`/zones/${e.zoneId}/cache/variants`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated variant`})}},T={command:`get`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,s(await l(`Loading variant`,async()=>t.cache.variants.get(i)),{successLabel:`Loaded variant`})}},E={command:`variants`,describe:`Serve different cached versions of an image based on the Accept header (WebP, AVIF, etc.)`,builder:e=>e.command(C).command(w).command(T).demandCommand(1),handler:()=>{}},D={command:`cache`,describe:`Purge cached content and configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(h).command(m).command(v).command(S).command(E).demandCommand(1),handler:()=>{}};export{D as default};
|
package/dist/calls-C5XCC0i1.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d 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:`create`,describe:`Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app.`,builder:e=>e.option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`,default:``}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls sfu create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating sfu`,async()=>f.post(`/accounts/${p}/calls/apps`,{body:e})),{successLabel:`Created sfu`});return}let m={};n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Creating sfu`,async()=>f.post(`/accounts/${p}/calls/apps`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created sfu`})}},p={command:`delete <appId>`,describe:`Deletes an app from Cloudflare Calls`,builder:e=>e.positional(`appId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 i=>{if(a(i.appId,`appId`),i.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls sfu delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/apps/${i.appId??`<appId>`}`,pathParams:{appId:String(i.appId??``)},bodyKind:`none`,validation:`passed`});return}let o=await r(i),s=i.local?u:await t(o);if(i.accountId=s,!await n(`sfu`,String(i.appId??``),{force:!!i.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await d(`Deleting sfu`,async()=>o.calls.sfu.delete(i.appId,s)),{successLabel:`Deleted sfu`})}},m={command:`get <appId>`,describe:`Fetches details for a single Calls app.`,builder:e=>e.positional(`appId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}),handler:async e=>{a(e.appId,`appId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading sfu`,async()=>n.calls.sfu.get(e.appId,i)),{successLabel:`Loaded sfu`})}},h={command:`list`,describe:`Lists all apps in the Cloudflare 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 sfu`,async()=>n.calls.sfu.list(i)),{successLabel:`Loaded sfu`})}},g={command:`update <appId>`,describe:`Edit details for a single app.`,builder:e=>e.positional(`appId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`,default:``}).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(a(n.appId,`appId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls sfu update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/apps/${n.appId??`<appId>`}`,pathParams:{appId:String(n.appId??``)},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating sfu`,async()=>f.put(`/accounts/${p}/calls/apps/${n.appId}`,{body:e})),{successLabel:`Updated sfu`});return}let m={};n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Updating sfu`,async()=>f.put(`/accounts/${p}/calls/apps/${n.appId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated sfu`})}},_={command:`sfu`,describe:`Selective Forwarding Unit apps that route WebRTC media between participants`,builder:e=>e.command(f).command(p).command(m).command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`create`,describe:`Creates a new Cloudflare Calls TURN key.`,builder:e=>e.option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`,default:``}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls turn create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating turn`,async()=>f.post(`/accounts/${p}/calls/turn_keys`,{body:e})),{successLabel:`Created turn`});return}let m={};n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Creating turn`,async()=>f.post(`/accounts/${p}/calls/turn_keys`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created turn`})}},y={command:`delete <keyId>`,describe:`Deletes a TURN key from Cloudflare Calls`,builder:e=>e.positional(`keyId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 i=>{if(a(i.keyId,`keyId`),i.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls turn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/turn_keys/${i.keyId??`<keyId>`}`,pathParams:{keyId:String(i.keyId??``)},bodyKind:`none`,validation:`passed`});return}let o=await r(i),s=i.local?u:await t(o);if(i.accountId=s,!await n(`turn`,String(i.keyId??``),{force:!!i.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}c(await d(`Deleting turn`,async()=>o.calls.turn.delete(i.keyId,s)),{successLabel:`Deleted turn`})}},b={command:`get <keyId>`,describe:`Fetches details for a single TURN key.`,builder:e=>e.positional(`keyId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}),handler:async e=>{a(e.keyId,`keyId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading turn`,async()=>n.calls.turn.get(e.keyId,i)),{successLabel:`Loaded turn`})}},x={command:`list`,describe:`Lists all TURN keys in the Cloudflare 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 turn`,async()=>n.calls.turn.list(i)),{successLabel:`Loaded turn`})}},S={command:`update <keyId>`,describe:`Edit details for a single TURN key.`,builder:e=>e.positional(`keyId`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`,default:``}).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(a(n.keyId,`keyId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf calls turn update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/calls/turn_keys/${n.keyId??`<keyId>`}`,pathParams:{keyId:String(n.keyId??``)},bodyKind:`json`,body:{name:n.name,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating turn`,async()=>f.put(`/accounts/${p}/calls/turn_keys/${n.keyId}`,{body:e})),{successLabel:`Updated turn`});return}let m={};n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),c(await d(`Updating turn`,async()=>f.put(`/accounts/${p}/calls/turn_keys/${n.keyId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated turn`})}},C={command:`turn`,describe:`TURN relay keys that help clients traverse NATs and firewalls for peer-to-peer connectivity`,builder:e=>e.command(v).command(y).command(b).command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`calls`,describe:`Real-time audio/video communication infrastructure — SFU apps for WebRTC and TURN relay keys`,builder:e=>e.command(_).command(C).demandCommand(1),handler:()=>{}};export{w as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e,u as t}from"./auth-BHD_B2p9.mjs";import{n}from"./input-validation-BpVQi9rR.mjs";import{n as r,t as i}from"./body-parser-iA3vRFmh.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./progress-5sHFvwez.mjs";const c={command:`get`,describe:`List Hostname Associations`,builder:e=>e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}),handler:async n=>{let r={};n.mtlsCertificateId!==void 0&&(r.mtls_certificate_id=n.mtlsCertificateId);let i=await e(n),o=await t({zone:n.zone},i,{quiet:n.quiet});n.zoneId=o,a(await s(`Loading hostname association`,async()=>i.certificateAuthorities.hostnameAssociations.get(o,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded hostname association`})}},l={command:`update`,describe:`Replace Hostname Associations`,builder:e=>e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).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 c=>{if(c.dryRun){o({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zoneId??`<zoneId>`}/certificate_authorities/hostname_associations`,pathParams:{zoneId:String(c.zoneId??``)},bodyKind:`json`,body:{hostnames:c.hostnames,mtlsCertificateId:c.mtlsCertificateId,body:c.body},validation:`passed`});return}let l=await e(c);if(c.zoneId=await t({zone:c.zone},l,{quiet:c.quiet}),c.body){let e=i(c.body);a(await s(`Updating hostname association`,async()=>l.put(`/zones/${c.zoneId}/certificate_authorities/hostname_associations`,{body:e})),{successLabel:`Updated hostname association`});return}let u={};c.hostnames!==void 0&&r(u,[`hostnames`],c.hostnames),c.mtlsCertificateId!==void 0&&r(u,[`mtls_certificate_id`],n(c.mtlsCertificateId,`mtlsCertificateId`,`text`)),a(await s(`Updating hostname association`,async()=>l.put(`/zones/${c.zoneId}/certificate_authorities/hostname_associations`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated hostname association`})}},u={command:`hostname-associations`,describe:`Associate client certificates with hostnames that require mutual TLS verification`,builder:e=>e.command(c).command(l).demandCommand(1),handler:()=>{}},d={command:`certificate-authorities`,describe:`Map client certificates to specific hostnames for mTLS authentication`,builder:e=>e.command(u).demandCommand(1),handler:()=>{}};export{d as default};
|
|
@@ -1,3 +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:`Create a new API Shield mTLS Client Certificate`,builder:e=>e.option(`csr`,{type:`string`,description:`The Certificate Signing Request (CSR). Must be newline-encoded.`}).option(`validity-days`,{type:`number`,description:`The number of days the Client Certificate will be valid after the issued_on date`}).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 client-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/client_certificates`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{csr:t.csr,validityDays:t.validityDays,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 client certificate`,async()=>a.post(`/zones/${t.zoneId}/client_certificates`,{body:e})),{successLabel:`Created client certificate`});return}if(t.csr===void 0&&(t.csr=await e(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),t.validityDays===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let d={};t.csr!==void 0&&o(d,[`csr`],i(t.csr,`csr`,`text`)),t.validityDays!==void 0&&o(d,[`validity_days`],t.validityDays),c(await u(`Creating client certificate`,async()=>a.post(`/zones/${t.zoneId}/client_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created client certificate`})}},f={command:`delete <clientCertificateId>`,describe:`Set a API Shield mTLS Client Certificate to pending_revocation status for processing to revoked status.`,builder:e=>e.positional(`clientCertificateId`,{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(a(e.clientCertificateId,`clientCertificateId`),e.dryRun){l({command:`cf client-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/client_certificates/${e.clientCertificateId??`<clientCertificateId>`}`,pathParams:{zoneId:String(e.zoneId??``),clientCertificateId:String(e.clientCertificateId??``)},bodyKind:`none`,validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`client certificate`,String(e.clientCertificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}c(await u(`Deleting client certificate`,async()=>i.clientCertificates.delete(o,e.clientCertificateId)),{successLabel:`Deleted client certificate`})}},p={command:`edit <clientCertificateId>`,describe:`If a API Shield mTLS Client Certificate is in a pending_revocation state, you may reactivate it with this endpoint.`,builder:e=>e.positional(`clientCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`reactivate`,{type:`boolean`,description:`The reactivate 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 e=>{if(a(e.clientCertificateId,`clientCertificateId`),e.dryRun){l({command:`cf client-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/client_certificates/${e.clientCertificateId??`<clientCertificateId>`}`,pathParams:{zoneId:String(e.zoneId??``),clientCertificateId:String(e.clientCertificateId??``)},bodyKind:`json`,body:{reactivate:e.reactivate,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 client certificate`,async()=>t.patch(`/zones/${e.zoneId}/client_certificates/${e.clientCertificateId}`,{body:n})),{successLabel:`Updated client certificate`});return}let i={};e.reactivate!==void 0&&o(i,[`reactivate`],e.reactivate),c(await u(`Updating client certificate`,async()=>t.patch(`/zones/${e.zoneId}/client_certificates/${e.clientCertificateId}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated client certificate`})}},m={command:`get <clientCertificateId>`,describe:`Get Details for a single mTLS API Shield Client Certificate`,builder:e=>e.positional(`clientCertificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.clientCertificateId,`clientCertificateId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading client certificate`,async()=>t.clientCertificates.get(i,e.clientCertificateId)),{successLabel:`Loaded client certificate`})}},h={command:`list`,describe:`List all of your Zone's API Shield mTLS Client Certificates by Status and/or using Pagination`,builder:e=>e.option(`status`,{type:`string`,description:`Client Certitifcate Status to filter results by.`,choices:[`all`,`active`,`pending_reactivation`,`pending_revocation`,`revoked`]}).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.status!==void 0&&(t.status=e.status),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 i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading client certificates`,async()=>i.clientCertificates.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded client certificates`})}},g={command:`client-certificates`,describe:`Issue and manage client certificates for mutual TLS (mTLS) authentication on your zone`,builder:e=>e.command(d).command(f).command(p).command(m).command(h).demandCommand(1),handler:()=>{}};export{g as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e,u as t}from"./auth-BHD_B2p9.mjs";import{t as n}from"./body-parser-iA3vRFmh.mjs";import{t as r}from"./output-CqGQp2r6.mjs";import{t as i}from"./dry-run-FV0pZwdg.mjs";import{t as a}from"./progress-5sHFvwez.mjs";const o={command:`list`,describe:`Retrieves the Cloud Connector rules configured for a zone. Rules define how traffic is routed to cloud services.`,builder:e=>e,handler:async n=>{let i=await e(n),o=await t({zone:n.zone},i,{quiet:n.quiet});n.zoneId=o,r(await a(`Loading rules`,async()=>i.cloudConnector.rules.list(o)),{successLabel:`Loaded rules`})}},s={command:`update`,describe:`Updates Cloud Connector rules for a zone, replacing the existing rule configuration.`,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 o=>{if(o.dryRun){i({command:`cf cloud-connector rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zoneId??`<zoneId>`}/cloud_connector/rules`,pathParams:{zoneId:String(o.zoneId??``)},bodyKind:`json`,body:{body:o.body},validation:`passed`});return}let s=await e(o);if(o.zoneId=await t({zone:o.zone},s,{quiet:o.quiet}),o.body){let e=n(o.body);r(await a(`Updating rule`,async()=>s.put(`/zones/${o.zoneId}/cloud_connector/rules`,{body:e})),{successLabel:`Updated rule`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},c={command:`rules`,describe:`Routing rules that map request patterns to cloud provider endpoints`,builder:e=>e.command(o).command(s).demandCommand(1),handler:()=>{}},l={command:`cloud-connector`,describe:`Route traffic from Cloudflare directly to cloud provider services (AWS, Azure, GCP) without origin servers`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}};export{l as default};
|