cf 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +26 -21
- package/dist/_meta/commands.json +7696 -18100
- package/dist/_meta/schemas.json +6411 -13925
- package/dist/{abuse-reports-dMIfUJ8v.mjs → abuse-reports-Dy76QPNP.mjs} +1 -1
- package/dist/{accounts-Kx1epdA1.mjs → accounts-CjtZ8x1z.mjs} +2 -2
- package/dist/{acm-Utu252kC.mjs → acm-C2lYIWs1.mjs} +1 -1
- package/dist/{addressing-CBq7Z7Vq.mjs → addressing-CHFK6uxW.mjs} +1 -1
- package/dist/{agent-context-BGTU299M.mjs → agent-context-CgGCT0xU.mjs} +1 -1
- package/dist/{ai-DOOKLPkG.mjs → ai-DS3i-I1a.mjs} +1 -1
- package/dist/{ai-gateway-Cj1T3avF.mjs → ai-gateway-RIsegO2x.mjs} +1 -1
- package/dist/ai-search-Dcj4BauG.mjs +7 -0
- package/dist/{ai_gateway-C3fH22C0.mjs → ai_gateway-w7YwfcPE.mjs} +1 -1
- package/dist/{alerting-CqmEIaKn.mjs → alerting-Bk85NNf5.mjs} +1 -1
- package/dist/{analytics-Dv-X8x7D.mjs → analytics-CkhhhZWZ.mjs} +1 -1
- package/dist/{analytics_engine-DdXVR8z2.mjs → analytics_engine-B7qgDJCA.mjs} +1 -1
- package/dist/{api-gateway-CNv0IHTU.mjs → api-gateway-CWdR4Ne7.mjs} +1 -1
- package/dist/{argo-CX_A4kcn.mjs → argo-DnJRVnGX.mjs} +1 -1
- package/dist/artifacts-BVWKiJUl.mjs +4 -0
- package/dist/{audit-logs-BfBf3oo-.mjs → audit-logs-DjTstbzL.mjs} +1 -1
- package/dist/auth-BqDOIrKX.mjs +150 -0
- package/dist/auth-DKkSwnxh.mjs +5 -0
- package/dist/billing-3rEqF83h.mjs +2 -0
- package/dist/{bot-management-CFvtVx62.mjs → bot-management-CJxD1pqi.mjs} +1 -1
- package/dist/{botnet-feed-B-M4Yu0W.mjs → botnet-feed-MG91D7BR.mjs} +1 -1
- package/dist/{brand-protection-D05Eg-_6.mjs → brand-protection-CK7gJi06.mjs} +1 -1
- package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
- package/dist/{build-DYkGW4dh.mjs → build-BE4o4imx.mjs} +131 -131
- package/dist/{cache-DsoW6Xwv.mjs → cache-B7pRbpTy.mjs} +1 -1
- package/dist/{calls-CZbO7TyR.mjs → calls-DXRWsZ8n.mjs} +3 -3
- package/dist/{certificate-authorities-D2yr7_3t.mjs → certificate-authorities-BR3gXBLs.mjs} +1 -1
- package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
- package/dist/{client-certificates-MJcDsTId.mjs → client-certificates-B0ebLJdk.mjs} +1 -1
- package/dist/{cloud-connector-DWOrN2eM.mjs → cloud-connector-BOjaggJk.mjs} +1 -1
- package/dist/{cloudforce-one-2Bhz8YdW.mjs → cloudforce-one-B6HYfk5Z.mjs} +1 -1
- package/dist/{completions-BwRpZQVn.mjs → completions-D_9WsLG7.mjs} +1 -1
- package/dist/config-7CBz8Xm0.mjs +2 -0
- package/dist/{connectivity-BX8C7tvK.mjs → connectivity-welFvZ7X.mjs} +1 -1
- package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
- package/dist/connectors-3vjrdFLB.mjs +3 -0
- package/dist/content-scanning-CnW2A0pv.mjs +4 -0
- package/dist/{context-DGlHRGWM.mjs → context-CONbNKO-.mjs} +1 -1
- package/dist/{custom-certificates-aAiEguR7.mjs → custom-certificates-CnYh6Yi-.mjs} +1 -1
- package/dist/{custom-hostnames-AG5yBHIi.mjs → custom-hostnames-C2upqZso.mjs} +1 -1
- package/dist/{custom-nameservers-D1DtlRue.mjs → custom-nameservers-BGkAD_PZ.mjs} +1 -1
- package/dist/{custom-pages-DQCi2plU.mjs → custom-pages-5fCSP8in.mjs} +1 -1
- package/dist/{d1-DbnYhw45.mjs → d1-CyiRbZZn.mjs} +1 -1
- package/dist/data-security-Casx4OS_.mjs +6 -0
- package/dist/{dcv-delegation-CHspSzTI.mjs → dcv-delegation-DVYO10oA.mjs} +1 -1
- package/dist/{deploy-CQial3kN.mjs → deploy-KBRFIatG.mjs} +1 -1
- package/dist/{dev-B38LfCTl.mjs → dev-pPazzZvt.mjs} +1 -1
- package/dist/{diagnostics-BJQGjVJn.mjs → diagnostics-BqYDoDfw.mjs} +1 -1
- package/dist/{dispatch-namespaces-DmHvoBOg.mjs → dispatch-namespaces-Cz2rajnP.mjs} +1 -1
- package/dist/{dist-AIcZFk0U.mjs → dist-DA54ZQu0.mjs} +7 -7
- package/dist/dist-DpDjsWWn.mjs +306 -0
- package/dist/{dns-VMhQSr5n.mjs → dns-62t95Xif.mjs} +1 -1
- package/dist/{dns-firewall-B4DVXFBQ.mjs → dns-firewall-Coy8d47t.mjs} +1 -1
- package/dist/{durable-objects-CTboySEo.mjs → durable-objects-BSuRERkw.mjs} +1 -1
- package/dist/{email-routing-tIR2SFu-.mjs → email-routing-BDUYYeV3.mjs} +1 -1
- package/dist/{email-security-Ca1id3rZ.mjs → email-security-ChHA6eqQ.mjs} +1 -1
- package/dist/{email-sending-DwWKc5jC.mjs → email-sending-CVrRqn6S.mjs} +1 -1
- package/dist/{filters-A4dg_a68.mjs → filters-qJpU9uAS.mjs} +1 -1
- package/dist/{firewall-DWPQgYd9.mjs → firewall-C3DDwfwh.mjs} +1 -1
- package/dist/{fraud-BMkSsJGU.mjs → fraud-DY3YXFVf.mjs} +1 -1
- package/dist/{google-tag-gateway-BGD49nRC.mjs → google-tag-gateway-B00MHDfB.mjs} +1 -1
- package/dist/{healthchecks-CtIfrFql.mjs → healthchecks-Drvb79v0.mjs} +1 -1
- package/dist/{hostnames-BiomxukN.mjs → hostnames-BdAQo1Mr.mjs} +1 -1
- package/dist/{hyperdrive-Da104VaQ.mjs → hyperdrive-99OJV9nl.mjs} +1 -1
- package/dist/{iam-BIGKo0WW.mjs → iam-BRbpg3lN.mjs} +1 -1
- package/dist/images-D1jI3r3O.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/{intel-CY6_79v8.mjs → intel-C3ajLpXd.mjs} +1 -1
- package/dist/{ips-K4bzaGqd.mjs → ips-B6JETVOY.mjs} +1 -1
- package/dist/{keyless-certificates-CZC-L8gM.mjs → keyless-certificates-C4MZ4xnf.mjs} +1 -1
- package/dist/{kv-8o27w_pY.mjs → kv-CSWoD9ks.mjs} +1 -1
- package/dist/{leaked-credential-checks-qLzRyu85.mjs → leaked-credential-checks-Dgs2oKm9.mjs} +2 -2
- package/dist/{load-balancers-DtG8nj25.mjs → load-balancers-Du1tNuUt.mjs} +1 -1
- package/dist/{logpush-4L0njy1d.mjs → logpush-SuJyO-uX.mjs} +1 -1
- package/dist/{logs-B_Yp95hv.mjs → logs-DcDNRPRl.mjs} +1 -1
- package/dist/{magic-cloud-networking-CSOM3EM-.mjs → magic-cloud-networking-D-T0RCvi.mjs} +1 -1
- package/dist/{magic-network-monitoring-BnwvM4-I.mjs → magic-network-monitoring-CqtvOePQ.mjs} +1 -1
- package/dist/{magic-transit-CXDyvhxq.mjs → magic-transit-BTbkhBtF.mjs} +32 -33
- package/dist/{managed-transforms-D15yVbZx.mjs → managed-transforms-CfUBSz9p.mjs} +1 -1
- package/dist/{mtls-certificates-D8k0AXWK.mjs → mtls-certificates-Cf1O8c2E.mjs} +1 -1
- package/dist/{network-interconnects-rrr7red3.mjs → network-interconnects-DsiNytOU.mjs} +1 -1
- package/dist/{observability-DWvpqnQJ.mjs → observability-CLqZ7OSi.mjs} +1 -1
- package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
- package/dist/{organizations-T77D50Sq.mjs → organizations-aRi1bhFC.mjs} +2 -2
- package/dist/{origin-ca-certificates-DXIvD8H5.mjs → origin-ca-certificates-BB4H89a_.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-C8oOczyV.mjs → origin-post-quantum-encryption-DurP3PXG.mjs} +1 -1
- package/dist/{origin-tls-client-auth-CaVW1Ztp.mjs → origin-tls-client-auth-CnQNy9-l.mjs} +1 -1
- package/dist/{output-BJFNwj7b.mjs → output-CUxZRM5A.mjs} +1 -1
- package/dist/{page-rules-CjZPTMQX.mjs → page-rules-CYqtPU1p.mjs} +1 -1
- package/dist/{page-shield-D5RRNJCY.mjs → page-shield-D8l9ZMUl.mjs} +1 -1
- package/dist/{pages-CWJtJnL0.mjs → pages-ChurJ2H7.mjs} +1 -1
- package/dist/{pipelines-B0L_7j9e.mjs → pipelines-CeyujvRf.mjs} +1 -1
- package/dist/{progress-CrCGTq7N.mjs → progress-Cent9Lsg.mjs} +1 -1
- package/dist/{queues-CN6DPhRR.mjs → queues-Rf_n11Cx.mjs} +1 -1
- package/dist/{r2-DQIcyRtA.mjs → r2-BtuTO3vQ.mjs} +1 -1
- package/dist/{r2-data-catalog-Bbo93TJx.mjs → r2-data-catalog-Debz38kv.mjs} +1 -1
- package/dist/radar-CzGM92uM.mjs +2 -0
- package/dist/{rate-limits-DcrQV6Ar.mjs → rate-limits-Bbk7HxP7.mjs} +1 -1
- package/dist/{raw-fetch-Dlccg0Tr.mjs → raw-fetch-DnbAMFBp.mjs} +1 -1
- package/dist/{realtime-kit-CaquuVOE.mjs → realtime-kit-CivLpkpg.mjs} +1 -1
- package/dist/{registrar-Ko-xZemf.mjs → registrar-8IeA5DKd.mjs} +1 -1
- package/dist/{request-tracers-DOW_reTJ.mjs → request-tracers-D1aH4NmL.mjs} +1 -1
- package/dist/{resource-sharing-D7TX0JV0.mjs → resource-sharing-B-Pcto7-.mjs} +3 -3
- package/dist/{resource-tagging-C3qtLzCz.mjs → resource-tagging-Bpb6Qq1M.mjs} +1 -1
- package/dist/{rules-BXRADHL5.mjs → rules-B10XWY10.mjs} +1 -1
- package/dist/{rulesets-CBgpeSvJ.mjs → rulesets-lYczEcJp.mjs} +1 -1
- package/dist/{rum-BjPptTUP.mjs → rum-B5GUKa4I.mjs} +3 -3
- package/dist/{schema-D16TgWBg.mjs → schema-hefO-tzo.mjs} +1 -1
- package/dist/{schema-validation-Dgv_opM3.mjs → schema-validation-DTq517Em.mjs} +1 -1
- package/dist/{scim-DdSEr4kZ.mjs → scim-BiLfOQ89.mjs} +1 -1
- package/dist/{secrets-store-7BfyvJLb.mjs → secrets-store-CBX0dvHL.mjs} +1 -1
- package/dist/{security-center-DAy6AKtT.mjs → security-center-AVpTOBK3.mjs} +1 -1
- package/dist/{security-txt-xAMb7K6Y.mjs → security-txt-DVlh8y9l.mjs} +1 -1
- package/dist/{session-COHHdS7A.mjs → session-CsvPYFj8.mjs} +2 -2
- package/dist/shared-0bwWVDLo.mjs +2 -0
- package/dist/{smart-shield-TeWZFnH2.mjs → smart-shield-DblHIce0.mjs} +1 -1
- package/dist/{snippets-CCSsCXVs.mjs → snippets-DrpqSXYC.mjs} +1 -1
- package/dist/{spawn-DcppKGI5.mjs → spawn-DK7pott_.mjs} +1 -1
- package/dist/{spectrum-CTTZID8u.mjs → spectrum-CnrG0jIC.mjs} +2 -2
- package/dist/speed-BzRY3Xlh.mjs +4 -0
- package/dist/{src-BW6vfAwE.mjs → src-D9_Gq68b.mjs} +10 -10
- package/dist/{ssl-BWA2LdwC.mjs → ssl-Cp6tQkZH.mjs} +1 -1
- package/dist/stream-CGTRN4ZN.mjs +14 -0
- package/dist/{tenants-Bd7NGQ_m.mjs → tenants-o_M62Y1n.mjs} +1 -1
- package/dist/{token-validation-DAgtFOvs.mjs → token-validation-Ca5AGEns.mjs} +1 -1
- package/dist/{tools-DXQmfFuE.mjs → tools-DtNNmO6l.mjs} +1 -1
- package/dist/{turnstile-cfdaO4ca.mjs → turnstile-l7mo9BWL.mjs} +2 -2
- package/dist/{ui-D4KtlMh9.mjs → ui-B97lRnOv.mjs} +1 -1
- package/dist/{url-normalization-B5RN4nLD.mjs → url-normalization-D1CogSIG.mjs} +1 -1
- package/dist/{url-scanner-BrZ1L9OC.mjs → url-scanner-BnJHJqcz.mjs} +1 -1
- package/dist/{user-CAo-yCJA.mjs → user-CiyYZ69X.mjs} +2 -2
- package/dist/{vectorize-C7_oQlaI.mjs → vectorize-D3LgMLOn.mjs} +1 -1
- package/dist/{versions-CUwWJWmy.mjs → versions-B6E8WQyA.mjs} +1 -1
- package/dist/{waiting-rooms-Dln5ICg5.mjs → waiting-rooms-Bhy_nuV3.mjs} +1 -1
- package/dist/{web3-HQJRm38W.mjs → web3-DlHE0CZc.mjs} +1 -1
- package/dist/{workers-Dg7ddG2Q.mjs → workers-DRAkU6YR.mjs} +1 -1
- package/dist/{workers-builds-AVfx8IyL.mjs → workers-builds-BmNjiHDZ.mjs} +1 -1
- package/dist/{workflows-VquuSh2J.mjs → workflows-z6oapEJs.mjs} +1 -1
- package/dist/{zaraz-xYSWIV4P.mjs → zaraz-CyzfYOEU.mjs} +1 -1
- package/dist/{zero-trust-CP96wnSh.mjs → zero-trust-fyyIelWx.mjs} +44 -44
- package/dist/zero_trust-BAhlNkjo.mjs +3 -0
- package/dist/{zones-BSgmZ9WC.mjs → zones-MSULnDwW.mjs} +4 -4
- package/package.json +4 -4
- package/dist/ai-search-CQF_Sn7d.mjs +0 -7
- package/dist/auth-SyWhMmPu.mjs +0 -6
- package/dist/auth-ffdf9yR0.mjs +0 -135
- package/dist/autorag-BuGhGTeZ.mjs +0 -2
- package/dist/billing-PoG81XaQ.mjs +0 -2
- package/dist/browser-rendering-xu8F_Rrv.mjs +0 -4
- package/dist/config-DYzlVxcB.mjs +0 -2
- package/dist/content-scanning-r6uzMO1r.mjs +0 -4
- package/dist/data-security-D_EtYBfo.mjs +0 -6
- package/dist/dist-DNBSHor6.mjs +0 -301
- package/dist/images-BO8FbDAa.mjs +0 -5
- package/dist/radar-Bxb0WX8V.mjs +0 -2
- package/dist/shared-AGtpXwwL.mjs +0 -2
- package/dist/speed-CuzTE0AL.mjs +0 -4
- package/dist/stream-GFsIZ-pP.mjs +0 -14
- /package/dist/{body-parser-DKa8Ipg1.mjs → body-parser-CBpeIUns.mjs} +0 -0
- /package/dist/{cli-types-CRIDdDw3.mjs → cli-types-CMNMD1V7.mjs} +0 -0
- /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
- /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
- /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
- /package/dist/{metadata-5VwHPW6C.mjs → metadata-jh2EIan8.mjs} +0 -0
- /package/dist/{resolve-4-OSeHlK.mjs → resolve-D1mG0REg.mjs} +0 -0
- /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{S as e,T as t,n}from"./auth-
|
|
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(`match-request-methods`,{type:`string`,array:!0,description:"The HTTP methods to match. You can specify a subset (for example, `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when creating a rate limit."}).option(`match-request-schemes`,{type:`string`,array:!0,description:"The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is optional."}).option(`match-request-url`,{type:`string`,description:"The URL pattern to match, composed of a host and a path such as `example.org/path*`. Normalization is applied before the pattern is matched. `*` wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to `*` to match all traffic to your zone."}).option(`match-response-origin-traffic`,{type:`boolean`,description:`When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional.
|
|
3
3
|
Notes: This field is deprecated. Instead, use response headers and set "origin_traffic" to "false" to avoid legacy behaviour interacting with the "response_headers" property.`}).option(`period`,{type:`number`,description:`The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.`}).option(`threshold`,{type:`number`,description:"The threshold that will trigger the configured mitigation action. Configure this value along with the `period` property to establish a threshold per period."}).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:`create`,describe:`Creates a new rate limit for a zone. Refer to the object definition for a list of required attributes.`,builder:l,handler:async t=>{if(t.dryRun){o({command:`cf rate-limits create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/rate_limits`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({match:{request:{methods:t[`match-request-methods`],schemes:t[`match-request-schemes`],url:c(t[`match-request-url`],`match-request-url`,`text`)},response:{origin_traffic:t[`match-response-origin-traffic`]}},period:t.period,threshold:t.threshold}):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(`Creating`,async()=>l.rateLimits.create({...e,zone_id:u})),{successLabel:`Created`});return}if(t.period===void 0)throw Error(`--period is required (or pass --body with this field set).`);if(t.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let d=i({match:{request:{methods:t[`match-request-methods`],schemes:t[`match-request-schemes`],url:c(t[`match-request-url`],`match-request-url`,`text`)},response:{origin_traffic:t[`match-response-origin-traffic`]}},period:t.period,threshold:t.threshold});a(await s(`Creating`,async()=>l.rateLimits.create({...d,zone_id:u})),{successLabel:`Created`})}};function d(e){return e.positional(`rate-limit-id`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,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 f={command:`delete <rate-limit-id>`,describe:`Deletes an existing rate limit.`,builder:d,handler:async r=>{if(r.dryRun){o({command:`cf rate-limits delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/rate_limits/${r[`rate-limit-id`]==null?`<rate-limit-id>`:encodeURIComponent(String(r[`rate-limit-id`]))}`,pathParams:{"rate-limit-id":String(r[`rate-limit-id`]??``),"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.
|
|
4
4
|
`);return}a(await s(`Deleting`,async()=>i.rateLimits.delete({zone_id:c,rate_limit_id:r[`rate-limit-id`]})),{successLabel:`Deleted`})}};function p(e){return e.positional(`rate-limit-id`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,demandOption:!0}).option(`match-request-methods`,{type:`string`,array:!0,description:"The HTTP methods to match. You can specify a subset (for example, `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when creating a rate limit."}).option(`match-request-schemes`,{type:`string`,array:!0,description:"The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is optional."}).option(`match-request-url`,{type:`string`,description:"The URL pattern to match, composed of a host and a path such as `example.org/path*`. Normalization is applied before the pattern is matched. `*` wildcards are expanded to match applicable traffic. Query strings are not matched. Set the value to `*` to match all traffic to your zone."}).option(`match-response-origin-traffic`,{type:`boolean`,description:`When true, only the uncached traffic served from your origin servers will count towards rate limiting. In this case, any cached traffic served by Cloudflare will not count towards rate limiting. This field is optional.
|
|
5
5
|
Notes: This field is deprecated. Instead, use response headers and set "origin_traffic" to "false" to avoid legacy behaviour interacting with the "response_headers" property.`}).option(`period`,{type:`number`,description:`The time in seconds (an integer value) to count matching traffic. If the count exceeds the configured threshold within this period, Cloudflare will perform the configured action.`}).option(`threshold`,{type:`number`,description:"The threshold that will trigger the configured mitigation action. Configure this value along with the `period` property to establish a threshold per period."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`edit <rate-limit-id>`,describe:`Updates an existing rate limit.`,builder:p,handler:async t=>{if(t.dryRun){o({command:`cf rate-limits edit`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/rate_limits/${t[`rate-limit-id`]==null?`<rate-limit-id>`:encodeURIComponent(String(t[`rate-limit-id`]))}`,pathParams:{"rate-limit-id":String(t[`rate-limit-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({match:{request:{methods:t[`match-request-methods`],schemes:t[`match-request-schemes`],url:c(t[`match-request-url`],`match-request-url`,`text`)},response:{origin_traffic:t[`match-response-origin-traffic`]}},period:t.period,threshold:t.threshold}):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.rateLimits.edit({...e,zone_id:u,rate_limit_id:t[`rate-limit-id`]})),{successLabel:`Updated`});return}if(t.period===void 0)throw Error(`--period is required (or pass --body with this field set).`);if(t.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let d=i({match:{request:{methods:t[`match-request-methods`],schemes:t[`match-request-schemes`],url:c(t[`match-request-url`],`match-request-url`,`text`)},response:{origin_traffic:t[`match-response-origin-traffic`]}},period:t.period,threshold:t.threshold});a(await s(`Updating`,async()=>l.rateLimits.edit({...d,zone_id:u,rate_limit_id:t[`rate-limit-id`]})),{successLabel:`Updated`})}};function h(e){return e.positional(`rate-limit-id`,{type:`string`,description:`Defines the unique identifier of the rate limit.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <rate-limit-id>`,describe:`Fetches the details of a rate limit.`,builder:h,handler:async t=>{if(t.dryRun){o({command:`cf rate-limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/rate_limits/${t[`rate-limit-id`]==null?`<rate-limit-id>`:encodeURIComponent(String(t[`rate-limit-id`]))}`,pathParams:{"rate-limit-id":String(t[`rate-limit-id`]??``),"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.rateLimits.get({zone_id:i,rate_limit_id:t[`rate-limit-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:"Defines the maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Fetches the rate limits for a zone.`,builder:_,handler:async t=>{let r={page:t.page,per_page:t[`per-page`]};if(t.dryRun){o({command:`cf rate-limits list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/rate_limits`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(t),c=await e({zone:t.zone},i,{quiet:t.quiet});t.zoneId=c,a(await s(`Loading`,async()=>i.rateLimits.list({zone_id:c,...r})),{successLabel:`Loaded`})}},y={command:`rate-limits`,describe:`Legacy per-zone rate limiting rules — prefer Advanced Rate Limiting in Rulesets for new configurations`,builder:e=>e.command(u).command(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{s as e}from"./session-CsvPYFj8.mjs";import{g as t}from"./dist-DpDjsWWn.mjs";import{a as n,r,v as i}from"./auth-BqDOIrKX.mjs";import{n as a}from"./local-D8bhHUMK.mjs";async function o(o,s={}){let{method:c=`GET`,localEndpoint:l}=s,u=`${t({compliance_region:i()})}${o}`,d={...n()};s.headers&&Object.assign(d,s.headers);let f=globalThis.fetch;l===void 0?d.Authorization=`Bearer ${await r()}`:f=a({endpoint:l});let p,m=s.body;m!=null&&(m instanceof FormData?p=m:Buffer.isBuffer(m)||m instanceof Uint8Array||m instanceof ArrayBuffer?(p=m,d[`Content-Type`]??=s.contentType??`application/octet-stream`):typeof m==`string`?(p=m,s.contentType&&(d[`Content-Type`]??=s.contentType)):(p=JSON.stringify(m),d[`Content-Type`]??=s.contentType??`application/json`));let h=await f(u,{method:c,headers:d,...p===void 0?{}:{body:p}});if(!h.ok){let t=h.headers.get(`content-type`)??``,n;try{n=t.includes(`application/json`)?await h.json():await h.text()}catch{n=null}throw new e({statusCode:h.status,body:n,rawResponse:{status:h.status,statusText:h.statusText,url:h.url||u,headers:h.headers,redirected:h.redirected,type:h.type}})}let g=await h.arrayBuffer();return Buffer.from(g)}function s(e){process.stdout.write(e)}export{s as n,o as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{t as p}from"./cli-types-CRIDdDw3.mjs";function m(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`anonymous`,{type:`boolean`,description:`if voters on a poll are anonymous`}).option(`hide-votes`,{type:`boolean`,description:`if votes on an option are visible before a person votes`}).option(`options`,{type:`string`,array:!0,description:`Different options for the question`}).option(`question`,{type:`string`,description:`Question of the poll`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a new poll`})}const h={command:`create-poll <meeting-id>`,describe:`Creates a new poll in an active session for the given meeting ID.`,builder:m,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit active-session create-poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}/meetings/${n[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(n[`meeting-id`]))}/active-session/poll`,pathParams:{"app-id":String(n[`app-id`]??``),"meeting-id":String(n[`meeting-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({anonymous:n.anonymous,hide_votes:n[`hide-votes`],options:n.options,question:d(n.question,`question`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.realtimeKit.activeSession.createPoll({...e,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`});return}if(n.options===void 0)throw Error(`--options is required (or pass --body with this field set).`);n.question===void 0&&(n.question=await t(`question`,`Question of the poll`));let m=s({anonymous:n.anonymous,hide_votes:n[`hide-votes`],options:n.options,question:d(n.question,`question`,`text`)});c(await u(`Creating`,async()=>r.realtimeKit.activeSession.createPoll({...m,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`})}};function ee(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get-active-session <meeting-id>`,describe:`Returns details of an ongoing active session for the given meeting ID.`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session get-active-session`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.activeSession.getActiveSession({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`kick-all-participants <meeting-id>`,describe:`Kicks all participants from an active session for the given meeting ID.`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-all-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/kick-all`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickAllParticipants({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}};function v(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`custom-participant-ids`,{type:`string`,array:!0,description:`The custom_participant_ids field`}).option(`participant-ids`,{type:`string`,array:!0,description:`The participant_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."})}const y={command:`kick-participants <meeting-id>`,describe:`Kicks one or more participants from an active session using user ID or custom participant ID.`,builder:v,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/kick`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickParticipants({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`custom-participant-ids`]===void 0)throw Error(`--custom-participant-ids is required (or pass --body with this field set).`);if(t[`participant-ids`]===void 0)throw Error(`--participant-ids is required (or pass --body with this field set).`);let d=s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]});c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickParticipants({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},b={command:`active-session`,describe:`Currently active meeting sessions with live participant counts and controls`,builder:e=>e.command(h).command(te).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-date`,{type:`string`,description:`start date in YYYY-MM-DD format`}).option(`end-date`,{type:`string`,description:`end date in YYYY-MM-DD format`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get-org-analytics <app-id>`,describe:`Returns day-wise session and recording analytics data of an App for the specified time range start_date to end_date. If start_date and end_date are not provided, the default time range is set from 30 days ago to the current date.`,builder:x,handler:async t=>{let n={start_date:t[`start-date`],end_date:t[`end-date`]};if(t.dryRun){l({command:`cf realtime-kit analytics get-org-analytics`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/analytics/daywise`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.analytics.getOrgAnalytics({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}},C={command:`analytics`,describe:`Live streaming from meetings to external platforms with stream key management`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Search string that matches apps by name.`}).option(`sort-order`,{type:`string`,description:`Sort order for apps by creation time.`,choices:[`ASC`,`DESC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Fetch all apps for your account`,builder:p(w),handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`],search:t.search,sort_order:t[`sort-order`]};if(t.dryRun){l({command:`cf realtime-kit apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/apps`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.apps.get({account_id:o,...n})),{successLabel:`Loaded`})}};function E(e){return e.option(`name`,{type:`string`,description:`The name 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 D={command:`post`,describe:`Create new app for your account`,builder:E,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit apps post`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/apps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.realtimeKit.apps.post({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name field`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Creating`,async()=>r.realtimeKit.apps.post({...m,account_id:p})),{successLabel:`Created`})}},O={command:`apps`,describe:`Realtime Kit applications that group meetings, sessions, and configuration together`,builder:e=>e.command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`allow-unmute`,{type:`boolean`,description:`if false, participants won't be able to unmute themselves after they are muted`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for muting all participants in an active session.`})}const A={command:`create <meeting-id>`,describe:`Mutes all participants of an active session for the given meeting ID.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute-all create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/mute-all`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_unmute:t[`allow-unmute`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`allow-unmute`]===void 0)throw Error(`--allow-unmute is required (or pass --body with this field set).`);let d=s({allow_unmute:t[`allow-unmute`]});c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},j={command:`mute-all`,describe:`Kit operations`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`custom-participant-ids`,{type:`string`,array:!0,description:`The custom_participant_ids field`}).option(`participant-ids`,{type:`string`,array:!0,description:`The participant_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."})}const N={command:`create <meeting-id>`,describe:`Mutes one or more participants from an active session using user ID or custom participant ID.`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/mute`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`custom-participant-ids`]===void 0)throw Error(`--custom-participant-ids is required (or pass --body with this field set).`);if(t[`participant-ids`]===void 0)throw Error(`--participant-ids is required (or pass --body with this field set).`);let d=s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]});c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},P={command:`mute`,describe:`Kit operations`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`active-session`,describe:`Operations for kit.meetings.active-session`,builder:e=>e.command(P).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <meeting-id>`,describe:"Returns livestream session details for the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:I,handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`]};if(t.dryRun){l({command:`cf realtime-kit kit meetings livestream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/livestream`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.meetings.livestream.get({account_id:o,app_id:t[`app-id`],meeting_id:t[`meeting-id`],...n})),{successLabel:`Loaded`})}},R={command:`livestream`,describe:`Kit operations`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`meetings`,describe:`Operations for kit.meetings`,builder:e=>e.command(F).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`session-id`,{type:`string`,description:`Session ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <session-id>`,describe:"Returns livestream session details for the given session ID. Retreive the session ID using the `Fetch all sessions of an App` API.",builder:B,handler:async t=>{let n={per_page:t[`per-page`],page_no:t[`page-no`]};if(t.dryRun){l({command:`cf realtime-kit kit sessions livestream sessions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/sessions/${t[`session-id`]==null?`<session-id>`:encodeURIComponent(String(t[`session-id`]))}/livestream-sessions`,pathParams:{"app-id":String(t[`app-id`]??``),"session-id":String(t[`session-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.sessions.livestream.sessions.get({account_id:o,app_id:t[`app-id`],session_id:t[`session-id`],...n})),{successLabel:`Loaded`})}},H={command:`sessions`,describe:`Kit operations`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`livestream`,describe:`Operations for kit.sessions.livestream`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`sessions`,describe:`Operations for kit.sessions`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},G={command:`kit`,describe:`Operations for kit`,builder:e=>e.command(z).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.positional(`livestream-id`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`get-active-livestreams-for-livestream-id <livestream-id>`,describe:"Returns details of all active livestreams for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:K,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-active-livestreams-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/${t[`livestream-id`]==null?`<livestream-id>`:encodeURIComponent(String(t[`livestream-id`]))}/active-livestream-session`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-id":String(t[`livestream-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getActiveLivestreamsForLivestreamId({account_id:r,app_id:t[`app-id`],livestream_id:t[`livestream-id`]})),{successLabel:`Loaded`})}};function J(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`exclude-meetings`,{type:`boolean`,description:`Exclude the RealtimeKit meetings that are livestreamed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`status`,{type:`string`,description:`Specifies the status of the operation.`,choices:[`LIVE`,`IDLE`,`ERRORED`,`INVOKED`]}).option(`start-time`,{type:`string`,description:`Specify the start time range in ISO format to access the live stream.`}).option(`end-time`,{type:`string`,description:`Specify the end time range in ISO format to access the live stream.`}).option(`sort-order`,{type:`string`,description:`Specifies the sorting order for the results.`,choices:[`ASC`,`DSC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get-all-livestreams <app-id>`,describe:"Returns details of livestreams associated with the given App ID. It includes livestreams created by your App and RealtimeKit meetings that are livestreamed by your App. If you only want details of livestreams created by your App and not RealtimeKit meetings, you can use the `exclude_meetings` query parameter.",builder:p(J),handler:async t=>{let n={exclude_meetings:t[`exclude-meetings`],per_page:t[`per-page`],page_no:t[`page-no`],status:t.status,start_time:t[`start-time`],end_time:t[`end-time`],sort_order:t[`sort-order`]};if(t.dryRun){l({command:`cf realtime-kit livestreams get-all-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getAllLivestreams({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}};function X(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-time`,{type:`number`,description:`Specify the start time as a Unix timestamp in seconds to access the livestream analytics.`}).option(`end-time`,{type:`number`,description:`Specify the end time as a Unix timestamp in seconds to access the livestream analytics.`}).option(`filters`,{type:`string`,description:`Optional filters for livestream analytics.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`get-livestream-analytics-complete <app-id>`,describe:`Returns livestream analytics for the specified time range.`,builder:X,handler:async t=>{let n={start_time:t[`start-time`],end_time:t[`end-time`],filters:t.filters};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-analytics-complete`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/analytics/livestreams/overall`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamAnalyticsComplete({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}};function Q(e){return e.positional(`livestream-session-id`,{type:`string`,description:`Livestream-session-id`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get-livestream-session-details-for-session-id <livestream-session-id>`,describe:"Returns livestream session details for the given livestream session ID. Retrieve the `livestream_session_id`using the `Fetch livestream session details using a session ID` API.",builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-details-for-session-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/sessions/${t[`livestream-session-id`]==null?`<livestream-session-id>`:encodeURIComponent(String(t[`livestream-session-id`]))}`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-session-id":String(t[`livestream-session-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getLivestreamSessionDetailsForSessionId({account_id:r,app_id:t[`app-id`],"livestream-session-id":t[`livestream-session-id`]})),{successLabel:`Loaded`})}};function re(e){return e.positional(`livestream-id`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get-livestream-session-for-livestream-id <livestream-id>`,describe:"Returns details of a livestream with sessions for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:re,handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`]};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/${t[`livestream-id`]==null?`<livestream-id>`:encodeURIComponent(String(t[`livestream-id`]))}`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-id":String(t[`livestream-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamSessionForLivestreamId({account_id:o,app_id:t[`app-id`],livestream_id:t[`livestream-id`],...n})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get-meeting-active-livestreams <meeting-id>`,describe:`Returns details of all active livestreams for the given meeting ID.`,builder:ae,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-meeting-active-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-livestream`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getMeetingActiveLivestreams({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Loaded`})}};function se(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`video-config-height`,{type:`number`,description:`Height of the livestreaming video in pixels`}).option(`video-config-width`,{type:`number`,description:`Width of the livestreaming video in pixels`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`start-livestreaming-a-meeting <meeting-id>`,describe:"Starts livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:se,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams start-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/livestreams`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({name:d(t.name,`name`,`text`),video_config:{height:t[`video-config-height`],width:t[`video-config-width`]}}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.livestreams.startLivestreamingAMeeting({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}let p=s({name:d(t.name,`name`,`text`),video_config:{height:t[`video-config-height`],width:t[`video-config-width`]}});c(await u(`Creating`,async()=>n.realtimeKit.livestreams.startLivestreamingAMeeting({...p,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}};function le(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier 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 ue={command:`stop-livestreaming-a-meeting <meeting-id>`,describe:"Stops the active livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:le,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams stop-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-livestream/stop`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force,message:`This operation halts an active live-stream. Viewers lose the broadcast immediately.`})){process.stderr.write(`Aborted.
|
|
2
|
+
import{C as e,D as t,E as n,T as r,_ as 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"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`anonymous`,{type:`boolean`,description:`if voters on a poll are anonymous`}).option(`hide-votes`,{type:`boolean`,description:`if votes on an option are visible before a person votes`}).option(`options`,{type:`string`,array:!0,description:`Different options for the question`}).option(`question`,{type:`string`,description:`Question of the poll`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a new poll`})}const h={command:`create-poll <meeting-id>`,describe:`Creates a new poll in an active session for the given meeting ID.`,builder:m,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit active-session create-poll`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}/meetings/${n[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(n[`meeting-id`]))}/active-session/poll`,pathParams:{"app-id":String(n[`app-id`]??``),"meeting-id":String(n[`meeting-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({anonymous:n.anonymous,hide_votes:n[`hide-votes`],options:n.options,question:d(n.question,`question`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.realtimeKit.activeSession.createPoll({...e,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`});return}if(n.options===void 0)throw Error(`--options is required (or pass --body with this field set).`);n.question===void 0&&(n.question=await t(`question`,`Question of the poll`));let m=s({anonymous:n.anonymous,hide_votes:n[`hide-votes`],options:n.options,question:d(n.question,`question`,`text`)});c(await u(`Creating`,async()=>r.realtimeKit.activeSession.createPoll({...m,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`})}};function ee(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get-active-session <meeting-id>`,describe:`Returns details of an ongoing active session for the given meeting ID.`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session get-active-session`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.activeSession.getActiveSession({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`kick-all-participants <meeting-id>`,describe:`Kicks all participants from an active session for the given meeting ID.`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-all-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/kick-all`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickAllParticipants({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}};function v(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`custom-participant-ids`,{type:`string`,array:!0,description:`The custom_participant_ids field`}).option(`participant-ids`,{type:`string`,array:!0,description:`The participant_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."})}const y={command:`kick-participants <meeting-id>`,describe:`Kicks one or more participants from an active session using user ID or custom participant ID.`,builder:v,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit active-session kick-participants`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/kick`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickParticipants({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`custom-participant-ids`]===void 0)throw Error(`--custom-participant-ids is required (or pass --body with this field set).`);if(t[`participant-ids`]===void 0)throw Error(`--participant-ids is required (or pass --body with this field set).`);let d=s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]});c(await u(`Creating`,async()=>n.realtimeKit.activeSession.kickParticipants({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},b={command:`active-session`,describe:`Currently active meeting sessions with live participant counts and controls`,builder:e=>e.command(h).command(te).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-date`,{type:`string`,description:`start date in YYYY-MM-DD format`}).option(`end-date`,{type:`string`,description:`end date in YYYY-MM-DD format`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get-org-analytics <app-id>`,describe:`Returns day-wise session and recording analytics data of an App for the specified time range start_date to end_date. If start_date and end_date are not provided, the default time range is set from 30 days ago to the current date.`,builder:x,handler:async t=>{let n={start_date:t[`start-date`],end_date:t[`end-date`]};if(t.dryRun){l({command:`cf realtime-kit analytics get-org-analytics`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/analytics/daywise`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.analytics.getOrgAnalytics({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}},C={command:`analytics`,describe:`Live streaming from meetings to external platforms with stream key management`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Search string that matches apps by name.`}).option(`sort-order`,{type:`string`,description:`Sort order for apps by creation time.`,choices:[`ASC`,`DESC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Fetch all apps for your account`,builder:p(w),handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`],search:t.search,sort_order:t[`sort-order`]};if(t.dryRun){l({command:`cf realtime-kit apps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/apps`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.apps.get({account_id:o,...n})),{successLabel:`Loaded`})}};function E(e){return e.option(`name`,{type:`string`,description:`The name 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 D={command:`post`,describe:`Create new app for your account`,builder:E,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit apps post`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/apps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.realtimeKit.apps.post({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name field`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Creating`,async()=>r.realtimeKit.apps.post({...m,account_id:p})),{successLabel:`Created`})}},O={command:`apps`,describe:`Realtime Kit applications that group meetings, sessions, and configuration together`,builder:e=>e.command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`allow-unmute`,{type:`boolean`,description:`if false, participants won't be able to unmute themselves after they are muted`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for muting all participants in an active session.`})}const A={command:`create <meeting-id>`,describe:`Mutes all participants of an active session for the given meeting ID.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute-all create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/mute-all`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_unmute:t[`allow-unmute`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`allow-unmute`]===void 0)throw Error(`--allow-unmute is required (or pass --body with this field set).`);let d=s({allow_unmute:t[`allow-unmute`]});c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.muteAll.create({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},j={command:`mute-all`,describe:`Kit operations`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`custom-participant-ids`,{type:`string`,array:!0,description:`The custom_participant_ids field`}).option(`participant-ids`,{type:`string`,array:!0,description:`The participant_ids field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for kicking participants from an active session. Only one of `participant_id` or `custom_participant_id` is required."})}const N={command:`create <meeting-id>`,describe:`Mutes one or more participants from an active session using user ID or custom participant ID.`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit kit meetings active-session mute create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-session/mute`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}if(t[`custom-participant-ids`]===void 0)throw Error(`--custom-participant-ids is required (or pass --body with this field set).`);if(t[`participant-ids`]===void 0)throw Error(`--participant-ids is required (or pass --body with this field set).`);let d=s({custom_participant_ids:t[`custom-participant-ids`],participant_ids:t[`participant-ids`]});c(await u(`Creating`,async()=>n.realtimeKit.kit.meetings.activeSession.mute.create({...d,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}},P={command:`mute`,describe:`Kit operations`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`active-session`,describe:`Operations for kit.meetings.active-session`,builder:e=>e.command(P).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <meeting-id>`,describe:"Returns livestream session details for the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:I,handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`]};if(t.dryRun){l({command:`cf realtime-kit kit meetings livestream get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/livestream`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.meetings.livestream.get({account_id:o,app_id:t[`app-id`],meeting_id:t[`meeting-id`],...n})),{successLabel:`Loaded`})}},R={command:`livestream`,describe:`Kit operations`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`meetings`,describe:`Operations for kit.meetings`,builder:e=>e.command(F).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`session-id`,{type:`string`,description:`Session ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <session-id>`,describe:"Returns livestream session details for the given session ID. Retreive the session ID using the `Fetch all sessions of an App` API.",builder:B,handler:async t=>{let n={per_page:t[`per-page`],page_no:t[`page-no`]};if(t.dryRun){l({command:`cf realtime-kit kit sessions livestream sessions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/sessions/${t[`session-id`]==null?`<session-id>`:encodeURIComponent(String(t[`session-id`]))}/livestream-sessions`,pathParams:{"app-id":String(t[`app-id`]??``),"session-id":String(t[`session-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.kit.sessions.livestream.sessions.get({account_id:o,app_id:t[`app-id`],session_id:t[`session-id`],...n})),{successLabel:`Loaded`})}},H={command:`sessions`,describe:`Kit operations`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`livestream`,describe:`Operations for kit.sessions.livestream`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`sessions`,describe:`Operations for kit.sessions`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},G={command:`kit`,describe:`Operations for kit`,builder:e=>e.command(z).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.positional(`livestream-id`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`get-active-livestreams-for-livestream-id <livestream-id>`,describe:"Returns details of all active livestreams for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:K,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-active-livestreams-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/${t[`livestream-id`]==null?`<livestream-id>`:encodeURIComponent(String(t[`livestream-id`]))}/active-livestream-session`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-id":String(t[`livestream-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getActiveLivestreamsForLivestreamId({account_id:r,app_id:t[`app-id`],livestream_id:t[`livestream-id`]})),{successLabel:`Loaded`})}};function J(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`exclude-meetings`,{type:`boolean`,description:`Exclude the RealtimeKit meetings that are livestreamed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`status`,{type:`string`,description:`Specifies the status of the operation.`,choices:[`LIVE`,`IDLE`,`ERRORED`,`INVOKED`]}).option(`start-time`,{type:`string`,description:`Specify the start time range in ISO format to access the live stream.`}).option(`end-time`,{type:`string`,description:`Specify the end time range in ISO format to access the live stream.`}).option(`sort-order`,{type:`string`,description:`Specifies the sorting order for the results.`,choices:[`ASC`,`DSC`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get-all-livestreams <app-id>`,describe:"Returns details of livestreams associated with the given App ID. It includes livestreams created by your App and RealtimeKit meetings that are livestreamed by your App. If you only want details of livestreams created by your App and not RealtimeKit meetings, you can use the `exclude_meetings` query parameter.",builder:p(J),handler:async t=>{let n={exclude_meetings:t[`exclude-meetings`],per_page:t[`per-page`],page_no:t[`page-no`],status:t.status,start_time:t[`start-time`],end_time:t[`end-time`],sort_order:t[`sort-order`]};if(t.dryRun){l({command:`cf realtime-kit livestreams get-all-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getAllLivestreams({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}};function X(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`start-time`,{type:`number`,description:`Specify the start time as a Unix timestamp in seconds to access the livestream analytics.`}).option(`end-time`,{type:`number`,description:`Specify the end time as a Unix timestamp in seconds to access the livestream analytics.`}).option(`filters`,{type:`string`,description:`Optional filters for livestream analytics.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`get-livestream-analytics-complete <app-id>`,describe:`Returns livestream analytics for the specified time range.`,builder:X,handler:async t=>{let n={start_time:t[`start-time`],end_time:t[`end-time`],filters:t.filters};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-analytics-complete`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/analytics/livestreams/overall`,pathParams:{"app-id":String(t[`app-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamAnalyticsComplete({account_id:o,app_id:t[`app-id`],...n})),{successLabel:`Loaded`})}};function Q(e){return e.positional(`livestream-session-id`,{type:`string`,description:`Livestream-session-id`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`get-livestream-session-details-for-session-id <livestream-session-id>`,describe:"Returns livestream session details for the given livestream session ID. Retrieve the `livestream_session_id`using the `Fetch livestream session details using a session ID` API.",builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-details-for-session-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/sessions/${t[`livestream-session-id`]==null?`<livestream-session-id>`:encodeURIComponent(String(t[`livestream-session-id`]))}`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-session-id":String(t[`livestream-session-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getLivestreamSessionDetailsForSessionId({account_id:r,app_id:t[`app-id`],"livestream-session-id":t[`livestream-session-id`]})),{successLabel:`Loaded`})}};function re(e){return e.positional(`livestream-id`,{type:`string`,description:`Livestream ID`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`page-no`,{type:`number`,description:`The page number from which you want your page search results to be displayed.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get-livestream-session-for-livestream-id <livestream-id>`,describe:"Returns details of a livestream with sessions for the given livestream ID. Retreive the livestream ID using the `Start livestreaming a meeting` API.",builder:re,handler:async t=>{let n={page_no:t[`page-no`],per_page:t[`per-page`]};if(t.dryRun){l({command:`cf realtime-kit livestreams get-livestream-session-for-livestream-id`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/livestreams/${t[`livestream-id`]==null?`<livestream-id>`:encodeURIComponent(String(t[`livestream-id`]))}`,pathParams:{"app-id":String(t[`app-id`]??``),"livestream-id":String(t[`livestream-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.realtimeKit.livestreams.getLivestreamSessionForLivestreamId({account_id:o,app_id:t[`app-id`],livestream_id:t[`livestream-id`],...n})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get-meeting-active-livestreams <meeting-id>`,describe:`Returns details of all active livestreams for the given meeting ID.`,builder:ae,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams get-meeting-active-livestreams`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-livestream`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.realtimeKit.livestreams.getMeetingActiveLivestreams({account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Loaded`})}};function se(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`video-config-height`,{type:`number`,description:`Height of the livestreaming video in pixels`}).option(`video-config-width`,{type:`number`,description:`Width of the livestreaming video in pixels`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`start-livestreaming-a-meeting <meeting-id>`,describe:"Starts livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:se,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams start-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/livestreams`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({name:d(t.name,`name`,`text`),video_config:{height:t[`video-config-height`],width:t[`video-config-width`]}}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.realtimeKit.livestreams.startLivestreamingAMeeting({...e,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`});return}let p=s({name:d(t.name,`name`,`text`),video_config:{height:t[`video-config-height`],width:t[`video-config-width`]}});c(await u(`Creating`,async()=>n.realtimeKit.livestreams.startLivestreamingAMeeting({...p,account_id:r,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Created`})}};function le(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier 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 ue={command:`stop-livestreaming-a-meeting <meeting-id>`,describe:"Stops the active livestream of a meeting associated with the given meeting ID. Retreive the meeting ID using the `Create a meeting` API.",builder:le,handler:async t=>{if(t.dryRun){l({command:`cf realtime-kit livestreams stop-livestreaming-a-meeting`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${t[`app-id`]==null?`<app-id>`:encodeURIComponent(String(t[`app-id`]))}/meetings/${t[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(t[`meeting-id`]))}/active-livestream/stop`,pathParams:{"app-id":String(t[`app-id`]??``),"meeting-id":String(t[`meeting-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force,message:`This operation halts an active live-stream. Viewers lose the broadcast immediately.`})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}c(await u(`Deleting`,async()=>n.realtimeKit.livestreams.stopLivestreamingAMeeting({account_id:o,app_id:t[`app-id`],meeting_id:t[`meeting-id`]})),{successLabel:`Deleted`})}},de={command:`livestreams`,describe:`Live streaming from meetings to external platforms with stream key management`,builder:e=>e.command(q).command(Y).command(Z).command(ne).command(ie).command(oe).command(ce).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(e){return e.positional(`meeting-id`,{type:`string`,description:`ID of the meeting. Fetch the meeting ID using the create a meeting API.`,demandOption:!0}).option(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`custom-participant-id`,{type:`string`,description:`A unique participant ID. You must specify a unique ID for the participant, for example, UUID, email address, and so on. `}).option(`name`,{type:`string`,description:`(Optional) Name of the participant. `}).option(`picture`,{type:`string`,description:`(Optional) A URL to a picture to be used for the participant. `}).option(`preset-name`,{type:`string`,description:`Name of the preset to apply to this participant.`,default:`group_call_host`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pe={command:`add-participant <meeting-id>`,describe:`Adds a participant to the given meeting ID.`,builder:fe,handler:async n=>{if(n.dryRun){l({command:`cf realtime-kit meetings add-participant`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/realtime/kit/${n[`app-id`]==null?`<app-id>`:encodeURIComponent(String(n[`app-id`]))}/meetings/${n[`meeting-id`]==null?`<meeting-id>`:encodeURIComponent(String(n[`meeting-id`]))}/participants`,pathParams:{"app-id":String(n[`app-id`]??``),"meeting-id":String(n[`meeting-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({custom_participant_id:d(n[`custom-participant-id`],`custom-participant-id`,`text`),name:d(n.name,`name`,`text`),picture:d(n.picture,`picture`,`text`),preset_name:d(n[`preset-name`],`preset-name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.realtimeKit.meetings.addParticipant({...e,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`});return}n[`custom-participant-id`]===void 0&&(n[`custom-participant-id`]=await t(`custom-participant-id`,`A unique participant ID. You must specify a unique ID for the participant, for example, UUID, email address, and so on. `)),n[`preset-name`]===void 0&&(n[`preset-name`]=await t(`preset-name`,`Name of the preset to apply to this participant.`));let m=s({custom_participant_id:d(n[`custom-participant-id`],`custom-participant-id`,`text`),name:d(n.name,`name`,`text`),picture:d(n.picture,`picture`,`text`),preset_name:d(n[`preset-name`],`preset-name`,`text`)});c(await u(`Creating`,async()=>r.realtimeKit.meetings.addParticipant({...m,account_id:p,app_id:n[`app-id`],meeting_id:n[`meeting-id`]})),{successLabel:`Created`})}};function me(e){return e.positional(`app-id`,{type:`string`,description:`The app identifier tag.`,demandOption:!0}).option(`ai-config-summarization-summary-type`,{type:`string`,description:`Defines the style of the summary, such as general, team meeting, or sales call.`,choices:[`general`,`team_meeting`,`sales_call`,`client_check_in`,`interview`,`daily_standup`,`one_on_one_meeting`,`lecture`,`code_review`],default:`general`}).option(`ai-config-summarization-text-format`,{type:`string`,description:`Determines the text format of the summary, such as plain text or markdown.`,choices:[`plain_text`,`markdown`],default:`markdown`}).option(`ai-config-summarization-word-limit`,{type:`number`,description:`Sets the maximum number of words in the meeting summary.`,default:500}).option(`ai-config-transcription-keywords`,{type:`string`,array:!0,description:`Adds specific terms to improve accurate detection during transcription.`}).option(`ai-config-transcription-language`,{type:`string`,description:`Specifies the language code for transcription to ensure accurate results.`,choices:[`en-US`,`en-IN`,`de`,`hi`,`sv`,`ru`,`pl`,`el`,`fr`,`nl`],default:`en-US`}).option(`ai-config-transcription-profanity-filter`,{type:`boolean`,description:`Control the inclusion of offensive language in transcriptions.`,default:!1}).option(`live-stream-on-start`,{type:`boolean`,description:`Specifies if the meeting should start getting livestreamed on start.`,default:!1}).option(`persist-chat`,{type:`boolean`,description:`If a meeting is set to persist_chat, meeting chat would remain for a week within the meeting space.`,default:!1}).option(`record-on-start`,{type:`boolean`,description:`Specifies if the meeting should start getting recorded as soon as someone joins the meeting.`,default:!1}).option(`recording-config-audio-config-channel`,{type:`string`,description:`Audio signal pathway within an audio file that carries a specific sound source.`,choices:[`mono`,`stereo`],default:`stereo`}).option(`recording-config-audio-config-codec`,{type:`string`,description:`Codec using which the recording will be encoded. If VP8/VP9 is selected for videoConfig, changing audioConfig is not allowed. In this case, the codec in the audioConfig is automatically set to vorbis.`,choices:[`MP3`,`AAC`],default:`AAC`}).option(`recording-config-audio-config-export-file`,{type:`boolean`,description:`Controls whether to export audio file seperately`,default:!0}).option(`recording-config-file-name-prefix`,{type:`string`,description:`Adds a prefix to the beginning of the file name of the recording.`}).option(`recording-config-live-streaming-config-rtmp-url`,{type:`string`,description:`RTMP URL to stream to`}).option(`recording-config-max-seconds`,{type:`number`,description:`Specifies the maximum duration for recording in seconds, ranging from a minimum of 60 seconds to a maximum of 24 hours.`}).option(`recording-config-realtimekit-bucket-config-enabled`,{type:`boolean`,description:"Controls whether recordings are uploaded to RealtimeKit's bucket. If set to false, `download_url`, `audio_download_url`, `download_url_expiry` won't be generated for a recording."}).option(`recording-config-storage-config-access-key`,{type:`string`,description:`Access key of the storage medium. Access key is not required for the \`gcs\` storage media type.
|
|
4
4
|
|
|
5
5
|
Note that this field is not readable by clients, only writeable.`}).option(`recording-config-storage-config-auth-method`,{type:`string`,description:`Authentication method used for "sftp" type storage medium
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,_ as n,i as r,n as i}from"./auth-
|
|
2
|
+
import{C as e,D as t,_ as n,i as r,n as i}from"./auth-BqDOIrKX.mjs";import{n as a,r 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"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(e){return e.option(`domains`,{type:`string`,array:!0,description:`List of fully qualified domain names (FQDNs) to check for availability. Each domain must include the extension.
|
|
3
3
|
- Minimum: 1 domain
|
|
4
4
|
- Maximum: 20 domains per request
|
|
5
5
|
- Domains on unsupported extensions are returned with \`registrable: false\` and a \`reason\` field
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,_ as n,n as r}from"./auth-
|
|
2
|
+
import{C as e,D 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";function d(e){return e.option(`body-base64`,{type:`string`,description:`Base64 encoded request body`}).option(`body-plain-text`,{type:`string`,description:`Request body as plain text`}).option(`context-bot-score`,{type:`number`,description:`Bot score used for evaluating tracing request processing`}).option(`context-geoloc-city`,{type:`string`,description:`The context.geoloc.city field`}).option(`context-geoloc-continent`,{type:`string`,description:`The context.geoloc.continent field`}).option(`context-geoloc-is-eu-country`,{type:`boolean`,description:`The context.geoloc.is_eu_country field`}).option(`context-geoloc-iso-code`,{type:`string`,description:`The context.geoloc.iso_code field`}).option(`context-geoloc-latitude`,{type:`number`,description:`The context.geoloc.latitude field`}).option(`context-geoloc-longitude`,{type:`number`,description:`The context.geoloc.longitude field`}).option(`context-geoloc-postal-code`,{type:`string`,description:`The context.geoloc.postal_code field`}).option(`context-geoloc-region-code`,{type:`string`,description:`The context.geoloc.region_code field`}).option(`context-geoloc-subdivision-2-iso-code`,{type:`string`,description:`The context.geoloc.subdivision_2_iso_code field`}).option(`context-geoloc-timezone`,{type:`string`,description:`The context.geoloc.timezone field`}).option(`context-skip-challenge`,{type:`boolean`,description:`Whether to skip any challenges for tracing request (e.g.: captcha)`}).option(`context-threat-score`,{type:`number`,description:`Threat score used for evaluating tracing request processing`}).option(`method`,{type:`string`,description:`HTTP Method of tracing request`}).option(`protocol`,{type:`string`,description:`HTTP Protocol of tracing request`}).option(`skip-response`,{type:`boolean`,description:`Skip sending the request to the Origin server after all rules evaluation`}).option(`url`,{type:`string`,description:`URL to which perform tracing request`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`create`,describe:`Traces a simulated HTTP request through Cloudflare's edge to analyze how rules, settings, and configurations would process the request. Useful for debugging firewall rules, page rules, and other request transformations without sending actual traffic. Supports custom headers, cookies, body content, and geolocation context.`,builder:d,handler:async d=>{if(d.dryRun){s({command:`cf request-tracers traces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/request-tracer/trace`,pathParams:{},bodyKind:`json`,body:d.body===void 0?a({body:{base64:l(d[`body-base64`],`body-base64`,`text`),plain_text:l(d[`body-plain-text`],`body-plain-text`,`text`)},context:{bot_score:d[`context-bot-score`],geoloc:{city:l(d[`context-geoloc-city`],`context-geoloc-city`,`text`),continent:l(d[`context-geoloc-continent`],`context-geoloc-continent`,`text`),is_eu_country:d[`context-geoloc-is-eu-country`],iso_code:l(d[`context-geoloc-iso-code`],`context-geoloc-iso-code`,`text`),latitude:d[`context-geoloc-latitude`],longitude:d[`context-geoloc-longitude`],postal_code:l(d[`context-geoloc-postal-code`],`context-geoloc-postal-code`,`text`),region_code:l(d[`context-geoloc-region-code`],`context-geoloc-region-code`,`text`),subdivision_2_iso_code:l(d[`context-geoloc-subdivision-2-iso-code`],`context-geoloc-subdivision-2-iso-code`,`text`),timezone:l(d[`context-geoloc-timezone`],`context-geoloc-timezone`,`text`)},skip_challenge:d[`context-skip-challenge`],threat_score:d[`context-threat-score`]},method:l(d.method,`method`,`text`),protocol:l(d.protocol,`protocol`,`text`),skip_response:d[`skip-response`],url:l(d.url,`url`,`text`)}):i(d.body)});return}let f=await r(d),p=d.local?u:await n(f);if(d.accountId=p,d.body){let e=i(d.body);o(await c(`Creating`,async()=>f.requestTracers.traces.create({...e,account_id:p})),{successLabel:`Created`});return}d.method===void 0&&(d.method=await t(`method`,`HTTP Method of tracing request`)),d.url===void 0&&(d.url=await t(`url`,`URL to which perform tracing request`));let m=a({body:{base64:l(d[`body-base64`],`body-base64`,`text`),plain_text:l(d[`body-plain-text`],`body-plain-text`,`text`)},context:{bot_score:d[`context-bot-score`],geoloc:{city:l(d[`context-geoloc-city`],`context-geoloc-city`,`text`),continent:l(d[`context-geoloc-continent`],`context-geoloc-continent`,`text`),is_eu_country:d[`context-geoloc-is-eu-country`],iso_code:l(d[`context-geoloc-iso-code`],`context-geoloc-iso-code`,`text`),latitude:d[`context-geoloc-latitude`],longitude:d[`context-geoloc-longitude`],postal_code:l(d[`context-geoloc-postal-code`],`context-geoloc-postal-code`,`text`),region_code:l(d[`context-geoloc-region-code`],`context-geoloc-region-code`,`text`),subdivision_2_iso_code:l(d[`context-geoloc-subdivision-2-iso-code`],`context-geoloc-subdivision-2-iso-code`,`text`),timezone:l(d[`context-geoloc-timezone`],`context-geoloc-timezone`,`text`)},skip_challenge:d[`context-skip-challenge`],threat_score:d[`context-threat-score`]},method:l(d.method,`method`,`text`),protocol:l(d.protocol,`protocol`,`text`),skip_response:d[`skip-response`],url:l(d.url,`url`,`text`)});o(await c(`Creating`,async()=>f.requestTracers.traces.create({...m,account_id:p})),{successLabel:`Created`})}},p={command:`traces`,describe:`Operations for traces`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`request-tracers`,describe:`request-tracers`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-
|
|
2
|
+
import{C as e,D as t,E as n,T as r,_ as 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"./local-D8bhHUMK.mjs";import{t as p}from"./cli-types-CMNMD1V7.mjs";function m(e){return e.option(`name`,{type:`string`,description:`The name of the share.`}).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`,describe:`Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`,builder:m,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.resourceSharing.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Creating`,async()=>r.resourceSharing.create({...m,account_id:p})),{successLabel:`Created`})}};function g(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier 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 _={command:`delete <share-id>`,describe:`Deletion is not immediate, an updated share object with a new status will be returned.`,builder:g,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}c(await u(`Deleting`,async()=>n.resourceSharing.delete({account_id:o,share_id:t[`share-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <share-id>`,describe:`Fetches share by ID.`,builder:v,handler:async t=>{let n={include_resources:t[`include-resources`],include_recipient_counts:t[`include-recipient-counts`]};if(t.dryRun){l({command:`cf resource-sharing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.get({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function b(e){return e.option(`status`,{type:`string`,description:`Filter shares by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`kind`,{type:`string`,description:`Filter shares by kind.`,choices:[`sent`,`received`]}).option(`target-type`,{type:`string`,description:`Filter shares by target_type.`,choices:[`account`,`organization`]}).option(`resource-types`,{type:`string`,description:`Filter share resources by resource_types.`}).option(`order`,{type:`string`,description:`Order shares by values in the given field.`,choices:[`name`,`created`]}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`tag`,{type:`string`,description:"Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all account shares.`,builder:p(b),handler:async t=>{let n={status:t.status,kind:t.kind,target_type:t[`target-type`],resource_types:t[`resource-types`],order:t.order,direction:t.direction,page:t.page,per_page:t[`per-page`],include_resources:t[`include-resources`],include_recipient_counts:t[`include-recipient-counts`],tag:t.tag};if(t.dryRun){l({command:`cf resource-sharing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.list({account_id:o,...n})),{successLabel:`Loaded`})}};function S(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`organization-id`,{type:`string`,description:`Organization identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Optionally specify `recipient_account_id` to target a specific account, or `organization_id` to target the caller's whole organization. If neither is provided, the caller's organization is used. The legacy field `account_id` is accepted as a synonym for `recipient_account_id` during the deprecation period (see `x-sunset` on that field). "})}const C={command:`create <share-id>`,describe:`Adds a recipient to a resource share, granting them access to the shared resources.`,builder:S,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({organization_id:d(t[`organization-id`],`organization-id`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.resourceSharing.recipients.create({body:e,account_id:r,share_id:t[`share-id`]})),{successLabel:`Created`});return}let p=s({organization_id:d(t[`organization-id`],`organization-id`,`text`)});c(await u(`Creating`,async()=>n.resourceSharing.recipients.create({body:p,account_id:r,share_id:t[`share-id`]})),{successLabel:`Created`})}};function w(e){return e.positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier 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 T={command:`delete <recipient-id>`,describe:`Deletion is not immediate, an updated share recipient object with a new status will be returned.`,builder:w,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients/${t[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(t[`recipient-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"recipient-id":String(t[`recipient-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}c(await u(`Deleting`,async()=>n.resourceSharing.recipients.delete({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <recipient-id>`,describe:`Get share recipient by ID.`,builder:E,handler:async t=>{let n={include_resources:t[`include-resources`]};if(t.dryRun){l({command:`cf resource-sharing recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients/${t[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(t[`recipient-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"recipient-id":String(t[`recipient-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.get({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`],...n})),{successLabel:`Loaded`})}};function O(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`List share recipients by share ID.`,builder:O,handler:async t=>{let n={include_resources:t[`include-resources`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier 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)`})}const j={command:`update <share-id>`,describe:`Changes a share's recipients to match the given list. Returns an error if the share targets an organization.`,builder:A,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.recipients.update({body:e,account_id:r,share_id:t[`share-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.`)}},M={command:`recipients`,describe:`
|
|
5
|
-
`);return}c(await u(`Deleting`,async()=>n.resourceSharing.resources.delete({account_id:o,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Deleted`})}};function L(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get <share-resource-id>`,describe:`Get share resource by ID.`,builder:L,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.resourceSharing.resources.get({account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Loaded`})}};function z(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter share resources by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`resource-type`,{type:`string`,description:`Filter share resources by resource_type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`List share resources by share ID.`,builder:p(z),handler:async t=>{let n={status:t.status,resource_type:t[`resource-type`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.resources.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function V(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier 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)`})}const H={command:`update <share-resource-id>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:V,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.resources.update({...e,account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-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.`)}},U={command:`resources`,describe:`
|
|
4
|
+
`);return}c(await u(`Deleting`,async()=>n.resourceSharing.recipients.delete({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <recipient-id>`,describe:`Get share recipient by ID.`,builder:E,handler:async t=>{let n={include_resources:t[`include-resources`]};if(t.dryRun){l({command:`cf resource-sharing recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients/${t[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(t[`recipient-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"recipient-id":String(t[`recipient-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.get({account_id:o,share_id:t[`share-id`],recipient_id:t[`recipient-id`],...n})),{successLabel:`Loaded`})}};function O(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`List share recipients by share ID.`,builder:O,handler:async t=>{let n={include_resources:t[`include-resources`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.recipients.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function A(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier 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)`})}const j={command:`update <share-id>`,describe:`Changes a share's recipients to match the given list. Returns an error if the share targets an organization.`,builder:A,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/recipients`,pathParams:{"share-id":String(t[`share-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.recipients.update({body:e,account_id:r,share_id:t[`share-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.`)}},M={command:`recipients`,describe:`Operations for recipients`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`resource-account-id`,{type:`string`,description:`Account identifier.`}).option(`resource-id`,{type:`string`,description:`Share Resource identifier.`}).option(`resource-type`,{type:`string`,description:`Resource Type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]}).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:`create <share-id>`,describe:`Adds a resource to an existing share, making it available to share recipients.`,builder:N,handler:async r=>{if(r.dryRun){l({command:`cf resource-sharing resources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${r[`share-id`]==null?`<share-id>`:encodeURIComponent(String(r[`share-id`]))}/resources`,pathParams:{"share-id":String(r[`share-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({resource_account_id:d(r[`resource-account-id`],`resource-account-id`,`text`),resource_id:d(r[`resource-id`],`resource-id`,`text`),resource_type:d(r[`resource-type`],`resource-type`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.resourceSharing.resources.create({body:e,account_id:m,share_id:r[`share-id`]})),{successLabel:`Created`});return}r[`resource-account-id`]===void 0&&(r[`resource-account-id`]=await t(`resource-account-id`,`Account identifier.`)),r[`resource-id`]===void 0&&(r[`resource-id`]=await t(`resource-id`,`Share Resource identifier.`)),r[`resource-type`]===void 0&&(r[`resource-type`]=await n(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]));let h=s({resource_account_id:d(r[`resource-account-id`],`resource-account-id`,`text`),resource_id:d(r[`resource-id`],`resource-id`,`text`),resource_type:d(r[`resource-type`],`resource-type`,`text`)});c(await u(`Creating`,async()=>p.resourceSharing.resources.create({body:h,account_id:m,share_id:r[`share-id`]})),{successLabel:`Created`})}};function F(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier 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 I={command:`delete <share-resource-id>`,describe:`Deletion is not immediate, an updated share resource object with a new status will be returned.`,builder:F,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}c(await u(`Deleting`,async()=>n.resourceSharing.resources.delete({account_id:o,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Deleted`})}};function L(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get <share-resource-id>`,describe:`Get share resource by ID.`,builder:L,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.resourceSharing.resources.get({account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-id`]})),{successLabel:`Loaded`})}};function z(e){return e.option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter share resources by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`resource-type`,{type:`string`,description:`Filter share resources by resource_type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page`\nis supplied without `per_page`. May be omitted entirely along with\n`page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`List share resources by share ID.`,builder:p(z),handler:async t=>{let n={status:t.status,resource_type:t[`resource-type`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf resource-sharing resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources`,pathParams:{"share-id":String(t[`share-id`]??``)},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.resourceSharing.resources.list({account_id:o,share_id:t[`share-id`],...n})),{successLabel:`Loaded`})}};function V(e){return e.positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier 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)`})}const H={command:`update <share-resource-id>`,describe:`Update is not immediate, an updated share resource object with a new status will be returned.`,builder:V,handler:async t=>{if(t.dryRun){l({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${t[`share-id`]==null?`<share-id>`:encodeURIComponent(String(t[`share-id`]))}/resources/${t[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(t[`share-resource-id`]))}`,pathParams:{"share-id":String(t[`share-id`]??``),"share-resource-id":String(t[`share-resource-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.resourceSharing.resources.update({...e,account_id:r,share_id:t[`share-id`],share_resource_id:t[`share-resource-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.`)}},U={command:`resources`,describe:`Operations for resources`,builder:e=>e.command(P).command(I).command(R).command(B).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the share.`}).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:`update <share-id>`,describe:`Updating is not immediate, an updated share object with a new status will be returned.`,builder:W,handler:async n=>{if(n.dryRun){l({command:`cf resource-sharing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/shares/${n[`share-id`]==null?`<share-id>`:encodeURIComponent(String(n[`share-id`]))}`,pathParams:{"share-id":String(n[`share-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.resourceSharing.update({...e,account_id:p,share_id:n[`share-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the share.`));let m=s({name:d(n.name,`name`,`text`)});c(await u(`Updating`,async()=>r.resourceSharing.update({...m,account_id:p,share_id:n[`share-id`]})),{successLabel:`Updated`})}},K={command:`resource-sharing`,describe:`resource-sharing`,builder:e=>e.command(h).command(_).command(y).command(x).command(G).command(M).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{K as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
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
3
|
verify the current resource ETag matches before applying the write. Returns
|
|
4
4
|
412 Precondition Failed if the resource has been modified since the ETag was
|
|
5
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.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{C as e,D as t,T as n,_ as r,n as i}from"./auth-
|
|
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
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
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,5 +1,5 @@
|
|
|
1
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-
|
|
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
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
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
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.
|