cf 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
- package/dist/{accounts-CjtZ8x1z.mjs → accounts-B_joQcMi.mjs} +9 -9
- package/dist/{acm-C2lYIWs1.mjs → acm-_kIHqYME.mjs} +2 -2
- package/dist/{addressing-CHFK6uxW.mjs → addressing-CaFlw8y1.mjs} +10 -10
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-DMPfi54f.mjs} +1 -1
- package/dist/ai-CqnhNb_c.mjs +2 -0
- package/dist/ai-gateway-pgYGI519.mjs +8 -0
- package/dist/ai-search-eqQMPQol.mjs +7 -0
- package/dist/ai_gateway--vuVLnOm.mjs +4 -0
- package/dist/{alerting-Bk85NNf5.mjs → alerting-CPxHiYHb.mjs} +5 -5
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-DSSRDZz8.mjs} +1 -1
- package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
- package/dist/{api-gateway-CWdR4Ne7.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
- package/dist/argo-aC6A3JyX.mjs +2 -0
- package/dist/artifacts-HD4V2xpK.mjs +4 -0
- package/dist/audit-logs-BuExU_nz.mjs +2 -0
- package/dist/auth-CSC4yhEJ.mjs +9 -0
- package/dist/auth-D5hNsOFq.mjs +5 -0
- package/dist/billing-COaghyxl.mjs +2 -0
- package/dist/bot-management-DmEzeV1Y.mjs +5 -0
- package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
- package/dist/brand-protection-dPrGe8sL.mjs +3 -0
- package/dist/{browser-rendering-Rae0AUt0.mjs → browser-rendering-BiSGnpBf.mjs} +3 -3
- package/dist/{build-BE4o4imx.mjs → build-HuS9-R0V.mjs} +2 -2
- package/dist/{cache-B7pRbpTy.mjs → cache-CY-7Lt71.mjs} +4 -4
- package/dist/{calls-DXRWsZ8n.mjs → calls-wOQGDWPl.mjs} +3 -3
- package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
- package/dist/client-certificates-CRf41xLe.mjs +3 -0
- package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
- package/dist/{cloudforce-one-B6HYfk5Z.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
- package/dist/{completions-D_9WsLG7.mjs → completions-DOeHPdCG.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-Bx3MgTHX.mjs +3 -0
- package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
- package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
- package/dist/connectors-DRt4e6d_.mjs +3 -0
- package/dist/{content-scanning-CnW2A0pv.mjs → content-scanning-Cd2vy5Sz.mjs} +3 -3
- package/dist/context-jpewmual.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
- package/dist/custom-nameservers-CWqA51in.mjs +3 -0
- package/dist/custom-pages-DeUKEFGe.mjs +4 -0
- package/dist/d1-DvWY9Gp4.mjs +4 -0
- package/dist/data-security-BPo6dIWu.mjs +6 -0
- package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-dVrgDUOp.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-C01_Lby6.mjs} +1 -1
- package/dist/diagnostics-6nKPmVgz.mjs +3 -0
- package/dist/{dispatch-namespaces-Cz2rajnP.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/{dist-DA54ZQu0.mjs → dist-t_YrL25p.mjs} +1 -1
- package/dist/{dns-62t95Xif.mjs → dns-ClciFGxx.mjs} +13 -13
- package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
- package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
- package/dist/{email-routing-BDUYYeV3.mjs → email-routing-CGXhFqF5.mjs} +9 -9
- package/dist/{email-security-ChHA6eqQ.mjs → email-security-D5viPq8S.mjs} +7 -7
- package/dist/email-sending-C2jpc3gh.mjs +3 -0
- package/dist/{filters-qJpU9uAS.mjs → filters-bzsFcWt0.mjs} +3 -3
- package/dist/{firewall-C3DDwfwh.mjs → firewall-DYZcTtIC.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-C03MtdZb.mjs} +1 -1
- package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
- package/dist/hostnames-CFgIVI3s.mjs +3 -0
- package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
- package/dist/iam-DqVPzGrb.mjs +6 -0
- package/dist/{images-D1jI3r3O.mjs → images-BYfl4YgR.mjs} +6 -6
- package/dist/index.mjs +1 -1
- package/dist/intel-duTEPIHc.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-nv9INuWZ.mjs} +1 -1
- package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
- package/dist/{kv-CSWoD9ks.mjs → kv-CZoV4tiv.mjs} +4 -4
- package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
- package/dist/{load-balancers-Du1tNuUt.mjs → load-balancers--OMg0HNt.mjs} +5 -5
- package/dist/{logpush-SuJyO-uX.mjs → logpush-C0_lZTyY.mjs} +3 -3
- package/dist/{logs-DcDNRPRl.mjs → logs-BtpWZQfV.mjs} +2 -2
- package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
- package/dist/{magic-network-monitoring-CqtvOePQ.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
- package/dist/{magic-transit-BTbkhBtF.mjs → magic-transit-CLhMcJ_-.mjs} +32 -32
- package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
- package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
- package/dist/{network-interconnects-DsiNytOU.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
- package/dist/oauth-Bk-F-tIO.mjs +52 -0
- package/dist/{observability-CLqZ7OSi.mjs → observability-BynRbTF4.mjs} +3 -3
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-BqJHyvMK.mjs} +3 -3
- package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
- package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-EZHJePmn.mjs} +4 -4
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CXJioWPs.mjs} +5 -5
- package/dist/{pages-ChurJ2H7.mjs → pages-D4aYteKk.mjs} +8 -8
- package/dist/{pipelines-CeyujvRf.mjs → pipelines-G8Iusxq-.mjs} +5 -5
- package/dist/progress-DrDErV9w.mjs +2 -0
- package/dist/queues-DEkbKqZX.mjs +6 -0
- package/dist/{r2-BtuTO3vQ.mjs → r2-CV0IkCAW.mjs} +9 -9
- package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-D986zPJr.mjs} +1 -1
- package/dist/{rate-limits-Bbk7HxP7.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
- package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
- package/dist/{realtime-kit-CivLpkpg.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CDIwTz3G.mjs} +6 -6
- package/dist/request-tracers-D7SFMDik.mjs +2 -0
- package/dist/{resource-sharing-B-Pcto7-.mjs → resource-sharing-YIQ04jXE.mjs} +4 -4
- package/dist/{resource-tagging-Bpb6Qq1M.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
- package/dist/rules-DHjLP5Kx.mjs +4 -0
- package/dist/{rulesets-lYczEcJp.mjs → rulesets-q4QABpKs.mjs} +7 -7
- package/dist/rum-SmT4HZmM.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-BR31o4P6.mjs} +1 -1
- package/dist/{schema-validation-DTq517Em.mjs → schema-validation-vVetgC_P.mjs} +5 -5
- package/dist/{scim-BiLfOQ89.mjs → scim-ChOkZpNx.mjs} +2 -2
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-BAK9G12O.mjs} +12 -12
- package/dist/security-center-eScuYDKP.mjs +2 -0
- package/dist/security-txt-x7R4gmQu.mjs +3 -0
- package/dist/session-DHYCE-PM.mjs +93 -0
- package/dist/shared-BAjo72Lz.mjs +2 -0
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
- package/dist/snippets-DrlgYJYp.mjs +4 -0
- package/dist/{spawn-DK7pott_.mjs → spawn-CCGzKlC4.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-pVGxb7u5.mjs} +6 -6
- package/dist/speed-ZFrMWDgd.mjs +4 -0
- package/dist/src-DU7FBCOX.mjs +108 -0
- package/dist/ssl-9JY05sYt.mjs +15 -0
- package/dist/{stream-CGTRN4ZN.mjs → stream-tRU39b8K.mjs} +13 -13
- package/dist/{tenants-o_M62Y1n.mjs → tenants-HLGUazms.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-_VdamKpz.mjs} +4 -4
- package/dist/{tools-DtNNmO6l.mjs → tools-D_hfUU_Z.mjs} +1 -1
- package/dist/{turnstile-l7mo9BWL.mjs → turnstile-BRzXd28B.mjs} +4 -4
- package/dist/{ui-B97lRnOv.mjs → ui-erjBdVKL.mjs} +1 -1
- package/dist/url-normalization-D-NxuLtN.mjs +3 -0
- package/dist/url-scanner-BzzR6iDx.mjs +2 -0
- package/dist/{user-CiyYZ69X.mjs → user-C4omq__w.mjs} +1 -1
- package/dist/vectorize-By6EqcNR.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-CBHwWPAM.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
- package/dist/{web3-DlHE0CZc.mjs → web3-DQ5dmE9W.mjs} +3 -3
- package/dist/{workers-DRAkU6YR.mjs → workers-D8Be7_as.mjs} +14 -14
- package/dist/workers-builds-BE3W3qNk.mjs +7 -0
- package/dist/{workflows-z6oapEJs.mjs → workflows-BWWufqFA.mjs} +3 -3
- package/dist/zaraz-Bsa9AvVL.mjs +2 -0
- package/dist/{zero-trust-fyyIelWx.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
- package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-BXtdwt6E.mjs} +6 -6
- package/package.json +1 -1
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/bot-management-CJxD1pqi.mjs +0 -5
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hostnames-BdAQo1Mr.mjs +0 -3
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/keyless-certificates-C4MZ4xnf.mjs +0 -3
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/snippets-DrpqSXYC.mjs +0 -4
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/ssl-Cp6tQkZH.mjs +0 -15
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/zaraz-CyzfYOEU.mjs +0 -2
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-BeyOc81z.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-OOwvpR8m.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-C3h-mwp7.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>t.tokenValidation.configuration.delete({zone_id:a,config_id:e[`config-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`title`,{type:`string`,description:`The title 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 b={command:`edit <config-id>`,describe:`Edit fields of an existing Token Configuration`,builder:y,handler:async e=>{if(e.dryRun){c({command:`cf token-validation configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({description:u(e.description,`description`,`text`),title:u(e.title,`title`,`text`)}):a(e.body)});return}let t=await i(e),
|
|
2
|
+
import{E as e,T as t,w as n,x as r}from"./oauth-Bk-F-tIO.mjs";import{n as i}from"./auth-CSC4yhEJ.mjs";import{n as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-DrDErV9w.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./cli-types-BeyOc81z.mjs";function f(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`title`,{type:`string`,description:`The title field`}).option(`token-type`,{type:`string`,description:`The token_type field`,choices:[`JWT`]}).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`,describe:`Create a new Token Validation configuration`,builder:f,handler:async n=>{if(n.dryRun){c({command:`cf token-validation configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({description:u(n.description,`description`,`text`),title:u(n.title,`title`,`text`),token_type:u(n[`token-type`],`token-type`,`text`)}):a(n.body)});return}let d=await i(n),f=await r({zone:n.zone},d,{quiet:n.quiet});if(n.zoneId=f,n.body){let e=a(n.body);s(await l(`Creating`,async()=>d.tokenValidation.configuration.create({...e,zone_id:f})),{successLabel:`Created`});return}n.description===void 0&&(n.description=await e(`description`,`The description field`)),n.title===void 0&&(n.title=await e(`title`,`The title field`)),n[`token-type`]===void 0&&(n[`token-type`]=await t(`token-type`,`The token_type field`,[`JWT`]));let p=o({description:u(n.description,`description`,`text`),title:u(n.title,`title`,`text`),token_type:u(n[`token-type`],`token-type`,`text`)});s(await l(`Creating`,async()=>d.tokenValidation.configuration.create({...p,zone_id:f})),{successLabel:`Created`})}};function m(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request payload for create and PUT credentials operations. Provided keys define the complete stored key set. Key identities (`{alg,kid}`) must be unique."})}const h={command:`update <config-id>`,describe:'Update Token Configuration credentials with full replacement semantics. Key identities (`{alg,kid}`) must be unique within the request. Symmetric keys (`kty: "oct"`) require `k`; `k: null` is invalid.',builder:m,handler:async e=>{if(e.dryRun){c({command:`cf token-validation configuration credentials update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}/credentials`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=a(e.body);s(await l(`Updating`,async()=>t.tokenValidation.configuration.credentials.update({body:r,zone_id:n,config_id:e[`config-id`]})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},g={command:`credentials`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <config-id>`,describe:`Delete Token Configuration`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf token-validation configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}s(await l(`Deleting`,async()=>t.tokenValidation.configuration.delete({zone_id:a,config_id:e[`config-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`title`,{type:`string`,description:`The title 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 b={command:`edit <config-id>`,describe:`Edit fields of an existing Token Configuration`,builder:y,handler:async e=>{if(e.dryRun){c({command:`cf token-validation configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({description:u(e.description,`description`,`text`),title:u(e.title,`title`,`text`)}):a(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=a(e.body);s(await l(`Updating`,async()=>t.tokenValidation.configuration.edit({...r,zone_id:n,config_id:e[`config-id`]})),{successLabel:`Updated`});return}let d=o({description:u(e.description,`description`,`text`),title:u(e.title,`title`,`text`)});s(await l(`Updating`,async()=>t.tokenValidation.configuration.edit({...d,zone_id:n,config_id:e[`config-id`]})),{successLabel:`Updated`})}};function x(e){return e.positional(`config-id`,{type:`string`,description:`Token Configuration ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <config-id>`,describe:`Get a single Token Configuration`,builder:x,handler:async e=>{if(e.dryRun){c({command:`cf token-validation configuration get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await l(`Loading`,async()=>t.tokenValidation.configuration.get({zone_id:n,config_id:e[`config-id`]})),{successLabel:`Loaded`})}};function C(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Lists all token validation configurations for this zone`,builder:C,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){c({command:`cf token-validation configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),a=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>n.tokenValidation.configuration.list({zone_id:a,...t})),{successLabel:`Loaded`})}},T={command:`configuration`,describe:`Token validation configurations defining JWT sources, JWKS endpoints, and claim requirements`,builder:e=>e.command(p).command(v).command(b).command(S).command(w).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`bulk-create`,describe:`Create zone token validation rules. A request can create multiple Token Validation Rules.`,builder:E,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=a(e.body);s(await l(`Creating`,async()=>t.tokenValidation.rules.bulkCreate({body:r,zone_id:n})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`bulk-edit`,describe:"Edit token validation rules. A request can update multiple Token Validation Rules. Rules can be re-ordered using the `position` field. Returns all updated rules.",builder:O,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/bulk`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=a(e.body);s(await l(`Updating`,async()=>t.tokenValidation.rules.bulkEdit({body:r,zone_id:n})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function A(e){return e.option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`description`,{type:`string`,description:"A human-readable description that gives more details than `title`."}).option(`enabled`,{type:`boolean`,description:`Toggle rule on or off.`}).option(`expression`,{type:`string`,description:`Rule expression. Requests that fail to match this expression will be subject to \`action\`.
|
|
4
4
|
|
|
5
5
|
For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/).
|
|
6
|
-
`}).option(`title`,{type:`string`,description:`A human-readable name for the 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)`})}const j={command:`create`,describe:`Create a token validation rule.`,builder:A,handler:async
|
|
6
|
+
`}).option(`title`,{type:`string`,description:`A human-readable name for the 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)`})}const j={command:`create`,describe:`Create a token validation rule.`,builder:A,handler:async n=>{if(n.dryRun){c({command:`cf token-validation rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?o({action:u(n.action,`action`,`text`),description:u(n.description,`description`,`text`),enabled:n.enabled,expression:u(n.expression,`expression`,`text`),title:u(n.title,`title`,`text`)}):a(n.body)});return}let d=await i(n),f=await r({zone:n.zone},d,{quiet:n.quiet});if(n.zoneId=f,n.body){let e=a(n.body);s(await l(`Creating`,async()=>d.tokenValidation.rules.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(n.action===void 0&&(n.action=await t(`action`,"Action to take on requests that match operations included in `selector` and fail `expression`.",[`log`,`block`])),n.description===void 0&&(n.description=await e(`description`,"A human-readable description that gives more details than `title`.")),n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);n.expression===void 0&&(n.expression=await e(`expression`,"Rule expression. Requests that fail to match this expression will be subject to `action`. For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). ")),n.title===void 0&&(n.title=await e(`title`,`A human-readable name for the rule.`));let p=o({action:u(n.action,`action`,`text`),description:u(n.description,`description`,`text`),enabled:n.enabled,expression:u(n.expression,`expression`,`text`),title:u(n.title,`title`,`text`)});s(await l(`Creating`,async()=>d.tokenValidation.rules.create({body:p,zone_id:f})),{successLabel:`Created`})}};function M(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const N={command:`delete <rule-id>`,describe:`Delete a zone token validation rule.`,builder:M,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let t=await i(e),a=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
7
|
`);return}s(await l(`Deleting`,async()=>t.tokenValidation.rules.delete({zone_id:a,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function P(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation Rule ID`,demandOption:!0}).option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`description`,{type:`string`,description:"A human-readable description that gives more details than `title`."}).option(`enabled`,{type:`boolean`,description:`Toggle rule on or off.`}).option(`expression`,{type:`string`,description:`Rule expression. Requests that fail to match this expression will be subject to \`action\`.
|
|
8
8
|
|
|
9
9
|
For details on expressions, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/).
|
|
10
|
-
`}).option(`title`,{type:`string`,description:`A human-readable name for the rule.`}).option(`position-index`,{type:`number`,description:`Move rule to this position`}).option(`position-before`,{type:`string`,description:`Move rule to before rule with this ID.`}).option(`position-after`,{type:`string`,description:`Move rule to after rule with this ID.`}).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-index`,[`position-before`,`position-after`]).conflicts(`position-before`,[`position-index`,`position-after`]).conflicts(`position-after`,[`position-index`,`position-before`])}const F={command:`edit <rule-id>`,describe:`Edit a zone token validation rule.`,builder:P,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({action:u(e.action,`action`,`text`),description:u(e.description,`description`,`text`),enabled:e.enabled,expression:u(e.expression,`expression`,`text`),title:u(e.title,`title`,`text`),position:{index:e[`position-index`],before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`)}}):a(e.body)});return}let t=await i(e),
|
|
10
|
+
`}).option(`title`,{type:`string`,description:`A human-readable name for the rule.`}).option(`position-index`,{type:`number`,description:`Move rule to this position`}).option(`position-before`,{type:`string`,description:`Move rule to before rule with this ID.`}).option(`position-after`,{type:`string`,description:`Move rule to after rule with this ID.`}).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-index`,[`position-before`,`position-after`]).conflicts(`position-before`,[`position-index`,`position-after`]).conflicts(`position-after`,[`position-index`,`position-before`])}const F={command:`edit <rule-id>`,describe:`Edit a zone token validation rule.`,builder:P,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({action:u(e.action,`action`,`text`),description:u(e.description,`description`,`text`),enabled:e.enabled,expression:u(e.expression,`expression`,`text`),title:u(e.title,`title`,`text`),position:{index:e[`position-index`],before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`)}}):a(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=a(e.body);s(await l(`Updating`,async()=>t.tokenValidation.rules.edit({body:r,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let d=o({action:u(e.action,`action`,`text`),description:u(e.description,`description`,`text`),enabled:e.enabled,expression:u(e.expression,`expression`,`text`),title:u(e.title,`title`,`text`),position:{index:e[`position-index`],before:u(e[`position-before`],`position-before`,`text`),after:u(e[`position-after`],`position-after`,`text`)}});s(await l(`Updating`,async()=>t.tokenValidation.rules.edit({body:d,zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function I(e){return e.positional(`rule-id`,{type:`string`,description:`Token Validation Rule ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <rule-id>`,describe:`Get a zone token validation rule.`,builder:I,handler:async e=>{if(e.dryRun){c({command:`cf token-validation rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,s(await l(`Loading`,async()=>t.tokenValidation.rules.get({zone_id:n,rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function R(e){return e.option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`token-configuration`,{type:`string`,description:`Select rules using any of these token configurations.`}).option(`action`,{type:`string`,description:"Action to take on requests that match operations included in `selector` and fail `expression`.",choices:[`log`,`block`]}).option(`enabled`,{type:`boolean`,description:`Toggle rule on or off.`}).option(`id`,{type:`string`,description:`Select rules with these IDs.`}).option(`rule-id`,{type:`string`,description:`Select rules with these IDs.`}).option(`host`,{type:`string`,description:"Select rules with this host in `include`."}).option(`hostname`,{type:`string`,description:"Select rules with this host in `include`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`List token validation rules`,builder:d(R),handler:async e=>{let t={per_page:e[`per-page`],page:e.page,token_configuration:e[`token-configuration`],action:e.action,enabled:e.enabled,id:e.id,rule_id:e[`rule-id`],host:e.host,hostname:e.hostname};if(e.dryRun){c({command:`cf token-validation rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),a=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading`,async()=>n.tokenValidation.rules.list({zone_id:a,...t})),{successLabel:`Loaded`})}};function B(e){return e.option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`state`,{type:`string`,description:`State`}).option(`host`,{type:`string`,description:`Filter operations by host.`}).option(`hostname`,{type:`string`,description:`Filter operations by host.`}).option(`method`,{type:`string`,description:`Filter operations by method.`}).option(`endpoint`,{type:`string`,description:`Filter operations by endpoint. Allows substring matching.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Select operations covered by this rule. For details on selectors, see the [Cloudflare Docs](https://developers.cloudflare.com/api-shield/security/jwt-validation/). `})}const V={command:`create`,describe:"Preview operations covered by a Token Validation rule. The API will return all operations on a zone annotated with an additional `state` field. Operations with an `included` `state` will be covered by a Token Validation Rule.",builder:d(B),handler:async e=>{let t={per_page:e[`per-page`],page:e.page,state:e.state,host:e.host,hostname:e.hostname,method:e.method,endpoint:e.endpoint};if(e.dryRun){c({command:`cf token-validation rules preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/token_validation/rules/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`json`,body:e.body===void 0?void 0:a(e.body)});return}let n=await i(e),o=await r({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=o,e.body){let r=a(e.body);new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),s(await l(`Creating`,async()=>n.tokenValidation.rules.preview.create({body:r,zone_id:o,...t})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},H={command:`preview`,describe:`Preview token validation rule behavior before applying`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`rules`,describe:`Validation rules that enforce token requirements on specific API endpoints`,builder:e=>e.command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`token-validation`,describe:`Validate JWT tokens at the edge — configure token sources, signing keys, and validation rules`,builder:e=>e.command(T).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./output-
|
|
2
|
+
import{t as e}from"./output-B6fBFRqe.mjs";import{n as t,t as n}from"./metadata-OOwvpR8m.mjs";function r(e){return e.replace(/[\s-]+/g,`_`)}function i(e){let t={type:e.type,description:e.description};return`default`in e&&e.default!==void 0&&(t.default=e.default),e.enum&&e.enum.length>0&&(t.enum=e.enum),t}function a(e){let t={},n=[];for(let r of e.arguments)t[r.name]=i(r),r.required&&n.push(r.name);for(let r of e.options)t[r.name]=i(r),r.required&&n.push(r.name);return{name:r(e.command),description:e.description,inputSchema:{type:`object`,properties:t,required:n}}}const o={command:`tools`,describe:!1,builder:e=>e,handler:async r=>{let i=t(import.meta.url,`commands.json`,n)?.commands??null;if(i===null){console.error(`Warning: Command metadata file not found. Run the build to generate it.`),e({version:`1.0`,tools:[]});return}e({version:`1.0`,tools:i.map(a)})}};export{o as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";import{t as p}from"./cli-types-BeyOc81z.mjs";function m(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
|
|
3
3
|
expensive challenges in response to malicious bots (ENT only).
|
|
4
4
|
`}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
|
|
5
5
|
this setting can determine the clearance level to be set
|
|
@@ -9,8 +9,8 @@ set this to a meaningful string to make it easier to identify your
|
|
|
9
9
|
widget, and where it is used.
|
|
10
10
|
`}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
|
|
11
11
|
`}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
|
|
12
|
-
`,choices:[`world`,`china`],default:`world`}).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:`Lists challenge widgets.`,builder:p(m),handler:async
|
|
13
|
-
`);return}c(await u(`Deleting`,async()=>n.turnstile.widgets.delete({account_id:o,sitekey:
|
|
12
|
+
`,choices:[`world`,`china`],default:`world`}).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:`Lists challenge widgets.`,builder:p(m),handler:async i=>{let p={page:i.page,per_page:i[`per-page`],order:i.order,direction:i.direction,filter:i.filter};if(i.dryRun){l({command:`cf turnstile widgets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:p,bodyKind:`json`,body:i.body===void 0?s({bot_fight_mode:i[`bot-fight-mode`],clearance_level:d(i[`clearance-level`],`clearance-level`,`text`),domains:i.domains,ephemeral_id:i[`ephemeral-id`],mode:d(i.mode,`mode`,`text`),name:d(i.name,`name`,`text`),offlabel:i.offlabel,region:d(i.region,`region`,`text`)}):o(i.body)});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=o(i.body);new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),c(await u(`Creating`,async()=>m.turnstile.widgets.create({...e,account_id:h,...p})),{successLabel:`Created`});return}if(i.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);i.mode===void 0&&(i.mode=await n(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),i.name===void 0&&(i.name=await e(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let g=s({bot_fight_mode:i[`bot-fight-mode`],clearance_level:d(i[`clearance-level`],`clearance-level`,`text`),domains:i.domains,ephemeral_id:i[`ephemeral-id`],mode:d(i.mode,`mode`,`text`),name:d(i.name,`name`,`text`),offlabel:i.offlabel,region:d(i.region,`region`,`text`)});new URLSearchParams(Object.entries(p).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),c(await u(`Creating`,async()=>m.turnstile.widgets.create({...g,account_id:h,...p})),{successLabel:`Created`})}};function g(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item 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 <sitekey>`,describe:`Destroy a Turnstile Widget.`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
13
|
+
`);return}c(await u(`Deleting`,async()=>n.turnstile.widgets.delete({account_id:o,sitekey:e.sitekey})),{successLabel:`Deleted`})}};function v(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <sitekey>`,describe:`Show a single challenge widget configuration.`,builder:v,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.turnstile.widgets.get({account_id:i,sitekey:e.sitekey})),{successLabel:`Loaded`})}};function b(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists all turnstile widgets of an account.`,builder:p(b),handler:async e=>{let n={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,filter:e.filter};if(e.dryRun){l({command:`cf turnstile widgets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await r(i);e.accountId=o,c(await u(`Loading`,async()=>i.turnstile.widgets.list({account_id:o,...n})),{successLabel:`Loaded`})}};function S(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`invalidate-immediately`,{type:`boolean`,description:"If `invalidate_immediately` is set to `false`, the previous secret will\nremain valid for two hours. Otherwise, the secret is immediately\ninvalidated, and requests using it will be rejected.\n",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`rotate-secret <sitekey>`,describe:"Generate a new secret key for this widget. If `invalidate_immediately` is set to `false`, the previous secret remains valid for 2 hours. Note that secrets cannot be rotated again during the grace period.",builder:S,handler:async e=>{if(e.dryRun){l({command:`cf turnstile widgets rotate-secret`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${e.sitekey==null?`<sitekey>`:encodeURIComponent(String(e.sitekey))}/rotate_secret`,pathParams:{sitekey:String(e.sitekey??``)},bodyKind:`json`,body:e.body===void 0?s({invalidate_immediately:e[`invalidate-immediately`]}):o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>n.turnstile.widgets.rotateSecret({...t,account_id:i,sitekey:e.sitekey})),{successLabel:`Created`});return}let d=s({invalidate_immediately:e[`invalidate-immediately`]});c(await u(`Creating`,async()=>n.turnstile.widgets.rotateSecret({...d,account_id:i,sitekey:e.sitekey})),{successLabel:`Created`})}};function w(e){return e.positional(`sitekey`,{type:`string`,description:`Widget item identifier tag.`,demandOption:!0}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
|
|
14
14
|
expensive challenges in response to malicious bots (ENT only).
|
|
15
15
|
`}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
|
|
16
16
|
this setting can determine the clearance level to be set
|
|
@@ -20,4 +20,4 @@ set this to a meaningful string to make it easier to identify your
|
|
|
20
20
|
widget, and where it is used.
|
|
21
21
|
`}).option(`offlabel`,{type:`boolean`,description:`Do not show any Cloudflare branding on the widget (ENT only).
|
|
22
22
|
`}).option(`region`,{type:`string`,description:`Region where this widget can be used. This cannot be changed after creation.
|
|
23
|
-
`,choices:[`world`,`china`]}).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 T={command:`update <sitekey>`,describe:`Update the configuration of a widget.`,builder:w,handler:async
|
|
23
|
+
`,choices:[`world`,`china`]}).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 T={command:`update <sitekey>`,describe:`Update the configuration of a widget.`,builder:w,handler:async i=>{if(i.dryRun){l({command:`cf turnstile widgets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/challenges/widgets/${i.sitekey==null?`<sitekey>`:encodeURIComponent(String(i.sitekey))}`,pathParams:{sitekey:String(i.sitekey??``)},bodyKind:`json`,body:i.body===void 0?s({bot_fight_mode:i[`bot-fight-mode`],clearance_level:d(i[`clearance-level`],`clearance-level`,`text`),domains:i.domains,ephemeral_id:i[`ephemeral-id`],mode:d(i.mode,`mode`,`text`),name:d(i.name,`name`,`text`),offlabel:i.offlabel,region:d(i.region,`region`,`text`)}):o(i.body)});return}let p=await a(i),m=i.local?f:await r(p);if(i.accountId=m,i.body){let e=o(i.body);c(await u(`Updating`,async()=>p.turnstile.widgets.update({...e,account_id:m,sitekey:i.sitekey})),{successLabel:`Updated`});return}if(i.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);i.mode===void 0&&(i.mode=await n(`mode`,`Widget Mode`,[`non-interactive`,`invisible`,`managed`])),i.name===void 0&&(i.name=await e(`name`,`Human readable widget name. Not unique. Cloudflare suggests that you set this to a meaningful string to make it easier to identify your widget, and where it is used. `));let h=s({bot_fight_mode:i[`bot-fight-mode`],clearance_level:d(i[`clearance-level`],`clearance-level`,`text`),domains:i.domains,ephemeral_id:i[`ephemeral-id`],mode:d(i.mode,`mode`,`text`),name:d(i.name,`name`,`text`),offlabel:i.offlabel,region:d(i.region,`region`,`text`)});c(await u(`Updating`,async()=>p.turnstile.widgets.update({...h,account_id:m,sitekey:i.sitekey})),{successLabel:`Updated`})}},E={command:`widgets`,describe:`Operations for widgets`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`turnstile`,describe:`turnstile`,builder:e=>e.command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./session-
|
|
2
|
+
import"./session-DHYCE-PM.mjs";import{i as e,n as t,t as n}from"./theme-DbNbIY4d.mjs";const r={bar:`│`,top:`┌`,bottom:`└`};function i(e,i,o){let s=o?.title??`Error`,c=t(),l=n.error,u=c.hex(l)(r.bar),d=c.hex(l)(r.top),f=c.hex(l)(r.bottom),p=Math.max(20,(process.stdout.columns||80)-2),m=[];if(m.push(``),m.push(`${d} ${c.hex(l).bold(s)}`),o?.rawMessage)for(let t of e.split(`
|
|
3
3
|
`))m.push(t.length>0?`${u} ${t}`:u);else for(let t of a(e,p))m.push(t.length>0?`${u} ${c.hex(l).bold(t)}`:u);if(i){m.push(u);for(let e of a(i,p))m.push(e.length>0?`${u} ${c.dim(e)}`:u)}return m.push(f),m.join(`
|
|
4
4
|
`)}function a(e,t){let n=[];for(let r of e.split(`
|
|
5
5
|
`)){if(r.length<=t){n.push(r);continue}let e=r.split(/\s+/),i=``;for(let r of e){if(!i){i=r;continue}i.length+1+r.length<=t?i+=` `+r:(n.push(i),i=r)}i&&n.push(i)}return n}function o(r){return`${t().hex(n.success)(e.success)} ${r}`}function s(r){return`${t().hex(n.warning)(e.warning)} ${r}`}function c(r){return`${t().hex(n.info)(e.info)} ${r}`}function l(r){let i=t().hex(n.muted);return`${i(e.arrow)} ${i(r)}`}export{i as a,s as i,c as n,o as r,l as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{T as e,w as t,x as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const d={command:`delete`,describe:`Deletes the URL Normalization settings.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf url-normalization delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}o(await c(`Deleting`,async()=>i.urlNormalization.delete({zone_id:a})),{successLabel:`Deleted`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Fetches the current URL Normalization settings.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf url-normalization get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.urlNormalization.get({zone_id:i})),{successLabel:`Loaded`})}};function m(e){return e.option(`scope`,{type:`string`,description:`The scope of the URL normalization.`,choices:[`incoming`,`both`,`none`]}).option(`type`,{type:`string`,description:`The type of URL normalization performed by Cloudflare.`,choices:[`cloudflare`,`rfc3986`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A URL Normalization object.`})}const h={command:`update`,describe:`Updates the URL Normalization settings.`,builder:m,handler:async t=>{if(t.dryRun){s({command:`cf url-normalization update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/url_normalization`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({scope:l(t.scope,`scope`,`text`),type:l(t.type,`type`,`text`)}):i(t.body)});return}let u=await r(t),d=await n({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=i(t.body);o(await c(`Updating`,async()=>u.urlNormalization.update({body:e,zone_id:d})),{successLabel:`Updated`});return}t.scope===void 0&&(t.scope=await e(`scope`,`The scope of the URL normalization.`,[`incoming`,`both`,`none`])),t.type===void 0&&(t.type=await e(`type`,`The type of URL normalization performed by Cloudflare.`,[`cloudflare`,`rfc3986`]));let f=a({scope:l(t.scope,`scope`,`text`),type:l(t.type,`type`,`text`)});o(await c(`Updating`,async()=>u.urlNormalization.update({body:f,zone_id:d})),{successLabel:`Updated`})}},g={command:`url-normalization`,describe:`Normalize incoming request URLs to a consistent format before rule evaluation and caching`,builder:e=>e.command(d).command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{E as e,S as t,g as n}from"./oauth-Bk-F-tIO.mjs";import{n as r}from"./auth-CSC4yhEJ.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-DrDErV9w.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";import{t as u}from"./local-CYc9q7l2.mjs";import{n as d,t as f}from"./raw-fetch-_n0lMAnD.mjs";function p(e){return e.positional(`response-id`,{type:`string`,description:`Response hash.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <response-id>`,describe:"Returns the raw response of the network request. Find the `response_id` in the `data.requests.response.hash`.",builder:p,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner responses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/responses/${e[`response-id`]==null?`<response-id>`:encodeURIComponent(String(e[`response-id`]))}`,pathParams:{"response-id":String(e[`response-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=e.local?u:await n(i);e.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/responses/${encodeURIComponent(String(e[`response-id`]))}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}},h={command:`responses`,describe:`Operations for responses`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of urls to scan (up to a 100).`})}const _={command:`bulk-create`,describe:`Submit URLs to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/ and take into account scans submitted in bulk have lower priority and may take longer to finish.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/bulk`,pathParams:{},bodyKind:`json`,body:e.body===void 0?void 0:i(e.body)});return}let a=await r(e),l=e.local?u:await n(a);if(e.accountId=l,e.body){let t=i(e.body);o(await c(`Creating`,async()=>a.urlScanner.scans.bulkCreate({body:t,account_id:l})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function v(e){return e.option(`agent-readiness`,{type:`boolean`,description:`Enable agent readiness checks.`}).option(`country`,{type:`string`,description:`Country to geo egress from`,choices:`AF.AL.DZ.AD.AO.AG.AR.AM.AU.AT.AZ.BH.BD.BB.BY.BE.BZ.BJ.BM.BT.BO.BA.BW.BR.BN.BG.BF.BI.KH.CM.CA.CV.KY.CF.TD.CL.CN.CO.KM.CG.CR.CI.HR.CU.CY.CZ.CD.DK.DJ.DM.DO.EC.EG.SV.GQ.ER.EE.SZ.ET.FJ.FI.FR.GA.GE.DE.GH.GR.GL.GD.GT.GN.GW.GY.HT.HN.HU.IS.IN.ID.IR.IQ.IE.IL.IT.JM.JP.JO.KZ.KE.KI.KW.KG.LA.LV.LB.LS.LR.LY.LI.LT.LU.MO.MG.MW.MY.MV.ML.MR.MU.MX.FM.MD.MC.MN.MS.MA.MZ.MM.NA.NR.NP.NL.NZ.NI.NE.NG.KP.MK.NO.OM.PK.PS.PA.PG.PY.PE.PH.PL.PT.QA.RO.RU.RW.SH.KN.LC.VC.WS.SM.ST.SA.SN.RS.SC.SL.SK.SI.SB.SO.ZA.KR.SS.ES.LK.SD.SR.SE.CH.SY.TW.TJ.TZ.TH.BS.GM.TL.TG.TO.TT.TN.TR.TM.UG.UA.AE.GB.US.UY.UZ.VU.VE.VN.YE.ZM.ZW`.split(`.`)}).option(`customagent`,{type:`string`,description:`The customagent field`}).option(`referer`,{type:`string`,description:`The referer field`}).option(`screenshots-resolutions`,{type:`string`,array:!0,description:`Take multiple screenshots targeting different device types.`}).option(`url`,{type:`string`,description:`The url field`}).option(`visibility`,{type:`string`,description:"The option `Public` means it will be included in listings like recent scans and search results. `Unlisted` means it will not be included in the aforementioned listings, users will need to have the scan's ID to access it. A a scan will be automatically marked as unlisted if it fails, if it contains potential PII or other sensitive material.",choices:[`Public`,`Unlisted`],default:`Public`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`create`,describe:`Submit a URL to scan. Check limits at https://developers.cloudflare.com/security-center/investigate/scan-limits/.`,builder:v,handler:async d=>{if(d.dryRun){s({command:`cf url-scanner scans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/scan`,pathParams:{},bodyKind:`json`,body:d.body===void 0?a({agentReadiness:d[`agent-readiness`],country:l(d.country,`country`,`text`),customagent:l(d.customagent,`customagent`,`text`),referer:l(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:l(d.url,`url`,`text`),visibility:l(d.visibility,`visibility`,`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.urlScanner.scans.create({...e,account_id:p})),{successLabel:`Created`});return}d.url===void 0&&(d.url=await e(`url`,`The url field`));let m=a({agentReadiness:d[`agent-readiness`],country:l(d.country,`country`,`text`),customagent:l(d.customagent,`customagent`,`text`),referer:l(d.referer,`referer`,`text`),screenshotsResolutions:d[`screenshots-resolutions`],url:l(d.url,`url`,`text`),visibility:l(d.visibility,`visibility`,`text`)});o(await c(`Creating`,async()=>f.urlScanner.scans.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`dom <scan-id>`,describe:`Returns a plain text response, with the scan's DOM content as rendered by Chrome.`,builder:b,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans dom`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/dom/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=e.local?u:await n(i);e.accountId=a,d((await c(`Loading`,async()=>f(`/accounts/${a}/urlscanner/v2/dom/${encodeURIComponent(String(e[`scan-id`]))}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}};function S(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <scan-id>`,describe:`Get URL scan by uuid`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/result/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=e.local?u:await n(i);e.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.get({account_id:a,scan_id:e[`scan-id`]})),{successLabel:`Loaded`})}};function w(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`har <scan-id>`,describe:`Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf url-scanner scans har`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/har/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}`,pathParams:{"scan-id":String(e[`scan-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=e.local?u:await n(i);e.accountId=a,o(await c(`Loading`,async()=>i.urlScanner.scans.har({account_id:a,scan_id:e[`scan-id`]})),{successLabel:`Loaded`})}};function E(e){return e.option(`size`,{type:`number`,description:`Limit the number of objects in the response.`}).option(`q`,{type:`string`,description:`Filter scans`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Use a subset of ElasticSearch Query syntax to filter scans. Some example queries:<br/> <br/>- 'path:"/bundles/jquery.js"': Searches for scans who requested resources with the given path.<br/>- 'page.asn:AS24940 AND hash:xxx': Websites hosted in AS24940 where a resource with the given hash was downloaded.<br/>- 'page.domain:microsoft* AND verdicts.malicious:true AND NOT page.domain:microsoft.com': malicious scans whose hostname starts with "microsoft".<br/>- 'apikey:me AND date:[2025-01 TO 2025-02]': my scans from 2025 January to 2025 February.`,builder:E,handler:async e=>{let i={size:e.size,q:e.q};if(e.dryRun){s({command:`cf url-scanner scans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/search`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(e),l=e.local?u:await n(a);e.accountId=l,o(await c(`Loading`,async()=>a.urlScanner.scans.list({account_id:l,...i})),{successLabel:`Loaded`})}};function O(e){return e.positional(`scan-id`,{type:`string`,description:`Scan UUID.`,demandOption:!0}).option(`resolution`,{type:`string`,description:`Target device type.`,choices:[`desktop`,`mobile`,`tablet`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`screenshot <scan-id>`,describe:`Get scan's screenshot by resolution (desktop/mobile/tablet).`,builder:O,handler:async e=>{let i={resolution:e.resolution};if(e.dryRun){s({command:`cf url-scanner scans screenshot`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/urlscanner/v2/screenshots/${e[`scan-id`]==null?`<scan-id>`:encodeURIComponent(String(e[`scan-id`]))}.png`,pathParams:{"scan-id":String(e[`scan-id`]??``)},query:i,bodyKind:`none`});return}let a=await r(e),o=e.local?u:await n(a);e.accountId=o;let l=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),p=await c(`Loading`,async()=>f(`/accounts/${o}/urlscanner/v2/screenshots/${encodeURIComponent(String(e[`scan-id`]))}.png${l?`?`+l:``}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));d(e.text===!0?p.toString(`utf-8`):p)}},A={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(_).command(y).command(x).command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`url-scanner`,describe:`Scan URLs for phishing, malware, and other threats — submit scans and retrieve detailed results`,builder:e=>e.command(h).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{j as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{E as e,T as t,w as n}from"./oauth-Bk-F-tIO.mjs";import{i as r,n as i}from"./auth-CSC4yhEJ.mjs";import{n as a,r as ee,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-DrDErV9w.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./cli-types-BeyOc81z.mjs";function te(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`list`,describe:`Gets a list of audit logs for a user account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:d(te),handler:async e=>{let t={id:e.id,export:e.export,"action.type":e[`action-type`],"actor.ip":e[`actor-ip`],"actor.email":e[`actor-email`],since:e.since,before:e.before,"zone.name":e[`zone-name`],direction:e.direction,per_page:e[`per-page`],page:e.page,hide_user_logs:e[`hide-user-logs`]};if(e.dryRun){c({command:`cf user audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/audit_logs`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.user.auditLogs.list(t)),{successLabel:`Loaded`})}},p={command:`audit-logs`,describe:`Review a chronological record of actions performed by or on behalf of your user`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order billing history by.`,choices:[`type`,`occurred_at`,`action`]}).option(`occurred-at`,{type:`string`,description:`When the billing item was created.`}).option(`type`,{type:`string`,description:`The billing item type.`}).option(`action`,{type:`string`,description:`The billing item action.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`list`,describe:`Accesses your billing history object.`,builder:d(m),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,occurred_at:e[`occurred-at`],type:e.type,action:e.action};if(e.dryRun){c({command:`cf user billing history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/billing/history`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.user.billing.history.list(t)),{successLabel:`Loaded`})}},g={command:`history`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Accesses your billing profile object.`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf user billing profile get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/billing/profile`,pathParams:{},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.user.billing.profile.get()),{successLabel:`Loaded`})}},y={command:`profile`,describe:`View billing history and payment profile for your user (deprecated — prefer account-level billing)`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`country`,{type:`string`,description:`The country in which the user lives.`}).option(`first-name`,{type:`string`,description:`User's first name`}).option(`last-name`,{type:`string`,description:`User's last name`}).option(`telephone`,{type:`string`,description:`User's telephone number`}).option(`zipcode`,{type:`string`,description:`The zipcode or postal code where the user lives.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`edit`,describe:`Edit part of your user details.`,builder:x,handler:async e=>{if(e.dryRun){c({command:`cf user edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({country:u(e.country,`country`,`text`),first_name:u(e[`first-name`],`first-name`,`text`),last_name:u(e[`last-name`],`last-name`,`text`),telephone:u(e.telephone,`telephone`,`text`),zipcode:u(e.zipcode,`zipcode`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.user.edit({...n})),{successLabel:`Updated`});return}let n=o({country:u(e.country,`country`,`text`),first_name:u(e[`first-name`],`first-name`,`text`),last_name:u(e[`last-name`],`last-name`,`text`),telephone:u(e.telephone,`telephone`,`text`),zipcode:u(e.zipcode,`zipcode`,`text`)});s(await l(`Updating`,async()=>t.user.edit({...n})),{successLabel:`Updated`})}};function C(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`create`,describe:`Creates a new IP Access rule for all zones owned by the current user. Note: To create an IP Access rule that applies to a specific zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:C,handler:async e=>{if(e.dryRun){c({command:`cf user firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`)}):a(e.body)});return}let n=await i(e);if(e.body){let t=a(e.body);s(await l(`Creating`,async()=>n.user.firewall.accessRules.create({...t})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let r=o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`)});s(await l(`Creating`,async()=>n.user.firewall.accessRules.create({...r})),{successLabel:`Created`})}};function T(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const E={command:`delete <rule-id>`,describe:`Deletes an IP Access rule at the user level. Note: Deleting a user-level rule will affect all zones owned by the user.`,builder:T,handler:async e=>{if(e.dryRun){c({command:`cf user firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let t=await i(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}s(await l(`Deleting`,async()=>t.user.firewall.accessRules.delete({rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function D(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the user level. You can only update the rule action (`mode` parameter) and notes.",builder:D,handler:async e=>{if(e.dryRun){c({command:`cf user firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({mode:u(e.mode,`mode`,`text`),notes:u(e.notes,`notes`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.user.firewall.accessRules.edit({...n,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let n=o({mode:u(e.mode,`mode`,`text`),notes:u(e.notes,`notes`,`text`)});s(await l(`Updating`,async()=>t.user.firewall.accessRules.edit({...n,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function k(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
|
|
4
4
|
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Fetches IP Access rules of the user. You can filter the results using several optional parameters.`,builder:d(k),handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){c({command:`cf user firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/firewall/access_rules/rules`,pathParams:{},query:t,bodyKind:`none`});return}let n=await i(e);s(await l(`Loading`,async()=>n.user.firewall.accessRules.list(t)),{successLabel:`Loaded`})}},j={command:`access-rules`,describe:`Firewall operations`,builder:e=>e.command(w).command(E).command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`firewall`,describe:`Operations for firewall`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get`,describe:`Retrieves detailed information about the currently authenticated user, including email, name, and account memberships.`,builder:N,handler:async e=>{if(e.dryRun){c({command:`cf user get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user`,pathParams:{},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.user.get()),{successLabel:`Loaded`})}};function F(e){return e.option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`create`,describe:`Create a configured monitor.`,builder:F,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.user.loadBalancers.monitors.create({...n})),{successLabel:`Created`});return}let n=o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)});s(await l(`Creating`,async()=>t.user.loadBalancers.monitors.create({...n})),{successLabel:`Created`})}};function L(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const R={command:`delete <monitor-id>`,describe:`Delete a configured monitor.`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let t=await i(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
5
|
`);return}s(await l(`Deleting`,async()=>t.user.loadBalancers.monitors.delete({monitor_id:e[`monitor-id`]})),{successLabel:`Deleted`})}};function z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`edit <monitor-id>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:z,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.user.loadBalancers.monitors.edit({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let n=o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)});s(await l(`Updating`,async()=>t.user.loadBalancers.monitors.edit({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}};function V(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <monitor-id>`,describe:`List a single configured monitor for a user.`,builder:V,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.user.loadBalancers.monitors.get({monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}};function U(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`List configured monitors for a user.`,builder:U,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors`,pathParams:{},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.user.loadBalancers.monitors.list()),{successLabel:`Loaded`})}};function G(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`create <monitor-id>`,describe:`Preview pools using the specified monitor with provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:G,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/preview`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Creating`,async()=>t.user.loadBalancers.monitors.preview.create({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Created`});return}let n=o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)});s(await l(`Creating`,async()=>t.user.loadBalancers.monitors.preview.create({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Created`})}},q={command:`preview`,describe:`Load Balancers operations`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`list`,describe:`Get the list of resources that reference the provided monitor.`,builder:J,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/references`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let t=await i(e);s(await l(`Loading`,async()=>t.user.loadBalancers.monitors.references.list({monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}},X={command:`references`,describe:`Load Balancers operations`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Q={command:`update <monitor-id>`,describe:`Modify a configured monitor.`,builder:Z,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)}):a(e.body)});return}let t=await i(e);if(e.body){let n=a(e.body);s(await l(`Updating`,async()=>t.user.loadBalancers.monitors.update({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let n=o({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:u(e.description,`description`,`text`),expected_body:u(e[`expected-body`],`expected-body`,`text`),expected_codes:u(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:u(e.method,`method`,`text`),path:u(e.path,`path`,`text`),port:e.port,probe_zone:u(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:u(e.type,`type`,`text`)});s(await l(`Updating`,async()=>t.user.loadBalancers.monitors.update({body:n,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}},ne={command:`monitors`,describe:`Load Balancers operations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(Q).command(q).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`,default:``}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`,default:!0}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`,default:0}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`hash`}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`,default:1}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`,default:``}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`],default:`random`}).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:`Create a new pool.`,builder:re,handler:async t=>{if(t.dryRun){c({command:`cf user load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:t.body===void 0?o({check_regions:t[`check-regions`],description:u(t.description,`description`,`text`),enabled:t.enabled,latitude:t.latitude,load_shedding:{default_percent:t[`load-shedding-default-percent`],default_policy:u(t[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:t[`load-shedding-session-percent`],session_policy:u(t[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:t.longitude,minimum_origins:t[`minimum-origins`],monitor:u(t.monitor,`monitor`,`text`),monitor_group:u(t[`monitor-group`],`monitor-group`,`text`),name:u(t.name,`name`,`text`),networks:t.networks,notification_email:u(t[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:t[`notification-filter-origin-disable`],healthy:t[`notification-filter-origin-healthy`]},pool:{disable:t[`notification-filter-pool-disable`],healthy:t[`notification-filter-pool-healthy`]}},origin_steering:{policy:u(t[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):a(t.body)});return}let n=await i(t);if(t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.user.loadBalancers.pools.create({...e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await e(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let r=o({check_regions:t[`check-regions`],description:u(t.description,`description`,`text`),enabled:t.enabled,latitude:t.latitude,load_shedding:{default_percent:t[`load-shedding-default-percent`],default_policy:u(t[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:t[`load-shedding-session-percent`],session_policy:u(t[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:t.longitude,minimum_origins:t[`minimum-origins`],monitor:u(t.monitor,`monitor`,`text`),monitor_group:u(t[`monitor-group`],`monitor-group`,`text`),name:u(t.name,`name`,`text`),networks:t.networks,notification_email:u(t[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:t[`notification-filter-origin-disable`],healthy:t[`notification-filter-origin-healthy`]},pool:{disable:t[`notification-filter-pool-disable`],healthy:t[`notification-filter-pool-healthy`]}},origin_steering:{policy:u(t[`origin-steering-policy`],`origin-steering-policy`,`text`)}});s(await l(`Creating`,async()=>n.user.loadBalancers.pools.create({...r})),{successLabel:`Created`})}};function ae(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`delete <pool-id>`,describe:`Delete a configured pool.`,builder:ae,handler:async e=>{if(e.dryRun){c({command:`cf user load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/user/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let t=await i(e);if(!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{i as a,n as o}from"./auth-CSC4yhEJ.mjs";import{n as s,t as c}from"./body-parser-DWSy7uZ8.mjs";import{t as l}from"./output-B6fBFRqe.mjs";import{n as u,t as d}from"./progress-DrDErV9w.mjs";import{n as f,t as p}from"./input-validation-_fMCApaH.mjs";import{t as m}from"./local-CYc9q7l2.mjs";function h(e){return e.option(`config-dimensions`,{type:`number`,description:`Specifies the number of dimensions for the index`}).option(`config-metric`,{type:`string`,description:`Specifies the type of metric to use calculating distance.`,choices:[`cosine`,`euclidean`,`dot-product`]}).option(`config-preset`,{type:`string`,description:`Specifies the preset to use for the index.`,choices:[`@cf/baai/bge-small-en-v1.5`,`@cf/baai/bge-base-en-v1.5`,`@cf/baai/bge-large-en-v1.5`,`openai/text-embedding-ada-002`,`cohere/embed-multilingual-v2.0`]}).option(`description`,{type:`string`,description:`Specifies the description of the index.`}).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)`}).conflicts(`config-dimensions`,[`config-preset`]).implies(`config-dimensions`,[`config-metric`]).conflicts(`config-metric`,[`config-preset`]).implies(`config-metric`,[`config-dimensions`]).conflicts(`config-preset`,[`config-dimensions`,`config-metric`])}const g={command:`create`,describe:`Creates and returns a new Vectorize Index.`,builder:h,handler:async n=>{if(n.dryRun){u({command:`cf vectorize create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({config:{dimensions:n[`config-dimensions`],metric:f(n[`config-metric`],`config-metric`,`text`),preset:f(n[`config-preset`],`config-preset`,`text`)},description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)}):s(n.body)});return}let i=await o(n),a=n.local?m:await r(i);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>i.vectorize.create({body:e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await e(`name`,`The name field`));let p=c({config:{dimensions:n[`config-dimensions`],metric:f(n[`config-metric`],`config-metric`,`text`),preset:f(n[`config-preset`],`config-preset`,`text`)},description:f(n.description,`description`,`text`),name:f(n.name,`name`,`text`)});l(await d(`Creating`,async()=>i.vectorize.create({body:p,account_id:a})),{successLabel:`Created`})}};function _(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`A list of vector identifiers to delete from the index indicated by the path.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`delete-by-ids <index-name>`,describe:`Delete a set of vectors from an index by their vector identifiers.`,builder:_,handler:async e=>{if(e.dryRun){u({command:`cf vectorize delete-by-ids`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/delete_by_ids`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`json`,body:e.body===void 0?c({ids:e.ids}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.vectorize.deleteByIds({body:t,account_id:i,index_name:e[`index-name`]})),{successLabel:`Created`});return}let a=c({ids:e.ids});l(await d(`Creating`,async()=>n.vectorize.deleteByIds({body:a,account_id:i,index_name:e[`index-name`]})),{successLabel:`Created`})}};function y(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete <index-name>`,describe:`Deletes the specified Vectorize Index.`,builder:y,handler:async e=>{if(e.dryRun){u({command:`cf vectorize delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`none`});return}let n=await o(e),a=e.local?m:await r(n);if(e.accountId=a,!await i({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}l(await d(`Deleting`,async()=>n.vectorize.delete({account_id:a,index_name:e[`index-name`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`ids`,{type:`string`,array:!0,description:`A list of vector identifiers to retrieve from the index indicated by the path.`}).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:`get-by-ids <index-name>`,describe:`Get a set of vectors from an index by their vector identifiers.`,builder:x,handler:async e=>{if(e.dryRun){u({command:`cf vectorize get-by-ids`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/get_by_ids`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`json`,body:e.body===void 0?c({ids:e.ids}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>n.vectorize.getByIds({body:t,account_id:i,index_name:e[`index-name`]})),{successLabel:`Created`});return}let a=c({ids:e.ids});l(await d(`Creating`,async()=>n.vectorize.getByIds({body:a,account_id:i,index_name:e[`index-name`]})),{successLabel:`Created`})}};function C(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <index-name>`,describe:`Returns the specified Vectorize Index.`,builder:C,handler:async e=>{if(e.dryRun){u({command:`cf vectorize get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.vectorize.get({account_id:i,index_name:e[`index-name`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`info <index-name>`,describe:`Get information about a vectorize index.`,builder:T,handler:async e=>{if(e.dryRun){u({command:`cf vectorize info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/info`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.vectorize.info({account_id:i,index_name:e[`index-name`]})),{successLabel:`Loaded`})}};function D(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`unparsable-behavior`,{type:`string`,description:`Behavior for ndjson parse failures.`,choices:[`error`,`discard`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const O={command:`insert <index-name>`,describe:`Inserts vectors into the specified index and returns a mutation id corresponding to the vectors enqueued for insertion.`,builder:D,handler:async e=>{let n={"unparsable-behavior":e[`unparsable-behavior`]};if(e.dryRun){u({command:`cf vectorize insert`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/insert`,pathParams:{"index-name":String(e[`index-name`]??``)},query:n,bodyKind:`octet-stream`,body:e.body});return}let i=await o(e),s=e.local?m:await r(i);if(e.accountId=s,e.file){let t=p(e.file);l(await d(`Creating`,async()=>a(i,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(e[`index-name`]))}/insert`,{body:t,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await d(`Creating`,async()=>a(i,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(e[`index-name`]))}/insert${r?`?`+r:``}`,{body:t,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function k(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`count`,{type:`number`,description:`Maximum number of vectors to return`}).option(`cursor`,{type:`string`,description:`Cursor for pagination to get the next page of results`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-vectors <index-name>`,describe:`Returns a paginated list of vector identifiers from the specified index.`,builder:k,handler:async e=>{let n={count:e.count,cursor:e.cursor};if(e.dryRun){u({command:`cf vectorize list-vectors`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/list`,pathParams:{"index-name":String(e[`index-name`]??``)},query:n,bodyKind:`none`});return}let i=await o(e),a=e.local?m:await r(i);e.accountId=a,l(await d(`Loading`,async()=>i.vectorize.listVectors({account_id:a,index_name:e[`index-name`],...n})),{successLabel:`Loaded`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list`,describe:`Returns a list of Vectorize Indexes`,builder:j,handler:async e=>{if(e.dryRun){u({command:`cf vectorize list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes`,pathParams:{},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.vectorize.list({account_id:i})),{successLabel:`Loaded`})}};function N(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`index-type`,{type:`string`,description:`Specifies the type of metadata property to index.`,choices:[`string`,`number`,`boolean`]}).option(`property-name`,{type:`string`,description:`Specifies the metadata property to index.`}).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 <index-name>`,describe:`Enable metadata filtering based on metadata property. Limited to 10 properties.`,builder:N,handler:async i=>{if(i.dryRun){u({command:`cf vectorize metadata-index create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${i[`index-name`]==null?`<index-name>`:encodeURIComponent(String(i[`index-name`]))}/metadata_index/create`,pathParams:{"index-name":String(i[`index-name`]??``)},bodyKind:`json`,body:i.body===void 0?c({indexType:f(i[`index-type`],`index-type`,`text`),propertyName:f(i[`property-name`],`property-name`,`text`)}):s(i.body)});return}let a=await o(i),p=i.local?m:await r(a);if(i.accountId=p,i.body){let e=s(i.body);l(await d(`Creating`,async()=>a.vectorize.metadataIndex.create({...e,account_id:p,index_name:i[`index-name`]})),{successLabel:`Created`});return}i[`index-type`]===void 0&&(i[`index-type`]=await n(`index-type`,`Specifies the type of metadata property to index.`,[`string`,`number`,`boolean`])),i[`property-name`]===void 0&&(i[`property-name`]=await e(`property-name`,`Specifies the metadata property to index.`));let h=c({indexType:f(i[`index-type`],`index-type`,`text`),propertyName:f(i[`property-name`],`property-name`,`text`)});l(await d(`Creating`,async()=>a.vectorize.metadataIndex.create({...h,account_id:p,index_name:i[`index-name`]})),{successLabel:`Created`})}};function F(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`property-name`,{type:`string`,description:`Specifies the metadata property for which the index must be deleted.`}).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 I={command:`delete <index-name>`,describe:`Allow Vectorize to delete the specified metadata index.`,builder:F,handler:async n=>{if(n.dryRun){u({command:`cf vectorize metadata-index delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${n[`index-name`]==null?`<index-name>`:encodeURIComponent(String(n[`index-name`]))}/metadata_index/delete`,pathParams:{"index-name":String(n[`index-name`]??``)},bodyKind:`json`,body:n.body===void 0?c({propertyName:f(n[`property-name`],`property-name`,`text`)}):s(n.body)});return}let a=await o(n),p=n.local?m:await r(a);if(n.accountId=p,!await i({force:!!n.force,message:`This operation deletes a metadata index destructively.`})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}if(n.body){let e=s(n.body);l(await d(`Deleting`,async()=>a.vectorize.metadataIndex.delete({...e,account_id:p,index_name:n[`index-name`]})),{successLabel:`Deleted`});return}n[`property-name`]===void 0&&(n[`property-name`]=await e(`property-name`,`Specifies the metadata property for which the index must be deleted.`));let h=c({propertyName:f(n[`property-name`],`property-name`,`text`)});l(await d(`Deleting`,async()=>a.vectorize.metadataIndex.delete({...h,account_id:p,index_name:n[`index-name`]})),{successLabel:`Deleted`})}};function L(e){return e.option(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`list`,describe:`List Metadata Indexes for the specified Vectorize Index.`,builder:L,handler:async e=>{if(e.dryRun){u({command:`cf vectorize metadata-index list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/metadata_index/list`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`none`});return}let n=await o(e),i=e.local?m:await r(n);e.accountId=i,l(await d(`Loading`,async()=>n.vectorize.metadataIndex.list({account_id:i,index_name:e[`index-name`]})),{successLabel:`Loaded`})}},z={command:`metadata-index`,describe:`Metadata indexes for filtered vector search`,builder:e=>e.command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`return-metadata`,{type:`string`,description:`Whether to return no metadata, indexed metadata or all metadata associated with the closest vectors.`,choices:[`none`,`indexed`,`all`],default:`none`}).option(`return-values`,{type:`boolean`,description:`Whether to return the values associated with the closest vectors.`,default:!1}).option(`top-k`,{type:`number`,description:`The number of nearest neighbors to find.`,default:5}).option(`vector`,{type:`string`,array:!0,description:`The search vector that will be used to find the nearest neighbors.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`query <index-name>`,describe:`Finds vectors closest to a given vector in an index.`,builder:B,handler:async e=>{if(e.dryRun){u({command:`cf vectorize query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/query`,pathParams:{"index-name":String(e[`index-name`]??``)},bodyKind:`json`,body:e.body===void 0?c({returnMetadata:f(e[`return-metadata`],`return-metadata`,`text`),returnValues:e[`return-values`],topK:e[`top-k`],vector:e.vector}):s(e.body)});return}let n=await o(e),i=e.local?m:await r(n);if(e.accountId=i,e.body){let t=s(e.body);l(await d(`Loading`,async()=>n.vectorize.query({...t,account_id:i,index_name:e[`index-name`]})),{successLabel:`Loaded`});return}if(e.vector===void 0)throw Error(`--vector is required (or pass --body with this field set).`);let a=c({returnMetadata:f(e[`return-metadata`],`return-metadata`,`text`),returnValues:e[`return-values`],topK:e[`top-k`],vector:e.vector});l(await d(`Loading`,async()=>n.vectorize.query({...a,account_id:i,index_name:e[`index-name`]})),{successLabel:`Loaded`})}};function H(e){return e.positional(`index-name`,{type:`string`,description:`Index name`,demandOption:!0}).option(`unparsable-behavior`,{type:`string`,description:`Behavior for ndjson parse failures.`,choices:[`error`,`discard`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const U={command:`upsert <index-name>`,describe:`Upserts vectors into the specified index, creating them if they do not exist and returns a mutation id corresponding to the vectors enqueued for upsertion.`,builder:H,handler:async e=>{let n={"unparsable-behavior":e[`unparsable-behavior`]};if(e.dryRun){u({command:`cf vectorize upsert`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/vectorize/v2/indexes/${e[`index-name`]==null?`<index-name>`:encodeURIComponent(String(e[`index-name`]))}/upsert`,pathParams:{"index-name":String(e[`index-name`]??``)},query:n,bodyKind:`octet-stream`,body:e.body});return}let i=await o(e),s=e.local?m:await r(i);if(e.accountId=s,e.file){let t=p(e.file);l(await d(`Creating`,async()=>a(i,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(e[`index-name`]))}/upsert`,{body:t,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(e.body){let t=f(e.body,`body`,`binary`),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();l(await d(`Creating`,async()=>a(i,`POST`,`/accounts/${s}/vectorize/v2/indexes/${encodeURIComponent(String(e[`index-name`]))}/upsert${r?`?`+r:``}`,{body:t,headers:{"Content-Type":`application/x-ndjson`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},W={command:`vectorize`,describe:`Globally distributed vector database for building semantic search, recommendations, and RAG applications on Workers`,builder:e=>e.command(g).command(b).command(v).command(w).command(S).command(E).command(O).command(M).command(A).command(V).command(U).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{W as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e,t}from"./shared-
|
|
2
|
+
import{n as e,t}from"./shared-BAjo72Lz.mjs";function n(t){return e(t).option(`preview-alias`,{type:`string`,description:`Preview alias for this Worker Version`,requiresArg:!0})}const r={command:`upload`,describe:`Upload a new Worker Version without deploying it`,builder:n,handler:async e=>{await t(e,{command:`Version upload`})}},i={command:`versions`,describe:`Manage Worker Versions`,builder:e=>e.command(r).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{i as default};
|