cf 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
- package/dist/auth-DX9KnJ0P.mjs +9 -0
- package/dist/auth-TYwGydWg.mjs +5 -0
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/context-C-WbewL6.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
- package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/progress-CL8I-7YK.mjs +2 -0
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/session-B8r8LNQN.mjs +93 -0
- package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
- package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
- package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/src-BQ1dr9xR.mjs +108 -0
- package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
- package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-CjtZ8x1z.mjs +0 -22
- package/dist/addressing-CHFK6uxW.mjs +0 -12
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/alerting-Bk85NNf5.mjs +0 -6
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
- package/dist/calls-DXRWsZ8n.mjs +0 -4
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/content-scanning-CnW2A0pv.mjs +0 -4
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
- package/dist/dist-DA54ZQu0.mjs +0 -82
- package/dist/dns-62t95Xif.mjs +0 -29
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-routing-BDUYYeV3.mjs +0 -10
- package/dist/email-security-ChHA6eqQ.mjs +0 -8
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/filters-qJpU9uAS.mjs +0 -4
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/images-D1jI3r3O.mjs +0 -7
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/kv-CSWoD9ks.mjs +0 -5
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/load-balancers-Du1tNuUt.mjs +0 -6
- package/dist/logpush-SuJyO-uX.mjs +0 -4
- package/dist/logs-DcDNRPRl.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
- package/dist/magic-transit-BTbkhBtF.mjs +0 -89
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/network-interconnects-DsiNytOU.mjs +0 -36
- package/dist/observability-CLqZ7OSi.mjs +0 -4
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/pages-ChurJ2H7.mjs +0 -11
- package/dist/pipelines-CeyujvRf.mjs +0 -6
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-BtuTO3vQ.mjs +0 -21
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/realtime-kit-CivLpkpg.mjs +0 -18
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
- package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rulesets-lYczEcJp.mjs +0 -8
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/schema-validation-DTq517Em.mjs +0 -24
- package/dist/scim-BiLfOQ89.mjs +0 -3
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/stream-CGTRN4ZN.mjs +0 -14
- package/dist/turnstile-l7mo9BWL.mjs +0 -23
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/user-CiyYZ69X.mjs +0 -10
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/web3-DlHE0CZc.mjs +0 -4
- package/dist/workers-DRAkU6YR.mjs +0 -18
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/workflows-z6oapEJs.mjs +0 -4
- package/dist/zero-trust-fyyIelWx.mjs +0 -118
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-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.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).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' and 'TCP'.`}).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:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(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. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-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.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).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' and 'TCP'.`,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 x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{r as c,t as l}from"./prompt-q3B7sM2A.mjs";function u(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-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.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).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' and 'TCP'.`,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 d={command:`create`,describe:`Create a new health check.`,builder:u,handler:async l=>{if(l.dryRun){a({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Creating`,async()=>u.healthchecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Creating`,async()=>u.healthchecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async n=>{if(n.dryRun){a({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>r.healthchecks.delete({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-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.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).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' and 'TCP'.`}).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:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async l=>{if(l.dryRun){a({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/healthchecks/${l[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(l[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(l[`healthcheck-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async n=>{if(n.dryRun){a({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.healthchecks.get({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(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. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async n=>{let r={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.healthchecks.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-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.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).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' and 'TCP'.`,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 x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async l=>{if(l.dryRun){a({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async n=>{if(n.dryRun){a({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await l({force:!!n.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}i(await o(`Deleting`,async()=>r.healthchecks.previews.delete({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async n=>{if(n.dryRun){a({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.healthchecks.previews.get({zone_id:s,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Loaded`})}},E={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-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.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).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(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).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' and 'TCP'.`}).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:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async l=>{if(l.dryRun){a({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/healthchecks/${l[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(l[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(l[`healthcheck-id`]??``),"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.healthchecks.update({body:e,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`});return}l.address===void 0&&(l.address=await c(`address`,`The hostname or IP address of the origin server to run health checks on.`)),l.name===void 0&&(l.name=await c(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=r({address:s(l.address,`address`,`text`),check_regions:l[`check-regions`],consecutive_fails:l[`consecutive-fails`],consecutive_successes:l[`consecutive-successes`],description:s(l.description,`description`,`text`),http_config:{allow_insecure:l[`http-config-allow-insecure`],expected_body:s(l[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:l[`http-config-expected-codes`],follow_redirects:l[`http-config-follow-redirects`],method:s(l[`http-config-method`],`http-config-method`,`text`),path:s(l[`http-config-path`],`http-config-path`,`text`),port:l[`http-config-port`]},interval:l.interval,name:s(l.name,`name`,`text`),retries:l.retries,suspended:l.suspended,tcp_config:{method:s(l[`tcp-config-method`],`tcp-config-method`,`text`),port:l[`tcp-config-port`]},timeout:l.timeout,type:s(l.type,`type`,`text`)});i(await o(`Updating`,async()=>u.healthchecks.update({body:f,zone_id:d,healthcheck_id:l[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(O).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{k as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{i as t,n}from"./auth-DX9KnJ0P.mjs";import{n as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{t as s}from"./prompt-q3B7sM2A.mjs";import{t as c}from"./cli-types-DGgEbf8K.mjs";function l(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:c(l),handler:async t=>{if(t.dryRun){a({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.hostnames.settings.tlsSingle.get({zone_id:s,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Loaded`})}},d={command:`tls-single`,describe:`Operations for settings.tls-single`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:c(f),handler:async t=>{if(t.dryRun){a({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`none`});return}let r=await n(t),c=await e({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=c,!await s({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>r.hostnames.settings.tls.delete({zone_id:c,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Deleted`})}};function m(e){return e.positional(`setting-id`,{type:`string`,description:'The TLS Setting name. The value type depends on the setting: - `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`). - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`). - `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:c(m),handler:async t=>{if(t.dryRun){a({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``)},bodyKind:`none`});return}let r=await n(t),s=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=s,i(await o(`Loading`,async()=>r.hostnames.settings.tls.get({zone_id:s,setting_id:t[`setting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:c(g),handler:async s=>{if(s.dryRun){a({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/hostnames/settings/${s[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(s[`setting-id`]))}/${s.hostname==null?`<hostname>`:encodeURIComponent(String(s.hostname))}`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``),"setting-id":String(s[`setting-id`]??``),hostname:String(s.hostname??``)},bodyKind:`json`,body:s.body===void 0?void 0:r(s.body)});return}let c=await n(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,s.body){let e=r(s.body);i(await o(`Updating`,async()=>c.hostnames.settings.tls.update({...e,zone_id:l,setting_id:s[`setting-id`],hostname:s.hostname})),{successLabel:`Updated`});return}i(await o(`Updating`,async()=>t(c,`PUT`,`/zones/${s.zoneId}/hostnames/settings/${encodeURIComponent(String(s[`setting-id`]))}/${encodeURIComponent(String(s.hostname))}`)),{successLabel:`Updated`})}},v={command:`tls`,describe:`Operations for settings.tls`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(v).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{n as u,r as d,t as f}from"./prompt-q3B7sM2A.mjs";function p(e){return e.option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
|
|
3
|
+
|
|
4
|
+
Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
|
|
5
|
+
If not specified, defaults to 20 for free tier and 60 for paid tier.
|
|
6
|
+
Contact Cloudflare if you need a higher limit.
|
|
7
|
+
`}).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(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const m={command:`create`,describe:`Creates and returns a new Hyperdrive configuration.`,builder:p,handler:async f=>{if(f.dryRun){o({command:`cf hyperdrive create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`json`,body:f.body===void 0?i({caching:{disabled:f[`caching-disabled`],max_age:f[`caching-max-age`],stale_while_revalidate:f[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(f[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(f[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(f[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(f.name,`name`,`text`),origin:{database:c(f[`origin-database`],`origin-database`,`text`),password:c(f[`origin-password`],`origin-password`,`text`),scheme:c(f[`origin-scheme`],`origin-scheme`,`text`),user:c(f[`origin-user`],`origin-user`,`text`),host:c(f[`origin-host`],`origin-host`,`text`),port:f[`origin-port`],access_client_id:c(f[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:c(f[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:c(f[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:f[`origin-connection-limit`]}):r(f.body)});return}let p=await n(f),m=f.local?l:await e();if(f.accountId=m,f.body){let e=r(f.body);a(await s(`Creating`,async()=>p.hyperdrive.create({body:e,account_id:m})),{successLabel:`Created`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),f[`origin-database`]===void 0&&(f[`origin-database`]=await d(`origin-database`,`Set the name of your origin database.`)),f[`origin-password`]===void 0&&(f[`origin-password`]=await d(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),f[`origin-scheme`]===void 0&&(f[`origin-scheme`]=await u(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),f[`origin-user`]===void 0&&(f[`origin-user`]=await d(`origin-user`,`Set the user of your origin database.`));let h=i({caching:{disabled:f[`caching-disabled`],max_age:f[`caching-max-age`],stale_while_revalidate:f[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(f[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(f[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(f[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(f.name,`name`,`text`),origin:{database:c(f[`origin-database`],`origin-database`,`text`),password:c(f[`origin-password`],`origin-password`,`text`),scheme:c(f[`origin-scheme`],`origin-scheme`,`text`),user:c(f[`origin-user`],`origin-user`,`text`),host:c(f[`origin-host`],`origin-host`,`text`),port:f[`origin-port`],access_client_id:c(f[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:c(f[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:c(f[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:f[`origin-connection-limit`]});a(await s(`Creating`,async()=>p.hyperdrive.create({body:h,account_id:m})),{successLabel:`Created`})}};function h(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <hyperdrive-id>`,describe:`Deletes the specified Hyperdrive.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf hyperdrive delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${r[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(r[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(r[`hyperdrive-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await f({force:!!r.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}a(await s(`Deleting`,async()=>i.hyperdrive.delete({account_id:c,hyperdrive_id:r[`hyperdrive-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
|
|
9
|
+
|
|
10
|
+
Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
|
|
11
|
+
If not specified, defaults to 20 for free tier and 60 for paid tier.
|
|
12
|
+
Contact Cloudflare if you need a higher limit.
|
|
13
|
+
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <hyperdrive-id>`,describe:`Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled.`,builder:_,handler:async u=>{if(u.dryRun){o({command:`cf hyperdrive edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${u[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(u[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(u[`hyperdrive-id`]??``)},bodyKind:`json`,body:u.body===void 0?i({caching:{disabled:u[`caching-disabled`],max_age:u[`caching-max-age`],stale_while_revalidate:u[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(u[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(u[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(u[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(u.name,`name`,`text`),origin_connection_limit:u[`origin-connection-limit`]}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Updating`,async()=>d.hyperdrive.edit({...e,account_id:f,hyperdrive_id:u[`hyperdrive-id`]})),{successLabel:`Updated`});return}let p=i({caching:{disabled:u[`caching-disabled`],max_age:u[`caching-max-age`],stale_while_revalidate:u[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(u[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(u[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(u[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(u.name,`name`,`text`),origin_connection_limit:u[`origin-connection-limit`]});a(await s(`Updating`,async()=>d.hyperdrive.edit({...p,account_id:f,hyperdrive_id:u[`hyperdrive-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <hyperdrive-id>`,describe:`Returns the specified Hyperdrive configuration.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf hyperdrive get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${r[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(r[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(r[`hyperdrive-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.hyperdrive.get({account_id:c,hyperdrive_id:r[`hyperdrive-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Returns a list of Hyperdrives.`,builder:x,handler:async r=>{let i={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf hyperdrive list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.hyperdrive.list({account_id:u,...i})),{successLabel:`Loaded`})}};function C(e){return e.positional(`hyperdrive-id`,{type:`string`,description:`The unique identifier of the Hyperdrive configuration.`,demandOption:!0}).option(`caching-disabled`,{type:`boolean`,description:`Set to true to disable caching of SQL responses. Default is false.`}).option(`caching-max-age`,{type:`number`,description:`Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.`}).option(`caching-stale-while-revalidate`,{type:`number`,description:`Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.`}).option(`mtls-ca-certificate-id`,{type:`string`,description:`Define CA certificate ID obtained after uploading CA cert.`}).option(`mtls-certificate-id`,{type:`string`,description:`Define mTLS certificate ID obtained after uploading client cert.`}).option(`mtls-sslmode`,{type:`string`,description:`Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.`,choices:[`require`,`verify-ca`,`verify-full`]}).option(`name`,{type:`string`,description:`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`}).option(`origin-database`,{type:`string`,description:`Set the name of your origin database.`}).option(`origin-password`,{type:`string`,description:`Set the password needed to access your origin database. The API never returns this write-only value.`}).option(`origin-scheme`,{type:`string`,description:`Specifies the URL scheme used to connect to your origin database.`,choices:[`postgres`,`postgresql`,`mysql`]}).option(`origin-user`,{type:`string`,description:`Set the user of your origin database.`}).option(`origin-host`,{type:`string`,description:`Defines the host (hostname or IP) of your origin database.`}).option(`origin-port`,{type:`number`,description:`Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.`}).option(`origin-access-client-id`,{type:`string`,description:`Defines the Client ID of the Access token to use when connecting to the origin database.`}).option(`origin-access-client-secret`,{type:`string`,description:`Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.`}).option(`origin-service-id`,{type:`string`,description:`The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.`}).option(`origin-connection-limit`,{type:`number`,description:`The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.
|
|
14
|
+
|
|
15
|
+
Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts.
|
|
16
|
+
If not specified, defaults to 20 for free tier and 60 for paid tier.
|
|
17
|
+
Contact Cloudflare if you need a higher limit.
|
|
18
|
+
`}).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(`origin-host`,[`origin-service-id`]).conflicts(`origin-port`,[`origin-access-client-id`,`origin-access-client-secret`,`origin-service-id`]).implies(`origin-port`,[`origin-host`]).conflicts(`origin-access-client-id`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-id`,[`origin-host`,`origin-access-client-secret`]).conflicts(`origin-access-client-secret`,[`origin-port`,`origin-service-id`]).implies(`origin-access-client-secret`,[`origin-host`,`origin-access-client-id`]).conflicts(`origin-service-id`,[`origin-host`,`origin-port`,`origin-access-client-id`,`origin-access-client-secret`])}const w={command:`update <hyperdrive-id>`,describe:`Updates and returns the specified Hyperdrive configuration.`,builder:C,handler:async f=>{if(f.dryRun){o({command:`cf hyperdrive update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/hyperdrive/configs/${f[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(f[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(f[`hyperdrive-id`]??``)},bodyKind:`json`,body:f.body===void 0?i({caching:{disabled:f[`caching-disabled`],max_age:f[`caching-max-age`],stale_while_revalidate:f[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(f[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(f[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(f[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(f.name,`name`,`text`),origin:{database:c(f[`origin-database`],`origin-database`,`text`),password:c(f[`origin-password`],`origin-password`,`text`),scheme:c(f[`origin-scheme`],`origin-scheme`,`text`),user:c(f[`origin-user`],`origin-user`,`text`),host:c(f[`origin-host`],`origin-host`,`text`),port:f[`origin-port`],access_client_id:c(f[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:c(f[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:c(f[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:f[`origin-connection-limit`]}):r(f.body)});return}let p=await n(f),m=f.local?l:await e();if(f.accountId=m,f.body){let e=r(f.body);a(await s(`Updating`,async()=>p.hyperdrive.update({body:e,account_id:m,hyperdrive_id:f[`hyperdrive-id`]})),{successLabel:`Updated`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),f[`origin-database`]===void 0&&(f[`origin-database`]=await d(`origin-database`,`Set the name of your origin database.`)),f[`origin-password`]===void 0&&(f[`origin-password`]=await d(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),f[`origin-scheme`]===void 0&&(f[`origin-scheme`]=await u(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),f[`origin-user`]===void 0&&(f[`origin-user`]=await d(`origin-user`,`Set the user of your origin database.`));let h=i({caching:{disabled:f[`caching-disabled`],max_age:f[`caching-max-age`],stale_while_revalidate:f[`caching-stale-while-revalidate`]},mtls:{ca_certificate_id:c(f[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`),mtls_certificate_id:c(f[`mtls-certificate-id`],`mtls-certificate-id`,`text`),sslmode:c(f[`mtls-sslmode`],`mtls-sslmode`,`text`)},name:c(f.name,`name`,`text`),origin:{database:c(f[`origin-database`],`origin-database`,`text`),password:c(f[`origin-password`],`origin-password`,`text`),scheme:c(f[`origin-scheme`],`origin-scheme`,`text`),user:c(f[`origin-user`],`origin-user`,`text`),host:c(f[`origin-host`],`origin-host`,`text`),port:f[`origin-port`],access_client_id:c(f[`origin-access-client-id`],`origin-access-client-id`,`text`),access_client_secret:c(f[`origin-access-client-secret`],`origin-access-client-secret`,`text`),service_id:c(f[`origin-service-id`],`origin-service-id`,`text`)},origin_connection_limit:f[`origin-connection-limit`]});a(await s(`Updating`,async()=>p.hyperdrive.update({body:h,account_id:m,hyperdrive_id:f[`hyperdrive-id`]})),{successLabel:`Updated`})}},T={command:`hyperdrive`,describe:`Accelerate access to existing databases by caching queries and pooling connections at the edge`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{T as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{r as u,t as d}from"./prompt-q3B7sM2A.mjs";import{t as f}from"./cli-types-DGgEbf8K.mjs";function p(e){return e.positional(`permission-group-id`,{type:`string`,description:`Permission Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <permission-group-id>`,describe:`Get information about a specific permission group in an account.`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf iam permission-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/permission_groups/${r[`permission-group-id`]==null?`<permission-group-id>`:encodeURIComponent(String(r[`permission-group-id`]))}`,pathParams:{"permission-group-id":String(r[`permission-group-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.iam.permissionGroups.get({account_id:c,permission_group_id:r[`permission-group-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`id`,{type:`string`,description:`ID of the permission group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the permission group to be fetched.`}).option(`label`,{type:`string`,description:`Label of the permission group to be fetched.`}).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 g={command:`list`,describe:`List all the permissions groups for an account.`,builder:h,handler:async r=>{let i={id:r.id,name:r.name,label:r.label,page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf iam permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/permission_groups`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.iam.permissionGroups.list({account_id:u,...i})),{successLabel:`Loaded`})}},_={command:`permission-groups`,describe:`View the permission groups that can be assigned to API tokens and policies`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`name`,{type:`string`,description:`Name of the resource group`}).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:`Create a new Resource Group under the specified account.`,builder:v,handler:async d=>{if(d.dryRun){o({command:`cf iam resource-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups`,pathParams:{},bodyKind:`json`,body:d.body===void 0?i({name:c(d.name,`name`,`text`)}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.iam.resourceGroups.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`Name of the resource group`));let m=i({name:c(d.name,`name`,`text`)});a(await s(`Creating`,async()=>f.iam.resourceGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group 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 x={command:`delete <resource-group-id>`,describe:`Remove a resource group from an account.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf iam resource-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${r[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(r[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(r[`resource-group-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await d({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>i.iam.resourceGroups.delete({account_id:c,resource_group_id:r[`resource-group-id`]})),{successLabel:`Deleted`})}};function S(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <resource-group-id>`,describe:`Get information about a specific resource group in an account.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf iam resource-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${r[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(r[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(r[`resource-group-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.iam.resourceGroups.get({account_id:c,resource_group_id:r[`resource-group-id`]})),{successLabel:`Loaded`})}};function w(e){return e.option(`id`,{type:`string`,description:`ID of the resource group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the resource group to be fetched.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`List all the resource groups for an account.`,builder:w,handler:async r=>{let i={id:r.id,name:r.name};if(r.dryRun){o({command:`cf iam resource-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.iam.resourceGroups.list({account_id:u,...i})),{successLabel:`Loaded`})}};function E(e){return e.positional(`resource-group-id`,{type:`string`,description:`Resource Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the resource group`}).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:`update <resource-group-id>`,describe:`Modify an existing resource group.`,builder:E,handler:async u=>{if(u.dryRun){o({command:`cf iam resource-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/resource_groups/${u[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(u[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(u[`resource-group-id`]??``)},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Updating`,async()=>d.iam.resourceGroups.update({...e,account_id:f,resource_group_id:u[`resource-group-id`]})),{successLabel:`Updated`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Updating`,async()=>d.iam.resourceGroups.update({...p,account_id:f,resource_group_id:u[`resource-group-id`]})),{successLabel:`Updated`})}},O={command:`resource-groups`,describe:`Define scopes that limit which account resources a policy or token can access`,builder:e=>e.command(y).command(x).command(C).command(T).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`begin-verification <sso-connector-id>`,describe:`Validates the user has added the DNS TXT record required for validating ownership of the domain they are trying to set up a connector for.`,builder:k,handler:async r=>{if(r.dryRun){o({command:`cf iam sso begin-verification`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${r[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(r[`sso-connector-id`]))}/begin_verification`,pathParams:{"sso-connector-id":String(r[`sso-connector-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Creating`,async()=>i.iam.sso.beginVerification({account_id:c,sso_connector_id:r[`sso-connector-id`]})),{successLabel:`Created`})}};function j(e){return e.option(`begin-verification`,{type:`boolean`,description:`Begin the verification process after creation`,default:!0}).option(`email-domain`,{type:`string`,description:`Email domain of the new SSO connector`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`,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 M={command:`create`,describe:`Creates a new SSO connector for logging into Cloudflare through an identity provider.`,builder:j,handler:async d=>{if(d.dryRun){o({command:`cf iam sso create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`json`,body:d.body===void 0?i({begin_verification:d[`begin-verification`],email_domain:c(d[`email-domain`],`email-domain`,`text`),use_fedramp_language:d[`use-fedramp-language`]}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.iam.sso.create({...e,account_id:p})),{successLabel:`Created`});return}d[`email-domain`]===void 0&&(d[`email-domain`]=await u(`email-domain`,`Email domain of the new SSO connector`));let m=i({begin_verification:d[`begin-verification`],email_domain:c(d[`email-domain`],`email-domain`,`text`),use_fedramp_language:d[`use-fedramp-language`]});a(await s(`Creating`,async()=>f.iam.sso.create({...m,account_id:p})),{successLabel:`Created`})}};function N(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector 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 P={command:`delete <sso-connector-id>`,describe:`Deletes an SSO connector from the account.`,builder:N,handler:async r=>{if(r.dryRun){o({command:`cf iam sso delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${r[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(r[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(r[`sso-connector-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await d({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}a(await s(`Deleting`,async()=>i.iam.sso.delete({account_id:c,sso_connector_id:r[`sso-connector-id`]})),{successLabel:`Deleted`})}};function F(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <sso-connector-id>`,describe:`Retrieves details for a specific SSO connector.`,builder:F,handler:async r=>{if(r.dryRun){o({command:`cf iam sso get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${r[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(r[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(r[`sso-connector-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.iam.sso.get({account_id:c,sso_connector_id:r[`sso-connector-id`]})),{successLabel:`Loaded`})}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Lists all SSO connectors configured for the account.`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf iam sso list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.iam.sso.list({account_id:c})),{successLabel:`Loaded`})}};function R(e){return e.positional(`sso-connector-id`,{type:`string`,description:`SSO Connector identifier tag.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`SSO Connector enabled state`}).option(`use-fedramp-language`,{type:`boolean`,description:`Controls the display of FedRAMP language to the user during SSO login`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`update <sso-connector-id>`,describe:`Updates the state or configuration of an SSO connector.`,builder:R,handler:async c=>{if(c.dryRun){o({command:`cf iam sso update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/sso_connectors/${c[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(c[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(c[`sso-connector-id`]??``)},bodyKind:`json`,body:c.body===void 0?i({enabled:c.enabled,use_fedramp_language:c[`use-fedramp-language`]}):r(c.body)});return}let u=await n(c),d=c.local?l:await e();if(c.accountId=d,c.body){let e=r(c.body);a(await s(`Updating`,async()=>u.iam.sso.update({...e,account_id:d,sso_connector_id:c[`sso-connector-id`]})),{successLabel:`Updated`});return}let f=i({enabled:c.enabled,use_fedramp_language:c[`use-fedramp-language`]});a(await s(`Updating`,async()=>u.iam.sso.update({...f,account_id:d,sso_connector_id:c[`sso-connector-id`]})),{successLabel:`Updated`})}},B={command:`sso`,describe:`Configure single sign-on connectors to authenticate account members through an external identity provider`,builder:e=>e.command(A).command(M).command(P).command(ee).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`name`,{type:`string`,description:`Name of the User group.`}).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:`Create a new user group under the specified account.`,builder:V,handler:async d=>{if(d.dryRun){o({command:`cf iam user-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups`,pathParams:{},bodyKind:`json`,body:d.body===void 0?i({name:c(d.name,`name`,`text`)}):r(d.body)});return}let f=await n(d),p=d.local?l:await e();if(d.accountId=p,d.body){let e=r(d.body);a(await s(`Creating`,async()=>f.iam.userGroups.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`Name of the User group.`));let m=i({name:c(d.name,`name`,`text`)});a(await s(`Creating`,async()=>f.iam.userGroups.create({...m,account_id:p})),{successLabel:`Created`})}};function U(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group 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 W={command:`delete <user-group-id>`,describe:`Remove a user group from an account.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf iam user-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${r[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(r[`user-group-id`]))}`,pathParams:{"user-group-id":String(r[`user-group-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await d({force:!!r.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}a(await s(`Deleting`,async()=>i.iam.userGroups.delete({account_id:c,user_group_id:r[`user-group-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <user-group-id>`,describe:`Get information about a specific user group in an account.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf iam user-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${r[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(r[`user-group-id`]))}`,pathParams:{"user-group-id":String(r[`user-group-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.iam.userGroups.get({account_id:c,user_group_id:r[`user-group-id`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`id`,{type:`string`,description:`ID of the user group to be fetched.`}).option(`name`,{type:`string`,description:`Name of the user group to be fetched.`}).option(`fuzzy-name`,{type:`string`,description:`A string used for searching for user groups containing that substring.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`The sort order of returned user groups by name (ascending or descending).`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`List all the user groups for an account.`,builder:f(q),handler:async r=>{let i={id:r.id,name:r.name,fuzzyName:r[`fuzzy-name`],page:r.page,per_page:r[`per-page`],direction:r.direction};if(r.dryRun){o({command:`cf iam user-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups`,pathParams:{},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.iam.userGroups.list({account_id:u,...i})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const X={command:`create <user-group-id>`,describe:`Add members to a User Group.`,builder:Y,handler:async i=>{if(i.dryRun){o({command:`cf iam user-groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${i[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(i[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(i[`user-group-id`]??``)},bodyKind:`json`,body:i.body===void 0?void 0:r(i.body)});return}let c=await n(i),u=i.local?l:await e();if(i.accountId=u,i.body){let e=r(i.body);a(await s(`Creating`,async()=>c.iam.userGroups.members.create({body:e,account_id:u,user_group_id:i[`user-group-id`]})),{successLabel:`Created`});return}if(i.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Z(e){return e.positional(`member-id`,{type:`string`,description:`The identifier of an existing account Member.`,demandOption:!0}).option(`user-group-id`,{type:`string`,description:`User Group 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 Q={command:`delete <member-id>`,describe:`Remove a member from User Group`,builder:Z,handler:async r=>{if(r.dryRun){o({command:`cf iam user-groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${r[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(r[`user-group-id`]))}/members/${r[`member-id`]==null?`<member-id>`:encodeURIComponent(String(r[`member-id`]))}`,pathParams:{"user-group-id":String(r[`user-group-id`]??``),"member-id":String(r[`member-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await d({force:!!r.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}a(await s(`Deleting`,async()=>i.iam.userGroups.members.delete({account_id:c,user_group_id:r[`user-group-id`],member_id:r[`member-id`]})),{successLabel:`Deleted`})}};function $(e){return e.option(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`fuzzy-email`,{type:`string`,description:`A string used for filtering members by partial email match.`}).option(`direction`,{type:`string`,description:`The sort order of returned user group members by email.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`list`,describe:`List all the members attached to a user group.`,builder:f($),handler:async r=>{let i={page:r.page,per_page:r[`per-page`],fuzzyEmail:r[`fuzzy-email`],direction:r.direction};if(r.dryRun){o({command:`cf iam user-groups members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${r[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(r[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(r[`user-group-id`]??``)},query:i,bodyKind:`none`});return}let c=await n(r),u=r.local?l:await e();r.accountId=u,a(await s(`Loading`,async()=>c.iam.userGroups.members.list({account_id:u,user_group_id:r[`user-group-id`],...i})),{successLabel:`Loaded`})}};function ne(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Set/Replace members to a user group.`})}const re={command:`update <user-group-id>`,describe:`Replace the set of members attached to a User Group.`,builder:ne,handler:async i=>{if(i.dryRun){o({command:`cf iam user-groups members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${i[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(i[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(i[`user-group-id`]??``)},bodyKind:`json`,body:i.body===void 0?void 0:r(i.body)});return}let c=await n(i),u=i.local?l:await e();if(i.accountId=u,i.body){let e=r(i.body);a(await s(`Updating`,async()=>c.iam.userGroups.members.update({body:e,account_id:u,user_group_id:i[`user-group-id`]})),{successLabel:`Updated`});return}if(i.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ie={command:`members`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(X).command(Q).command(te).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`user-group-id`,{type:`string`,description:`User Group identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`Name of the User group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`update <user-group-id>`,describe:`Modify an existing user group.`,builder:ae,handler:async u=>{if(u.dryRun){o({command:`cf iam user-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/iam/user_groups/${u[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(u[`user-group-id`]))}`,pathParams:{"user-group-id":String(u[`user-group-id`]??``)},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Updating`,async()=>d.iam.userGroups.update({...e,account_id:f,user_group_id:u[`user-group-id`]})),{successLabel:`Updated`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Updating`,async()=>d.iam.userGroups.update({...p,account_id:f,user_group_id:u[`user-group-id`]})),{successLabel:`Updated`})}},se={command:`user-groups`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(H).command(W).command(K).command(J).command(oe).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ce={command:`iam`,describe:`Identity and access management — permission groups, resource groups, user groups, and SSO connectors`,builder:e=>e.command(_).command(O).command(B).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ce as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.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-CL8I-7YK.mjs";import{n as l,t as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{n as f,r as p,t as m}from"./prompt-q3B7sM2A.mjs";import{t as h}from"./cli-types-DGgEbf8K.mjs";import{n as ee,t as te}from"./raw-fetch-bIXC9D1m.mjs";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:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`id`,{type:`string`,description:`An optional custom unique identifier for your image.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can use used for keeping references to another system of record for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token for the access.`}).option(`url`,{type:`string`,description:`A URL to fetch an image from origin. Only needed when type is uploading from a URL.`})}const _={command:`create`,describe:`Upload an image to CF Images. Images up to 10 Megabytes can be uploaded using a single HTTP POST (multipart/form-data) request by sending an image file or passing a URL accessible to the API.`,builder:g,handler:async i=>{if(i.dryRun){s({command:`cf images create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1`,pathParams:{},bodyKind:`multipart`,body:{body:i.body,file:i.file,creator:i.creator,id:i.id,metadata:i.metadata,"require-signed-urls":i[`require-signed-urls`],url:i.url}});return}let a=await r(i),f=i.local?d:await e();if(i.accountId=f,i.file!==void 0||i.body!==void 0||i.creator!==void 0||i.id!==void 0||i.metadata!==void 0||i[`require-signed-urls`]!==void 0||i.url!==void 0){let e=new FormData;if(i.file){let t=u(i.file);e.append(`file`,new Blob([t]),i.file.split(/[\\/]/).filter(Boolean).pop())}else i.body!==void 0&&e.append(`file`,i.body);if(i.creator!==void 0&&e.append(`creator`,String(l(i.creator,`creator`,`text`)??``)),i.id!==void 0&&e.append(`id`,String(l(i.id,`id`,`text`)??``)),i.metadata!==void 0){let t=typeof i.metadata==`string`?l(i.metadata,`metadata`,`text`):i.metadata;e.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}i[`require-signed-urls`]!==void 0&&e.append(`requireSignedURLs`,String(i[`require-signed-urls`])),i.url!==void 0&&e.append(`url`,String(l(i.url,`url`,`text`)??``)),o(await c(`Creating`,async()=>n(a,`POST`,`/accounts/${f}/images/v1`,{body:e})),{successLabel:`Created`});return}if(i.body){let e=l(i.body,`body`,`binary`);o(await c(`Creating`,async()=>n(a,`POST`,`/accounts/${f}/images/v1`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>a.images.create({account_id:f})),{successLabel:`Created`})}};function v(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const y={command:`delete <image-id>`,describe:`Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.`,builder:v,handler:async n=>{if(n.dryRun){s({command:`cf images delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${n[`image-id`]==null?`<image-id>`:encodeURIComponent(String(n[`image-id`]))}`,pathParams:{"image-id":String(n[`image-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation will delete this image.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}o(await c(`Deleting`,async()=>i.images.delete({account_id:a,image_id:n[`image-id`]})),{successLabel:`Deleted`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`expiry`,{type:`string`,description:`The date after which the upload will not be accepted. Minimum: Now + 2 minutes. Maximum: Now + 6 hours.`}).option(`id`,{type:`string`,description:`Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths, and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a UUID.`}).option(`metadata`,{type:`string`,description:`User modifiable key-value store. Can be used for keeping references to another system of record, for managing images.`}).option(`require-signed-urls`,{type:`boolean`,description:`Indicates whether the image requires a signature token to be accessed.`})}const x={command:`direct-upload`,describe:"Direct uploads allow users to upload images without API keys. A common use case are web apps, client-side applications, or mobile devices where users upload content directly to Cloudflare Images. This method creates a draft record for a future image. It returns an upload URL and an image identifier. To verify if the image itself has been uploaded, send an image details request (accounts/:account_identifier/images/v1/:identifier), and check that the `draft: true` property is not present.",builder:b,handler:async i=>{if(i.dryRun){s({command:`cf images direct-upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/direct_upload`,pathParams:{},bodyKind:`multipart`,body:{body:i.body,file:i.file,creator:i.creator,expiry:i.expiry,id:i.id,metadata:i.metadata,"require-signed-urls":i[`require-signed-urls`]}});return}let a=await r(i),f=i.local?d:await e();if(i.accountId=f,i.file!==void 0||i.body!==void 0||i.creator!==void 0||i.expiry!==void 0||i.id!==void 0||i.metadata!==void 0||i[`require-signed-urls`]!==void 0){let e=new FormData;if(i.file){let t=u(i.file);e.append(`file`,new Blob([t]),i.file.split(/[\\/]/).filter(Boolean).pop())}else i.body!==void 0&&e.append(`file`,i.body);if(i.creator!==void 0&&e.append(`creator`,String(l(i.creator,`creator`,`text`)??``)),i.expiry!==void 0&&e.append(`expiry`,String(l(i.expiry,`expiry`,`text`)??``)),i.id!==void 0&&e.append(`id`,String(l(i.id,`id`,`text`)??``)),i.metadata!==void 0){let t=typeof i.metadata==`string`?l(i.metadata,`metadata`,`text`):i.metadata;e.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}i[`require-signed-urls`]!==void 0&&e.append(`requireSignedURLs`,String(i[`require-signed-urls`])),o(await c(`Creating`,async()=>n(a,`POST`,`/accounts/${f}/images/v2/direct_upload`,{body:e})),{successLabel:`Created`});return}if(i.body){let e=l(i.body,`body`,`binary`);o(await c(`Creating`,async()=>n(a,`POST`,`/accounts/${f}/images/v2/direct_upload`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}o(await c(`Creating`,async()=>a.images.directUpload({account_id:f})),{successLabel:`Created`})}};function S(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`creator`,{type:`string`,description:`Can set the creator field with an internal user ID.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the image can be accessed using only its UID. If set to `true`, a signed token needs to be generated with a signing key to view the image. Returns a new UID on a change. No change if not specified."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`edit <image-id>`,describe:`Update a CF Images image's metadata, creator, or access control. On access control change, all copies of the image are purged from cache.`,builder:S,handler:async n=>{if(n.dryRun){s({command:`cf images edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${n[`image-id`]==null?`<image-id>`:encodeURIComponent(String(n[`image-id`]))}`,pathParams:{"image-id":String(n[`image-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({creator:l(n.creator,`creator`,`text`),requireSignedURLs:n[`require-signed-urls`]}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.images.edit({...e,account_id:f,image_id:n[`image-id`]})),{successLabel:`Updated`});return}let p=a({creator:l(n.creator,`creator`,`text`),requireSignedURLs:n[`require-signed-urls`]});o(await c(`Updating`,async()=>u.images.edit({...p,account_id:f,image_id:n[`image-id`]})),{successLabel:`Updated`})}};function w(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const T={command:`get-blob <image-id>`,describe:`Download an image from CF Images. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.`,builder:w,handler:async n=>{if(n.dryRun){s({command:`cf images get-blob`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${n[`image-id`]==null?`<image-id>`:encodeURIComponent(String(n[`image-id`]))}/blob`,pathParams:{"image-id":String(n[`image-id`]??``)},bodyKind:`none`});return}await r(n);let i=n.local?d:await e();n.accountId=i;let a=await c(`Loading`,async()=>te(`/accounts/${i}/images/v1/${encodeURIComponent(String(n[`image-id`]))}/blob`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));ee(n.text===!0?a.toString(`utf-8`):a)}};function E(e){return e.positional(`image-id`,{type:`string`,description:`Image unique identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <image-id>`,describe:`Fetch details for a CF Images image.`,builder:E,handler:async n=>{if(n.dryRun){s({command:`cf images get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/${n[`image-id`]==null?`<image-id>`:encodeURIComponent(String(n[`image-id`]))}`,pathParams:{"image-id":String(n[`image-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.get({account_id:a,image_id:n[`image-id`]})),{successLabel:`Loaded`})}};function O(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`create <signing-key-name>`,describe:`Create a new CF Images signing key with specified name. Returns all keys available.`,builder:O,handler:async n=>{if(n.dryRun){s({command:`cf images keys create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys/${n[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(n[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(n[`signing-key-name`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Updating`,async()=>i.images.keys.create({account_id:a,signing_key_name:n[`signing-key-name`]})),{successLabel:`Updated`})}};function A(e){return e.positional(`signing-key-name`,{type:`string`,description:`Signing key 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 j={command:`delete <signing-key-name>`,describe:`Delete a CF Images signing key with specified name. Returns all keys available. When the last key is removed, a new default signing key will be generated.`,builder:A,handler:async n=>{if(n.dryRun){s({command:`cf images keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys/${n[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(n[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(n[`signing-key-name`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation will delete this signing key. This will invalidate any URLs that are signed with this key.`})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}o(await c(`Deleting`,async()=>i.images.keys.delete({account_id:a,signing_key_name:n[`signing-key-name`]})),{successLabel:`Deleted`})}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`List your CF Images signing keys.`,builder:M,handler:async n=>{if(n.dryRun){s({command:`cf images keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/keys`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.keys.list({account_id:a})),{successLabel:`Loaded`})}},P={command:`keys`,describe:`Operations for keys`,builder:e=>e.command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`continuation-token`,{type:`string`,description:`Continuation token to fetch next page. Passed as a query param when requesting List V2 api endpoint.`}).option(`per-page`,{type:`number`,description:`Number of items per page`}).option(`sort-order`,{type:`string`,description:`Sorting order by upload time`,choices:[`asc`,`desc`]}).option(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:"List up to 10000 images from CF Images, with up to 1000 results per page. Use the optional parameters below to get a specific range of images. Pagination is supported via continuation_token. **Metadata Filtering (Optional):** You can optionally filter images by custom metadata fields using the `meta.<field>[<operator>]=<value>` syntax. **Supported Operators:** - `eq` / `eq:string` / `eq:number` / `eq:boolean` - Exact match - `gt` / `gt:number` - Greater than (number only) - `gte` / `gte:number` - Greater than or equal (number only) - `lt` / `lt:number` - Less than (number only) - `lte` / `lte:number` - Less than or equal (number only) - `in` / `in:string` / `in:number` - Match any value in list (pipe-separated) **Metadata Filter Constraints:** - Maximum 5 metadata filters per request - Maximum 5 levels of nesting (e.g., `meta.first.second.third.fourth.fifth`) - Maximum 10 elements for list operators (`in`) - Supports string, number, and boolean value types - Range operators (`gt`, `gte`, `lt`, `lte`) only accept numeric values **Filter Consistency:** Filters are combined with AND logic. The system does not validate whether filter combinations are logically consistent. For example, `meta.priority[eq:number]=5&meta.priority[lte:number]=3` will return zero results because no value can satisfy both conditions simultaneously. It is the caller's responsibility to ensure filter combinations make sense. **Examples:** ``` # List all images /images/v2 # Filter by metadata [eq] /images/v2?meta.status[eq:string]=active # Filter by metadata [in] /images/v2?meta.status[in]=pending|deleted|flagged # Filter by metadata [in:number] /images/v2?meta.ratings[in:number]=4|5 # Filter by metadata range [gte:number] /images/v2?meta.priority[gte:number]=1 # Filter by bounded range /images/v2?meta.priority[gte:number]=1&meta.priority[lte:number]=5 # Filter by nested metadata /images/v2?meta.region.name[eq]=eu-west # Combine metadata filters with creator /images/v2?meta.status[eq]=active&creator=user123 # Multiple metadata filters (AND logic) /images/v2?meta.status[eq]=active&meta.priority[eq:number]=5 ```",builder:h(F),handler:async n=>{let i={continuation_token:n[`continuation-token`],per_page:n[`per-page`],sort_order:n[`sort-order`],creator:n.creator};if(n.dryRun){s({command:`cf images list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.images.list({account_id:l,...i})),{successLabel:`Loaded`})}};function L(e){return e.option(`conflict-behaviour`,{type:`string`,description:`How to handle objects that already exist at the destination.`,choices:[`skip`,`overwrite`],default:`skip`}).option(`excluded-content-types`,{type:`string`,array:!0,description:`Content types to skip during migration.`}).option(`path-prefix`,{type:`string`,description:`Prefix to prepend to image custom IDs.`}).option(`root-directory`,{type:`string`,description:`Only import objects under this prefix in the source bucket.`}).option(`source-id`,{type:`string`,description:`The identifier of the source to migrate from.`}).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 R={command:`create`,describe:`Create a new migration from an existing source. The migration will import objects from the source bucket into Cloudflare Images.`,builder:L,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({conflictBehaviour:l(n[`conflict-behaviour`],`conflict-behaviour`,`text`),excludedContentTypes:n[`excluded-content-types`],pathPrefix:l(n[`path-prefix`],`path-prefix`,`text`),rootDirectory:l(n[`root-directory`],`root-directory`,`text`),sourceId:l(n[`source-id`],`source-id`,`text`)}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.images.sourcingKit.migrations.create({...e,account_id:f})),{successLabel:`Created`});return}n[`source-id`]===void 0&&(n[`source-id`]=await p(`source-id`,`The identifier of the source to migrate from.`));let m=a({conflictBehaviour:l(n[`conflict-behaviour`],`conflict-behaviour`,`text`),excludedContentTypes:n[`excluded-content-types`],pathPrefix:l(n[`path-prefix`],`path-prefix`,`text`),rootDirectory:l(n[`root-directory`],`root-directory`,`text`),sourceId:l(n[`source-id`],`source-id`,`text`)});o(await c(`Creating`,async()=>u.images.sourcingKit.migrations.create({...m,account_id:f})),{successLabel:`Created`})}};function z(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const B={command:`delete <migration-id>`,describe:`Delete an existing migration. Only completed, errored, or aborted migrations can be deleted.`,builder:z,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}`,pathParams:{"migration-id":String(n[`migration-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}o(await c(`Deleting`,async()=>i.images.sourcingKit.migrations.delete({account_id:a,migration_id:n[`migration-id`]})),{successLabel:`Deleted`})}};function V(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <migration-id>`,describe:`Fetch details for a single migration.`,builder:V,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}`,pathParams:{"migration-id":String(n[`migration-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.sourcingKit.migrations.get({account_id:a,migration_id:n[`migration-id`]})),{successLabel:`Loaded`})}};function U(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`abort <migration-id>`,describe:`Abort a running migration. Objects already imported will not be removed.`,builder:U,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations lifecycle abort`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}/lifecycle/abort`,pathParams:{"migration-id":String(n[`migration-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Updating`,async()=>i.images.sourcingKit.migrations.lifecycle.abort({account_id:a,migration_id:n[`migration-id`]})),{successLabel:`Updated`})}};function G(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <migration-id>`,describe:`Get the current progress of a migration including counts of scanned, imported, skipped, and errored objects.`,builder:G,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations lifecycle get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}/lifecycle`,pathParams:{"migration-id":String(n[`migration-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.sourcingKit.migrations.lifecycle.get({account_id:a,migration_id:n[`migration-id`]})),{successLabel:`Loaded`})}};function q(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`logs <migration-id>`,describe:`List log entries for a specific migration.`,builder:q,handler:async n=>{let i={offset:n.offset,limit:n.limit};if(n.dryRun){s({command:`cf images sourcing-kit migrations lifecycle logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}/logs`,pathParams:{"migration-id":String(n[`migration-id`]??``)},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.images.sourcingKit.migrations.lifecycle.logs({account_id:l,migration_id:n[`migration-id`],...i})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`migration-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`start <migration-id>`,describe:`Start a pending migration. The migration will begin importing objects from the configured source.`,builder:Y,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit migrations lifecycle start`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations/${n[`migration-id`]==null?`<migration-id>`:encodeURIComponent(String(n[`migration-id`]))}/lifecycle/start`,pathParams:{"migration-id":String(n[`migration-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Updating`,async()=>i.images.sourcingKit.migrations.lifecycle.start({account_id:a,migration_id:n[`migration-id`]})),{successLabel:`Updated`})}},Z={command:`lifecycle`,describe:`Operations for sourcing-kit.migrations.lifecycle`,builder:e=>e.command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`list`,describe:`List all migrations for the account.`,builder:Q,handler:async n=>{let i={offset:n.offset,limit:n.limit};if(n.dryRun){s({command:`cf images sourcing-kit migrations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/migrations`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.images.sourcingKit.migrations.list({account_id:l,...i})),{successLabel:`Loaded`})}},re={command:`migrations`,describe:`Operations for sourcing-kit.migrations`,builder:e=>e.command(R).command(B).command(H).command(ne).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`connectivity <source-id>`,describe:`Check the current connectivity status of an existing migration source.`,builder:ie,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources connectivity`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${n[`source-id`]==null?`<source-id>`:encodeURIComponent(String(n[`source-id`]))}/connectivity`,pathParams:{"source-id":String(n[`source-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.sourcingKit.sources.connectivity({account_id:a,source_id:n[`source-id`]})),{successLabel:`Loaded`})}};function oe(e){return e.option(`account`,{type:`string`,description:`Account identifier for the bucket (required for R2 vendor).`}).option(`bucket`,{type:`string`,description:`The name of the storage bucket.`}).option(`name`,{type:`string`,description:`A human-readable name for the source.`}).option(`vendor`,{type:`string`,description:`The cloud storage vendor of the source bucket.`,choices:[`s3`,`r2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const se={command:`create`,describe:`Create a new migration source by providing storage credentials. The service will verify connectivity to the bucket before accepting the source.`,builder:oe,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({account:l(n.account,`account`,`text`),bucket:l(n.bucket,`bucket`,`text`),name:l(n.name,`name`,`text`),vendor:l(n.vendor,`vendor`,`text`)}):i(n.body)});return}let u=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.images.sourcingKit.sources.create({...e,account_id:m})),{successLabel:`Created`});return}n.bucket===void 0&&(n.bucket=await p(`bucket`,`The name of the storage bucket.`)),n.name===void 0&&(n.name=await p(`name`,`A human-readable name for the source.`)),n.vendor===void 0&&(n.vendor=await f(`vendor`,`The cloud storage vendor of the source bucket.`,[`s3`,`r2`]));let h=a({account:l(n.account,`account`,`text`),bucket:l(n.bucket,`bucket`,`text`),name:l(n.name,`name`,`text`),vendor:l(n.vendor,`vendor`,`text`)});o(await c(`Creating`,async()=>u.images.sourcingKit.sources.create({...h,account_id:m})),{successLabel:`Created`})}};function ce(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const le={command:`delete <source-id>`,describe:`Delete an existing migration source. Sources with active migrations cannot be deleted.`,builder:ce,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${n[`source-id`]==null?`<source-id>`:encodeURIComponent(String(n[`source-id`]))}`,pathParams:{"source-id":String(n[`source-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}o(await c(`Deleting`,async()=>i.images.sourcingKit.sources.delete({account_id:a,source_id:n[`source-id`]})),{successLabel:`Deleted`})}};function ue(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`get <source-id>`,describe:`Fetch details for a single migration source.`,builder:ue,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${n[`source-id`]==null?`<source-id>`:encodeURIComponent(String(n[`source-id`]))}`,pathParams:{"source-id":String(n[`source-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.sourcingKit.sources.get({account_id:a,source_id:n[`source-id`]})),{successLabel:`Loaded`})}};function fe(e){return e.option(`offset`,{type:`number`,description:`Number of items to skip before returning results.`}).option(`limit`,{type:`number`,description:`Maximum number of items to return.`}).option(`name`,{type:`string`,description:`Filter sources by name (partial match).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`list`,describe:`List all configured migration sources for the account.`,builder:fe,handler:async n=>{let i={offset:n.offset,limit:n.limit,name:n.name};if(n.dryRun){s({command:`cf images sourcing-kit sources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.images.sourcingKit.sources.list({account_id:l,...i})),{successLabel:`Loaded`})}};function me(e){return e.option(`account`,{type:`string`,description:`Account identifier for the bucket (required for R2 vendor).`}).option(`bucket`,{type:`string`,description:`The name of the storage bucket.`}).option(`region`,{type:`string`,description:`The region hint for the bucket (S3 only).`}).option(`vendor`,{type:`string`,description:`The cloud storage vendor of the source bucket.`,choices:[`s3`,`r2`]}).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 he={command:`pre-check`,describe:`Verify connectivity to a storage bucket before creating a source. Returns connectivity status without persisting any state.`,builder:me,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources pre-check`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/connectivity-precheck`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({account:l(n.account,`account`,`text`),bucket:l(n.bucket,`bucket`,`text`),region:l(n.region,`region`,`text`),vendor:l(n.vendor,`vendor`,`text`)}):i(n.body)});return}let u=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.images.sourcingKit.sources.preCheck({...e,account_id:m})),{successLabel:`Created`});return}n.bucket===void 0&&(n.bucket=await p(`bucket`,`The name of the storage bucket.`)),n.vendor===void 0&&(n.vendor=await f(`vendor`,`The cloud storage vendor of the source bucket.`,[`s3`,`r2`]));let h=a({account:l(n.account,`account`,`text`),bucket:l(n.bucket,`bucket`,`text`),region:l(n.region,`region`,`text`),vendor:l(n.vendor,`vendor`,`text`)});o(await c(`Creating`,async()=>u.images.sourcingKit.sources.preCheck({...h,account_id:m})),{successLabel:`Created`})}};function ge(e){return e.positional(`source-id`,{type:`string`,description:`Sourcing kit resource identifier.`,demandOption:!0}).option(`name`,{type:`string`,description:`Updated name for the source.`}).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 _e={command:`update <source-id>`,describe:`Update the name of an existing migration source.`,builder:ge,handler:async n=>{if(n.dryRun){s({command:`cf images sourcing-kit sources update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v2/sourcingkit/sources/${n[`source-id`]==null?`<source-id>`:encodeURIComponent(String(n[`source-id`]))}`,pathParams:{"source-id":String(n[`source-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({name:l(n.name,`name`,`text`)}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.images.sourcingKit.sources.update({...e,account_id:f,source_id:n[`source-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await p(`name`,`Updated name for the source.`));let m=a({name:l(n.name,`name`,`text`)});o(await c(`Updating`,async()=>u.images.sourcingKit.sources.update({...m,account_id:f,source_id:n[`source-id`]})),{successLabel:`Updated`})}},ve={command:`sources`,describe:`Operations for sourcing-kit.sources`,builder:e=>e.command(ae).command(se).command(le).command(de).command(pe).command(he).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ye={command:`sourcing-kit`,describe:`Operations for sourcing-kit`,builder:e=>e.command(re).command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`stats`,describe:`Fetch image statistics details for Cloudflare Images. The returned statistics detail storage usage, including the current image count vs this account's allowance.`,builder:be,handler:async n=>{if(n.dryRun){s({command:`cf images stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/stats`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.stats({account_id:a})),{successLabel:`Loaded`})}};function Se(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(`creator`,{type:`string`,description:`Internal user ID set within the creator field. Setting to empty string "" will return images where creator field is not set`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`list`,describe:`List up to 100 images with one request. Use the optional parameters below to get a specific range of images.`,builder:Se,handler:async n=>{let i={page:n.page,per_page:n[`per-page`],creator:n.creator};if(n.dryRun){s({command:`cf images v1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.images.v1.list({account_id:l,...i})),{successLabel:`Loaded`})}};function we(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get <variant-id>`,describe:`Fetch details for a single variant with properties at the top level of the result.`,builder:we,handler:async n=>{if(n.dryRun){s({command:`cf images v1 variants-flat get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${n[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(n[`variant-id`]))}/flat`,pathParams:{"variant-id":String(n[`variant-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.v1.variantsFlat.get({account_id:a,variant_id:n[`variant-id`]})),{successLabel:`Loaded`})}},Ee={command:`variants-flat`,describe:`Operations for v1.variants-flat`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`v1`,describe:`Operations for v1`,builder:e=>e.command(Ce).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.option(`id`,{type:`string`,description:`The id field`}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`,default:!1}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`create`,describe:`Create a CF Images variant that allows you to resize images for different use cases.`,builder:$,handler:async n=>{if(n.dryRun){s({command:`cf images variants create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({id:l(n.id,`id`,`text`),neverRequireSignedURLs:n[`never-require-signed-urls`],options:{fit:l(n[`options-fit`],`options-fit`,`text`),height:n[`options-height`],metadata:l(n[`options-metadata`],`options-metadata`,`text`),width:n[`options-width`]}}):i(n.body)});return}let u=await r(n),m=n.local?d:await e();if(n.accountId=m,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.images.variants.create({body:e,account_id:m})),{successLabel:`Created`});return}if(n.id===void 0&&(n.id=await p(`id`,`The id field`)),n[`options-fit`]===void 0&&(n[`options-fit`]=await f(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),n[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(n[`options-metadata`]===void 0&&(n[`options-metadata`]=await f(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),n[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let h=a({id:l(n.id,`id`,`text`),neverRequireSignedURLs:n[`never-require-signed-urls`],options:{fit:l(n[`options-fit`],`options-fit`,`text`),height:n[`options-height`],metadata:l(n[`options-metadata`],`options-metadata`,`text`),width:n[`options-width`]}});o(await c(`Creating`,async()=>u.images.variants.create({body:h,account_id:m})),{successLabel:`Created`})}};function ke(e){return e.positional(`variant-id`,{type:`string`,description:`Variant 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 Ae={command:`delete <variant-id>`,describe:`Delete a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:ke,handler:async n=>{if(n.dryRun){s({command:`cf images variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${n[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(n[`variant-id`]))}`,pathParams:{"variant-id":String(n[`variant-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();if(n.accountId=a,!await m({force:!!n.force,message:`This operation will delete this variant.`})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}o(await c(`Deleting`,async()=>i.images.variants.delete({account_id:a,variant_id:n[`variant-id`]})),{successLabel:`Deleted`})}};function je(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`never-require-signed-urls`,{type:`boolean`,description:`Indicates whether the variant can access an image without a signature, regardless of image access control.`}).option(`options-fit`,{type:`string`,description:`The fit property describes how the width and height dimensions should be interpreted.`,choices:[`scale-down`,`contain`,`cover`,`crop`,`pad`]}).option(`options-height`,{type:`number`,description:`Maximum height in image pixels.`}).option(`options-metadata`,{type:`string`,description:`What EXIF data should be preserved in the output image.`,choices:[`keep`,`copyright`,`none`]}).option(`options-width`,{type:`number`,description:`Maximum width in image pixels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Me={command:`edit <variant-id>`,describe:`Update a CF Images variant. This will purge the cache for all images associated with the variant.`,builder:je,handler:async n=>{if(n.dryRun){s({command:`cf images variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${n[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(n[`variant-id`]))}`,pathParams:{"variant-id":String(n[`variant-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({neverRequireSignedURLs:n[`never-require-signed-urls`],options:{fit:l(n[`options-fit`],`options-fit`,`text`),height:n[`options-height`],metadata:l(n[`options-metadata`],`options-metadata`,`text`),width:n[`options-width`]}}):i(n.body)});return}let u=await r(n),p=n.local?d:await e();if(n.accountId=p,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.images.variants.edit({...e,account_id:p,variant_id:n[`variant-id`]})),{successLabel:`Updated`});return}if(n[`options-fit`]===void 0&&(n[`options-fit`]=await f(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),n[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(n[`options-metadata`]===void 0&&(n[`options-metadata`]=await f(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),n[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let m=a({neverRequireSignedURLs:n[`never-require-signed-urls`],options:{fit:l(n[`options-fit`],`options-fit`,`text`),height:n[`options-height`],metadata:l(n[`options-metadata`],`options-metadata`,`text`),width:n[`options-width`]}});o(await c(`Updating`,async()=>u.images.variants.edit({...m,account_id:p,variant_id:n[`variant-id`]})),{successLabel:`Updated`})}};function Ne(e){return e.positional(`variant-id`,{type:`string`,description:`Variant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`get <variant-id>`,describe:`Fetch details for a CF Images variant.`,builder:Ne,handler:async n=>{if(n.dryRun){s({command:`cf images variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants/${n[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(n[`variant-id`]))}`,pathParams:{"variant-id":String(n[`variant-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.variants.get({account_id:a,variant_id:n[`variant-id`]})),{successLabel:`Loaded`})}};function Fe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`list`,describe:`List existing CF Images variants.`,builder:Fe,handler:async n=>{if(n.dryRun){s({command:`cf images variants list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.images.variants.list({account_id:a})),{successLabel:`Loaded`})}},Le={command:`variants`,describe:`Operations for variants`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={command:`images`,describe:`images`,builder:e=>e.command(_).command(y).command(x).command(C).command(D).command(T).command(I).command(xe).command(P).command(ye).command(De).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Re as default};
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i as e,n as t,r as n,t as r}from"./src-
|
|
2
|
+
import{i as e,n as t,r as n,t as r}from"./src-BQ1dr9xR.mjs";export{r as CliExit,t as buildCli,n as main,e as runMain};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{i as n,n as r}from"./auth-DX9KnJ0P.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-CL8I-7YK.mjs";import{n as l,t as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{t as f}from"./prompt-q3B7sM2A.mjs";import{t as p}from"./cli-types-DGgEbf8K.mjs";import{n as m,t as ee}from"./raw-fetch-bIXC9D1m.mjs";function h(e){return e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <asn>`,describe:`Gets an overview of the Autonomous System Number (ASN) and a list of subnets for it.`,builder:p(h),handler:async n=>{if(n.dryRun){s({command:`cf intel asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/asn/${n.asn==null?`<asn>`:encodeURIComponent(String(n.asn))}`,pathParams:{asn:String(n.asn??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.asn.get({account_id:a,asn:n.asn})),{successLabel:`Loaded`})}};function _(e){return e.positional(`asn`,{type:`string`,description:`Asn`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <asn>`,describe:`Get ASN Subnets.`,builder:p(_),handler:async n=>{if(n.dryRun){s({command:`cf intel asn subnets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/asn/${n.asn==null?`<asn>`:encodeURIComponent(String(n.asn))}/subnets`,pathParams:{asn:String(n.asn??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.asn.subnets.get({account_id:a,asn:n.asn})),{successLabel:`Loaded`})}},y={command:`subnets`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`asn`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Lists all available issue types in Security Center, describing categories of security issues.`,builder:x,handler:async n=>{if(n.dryRun){s({command:`cf intel attack-surface-report issue-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/issue-types`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.attackSurfaceReport.issueTypes.get({account_id:a})),{successLabel:`Loaded`})}},C={command:`issue-types`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`class`,describe:`Retrieves Security Center issue counts aggregated by classification class.`,builder:p(w),handler:async n=>{let i={dismissed:n.dismissed,issue_class:n[`issue-class`],issue_type:n[`issue-type`],product:n.product,severity:n.severity,subject:n.subject};if(n.dryRun){s({command:`cf intel attack-surface-report issues class`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/issues/class`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.class({account_id:l,...i})),{successLabel:`Loaded`})}};function E(e){return e.positional(`issue-id`,{type:`string`,description:`Issue ID`,demandOption:!0}).option(`dismiss`,{type:`boolean`,description:`The dismiss field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`dismiss <issue-id>`,describe:`Deprecated endpoint for archiving Security Center insights. Use the newer archive-security-center-insight endpoint instead.`,builder:E,handler:async n=>{if(n.dryRun){s({command:`cf intel attack-surface-report issues dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/${n[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(n[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(n[`issue-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({dismiss:n.dismiss}):i(n.body)});return}let l=await r(n),u=n.local?d:await e();if(n.accountId=u,n.body){let e=i(n.body);o(await c(`Updating`,async()=>l.intel.attackSurfaceReport.issues.dismiss({...e,account_id:u,issue_id:n[`issue-id`]})),{successLabel:`Updated`});return}let f=a({dismiss:n.dismiss});o(await c(`Updating`,async()=>l.intel.attackSurfaceReport.issues.dismiss({...f,account_id:u,issue_id:n[`issue-id`]})),{successLabel:`Updated`})}};function O(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`page`,{type:`number`,description:`Specifies the current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Sets the number of results per page of results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all Security Center issues for the account, showing active security problems requiring attention.`,builder:p(O),handler:async n=>{let i={dismissed:n.dismissed,issue_class:n[`issue-class`],issue_type:n[`issue-type`],product:n.product,severity:n.severity,subject:n.subject,page:n.page,per_page:n[`per-page`]};if(n.dryRun){s({command:`cf intel attack-surface-report issues list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/issues`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.list({account_id:l,...i})),{successLabel:`Loaded`})}};function A(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`severity`,describe:`Retrieves Security Center issue counts aggregated by severity level.`,builder:p(A),handler:async n=>{let i={dismissed:n.dismissed,issue_class:n[`issue-class`],issue_type:n[`issue-type`],product:n.product,severity:n.severity,subject:n.subject};if(n.dryRun){s({command:`cf intel attack-surface-report issues severity`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/issues/severity`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.severity({account_id:l,...i})),{successLabel:`Loaded`})}};function M(e){return e.option(`dismissed`,{type:`boolean`,description:`Dismissed`}).option(`issue-class`,{type:`string`,description:`Issue class`}).option(`issue-type`,{type:`string`,description:`Issue type`}).option(`product`,{type:`string`,description:`Product`}).option(`severity`,{type:`string`,description:`Severity`}).option(`subject`,{type:`string`,description:`Subject`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`type`,describe:`Retrieves Security Center issue counts aggregated by issue type.`,builder:p(M),handler:async n=>{let i={dismissed:n.dismissed,issue_class:n[`issue-class`],issue_type:n[`issue-type`],product:n.product,severity:n.severity,subject:n.subject};if(n.dryRun){s({command:`cf intel attack-surface-report issues type`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/attack-surface-report/issues/type`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.type({account_id:l,...i})),{successLabel:`Loaded`})}},P={command:`issues`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`attack-surface-report`,describe:`Operations for attack-surface-report`,builder:e=>e.command(C).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.option(`start-end-params`,{type:`string`,description:`Start end params`}).option(`ipv4`,{type:`string`,description:`Ipv4`}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Gets a list of all the domains that have resolved to a specific IP address.`,builder:p(I),handler:async n=>{let i={start_end_params:n[`start-end-params`],ipv4:n.ipv4,page:n.page,per_page:n[`per-page`]};if(n.dryRun){s({command:`cf intel dns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/dns`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.dns.list({account_id:l,...i})),{successLabel:`Loaded`})}},R={command:`dns`,describe:`Passive DNS data showing historical DNS resolution records for domains`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get`,describe:`Gets historical security threat and content categories currently and previously assigned to a domain.`,builder:z,handler:async n=>{let i={domain:n.domain};if(n.dryRun){s({command:`cf intel domain-history get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/domain-history`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.domainHistory.get({account_id:l,...i})),{successLabel:`Loaded`})}},V={command:`domain-history`,describe:`Historical domain registration and categorization changes over time`,builder:e=>e.command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.option(`domain`,{type:`string`,description:"Accepts multiple values like `?domain=cloudflare.com&domain=example.com`."}).option(`include-ranking`,{type:`boolean`,description:"Whether to include domain ranking data in the response. Defaults to\n`false` — ranking lookups are expensive at bulk scale and most\ncallers do not need them. Set to `true` to opt in. This parameter\nreplaces the deprecated `skip_ranking` (see below)."}).option(`skip-ranking`,{type:`boolean`,description:"**Deprecated.** Previously controlled whether the ranking lookup\nwas skipped (defaulted to `false`, meaning ranking ran). The\nendpoint's default behavior is being flipped — ranking is now\nopt-in via `include_ranking=true` — and this parameter will be\nsilently ignored. Remove it from your callers and use\n`include_ranking` instead."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get`,describe:"Returns security details and statistics about multiple domains in a single request. **Behavior change — domain ranking is becoming opt-in.** This endpoint previously included domain ranking data in every response and accepted a `skip_ranking=true` query parameter to opt out. That parameter is being deprecated and ranking will no longer be returned by default. Callers that want ranking data must pass `include_ranking=true`. The `skip_ranking` parameter will be silently ignored once the change ships.",builder:H,handler:async n=>{let i={domain:n.domain,include_ranking:n[`include-ranking`],skip_ranking:n[`skip-ranking`]};if(n.dryRun){s({command:`cf intel domains bulks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/domain/bulk`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.domains.bulks.get({account_id:l,...i})),{successLabel:`Loaded`})}},W={command:`bulks`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`skip-dns`,{type:`boolean`,description:`Skip DNS resolution lookups for faster response.`}).option(`skip-ranking`,{type:`boolean`,description:"Skip the domain ranking lookup for faster responses. Defaults to\n`false` (ranking is included). Set to `true` to opt out — primarily\nused by callers like Cloudflare Radar that need to avoid a\ncircular dependency when building the domain details page.\nNote: the bulk endpoint (`/intel/domain/bulk`) uses opposite\ndefaults — see `include_ranking` there."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get`,describe:`Gets security details and statistics about a domain.`,builder:G,handler:async n=>{let i={domain:n.domain,skip_dns:n[`skip-dns`],skip_ranking:n[`skip-ranking`]};if(n.dryRun){s({command:`cf intel domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/domain`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.domains.get({account_id:l,...i})),{successLabel:`Loaded`})}},q={command:`domains`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(K).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`description`,{type:`string`,description:`The description of the example test`}).option(`name`,{type:`string`,description:`The name of the indicator feed`}).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:`Creates a new custom threat indicator feed for sharing threat intelligence data.`,builder:J,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({description:l(n.description,`description`,`text`),name:l(n.name,`name`,`text`)}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.intel.indicatorFeeds.create({...e,account_id:f})),{successLabel:`Created`});return}let p=a({description:l(n.description,`description`,`text`),name:l(n.name,`name`,`text`)});o(await c(`Creating`,async()=>u.intel.indicatorFeeds.create({...p,account_id:f})),{successLabel:`Created`})}};function X(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`data <feed-id>`,describe:`Retrieves the raw data entries in a custom threat indicator feed.`,builder:X,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds data`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/${n[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(n[`feed-id`]))}/data`,pathParams:{"feed-id":String(n[`feed-id`]??``)},bodyKind:`none`});return}await r(n);let i=n.local?d:await e();n.accountId=i,m((await c(`Loading`,async()=>ee(`/accounts/${i}/intel/indicator-feeds/${encodeURIComponent(String(n[`feed-id`]))}/data`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}))).toString(`utf-8`))}};function Z(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <feed-id>`,describe:`Downloads the content of a custom threat indicator feed.`,builder:p(Z),handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/${n[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(n[`feed-id`]))}/download`,pathParams:{"feed-id":String(n[`feed-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.downloads.get({account_id:a,feed_id:n[`feed-id`]})),{successLabel:`Loaded`})}},ne={command:`downloads`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <feed-id>`,describe:`Retrieves details for a specific custom threat indicator feed.`,builder:p(re),handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/${n[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(n[`feed-id`]))}`,pathParams:{"feed-id":String(n[`feed-id`]??``)},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.get({account_id:a,feed_id:n[`feed-id`]})),{successLabel:`Loaded`})}};function ae(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`Retrieves details for all accessible custom threat indicator feeds.`,builder:ae,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.list({account_id:a})),{successLabel:`Loaded`})}};function se(e){return e.option(`account-tag`,{type:`string`,description:`The Cloudflare account tag of the account to change permissions on`}).option(`feed-id`,{type:`number`,description:`The ID of the feed to add/remove permissions on`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`create`,describe:`Grants access permissions for a custom threat indicator feed to other accounts.`,builder:se,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds permissions create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/permissions/add`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({account_tag:l(n[`account-tag`],`account-tag`,`text`),feed_id:n[`feed-id`]}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.intel.indicatorFeeds.permissions.create({body:e,account_id:f})),{successLabel:`Updated`});return}let p=a({account_tag:l(n[`account-tag`],`account-tag`,`text`),feed_id:n[`feed-id`]});o(await c(`Updating`,async()=>u.intel.indicatorFeeds.permissions.create({body:p,account_id:f})),{successLabel:`Updated`})}};function le(e){return e.option(`account-tag`,{type:`string`,description:`The Cloudflare account tag of the account to change permissions on`}).option(`feed-id`,{type:`number`,description:`The ID of the feed to add/remove permissions on`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`delete`,describe:`Revokes access permissions for a custom threat indicator feed.`,builder:le,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds permissions delete`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/permissions/remove`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({account_tag:l(n[`account-tag`],`account-tag`,`text`),feed_id:n[`feed-id`]}):i(n.body)});return}let u=await r(n),p=n.local?d:await e();if(n.accountId=p,!await f({force:!!n.force,message:`This operation destructively removes a permission entry.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(n.body){let e=i(n.body);o(await c(`Deleting`,async()=>u.intel.indicatorFeeds.permissions.delete({body:e,account_id:p})),{successLabel:`Deleted`});return}let m=a({account_tag:l(n[`account-tag`],`account-tag`,`text`),feed_id:n[`feed-id`]});o(await c(`Deleting`,async()=>u.intel.indicatorFeeds.permissions.delete({body:m,account_id:p})),{successLabel:`Deleted`})}};function de(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`list`,describe:`Lists current access permissions for custom threat indicator feeds.`,builder:de,handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds permissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/permissions/view`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.permissions.list({account_id:a})),{successLabel:`Loaded`})}},pe={command:`permissions`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`source`,{type:`string`,description:"The file to upload. Either a plain STIX2/CRDF body or a gzipped one (recognised by `0x1f 0x8b` magic bytes or a `.gz` filename suffix). "})}const he={command:`update <feed-id>`,describe:"Revises the raw data entries in a custom threat indicator feed. Accepts both plain and gzipped STIX2/CRDF bodies. Gzip is detected by RFC 1952 magic bytes (`0x1f 0x8b`) and/or a `.gz` filename suffix (case-insensitive) — either signal alone is sufficient to trigger the gzip path; if the body is not valid gzip, the upload fails fast. Customers are encouraged to gzip larger uploads — the api-gateway 500 MB body cap applies to the on-the-wire (compressed) size, so gzip lets a single upload carry several GiB of decompressed STIX.",builder:p(me),handler:async i=>{if(i.dryRun){s({command:`cf intel indicator-feeds snapshots update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/${i[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(i[`feed-id`]))}/snapshot`,pathParams:{"feed-id":String(i[`feed-id`]??``)},bodyKind:`multipart`,body:{body:i.body,file:i.file,source:i.source}});return}let a=await r(i),f=i.local?d:await e();if(i.accountId=f,i.file!==void 0||i.body!==void 0||i.source!==void 0){let e=new FormData;if(i.file){let t=u(i.file);e.append(`file`,new Blob([t]),i.file.split(/[\\/]/).filter(Boolean).pop())}else i.body!==void 0&&e.append(`file`,i.body);i.source!==void 0&&e.append(`source`,String(l(i.source,`source`,`text`)??``)),o(await c(`Updating`,async()=>n(a,`PUT`,`/accounts/${f}/intel/indicator-feeds/${encodeURIComponent(String(i[`feed-id`]))}/snapshot`,{body:e})),{successLabel:`Updated`});return}if(i.body){let e=l(i.body,`body`,`binary`);o(await c(`Updating`,async()=>n(a,`PUT`,`/accounts/${f}/intel/indicator-feeds/${encodeURIComponent(String(i[`feed-id`]))}/snapshot`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}o(await c(`Updating`,async()=>a.intel.indicatorFeeds.snapshots.update({account_id:f,feed_id:i[`feed-id`]})),{successLabel:`Updated`})}},ge={command:`snapshots`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _e(e){return e.positional(`feed-id`,{type:`string`,description:`Indicator feed ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The new description of the feed`}).option(`is-attributable`,{type:`boolean`,description:`The new is_attributable value of the feed`}).option(`is-downloadable`,{type:`boolean`,description:`The new is_downloadable value of the feed`}).option(`is-public`,{type:`boolean`,description:`The new is_public value of the feed`}).option(`name`,{type:`string`,description:`The new name of the feed`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ve={command:`update <feed-id>`,describe:`Revises details for a specific custom threat indicator feed.`,builder:p(_e),handler:async n=>{if(n.dryRun){s({command:`cf intel indicator-feeds update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/indicator-feeds/${n[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(n[`feed-id`]))}`,pathParams:{"feed-id":String(n[`feed-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({description:l(n.description,`description`,`text`),is_attributable:n[`is-attributable`],is_downloadable:n[`is-downloadable`],is_public:n[`is-public`],name:l(n.name,`name`,`text`)}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.intel.indicatorFeeds.update({...e,account_id:f,feed_id:n[`feed-id`]})),{successLabel:`Updated`});return}let p=a({description:l(n.description,`description`,`text`),is_attributable:n[`is-attributable`],is_downloadable:n[`is-downloadable`],is_public:n[`is-public`],name:l(n.name,`name`,`text`)});o(await c(`Updating`,async()=>u.intel.indicatorFeeds.update({...p,account_id:f,feed_id:n[`feed-id`]})),{successLabel:`Updated`})}},ye={command:`indicator-feeds`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(Y).command(te).command(ie).command(oe).command(ve).command(ne).command(pe).command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get`,describe:`Returns a list of available IP list categories (e.g., anonymizer, botnetcc, malware, tor, vpn, open_proxies). This endpoint provides metadata about which IP lists are available in the system.`,builder:be,handler:async n=>{if(n.dryRun){s({command:`cf intel ip-lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/ip-lists`,pathParams:{},bodyKind:`none`});return}let i=await r(n),a=n.local?d:await e();n.accountId=a,o(await c(`Loading`,async()=>i.intel.ipLists.get({account_id:a})),{successLabel:`Loaded`})}},xe={command:`ip-lists`,describe:`Curated IP lists used for threat detection and policy enforcement`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.option(`ipv4`,{type:`string`,description:`Ipv4`}).option(`ipv6`,{type:`string`,description:`Ipv6`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`get`,describe:"Gets the geolocation, ASN, infrastructure type of the ASN, and any security threat categories of an IP address. **Must provide ip query parameters.** For example, `/intel/ip?ipv4=1.1.1.1` or `/intel/ip?ipv6=2001:db8::1`.",builder:Se,handler:async n=>{let i={ipv4:n.ipv4,ipv6:n.ipv6};if(n.dryRun){s({command:`cf intel ips get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/ip`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.ips.get({account_id:l,...i})),{successLabel:`Loaded`})}},we={command:`ips`,describe:`IP address intelligence — geolocation, risk assessment, and hosting provider details`,builder:e=>e.command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.option(`content-adds`,{type:`string`,array:!0,description:`Content category IDs to add.`}).option(`content-removes`,{type:`string`,array:!0,description:`Content category IDs to remove.`}).option(`indicator-type`,{type:`string`,description:`The indicator_type field`,choices:[`domain`,`ipv4`,`ipv6`,`url`]}).option(`ip`,{type:`string`,description:"Provide only if indicator_type is `ipv4` or `ipv6`."}).option(`security-adds`,{type:`string`,array:!0,description:`Security category IDs to add.`}).option(`security-removes`,{type:`string`,array:!0,description:`Security category IDs to remove.`}).option(`url`,{type:`string`,description:"Provide only if indicator_type is `domain` or `url`. Example if indicator_type is `domain`: `example.com`. Example if indicator_type is `url`: `https://example.com/news/`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`create`,describe:"Allows you to submit requests to change a domain’s category. Requests that include category `169` (New Domains) or category `177` (Newly Seen) in any of `content_adds`, `content_removes`, `security_adds`, or `security_removes` will be rejected with a `400 Bad Request`. These categories are automatically managed and fall off 30 days after they are applied.",builder:Te,handler:async n=>{if(n.dryRun){s({command:`cf intel miscategorizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/miscategorization`,pathParams:{},bodyKind:`json`,body:n.body===void 0?a({content_adds:n[`content-adds`],content_removes:n[`content-removes`],indicator_type:l(n[`indicator-type`],`indicator-type`,`text`),ip:l(n.ip,`ip`,`text`),security_adds:n[`security-adds`],security_removes:n[`security-removes`],url:l(n.url,`url`,`text`)}):i(n.body)});return}let u=await r(n),f=n.local?d:await e();if(n.accountId=f,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.intel.miscategorizations.create({...e,account_id:f})),{successLabel:`Created`});return}let p=a({content_adds:n[`content-adds`],content_removes:n[`content-removes`],indicator_type:l(n[`indicator-type`],`indicator-type`,`text`),ip:l(n.ip,`ip`,`text`),security_adds:n[`security-adds`],security_removes:n[`security-removes`],url:l(n.url,`url`,`text`)});o(await c(`Creating`,async()=>u.intel.miscategorizations.create({...p,account_id:f})),{successLabel:`Created`})}},De={command:`miscategorizations`,describe:`Report and track domain miscategorization corrections`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`get`,describe:`Retrieves WHOIS registration data for a domain, including registrant and nameserver information.`,builder:Oe,handler:async n=>{let i={domain:n.domain};if(n.dryRun){s({command:`cf intel whois get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/intel/whois`,pathParams:{},query:i,bodyKind:`none`});return}let a=await r(n),l=n.local?d:await e();n.accountId=l,o(await c(`Loading`,async()=>a.intel.whois.get({account_id:l,...i})),{successLabel:`Loaded`})}},Ae={command:`whois`,describe:`WHOIS registration data for domains including registrant, registrar, and nameservers`,builder:e=>e.command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},je={command:`intel`,describe:`Threat intelligence lookups — IP reputation, domain info, ASN details, WHOIS, and indicator feeds`,builder:e=>e.command(b).command(F).command(R).command(V).command(q).command(ye).command(xe).command(we).command(De).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{je as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e}from"./auth-
|
|
2
|
+
import{n as e}from"./auth-DX9KnJ0P.mjs";import{t}from"./output-B6fBFRqe.mjs";import{n,t as r}from"./progress-CL8I-7YK.mjs";function i(e){return e.option(`networks`,{type:`string`,description:"Specified as `jdcloud` to list IPs used by JD Cloud data centers."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={command:`list`,describe:`Get IPs used on the Cloudflare/JD Cloud network, see https://www.cloudflare.com/ips for Cloudflare IPs or https://developers.cloudflare.com/china-network/reference/infrastructure/ for JD Cloud IPs.`,builder:i,handler:async i=>{let a={networks:i.networks};if(i.dryRun){n({command:`cf ips list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/ips`,pathParams:{},query:a,bodyKind:`none`});return}let o=await e(i);t(await r(`Loading`,async()=>o.ips.list(a)),{successLabel:`Loaded`})}},o={command:`ips`,describe:`List Cloudflare's IP ranges used for proxying traffic — useful for firewall allowlisting`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{o as default};
|