cf 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +76 -70
- package/dist/_meta/commands.json +47761 -55490
- package/dist/_meta/schemas.json +31106 -34818
- package/dist/abuse-reports-Dy76QPNP.mjs +8 -0
- package/dist/accounts-CjtZ8x1z.mjs +22 -0
- package/dist/acm-C2lYIWs1.mjs +3 -0
- package/dist/addressing-CHFK6uxW.mjs +12 -0
- package/dist/{agent-context-D26woB9J.mjs → agent-context-CgGCT0xU.mjs} +1 -1
- package/dist/ai-DS3i-I1a.mjs +2 -0
- package/dist/ai-gateway-RIsegO2x.mjs +8 -0
- package/dist/ai-search-Dcj4BauG.mjs +7 -0
- package/dist/ai_gateway-w7YwfcPE.mjs +4 -0
- package/dist/alerting-Bk85NNf5.mjs +6 -0
- package/dist/analytics-CkhhhZWZ.mjs +20 -0
- package/dist/analytics_engine-B7qgDJCA.mjs +2 -0
- package/dist/api-gateway-CWdR4Ne7.mjs +33 -0
- package/dist/argo-DnJRVnGX.mjs +2 -0
- package/dist/artifacts-BVWKiJUl.mjs +4 -0
- package/dist/audit-logs-DjTstbzL.mjs +2 -0
- package/dist/auth-BqDOIrKX.mjs +150 -0
- package/dist/auth-DKkSwnxh.mjs +5 -0
- package/dist/billing-3rEqF83h.mjs +2 -0
- package/dist/body-parser-CBpeIUns.mjs +2 -0
- package/dist/bot-management-CJxD1pqi.mjs +5 -0
- package/dist/botnet-feed-MG91D7BR.mjs +3 -0
- package/dist/brand-protection-CK7gJi06.mjs +3 -0
- package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
- package/dist/{build-5jmmOZhm.mjs → build-BE4o4imx.mjs} +131 -131
- package/dist/cache-B7pRbpTy.mjs +5 -0
- package/dist/calls-DXRWsZ8n.mjs +4 -0
- package/dist/certificate-authorities-BR3gXBLs.mjs +2 -0
- package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
- package/dist/cli-types-CMNMD1V7.mjs +2 -0
- package/dist/client-certificates-B0ebLJdk.mjs +3 -0
- package/dist/cloud-connector-BOjaggJk.mjs +2 -0
- package/dist/cloudforce-one-B6HYfk5Z.mjs +21 -0
- package/dist/{completions-BKrxcfhN.mjs → completions-D_9WsLG7.mjs} +1 -1
- package/dist/config-7CBz8Xm0.mjs +2 -0
- package/dist/connectivity-welFvZ7X.mjs +3 -0
- package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
- package/dist/connectors-3vjrdFLB.mjs +3 -0
- package/dist/content-scanning-CnW2A0pv.mjs +4 -0
- package/dist/context-CONbNKO-.mjs +2 -0
- package/dist/custom-certificates-CnYh6Yi-.mjs +5 -0
- package/dist/custom-hostnames-C2upqZso.mjs +5 -0
- package/dist/custom-nameservers-BGkAD_PZ.mjs +3 -0
- package/dist/custom-pages-5fCSP8in.mjs +4 -0
- package/dist/d1-CyiRbZZn.mjs +4 -0
- package/dist/data-security-Casx4OS_.mjs +6 -0
- package/dist/dcv-delegation-DVYO10oA.mjs +2 -0
- package/dist/{deploy-DbkiIzUr.mjs → deploy-KBRFIatG.mjs} +1 -1
- package/dist/{dev-C6iSuQZm.mjs → dev-pPazzZvt.mjs} +1 -1
- package/dist/diagnostics-BqYDoDfw.mjs +3 -0
- package/dist/dispatch-namespaces-Cz2rajnP.mjs +7 -0
- package/dist/{dist-CnSubA1Z.mjs → dist-DA54ZQu0.mjs} +1 -1
- package/dist/dist-DpDjsWWn.mjs +306 -0
- package/dist/dns-62t95Xif.mjs +29 -0
- package/dist/dns-firewall-Coy8d47t.mjs +57 -0
- package/dist/durable-objects-BSuRERkw.mjs +2 -0
- package/dist/email-routing-BDUYYeV3.mjs +10 -0
- package/dist/email-security-ChHA6eqQ.mjs +8 -0
- package/dist/email-sending-CVrRqn6S.mjs +3 -0
- package/dist/filters-qJpU9uAS.mjs +4 -0
- package/dist/firewall-C3DDwfwh.mjs +11 -0
- package/dist/fraud-DY3YXFVf.mjs +20 -0
- package/dist/google-tag-gateway-B00MHDfB.mjs +2 -0
- package/dist/healthchecks-Drvb79v0.mjs +4 -0
- package/dist/hostnames-BdAQo1Mr.mjs +3 -0
- package/dist/hyperdrive-99OJV9nl.mjs +18 -0
- package/dist/iam-BRbpg3lN.mjs +6 -0
- package/dist/images-D1jI3r3O.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-C3ajLpXd.mjs +3 -0
- package/dist/{ips-B8fwxKZD.mjs → ips-B6JETVOY.mjs} +1 -1
- package/dist/keyless-certificates-C4MZ4xnf.mjs +3 -0
- package/dist/kv-CSWoD9ks.mjs +5 -0
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +3 -0
- package/dist/load-balancers-Du1tNuUt.mjs +6 -0
- package/dist/logpush-SuJyO-uX.mjs +4 -0
- package/dist/logs-DcDNRPRl.mjs +3 -0
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +5 -0
- package/dist/magic-network-monitoring-CqtvOePQ.mjs +4 -0
- package/dist/magic-transit-BTbkhBtF.mjs +89 -0
- package/dist/managed-transforms-CfUBSz9p.mjs +3 -0
- package/dist/mtls-certificates-Cf1O8c2E.mjs +3 -0
- package/dist/network-interconnects-DsiNytOU.mjs +36 -0
- package/dist/observability-CLqZ7OSi.mjs +4 -0
- package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
- package/dist/organizations-aRi1bhFC.mjs +41 -0
- package/dist/origin-ca-certificates-BB4H89a_.mjs +3 -0
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +2 -0
- package/dist/origin-tls-client-auth-CnQNy9-l.mjs +4 -0
- package/dist/output-CUxZRM5A.mjs +2 -0
- package/dist/page-rules-CYqtPU1p.mjs +18 -0
- package/dist/page-shield-D8l9ZMUl.mjs +37 -0
- package/dist/pages-ChurJ2H7.mjs +11 -0
- package/dist/pipelines-CeyujvRf.mjs +6 -0
- package/dist/{progress-CjcQ6ato.mjs → progress-Cent9Lsg.mjs} +1 -1
- package/dist/queues-Rf_n11Cx.mjs +6 -0
- package/dist/r2-BtuTO3vQ.mjs +21 -0
- package/dist/r2-data-catalog-Debz38kv.mjs +14 -0
- package/dist/radar-CzGM92uM.mjs +2 -0
- package/dist/rate-limits-Bbk7HxP7.mjs +5 -0
- package/dist/raw-fetch-DnbAMFBp.mjs +2 -0
- package/dist/realtime-kit-CivLpkpg.mjs +18 -0
- package/dist/registrar-8IeA5DKd.mjs +46 -0
- package/dist/request-tracers-D1aH4NmL.mjs +2 -0
- package/dist/{resolve-BuJRWSk0.mjs → resolve-D1mG0REg.mjs} +1 -1
- package/dist/resource-sharing-B-Pcto7-.mjs +5 -0
- package/dist/resource-tagging-Bpb6Qq1M.mjs +16 -0
- package/dist/rules-B10XWY10.mjs +4 -0
- package/dist/rulesets-lYczEcJp.mjs +8 -0
- package/dist/rum-B5GUKa4I.mjs +4 -0
- package/dist/{schema-CHBfkARI.mjs → schema-hefO-tzo.mjs} +1 -1
- package/dist/schema-validation-DTq517Em.mjs +24 -0
- package/dist/scim-BiLfOQ89.mjs +3 -0
- package/dist/secrets-store-CBX0dvHL.mjs +25 -0
- package/dist/security-center-AVpTOBK3.mjs +2 -0
- package/dist/security-txt-DVlh8y9l.mjs +3 -0
- package/dist/session-CsvPYFj8.mjs +5 -0
- package/dist/shared-0bwWVDLo.mjs +2 -0
- package/dist/smart-shield-DblHIce0.mjs +3 -0
- package/dist/snippets-DrpqSXYC.mjs +4 -0
- package/dist/{spawn-13QQ0IwO.mjs → spawn-DK7pott_.mjs} +1 -1
- package/dist/spectrum-CnrG0jIC.mjs +63 -0
- package/dist/speed-BzRY3Xlh.mjs +4 -0
- package/dist/{src-B9cKsgsg.mjs → src-D9_Gq68b.mjs} +12 -12
- package/dist/ssl-Cp6tQkZH.mjs +15 -0
- package/dist/stream-CGTRN4ZN.mjs +14 -0
- package/dist/tenants-o_M62Y1n.mjs +2 -0
- package/dist/token-validation-Ca5AGEns.mjs +10 -0
- package/dist/{tools-B7QiNu-d.mjs → tools-DtNNmO6l.mjs} +1 -1
- package/dist/turnstile-l7mo9BWL.mjs +23 -0
- package/dist/{ui-BXjU1dX1.mjs → ui-B97lRnOv.mjs} +1 -1
- package/dist/url-normalization-D1CogSIG.mjs +3 -0
- package/dist/url-scanner-BnJHJqcz.mjs +2 -0
- package/dist/user-CiyYZ69X.mjs +10 -0
- package/dist/vectorize-D3LgMLOn.mjs +4 -0
- package/dist/{versions-DzyrlUAi.mjs → versions-B6E8WQyA.mjs} +1 -1
- package/dist/waiting-rooms-Bhy_nuV3.mjs +11 -0
- package/dist/web3-DlHE0CZc.mjs +4 -0
- package/dist/workers-DRAkU6YR.mjs +18 -0
- package/dist/workers-builds-BmNjiHDZ.mjs +7 -0
- package/dist/workflows-z6oapEJs.mjs +4 -0
- package/dist/zaraz-CyzfYOEU.mjs +2 -0
- package/dist/zero-trust-fyyIelWx.mjs +118 -0
- package/dist/zero_trust-BAhlNkjo.mjs +3 -0
- package/dist/zones-MSULnDwW.mjs +21 -0
- package/package.json +7 -6
- package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
- package/dist/accounts-BopMfODC.mjs +0 -21
- package/dist/acm-BT4vlnEJ.mjs +0 -3
- package/dist/addressing-B3uFxHst.mjs +0 -13
- package/dist/ai-DWHqwMap.mjs +0 -2
- package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
- package/dist/ai-search-VnOQ5n--.mjs +0 -7
- package/dist/alerting-BmmgIlIO.mjs +0 -6
- package/dist/analytics-isY03taL.mjs +0 -20
- package/dist/api-gateway-DXurEbA-.mjs +0 -33
- package/dist/argo-B02BL_hp.mjs +0 -2
- package/dist/audit-logs-DcgR9xUc.mjs +0 -2
- package/dist/auth-CQcAgnOy.mjs +0 -135
- package/dist/auth-DenWm_X0.mjs +0 -6
- package/dist/autorag-CmrwnGVj.mjs +0 -2
- package/dist/billing-CaW1ZAB1.mjs +0 -2
- package/dist/body-parser-Br-BoYk-.mjs +0 -2
- package/dist/bot-management-CeBsFx68.mjs +0 -5
- package/dist/botnet-feed-B396vQeQ.mjs +0 -3
- package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
- package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
- package/dist/builds-C_ySULja.mjs +0 -2
- package/dist/cache-DmXizSMi.mjs +0 -5
- package/dist/calls-x4KQpTB4.mjs +0 -4
- package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
- package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
- package/dist/cloud-connector-BClQpEzI.mjs +0 -2
- package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
- package/dist/config-DYzlVxcB.mjs +0 -2
- package/dist/connectivity-G0NP6LtW.mjs +0 -3
- package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
- package/dist/context-CC0Rhkhy.mjs +0 -2
- package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
- package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
- package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
- package/dist/custom-pages-D-oErw57.mjs +0 -4
- package/dist/d1-C95ckPKI.mjs +0 -3
- package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
- package/dist/diagnostics-DEEhPnXj.mjs +0 -3
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
- package/dist/dist-DNBSHor6.mjs +0 -301
- package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
- package/dist/dns-qW-3TZOT.mjs +0 -29
- package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
- package/dist/email-routing-tdNJaCpJ.mjs +0 -10
- package/dist/email-security-DTVHNr2h.mjs +0 -60
- package/dist/email-sending-DsFTvE31.mjs +0 -3
- package/dist/filters-DO1Is_tI.mjs +0 -4
- package/dist/firewall-DbUhVTCg.mjs +0 -11
- package/dist/fraud-Bzr4njYb.mjs +0 -8
- package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
- package/dist/healthchecks-BBAs-lS_.mjs +0 -4
- package/dist/hostnames-Dz9PEUKS.mjs +0 -3
- package/dist/hyperdrive-B1iUJddG.mjs +0 -18
- package/dist/iam-CJM8gHpG.mjs +0 -6
- package/dist/images-DEoBmtFS.mjs +0 -5
- package/dist/intel-BM6xkZ0C.mjs +0 -3
- package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
- package/dist/kv-BTceLtWZ.mjs +0 -5
- package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
- package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
- package/dist/logpush-CSYhgevA.mjs +0 -4
- package/dist/logs-DlIwmMpt.mjs +0 -3
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
- package/dist/magic-transit-qQmA-981.mjs +0 -89
- package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
- package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
- package/dist/network-interconnects-CxG2deY0.mjs +0 -36
- package/dist/organizations-DyEAiGiR.mjs +0 -41
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
- package/dist/output-D7_yAFVR.mjs +0 -2
- package/dist/page-rules-DP-w6TAm.mjs +0 -18
- package/dist/page-shield-Bf7kFp8c.mjs +0 -37
- package/dist/pages-D0Y_XRqW.mjs +0 -10
- package/dist/pipelines-C-SPESAk.mjs +0 -6
- package/dist/queues-wv6CZsi8.mjs +0 -6
- package/dist/r2-DuXjp9n5.mjs +0 -21
- package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
- package/dist/radar-BW_ZHP8X.mjs +0 -2
- package/dist/rate-limits-DLTkIvwr.mjs +0 -5
- package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
- package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
- package/dist/registrar-DIIv6fWd.mjs +0 -46
- package/dist/request-tracers-DMej0Drs.mjs +0 -2
- package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
- package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
- package/dist/rules-DLJpOYbC.mjs +0 -4
- package/dist/rulesets-D9nqEJT5.mjs +0 -8
- package/dist/rum-DBVmdPkp.mjs +0 -4
- package/dist/schema-validation-MCd3xdtX.mjs +0 -4
- package/dist/scim-DZA3VXog.mjs +0 -3
- package/dist/scm-CilfPOue.mjs +0 -2
- package/dist/secrets-store-BrvcZSOM.mjs +0 -21
- package/dist/security-center-BU6f3Cm1.mjs +0 -2
- package/dist/security-txt-BPIbP3dG.mjs +0 -3
- package/dist/session-H7IV2BrM.mjs +0 -2
- package/dist/shared-DEzmTsEC.mjs +0 -2
- package/dist/smart-shield-e8XFBkiF.mjs +0 -3
- package/dist/snippets-B4M3MMb8.mjs +0 -4
- package/dist/spectrum-B0adfSRI.mjs +0 -59
- package/dist/speed-BVcUtkAz.mjs +0 -4
- package/dist/ssl-BAa91gsc.mjs +0 -15
- package/dist/stream-D53sxKb3.mjs +0 -14
- package/dist/tenants-bH5pt3dJ.mjs +0 -2
- package/dist/token-validation-M61Vx_Tw.mjs +0 -4
- package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
- package/dist/url-normalization-DZrWDgB5.mjs +0 -3
- package/dist/url-scanner-Zo49edNp.mjs +0 -2
- package/dist/user-DbXlVReB.mjs +0 -10
- package/dist/vectorize-CUnTM0DT.mjs +0 -4
- package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
- package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
- package/dist/web3-DueyOQtx.mjs +0 -4
- package/dist/workers-builds-BM_aoeUR.mjs +0 -7
- package/dist/workers-nV_vBCfV.mjs +0 -16
- package/dist/workflows-CQITmo-s.mjs +0 -4
- package/dist/zaraz-DIbpF5Op.mjs +0 -2
- package/dist/zero-trust-CKp8j512.mjs +0 -119
- package/dist/zones-BZ5tZDbH.mjs +0 -28
- /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
- /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
- /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
- /package/dist/{metadata-DGdCpUxn.mjs → metadata-jh2EIan8.mjs} +0 -0
- /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{S as e,n as t}from"./auth-BqDOIrKX.mjs";import{t as n}from"./output-CUxZRM5A.mjs";import{n as r,t as i}from"./progress-Cent9Lsg.mjs";import{t as a}from"./cli-types-CMNMD1V7.mjs";function o(e){return e.positional(`zone-identifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`until`,{type:`string`,description:`The (exclusive) end of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. If omitted, the time of the request is used.`}).option(`since`,{type:`string`,description:`The (inclusive) beginning of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. At this point in time, it cannot exceed a time in the past greater than one year.
|
|
3
|
+
|
|
4
|
+
Ranges that the Cloudflare web application provides will provide the following period length for each point:
|
|
5
|
+
- Last 60 minutes (from -59 to -1): 1 minute resolution
|
|
6
|
+
- Last 7 hours (from -419 to -60): 15 minutes resolution
|
|
7
|
+
- Last 15 hours (from -899 to -420): 30 minutes resolution
|
|
8
|
+
- Last 72 hours (from -4320 to -900): 1 hour resolution
|
|
9
|
+
- Older than 3 days (-525600 to -4320): 1 day resolution.`}).option(`continuous`,{type:`boolean`,description:`When set to true, the API will move the requested time window backward, until it finds a region with completely aggregated data.
|
|
10
|
+
|
|
11
|
+
The API response _may not represent the requested time window_.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const s={command:`get <zone-identifier>`,describe:`This view provides a breakdown of analytics data by datacenter. Note: This is available to Enterprise customers only.`,builder:a(o),handler:async a=>{let o={until:a.until,since:a.since,continuous:a.continuous};if(a.dryRun){r({command:`cf analytics colo get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/analytics/colos`,pathParams:{"zone-identifier":String(a.zone??a[`zone-identifier`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.analytics.colo.get({zone_identifier:c,...o})),{successLabel:`Loaded`})}},c={command:`colo`,describe:`Per-data-center (colo) traffic analytics breakdown for the zone`,builder:e=>e.command(s).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function l(e){return e.positional(`zone-identifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`until`,{type:`string`,description:`The (exclusive) end of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. If omitted, the time of the request is used.`}).option(`since`,{type:`string`,description:`The (inclusive) beginning of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. At this point in time, it cannot exceed a time in the past greater than one year.
|
|
12
|
+
|
|
13
|
+
Ranges that the Cloudflare web application provides will provide the following period length for each point:
|
|
14
|
+
- Last 60 minutes (from -59 to -1): 1 minute resolution
|
|
15
|
+
- Last 7 hours (from -419 to -60): 15 minutes resolution
|
|
16
|
+
- Last 15 hours (from -899 to -420): 30 minutes resolution
|
|
17
|
+
- Last 72 hours (from -4320 to -900): 1 hour resolution
|
|
18
|
+
- Older than 3 days (-525600 to -4320): 1 day resolution.`}).option(`continuous`,{type:`boolean`,description:`When set to true, the API will move the requested time window backward, until it finds a region with completely aggregated data.
|
|
19
|
+
|
|
20
|
+
The API response _may not represent the requested time window_.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <zone-identifier>`,describe:`The dashboard view provides both totals and timeseries data for the given zone and time period across the entire Cloudflare network.`,builder:a(l),handler:async a=>{let o={until:a.until,since:a.since,continuous:a.continuous};if(a.dryRun){r({command:`cf analytics dashboard get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/analytics/dashboard`,pathParams:{"zone-identifier":String(a.zone??a[`zone-identifier`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.analytics.dashboard.get({zone_identifier:c,...o})),{successLabel:`Loaded`})}},d={command:`dashboard`,describe:`Aggregated zone dashboard analytics — requests, bandwidth, threats, and page views`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.analytics.latency.colos.get({zone_id:s})),{successLabel:`Loaded`})}},m={command:`colos`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`bins`,{type:`string`,description:`Bins`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`,builder:h,handler:async a=>{let o={bins:a.bins};if(a.dryRun){r({command:`cf analytics latency get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/analytics/latency`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.analytics.latency.get({zone_id:c,...o})),{successLabel:`Loaded`})}},_={command:`latency`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(g).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(c).command(d).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,_ as t,i as n,n as r}from"./auth-BqDOIrKX.mjs";import{t as i}from"./output-CUxZRM5A.mjs";import{n as a,t as o}from"./progress-Cent9Lsg.mjs";import{n as s,t as c}from"./input-validation-CTqtyiY9.mjs";import{t as l}from"./local-D8bhHUMK.mjs";function u(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`})}const d={command:`query`,describe:`Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`,builder:u,handler:async u=>{if(u.dryRun){a({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?l:await t(d);if(u.accountId=f,u.file){let e=c(u.file);i(await o(`Loading`,async()=>n(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(u.body){let e=s(u.body,`body`,`binary`);i(await o(`Loading`,async()=>n(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}i(await o(`Loading`,async()=>d.analyticsEngine.sql.query({account_id:f})),{successLabel:`Loaded`})}},f={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{D as e,E as t,S as n,T as r,i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d,t as f}from"./input-validation-CTqtyiY9.mjs";import{t as p}from"./cli-types-CMNMD1V7.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let n=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()=>r.apiGateway.configurations.update({body:n,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),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.apiGateway.discovery.get({zone_id:r})),{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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.bulkEdit({body:n,zone_id:r})),{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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.edit({...n,zone_id:r,discovery_id:e[`discovery-id`]})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>t.apiGateway.discovery.operations.edit({zone_id:r,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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.expressionTemplate.fallthrough.create({...n,zone_id:r})),{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:r})),{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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.managed.resources.operation.update({body:n,zone_id:r,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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.labels.user.bulkCreate({body:n,zone_id:r})),{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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.edit({...n,zone_id:r,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:r,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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.resources.operation.update({body:n,zone_id:r,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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.labels.user.update({...n,zone_id:r,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:r,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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.bulkCreate({body:n,zone_id:r})),{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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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 r=>{if(r.dryRun){l({command:`cf api-gateway operations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/api_gateway/operations/item`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({endpoint:d(r.endpoint,`endpoint`,`text`),host:d(r.host,`host`,`text`),method:d(r.method,`method`,`text`)}):o(r.body)});return}let i=await a(r),f=await n({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=f,r.body){let e=o(r.body);c(await u(`Creating`,async()=>i.apiGateway.operations.create({body:e,zone_id:f})),{successLabel:`Created`});return}r.endpoint===void 0&&(r.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/.`)),r.host===void 0&&(r.host=await e(`host`,`RFC3986-compliant host.`)),r.method===void 0&&(r.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(r.endpoint,`endpoint`,`text`),host:d(r.host,`host`,`text`),method:d(r.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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.labels.bulkCreate({...n,zone_id:r})),{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:r})),{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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.labels.bulkUpdate({...n,zone_id:r})),{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:r})),{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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Creating`,async()=>t.apiGateway.operations.labels.create({...n,zone_id:r,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:r,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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.labels.update({...n,zone_id:r,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:r,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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.schemaValidation.edit({body:n,zone_id:r})),{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),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.apiGateway.operations.schemaValidation.get({zone_id:r,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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.operations.schemaValidation.update({...n,zone_id:r,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:r,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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.settings.schemaValidation.edit({...n,zone_id:r})),{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:r})),{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),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.apiGateway.settings.schemaValidation.get({zone_id:r})),{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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.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()=>r.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 n({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 n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({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),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.apiGateway.userSchemas.edit({...n,zone_id:r,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>t.apiGateway.userSchemas.edit({zone_id:r,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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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 r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>r.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{E as e,S as t,n}from"./auth-BqDOIrKX.mjs";import{n as r,t as i}from"./body-parser-CBpeIUns.mjs";import{t as a}from"./output-CUxZRM5A.mjs";import{n as o,t as s}from"./progress-Cent9Lsg.mjs";import{n as c}from"./input-validation-CTqtyiY9.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};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{t as i}from"./output-CUxZRM5A.mjs";import{n as a,t as o}from"./progress-Cent9Lsg.mjs";import{t as s}from"./local-D8bhHUMK.mjs";import{t as c}from"./cli-types-CMNMD1V7.mjs";import{n as l,t as u}from"./raw-fetch-DnbAMFBp.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsNamespacesGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsNamespacesGet({account_id:l,namespace:t.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 t=>{let c={limit:t.limit,cursor:t.cursor};if(t.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(t),u=t.local?s:await n(l);t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposBlobGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/blob/${t.hash==null?`<hash>`:encodeURIComponent(String(t.hash))}`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``),hash:String(t.hash??``)},bodyKind:`none`});return}let i=await r(t),c=t.local?s:await n(i);t.accountId=c;let d=await o(`Loading`,async()=>u(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(t.namespace))}/repos/${encodeURIComponent(String(t.name))}/blob/${encodeURIComponent(String(t.hash))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));l(t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposCommitGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/commit/${t.hash==null?`<hash>`:encodeURIComponent(String(t.hash))}`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``),hash:String(t.hash??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposCommitGet({account_id:l,namespace:t.namespace,name:t.name,hash:t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposCreate({account_id:l,namespace:t.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 n(l);if(c.accountId=u,!await t({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 t=>{let i={ref:t.ref,path:t.path};if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposFileGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/file`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},query:i,bodyKind:`none`});return}let c=await r(t),d=t.local?s:await n(c);t.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(t.namespace))}/repos/${encodeURIComponent(String(t.name))}/file${f?`?`+f:``}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));l(t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposFork`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/fork`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposFork({account_id:l,namespace:t.namespace,name:t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposGet({account_id:l,namespace:t.namespace,name:t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposImport`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/import`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsReposImport({account_id:l,namespace:t.namespace,name:t.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 t=>{let c={limit:t.limit,cursor:t.cursor,search:t.search,sort:t.sort,direction:t.direction};if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos`,pathParams:{namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await r(t),u=t.local?s:await n(l);t.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsReposList({account_id:u,namespace:t.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 t=>{let c={ref:t.ref,limit:t.limit,offset:t.offset};if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposLogGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/log`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},query:c,bodyKind:`none`});return}let l=await r(t),u=t.local?s:await n(l);t.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsReposLogGet({account_id:u,namespace:t.namespace,name:t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposRawGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/raw/${t.ref==null?`<ref>`:encodeURIComponent(String(t.ref))}/${t.path==null?`<path>`:encodeURIComponent(String(t.path))}`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``),ref:String(t.ref??``),path:String(t.path??``)},bodyKind:`none`});return}let i=await r(t),c=t.local?s:await n(i);t.accountId=c;let d=await o(`Loading`,async()=>u(`/accounts/${c}/artifacts/namespaces/${encodeURIComponent(String(t.namespace))}/repos/${encodeURIComponent(String(t.name))}/raw/${encodeURIComponent(String(t.ref))}/${encodeURIComponent(String(t.path))}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));l(t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsReposTreeGet`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/tree/${t.hash==null?`<hash>`:encodeURIComponent(String(t.hash))}`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``),hash:String(t.hash??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Loading`,async()=>c.artifacts.namespaces.artifactsReposTreeGet({account_id:l,namespace:t.namespace,name:t.name,hash:t.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 t=>{let c={state:t.state,page:t.page,per_page:t[`per-page`]};if(t.dryRun){a({command:`cf artifacts namespaces artifactsRepoTokensList`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/repos/${t.name==null?`<name>`:encodeURIComponent(String(t.name))}/tokens`,pathParams:{namespace:String(t.namespace??``),name:String(t.name??``)},query:c,bodyKind:`none`});return}let l=await r(t),u=t.local?s:await n(l);t.accountId=u,i(await o(`Loading`,async()=>l.artifacts.namespaces.artifactsRepoTokensList({account_id:u,namespace:t.namespace,name:t.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 t=>{if(t.dryRun){a({command:`cf artifacts namespaces artifactsTokensCreate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/artifacts/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/tokens`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await r(t),l=t.local?s:await n(c);t.accountId=l,i(await o(`Creating`,async()=>c.artifacts.namespaces.artifactsTokensCreate({account_id:l,namespace:t.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 n(l);if(c.accountId=u,!await t({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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,_ as t,n}from"./auth-BqDOIrKX.mjs";import{t as r}from"./output-CUxZRM5A.mjs";import{n as i,t as a}from"./progress-Cent9Lsg.mjs";import{t as o}from"./local-D8bhHUMK.mjs";import{t as s}from"./cli-types-CMNMD1V7.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){i({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/audit_logs`,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.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
|