cf 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abuse-reports-Ina5TlsU.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/acm-SqcV8o5o.mjs +3 -0
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-DMPfi54f.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-DSSRDZz8.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/{audit-logs-BuExU_nz.mjs → audit-logs-BvQ9uwuy.mjs} +1 -1
- package/dist/{auth-CSC4yhEJ.mjs → auth-DX9KnJ0P.mjs} +3 -3
- package/dist/{auth-D5hNsOFq.mjs → auth-TYwGydWg.mjs} +1 -1
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/bot-management-DgW--8wM.mjs +5 -0
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/cache-CeN5t6_W.mjs +5 -0
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/{certificate-authorities-CtqzAtxQ.mjs → certificate-authorities-BzZnWCac.mjs} +1 -1
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/{cloud-connector-BA5IRZUP.mjs → cloud-connector-D5h8Dzzg.mjs} +1 -1
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-DOeHPdCG.mjs → completions-Bvzav4Mj.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/{context-jpewmual.mjs → context-C-WbewL6.mjs} +1 -1
- package/dist/custom-certificates-CfRj7QZb.mjs +5 -0
- package/dist/{custom-hostnames-CtuTdFcX.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/{dcv-delegation-Bgf86J-r.mjs → dcv-delegation-BYsNl3qc.mjs} +1 -1
- package/dist/{deploy-dVrgDUOp.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-C01_Lby6.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-DYZcTtIC.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-C03MtdZb.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/healthchecks-BBtW8vRh.mjs +4 -0
- package/dist/hostnames-Bh2IFxIw.mjs +3 -0
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-nv9INuWZ.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/keyless-certificates-CfJmXccT.mjs +3 -0
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{organizations-BqJHyvMK.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/origin-tls-client-auth-B30_2_dO.mjs +4 -0
- package/dist/{page-rules-EZHJePmn.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-CXJioWPs.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/{progress-DrDErV9w.mjs → progress-CL8I-7YK.mjs} +1 -1
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-D986zPJr.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/{raw-fetch-_n0lMAnD.mjs → raw-fetch-bIXC9D1m.mjs} +1 -1
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-CDIwTz3G.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-BR31o4P6.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{secrets-store-BAK9G12O.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/{session-DHYCE-PM.mjs → session-B8r8LNQN.mjs} +1 -1
- package/dist/{build-HuS9-R0V.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/smart-shield-BreBC1Ap.mjs +3 -0
- package/dist/snippets-BAJoWMSJ.mjs +4 -0
- package/dist/{spawn-CCGzKlC4.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-pVGxb7u5.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/{src-DU7FBCOX.mjs → src-BQ1dr9xR.mjs} +4 -4
- package/dist/ssl-D3Pixs8M.mjs +15 -0
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-HLGUazms.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/token-validation-DUvtXWur.mjs +10 -0
- package/dist/{tools-D_hfUU_Z.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-erjBdVKL.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-CBHwWPAM.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-u6KwrzWd.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/zaraz-9l7KuLqh.mjs +2 -0
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-BXtdwt6E.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-B_joQcMi.mjs +0 -22
- package/dist/acm-_kIHqYME.mjs +0 -3
- package/dist/addressing-CaFlw8y1.mjs +0 -12
- package/dist/ai-CqnhNb_c.mjs +0 -2
- package/dist/ai-gateway-pgYGI519.mjs +0 -8
- package/dist/ai-search-eqQMPQol.mjs +0 -7
- package/dist/ai_gateway--vuVLnOm.mjs +0 -4
- package/dist/alerting-CPxHiYHb.mjs +0 -6
- package/dist/analytics_engine-gWyfnsCs.mjs +0 -2
- package/dist/api-gateway-BXXGFCVR.mjs +0 -33
- package/dist/argo-aC6A3JyX.mjs +0 -2
- package/dist/artifacts-HD4V2xpK.mjs +0 -4
- package/dist/billing-COaghyxl.mjs +0 -2
- package/dist/bot-management-DmEzeV1Y.mjs +0 -5
- package/dist/botnet-feed-ByEAXAkw.mjs +0 -3
- package/dist/brand-protection-dPrGe8sL.mjs +0 -3
- package/dist/browser-rendering-BiSGnpBf.mjs +0 -4
- package/dist/cache-CY-7Lt71.mjs +0 -5
- package/dist/calls-wOQGDWPl.mjs +0 -4
- package/dist/client-certificates-CRf41xLe.mjs +0 -3
- package/dist/cloudforce-one-Bq_qPAWs.mjs +0 -21
- package/dist/connectivity-Bx3MgTHX.mjs +0 -3
- package/dist/connector-interrupts-D7ylweJZ.mjs +0 -2
- package/dist/connector-telemetry-events-6izV1kbP.mjs +0 -2
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +0 -2
- package/dist/connectors-DRt4e6d_.mjs +0 -3
- package/dist/content-scanning-Cd2vy5Sz.mjs +0 -4
- package/dist/custom-certificates-DYE-9epx.mjs +0 -5
- package/dist/custom-nameservers-CWqA51in.mjs +0 -3
- package/dist/custom-pages-DeUKEFGe.mjs +0 -4
- package/dist/d1-DvWY9Gp4.mjs +0 -4
- package/dist/data-security-BPo6dIWu.mjs +0 -6
- package/dist/diagnostics-6nKPmVgz.mjs +0 -3
- package/dist/dispatch-namespaces-64lXx2WJ.mjs +0 -7
- package/dist/dist-t_YrL25p.mjs +0 -82
- package/dist/dns-ClciFGxx.mjs +0 -29
- package/dist/dns-firewall-DfUmXDCe.mjs +0 -57
- package/dist/durable-objects-CMaYZ-YU.mjs +0 -2
- package/dist/email-routing-CGXhFqF5.mjs +0 -10
- package/dist/email-security-D5viPq8S.mjs +0 -8
- package/dist/email-sending-C2jpc3gh.mjs +0 -3
- package/dist/filters-bzsFcWt0.mjs +0 -4
- package/dist/google-tag-gateway-Dfy887yA.mjs +0 -2
- package/dist/healthchecks-DRoAlWgr.mjs +0 -4
- package/dist/hostnames-CFgIVI3s.mjs +0 -3
- package/dist/hyperdrive-C7-gwTSV.mjs +0 -18
- package/dist/iam-DqVPzGrb.mjs +0 -6
- package/dist/images-BYfl4YgR.mjs +0 -7
- package/dist/intel-duTEPIHc.mjs +0 -3
- package/dist/keyless-certificates-CRCDVd3g.mjs +0 -3
- package/dist/kv-CZoV4tiv.mjs +0 -5
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +0 -3
- package/dist/load-balancers--OMg0HNt.mjs +0 -6
- package/dist/logpush-C0_lZTyY.mjs +0 -4
- package/dist/logs-BtpWZQfV.mjs +0 -3
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +0 -5
- package/dist/magic-network-monitoring-CKgQyRj4.mjs +0 -4
- package/dist/magic-transit-CLhMcJ_-.mjs +0 -89
- package/dist/managed-transforms-D0Z2mlth.mjs +0 -3
- package/dist/mtls-certificates-BL65NK5T.mjs +0 -3
- package/dist/network-interconnects-Bgu9gmaG.mjs +0 -36
- package/dist/oauth-Bk-F-tIO.mjs +0 -52
- package/dist/observability-BynRbTF4.mjs +0 -4
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +0 -3
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +0 -2
- package/dist/origin-tls-client-auth-d3snC3vr.mjs +0 -4
- package/dist/pages-D4aYteKk.mjs +0 -11
- package/dist/pipelines-G8Iusxq-.mjs +0 -6
- package/dist/queues-DEkbKqZX.mjs +0 -6
- package/dist/r2-CV0IkCAW.mjs +0 -21
- package/dist/r2-data-catalog-NtqGC_a_.mjs +0 -14
- package/dist/rate-limits-B2wRsUX1.mjs +0 -5
- package/dist/realtime-kit-Ld3c5eU6.mjs +0 -18
- package/dist/request-tracers-D7SFMDik.mjs +0 -2
- package/dist/resource-sharing-YIQ04jXE.mjs +0 -5
- package/dist/resource-tagging-Bd6Y03sg.mjs +0 -16
- package/dist/rules-DHjLP5Kx.mjs +0 -4
- package/dist/rulesets-q4QABpKs.mjs +0 -8
- package/dist/rum-SmT4HZmM.mjs +0 -4
- package/dist/schema-validation-vVetgC_P.mjs +0 -24
- package/dist/scim-ChOkZpNx.mjs +0 -3
- package/dist/security-center-eScuYDKP.mjs +0 -2
- package/dist/security-txt-x7R4gmQu.mjs +0 -3
- package/dist/shared-BAjo72Lz.mjs +0 -2
- package/dist/smart-shield-CWlSsNi8.mjs +0 -3
- package/dist/snippets-DrlgYJYp.mjs +0 -4
- package/dist/speed-ZFrMWDgd.mjs +0 -4
- package/dist/ssl-9JY05sYt.mjs +0 -15
- package/dist/stream-tRU39b8K.mjs +0 -14
- package/dist/token-validation-_VdamKpz.mjs +0 -10
- package/dist/turnstile-BRzXd28B.mjs +0 -23
- package/dist/url-normalization-D-NxuLtN.mjs +0 -3
- package/dist/url-scanner-BzzR6iDx.mjs +0 -2
- package/dist/user-C4omq__w.mjs +0 -10
- package/dist/vectorize-By6EqcNR.mjs +0 -4
- package/dist/web3-DQ5dmE9W.mjs +0 -4
- package/dist/workers-D8Be7_as.mjs +0 -18
- package/dist/workers-builds-BE3W3qNk.mjs +0 -7
- package/dist/workflows-BWWufqFA.mjs +0 -4
- package/dist/zaraz-Bsa9AvVL.mjs +0 -2
- package/dist/zero-trust-UNVZFnKu.mjs +0 -118
- package/dist/zero_trust-B0_Rk4p2.mjs +0 -3
- /package/dist/{cli-types-BeyOc81z.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{metadata-OOwvpR8m.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-C3h-mwp7.mjs → resolve-DGD57PFH.mjs} +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,T as t,w as n,x as r}from"./oauth-Bk-F-tIO.mjs";import{i,n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d,t as f}from"./input-validation-_fMCApaH.mjs";import{t as p}from"./cli-types-BeyOc81z.mjs";function ee(e){return e.option(`normalize`,{type:`boolean`,description:`Ensures that the configuration is written or retrieved in normalized fashion`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get`,describe:`Gets the current API Shield configuration settings for a zone, including validation behavior and enforcement mode.`,builder:ee,handler:async e=>{let t={normalize:e.normalize};if(e.dryRun){l({command:`cf api-gateway configurations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.configurations.get({zone_id:i,...t})),{successLabel:`Loaded`})}};function m(e){return e.option(`normalize`,{type:`boolean`,description:`Ensures that the configuration is written or retrieved in normalized fashion`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`update`,describe:`Updates API Shield configuration settings for a zone. Can modify validation strictness, enforcement mode, and other global settings.`,builder:m,handler:async e=>{let t={normalize:e.normalize};if(e.dryRun){l({command:`cf api-gateway configurations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let r=o(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),c(await u(`Updating`,async()=>n.apiGateway.configurations.update({body:r,zone_id:i,...t})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`configurations`,describe:`API Shield configuration — authentication requirements and session identifiers`,builder:e=>e.command(te).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Retrieve the most up to date view of discovered operations, rendered as OpenAPI schemas`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway discovery get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/discovery`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading`,async()=>t.apiGateway.discovery.get({zone_id:n})),{successLabel:`Loaded`})}};function y(e){return 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)`})}const b={command:`bulk-edit`,describe:"Update the `state` on one or more discovered operations",builder:y,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway discovery operations bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/discovery/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.bulkEdit({body:r,zone_id:n})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function x(e){return e.positional(`discovery-id`,{type:`string`,description:`Discovery ID of a discovered operation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit <discovery-id>`,describe:"Update the `state` on a discovered operation",builder:x,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway discovery operations edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/discovery/operations/${e[`discovery-id`]==null?`<discovery-id>`:encodeURIComponent(String(e[`discovery-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"discovery-id":String(e[`discovery-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.edit({...r,zone_id:n,discovery_id:e[`discovery-id`]})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.edit({zone_id:n,discovery_id:e[`discovery-id`]})),{successLabel:`Updated`})}};function C(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`order`,{type:`string`,description:`Field to order by`,choices:[`host`,`method`,`endpoint`,`traffic_stats.requests`,`traffic_stats.last_updated`]}).option(`diff`,{type:`boolean`,description:"When `true`, only return API Discovery results that are not saved into API Shield Endpoint Management"}).option(`origin`,{type:`string`,description:"Filter results to only include discovery results sourced from a particular discovery engine\n * `ML` - Discovered operations that were sourced using ML API Discovery\n * `SessionIdentifier` - Discovered operations that were sourced using Session Identifier API Discovery",choices:[`ML`,`SessionIdentifier`,`LabelDiscovery`]}).option(`state`,{type:`string`,description:"Filter results to only include discovery results in a particular state. States are as follows\n * `review` - Discovered operations that are not saved into API Shield Endpoint Management\n * `saved` - Discovered operations that are already saved into API Shield Endpoint Management\n * `ignored` - Discovered operations that have been marked as ignored",choices:[`review`,`saved`,`ignored`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Retrieve the most up to date view of discovered operations`,builder:p(C),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],host:e.host,method:e.method,endpoint:e.endpoint,direction:e.direction,order:e.order,diff:e.diff,origin:e.origin,state:e.state};if(e.dryRun){l({command:`cf api-gateway discovery operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/discovery/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.discovery.operations.list({zone_id:i,...t})),{successLabel:`Loaded`})}},T={command:`operations`,describe:`Auto-discovered API endpoints from traffic analysis with schema inference`,builder:e=>e.command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},E={command:`discovery`,describe:`Auto-discovered API endpoints from traffic analysis with schema inference`,builder:e=>e.command(v).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`hosts`,{type:`string`,array:!0,description:`List of hosts to be targeted in the expression`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`create`,describe:`Creates an expression template fallthrough rule for API Shield. Used for configuring default behavior when no other expression templates match.`,builder:D,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway expression-template fallthrough create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/expression-template/fallthrough`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({hosts:e.hosts}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.expressionTemplate.fallthrough.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.hosts===void 0)throw Error(`--hosts is required (or pass --body with this field set).`);let i=s({hosts:e.hosts});c(await u(`Creating`,async()=>t.apiGateway.expressionTemplate.fallthrough.create({...i,zone_id:n})),{successLabel:`Created`})}},k={command:`fallthrough`,describe:`Reusable expression templates for API Gateway rule configurations`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},A={command:`expression-template`,describe:`Operations for expression-template`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order by`,choices:[`name`,`description`,`created_at`,`last_updated`,`mapped_resources.operations`]}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`source`,{type:`string`,description:`Filter for labels with source`,choices:[`user`,`managed`]}).option(`filter`,{type:`string`,description:`Filter for labels where the name or description matches using substring match`}).option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label"}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`Retrieve all labels`,builder:p(j),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,source:e.source,filter:e.filter,with_mapped_resource_counts:e[`with-mapped-resource-counts`]};if(e.dryRun){l({command:`cf api-gateway labels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.labels.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function N(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label"}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <name>`,describe:`Retrieve managed label`,builder:N,handler:async e=>{let t={with_mapped_resource_counts:e[`with-mapped-resource-counts`]};if(e.dryRun){l({command:`cf api-gateway labels managed get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/managed/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.labels.managed.get({zone_id:i,name:e.name,...t})),{successLabel:`Loaded`})}};function F(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`update <name>`,describe:`Replace all operations(s) attached to a managed label`,builder:F,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels managed resources operation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/managed/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}/resources/operation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.managed.resources.operation.update({body:r,zone_id:n,name:e.name})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},L={command:`operation`,describe:`Labels operations`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`resources`,describe:`Operations for labels.managed.resources`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`managed`,describe:`Labels operations`,builder:e=>e.command(P).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return 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)`})}const V={command:`bulk-create`,describe:`Create user labels`,builder:B,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.labels.user.bulkCreate({body:r,zone_id:n})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function H(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`bulk-delete`,describe:`Delete user labels`,builder:H,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let n=o(e.body);c(await u(`Deleting`,async()=>t.apiGateway.labels.user.bulkDelete({body:n,zone_id:i})),{successLabel:`Deleted`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function W(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const G={command:`delete <name>`,describe:`Delete user label`,builder:W,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},bodyKind:`none`});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}c(await u(`Deleting`,async()=>t.apiGateway.labels.user.delete({zone_id:i,name:e.name})),{successLabel:`Deleted`})}};function K(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`description`,{type:`string`,description:`The description of the label`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`edit <name>`,describe:`Update certain fields on a label`,builder:K,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},bodyKind:`json`,body:e.body===void 0?s({description:d(e.description,`description`,`text`)}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.edit({...r,zone_id:n,name:e.name})),{successLabel:`Updated`});return}let i=s({description:d(e.description,`description`,`text`)});c(await u(`Updating`,async()=>t.apiGateway.labels.user.edit({...i,zone_id:n,name:e.name})),{successLabel:`Updated`})}};function J(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label"}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <name>`,describe:`Retrieve user label`,builder:J,handler:async e=>{let t={with_mapped_resource_counts:e[`with-mapped-resource-counts`]};if(e.dryRun){l({command:`cf api-gateway labels user get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.labels.user.get({zone_id:i,name:e.name,...t})),{successLabel:`Loaded`})}};function X(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Z={command:`update <name>`,describe:`Replace all operations(s) attached to a user label`,builder:X,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user resources operation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}/resources/operation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.resources.operation.update({body:r,zone_id:n,name:e.name})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},Q={command:`operation`,describe:`Labels operations`,builder:e=>e.command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ne={command:`resources`,describe:`Operations for labels.user.resources`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`name`,{type:`string`,description:`The label name`,demandOption:!0}).option(`description`,{type:`string`,description:`The description of the label`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`update <name>`,describe:`Update all fields on a label`,builder:re,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/labels/user/${e.name==null?`<name>`:encodeURIComponent(String(e.name))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),name:String(e.name??``)},bodyKind:`json`,body:e.body===void 0?s({description:d(e.description,`description`,`text`)}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.update({...r,zone_id:n,name:e.name})),{successLabel:`Updated`});return}let i=s({description:d(e.description,`description`,`text`)});c(await u(`Updating`,async()=>t.apiGateway.labels.user.update({...i,zone_id:n,name:e.name})),{successLabel:`Updated`})}},ae={command:`user`,describe:`Labels operations`,builder:e=>e.command(V).command(U).command(G).command(q).command(Y).command(ie).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},oe={command:`labels`,describe:`Labels operations`,builder:e=>e.command(M).command(z).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function se(e){return 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)`})}const ce={command:`bulk-create`,describe:`Add one or more operations to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date.`,builder:se,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.bulkCreate({body:r,zone_id:n})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function le(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`bulk-delete`,describe:`Bulk removes multiple API operations from API Shield endpoint management in a single request. Efficient for cleaning up unused endpoints.`,builder:le,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(e.body){let n=o(e.body);c(await u(`Deleting`,async()=>t.apiGateway.operations.bulkDelete({body:n,zone_id:i})),{successLabel:`Deleted`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function de(e){return e.option(`endpoint`,{type:`string`,description:`The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.`}).option(`host`,{type:`string`,description:`RFC3986-compliant host.`}).option(`method`,{type:`string`,description:`The HTTP method used to access the endpoint.`,choices:[`GET`,`POST`,`HEAD`,`OPTIONS`,`PUT`,`DELETE`,`CONNECT`,`PATCH`,`TRACE`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create`,describe:`Add one operation to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date.`,builder:de,handler:async n=>{if(n.dryRun){l({command:`cf api-gateway operations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/api_gateway/operations/item`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({endpoint:d(n.endpoint,`endpoint`,`text`),host:d(n.host,`host`,`text`),method:d(n.method,`method`,`text`)}):o(n.body)});return}let i=await a(n),f=await r({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=f,n.body){let e=o(n.body);c(await u(`Creating`,async()=>i.apiGateway.operations.create({body:e,zone_id:f})),{successLabel:`Created`});return}n.endpoint===void 0&&(n.endpoint=await e(`endpoint`,`The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.`)),n.host===void 0&&(n.host=await e(`host`,`RFC3986-compliant host.`)),n.method===void 0&&(n.method=await t(`method`,`The HTTP method used to access the endpoint.`,[`GET`,`POST`,`HEAD`,`OPTIONS`,`PUT`,`DELETE`,`CONNECT`,`PATCH`,`TRACE`]));let p=s({endpoint:d(n.endpoint,`endpoint`,`text`),host:d(n.host,`host`,`text`),method:d(n.method,`method`,`text`)});c(await u(`Creating`,async()=>i.apiGateway.operations.create({body:p,zone_id:f})),{successLabel:`Created`})}};function pe(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const me={command:`delete <operation-id>`,describe:`Removes a single API operation from API Shield endpoint management. The operation will no longer be tracked or protected by API Shield rules.`,builder:pe,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}c(await u(`Deleting`,async()=>t.apiGateway.operations.delete({zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Deleted`})}};function he(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`with-schemas`,{type:`boolean`,description:`When true, includes OpenAPI schemas (both uploaded and learned) for the operation in the response. Due to the conversion overhead, this parameter is only supported on single-operation retrieval.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <operation-id>`,describe:`Gets detailed information about a specific API operation in API Shield, including its schema validation settings and traffic statistics.`,builder:p(he),handler:async e=>{let t={feature:e.feature,with_schemas:e[`with-schemas`]};if(e.dryRun){l({command:`cf api-gateway operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.operations.get({zone_id:i,operation_id:e[`operation-id`],...t})),{successLabel:`Loaded`})}};function _e(e){return e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ve={command:`bulk-create`,describe:`Bulk attach label(s) on operation(s) in endpoint management`,builder:_e,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.labels.bulkCreate({...r,zone_id:n})),{successLabel:`Created`});return}let i=s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}});c(await u(`Creating`,async()=>t.apiGateway.operations.labels.bulkCreate({...i,zone_id:n})),{successLabel:`Created`})}};function ye(e){return e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`bulk-delete`,describe:`Bulk remove label(s) on operation(s) in endpoint management`,builder:ye,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}}):o(e.body)});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}if(e.body){let n=o(e.body);c(await u(`Deleting`,async()=>t.apiGateway.operations.labels.bulkDelete({...n,zone_id:i})),{successLabel:`Deleted`});return}let d=s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}});c(await u(`Deleting`,async()=>t.apiGateway.operations.labels.bulkDelete({...d,zone_id:i})),{successLabel:`Deleted`})}};function xe(e){return e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names. Providing an empty array will result in all managed labels being removed from all affected operations`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names. Providing an empty array will result in all user labels being removed from all affected operations`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Se={command:`bulk-update`,describe:`Bulk replace label(s) on operation(s) in endpoint management`,builder:xe,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.labels.bulkUpdate({...r,zone_id:n})),{successLabel:`Updated`});return}if(e[`managed-labels`]===void 0)throw Error(`--managed-labels is required (or pass --body with this field set).`);if(e[`user-labels`]===void 0)throw Error(`--user-labels is required (or pass --body with this field set).`);let i=s({managed:{labels:e[`managed-labels`]},user:{labels:e[`user-labels`]}});c(await u(`Updating`,async()=>t.apiGateway.operations.labels.bulkUpdate({...i,zone_id:n})),{successLabel:`Updated`})}};function Ce(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`managed`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const we={command:`create <operation-id>`,describe:`Attach label(s) on an operation in endpoint management`,builder:Ce,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:e.managed,user:e.user}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.labels.create({...r,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Created`});return}let i=s({managed:e.managed,user:e.user});c(await u(`Creating`,async()=>t.apiGateway.operations.labels.create({...i,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Created`})}};function Te(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`managed`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`delete <operation-id>`,describe:`Remove label(s) on an operation in endpoint management`,builder:Te,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:e.managed,user:e.user}):o(e.body)});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}if(e.body){let n=o(e.body);c(await u(`Deleting`,async()=>t.apiGateway.operations.labels.delete({...n,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Deleted`});return}let d=s({managed:e.managed,user:e.user});c(await u(`Deleting`,async()=>t.apiGateway.operations.labels.delete({...d,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Deleted`})}};function De(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`managed`,{type:`string`,array:!0,description:`List of managed label names. Omitting this property or passing an empty array will result in all managed labels being removed from the operation`}).option(`user`,{type:`string`,array:!0,description:`List of user label names. Omitting this property or passing an empty array will result in all user labels being removed from the operation`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`update <operation-id>`,describe:`Replace label(s) on an operation in endpoint management`,builder:De,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}/labels`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({managed:e.managed,user:e.user}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.labels.update({...r,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Updated`});return}let i=s({managed:e.managed,user:e.user});c(await u(`Updating`,async()=>t.apiGateway.operations.labels.update({...i,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Updated`})}},ke={command:`labels`,describe:`Manage labels on API Shield operations for classification and policy enforcement`,builder:e=>e.command(ve).command(be).command(Se).command(we).command(Ee).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:"Field to order by. When requesting a feature, the feature keys are available for ordering as well, e.g., `thresholds.suggested_threshold`.",choices:[`method`,`host`,`endpoint`,`thresholds.$key`]}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const je={command:`list`,describe:`Lists all API operations tracked by API Shield for a zone with pagination. Returns operation details including method, path, and feature configurations.`,builder:p(Ae),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,host:e.host,method:e.method,endpoint:e.endpoint,feature:e.feature};if(e.dryRun){l({command:`cf api-gateway operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.operations.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Me(e){return 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)`})}const Ne={command:`edit`,describe:`Updates multiple operation-level schema validation settings on the zone`,builder:Me,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations schema-validation edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.schemaValidation.edit({body:r,zone_id:n})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Pe(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`get <operation-id>`,describe:`Retrieves operation-level schema validation settings on the zone`,builder:Pe,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations schema-validation get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading`,async()=>t.apiGateway.operations.schemaValidation.get({zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`operation-id`,{type:`string`,description:`Identifier for the operation`,demandOption:!0}).option(`mitigation-action`,{type:`string`,description:"When set, this applies a mitigation action to this operation\n\n - `log` log request when request does not conform to schema for this operation\n - `block` deny access to the site when request does not conform to schema for this operation\n - `none` will skip mitigation for this operation\n - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied\n",choices:[`log`,`block`,`none`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`update <operation-id>`,describe:`Updates operation-level schema validation settings on the zone`,builder:Ie,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations schema-validation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/operations/${e[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(e[`operation-id`]))}/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operation-id":String(e[`operation-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({mitigation_action:d(e[`mitigation-action`],`mitigation-action`,`text`)}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.schemaValidation.update({...r,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Updated`});return}let i=s({mitigation_action:d(e[`mitigation-action`],`mitigation-action`,`text`)});c(await u(`Updating`,async()=>t.apiGateway.operations.schemaValidation.update({...i,zone_id:n,operation_id:e[`operation-id`]})),{successLabel:`Updated`})}},Re={command:`schema-validation`,describe:`Registered API operations (method + path) with traffic metrics and schema bindings`,builder:e=>e.command(Ne).command(Fe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ze={command:`operations`,describe:`Registered API operations (method + path) with traffic metrics and schema bindings`,builder:e=>e.command(ce).command(ue).command(fe).command(me).command(ge).command(je).command(ke).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.option(`host`,{type:`string`,description:`Receive schema only for the given host(s).`}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Retrieves API operations and their features exported as OpenAPI schemas.`,builder:p(Be),handler:async e=>{let t={host:e.host,feature:e.feature};if(e.dryRun){l({command:`cf api-gateway schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.schemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}},He={command:`schemas`,describe:`OpenAPI schemas learned from traffic for API endpoint validation`,builder:e=>e.command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ue(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used when there is no mitigation action defined on the operation
|
|
9
|
-
Mitigation actions are as follows:
|
|
10
|
-
|
|
11
|
-
* \`log\` - log request when request does not conform to schema
|
|
12
|
-
* \`block\` - deny access to the site when request does not conform to schema
|
|
13
|
-
|
|
14
|
-
A special value of of \`none\` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation
|
|
15
|
-
|
|
16
|
-
\`null\` will have no effect.
|
|
17
|
-
`,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:`When set, this overrides both zone level and operation level mitigation actions.
|
|
18
|
-
|
|
19
|
-
- \`none\` will skip running schema validation entirely for the request
|
|
20
|
-
|
|
21
|
-
To clear any override, use the special value \`disable_override\`
|
|
22
|
-
|
|
23
|
-
\`null\` will have no effect.
|
|
24
|
-
`,choices:[`none`,`disable_override`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const We={command:`edit`,describe:`Updates zone level schema validation settings on the zone`,builder:Ue,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway settings schema-validation edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/settings/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)}):o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.settings.schemaValidation.edit({...r,zone_id:n})),{successLabel:`Updated`});return}let i=s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)});c(await u(`Updating`,async()=>t.apiGateway.settings.schemaValidation.edit({...i,zone_id:n})),{successLabel:`Updated`})}};function Ge(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ke={command:`get`,describe:`Retrieves zone level schema validation settings currently set on the zone`,builder:Ge,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway settings schema-validation get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/settings/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading`,async()=>t.apiGateway.settings.schemaValidation.get({zone_id:n})),{successLabel:`Loaded`})}};function qe(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used when there is no mitigation action defined on the operation
|
|
25
|
-
|
|
26
|
-
Mitigation actions are as follows:
|
|
27
|
-
|
|
28
|
-
* \`log\` - log request when request does not conform to schema
|
|
29
|
-
* \`block\` - deny access to the site when request does not conform to schema
|
|
30
|
-
|
|
31
|
-
A special value of of \`none\` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation
|
|
32
|
-
`,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:"When set, this overrides both zone level and operation level mitigation actions.\n\n - `none` will skip running schema validation entirely for the request\n - `null` indicates that no override is in place\n\nTo clear any override, use the special value `disable_override` or `null`\n",choices:[`none`,`disable_override`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Je={command:`update`,describe:`Updates zone level schema validation settings on the zone`,builder:qe,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway settings schema-validation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/settings/schema_validation`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)}):o(e.body)});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>n.apiGateway.settings.schemaValidation.update({...t,zone_id:i})),{successLabel:`Updated`});return}e[`validation-default-mitigation-action`]===void 0&&(e[`validation-default-mitigation-action`]=await t(`validation-default-mitigation-action`,"The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: * `log` - log request when request does not conform to schema * `block` - deny access to the site when request does not conform to schema A special value of of `none` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation ",[`none`,`log`,`block`]));let f=s({validation_default_mitigation_action:d(e[`validation-default-mitigation-action`],`validation-default-mitigation-action`,`text`),validation_override_mitigation_action:d(e[`validation-override-mitigation-action`],`validation-override-mitigation-action`,`text`)});c(await u(`Updating`,async()=>n.apiGateway.settings.schemaValidation.update({...f,zone_id:i})),{successLabel:`Updated`})}},Ye={command:`schema-validation`,describe:`Zone-level API Gateway settings including schema validation behavior`,builder:e=>e.command(We).command(Ke).command(Je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Xe={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ze(e){return 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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`kind`,{type:`string`,description:`Kind of schema`}).option(`name`,{type:`string`,description:`Name of the schema`}).option(`validation-enabled`,{type:`string`,description:`Flag whether schema is enabled for validation.`})}const Qe={command:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:Ze,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,kind:e.kind,name:e.name,"validation-enabled":e[`validation-enabled`]}});return}let t=await a(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.file!==void 0||e.body!==void 0||e.kind!==void 0||e.name!==void 0||e[`validation-enabled`]!==void 0){let n=new FormData;if(e.file){let t=f(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.kind!==void 0&&n.append(`kind`,String(d(e.kind,`kind`,`text`)??``)),e.name!==void 0&&n.append(`name`,String(d(e.name,`name`,`text`)??``)),e[`validation-enabled`]!==void 0&&n.append(`validation_enabled`,String(d(e[`validation-enabled`],`validation-enabled`,`text`)??``)),c(await u(`Creating`,async()=>i(t,`POST`,`/zones/${e.zoneId}/api_gateway/user_schemas`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=d(e.body,`body`,`binary`);c(await u(`Creating`,async()=>i(t,`POST`,`/zones/${e.zoneId}/api_gateway/user_schemas`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function $e(e){return e.positional(`schema-id`,{type:`string`,description:`Identifier for the schema-ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const et={command:`delete <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules.`,builder:$e,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
33
|
-
`);return}c(await u(`Deleting`,async()=>t.apiGateway.userSchemas.delete({zone_id:i,schema_id:e[`schema-id`]})),{successLabel:`Deleted`})}};function tt(e){return e.positional(`schema-id`,{type:`string`,description:`Identifier for the schema-ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $={command:`edit <schema-id>`,describe:`Activates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions.`,builder:tt,handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let t=await a(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.userSchemas.edit({...r,zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>t.apiGateway.userSchemas.edit({zone_id:n,schema_id:e[`schema-id`]})),{successLabel:`Updated`})}};function nt(e){return e.positional(`schema-id`,{type:`string`,description:`Identifier for the schema-ID`,demandOption:!0}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rt={command:`get <schema-id>`,describe:`Gets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration.`,builder:nt,handler:async e=>{let t={omit_source:e[`omit-source`]};if(e.dryRun){l({command:`cf api-gateway user-schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"schema-id":String(e[`schema-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.userSchemas.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}};function it(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone. Useful for understanding which domains have schema coverage.`,builder:it,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf api-gateway user-schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas/hosts`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.userSchemas.hosts.list({zone_id:i,...t})),{successLabel:`Loaded`})}},ot={command:`hosts`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function st(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`}).option(`validation-enabled`,{type:`boolean`,description:`Flag whether schema is enabled for validation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ct={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield for the zone, including their validation status and associated operations.`,builder:st,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],omit_source:e[`omit-source`],validation_enabled:e[`validation-enabled`]};if(e.dryRun){l({command:`cf api-gateway user-schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.userSchemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function lt(e){return e.option(`schema-id`,{type:`string`,description:`Identifier for the schema-ID`,demandOption:!0}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in API Shield Endpoint Management or not. `new` will just return operations from the schema that do not exist in API Shield Endpoint Management. `existing` will just return operations from the schema that already exist in API Shield Endpoint Management.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`list`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:p(lt),handler:async e=>{let t={feature:e.feature,host:e.host,method:e.method,endpoint:e.endpoint,page:e.page,per_page:e[`per-page`],operation_status:e[`operation-status`]};if(e.dryRun){l({command:`cf api-gateway user-schemas operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/api_gateway/user_schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}/operations`,pathParams:{"schema-id":String(e[`schema-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await a(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.apiGateway.userSchemas.operations.list({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}},dt={command:`operations`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ft={command:`user-schemas`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(Qe).command(et).command($).command(rt).command(ct).command(ot).command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pt={command:`api-gateway`,describe:`Discover, monitor, and protect your API endpoints with schema validation, abuse detection, and routing`,builder:e=>e.command(g).command(E).command(A).command(oe).command(ze).command(He).command(Xe).command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{pt as default};
|
package/dist/argo-aC6A3JyX.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{T as e,x as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-DrDErV9w.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";function l(e){return e.option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`})}const u={command:`edit`,describe:`Configures the value of the Argo Smart Routing enablement setting.`,builder:l,handler:async l=>{if(l.dryRun){o({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({value:c(l.value,`value`,`text`)}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.argo.smartRouting.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await e(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let f=i({value:c(l.value,`value`,`text`)});a(await s(`Updating`,async()=>u.argo.smartRouting.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves the value of Argo Smart Routing enablement setting.`,builder:d,handler:async e=>{if(e.dryRun){o({command:`cf argo smart-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.argo.smartRouting.get({zone_id:i})),{successLabel:`Loaded`})}},p={command:`smart-routing`,describe:`Route traffic through the fastest network paths to your origin using real-time latency data`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`value`,{type:`string`,description:`Enables Tiered Caching.`,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 Tiered Caching.`})}const h={command:`edit`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:m,handler:async l=>{if(l.dryRun){o({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({value:c(l.value,`value`,`text`)}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.argo.tieredCaching.edit({...e,zone_id:d})),{successLabel:`Updated`});return}l.value===void 0&&(l.value=await e(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let f=i({value:c(l.value,`value`,`text`)});a(await s(`Updating`,async()=>u.argo.tieredCaching.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:g,handler:async e=>{if(e.dryRun){o({command:`cf argo tiered-caching get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.argo.tieredCaching.get({zone_id:i})),{successLabel:`Loaded`})}},v={command:`tiered-caching`,describe:`Reduce origin load by having upper-tier data centers serve cache misses before reaching your origin`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`argo`,describe:`Network optimization features that speed up and improve reliability of traffic to your origins`,builder:e=>e.command(p).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t,w as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-DrDErV9w.mjs";import{t as s}from"./local-CYc9q7l2.mjs";import{t as c}from"./cli-types-BeyOc81z.mjs";import{n as l,t as u}from"./raw-fetch-_n0lMAnD.mjs";function d(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`artifactsNamespacesGet <namespace>`,describe:`Returns an Artifacts namespace summary.`,builder:d,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsNamespacesGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}`,pathParams:{namespace:String(n.namespace??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsNamespacesGet({account_id:l,namespace:n.namespace})),{successLabel:`Loaded`})}};function p(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`artifactsNamespacesList`,describe:`Lists Artifacts namespaces for an account.`,builder:p,handler:async n=>{let c={limit:n.limit,cursor:n.cursor};if(n.dryRun){a({command:`cf artifacts namespaces artifactsNamespacesList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t(l);n.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsNamespacesList({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const g={command:`artifactsReposBlobGet <hash>`,describe:`Returns raw bytes for an immutable Git blob object. Blob responses are cacheable forever by hash.`,builder:h,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposBlobGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/blob/${n.hash==null?`<hash>`:encodeURIComponent(String(n.hash))}`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``),hash:String(n.hash??``)},bodyKind:`none`});return}let i=await r(n),c=n.local?s:await t(i);n.accountId=c;let d=await o(`Loading`,async()=>u(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(n.namespace))}/repos/${encodeURIComponent(String(n.name))}/blob/${encodeURIComponent(String(n.hash))}`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));l(n.text===!0?d.toString(`utf-8`):d)}};function _(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`artifactsReposCommitGet <hash>`,describe:`Returns decoded metadata for an immutable Git commit object. Commit responses are cacheable forever by hash.`,builder:_,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposCommitGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/commit/${n.hash==null?`<hash>`:encodeURIComponent(String(n.hash))}`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``),hash:String(n.hash??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposCommitGet({account_id:l,namespace:n.namespace,name:n.name,hash:n.hash})),{successLabel:`Loaded`})}};function y(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`artifactsReposCreate <namespace>`,describe:`Creates a Git-compatible Artifacts repository in a namespace.`,builder:y,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos`,pathParams:{namespace:String(n.namespace??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposCreate({account_id:l,namespace:n.namespace})),{successLabel:`Created`})}};function x(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`artifactsReposDelete <name>`,describe:`Deletes a repository and schedules cleanup of its backing data.`,builder:x,handler:async c=>{if(c.dryRun){a({command:`cf artifacts namespaces artifactsReposDelete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${c.namespace==null?`<namespace>`:encodeURIComponent(String(c.namespace))}/repos/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}`,pathParams:{namespace:String(c.namespace??``),name:String(c.name??``)},bodyKind:`none`});return}let l=await r(c),u=c.local?s:await t(l);if(c.accountId=u,!await n({force:!!c.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>l.artifacts.namespaces.artifactsReposDelete({account_id:u,namespace:c.namespace,name:c.name})),{successLabel:`Deleted`})}};function C(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash.`,demandOption:!0}).option(`path`,{type:`string`,description:`File path.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const w={command:`artifactsReposFileGet <name>`,describe:`Returns raw bytes for a file resolved by ref and path.`,builder:C,handler:async n=>{let i={ref:n.ref,path:n.path};if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposFileGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/file`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},query:i,bodyKind:`none`});return}let c=await r(n),d=n.local?s:await t(c);n.accountId=d;let f=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),p=await o(`Loading`,async()=>u(`/accounts/${d}/artifacts/namespaces/${encodeURIComponent(String(n.namespace))}/repos/${encodeURIComponent(String(n.name))}/file${f?`?`+f:``}`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));l(n.text===!0?p.toString(`utf-8`):p)}};function T(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`artifactsReposFork <name>`,describe:`Forks a source repository into a new repository.`,builder:T,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposFork`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/fork`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposFork({account_id:l,namespace:n.namespace,name:n.name})),{successLabel:`Created`})}};function D(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`artifactsReposGet <name>`,describe:`Returns repository metadata.`,builder:D,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposGet({account_id:l,namespace:n.namespace,name:n.name})),{successLabel:`Loaded`})}};function k(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`artifactsReposImport <name>`,describe:`Imports an HTTPS Git repository into an Artifacts repository.`,builder:k,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposImport`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/import`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposImport({account_id:l,namespace:n.namespace,name:n.name})),{successLabel:`Created`})}};function j(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`search`,{type:`string`,description:`Search`}).option(`sort`,{type:`string`,description:`Sort`,choices:[`created_at`,`updated_at`,`last_push_at`,`name`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`artifactsReposList <namespace>`,describe:`Lists repositories in a namespace.`,builder:c(j),handler:async n=>{let c={limit:n.limit,cursor:n.cursor,search:n.search,sort:n.sort,direction:n.direction};if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos`,pathParams:{namespace:String(n.namespace??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t(l);n.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsReposList({account_id:u,namespace:n.namespace,...c})),{successLabel:`Loaded`})}};function N(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or commit hash. Defaults to HEAD.`}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`artifactsReposLogGet <name>`,describe:`Returns commit metadata walking backwards from a ref, branch, tag, or HEAD.`,builder:N,handler:async n=>{let c={ref:n.ref,limit:n.limit,offset:n.offset};if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposLogGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/log`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t(l);n.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsReposLogGet({account_id:u,namespace:n.namespace,name:n.name,...c})),{successLabel:`Loaded`})}};function F(e){return e.positional(`path`,{type:`string`,description:`File path. May contain slashes.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`ref`,{type:`string`,description:`Git ref, branch, tag, or 40-character commit hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const I={command:`artifactsReposRawGet <path>`,describe:`Returns file bytes resolved by ref and path, with a sniffed content type and browser-safe response headers.`,builder:F,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposRawGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/raw/${n.ref==null?`<ref>`:encodeURIComponent(String(n.ref))}/${n.path==null?`<path>`:encodeURIComponent(String(n.path))}`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``),ref:String(n.ref??``),path:String(n.path??``)},bodyKind:`none`});return}let i=await r(n),c=n.local?s:await t(i);n.accountId=c;let d=await o(`Loading`,async()=>u(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(n.namespace))}/repos/${encodeURIComponent(String(n.name))}/raw/${encodeURIComponent(String(n.ref))}/${encodeURIComponent(String(n.path))}`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));l(n.text===!0?d.toString(`utf-8`):d)}};function L(e){return e.positional(`hash`,{type:`string`,description:`40-character lowercase hexadecimal Git object hash.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`artifactsReposTreeGet <hash>`,describe:`Returns decoded entries for an immutable Git tree object. Tree responses are cacheable forever by hash.`,builder:L,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsReposTreeGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/tree/${n.hash==null?`<hash>`:encodeURIComponent(String(n.hash))}`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``),hash:String(n.hash??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposTreeGet({account_id:l,namespace:n.namespace,name:n.name,hash:n.hash})),{successLabel:`Loaded`})}};function z(e){return e.positional(`name`,{type:`string`,description:`Repository name.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`state`,{type:`string`,description:`State`,choices:[`active`,`expired`,`revoked`,`all`]}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`artifactsRepoTokensList <name>`,describe:`Lists tokens for a repository.`,builder:c(z),handler:async n=>{let c={state:n.state,page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf artifacts namespaces artifactsRepoTokensList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/repos/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/tokens`,pathParams:{namespace:String(n.namespace??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t(l);n.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsRepoTokensList({account_id:u,namespace:n.namespace,name:n.name,...c})),{successLabel:`Loaded`})}};function V(e){return e.positional(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`artifactsTokensCreate <namespace>`,describe:`Creates a scoped Git token for a repository.`,builder:V,handler:async n=>{if(n.dryRun){a({command:`cf artifacts namespaces artifactsTokensCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${n.namespace==null?`<namespace>`:encodeURIComponent(String(n.namespace))}/tokens`,pathParams:{namespace:String(n.namespace??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsTokensCreate({account_id:l,namespace:n.namespace})),{successLabel:`Created`})}};function U(e){return e.positional(`id`,{type:`string`,description:`Token ID. Must match /^[0-9a-z]{16}$/.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Artifacts namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const W={command:`artifactsTokensRevoke <id>`,describe:`Revokes an Artifacts repository token.`,builder:U,handler:async c=>{if(c.dryRun){a({command:`cf artifacts namespaces artifactsTokensRevoke`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${c.namespace==null?`<namespace>`:encodeURIComponent(String(c.namespace))}/tokens/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}`,pathParams:{namespace:String(c.namespace??``),id:String(c.id??``)},bodyKind:`none`});return}let l=await r(c),u=c.local?s:await t(l);if(c.accountId=u,!await n({force:!!c.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting`,async()=>l.artifacts.namespaces.artifactsTokensRevoke({account_id:u,namespace:c.namespace,id:c.id})),{successLabel:`Deleted`})}},G={command:`namespaces`,describe:`Operations for namespaces`,builder:e=>e.command(f).command(m).command(B).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(I).command(R).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`artifacts`,describe:`artifacts`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t}from"./oauth-Bk-F-tIO.mjs";import{n}from"./auth-CSC4yhEJ.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-DrDErV9w.mjs";import{t as o}from"./local-CYc9q7l2.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`get`,describe:`Gets the current billing profile for the account.`,builder:s,handler:async s=>{if(s.dryRun){i({command:`cf billing profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/billing/profile`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.billing.profiles.get({account_id:l})),{successLabel:`Loaded`})}},l={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`from`,{type:`string`,description:`Start date for the usage query (ISO 8601).`}).option(`to`,{type:`string`,description:`End date for the usage query (ISO 8601).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={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.`,builder:u,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage paygo`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/paygo-usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t(l);s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.paygo({account_id:u,...c})),{successLabel:`Loaded`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`paygo_info`,describe:`Returns high-level usage information for the account, including coverage, and subscription metadata.`,builder:f,handler:async s=>{if(s.dryRun){i({command:`cf billing usage paygo_info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/paygo-usage-info`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t(c);s.accountId=l,r(await a(`Loading`,async()=>c.billing.usage.paygoInfo({account_id:l})),{successLabel:`Loaded`})}},m={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},h={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(l).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,T as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";function u(e){return 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)`})}const d={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:u,handler:async u=>{if(u.dryRun){s({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?a({description:l(u.description,`description`,`text`),expression:l(u.expression,`expression`,`text`),first_request_seen_at:l(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:l(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:l(u.subtype,`subtype`,`text`),type:l(u.type,`type`,`text`)}):i(u.body)});return}let d=await r(u),f=await n({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=i(u.body);o(await c(`Creating`,async()=>d.botManagement.feedback.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.description===void 0&&(u.description=await e(`description`,`The description field`)),u.expression===void 0&&(u.expression=await e(`expression`,`Wirefilter expression describing the traffic being reported.`)),u[`first-request-seen-at`]===void 0&&(u[`first-request-seen-at`]=await e(`first-request-seen-at`,`The first_request_seen_at field`)),u[`last-request-seen-at`]===void 0&&(u[`last-request-seen-at`]=await e(`last-request-seen-at`,`The last_request_seen_at field`)),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 p=a({description:l(u.description,`description`,`text`),expression:l(u.expression,`expression`,`text`),first_request_seen_at:l(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:l(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:l(u.subtype,`subtype`,`text`),type:l(u.type,`type`,`text`)});o(await c(`Creating`,async()=>d.botManagement.feedback.create({body:p,zone_id:f})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={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:f,handler:async e=>{if(e.dryRun){s({command:`cf bot-management feedback list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.botManagement.feedback.list({zone_id:i})),{successLabel:`Loaded`})}},m={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf bot-management get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.botManagement.get({zone_id:i})),{successLabel:`Loaded`})}};function _(e){return e.option(`ai-bots-protection`,{type:`string`,description:`Enable rule to block AI Scrapers and Crawlers.`,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.`}).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.
|
|
3
|
-
Enable if static resources on your application need bot protection.
|
|
4
|
-
Note: Static resource protection can also result in legitimate traffic being blocked.
|
|
5
|
-
`}).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)`})}const v={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:_,handler:async e=>{if(e.dryRun){s({command:`cf bot-management update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({ai_bots_protection:l(e[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:l(e[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:l(e[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:l(e[`crawler-protection`],`crawler-protection`,`text`),enable_js:e[`enable-js`],is_robots_txt_managed:e[`is-robots-txt-managed`],fight_mode:e[`fight-mode`],stale_zone_configuration:{optimize_wordpress:e[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:l(e[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:l(e[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:l(e[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:l(e[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:e[`stale-zone-configuration-suppress-session-score`],fight_mode:e[`stale-zone-configuration-fight-mode`]},optimize_wordpress:e[`optimize-wordpress`],sbfm_definitely_automated:l(e[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:e[`sbfm-static-resource-protection`],sbfm_verified_bots:l(e[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:l(e[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:e[`auto-update-model`],bm_cookie_enabled:e[`bm-cookie-enabled`],suppress_session_score:e[`suppress-session-score`]}):i(e.body)});return}let t=await r(e),u=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=u,e.body){let n=i(e.body);o(await c(`Updating`,async()=>t.botManagement.update({body:n,zone_id:u})),{successLabel:`Updated`});return}let d=a({ai_bots_protection:l(e[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:l(e[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:l(e[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:l(e[`crawler-protection`],`crawler-protection`,`text`),enable_js:e[`enable-js`],is_robots_txt_managed:e[`is-robots-txt-managed`],fight_mode:e[`fight-mode`],stale_zone_configuration:{optimize_wordpress:e[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:l(e[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:l(e[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:l(e[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:l(e[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:e[`stale-zone-configuration-suppress-session-score`],fight_mode:e[`stale-zone-configuration-fight-mode`]},optimize_wordpress:e[`optimize-wordpress`],sbfm_definitely_automated:l(e[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:e[`sbfm-static-resource-protection`],sbfm_verified_bots:l(e[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:l(e[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:e[`auto-update-model`],bm_cookie_enabled:e[`bm-cookie-enabled`],suppress_session_score:e[`suppress-session-score`]});o(await c(`Updating`,async()=>t.botManagement.update({body:d,zone_id:u})),{successLabel:`Updated`})}},y={command:`bot-management`,describe:`Bot detection and mitigation settings — configure bot scores, JavaScript detections, and challenge behavior`,builder:e=>e.command(g).command(v).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t,w as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-DrDErV9w.mjs";import{t as s}from"./local-CYc9q7l2.mjs";import{t as c}from"./cli-types-BeyOc81z.mjs";function l(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`day-report <asn-id>`,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:c(l),handler:async n=>{let c={date:n.date};if(n.dryRun){a({command:`cf botnet-feed asn day-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/asn/${n[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(n[`asn-id`]))}/day_report`,pathParams:{"asn-id":String(n[`asn-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t(l);n.accountId=u,i(await o(`Loading`,async()=>l.botnetFeed.asn.dayReport({account_id:u,asn_id:n[`asn-id`],...c})),{successLabel:`Loaded`})}};function d(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`full-report <asn-id>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:c(d),handler:async n=>{if(n.dryRun){a({command:`cf botnet-feed asn full-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/asn/${n[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(n[`asn-id`]))}/full_report`,pathParams:{"asn-id":String(n[`asn-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.botnetFeed.asn.fullReport({account_id:l,asn_id:n[`asn-id`]})),{successLabel:`Loaded`})}},p={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`asn-id`,{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})}const h={command:`delete <asn-id>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:c(m),handler:async c=>{if(c.dryRun){a({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/configs/asn/${c[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(c[`asn-id`]))}`,pathParams:{"asn-id":String(c[`asn-id`]??``)},bodyKind:`none`});return}let l=await r(c),u=c.local?s:await t(l);if(c.accountId=u,!await n({force:!!c.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>l.botnetFeed.configs.asn.delete({account_id:u,asn_id:c[`asn-id`]})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.`,builder:g,handler:async n=>{if(n.dryRun){a({command:`cf botnet-feed configs asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/botnet_feed/configs/asn`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t(c);n.accountId=l,i(await o(`Loading`,async()=>c.botnetFeed.configs.asn.get({account_id:l})),{successLabel:`Loaded`})}},v={command:`asn`,describe:`Botnet feed subscription configuration and notification preferences`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`configs`,describe:`Operations for configs`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`botnet-feed`,describe:`Botnet threat intelligence feeds — IP and ASN-level data on known command-and-control infrastructure`,builder:e=>e.command(p).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,S as t,g as n,w as r}from"./oauth-Bk-F-tIO.mjs";import{n as i}from"./auth-CSC4yhEJ.mjs";import{n as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-DrDErV9w.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{t as f}from"./cli-types-BeyOc81z.mjs";function p(e){return 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)`})}const m={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:p,handler:async r=>{let f={showHistoric:r[`show-historic`],download:r.download};if(r.dryRun){c({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:{},query:f,bodyKind:`json`,body:r.body===void 0?o({image_data:u(r[`image-data`],`image-data`,`text`),score_threshold:r[`score-threshold`],top_k:r[`top-k`]}):a(r.body)});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=a(r.body);new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),s(await l(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...f})),{successLabel:`Created`});return}r[`image-data`]===void 0&&(r[`image-data`]=await e(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=o({image_data:u(r[`image-data`],`image-data`,`text`),score_threshold:r[`score-threshold`],top_k:r[`top-k`]});new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),s(await l(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...f})),{successLabel:`Created`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:h,handler:async e=>{if(e.dryRun){c({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await n(r);e.accountId=a,s(await l(`Loading`,async()=>r.brandProtection.urlInfo({account_id:a})),{successLabel:`Loaded`})}};function _(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:f(_),handler:async e=>{let r={offset:e.offset,limit:e.limit,query_id:e[`query-id`],download:e.download,orderBy:e[`order-by`],order:e.order};if(e.dryRun){c({command:`cf brand-protection v2 logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.logoMatches.get({account_id:o,...r})),{successLabel:`Loaded`})}},y={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return 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)`})}const x={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:b,handler:async r=>{if(r.dryRun){c({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:r.body===void 0?o({image_data:u(r[`image-data`],`image-data`,`text`),search_lookback:r[`search-lookback`],similarity_threshold:r[`similarity-threshold`],tag:u(r.tag,`tag`,`text`)}):a(r.body)});return}let f=await i(r),p=r.local?d:await n(f);if(r.accountId=p,r.body){let e=a(r.body);s(await l(`Creating`,async()=>f.brandProtection.v2.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(r[`image-data`]===void 0&&(r[`image-data`]=await e(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),r[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);r.tag===void 0&&(r.tag=await e(`tag`,`Unique identifier for the logo query`));let m=o({image_data:u(r[`image-data`],`image-data`,`text`),search_lookback:r[`search-lookback`],similarity_threshold:r[`similarity-threshold`],tag:u(r.tag,`tag`,`text`)});s(await l(`Creating`,async()=>f.brandProtection.v2.logos.create({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`query-id`,{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})}const C={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:S,handler:async e=>{if(e.dryRun){c({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>a.brandProtection.v2.logos.delete({account_id:o,query_id:e[`query-id`]})),{successLabel:`Deleted`})}};function w(e){return 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`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={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:w,handler:async e=>{let r={id:e.id,download:e.download};if(e.dryRun){c({command:`cf brand-protection v2 logos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.logos.get({account_id:o,...r})),{successLabel:`Loaded`})}},E={command:`logos`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return 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`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={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:f(D),handler:async e=>{let r={offset:e.offset,limit:e.limit,query_id:e[`query-id`],include_domain_id:e[`include-domain-id`],include_dismissed:e[`include-dismissed`],domain_search:e[`domain-search`],orderBy:e[`order-by`],order:e.order};if(e.dryRun){c({command:`cf brand-protection v2 matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.matches.get({account_id:o,...r})),{successLabel:`Loaded`})}},k={command:`matches`,describe:`Detected brand abuse matches from monitoring queries with evidence downloads`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`id`,{type:`string`,description:`ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:A,handler:async e=>{let r={id:e.id};if(e.dryRun){c({command:`cf brand-protection v2 queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.brandProtection.v2.queries.get({account_id:o,...r})),{successLabel:`Loaded`})}},M={command:`queries`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`v2`,describe:`Operations for v2`,builder:e=>e.command(y).command(E).command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`brand-protection`,describe:`Monitor the Internet for phishing sites, lookalike domains, and unauthorized use of your brand assets`,builder:e=>e.command(m).command(g).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t,w as n}from"./oauth-Bk-F-tIO.mjs";import{i as r,n as i}from"./auth-CSC4yhEJ.mjs";import{n as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{t as u}from"./cli-types-BeyOc81z.mjs";import{n as d,t as f}from"./raw-fetch-_n0lMAnD.mjs";function p(e){return 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)`})}const m={command:`create`,describe:"Returns the page's accessibility tree. Use `interestingOnly` to only return semantically meaningful nodes; use `root` to scope the tree to a CSS-selector-anchored subtree. Control page loading with `gotoOptions` and `waitFor*` options.",builder:p,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering accessibilityTree create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/accessibilityTree`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.accessibilityTree.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/accessibilityTree`,{query:u})),{successLabel:`Created`})}},ee={command:`accessibilityTree`,describe:`Operations for accessibilityTree`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return 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)`})}const g={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:h,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering content create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/content`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.content.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/content`,{query:u})),{successLabel:`Created`})}},_={command:`content`,describe:`Operations for content`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return 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)`})}const y={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:v,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering crawl create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/crawl`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.crawl.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/crawl`,{query:u})),{successLabel:`Created`})}};function b(e){return e.positional(`job-id`,{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})}const x={command:`delete <job-id>`,describe:`Cancels an ongoing crawl job by setting its status to cancelled and stopping all queued URLs.`,builder:b,handler:async r=>{if(r.dryRun){s({command:`cf browser-rendering crawl delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/crawl/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{"job-id":String(r[`job-id`]??``)},bodyKind:`none`});return}let a=await i(r),u=r.local?l:await t(a);if(r.accountId=u,!await n({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>a.browserRendering.crawl.delete({account_id:u,job_id:r[`job-id`]})),{successLabel:`Deleted`})}};function S(e){return e.positional(`job-id`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <job-id>`,describe:`Returns the result of a crawl job.`,builder:u(S),handler:async n=>{let r={cacheTTL:n[`cache-ttl`],status:n.status,cursor:n.cursor,limit:n.limit};if(n.dryRun){s({command:`cf browser-rendering crawl get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/crawl/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.crawl.get({account_id:u,job_id:n[`job-id`],...r})),{successLabel:`Loaded`})}},w={command:`crawl`,describe:`Operations for crawl`,builder:e=>e.command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`session-id`,{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.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`connect <session-id>`,describe:`Establishes a WebSocket connection to an existing browser session.`,builder:T,handler:async n=>{let r={keep_alive:n[`keep-alive`],lab:n.lab,recording:n.recording};if(n.dryRun){s({command:`cf browser-rendering devtools browser connect`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.devtools.browser.connect({account_id:u,session_id:n[`session-id`],...r})),{successLabel:`Loaded`})}};function D(e){return e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in milliseconds.`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`targets`,{type:`boolean`,description:`Include browser targets in response.`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes). Only used when targets is true.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`create`,describe:`Acquires a browser and returns its session ID and websocket URL.`,builder:D,handler:async n=>{let r={keep_alive:n[`keep-alive`],lab:n.lab,targets:n.targets,liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`],recording:n.recording};if(n.dryRun){s({command:`cf browser-rendering devtools browser create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Creating`,async()=>a.browserRendering.devtools.browser.create({account_id:u,...r})),{successLabel:`Created`})}};function k(e){return e.positional(`session-id`,{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})}const A={command:`delete <session-id>`,describe:`Closes an existing browser session.`,builder:k,handler:async r=>{if(r.dryRun){s({command:`cf browser-rendering devtools browser delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${r[`session-id`]==null?`<session-id>`:encodeURIComponent(String(r[`session-id`]))}`,pathParams:{"session-id":String(r[`session-id`]??``)},bodyKind:`none`});return}let a=await i(r),u=r.local?l:await t(a);if(r.accountId=u,!await n({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}o(await c(`Deleting`,async()=>a.browserRendering.devtools.browser.delete({account_id:u,session_id:r[`session-id`]})),{successLabel:`Deleted`})}};function j(e){return 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.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`launch`,describe:`Acquires and establishes a WebSocket connection to a browser session.`,builder:j,handler:async n=>{let r={keep_alive:n[`keep-alive`],lab:n.lab,recording:n.recording};if(n.dryRun){s({command:`cf browser-rendering devtools browser launch`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.devtools.browser.launch({account_id:u,...r})),{successLabel:`Loaded`})}};function N(e){return e.positional(`target-id`,{type:`string`,description:`Target ID, e.g. page ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <target-id>`,describe:`Establishes a WebSocket connection to a specific Chrome DevTools target or page.`,builder:N,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser page get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/page/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.page.get({account_id:a,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}},F={command:`page`,describe:`Operations for devtools.browser.page`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`protocol <session-id>`,describe:`Returns the complete Chrome DevTools Protocol schema including all domains, commands, events, and types. This schema describes the entire CDP API surface.`,builder:I,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser protocol`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/protocol`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.protocol({account_id:a,session_id:n[`session-id`]})),{successLabel:`Loaded`})}};function R(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to activate.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`activate <target-id>`,describe:`Activates (brings to front) a specific browser target by its ID.`,builder:R,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser targets activate`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/activate/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.targets.activate({account_id:a,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function B(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to close.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`close <target-id>`,describe:`Closes a specific browser target (tab, page, etc.) by its ID. Returns 'Target is closing' on success or an error if the target is not found.`,builder:B,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser targets close`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/close/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.targets.close({account_id:a,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function H(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`url`,{type:`string`,description:`Url`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`create <session-id>`,describe:`Opens a new tab in the browser. Optionally specify a URL to navigate to.`,builder:H,handler:async n=>{let r={url:n.url,liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){s({command:`cf browser-rendering devtools browser targets create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/new`,pathParams:{"session-id":String(n[`session-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Updating`,async()=>a.browserRendering.devtools.browser.targets.create({account_id:u,session_id:n[`session-id`],...r})),{successLabel:`Updated`})}};function W(e){return e.positional(`target-id`,{type:`string`,description:`Target ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <target-id>`,describe:`Returns the debuggable target with the given ID.`,builder:W,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser targets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/list/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.targets.get({account_id:a,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function K(e){return e.option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:K,handler:async n=>{let r={liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){s({command:`cf browser-rendering devtools browser targets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/list`,pathParams:{"session-id":String(n[`session-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.devtools.browser.targets.list({account_id:u,session_id:n[`session-id`],...r})),{successLabel:`Loaded`})}},J={command:`targets`,describe:`Operations for devtools.browser.targets`,builder:e=>e.command(z).command(V).command(U).command(G).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Y(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`version <session-id>`,describe:`Get browser version metadata.`,builder:Y,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools browser version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/version`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.browser.version({account_id:a,session_id:n[`session-id`]})),{successLabel:`Loaded`})}},te={command:`browser`,describe:`Operations for devtools.browser`,builder:e=>e.command(E).command(O).command(A).command(M).command(L).command(X).command(F).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <session-id>`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:Z,handler:async n=>{let r={liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){s({command:`cf browser-rendering devtools json get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json`,pathParams:{"session-id":String(n[`session-id`]??``)},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.devtools.json.get({account_id:u,session_id:n[`session-id`],...r})),{successLabel:`Loaded`})}},ne={command:`json`,describe:`Operations for devtools.json`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`session-id`,{type:`string`,description:`Session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <session-id>`,describe:`Get details for a specific browser session.`,builder:re,handler:async n=>{if(n.dryRun){s({command:`cf browser-rendering devtools session get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/session/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let r=await i(n),a=n.local?l:await t(r);n.accountId=a,o(await c(`Loading`,async()=>r.browserRendering.devtools.session.get({account_id:a,session_id:n[`session-id`]})),{successLabel:`Loaded`})}};function ae(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`List active browser sessions.`,builder:ae,handler:async n=>{let r={limit:n.limit,offset:n.offset};if(n.dryRun){s({command:`cf browser-rendering devtools session list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/devtools/session`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(n),u=n.local?l:await t(a);n.accountId=u,o(await c(`Loading`,async()=>a.browserRendering.devtools.session.list({account_id:u,...r})),{successLabel:`Loaded`})}},se={command:`session`,describe:`Operations for devtools.session`,builder:e=>e.command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ce={command:`devtools`,describe:`Operations for devtools`,builder:e=>e.command(te).command(ne).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return 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)`})}const ue={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:le,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering json create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/json`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.json.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/json`,{query:u})),{successLabel:`Created`})}},de={command:`json`,describe:`Operations for json`,builder:e=>e.command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(e){return 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)`})}const pe={command:`create`,describe:`Get links from a web page.`,builder:fe,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering links create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/links`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.links.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/links`,{query:u})),{successLabel:`Created`})}},me={command:`links`,describe:`Operations for links`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return 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)`})}const ge={command:`create`,describe:"Gets markdown of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options.",builder:he,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering markdown create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/markdown`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.markdown.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/markdown`,{query:u})),{successLabel:`Created`})}},_e={command:`markdown`,describe:`Operations for markdown`,builder:e=>e.command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return 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})}const ye={command:`create`,describe:"Fetches rendered PDF from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:ve,handler:async n=>{let r={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering pdf create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/pdf`,pathParams:{},query:r,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let o=await i(n),u=n.local?l:await t(o);if(n.accountId=u,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i=await c(`Creating`,async()=>f(`/accounts/${u}/browser-rendering/pdf${t?`?`+t:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:JSON.stringify(e),contentType:`application/json`}));d(n.text===!0?i.toString(`utf-8`):i);return}let p=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),m=await c(`Creating`,async()=>f(`/accounts/${u}/browser-rendering/pdf${p?`?`+p:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0}));d(n.text===!0?m.toString(`utf-8`):m)}},be={command:`pdf`,describe:`Operations for pdf`,builder:e=>e.command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return 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)`})}const xe={command:`create`,describe:`Get meta attributes like height, width, text and others of selected elements.`,builder:$,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering scrape create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/scrape`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.scrape.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/scrape`,{query:u})),{successLabel:`Created`})}},Se={command:`scrape`,describe:`Operations for scrape`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return 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})}const we={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:Ce,handler:async n=>{let r={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering screenshot create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/screenshot`,pathParams:{},query:r,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let o=await i(n),u=n.local?l:await t(o);if(n.accountId=u,n.body){let e=a(n.body),t=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i=await c(`Creating`,async()=>f(`/accounts/${u}/browser-rendering/screenshot${t?`?`+t:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:JSON.stringify(e),contentType:`application/json`}));d(n.text===!0?i.toString(`utf-8`):i);return}let p=new URLSearchParams(Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),m=await c(`Creating`,async()=>f(`/accounts/${u}/browser-rendering/screenshot${p?`?`+p:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0}));d(n.text===!0?m.toString(`utf-8`):m)}},Te={command:`screenshot`,describe:`Operations for screenshot`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return 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)`})}const De={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:Ee,handler:async n=>{let u={cacheTTL:n[`cache-ttl`]};if(n.dryRun){s({command:`cf browser-rendering snapshot create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/browser-rendering/snapshot`,pathParams:{},query:u,bodyKind:`json`,body:n.body===void 0?void 0:a(n.body)});return}let d=await i(n),f=n.local?l:await t(d);if(n.accountId=f,n.body){let e=a(n.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),o(await c(`Creating`,async()=>d.browserRendering.snapshot.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/browser-rendering/snapshot`,{query:u})),{successLabel:`Created`})}},Oe={command:`snapshot`,describe:`Operations for snapshot`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ke={command:`browser-rendering`,describe:`browser-rendering`,builder:e=>e.command(ee).command(_).command(w).command(ce).command(de).command(me).command(_e).command(be).command(Se).command(Te).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ke as default};
|
package/dist/cache-CY-7Lt71.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{T as e,w as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{i as r,n as i}from"./auth-CSC4yhEJ.mjs";import{n as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-DrDErV9w.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={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:d,handler:async e=>{if(e.dryRun){c({command:`cf cache cache-reserve clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Creating`,async()=>t.cache.cacheReserve.clear({zone_id:r})),{successLabel:`Created`})}};function p(e){return e.option(`value`,{type:`string`,description:`Value of the Cache Reserve zone setting.`,choices:[`on`,`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)`})}const m={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:p,handler:async t=>{if(t.dryRun){c({command:`cf cache cache-reserve edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({value:u(t.value,`value`,`text`)}):a(t.body)});return}let r=await i(t),d=await n({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.cache.cacheReserve.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await e(`value`,`Value of the Cache Reserve zone setting.`,[`on`,`off`]));let f=o({value:u(t.value,`value`,`text`)});s(await l(`Updating`,async()=>r.cache.cacheReserve.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={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:h,handler:async e=>{if(e.dryRun){c({command:`cf cache cache-reserve get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.cache.cacheReserve.get({zone_id:r})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={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:_,handler:async e=>{if(e.dryRun){c({command:`cf cache cache-reserve status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.cache.cacheReserve.status({zone_id:r})),{successLabel:`Loaded`})}},y={command:`cache-reserve`,describe:`Persistent storage tier that keeps cached assets even after eviction from edge caches`,builder:e=>e.command(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={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:b,handler:async e=>{if(e.dryRun){c({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/purge_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let o=await i(e),u=await n({zone:e.zone},o,{quiet:e.quiet});if(e.zoneId=u,!await t({force:!!e.force,message:`This operation destroys cached content for a zone.`})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let t=a(e.body);s(await l(`Deleting`,async()=>o.cache.purge({body:t,zone_id:u})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>r(o,`POST`,`/zones/${e.zoneId}/purge_cache`)),{successLabel:`Deleted`})}};function S(e){return e.option(`value`,{type:`string`,description:`Value of the Regional Tiered Cache zone setting.`,choices:[`on`,`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)`})}const C={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:S,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.zone??t.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({value:u(t.value,`value`,`text`)}):a(t.body)});return}let r=await i(t),d=await n({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.cache.regionalTieredCache.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await e(`value`,`Value of the Regional Tiered Cache zone setting.`,[`on`,`off`]));let f=o({value:u(t.value,`value`,`text`)});s(await l(`Updating`,async()=>r.cache.regionalTieredCache.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={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:w,handler:async e=>{if(e.dryRun){c({command:`cf cache regional-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.cache.regionalTieredCache.get({zone_id:r})),{successLabel:`Loaded`})}},E={command:`regional-tiered-cache`,describe:`Restrict tiered cache topology to data centers within a specific geographic region`,builder:e=>e.command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const O={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:D,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.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}s(await l(`Deleting`,async()=>r.cache.smartTieredCache.delete({zone_id:a})),{successLabel:`Deleted`})}};function k(e){return 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.`})}const A={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:k,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.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({value:u(t.value,`value`,`text`)}):a(t.body)});return}let r=await i(t),d=await n({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=a(t.body);s(await l(`Updating`,async()=>r.cache.smartTieredCache.edit({body:e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await e(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let f=o({value:u(t.value,`value`,`text`)});s(await l(`Updating`,async()=>r.cache.smartTieredCache.edit({body:f,zone_id:d})),{successLabel:`Updated`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={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:j,handler:async e=>{if(e.dryRun){c({command:`cf cache smart-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.cache.smartTieredCache.get({zone_id:r})),{successLabel:`Loaded`})}},N={command:`smart-tiered-cache`,describe:`Automatically determine the best upper-tier data centers for tiered cache topology`,builder:e=>e.command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const F={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:P,handler:async e=>{if(e.dryRun){c({command:`cf cache variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}s(await l(`Deleting`,async()=>r.cache.variants.delete({zone_id:a})),{successLabel:`Deleted`})}};function I(e){return 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)`})}const L={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:I,handler:async e=>{if(e.dryRun){c({command:`cf cache variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({value:{avif:e[`value-avif`],bmp:e[`value-bmp`],gif:e[`value-gif`],jp2:e[`value-jp2`],jpeg:e[`value-jpeg`],jpg:e[`value-jpg`],jpg2:e[`value-jpg2`],png:e[`value-png`],tif:e[`value-tif`],tiff:e[`value-tiff`],webp:e[`value-webp`]}}):a(e.body)});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.cache.variants.edit({...n,zone_id:r})),{successLabel:`Updated`});return}let u=o({value:{avif:e[`value-avif`],bmp:e[`value-bmp`],gif:e[`value-gif`],jp2:e[`value-jp2`],jpeg:e[`value-jpeg`],jpg:e[`value-jpg`],jpg2:e[`value-jpg2`],png:e[`value-png`],tif:e[`value-tif`],tiff:e[`value-tiff`],webp:e[`value-webp`]}});s(await l(`Updating`,async()=>t.cache.variants.edit({...u,zone_id:r})),{successLabel:`Updated`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={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:R,handler:async e=>{if(e.dryRun){c({command:`cf cache variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,s(await l(`Loading`,async()=>t.cache.variants.get({zone_id:r})),{successLabel:`Loaded`})}},B={command:`variants`,describe:`Serve different cached versions of an image based on the Accept header (WebP, AVIF, etc.)`,builder:e=>e.command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`cache`,describe:`Purge cached content and configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(x).command(y).command(E).command(N).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{V as default};
|
package/dist/calls-wOQGDWPl.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,g as t,w as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";import{t as u}from"./local-CYc9q7l2.mjs";function d(e){return 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)`})}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:d,handler:async n=>{if(n.dryRun){s({command:`cf calls sfu create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({name:l(n.name,`name`,`text`)}):i(n.body)});return}let d=await r(n),f=n.local?u:await t(d);if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Creating`,async()=>d.calls.sfu.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=a({name:l(n.name,`name`,`text`)});o(await c(`Creating`,async()=>d.calls.sfu.create({body:p,account_id:f})),{successLabel:`Created`})}};function p(e){return e.positional(`app-id`,{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})}const m={command:`delete <app-id>`,describe:`Deletes an app from Cloudflare Calls`,builder:p,handler:async i=>{if(i.dryRun){s({command:`cf calls sfu delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/apps/${i[`app-id`]==null?`<app-id>`:encodeURIComponent(String(i[`app-id`]))}`,pathParams:{"app-id":String(i[`app-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await t(a);if(i.accountId=l,!await n({force:!!i.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>a.calls.sfu.delete({account_id:l,app_id:i[`app-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`app-id`,{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})}const g={command:`get <app-id>`,describe:`Fetches details for a single Calls app.`,builder:h,handler:async n=>{if(n.dryRun){s({command:`cf calls sfu get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/apps/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}`,pathParams:{"app-id":String(n[`app-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?u:await t(i);n.accountId=a,o(await c(`Loading`,async()=>i.calls.sfu.get({account_id:a,app_id:n[`app-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Lists all apps in the Cloudflare account`,builder:_,handler:async n=>{if(n.dryRun){s({command:`cf calls sfu list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?u:await t(i);n.accountId=a,o(await c(`Loading`,async()=>i.calls.sfu.list({account_id:a})),{successLabel:`Loaded`})}};function y(e){return e.positional(`app-id`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`update <app-id>`,describe:`Edit details for a single app.`,builder:y,handler:async n=>{if(n.dryRun){s({command:`cf calls sfu update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/apps/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}`,pathParams:{"app-id":String(n[`app-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({name:l(n.name,`name`,`text`)}):i(n.body)});return}let d=await r(n),f=n.local?u:await t(d);if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>d.calls.sfu.update({body:e,account_id:f,app_id:n[`app-id`]})),{successLabel:`Updated`});return}let p=a({name:l(n.name,`name`,`text`)});o(await c(`Updating`,async()=>d.calls.sfu.update({body:p,account_id:f,app_id:n[`app-id`]})),{successLabel:`Updated`})}},x={command:`sfu`,describe:`Operations for sfu`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return 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)`})}const C={command:`create`,describe:`Creates a new Cloudflare Calls TURN key.`,builder:S,handler:async n=>{if(n.dryRun){s({command:`cf calls turn create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({name:l(n.name,`name`,`text`)}):i(n.body)});return}let d=await r(n),f=n.local?u:await t(d);if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Creating`,async()=>d.calls.turn.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=a({name:l(n.name,`name`,`text`)});o(await c(`Creating`,async()=>d.calls.turn.create({body:p,account_id:f})),{successLabel:`Created`})}};function w(e){return e.positional(`key-id`,{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})}const T={command:`delete <key-id>`,describe:`Deletes a TURN key from Cloudflare Calls`,builder:w,handler:async i=>{if(i.dryRun){s({command:`cf calls turn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/turn_keys/${i[`key-id`]==null?`<key-id>`:encodeURIComponent(String(i[`key-id`]))}`,pathParams:{"key-id":String(i[`key-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await t(a);if(i.accountId=l,!await n({force:!!i.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}o(await c(`Deleting`,async()=>a.calls.turn.delete({account_id:l,key_id:i[`key-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-id`,{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})}const D={command:`get <key-id>`,describe:`Fetches details for a single TURN key.`,builder:E,handler:async n=>{if(n.dryRun){s({command:`cf calls turn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/turn_keys/${n[`key-id`]==null?`<key-id>`:encodeURIComponent(String(n[`key-id`]))}`,pathParams:{"key-id":String(n[`key-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?u:await t(i);n.accountId=a,o(await c(`Loading`,async()=>i.calls.turn.get({account_id:a,key_id:n[`key-id`]})),{successLabel:`Loaded`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all TURN keys in the Cloudflare account`,builder:O,handler:async n=>{if(n.dryRun){s({command:`cf calls turn list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?u:await t(i);n.accountId=a,o(await c(`Loading`,async()=>i.calls.turn.list({account_id:a})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-id`,{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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`update <key-id>`,describe:`Edit details for a single TURN key.`,builder:A,handler:async n=>{if(n.dryRun){s({command:`cf calls turn update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/calls/turn_keys/${n[`key-id`]==null?`<key-id>`:encodeURIComponent(String(n[`key-id`]))}`,pathParams:{"key-id":String(n[`key-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({name:l(n.name,`name`,`text`)}):i(n.body)});return}let d=await r(n),f=n.local?u:await t(d);if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>d.calls.turn.update({body:e,account_id:f,key_id:n[`key-id`]})),{successLabel:`Updated`});return}let p=a({name:l(n.name,`name`,`text`)});o(await c(`Updating`,async()=>d.calls.turn.update({body:p,account_id:f,key_id:n[`key-id`]})),{successLabel:`Updated`})}},M={command:`turn`,describe:`Operations for turn`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`calls`,describe:`calls`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{E as e,w as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";import{t as u}from"./cli-types-BeyOc81z.mjs";function d(e){return 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)`})}const f={command:`create`,describe:`Create a new API Shield mTLS Client Certificate.`,builder:d,handler:async t=>{if(t.dryRun){s({command:`cf client-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({csr:l(t.csr,`csr`,`text`),validity_days:t[`validity-days`]}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>u.clientCertificates.create({...e,zone_id:d})),{successLabel:`Created`});return}if(t.csr===void 0&&(t.csr=await e(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),t[`validity-days`]===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let f=a({csr:l(t.csr,`csr`,`text`),validity_days:t[`validity-days`]});o(await c(`Creating`,async()=>u.clientCertificates.create({...f,zone_id:d})),{successLabel:`Created`})}};function p(e){return e.positional(`client-certificate-id`,{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})}const m={command:`delete <client-certificate-id>`,describe:`Set a API Shield mTLS Client Certificate to pending_revocation status for processing to revoked status.`,builder:p,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>i.clientCertificates.delete({zone_id:a,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`client-certificate-id`,{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)`})}const g={command:`edit <client-certificate-id>`,describe:`If a API Shield mTLS Client Certificate is in a pending_revocation state, you may reactivate it with this endpoint.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({reactivate:e.reactivate}):i(e.body)});return}let t=await r(e),l=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=l,e.body){let n=i(e.body);o(await c(`Updating`,async()=>t.clientCertificates.edit({...n,zone_id:l,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Updated`});return}let u=a({reactivate:e.reactivate});o(await c(`Updating`,async()=>t.clientCertificates.edit({...u,zone_id:l,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Updated`})}};function _(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <client-certificate-id>`,describe:`Get Details for a single mTLS API Shield Client Certificate.`,builder:_,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.clientCertificates.get({zone_id:i,client_certificate_id:e[`client-certificate-id`]})),{successLabel:`Loaded`})}};function y(e){return 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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`List all of your Zone's API Shield mTLS Client Certificates by Status and/or using Pagination.`,builder:u(y),handler:async e=>{let t={status:e.status,page:e.page,per_page:e[`per-page`],limit:e.limit,offset:e.offset};if(e.dryRun){s({command:`cf client-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.clientCertificates.list({zone_id:a,...t})),{successLabel:`Loaded`})}},x={command:`client-certificates`,describe:`Issue and manage client certificates for mutual TLS (mTLS) authentication on your zone`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{x as default};
|