cf 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
- package/dist/auth-DX9KnJ0P.mjs +9 -0
- package/dist/auth-TYwGydWg.mjs +5 -0
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/context-C-WbewL6.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
- package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/progress-CL8I-7YK.mjs +2 -0
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/session-B8r8LNQN.mjs +93 -0
- package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
- package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
- package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/src-BQ1dr9xR.mjs +108 -0
- package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
- package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-CjtZ8x1z.mjs +0 -22
- package/dist/addressing-CHFK6uxW.mjs +0 -12
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/alerting-Bk85NNf5.mjs +0 -6
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
- package/dist/calls-DXRWsZ8n.mjs +0 -4
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/content-scanning-CnW2A0pv.mjs +0 -4
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
- package/dist/dist-DA54ZQu0.mjs +0 -82
- package/dist/dns-62t95Xif.mjs +0 -29
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-routing-BDUYYeV3.mjs +0 -10
- package/dist/email-security-ChHA6eqQ.mjs +0 -8
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/filters-qJpU9uAS.mjs +0 -4
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/images-D1jI3r3O.mjs +0 -7
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/kv-CSWoD9ks.mjs +0 -5
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/load-balancers-Du1tNuUt.mjs +0 -6
- package/dist/logpush-SuJyO-uX.mjs +0 -4
- package/dist/logs-DcDNRPRl.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
- package/dist/magic-transit-BTbkhBtF.mjs +0 -89
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/network-interconnects-DsiNytOU.mjs +0 -36
- package/dist/observability-CLqZ7OSi.mjs +0 -4
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/pages-ChurJ2H7.mjs +0 -11
- package/dist/pipelines-CeyujvRf.mjs +0 -6
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-BtuTO3vQ.mjs +0 -21
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/realtime-kit-CivLpkpg.mjs +0 -18
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
- package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rulesets-lYczEcJp.mjs +0 -8
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/schema-validation-DTq517Em.mjs +0 -24
- package/dist/scim-BiLfOQ89.mjs +0 -3
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/stream-CGTRN4ZN.mjs +0 -14
- package/dist/turnstile-l7mo9BWL.mjs +0 -23
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/user-CiyYZ69X.mjs +0 -10
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/web3-DlHE0CZc.mjs +0 -4
- package/dist/workers-DRAkU6YR.mjs +0 -18
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/workflows-z6oapEJs.mjs +0 -4
- package/dist/zero-trust-fyyIelWx.mjs +0 -118
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,S as r,T as i,_ as a,i as o,n as s}from"./auth-BqDOIrKX.mjs";import{n as c,r as l,t as u}from"./body-parser-CBpeIUns.mjs";import{t as d}from"./output-CUxZRM5A.mjs";import{n as f,t as p}from"./progress-Cent9Lsg.mjs";import{n as m}from"./input-validation-CTqtyiY9.mjs";import{t as h}from"./local-D8bhHUMK.mjs";import{t as g}from"./cli-types-CMNMD1V7.mjs";function _(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
|
|
3
|
-
verify the current resource ETag matches before applying the write. Returns
|
|
4
|
-
412 Precondition Failed if the resource has been modified since the ETag was
|
|
5
|
-
obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).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:`Request body schema for deleting tags from account-level resources. Use /zones/{zone_id}/tags for zone-level resources.`})}const v={command:`delete`,describe:`Removes all tags from a specific account-level resource.`,builder:_,handler:async r=>{let g={};if(r[`if-match`]!==void 0&&(g[`If-Match`]=String(r[`if-match`])),r.dryRun){f({command:`cf resource-tagging account-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({resource_id:m(r[`resource-id`],`resource-id`,`text`),resource_type:m(r[`resource-type`],`resource-type`,`text`),worker_id:m(r[`worker-id`],`worker-id`,`text`)}):c(r.body)});return}let _=await s(r),v=r.local?h:await a(_);if(r.accountId=v,!await i({force:!!r.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}if(r.body){let e=c(r.body);d(await p(`Deleting`,async()=>o(_,`DELETE`,`/accounts/${v}/tags`,{body:e,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`});return}r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let y={};r[`resource-id`]!==void 0&&l(y,[`resource_id`],m(r[`resource-id`],`resource-id`,`text`)),r[`resource-type`]!==void 0&&l(y,[`resource_type`],m(r[`resource-type`],`resource-type`,`text`)),r[`worker-id`]!==void 0&&l(y,[`worker_id`],m(r[`worker-id`],`worker-id`,`text`)),d(await p(`Deleting`,async()=>o(_,`DELETE`,`/accounts/${v}/tags`,{body:Object.keys(y).length>0?y:void 0,headers:Object.keys(g).length>0?g:void 0})),{successLabel:`Deleted`})}};function y(e){return e.option(`resource-id`,{type:`string`,description:`The ID of the resource to retrieve tags for.`,demandOption:!0}).option(`resource-type`,{type:`string`,description:`The type of the resource.`,choices:[`access_application`,`access_group`,`account`,`ai_gateway`,`alerting_policy`,`alerting_webhook`,`cloudflared_tunnel`,`d1_database`,`durable_object_namespace`,`gateway_list`,`gateway_rule`,`image`,`kv_namespace`,`queue`,`r2_bucket`,`resource_share`,`stream_live_input`,`stream_video`,`worker`,`worker_version`],demandOption:!0}).option(`worker-id`,{type:`string`,description:`Worker identifier. Required for worker_version resources.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Retrieves tags for a specific account-level resource.`,builder:g(y),handler:async t=>{let n={resource_id:t[`resource-id`],resource_type:t[`resource-type`],worker_id:t[`worker-id`]};if(t.dryRun){f({command:`cf resource-tagging account-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.accountTags.get({account_id:i,...n})),{successLabel:`Loaded`})}};function x(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
|
|
7
|
-
verify the current resource ETag matches before applying the write. Returns
|
|
8
|
-
412 Precondition Failed if the resource has been modified since the ETag was
|
|
9
|
-
obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for worker_version resource type.`,choices:[`worker_version`]}).option(`worker-id`,{type:`string`,description:`Worker ID is required only for worker_version resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for setting tags on account-level resources.`})}const S={command:`update`,describe:`Creates or updates tags for a specific account-level resource.`,builder:x,handler:async r=>{let i={};if(r[`if-match`]!==void 0&&(i[`If-Match`]=String(r[`if-match`])),r.dryRun){f({command:`cf resource-tagging account-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({resource_id:m(r[`resource-id`],`resource-id`,`text`),resource_type:m(r[`resource-type`],`resource-type`,`text`),worker_id:m(r[`worker-id`],`worker-id`,`text`)}):c(r.body)});return}let g=await s(r),_=r.local?h:await a(g);if(r.accountId=_,r.body){let e=c(r.body);d(await p(`Updating`,async()=>o(g,`PUT`,`/accounts/${_}/tags`,{body:e,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`});return}r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Enum for worker_version resource type.`,[`worker_version`]));let v={};r[`resource-id`]!==void 0&&l(v,[`resource_id`],m(r[`resource-id`],`resource-id`,`text`)),r[`resource-type`]!==void 0&&l(v,[`resource_type`],m(r[`resource-type`],`resource-type`,`text`)),r[`worker-id`]!==void 0&&l(v,[`worker_id`],m(r[`worker-id`],`worker-id`,`text`)),d(await p(`Updating`,async()=>o(g,`PUT`,`/accounts/${_}/tags`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},C={command:`account-tags`,describe:`Tags applied to the account for organizational grouping and policy targeting`,builder:e=>e.command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Lists all distinct tag keys used across resources in an account.`,builder:w,handler:async t=>{let n={cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/keys`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.keys.list({account_id:i,...n})),{successLabel:`Loaded`})}},E={command:`keys`,describe:`Tag key definitions that establish the vocabulary for tagging resources`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`type`,{type:`string`,description:`Filter by resource type. Can be repeated to filter by multiple types (OR logic). Example: ?type=zone&type=worker`}).option(`tag`,{type:`string`,description:"Filter resources by tag criteria. This parameter can be repeated multiple times, with AND logic between parameters.\n\nSupported syntax:\n- **Key-only**: `tag=<key>` - Resource must have the tag key (e.g., `tag=production`)\n- **Key-value**: `tag=<key>=<value>` - Resource must have the tag with specific value (e.g., `tag=env=prod`)\n- **Multiple values (OR)**: `tag=<key>=<v1>,<v2>` - Resource must have tag with any of the values (e.g., `tag=env=prod,staging`)\n- **Negate key-only**: `tag=!<key>` - Resource must not have the tag key (e.g., `tag=!archived`)\n- **Negate key-value**: `tag=<key>!=<value>` - Resource must not have the tag with specific value (e.g., `tag=region!=us-west-1`)\n\nMultiple tag parameters are combined with AND logic."}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`Lists all tagged resources for an account.`,builder:g(D),handler:async t=>{let n={type:t.type,tag:t.tag,cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/resources`,pathParams:{},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.list({account_id:i,...n})),{successLabel:`Loaded`})}};function k(e){return e.option(`tag-key`,{type:`string`,description:`The tag key to retrieve values for.`,demandOption:!0}).option(`type`,{type:`string`,description:`Filter by resource type.`,choices:`access_application.access_application_policy.access_group.account.ai_gateway.alerting_policy.alerting_webhook.api_gateway_operation.cloudflared_tunnel.custom_certificate.custom_hostname.d1_database.dns_record.durable_object_namespace.gateway_list.gateway_rule.image.kv_namespace.managed_client_certificate.queue.r2_bucket.resource_share.stream_live_input.stream_video.worker.worker_version.zone`.split(`.`)}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Lists all distinct values for a given tag key, optionally filtered by resource type.`,builder:g(k),handler:async t=>{let n={type:t.type,cursor:t.cursor};if(t.dryRun){f({command:`cf resource-tagging values list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/tags/values/${t[`tag-key`]==null?`<tag-key>`:encodeURIComponent(String(t[`tag-key`]))}`,pathParams:{"tag-key":String(t[`tag-key`]??``)},query:n,bodyKind:`none`});return}let r=await s(t),i=t.local?h:await a(r);t.accountId=i,d(await p(`Loading`,async()=>r.resourceTagging.values.list({account_id:i,tag_key:t[`tag-key`],...n})),{successLabel:`Loaded`})}},j={command:`values`,describe:`Allowed values for tag keys — constrain tagging to a defined set of options`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
|
|
10
|
-
verify the current resource ETag matches before applying the write. Returns
|
|
11
|
-
412 Precondition Failed if the resource has been modified since the ETag was
|
|
12
|
-
obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for base zone-level resource types (those with no extra required fields).`,choices:[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]}).option(`access-application-id`,{type:`string`,description:`Access application ID is required only for access_application_policy resources`}).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:`Request body schema for deleting tags from zone-level resources.`})}const N={command:`delete`,describe:`Removes all tags from a specific zone-level resource.`,builder:M,handler:async e=>{let a={};if(e[`if-match`]!==void 0&&(a[`If-Match`]=String(e[`if-match`])),e.dryRun){f({command:`cf resource-tagging zone-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({resource_id:m(e[`resource-id`],`resource-id`,`text`),resource_type:m(e[`resource-type`],`resource-type`,`text`),access_application_id:m(e[`access-application-id`],`access-application-id`,`text`)}):c(e.body)});return}let h=await s(e);if(e.zoneId=await r({zone:e.zone},h,{quiet:e.quiet}),!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}if(e.body){let t=c(e.body);d(await p(`Deleting`,async()=>o(h,`DELETE`,`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`});return}e[`resource-id`]===void 0&&(e[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),e[`resource-type`]===void 0&&(e[`resource-type`]=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let g={};e[`resource-id`]!==void 0&&l(g,[`resource_id`],m(e[`resource-id`],`resource-id`,`text`)),e[`resource-type`]!==void 0&&l(g,[`resource_type`],m(e[`resource-type`],`resource-type`,`text`)),e[`access-application-id`]!==void 0&&l(g,[`access_application_id`],m(e[`access-application-id`],`access-application-id`,`text`)),d(await p(`Deleting`,async()=>o(h,`DELETE`,`/zones/${e.zoneId}/tags`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function P(e){return e.option(`resource-id`,{type:`string`,description:`The ID of the resource to retrieve tags for.`,demandOption:!0}).option(`resource-type`,{type:`string`,description:`The type of the resource.`,choices:[`access_application_policy`,`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`],demandOption:!0}).option(`access-application-id`,{type:`string`,description:`Access application ID identifier. Required for access_application_policy resources.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get`,describe:`Retrieves tags for a specific zone-level resource.`,builder:g(P),handler:async e=>{let t={resource_id:e[`resource-id`],resource_type:e[`resource-type`],access_application_id:e[`access-application-id`]};if(e.dryRun){f({command:`cf resource-tagging zone-tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await s(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,d(await p(`Loading`,async()=>n.resourceTagging.zoneTags.get({zone_id:i,...t})),{successLabel:`Loaded`})}};function I(e){return e.option(`if-match`,{type:`string`,description:`ETag value for optimistic concurrency control. When provided, the server will
|
|
14
|
-
verify the current resource ETag matches before applying the write. Returns
|
|
15
|
-
412 Precondition Failed if the resource has been modified since the ETag was
|
|
16
|
-
obtained. Omit this header for unconditional writes.`}).option(`resource-id`,{type:`string`,description:`Identifies the unique resource.`}).option(`resource-type`,{type:`string`,description:`Enum for base zone-level resource types (those with no extra required fields).`,choices:[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]}).option(`access-application-id`,{type:`string`,description:`Access application ID is required only for access_application_policy resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body schema for setting tags on zone-level resources.`})}const L={command:`update`,describe:`Creates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.`,builder:I,handler:async e=>{let i={};if(e[`if-match`]!==void 0&&(i[`If-Match`]=String(e[`if-match`])),e.dryRun){f({command:`cf resource-tagging zone-tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/tags`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({resource_id:m(e[`resource-id`],`resource-id`,`text`),resource_type:m(e[`resource-type`],`resource-type`,`text`),access_application_id:m(e[`access-application-id`],`access-application-id`,`text`)}):c(e.body)});return}let a=await s(e);if(e.zoneId=await r({zone:e.zone},a,{quiet:e.quiet}),e.body){let t=c(e.body);d(await p(`Updating`,async()=>o(a,`PUT`,`/zones/${e.zoneId}/tags`,{body:t,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`});return}e[`resource-id`]===void 0&&(e[`resource-id`]=await t(`resource-id`,`Identifies the unique resource.`)),e[`resource-type`]===void 0&&(e[`resource-type`]=await n(`resource-type`,`Enum for base zone-level resource types (those with no extra required fields).`,[`api_gateway_operation`,`custom_certificate`,`custom_hostname`,`dns_record`,`managed_client_certificate`,`zone`]));let h={};e[`resource-id`]!==void 0&&l(h,[`resource_id`],m(e[`resource-id`],`resource-id`,`text`)),e[`resource-type`]!==void 0&&l(h,[`resource_type`],m(e[`resource-type`],`resource-type`,`text`)),e[`access-application-id`]!==void 0&&l(h,[`access_application_id`],m(e[`access-application-id`],`access-application-id`,`text`)),d(await p(`Updating`,async()=>o(a,`PUT`,`/zones/${e.zoneId}/tags`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},R={command:`zone-tags`,describe:`Tags applied to individual zones for categorization and bulk management`,builder:e=>e.command(N).command(F).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`resource-tagging`,describe:`Tag accounts and zones with key-value metadata for organization, filtering, and policy targeting`,builder:e=>e.command(O).command(C).command(E).command(j).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
|
package/dist/rules-B10XWY10.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,T as n,_ as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,t as o}from"./body-parser-CBpeIUns.mjs";import{t as s}from"./output-CUxZRM5A.mjs";import{n as c,t as l}from"./progress-Cent9Lsg.mjs";import{n as u}from"./input-validation-CTqtyiY9.mjs";import{t as d}from"./local-D8bhHUMK.mjs";function f(e){return e.positional(`operation-id`,{type:`string`,description:`The unique operation ID of the asynchronous action.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get <operation-id>`,describe:"Gets the current status of an asynchronous operation on a list. The `status` property can have one of the following values: `pending`, `running`, `completed`, or `failed`. If the status is `failed`, the `error` property will contain a message describing the error.",builder:f,handler:async t=>{if(t.dryRun){c({command:`cf rules lists bulk-operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/bulk_operations/${t[`operation-id`]==null?`<operation-id>`:encodeURIComponent(String(t[`operation-id`]))}`,pathParams:{"operation-id":String(t[`operation-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.bulkOperations.get({account_id:a,operation_id:t[`operation-id`]})),{successLabel:`Loaded`})}},m={command:`bulk-operations`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`description`,{type:`string`,description:`An informative summary of the list.`}).option(`name`,{type:`string`,description:`An informative name for the list. Use this name in filter and rule expressions.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`create`,describe:`Creates a new list of the specified kind.`,builder:h,handler:async n=>{if(n.dryRun){c({command:`cf rules lists create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),name:u(n.name,`name`,`text`)}):a(n.body)});return}let f=await i(n),p=n.local?d:await r(f);if(n.accountId=p,n.body){let e=a(n.body);s(await l(`Creating`,async()=>f.rules.lists.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`An informative name for the list. Use this name in filter and rule expressions.`));let m=o({description:u(n.description,`description`,`text`),name:u(n.name,`name`,`text`)});s(await l(`Creating`,async()=>f.rules.lists.create({...m,account_id:p})),{successLabel:`Created`})}};function _(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,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 v={command:`delete <list-id>`,describe:`Deletes a specific list and all its items.`,builder:_,handler:async t=>{if(t.dryRun){c({command:`cf rules lists delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);if(t.accountId=o,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>a.rules.lists.delete({account_id:o,list_id:t[`list-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <list-id>`,describe:`Fetches the details of a list.`,builder:y,handler:async t=>{if(t.dryRun){c({command:`cf rules lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.get({account_id:a,list_id:t[`list-id`]})),{successLabel:`Loaded`})}};function x(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,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:`create <list-id>`,describe:"Appends new items to the list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:x,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.rules.lists.items.create({body:e,account_id:o,list_id:t[`list-id`]})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function C(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`delete <list-id>`,describe:"Removes one or more items from a list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:C,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let o=await i(t),u=t.local?d:await r(o);if(t.accountId=u,!await n({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(t.body){let e=a(t.body);s(await l(`Deleting`,async()=>o.rules.lists.items.delete({...e,account_id:u,list_id:t[`list-id`]})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>o.rules.lists.items.delete({account_id:u,list_id:t[`list-id`]})),{successLabel:`Deleted`})}};function T(e){return e.positional(`item-id`,{type:`string`,description:`Defines the unique ID of the item in the List.`,demandOption:!0}).option(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <item-id>`,describe:`Fetches a list item in the list.`,builder:T,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"item-id":String(t[`item-id`]??``),"list-id":String(t[`list-id`]??``)},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.items.get({account_id:a,list_id:t[`list-id`],item_id:t[`item-id`]})),{successLabel:`Loaded`})}};function D(e){return e.option(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`cursor`,{type:`string`,description:"The pagination cursor. An opaque string token indicating the position from which to continue when requesting the next/previous set of records. Cursor values are provided under `result_info.cursors` in the response. You should make no assumptions about a cursor's content or length."}).option(`per-page`,{type:`number`,description:`Amount of results to include in each paginated response. A non-negative 32 bit integer.`}).option(`search`,{type:`string`,description:`A search query to filter returned items. Its meaning depends on the list type: IP addresses must start with the provided string, hostnames and bulk redirects must contain the string, and ASNs must match the string exactly.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`Fetches all the items in the list.`,builder:D,handler:async t=>{let n={cursor:t.cursor,per_page:t[`per-page`],search:t.search};if(t.dryRun){c({command:`cf rules lists items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},query:n,bodyKind:`none`});return}let a=await i(t),o=t.local?d:await r(a);t.accountId=o,s(await l(`Loading`,async()=>a.rules.lists.items.list({account_id:o,list_id:t[`list-id`],...n})),{successLabel:`Loaded`})}};function k(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,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 A={command:`update <list-id>`,describe:"Removes all existing items from the list and adds the provided items to the list. This operation is asynchronous. To get current the operation status, invoke the `Get bulk operation status` endpoint with the returned `operation_id`. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.",builder:k,handler:async t=>{if(t.dryRun){c({command:`cf rules lists items update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}/items`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=t.local?d:await r(n);if(t.accountId=o,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.rules.lists.items.update({body:e,account_id:o,list_id:t[`list-id`]})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},j={command:`items`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(S).command(w).command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Fetches all lists in the account.`,builder:M,handler:async t=>{if(t.dryRun){c({command:`cf rules lists list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists`,pathParams:{},bodyKind:`none`});return}let n=await i(t),a=t.local?d:await r(n);t.accountId=a,s(await l(`Loading`,async()=>n.rules.lists.list({account_id:a})),{successLabel:`Loaded`})}};function P(e){return e.positional(`list-id`,{type:`string`,description:`The unique ID of the list.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative summary of the list.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const F={command:`update <list-id>`,describe:`Updates the description of a list.`,builder:P,handler:async t=>{if(t.dryRun){c({command:`cf rules lists update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rules/lists/${t[`list-id`]==null?`<list-id>`:encodeURIComponent(String(t[`list-id`]))}`,pathParams:{"list-id":String(t[`list-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({description:u(t.description,`description`,`text`)}):a(t.body)});return}let n=await i(t),f=t.local?d:await r(n);if(t.accountId=f,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.rules.lists.update({...e,account_id:f,list_id:t[`list-id`]})),{successLabel:`Updated`});return}let p=o({description:u(t.description,`description`,`text`)});s(await l(`Updating`,async()=>n.rules.lists.update({...p,account_id:f,list_id:t[`list-id`]})),{successLabel:`Updated`})}},I={command:`lists`,describe:`Named lists of IPs, hostnames, ASNs, or redirects that can be referenced in rule expressions`,builder:e=>e.command(g).command(v).command(b).command(N).command(F).command(m).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},L={command:`rules`,describe:`Account-level IP lists, hostname lists, and other reusable lists referenced by firewall rules and rulesets`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{L as default};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,S as r,T as i,_ as a,n as o}from"./auth-BqDOIrKX.mjs";import{n as s,t as c}from"./body-parser-CBpeIUns.mjs";import{t as l}from"./output-CUxZRM5A.mjs";import{n as u,t as d}from"./progress-Cent9Lsg.mjs";import{n as f}from"./input-validation-CTqtyiY9.mjs";import{t as p}from"./local-D8bhHUMK.mjs";import{t as m}from"./cli-types-CMNMD1V7.mjs";function h(e){return e.option(`description`,{type:`string`,description:`An informative description of the ruleset.`,default:``}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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 ee={command:`create`,describe:`Creates a ruleset at the account level.`,builder:h,handler:async r=>{if(r.dryRun){u({command:`cf rulesets account-rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets`,pathParams:{},bodyKind:`json`,body:r.body===void 0?c({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),kind:f(r.kind,`kind`,`text`),phase:f(r.phase,`phase`,`text`)}):s(r.body)});return}let i=await o(r),m=r.local?p:await a(i);if(r.accountId=m,r.body){let e=s(r.body);l(await d(`Creating`,async()=>i.rulesets.accountRulesets.create({...e,account_id:m})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await t(`name`,`The human-readable name of the ruleset.`)),r.kind===void 0&&(r.kind=await n(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),r.phase===void 0&&(r.phase=await n(`phase`,`The phase of the ruleset.`,[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]));let h=c({description:f(r.description,`description`,`text`),name:f(r.name,`name`,`text`),kind:f(r.kind,`kind`,`text`),phase:f(r.phase,`phase`,`text`)});l(await d(`Creating`,async()=>i.rulesets.accountRulesets.create({...h,account_id:m})),{successLabel:`Created`})}};function te(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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 <ruleset-id>`,describe:`Deletes all versions of an existing account ruleset.`,builder:te,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.delete({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <ruleset-id>`,describe:`Fetches the latest version of an account ruleset.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.get({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`number`,description:`The number of rulesets to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Fetches all rulesets at the account level.`,builder:y,handler:async t=>{let n={cursor:t.cursor,per_page:t[`per-page`]};if(t.dryRun){u({command:`cf rulesets account-rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),i=t.local?p:await a(r);t.accountId=i,l(await d(`Loading`,async()=>r.rulesets.accountRulesets.list({account_id:i,...n})),{successLabel:`Loaded`})}};function x(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <ruleset-phase>`,describe:`Fetches the latest version of the account entry point ruleset for a given phase.`,builder:m(x),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.get({account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Loaded`})}};function C(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).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 w={command:`update <ruleset-phase>`,describe:`Updates an account entry point ruleset, creating a new version.`,builder:m(C),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.phases.update({...e,account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Updated`});return}let i=c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`)});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.phases.update({...i,account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Updated`})}};function T(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account entry point ruleset.`,builder:m(T),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.get({account_id:r,ruleset_phase:t[`ruleset-phase`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Loaded`})}};function D(e){return e.option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`list`,describe:`Fetches the versions of an account entry point ruleset.`,builder:m(D),handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/phases/${t[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(t[`ruleset-phase`]))}/entrypoint/versions`,pathParams:{"ruleset-phase":String(t[`ruleset-phase`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.phases.versions.list({account_id:r,ruleset_phase:t[`ruleset-phase`]})),{successLabel:`Loaded`})}},k={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},A={command:`phases`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(S).command(w).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const M={command:`create <ruleset-id>`,describe:`Adds a new rule to an account ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.`,builder:j,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.rulesets.accountRulesets.rules.create({...e,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let i=c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}});l(await d(`Creating`,async()=>n.rulesets.accountRulesets.rules.create({...i,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function N(e){return e.positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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 P={command:`delete <rule-id>`,describe:`Deletes an existing rule from an account ruleset.`,builder:N,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.rules.delete({account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const I={command:`update <rule-id>`,describe:`Updates an existing rule in an account ruleset.`,builder:F,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.rules.update({...e,account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let i=c({position:{before:f(t[`position-before`],`position-before`,`text`),after:f(t[`position-after`],`position-after`,`text`),index:t[`position-index`]}});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.rules.update({...i,account_id:r,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},L={command:`rules`,describe:`Operations for account-rulesets.rules`,builder:e=>e.command(M).command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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 <ruleset-id>`,describe:`Updates an account ruleset, creating a new version.`,builder:R,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`),kind:f(t.kind,`kind`,`text`),phase:f(t.phase,`phase`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.rulesets.accountRulesets.update({...e,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Updated`});return}let i=c({description:f(t.description,`description`,`text`),name:f(t.name,`name`,`text`),kind:f(t.kind,`kind`,`text`),phase:f(t.phase,`phase`,`text`)});l(await d(`Updating`,async()=>n.rulesets.accountRulesets.update({...i,account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Updated`})}};function B(e){return e.positional(`rule-tag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`tag <rule-tag>`,describe:`Fetches the rules of a managed account ruleset version for a given tag.`,builder:B,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}/by_tag/${t[`rule-tag`]==null?`<rule-tag>`:encodeURIComponent(String(t[`rule-tag`]))}`,pathParams:{"rule-tag":String(t[`rule-tag`]??``),"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.byTag.tag({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`],rule_tag:t[`rule-tag`]})),{successLabel:`Loaded`})}},H={command:`by-tag`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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:`delete <ruleset-version>`,describe:`Deletes an existing version of an account ruleset.`,builder:U,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);if(t.accountId=r,!await i({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}l(await d(`Deleting`,async()=>n.rulesets.accountRulesets.versions.delete({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <ruleset-version>`,describe:`Fetches a specific version of an account ruleset.`,builder:G,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions/${t[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(t[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(t[`ruleset-version`]??``),"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.get({account_id:r,ruleset_id:t[`ruleset-id`],ruleset_version:t[`ruleset-version`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`Fetches the versions of an account ruleset.`,builder:q,handler:async t=>{if(t.dryRun){u({command:`cf rulesets account-rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rulesets/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/versions`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await a(n);t.accountId=r,l(await d(`Loading`,async()=>n.rulesets.accountRulesets.versions.list({account_id:r,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`rule-tag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`tag <rule-tag>`,describe:`Fetches the rules of a managed zone ruleset version for a given tag.`,builder:Y,handler:async e=>{if(e.dryRun){u({command:`cf rulesets account-rulesets versions zone-by-tag tag`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}/by_tag/${e[`rule-tag`]==null?`<rule-tag>`:encodeURIComponent(String(e[`rule-tag`]))}`,pathParams:{"rule-tag":String(e[`rule-tag`]??``),"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.accountRulesets.versions.zoneByTag.tag({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`],rule_tag:e[`rule-tag`]})),{successLabel:`Loaded`})}},Z={command:`zone-by-tag`,describe:`Operations for account-rulesets.versions.zone-by-tag`,builder:e=>e.command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Q={command:`versions`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(W).command(K).command(J).command(H).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ne={command:`account-rulesets`,describe:`Account-scoped rulesets — same operations as zone-level but scoped to the account`,builder:e=>e.command(ee).command(g).command(v).command(b).command(z).command(A).command(L).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`description`,{type:`string`,description:`An informative description of the ruleset.`,default:``}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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:`create`,describe:`Creates a ruleset at the zone level.`,builder:re,handler:async e=>{if(e.dryRun){u({command:`cf rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)}):s(e.body)});return}let i=await o(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,e.body){let t=s(e.body);l(await d(`Creating`,async()=>i.rulesets.create({...t,zone_id:a})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The human-readable name of the ruleset.`)),e.kind===void 0&&(e.kind=await n(`kind`,`The kind of the ruleset.`,[`managed`,`custom`,`root`,`zone`])),e.phase===void 0&&(e.phase=await n(`phase`,`The phase of the ruleset.`,[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]));let p=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)});l(await d(`Creating`,async()=>i.rulesets.create({...p,zone_id:a})),{successLabel:`Created`})}};function ae(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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 oe={command:`delete <ruleset-id>`,describe:`Deletes all versions of an existing zone ruleset.`,builder:ae,handler:async e=>{if(e.dryRun){u({command:`cf rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}l(await d(`Deleting`,async()=>t.rulesets.delete({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <ruleset-id>`,describe:`Fetches the latest version of a zone ruleset.`,builder:se,handler:async e=>{if(e.dryRun){u({command:`cf rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.get({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`number`,description:`The number of rulesets to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Fetches all rulesets at the zone level.`,builder:le,handler:async e=>{let t={cursor:e.cursor,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await o(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>n.rulesets.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function de(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`get <ruleset-phase>`,describe:`Fetches the latest version of the zone entry point ruleset for a given phase.`,builder:m(de),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.get({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}};function pe(e){return e.positional(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`update <ruleset-phase>`,describe:`Updates a zone entry point ruleset, creating a new version.`,builder:m(pe),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.phases.update({...r,zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Updated`});return}let i=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`)});l(await d(`Updating`,async()=>t.rulesets.phases.update({...i,zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Updated`})}};function he(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone entry point ruleset.`,builder:m(he),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.versions.get({zone_id:n,ruleset_phase:e[`ruleset-phase`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function _e(e){return e.option(`ruleset-phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list`,describe:`Fetches the versions of a zone entry point ruleset.`,builder:m(_e),handler:async e=>{if(e.dryRun){u({command:`cf rulesets phases versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/phases/${e[`ruleset-phase`]==null?`<ruleset-phase>`:encodeURIComponent(String(e[`ruleset-phase`]))}/entrypoint/versions`,pathParams:{"ruleset-phase":String(e[`ruleset-phase`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.phases.versions.list({zone_id:n,ruleset_phase:e[`ruleset-phase`]})),{successLabel:`Loaded`})}},ye={command:`versions`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(ge).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},be={command:`phases`,describe:`Execution phases that determine when rulesets run in the request lifecycle (e.g. http_request_firewall_custom)`,builder:e=>e.command(fe).command(me).command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const Se={command:`create <ruleset-id>`,describe:`Adds a new rule to a zone ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.`,builder:xe,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Creating`,async()=>t.rulesets.rules.create({...r,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Created`});return}let i=c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});l(await d(`Creating`,async()=>t.rulesets.rules.create({...i,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Created`})}};function Ce(e){return e.positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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 we={command:`delete <rule-id>`,describe:`Deletes an existing rule from a zone ruleset.`,builder:Ce,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}l(await d(`Deleting`,async()=>t.rulesets.rules.delete({zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function Te(e){return e.positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const Ee={command:`edit <rule-id>`,describe:`Updates an existing rule in a zone ruleset.`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf rulesets rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.rules.edit({...r,zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({position:{before:f(e[`position-before`],`position-before`,`text`),after:f(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});l(await d(`Updating`,async()=>t.rulesets.rules.edit({...i,zone_id:n,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}},De={command:`rules`,describe:`Individual rules within a ruleset — each with an expression, action, and priority`,builder:e=>e.command(Se).command(we).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).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 <ruleset-id>`,describe:`Updates a zone ruleset, creating a new version.`,builder:$,handler:async e=>{if(e.dryRun){u({command:`cf rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)}):s(e.body)});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=s(e.body);l(await d(`Updating`,async()=>t.rulesets.update({...r,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Updated`});return}let i=c({description:f(e.description,`description`,`text`),name:f(e.name,`name`,`text`),kind:f(e.kind,`kind`,`text`),phase:f(e.phase,`phase`,`text`)});l(await d(`Updating`,async()=>t.rulesets.update({...i,zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,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 Ae={command:`delete <ruleset-version>`,describe:`Deletes an existing version of a zone ruleset.`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}l(await d(`Deleting`,async()=>t.rulesets.versions.delete({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Deleted`})}};function je(e){return e.positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <ruleset-version>`,describe:`Fetches a specific version of a zone ruleset.`,builder:je,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"ruleset-version":String(e[`ruleset-version`]??``),"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.versions.get({zone_id:n,ruleset_id:e[`ruleset-id`],ruleset_version:e[`ruleset-version`]})),{successLabel:`Loaded`})}};function Ne(e){return e.option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`Fetches the versions of a zone ruleset.`,builder:Ne,handler:async e=>{if(e.dryRun){u({command:`cf rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/versions`,pathParams:{"ruleset-id":String(e[`ruleset-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,l(await d(`Loading`,async()=>t.rulesets.versions.list({zone_id:n,ruleset_id:e[`ruleset-id`]})),{successLabel:`Loaded`})}},Fe={command:`versions`,describe:`Immutable snapshots of a ruleset, allowing rollback and audit of rule changes`,builder:e=>e.command(Ae).command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ie={command:`rulesets`,describe:`Versioned collections of rules that control how Cloudflare processes traffic — WAF, transform, redirect, and more`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(Oe).command(ne).command(be).command(De).command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ie as default};
|
package/dist/rum-B5GUKa4I.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{n as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./local-D8bhHUMK.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(e){return e.option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`delete-rules`,{type:`string`,array:!0,description:`A list of rule identifiers to delete.`}).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 p={command:`bulk-create`,describe:`Modifies one or more rules in a Web Analytics ruleset with a single request.`,builder:f,handler:async t=>{if(t.dryRun){s({command:`cf rum rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({delete_rules:t[`delete-rules`]}):i(t.body)});return}let l=await r(t),d=t.local?u:await n(l);if(t.accountId=d,t.body){let e=i(t.body);o(await c(`Creating`,async()=>l.rum.rules.bulkCreate({...e,account_id:d,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let f=a({delete_rules:t[`delete-rules`]});o(await c(`Creating`,async()=>l.rum.rules.bulkCreate({...f,account_id:d,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function m(e){return e.positional(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`host`,{type:`string`,description:`The host field`}).option(`inclusive`,{type:`boolean`,description:`Whether the rule includes or excludes traffic from being measured.`}).option(`is-paused`,{type:`boolean`,description:`Whether the rule is paused or not.`}).option(`paths`,{type:`string`,array:!0,description:`The paths field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create <ruleset-id>`,describe:`Creates a new rule in a Web Analytics ruleset.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf rum rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rule`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Creating`,async()=>d.rum.rules.create({body:e,account_id:f,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`});return}let p=a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths});o(await c(`Creating`,async()=>d.rum.rules.create({body:p,account_id:f,ruleset_id:t[`ruleset-id`]})),{successLabel:`Created`})}};function g(e){return e.positional(`rule-id`,{type:`string`,description:`The Web Analytics rule identifier.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <rule-id>`,describe:`Deletes an existing rule from a Web Analytics ruleset.`,builder:g,handler:async i=>{if(i.dryRun){s({command:`cf rum rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${i[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(i[`ruleset-id`]))}/rule/${i[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(i[`rule-id`]))}`,pathParams:{"ruleset-id":String(i[`ruleset-id`]??``),"rule-id":String(i[`rule-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await n(a);if(i.accountId=l,!await t({force:!!i.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>a.rum.rules.delete({account_id:l,ruleset_id:i[`ruleset-id`],rule_id:i[`rule-id`]})),{successLabel:`Deleted`})}};function v(e){return e.option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`Lists all the rules in a Web Analytics ruleset.`,builder:v,handler:async t=>{if(t.dryRun){s({command:`cf rum rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rules`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.rules.list({account_id:a,ruleset_id:t[`ruleset-id`]})),{successLabel:`Loaded`})}};function b(e){return e.positional(`rule-id`,{type:`string`,description:`The Web Analytics rule identifier.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The Web Analytics ruleset identifier.`,demandOption:!0}).option(`host`,{type:`string`,description:`The host field`}).option(`inclusive`,{type:`boolean`,description:`Whether the rule includes or excludes traffic from being measured.`}).option(`is-paused`,{type:`boolean`,description:`Whether the rule is paused or not.`}).option(`paths`,{type:`string`,array:!0,description:`The paths field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`update <rule-id>`,describe:`Updates a rule in a Web Analytics ruleset.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf rum rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/v2/${t[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(t[`ruleset-id`]))}/rule/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"ruleset-id":String(t[`ruleset-id`]??``),"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Updating`,async()=>d.rum.rules.update({body:e,account_id:f,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let p=a({host:l(t.host,`host`,`text`),inclusive:t.inclusive,is_paused:t[`is-paused`],paths:t.paths});o(await c(`Updating`,async()=>d.rum.rules.update({body:p,account_id:f,ruleset_id:t[`ruleset-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},S={command:`rules`,describe:`Operations for rules`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`auto-install`,{type:`boolean`,description:`If enabled, the JavaScript snippet is automatically injected for orange-clouded sites.`}).option(`host`,{type:`string`,description:`The hostname to use for gray-clouded sites.`}).option(`zone-tag`,{type:`string`,description:`The zone identifier.`}).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 w={command:`create`,describe:`Creates a new Web Analytics site.`,builder:C,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info`,pathParams:{},bodyKind:`json`,body:t.body===void 0?a({auto_install:t[`auto-install`],host:l(t.host,`host`,`text`),zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Creating`,async()=>d.rum.siteInfo.create({...e,account_id:f})),{successLabel:`Created`});return}let p=a({auto_install:t[`auto-install`],host:l(t.host,`host`,`text`),zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)});o(await c(`Creating`,async()=>d.rum.siteInfo.create({...p,account_id:f})),{successLabel:`Created`})}};function T(e){return e.positional(`site-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <site-id>`,describe:`Deletes an existing Web Analytics site.`,builder:T,handler:async i=>{if(i.dryRun){s({command:`cf rum site-info delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${i[`site-id`]==null?`<site-id>`:encodeURIComponent(String(i[`site-id`]))}`,pathParams:{"site-id":String(i[`site-id`]??``)},bodyKind:`none`});return}let a=await r(i),l=i.local?u:await n(a);if(i.accountId=l,!await t({force:!!i.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}o(await c(`Deleting`,async()=>a.rum.siteInfo.delete({account_id:l,site_id:i[`site-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`site-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <site-id>`,describe:`Retrieves a Web Analytics site.`,builder:D,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?u:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.rum.siteInfo.get({account_id:a,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function k(e){return e.option(`per-page`,{type:`number`,description:`Number of items to return per page of results.`}).option(`page`,{type:`number`,description:`Current page within the paginated list of results.`}).option(`order-by`,{type:`string`,description:`The property used to sort the list of results.`,choices:[`host`,`created`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Lists all Web Analytics sites of an account.`,builder:d(k),handler:async t=>{let i={per_page:t[`per-page`],page:t.page,order_by:t[`order-by`]};if(t.dryRun){s({command:`cf rum site-info list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/list`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),l=t.local?u:await n(a);t.accountId=l,o(await c(`Loading`,async()=>a.rum.siteInfo.list({account_id:l,...i})),{successLabel:`Loaded`})}};function j(e){return e.positional(`site-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`auto-install`,{type:`boolean`,description:`If enabled, the JavaScript snippet is automatically injected for orange-clouded sites.`}).option(`enabled`,{type:`boolean`,description:`Enables or disables RUM. This option can be used only when auto_install is set to true.`}).option(`host`,{type:`string`,description:`The hostname to use for gray-clouded sites.`}).option(`lite`,{type:`boolean`,description:`If enabled, the JavaScript snippet will not be injected for visitors from the EU.`}).option(`zone-tag`,{type:`string`,description:`The zone identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`update <site-id>`,describe:`Updates an existing Web Analytics site.`,builder:j,handler:async t=>{if(t.dryRun){s({command:`cf rum site-info update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/rum/site_info/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({auto_install:t[`auto-install`],enabled:t.enabled,host:l(t.host,`host`,`text`),lite:t.lite,zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)}):i(t.body)});return}let d=await r(t),f=t.local?u:await n(d);if(t.accountId=f,t.body){let e=i(t.body);o(await c(`Updating`,async()=>d.rum.siteInfo.update({...e,account_id:f,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let p=a({auto_install:t[`auto-install`],enabled:t.enabled,host:l(t.host,`host`,`text`),lite:t.lite,zone_tag:l(t[`zone-tag`],`zone-tag`,`text`)});o(await c(`Updating`,async()=>d.rum.siteInfo.update({...p,account_id:f,site_id:t[`site-id`]})),{successLabel:`Updated`})}},N={command:`site-info`,describe:`Operations for site-info`,builder:e=>e.command(w).command(E).command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`rum`,describe:`rum`,builder:e=>e.command(S).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
|
|
@@ -1,24 +0,0 @@
|
|
|
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}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./cli-types-CMNMD1V7.mjs";function p(e){return e.option(`kind`,{type:`string`,description:`The kind of the schema`,choices:[`openapi_v3`]}).option(`name`,{type:`string`,description:`A human-readable name for the schema`}).option(`source`,{type:`string`,description:`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`}).option(`validation-enabled`,{type:`boolean`,description:`An indicator if this schema is enabled`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:p,handler:async r=>{if(r.dryRun){l({command:`cf schema-validation schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/schema_validation/schemas`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({kind:d(r.kind,`kind`,`text`),name:d(r.name,`name`,`text`),source:d(r.source,`source`,`text`),validation_enabled:r[`validation-enabled`]}):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.schemaValidation.schemas.create({...e,zone_id:f})),{successLabel:`Created`});return}if(r.kind===void 0&&(r.kind=await t(`kind`,`The kind of the schema`,[`openapi_v3`])),r.name===void 0&&(r.name=await e(`name`,`A human-readable name for the schema`)),r.source===void 0&&(r.source=await e(`source`,`The raw schema, e.g., the OpenAPI schema, either as JSON or YAML`)),r[`validation-enabled`]===void 0)throw Error(`--validation-enabled is required (or pass --body with this field set).`);let p=s({kind:d(r.kind,`kind`,`text`),name:d(r.name,`name`,`text`),source:d(r.source,`source`,`text`),validation_enabled:r[`validation-enabled`]});c(await u(`Creating`,async()=>i.schemaValidation.schemas.create({...p,zone_id:f})),{successLabel:`Created`})}};function h(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,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 <schema-id>`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield. Operations using this schema will lose their validation rules.`,builder:h,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/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.
|
|
3
|
-
`);return}c(await u(`Deleting`,async()=>t.schemaValidation.schemas.delete({zone_id:i,schema_id:e[`schema-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,demandOption:!0}).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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <schema-id>`,describe:`Modifies an existing OpenAPI schema in API Shield, updating the validation rules for associated API operations.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/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?s({validation_enabled:e[`validation-enabled`]}):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.schemaValidation.schemas.edit({...n,zone_id:r,schema_id:e[`schema-id`]})),{successLabel:`Updated`});return}let i=s({validation_enabled:e[`validation-enabled`]});c(await u(`Updating`,async()=>t.schemaValidation.schemas.edit({...i,zone_id:r,schema_id:e[`schema-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,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 b={command:`get <schema-id>`,describe:`Gets the contents and metadata of a specific OpenAPI schema uploaded to API Shield.`,builder:y,handler:async e=>{let t={omit_source:e[`omit-source`]};if(e.dryRun){l({command:`cf schema-validation schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/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.schemaValidation.schemas.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}};function x(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 S={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone.`,builder:x,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf schema-validation schemas hosts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/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.schemaValidation.schemas.hosts.list({zone_id:i,...t})),{successLabel:`Loaded`})}},C={command:`hosts`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(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:`Filter for enabled schemas`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield with pagination support.`,builder:w,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 schema-validation schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/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.schemaValidation.schemas.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function E(e){return e.positional(`schema-id`,{type:`string`,description:`The unique identifier of the schema`,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 Web Asset Management or not. `new` will just return operations from the schema that do not exist otherwise. `existing` will just return operations from the schema that already exist.",choices:[`new`,`existing`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <schema-id>`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:f(E),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 schema-validation schemas operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/schemas/${e[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(e[`schema-id`]))}/operations`,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.schemaValidation.schemas.operations.get({zone_id:i,schema_id:e[`schema-id`],...t})),{successLabel:`Loaded`})}},O={command:`operations`,describe:`List schema hosts and extract operations from uploaded schemas`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},k={command:`schemas`,describe:`Uploaded API schemas used to validate incoming requests against expected formats`,builder:e=>e.command(m).command(g).command(v).command(b).command(T).command(C).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
|
|
4
|
-
Mitigation actions are as follows:
|
|
5
|
-
|
|
6
|
-
- \`"log"\` - log request when request does not conform to schema
|
|
7
|
-
- \`"block"\` - deny access to the site when request does not conform to schema
|
|
8
|
-
- \`"none"\` - skip running schema validation
|
|
9
|
-
`,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:`When set, this overrides both zone level and operation level mitigation actions.
|
|
10
|
-
|
|
11
|
-
- \`"none"\` - skip running schema validation entirely for the request
|
|
12
|
-
- \`null\` - clears any existing override
|
|
13
|
-
`,choices:[`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 j={command:`edit`,describe:`Partially updates global schema validation settings for a zone using PATCH semantics.`,builder:A,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,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.schemaValidation.settings.edit({body: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.schemaValidation.settings.edit({body:i,zone_id:r})),{successLabel:`Updated`})}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get`,describe:`Retrieves the current global schema validation settings for a zone.`,builder:M,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,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.schemaValidation.settings.get({zone_id:r})),{successLabel:`Loaded`})}};function P(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 F={command:`bulk-edit`,describe:`Updates schema validation settings for multiple API operations in a single request. Efficient for applying consistent validation rules across endpoints.`,builder:P,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/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.schemaValidation.settings.operations.bulkEdit({body:n,zone_id:r})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>i(t,`PATCH`,`/zones/${e.zoneId}/schema_validation/settings/operations`)),{successLabel:`Updated`})}};function I(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 L={command:`delete <operation-id>`,describe:`Removes custom schema validation settings for a specific API operation, reverting to zone-level defaults.`,builder:I,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/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.
|
|
14
|
-
`);return}c(await u(`Deleting`,async()=>t.schemaValidation.settings.operations.delete({zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Deleted`})}};function R(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 z={command:`get <operation-id>`,describe:`Retrieves the schema validation settings configured for a specific API operation.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/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),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.schemaValidation.settings.operations.get({zone_id:r,operation_id:e[`operation-id`]})),{successLabel:`Loaded`})}};function B(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 V={command:`list`,describe:`Lists all per-operation schema validation settings configured for the zone.`,builder:B,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf schema-validation settings operations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/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.schemaValidation.settings.operations.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function H(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` - clears any mitigation action\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 U={command:`update <operation-id>`,describe:`Fully updates schema validation settings for a specific API operation.`,builder:H,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings operations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings/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:`json`,body:e.body===void 0?s({mitigation_action:d(e[`mitigation-action`],`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.schemaValidation.settings.operations.update({...t,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Updated`});return}e[`mitigation-action`]===void 0&&(e[`mitigation-action`]=await t(`mitigation-action`,'When set, this applies a mitigation action to this operation - `"log"` - log request when request does not conform to schema for this operation - `"block"` - deny access to the site when request does not conform to schema for this operation - `"none"` - will skip mitigation for this operation - `null` - clears any mitigation action ',[`log`,`block`,`none`]));let f=s({mitigation_action:d(e[`mitigation-action`],`mitigation-action`,`text`)});c(await u(`Updating`,async()=>r.schemaValidation.settings.operations.update({...f,zone_id:i,operation_id:e[`operation-id`]})),{successLabel:`Updated`})}},W={command:`operations`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(F).command(L).command(z).command(V).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`validation-default-mitigation-action`,{type:`string`,description:`The default mitigation action used
|
|
15
|
-
Mitigation actions are as follows:
|
|
16
|
-
|
|
17
|
-
- \`"log"\` - log request when request does not conform to schema
|
|
18
|
-
- \`"block"\` - deny access to the site when request does not conform to schema
|
|
19
|
-
- \`"none"\` - skip running schema validation
|
|
20
|
-
`,choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:`When set, this overrides both zone level and operation level mitigation actions.
|
|
21
|
-
|
|
22
|
-
- \`"none"\` - skip running schema validation entirely for the request
|
|
23
|
-
- \`null\` - clears any existing override
|
|
24
|
-
`,choices:[`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 K={command:`update`,describe:`Fully updates global schema validation settings for a zone, replacing existing configuration.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf schema-validation settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/schema_validation/settings`,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.schemaValidation.settings.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 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 - `"none"` - skip running schema validation ',[`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.schemaValidation.settings.update({...f,zone_id:i})),{successLabel:`Updated`})}},q={command:`settings`,describe:`Zone-level schema validation settings including default actions for unmatched requests`,builder:e=>e.command(j).command(N).command(K).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},J={command:`schema-validation`,describe:`API schema validation settings — enforce request/response schemas and configure validation behavior`,builder:e=>e.command(k).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{J as default};
|
package/dist/scim-BiLfOQ89.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,T as t,_ as n,i as r,n as i}from"./auth-BqDOIrKX.mjs";import{t as a}from"./output-CUxZRM5A.mjs";import{n as o,t as s}from"./progress-Cent9Lsg.mjs";import{n as c,t as l}from"./input-validation-CTqtyiY9.mjs";import{t as u}from"./local-D8bhHUMK.mjs";import{t as d}from"./cli-types-CMNMD1V7.mjs";function f(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 p={command:`create`,describe:"Creates a new SCIM Group (user group) for the account. The `displayName` must not be empty and must not begin with `CF` (reserved for system groups).",builder:f,handler:async t=>{if(t.dryRun){o({command:`cf scim groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Groups`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function m(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <group-id>`,describe:`Deletes a SCIM Group (custom user groups only). System groups backed by Cloudflare permission groups cannot be deleted via SCIM. Returns 204 No Content on success.`,builder:m,handler:async r=>{if(r.dryRun){o({command:`cf scim groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${r[`group-id`]==null?`<group-id>`:encodeURIComponent(String(r[`group-id`]))}`,pathParams:{"group-id":String(r[`group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?u:await n(c);if(r.accountId=l,!await t({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}a(await s(`Deleting`,async()=>c.scim.groups.delete({account_id:l,group_id:r[`group-id`]})),{successLabel:`Deleted`})}};function g(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const _={command:`edit <group-id>`,describe:"Partially updates a SCIM Group via PATCH operations (RFC 7644 Section 3.5.2). Supports add, remove, and replace operations on `members`, `displayName`, and `externalId`. For system groups (prefixed `cloudflare-v1-`), only member management operations are supported.",builder:g,handler:async t=>{if(t.dryRun){o({command:`cf scim groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(t[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Groups/${encodeURIComponent(String(t[`group-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.positional(`group-id`,{type:`string`,description:"The group identifier for a SCIM Group resource. For system groups this is prefixed `cloudflare-v1-<permissionGroupTag>`; for custom user groups this is a UUID-style tag.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <group-id>`,describe:`Retrieves a single SCIM Group resource by group ID.`,builder:v,handler:async t=>{if(t.dryRun){o({command:`cf scim groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.groups.get({account_id:c,group_id:t[`group-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `displayName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:"Lists SCIM Group resources for the account. Returns both system groups (backed by Cloudflare permission groups, prefixed `cloudflare-v1-`) and custom user groups. Supports filtering by `displayName` using SCIM filter syntax.",builder:b,handler:async t=>{let r={startIndex:t[`start-index`],count:t.count,filter:t.filter};if(t.dryRun){o({command:`cf scim groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Groups`,pathParams:{},query:r,bodyKind:`none`});return}let c=await i(t),l=t.local?u:await n(c);t.accountId=l,a(await s(`Loading`,async()=>c.scim.groups.list({account_id:l,...r})),{successLabel:`Loaded`})}},S={command:`groups`,describe:`Groups operations`,builder:e=>e.command(p).command(h).command(_).command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`resource-type-id`,{type:`string`,description:`The resource type identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <resource-type-id>`,describe:"Returns a single SCIM resource type by ID (RFC 7643 Section 6). Valid IDs are `User` and `Group`.",builder:d(C),handler:async t=>{if(t.dryRun){o({command:`cf scim resource-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ResourceTypes/${t[`resource-type-id`]==null?`<resource-type-id>`:encodeURIComponent(String(t[`resource-type-id`]))}`,pathParams:{"resource-type-id":String(t[`resource-type-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.resourceTypes.get({account_id:c,resource_type_id:t[`resource-type-id`]})),{successLabel:`Loaded`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`list`,describe:`Returns the list of SCIM resource types supported by the Cloudflare SCIM service (RFC 7643 Section 6, RFC 7644 Section 4). Clients use this to discover available resource categories (e.g. Users, Groups) and their associated schemas. Query parameters are not supported on this endpoint.`,builder:T,handler:async t=>{if(t.dryRun){o({command:`cf scim resource-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ResourceTypes`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.resourceTypes.list({account_id:c})),{successLabel:`Loaded`})}},D={command:`resource-types`,describe:`Resource Types operations`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`schema-id`,{type:`string`,description:`The schema URI identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <schema-id>`,describe:"Returns a single SCIM schema definition by schema URI ID (RFC 7643 Section 7). Valid IDs are `urn:ietf:params:scim:schemas:core:2.0:User` and `urn:ietf:params:scim:schemas:core:2.0:Group`.",builder:O,handler:async t=>{if(t.dryRun){o({command:`cf scim schemas get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Schemas/${t[`schema-id`]==null?`<schema-id>`:encodeURIComponent(String(t[`schema-id`]))}`,pathParams:{"schema-id":String(t[`schema-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.schemas.get({account_id:c,schema_id:t[`schema-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Returns the list of SCIM schemas supported by the Cloudflare SCIM service (RFC 7643 Section 7, RFC 7644 Section 4). Clients use this to introspect the attributes of each resource type. Query parameters are not supported on this endpoint.`,builder:A,handler:async t=>{if(t.dryRun){o({command:`cf scim schemas list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Schemas`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.schemas.list({account_id:c})),{successLabel:`Loaded`})}},M={command:`schemas`,describe:`Schemas operations`,builder:e=>e.command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get`,describe:`Returns the SCIM 2.0 Service Provider configuration (RFC 7643 Section 5). IdPs use this endpoint to auto-configure their SCIM integration with Cloudflare, discovering which optional features (patch, bulk, filter, etc.) are supported.`,builder:N,handler:async t=>{if(t.dryRun){o({command:`cf scim service-provider-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/ServiceProviderConfig`,pathParams:{},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.serviceProviderConfig.get({account_id:c})),{successLabel:`Loaded`})}},F={command:`service-provider-config`,describe:`Service Provider Config operations`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(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 L={command:`create`,describe:"Provisions a new account member via SCIM. The `userName` field must be a valid email address and must match the primary email in `emails`. The account must be an Enterprise account with SCIM entitlements enabled.",builder:I,handler:async t=>{if(t.dryRun){o({command:`cf scim users create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users`,pathParams:{},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/scim/v2/Users`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function R(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const z={command:`edit <user-id>`,describe:'Partially updates a SCIM User via PATCH operations (RFC 7644 Section 3.5.2). Supports updating `userName`, `name.givenName`, `name.familyName`, and `active`. Setting `active: false` deprovisions the user (removes them from the account). For IdP compatibility, `emails[type eq "work"].value` is also accepted as an alias for `userName`.',builder:R,handler:async t=>{if(t.dryRun){o({command:`cf scim users edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PATCH`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function B(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <user-id>`,describe:`Retrieves a single account member as a SCIM User resource by user tag.`,builder:B,handler:async t=>{if(t.dryRun){o({command:`cf scim users get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`none`});return}let r=await i(t),c=t.local?u:await n(r);t.accountId=c,a(await s(`Loading`,async()=>r.scim.users.get({account_id:c,user_id:t[`user-id`]})),{successLabel:`Loaded`})}};function H(e){return e.option(`start-index`,{type:`number`,description:`The 1-based index of the first result in the current set of list results. Values less than 1 are treated as 1.`}).option(`count`,{type:`number`,description:`Specifies the desired maximum number of query results per page.`}).option(`filter`,{type:`string`,description:'SCIM filter expression (RFC 7644 Section 3.4.2.2). Only `userName eq "value"` is supported.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:'Lists account members as SCIM User resources. Supports optional filtering by `userName` (email) using the SCIM filter syntax (e.g. `userName eq "user@example.com"`). Pagination is controlled via `startIndex` and `count` query parameters per RFC 7644 Section 3.4.2.4.',builder:H,handler:async t=>{let r={startIndex:t[`start-index`],count:t.count,filter:t.filter};if(t.dryRun){o({command:`cf scim users list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users`,pathParams:{},query:r,bodyKind:`none`});return}let c=await i(t),l=t.local?u:await n(c);t.accountId=l,a(await s(`Loading`,async()=>c.scim.users.list({account_id:l,...r})),{successLabel:`Loaded`})}};function W(e){return e.positional(`user-id`,{type:`string`,description:`The user tag identifying a SCIM User resource (account member).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const G={command:`update <user-id>`,describe:"Replaces a SCIM User resource (RFC 7644 Section 3.5.1). Fully replaces the mutable attributes of the user. Supports updating `userName`, `name`, `emails`, and `active`.",builder:W,handler:async t=>{if(t.dryRun){o({command:`cf scim users update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/scim/v2/Users/${t[`user-id`]==null?`<user-id>`:encodeURIComponent(String(t[`user-id`]))}`,pathParams:{"user-id":String(t[`user-id`]??``)},bodyKind:`octet-stream`,body:t.body});return}let d=await i(t),f=t.local?u:await n(d);if(t.accountId=f,t.file){let e=l(t.file);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body){let e=c(t.body,`body`,`binary`);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/scim/v2/Users/${encodeURIComponent(String(t[`user-id`]))}`,{body:e,headers:{"Content-Type":`application/scim+json`}})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},K={command:`users`,describe:`Users operations`,builder:e=>e.command(L).command(z).command(V).command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`scim`,describe:`SCIM 2.0 provisioning — manage users, groups, and identity provider sync for your account`,builder:e=>e.command(S).command(D).command(M).command(F).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{C as e,S as t,_ as n,n as r}from"./auth-BqDOIrKX.mjs";import{n as i,t as a}from"./body-parser-CBpeIUns.mjs";import{t as o}from"./output-CUxZRM5A.mjs";import{n as s,t as c}from"./progress-Cent9Lsg.mjs";import{t as l}from"./local-D8bhHUMK.mjs";import{t as u}from"./cli-types-CMNMD1V7.mjs";function d(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`get`,describe:`Retrieves Security Center insight counts aggregated by classification class.`,builder:u(d),handler:async t=>{let i={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){s({command:`cf security-center insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights/class`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),u=t.local?l:await n(a);t.accountId=u,o(await c(`Loading`,async()=>a.securityCenter.insights.class.get({account_id:u,...i})),{successLabel:`Loaded`})}},p={command:`class`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`dismiss <issue-id>`,describe:`Archives a Security Center insight for an account, removing it from the active insights list while preserving historical data.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf security-center insights dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights/${t[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(t[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(t[`issue-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({dismiss:t.dismiss}):i(t.body)});return}let u=await r(t),d=t.local?l:await n(u);if(t.accountId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.securityCenter.insights.dismiss({...e,account_id:d,issue_id:t[`issue-id`]})),{successLabel:`Updated`});return}let f=a({dismiss:t.dismiss});o(await c(`Updating`,async()=>u.securityCenter.insights.dismiss({...f,account_id:d,issue_id:t[`issue-id`]})),{successLabel:`Updated`})}};function g(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`list`,describe:`Lists all Security Center insights for the account, showing security findings and recommendations.`,builder:u(g),handler:async t=>{let i={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject,page:t.page,per_page:t[`per-page`]};if(t.dryRun){s({command:`cf security-center insights list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),u=t.local?l:await n(a);t.accountId=u,o(await c(`Loading`,async()=>a.securityCenter.insights.list({account_id:u,...i})),{successLabel:`Loaded`})}};function v(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get`,describe:`Retrieves Security Center insight counts aggregated by severity level (critical, high, medium, low).`,builder:u(v),handler:async t=>{let i={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){s({command:`cf security-center insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights/severity`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),u=t.local?l:await n(a);t.accountId=u,o(await c(`Loading`,async()=>a.securityCenter.insights.severity.get({account_id:u,...i})),{successLabel:`Loaded`})}},b={command:`severity`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Retrieves Security Center insight counts aggregated by insight type.`,builder:u(x),handler:async t=>{let i={dismissed:t.dismissed,issue_class:t[`issue-class`],issue_type:t[`issue-type`],product:t.product,severity:t.severity,subject:t.subject};if(t.dryRun){s({command:`cf security-center insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights/type`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(t),u=t.local?l:await n(a);t.accountId=u,o(await c(`Loading`,async()=>a.securityCenter.insights.type.get({account_id:u,...i})),{successLabel:`Loaded`})}},C={command:`type`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},w={command:`insights`,describe:`Security findings and recommendations across your account — DNS, SSL, WAF misconfigurations, etc.`,builder:e=>e.command(h).command(_).command(p).command(b).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by classification class.`,builder:u(T),handler:async e=>{let n={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf security-center zone-insights class get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/security-center/insights/class`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.securityCenter.zoneInsights.class.get({zone_id:a,...n})),{successLabel:`Loaded`})}},D={command:`class`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <issue-id>`,describe:`Returns the full context payload for an insight. This endpoint is used for insights with large payloads that are not included inline in the list response.`,builder:O,handler:async t=>{if(t.dryRun){s({command:`cf security-center zone-insights context get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/security-center/insights/${t[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(t[`issue-id`]))}/context`,pathParams:{"issue-id":String(t[`issue-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=t.local?l:await n(i);t.accountId=a,o(await c(`Loading`,async()=>i.securityCenter.zoneInsights.context.get({account_id:a,issue_id:t[`issue-id`]})),{successLabel:`Loaded`})}},A={command:`context`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`update <issue-id>`,describe:`Archives a zone-specific Security Center insight, removing it from the active zone insights while preserving historical data.`,builder:j,handler:async e=>{if(e.dryRun){s({command:`cf security-center zone-insights dismiss update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/security-center/insights/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/dismiss`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"issue-id":String(e[`issue-id`]??``)},bodyKind:`json`,body:e.body===void 0?a({dismiss:e.dismiss}):i(e.body)});return}let n=await r(e),l=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=l,e.body){let t=i(e.body);o(await c(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...t,zone_id:l,issue_id:e[`issue-id`]})),{successLabel:`Updated`});return}let u=a({dismiss:e.dismiss});o(await c(`Updating`,async()=>n.securityCenter.zoneInsights.dismiss.update({...u,zone_id:l,issue_id:e[`issue-id`]})),{successLabel:`Updated`})}},N={command:`dismiss`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get`,describe:`Lists Security Center insights for a specific zone, showing zone-level security findings.`,builder:u(P),handler:async e=>{let n={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject,page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf security-center zone-insights get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/security-center/insights`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.securityCenter.zoneInsights.get({zone_id:a,...n})),{successLabel:`Loaded`})}};function I(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by severity level.`,builder:u(I),handler:async e=>{let n={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf security-center zone-insights severity get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/security-center/insights/severity`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.securityCenter.zoneInsights.severity.get({zone_id:a,...n})),{successLabel:`Loaded`})}},R={command:`severity`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Retrieves zone-specific Security Center insight counts aggregated by insight type.`,builder:u(z),handler:async e=>{let n={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf security-center zone-insights type get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/security-center/insights/type`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.securityCenter.zoneInsights.type.get({zone_id:a,...n})),{successLabel:`Loaded`})}},V={command:`type`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},H={command:`zone-insights`,describe:`Zone-scoped security insights — counts by class, severity, type, and dismissal`,builder:e=>e.command(F).command(D).command(A).command(N).command(R).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`security-center`,describe:`Security posture dashboard — view and manage security insights, misconfigurations, and vulnerabilities`,builder:e=>e.command(w).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{U as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,T 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(`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 u={command:`delete`,describe:`Removes the security.txt file configuration for a zone. The /.well-known/security.txt endpoint will no longer be served.`,builder:l,handler:async r=>{if(r.dryRun){o({command:`cf security-txt delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await e({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await t({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}a(await s(`Deleting`,async()=>i.securityTxt.delete({zone_id:c})),{successLabel:`Deleted`})}};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 current security.txt file configuration for a zone, used for security vulnerability reporting.`,builder:d,handler:async t=>{if(t.dryRun){o({command:`cf security-txt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.securityTxt.get({zone_id:i})),{successLabel:`Loaded`})}};function p(e){return e.option(`acknowledgments`,{type:`string`,array:!0,description:`The acknowledgments field`}).option(`canonical`,{type:`string`,array:!0,description:`The canonical field`}).option(`contact`,{type:`string`,array:!0,description:`The contact field`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`encryption`,{type:`string`,array:!0,description:`The encryption field`}).option(`expires`,{type:`string`,description:`The expires field`}).option(`hiring`,{type:`string`,array:!0,description:`The hiring field`}).option(`policy`,{type:`string`,array:!0,description:`The policy field`}).option(`preferred-languages`,{type:`string`,description:`The preferred_languages field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`update`,describe:`Updates the security.txt file configuration for a zone, which provides security researchers with vulnerability reporting information.`,builder:p,handler:async t=>{if(t.dryRun){o({command:`cf security-txt update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/security-center/securitytxt`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({acknowledgments:t.acknowledgments,canonical:t.canonical,contact:t.contact,enabled:t.enabled,encryption:t.encryption,expires:c(t.expires,`expires`,`text`),hiring:t.hiring,policy:t.policy,preferred_languages:c(t[`preferred-languages`],`preferred-languages`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Updating`,async()=>l.securityTxt.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=i({acknowledgments:t.acknowledgments,canonical:t.canonical,contact:t.contact,enabled:t.enabled,encryption:t.encryption,expires:c(t.expires,`expires`,`text`),hiring:t.hiring,policy:t.policy,preferred_languages:c(t[`preferred-languages`],`preferred-languages`,`text`)});a(await s(`Updating`,async()=>l.securityTxt.update({body:d,zone_id:u})),{successLabel:`Updated`})}},h={command:`security-txt`,describe:`Manage the /.well-known/security.txt file that tells security researchers how to report vulnerabilities`,builder:e=>e.command(u).command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
|
package/dist/shared-0bwWVDLo.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./session-CsvPYFj8.mjs";import{T as t,c as n,l as r,u as i}from"./dist-DpDjsWWn.mjs";import{a,o}from"./theme-CFHr0Dh9.mjs";import"./ui-B97lRnOv.mjs";import{O as s,_ as c,n as l,r as u}from"./auth-BqDOIrKX.mjs";import{i as d,m as f,n as p,o as m,t as h}from"./dist-DA54ZQu0.mjs";import{a as g,c as _,i as v,n as y,o as b,r as x,s as S}from"./build-BE4o4imx.mjs";import{existsSync as C,readFileSync as w,statSync as T}from"node:fs";import E from"node:assert";import{dirname as D,join as O,sep as k}from"node:path";function A(a){let o={apiToken:a},c=e,l=!!process.env.DEBUG,u={loggerLevel:l?`debug`:`log`,debug:l?(...e)=>p.message(e.join(` `),{spacing:0}):()=>{},debugWithSanitization:l?(e,...n)=>{t()?p.message(`${e} omitted; set WRANGLER_LOG_SANITIZE=false to include sanitized data`,{spacing:0}):p.message([e,...n].join(` `),{spacing:0})}:()=>{},log:(...e)=>p.message(e.join(` `),{spacing:0}),info:(...e)=>p.message(e.join(` `),{spacing:0}),warn:(...e)=>p.warn(String(e.join(` `)),{spacing:0}),error:(...e)=>p.error(String(e.join(` `)),{spacing:0})};return{fetchResult:(e,t,n,r,a)=>i(e,t,n,c,u,r,a,o),fetchListResult:(e,t,n,i)=>r(e,t,n,c,u,i,o),fetchPagedListResult:(e,t,n,i)=>r(e,t,n,c,u,i,o),fetchKVGetValue:(e,t,r,i)=>n(e,t,r,i,c,u,o),logger:u,confirm:async(e,t)=>{if(s())return t?.fallbackValue??t?.defaultValue??!1;let n=await h({message:e,initialValue:t?.defaultValue??!1});return f(n)&&process.exit(130),n===!0},prompt:async(e,t)=>{if(s())return t?.defaultValue??``;let n=await m({message:e,defaultValue:t?.defaultValue});return f(n)&&process.exit(130),n},select:async(e,t)=>{let{choices:n,defaultOption:r,fallbackOption:i}=t;if(s()){let e=n[i??r??0]??n[0];if(!e)throw Error(`select() called with no choices`);return e.value}let a=await d({message:e,options:n.map(e=>({value:e.value,label:e.title,...e.description?{hint:e.description}:{}})),initialValue:r===void 0?void 0:n[r]?.value});return f(a)&&process.exit(130),a}}}const j={esm:`esm`,cjs:`commonjs`,python:`python`,"python-requirement":`python-requirement`,wasm:`compiled-wasm`,text:`text`,data:`buffer`,json:`text`};function M(e,t,n,r){let i=process.cwd(),a=t.main??``;return{entry:{file:a,projectRoot:i,configPath:e.configPath,format:`modules`,moduleRoot:a?D(a):e.bundlePath,exports:[]},name:e.workerName,compatibilityDate:t.compatibility_date,compatibilityFlags:t.compatibility_flags??[],assetsDir:I(e,t),main:t.main??void 0,keepVars:t.keep_vars??!1,dryRun:r[`dry-run`],env:void 0,outfile:void 0,tag:r.tag,message:r.message,secretsFile:void 0,experimentalAutoCreate:!0,accountId:n,sendMetrics:!1,resourcesProvision:!0,skipProvisioningConfigWriteback:!0,skipLastDeployedFromApiCheck:!1,cliVars:{},isWorkersSite:!1,useServiceEnvApiPath:!1}}function N(e,t,n,r){return{...M(e,t,n,r),command:`deploy`,containersRollout:void 0,triggers:t.triggers?.crons,routes:F(t),logpush:t.logpush,dispatchNamespace:void 0,strict:!0,legacyAssetPaths:void 0,oldAssetTtl:void 0}}function P(e,t,n,r){return{...M(e,t,n,r),command:`versions upload`,strict:!0,previewAlias:r[`preview-alias`]}}function F(e){return e.routes?e.routes:e.route?[e.route]:[]}function I(e,t){let n=e.assetsDir??t.assets?.directory;if(!n)return;let r=!!t.main,i=t.assets?.run_worker_first;if(!r&&i)throw new x(`assets.run_worker_first requires a Worker entrypoint, but no main module is configured.`);return{directory:n,binding:t.assets?.binding,directoryExists:C(n)}}function L(e,t,n){let{mainModule:r,modules:i}=t.manifest??{};if(!r)return{modules:[],sourceMaps:void 0,dependencies:{},resolvedEntryPointPath:``,bundleType:`esm`,content:``};R(r,e.bundlePath);let a=O(e.bundlePath,r);if(!C(a))throw new x(`Main module not found: ${a}`);let o=i?.[r]?.type??`esm`;if(o===`sourcemap`)throw new x(`Main module "${r}" cannot be a sourcemap.`);let s=w(a,`utf8`),c=j[o],l=[],u=[],d={};if(d[a]={bytesInOutput:T(a).size},i)for(let[t,a]of Object.entries(i)){if(t===r)continue;R(t,e.bundlePath);let i=O(e.bundlePath,t);if(a.type===`sourcemap`){n&&C(i)&&u.push({name:t,content:w(i,`utf8`)});continue}if(!C(i))throw new x(`Module not found: ${i}`);let o=a.type===`wasm`||a.type===`data`?w(i):w(i,`utf8`);l.push({name:`./${t}`,filePath:i,content:o,type:j[a.type]}),d[i]={bytesInOutput:T(i).size}}return{modules:l,sourceMaps:u.length>0?u:void 0,dependencies:d,resolvedEntryPointPath:a,bundleType:c,content:s}}function R(e,t){let n=O(t,e);if(n!==t&&!n.startsWith(t+k))throw new x(`Module path "${e}" escapes the bundle directory.`)}function z(e){return e.option(`mode`,{type:`string`,alias:`m`,description:`Deployment mode (e.g. production, staging, preview)`}).option(`prebuilt`,{type:`boolean`,description:`Deploy existing Build Output API files without building`,default:!1}).option(`tag`,{type:`string`,description:`A tag to associate with this Worker Version`,requiresArg:!0}).option(`message`,{type:`string`,description:`A message to associate with this Worker Version`,requiresArg:!0}).option(`dry-run`,{describe:`Build a project and run checks without actually uploading the Worker`,type:`boolean`,default:!1})}async function B(e,t){e.prebuilt||(await y(e.mode),p.message(``,{spacing:0}));let n=g(),r=n.workers[0];E(r&&n.workers.length===1,`There should be only one worker`);let{wranglerConfig:i,builtConfig:s}=v(r),d=L(r,s,i.upload_source_maps),f=await u(),m=await c(await l(e));if(_(A(f)),t.command===`Deploy`){let t=N(r,i,m,e);p.message(a.bold(`Deploy`),{symbol:o.dim(`├`),spacing:0}),await b(t,i,d,{syncWorkersSite:void 0,getNormalizedContainerOptions:void 0,buildContainer:void 0,deployContainers:void 0,analyseBundle:void 0})}else{let t=P(r,i,m,e);p.message(a.bold(`Upload`),{symbol:o.dim(`├`),spacing:0}),await S(t,i,d,{analyseBundle:void 0})}p.success(e[`dry-run`]?`Dry run complete`:`${t.command} complete`)}export{z as n,B as t};
|
package/dist/speed-BzRY3Xlh.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{S as e,T as t,n}from"./auth-BqDOIrKX.mjs";import{n as r}from"./body-parser-CBpeIUns.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"./cli-types-CMNMD1V7.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Retrieves quota for all plans, as well as the current zone quota.`,builder:c,handler:async t=>{if(t.dryRun){a({command:`cf speed availabilities list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/availabilities`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.speed.availabilities.list({zone_id:s})),{successLabel:`Loaded`})}},u={command:`availabilities`,describe:`Operations for availabilities`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`list`,describe:`Lists all webpages which have been tested.`,builder:d,handler:async t=>{if(t.dryRun){a({command:`cf speed pages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/pages`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.speed.pages.list({zone_id:s})),{successLabel:`Loaded`})}};function p(e){return e.positional(`url`,{type:`string`,description:`A URL.`,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 m={command:`create <url>`,describe:`Starts a test for a specific webpage, in a specific region.`,builder:p,handler:async t=>{if(t.dryRun){a({command:`cf speed pages tests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/pages/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}/tests`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``)},bodyKind:`json`,body:t.body===void 0?void 0:r(t.body)});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});if(t.zoneId=c,t.body){let e=r(t.body);i(await o(`Creating`,async()=>s.speed.pages.tests.create({...e,zone_id:c,url:t.url})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>s.speed.pages.tests.create({zone_id:c,url:t.url})),{successLabel:`Created`})}};function h(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`]}).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 <url>`,describe:`Deletes all tests for a specific webpage from a specific region. Deleted tests are still counted as part of the quota.`,builder:s(h),handler:async r=>{let s={region:r.region};if(r.dryRun){a({command:`cf speed pages tests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/speed_api/pages/${r.url==null?`<url>`:encodeURIComponent(String(r.url))}/tests`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),url:String(r.url??``)},query:s,bodyKind:`none`});return}let c=await n(r),l=await e({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await t({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>c.speed.pages.tests.delete({zone_id:l,url:r.url,...s})),{successLabel:`Deleted`})}};function _(e){return e.positional(`test-id`,{type:`string`,description:`Test ID`,demandOption:!0}).option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <test-id>`,describe:`Retrieves the result of a specific test.`,builder:_,handler:async t=>{if(t.dryRun){a({command:`cf speed pages tests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/pages/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}/tests/${t[`test-id`]==null?`<test-id>`:encodeURIComponent(String(t[`test-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``),"test-id":String(t[`test-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.speed.pages.tests.get({zone_id:s,url:t.url,test_id:t[`test-id`]})),{successLabel:`Loaded`})}};function y(e){return e.option(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Test history (list of tests) for a specific webpage.`,builder:s(y),handler:async t=>{let r={page:t.page,per_page:t[`per-page`],region:t.region};if(t.dryRun){a({command:`cf speed pages tests list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/pages/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}/tests`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``)},query:r,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.speed.pages.tests.list({zone_id:c,url:t.url,...r})),{successLabel:`Loaded`})}},x={command:`tests`,describe:`Operations for pages.tests`,builder:e=>e.command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`],demandOption:!0}).option(`device-type`,{type:`string`,description:`The type of device.`,choices:[`DESKTOP`,`MOBILE`],demandOption:!0}).option(`start`,{type:`string`,description:`Start`,demandOption:!0}).option(`end`,{type:`string`,description:`End`}).option(`tz`,{type:`string`,description:`The timezone of the start and end timestamps.`,demandOption:!0}).option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to include in the results.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`trend <url>`,describe:`Lists the core web vital metrics trend over time for a specific page.`,builder:s(S),handler:async t=>{let r={region:t.region,deviceType:t[`device-type`],start:t.start,end:t.end,tz:t.tz,metrics:t.metrics};if(t.dryRun){a({command:`cf speed pages trend`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/pages/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}/trend`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``)},query:r,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.speed.pages.trend({zone_id:c,url:t.url,...r})),{successLabel:`Loaded`})}},w={command:`pages`,describe:`Operations for pages`,builder:e=>e.command(f).command(C).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`]}).option(`frequency`,{type:`string`,description:`The frequency of the scheduled test. Defaults to WEEKLY for free plans, DAILY for paid plans.`,choices:[`DAILY`,`WEEKLY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`create <url>`,describe:`Creates a scheduled test for a page.`,builder:s(T),handler:async t=>{let r={region:t.region,frequency:t.frequency};if(t.dryRun){a({command:`cf speed schedule create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/schedule/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``)},query:r,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Creating`,async()=>s.speed.schedule.create({zone_id:c,url:t.url,...r})),{successLabel:`Created`})}};function D(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const O={command:`delete <url>`,describe:`Deletes a scheduled test for a page.`,builder:s(D),handler:async r=>{let s={region:r.region};if(r.dryRun){a({command:`cf speed schedule delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/speed_api/schedule/${r.url==null?`<url>`:encodeURIComponent(String(r.url))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),url:String(r.url??``)},query:s,bodyKind:`none`});return}let c=await n(r),l=await e({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await t({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting`,async()=>c.speed.schedule.delete({zone_id:l,url:r.url,...s})),{successLabel:`Deleted`})}};function k(e){return e.positional(`url`,{type:`string`,description:`A URL.`,demandOption:!0}).option(`region`,{type:`string`,description:`A test region.`,choices:[`asia-east1`,`asia-northeast1`,`asia-northeast2`,`asia-south1`,`asia-southeast1`,`australia-southeast1`,`europe-north1`,`europe-southwest1`,`europe-west1`,`europe-west2`,`europe-west3`,`europe-west4`,`europe-west8`,`europe-west9`,`me-west1`,`southamerica-east1`,`us-central1`,`us-east1`,`us-east4`,`us-south1`,`us-west1`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get <url>`,describe:`Retrieves the test schedule for a page in a specific region.`,builder:s(k),handler:async t=>{let r={region:t.region};if(t.dryRun){a({command:`cf speed schedule get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/speed_api/schedule/${t.url==null?`<url>`:encodeURIComponent(String(t.url))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),url:String(t.url??``)},query:r,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,i(await o(`Loading`,async()=>s.speed.schedule.get({zone_id:c,url:t.url,...r})),{successLabel:`Loaded`})}},j={command:`schedule`,describe:`Operations for schedule`,builder:e=>e.command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`speed`,describe:`speed`,builder:e=>e.command(u).command(w).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{M as default};
|