cf 0.0.6 → 0.2.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 +2 -4
- package/bin/cf +11 -0
- package/dist/_meta/agent-context.json +89 -89
- package/dist/_meta/commands.json +12866 -4982
- package/dist/_meta/schemas.json +33572 -1148
- package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
- package/dist/accounts-BopMfODC.mjs +21 -0
- package/dist/acm-BT4vlnEJ.mjs +3 -0
- package/dist/addressing-B3uFxHst.mjs +13 -0
- package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
- package/dist/ai-DWHqwMap.mjs +2 -0
- package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
- package/dist/ai-search-VnOQ5n--.mjs +7 -0
- package/dist/alerting-BmmgIlIO.mjs +6 -0
- package/dist/analytics-isY03taL.mjs +20 -0
- package/dist/api-gateway-DXurEbA-.mjs +33 -0
- package/dist/argo-B02BL_hp.mjs +2 -0
- package/dist/audit-logs-DcgR9xUc.mjs +2 -0
- package/dist/auth-CQcAgnOy.mjs +135 -0
- package/dist/auth-DenWm_X0.mjs +6 -0
- package/dist/autorag-CmrwnGVj.mjs +2 -0
- package/dist/billing-CaW1ZAB1.mjs +2 -0
- package/dist/body-parser-Br-BoYk-.mjs +2 -0
- package/dist/bot-management-CeBsFx68.mjs +5 -0
- package/dist/botnet-feed-B396vQeQ.mjs +3 -0
- package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
- package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
- package/dist/build-5jmmOZhm.mjs +1054 -0
- package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
- package/dist/cache-DmXizSMi.mjs +5 -0
- package/dist/calls-x4KQpTB4.mjs +4 -0
- package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
- package/dist/chunk-DH-VkVmc.mjs +2 -0
- package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
- package/dist/cloud-connector-BClQpEzI.mjs +2 -0
- package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
- package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
- package/dist/config-DYzlVxcB.mjs +2 -0
- package/dist/connectivity-G0NP6LtW.mjs +3 -0
- package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
- package/dist/context-CC0Rhkhy.mjs +2 -0
- package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
- package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
- package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
- package/dist/custom-pages-D-oErw57.mjs +4 -0
- package/dist/d1-C95ckPKI.mjs +3 -0
- package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
- package/dist/delegate.mjs +2 -0
- package/dist/deploy-DbkiIzUr.mjs +2 -0
- package/dist/dev-C6iSuQZm.mjs +6 -0
- package/dist/diagnostics-DEEhPnXj.mjs +3 -0
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
- package/dist/dist-CnSubA1Z.mjs +82 -0
- package/dist/dist-DNBSHor6.mjs +301 -0
- package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
- package/dist/dns-qW-3TZOT.mjs +29 -0
- package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
- package/dist/email-routing-tdNJaCpJ.mjs +10 -0
- package/dist/email-security-DTVHNr2h.mjs +60 -0
- package/dist/email-sending-DsFTvE31.mjs +3 -0
- package/dist/filters-DO1Is_tI.mjs +4 -0
- package/dist/firewall-DbUhVTCg.mjs +11 -0
- package/dist/fraud-Bzr4njYb.mjs +8 -0
- package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
- package/dist/healthchecks-BBAs-lS_.mjs +4 -0
- package/dist/hostnames-Dz9PEUKS.mjs +3 -0
- package/dist/hyperdrive-B1iUJddG.mjs +18 -0
- package/dist/iam-CJM8gHpG.mjs +6 -0
- package/dist/images-DEoBmtFS.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/input-validation-zEO81MWN.mjs +2 -0
- package/dist/intel-BM6xkZ0C.mjs +3 -0
- package/dist/ips-B8fwxKZD.mjs +2 -0
- package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
- package/dist/kv-BTceLtWZ.mjs +5 -0
- package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
- package/dist/lib-Eu1wXxuh.mjs +68 -0
- package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
- package/dist/local-VJaJ3BZ1.mjs +2 -0
- package/dist/logpush-CSYhgevA.mjs +4 -0
- package/dist/logs-DlIwmMpt.mjs +3 -0
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
- package/dist/magic-transit-qQmA-981.mjs +89 -0
- package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
- package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
- package/dist/network-interconnects-CxG2deY0.mjs +36 -0
- package/dist/organizations-DyEAiGiR.mjs +41 -0
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
- package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
- package/dist/page-rules-DP-w6TAm.mjs +18 -0
- package/dist/page-shield-Bf7kFp8c.mjs +37 -0
- package/dist/pages-D0Y_XRqW.mjs +10 -0
- package/dist/pipelines-C-SPESAk.mjs +6 -0
- package/dist/progress-CjcQ6ato.mjs +2 -0
- package/dist/queues-wv6CZsi8.mjs +6 -0
- package/dist/r2-DuXjp9n5.mjs +21 -0
- package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
- package/dist/radar-BW_ZHP8X.mjs +2 -0
- package/dist/rate-limits-DLTkIvwr.mjs +5 -0
- package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
- package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
- package/dist/registrar-DIIv6fWd.mjs +46 -0
- package/dist/request-tracers-DMej0Drs.mjs +2 -0
- package/dist/resolve-BuJRWSk0.mjs +2 -0
- package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
- package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
- package/dist/rules-DLJpOYbC.mjs +4 -0
- package/dist/rulesets-D9nqEJT5.mjs +8 -0
- package/dist/rum-DBVmdPkp.mjs +4 -0
- package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
- package/dist/schema-validation-MCd3xdtX.mjs +4 -0
- package/dist/scim-DZA3VXog.mjs +3 -0
- package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
- package/dist/secrets-store-BrvcZSOM.mjs +21 -0
- package/dist/security-center-BU6f3Cm1.mjs +2 -0
- package/dist/security-txt-BPIbP3dG.mjs +3 -0
- package/dist/session-H7IV2BrM.mjs +2 -0
- package/dist/shared-DEzmTsEC.mjs +2 -0
- package/dist/smart-shield-e8XFBkiF.mjs +3 -0
- package/dist/snippets-B4M3MMb8.mjs +4 -0
- package/dist/spawn-13QQ0IwO.mjs +10 -0
- package/dist/spectrum-B0adfSRI.mjs +59 -0
- package/dist/speed-BVcUtkAz.mjs +4 -0
- package/dist/src-B9cKsgsg.mjs +108 -0
- package/dist/ssl-BAa91gsc.mjs +15 -0
- package/dist/stream-D53sxKb3.mjs +14 -0
- package/dist/tenants-bH5pt3dJ.mjs +2 -0
- package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
- package/dist/token-validation-M61Vx_Tw.mjs +4 -0
- package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
- package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
- package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
- package/dist/url-normalization-DZrWDgB5.mjs +3 -0
- package/dist/url-scanner-Zo49edNp.mjs +2 -0
- package/dist/user-DbXlVReB.mjs +10 -0
- package/dist/vectorize-CUnTM0DT.mjs +4 -0
- package/dist/versions-DzyrlUAi.mjs +2 -0
- package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
- package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
- package/dist/web3-DueyOQtx.mjs +4 -0
- package/dist/workers-builds-BM_aoeUR.mjs +7 -0
- package/dist/workers-nV_vBCfV.mjs +16 -0
- package/dist/workflows-CQITmo-s.mjs +4 -0
- package/dist/zaraz-DIbpF5Op.mjs +2 -0
- package/dist/zero-trust-CKp8j512.mjs +119 -0
- package/dist/zones-BZ5tZDbH.mjs +28 -0
- package/package.json +13 -3
- package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
- package/dist/accounts-BjGtCB8T.mjs +0 -6
- package/dist/acm-h4YPDN7k.mjs +0 -3
- package/dist/addressing-BiEnQ1o1.mjs +0 -11
- package/dist/ai-BPln2Yka.mjs +0 -2
- package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
- package/dist/ai-search-EjrONI5a.mjs +0 -7
- package/dist/alerting-CPWMKr-m.mjs +0 -6
- package/dist/analytics-3dX9-scQ.mjs +0 -2
- package/dist/api-gateway-7FKFHdI-.mjs +0 -9
- package/dist/argo-Dxz9P37E.mjs +0 -2
- package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
- package/dist/auth-BHD_B2p9.mjs +0 -277
- package/dist/auth-caVo2j1K.mjs +0 -6
- package/dist/autorag-D7nMweNF.mjs +0 -2
- package/dist/billing-yaIBp1Xq.mjs +0 -2
- package/dist/body-parser-iA3vRFmh.mjs +0 -2
- package/dist/bot-management-C0H6U0t4.mjs +0 -2
- package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
- package/dist/brand-protection-CI0NQa_l.mjs +0 -3
- package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
- package/dist/cache-B6M_pm_D.mjs +0 -5
- package/dist/calls-C5XCC0i1.mjs +0 -4
- package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
- package/dist/client-certificates-CwpzEnCT.mjs +0 -3
- package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
- package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
- package/dist/config-BmTd_qeU.mjs +0 -2
- package/dist/connectivity-C4tXPkW_.mjs +0 -3
- package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
- package/dist/context-6lBIck1r.mjs +0 -2
- package/dist/custom-certificates-pllRyU2y.mjs +0 -3
- package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
- package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
- package/dist/custom-pages-XWwfn7hV.mjs +0 -4
- package/dist/d1-c_zhZGWf.mjs +0 -3
- package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
- package/dist/dev-Bu26u5Jm.mjs +0 -14
- package/dist/diagnostics-BU07Jnku.mjs +0 -3
- package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
- package/dist/dns-CrvIxztB.mjs +0 -11
- package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
- package/dist/dry-run-FV0pZwdg.mjs +0 -2
- package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
- package/dist/email-routing-CxU5JlXT.mjs +0 -10
- package/dist/email-security-CnpAHWpj.mjs +0 -8
- package/dist/email-sending-MeCKsktR.mjs +0 -3
- package/dist/filters-Sx2Po1UP.mjs +0 -4
- package/dist/firewall-B0_012XO.mjs +0 -9
- package/dist/fraud-CG0G_VG-.mjs +0 -2
- package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
- package/dist/healthchecks-C0LgExxa.mjs +0 -4
- package/dist/hostnames-D4K6s9EX.mjs +0 -3
- package/dist/hyperdrive-D7XvTRys.mjs +0 -3
- package/dist/iam-4LhJianW.mjs +0 -6
- package/dist/images-BqXyIycX.mjs +0 -5
- package/dist/input-validation-BpVQi9rR.mjs +0 -2
- package/dist/intel-CiO3Sy4x.mjs +0 -3
- package/dist/ips-DLuGN7Mr.mjs +0 -2
- package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
- package/dist/kv-CVYCrk7L.mjs +0 -5
- package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
- package/dist/load-balancers-cxodJuI2.mjs +0 -6
- package/dist/local-OqhVQbv0.mjs +0 -2
- package/dist/logpush-BX7z2xWz.mjs +0 -4
- package/dist/logs-C7vxr6Kp.mjs +0 -3
- package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
- package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
- package/dist/magic-transit-troGMFb9.mjs +0 -30
- package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
- package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
- package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
- package/dist/organizations-BtlEchi-.mjs +0 -4
- package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
- package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
- package/dist/page-rules-CcMmrvY4.mjs +0 -3
- package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
- package/dist/pages-F1vdzqgC.mjs +0 -6
- package/dist/pipelines-DsF1HHMY.mjs +0 -6
- package/dist/progress-5sHFvwez.mjs +0 -2
- package/dist/queues-BuvkxFPX.mjs +0 -6
- package/dist/r2-Du-fgHiT.mjs +0 -9
- package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
- package/dist/radar-C0eqNmWR.mjs +0 -2
- package/dist/rate-limits-CUv2cxXV.mjs +0 -3
- package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
- package/dist/realtime-kit-C-jix3I_.mjs +0 -6
- package/dist/registrar-B7V7i89n.mjs +0 -2
- package/dist/request-tracers-D2V7QUrC.mjs +0 -2
- package/dist/resolve-GtphSYWh.mjs +0 -2
- package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
- package/dist/resource-tagging-BOknFugv.mjs +0 -4
- package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
- package/dist/rules-DzJFHGW1.mjs +0 -4
- package/dist/rulesets-BzI1dUiq.mjs +0 -8
- package/dist/rum-CQ_rJ96u.mjs +0 -4
- package/dist/schema-validation-TmikfxS9.mjs +0 -4
- package/dist/scim-ByZ5kqXS.mjs +0 -3
- package/dist/secrets-store-D7HL4VXw.mjs +0 -8
- package/dist/security-center-OUrILUnx.mjs +0 -2
- package/dist/security-txt-Ca13oCJ8.mjs +0 -3
- package/dist/session-Dxi_LbAk.mjs +0 -2
- package/dist/smart-shield-foPT0J9L.mjs +0 -3
- package/dist/snippets-FDPiBMWc.mjs +0 -4
- package/dist/spectrum-DPoh_BPx.mjs +0 -3
- package/dist/speed-BuEappVX.mjs +0 -4
- package/dist/src-D8_cWUwt.mjs +0 -104
- package/dist/ssl-bJbzEoRv.mjs +0 -3
- package/dist/stream-DuYGiGk6.mjs +0 -13
- package/dist/tenants-BYqEutrr.mjs +0 -2
- package/dist/token-validation-DwmtbWUB.mjs +0 -4
- package/dist/turnstile-Dy91RVTn.mjs +0 -3
- package/dist/url-normalization-DoD9iHWH.mjs +0 -3
- package/dist/url-scanner-qwL64FIo.mjs +0 -2
- package/dist/user-Cduf3VRi.mjs +0 -7
- package/dist/vectorize-CMLobU9V.mjs +0 -4
- package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
- package/dist/web3-Bcx68Kq3.mjs +0 -4
- package/dist/workers-D5fOQsUA.mjs +0 -16
- package/dist/workers-builds-2kdzxjlN.mjs +0 -7
- package/dist/workflows-qFD80noW.mjs +0 -4
- package/dist/zaraz-C0iJimA4.mjs +0 -2
- package/dist/zero-trust-Btix6zOy.mjs +0 -73
- package/dist/zones-Nu3wMtds.mjs +0 -5
- /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,b as n,t as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.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 e=>{if(e.dryRun){s({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/healthchecks`,{body:t})),{successLabel:`Created`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/healthchecks`,{body:Object.keys(d).length>0?d:void 0})),{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),l=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=l,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(t.body){let e=a(t.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${t.zoneId}/healthchecks/${encodeURIComponent(String(t[`healthcheck-id`]))}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.healthchecks.delete(t[`healthcheck-id`],l)),{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 e=>{if(e.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,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:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Updating`,async()=>u.patch(`/zones/${e.zoneId}/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{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 t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.healthchecks.get(e[`healthcheck-id`],i)),{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 t={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:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list(a,t)),{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 e=>{if(e.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/healthchecks/preview`,{body:t})),{successLabel:`Created`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/healthchecks/preview`,{body:Object.keys(d).length>0?d:void 0})),{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async t=>{if(t.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/healthchecks/preview/${t[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(t[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(t[`healthcheck-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),l=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=l,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}if(t.body){let e=a(t.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${t.zoneId}/healthchecks/preview/${encodeURIComponent(String(t[`healthcheck-id`]))}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete(t[`healthcheck-id`],l)),{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 e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,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 t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.healthchecks.previews.get(e[`healthcheck-id`],i)),{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 e=>{if(e.dryRun){s({command:`cf healthchecks update`,method:`PUT`,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:`json`,body:{address:e.address,"check-regions":e[`check-regions`],"consecutive-fails":e[`consecutive-fails`],"consecutive-successes":e[`consecutive-successes`],description:e.description,"http-config-allow-insecure":e[`http-config-allow-insecure`],"http-config-expected-body":e[`http-config-expected-body`],"http-config-expected-codes":e[`http-config-expected-codes`],"http-config-follow-redirects":e[`http-config-follow-redirects`],"http-config-method":e[`http-config-method`],"http-config-path":e[`http-config-path`],"http-config-port":e[`http-config-port`],interval:e.interval,name:e.name,retries:e.retries,suspended:e.suspended,"tcp-config-method":e[`tcp-config-method`],"tcp-config-port":e[`tcp-config-port`],timeout:e.timeout,type:e.type,body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.address===void 0&&(e.address=await t(`address`,`The hostname or IP address of the origin server to run health checks on.`)),e.name===void 0&&(e.name=await t(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let d={};e.address!==void 0&&i(d,[`address`],l(e.address,`address`,`text`)),e[`check-regions`]!==void 0&&i(d,[`check_regions`],e[`check-regions`]),e[`consecutive-fails`]!==void 0&&i(d,[`consecutive_fails`],e[`consecutive-fails`]),e[`consecutive-successes`]!==void 0&&i(d,[`consecutive_successes`],e[`consecutive-successes`]),e.description!==void 0&&i(d,[`description`],l(e.description,`description`,`text`)),e[`http-config-allow-insecure`]!==void 0&&i(d,[`http_config`,`allow_insecure`],e[`http-config-allow-insecure`]),e[`http-config-expected-body`]!==void 0&&i(d,[`http_config`,`expected_body`],l(e[`http-config-expected-body`],`http-config-expected-body`,`text`)),e[`http-config-expected-codes`]!==void 0&&i(d,[`http_config`,`expected_codes`],e[`http-config-expected-codes`]),e[`http-config-follow-redirects`]!==void 0&&i(d,[`http_config`,`follow_redirects`],e[`http-config-follow-redirects`]),e[`http-config-method`]!==void 0&&i(d,[`http_config`,`method`],l(e[`http-config-method`],`http-config-method`,`text`)),e[`http-config-path`]!==void 0&&i(d,[`http_config`,`path`],l(e[`http-config-path`],`http-config-path`,`text`)),e[`http-config-port`]!==void 0&&i(d,[`http_config`,`port`],e[`http-config-port`]),e.interval!==void 0&&i(d,[`interval`],e.interval),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.retries!==void 0&&i(d,[`retries`],e.retries),e.suspended!==void 0&&i(d,[`suspended`],e.suspended),e[`tcp-config-method`]!==void 0&&i(d,[`tcp_config`,`method`],l(e[`tcp-config-method`],`tcp-config-method`,`text`)),e[`tcp-config-port`]!==void 0&&i(d,[`tcp_config`,`port`],e[`tcp-config-port`]),e.timeout!==void 0&&i(d,[`timeout`],e.timeout),e.type!==void 0&&i(d,[`type`],l(e.type,`type`,`text`)),o(await c(`Updating`,async()=>u.put(`/zones/${e.zoneId}/healthchecks/${encodeURIComponent(String(e[`healthcheck-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{t as r}from"./body-parser-Br-BoYk-.mjs";import{t as i}from"./output-D7_yAFVR.mjs";import{n as a,t as o}from"./progress-CjcQ6ato.mjs";function s(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. The 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 c={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:s,handler:async e=>{if(e.dryRun){a({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`none`});return}let r=await n(e),s=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading`,async()=>r.hostnames.settings.tlsSingle.get(s,e[`setting-id`],e.hostname)),{successLabel:`Loaded`})}},l={command:`tls-single`,describe:`Hostname TLS settings — single hostname lookup`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(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. The 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 d={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:u,handler:async r=>{if(r.dryRun){a({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/hostnames/settings/${r[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(r[`setting-id`]))}/${r.hostname==null?`<hostname>`:encodeURIComponent(String(r.hostname))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"setting-id":String(r[`setting-id`]??``),hostname:String(r.hostname??``)},bodyKind:`none`});return}let s=await n(r),c=await t({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,!await e({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>s.hostnames.settings.tls.delete(c,r[`setting-id`],r.hostname)),{successLabel:`Deleted`})}};function f(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 p={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:f,handler:async e=>{if(e.dryRun){a({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``)},bodyKind:`none`});return}let r=await n(e),s=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=s,i(await o(`Loading`,async()=>r.hostnames.settings.tls.get(s,e[`setting-id`])),{successLabel:`Loaded`})}};function m(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. The 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 h={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:m,handler:async e=>{if(e.dryRun){a({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/hostnames/settings/${e[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(e[`setting-id`]))}/${e.hostname==null?`<hostname>`:encodeURIComponent(String(e.hostname))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"setting-id":String(e[`setting-id`]??``),hostname:String(e.hostname??``)},bodyKind:`json`,body:{body:e.body}});return}let s=await n(e),c=await t({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=c,e.body){let t=r(e.body);i(await o(`Updating`,async()=>s.put(`/zones/${e.zoneId}/hostnames/settings/${encodeURIComponent(String(e[`setting-id`]))}/${encodeURIComponent(String(e.hostname))}`,{body:t})),{successLabel:`Updated`});return}i(await o(`Updating`,async()=>s.hostnames.settings.tls.update(c,e[`setting-id`],e.hostname)),{successLabel:`Updated`})}},g={command:`tls`,describe:`Individual hostname TLS configuration overrides (min TLS version, ciphers, HTTP/2, etc.)`,builder:e=>e.command(d).command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(g).command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.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 e=>{if(e.dryRun){l({command:`cf hyperdrive create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`json`,body:{"caching-disabled":e[`caching-disabled`],"caching-max-age":e[`caching-max-age`],"caching-stale-while-revalidate":e[`caching-stale-while-revalidate`],"mtls-ca-certificate-id":e[`mtls-ca-certificate-id`],"mtls-certificate-id":e[`mtls-certificate-id`],"mtls-sslmode":e[`mtls-sslmode`],name:e.name,"origin-database":e[`origin-database`],"origin-password":e[`origin-password`],"origin-scheme":e[`origin-scheme`],"origin-user":e[`origin-user`],"origin-host":e[`origin-host`],"origin-port":e[`origin-port`],"origin-access-client-id":e[`origin-access-client-id`],"origin-access-client-secret":e[`origin-access-client-secret`],"origin-service-id":e[`origin-service-id`],"origin-connection-limit":e[`origin-connection-limit`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/hyperdrive/configs`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),e[`origin-database`]===void 0&&(e[`origin-database`]=await t(`origin-database`,`Set the name of your origin database.`)),e[`origin-password`]===void 0&&(e[`origin-password`]=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),e[`origin-scheme`]===void 0&&(e[`origin-scheme`]=await i(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),e[`origin-user`]===void 0&&(e[`origin-user`]=await t(`origin-user`,`Set the user of your origin database.`));let h={};e[`caching-disabled`]!==void 0&&o(h,[`caching`,`disabled`],e[`caching-disabled`]),e[`caching-max-age`]!==void 0&&o(h,[`caching`,`max_age`],e[`caching-max-age`]),e[`caching-stale-while-revalidate`]!==void 0&&o(h,[`caching`,`stale_while_revalidate`],e[`caching-stale-while-revalidate`]),e[`mtls-ca-certificate-id`]!==void 0&&o(h,[`mtls`,`ca_certificate_id`],d(e[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`)),e[`mtls-certificate-id`]!==void 0&&o(h,[`mtls`,`mtls_certificate_id`],d(e[`mtls-certificate-id`],`mtls-certificate-id`,`text`)),e[`mtls-sslmode`]!==void 0&&o(h,[`mtls`,`sslmode`],d(e[`mtls-sslmode`],`mtls-sslmode`,`text`)),e.name!==void 0&&o(h,[`name`],d(e.name,`name`,`text`)),e[`origin-database`]!==void 0&&o(h,[`origin`,`database`],d(e[`origin-database`],`origin-database`,`text`)),e[`origin-password`]!==void 0&&o(h,[`origin`,`password`],d(e[`origin-password`],`origin-password`,`text`)),e[`origin-scheme`]!==void 0&&o(h,[`origin`,`scheme`],d(e[`origin-scheme`],`origin-scheme`,`text`)),e[`origin-user`]!==void 0&&o(h,[`origin`,`user`],d(e[`origin-user`],`origin-user`,`text`)),e[`origin-host`]!==void 0&&o(h,[`origin`,`host`],d(e[`origin-host`],`origin-host`,`text`)),e[`origin-port`]!==void 0&&o(h,[`origin`,`port`],e[`origin-port`]),e[`origin-access-client-id`]!==void 0&&o(h,[`origin`,`access_client_id`],d(e[`origin-access-client-id`],`origin-access-client-id`,`text`)),e[`origin-access-client-secret`]!==void 0&&o(h,[`origin`,`access_client_secret`],d(e[`origin-access-client-secret`],`origin-access-client-secret`,`text`)),e[`origin-service-id`]!==void 0&&o(h,[`origin`,`service_id`],d(e[`origin-service-id`],`origin-service-id`,`text`)),e[`origin-connection-limit`]!==void 0&&o(h,[`origin_connection_limit`],e[`origin-connection-limit`]),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/hyperdrive/configs`,{body:Object.keys(h).length>0?h:void 0})),{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 t=>{if(t.dryRun){l({command:`cf hyperdrive delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs/${t[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(t[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(t[`hyperdrive-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}c(await u(`Deleting`,async()=>i.hyperdrive.delete(o,t[`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 e=>{if(e.dryRun){l({command:`cf hyperdrive edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`json`,body:{"caching-disabled":e[`caching-disabled`],"caching-max-age":e[`caching-max-age`],"caching-stale-while-revalidate":e[`caching-stale-while-revalidate`],"mtls-ca-certificate-id":e[`mtls-ca-certificate-id`],"mtls-certificate-id":e[`mtls-certificate-id`],"mtls-sslmode":e[`mtls-sslmode`],name:e.name,"origin-connection-limit":e[`origin-connection-limit`],body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/hyperdrive/configs/${encodeURIComponent(String(e[`hyperdrive-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e[`caching-disabled`]!==void 0&&o(p,[`caching`,`disabled`],e[`caching-disabled`]),e[`caching-max-age`]!==void 0&&o(p,[`caching`,`max_age`],e[`caching-max-age`]),e[`caching-stale-while-revalidate`]!==void 0&&o(p,[`caching`,`stale_while_revalidate`],e[`caching-stale-while-revalidate`]),e[`mtls-ca-certificate-id`]!==void 0&&o(p,[`mtls`,`ca_certificate_id`],d(e[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`)),e[`mtls-certificate-id`]!==void 0&&o(p,[`mtls`,`mtls_certificate_id`],d(e[`mtls-certificate-id`],`mtls-certificate-id`,`text`)),e[`mtls-sslmode`]!==void 0&&o(p,[`mtls`,`sslmode`],d(e[`mtls-sslmode`],`mtls-sslmode`,`text`)),e.name!==void 0&&o(p,[`name`],d(e.name,`name`,`text`)),e[`origin-connection-limit`]!==void 0&&o(p,[`origin_connection_limit`],e[`origin-connection-limit`]),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/hyperdrive/configs/${encodeURIComponent(String(e[`hyperdrive-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{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 e=>{if(e.dryRun){l({command:`cf hyperdrive get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.hyperdrive.get(i,e[`hyperdrive-id`])),{successLabel:`Loaded`})}};function x(e){return e.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 e=>{if(e.dryRun){l({command:`cf hyperdrive list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.hyperdrive.list(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 e=>{if(e.dryRun){l({command:`cf hyperdrive update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/hyperdrive/configs/${e[`hyperdrive-id`]==null?`<hyperdrive-id>`:encodeURIComponent(String(e[`hyperdrive-id`]))}`,pathParams:{"hyperdrive-id":String(e[`hyperdrive-id`]??``)},bodyKind:`json`,body:{"caching-disabled":e[`caching-disabled`],"caching-max-age":e[`caching-max-age`],"caching-stale-while-revalidate":e[`caching-stale-while-revalidate`],"mtls-ca-certificate-id":e[`mtls-ca-certificate-id`],"mtls-certificate-id":e[`mtls-certificate-id`],"mtls-sslmode":e[`mtls-sslmode`],name:e.name,"origin-database":e[`origin-database`],"origin-password":e[`origin-password`],"origin-scheme":e[`origin-scheme`],"origin-user":e[`origin-user`],"origin-host":e[`origin-host`],"origin-port":e[`origin-port`],"origin-access-client-id":e[`origin-access-client-id`],"origin-access-client-secret":e[`origin-access-client-secret`],"origin-service-id":e[`origin-service-id`],"origin-connection-limit":e[`origin-connection-limit`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Updating`,async()=>p.put(`/accounts/${m}/hyperdrive/configs/${encodeURIComponent(String(e[`hyperdrive-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.name===void 0&&(e.name=await t(`name`,`The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.`)),e[`origin-database`]===void 0&&(e[`origin-database`]=await t(`origin-database`,`Set the name of your origin database.`)),e[`origin-password`]===void 0&&(e[`origin-password`]=await t(`origin-password`,`Set the password needed to access your origin database. The API never returns this write-only value.`,{kind:`secret`})),e[`origin-scheme`]===void 0&&(e[`origin-scheme`]=await i(`origin-scheme`,`Specifies the URL scheme used to connect to your origin database.`,[`postgres`,`postgresql`,`mysql`])),e[`origin-user`]===void 0&&(e[`origin-user`]=await t(`origin-user`,`Set the user of your origin database.`));let h={};e[`caching-disabled`]!==void 0&&o(h,[`caching`,`disabled`],e[`caching-disabled`]),e[`caching-max-age`]!==void 0&&o(h,[`caching`,`max_age`],e[`caching-max-age`]),e[`caching-stale-while-revalidate`]!==void 0&&o(h,[`caching`,`stale_while_revalidate`],e[`caching-stale-while-revalidate`]),e[`mtls-ca-certificate-id`]!==void 0&&o(h,[`mtls`,`ca_certificate_id`],d(e[`mtls-ca-certificate-id`],`mtls-ca-certificate-id`,`text`)),e[`mtls-certificate-id`]!==void 0&&o(h,[`mtls`,`mtls_certificate_id`],d(e[`mtls-certificate-id`],`mtls-certificate-id`,`text`)),e[`mtls-sslmode`]!==void 0&&o(h,[`mtls`,`sslmode`],d(e[`mtls-sslmode`],`mtls-sslmode`,`text`)),e.name!==void 0&&o(h,[`name`],d(e.name,`name`,`text`)),e[`origin-database`]!==void 0&&o(h,[`origin`,`database`],d(e[`origin-database`],`origin-database`,`text`)),e[`origin-password`]!==void 0&&o(h,[`origin`,`password`],d(e[`origin-password`],`origin-password`,`text`)),e[`origin-scheme`]!==void 0&&o(h,[`origin`,`scheme`],d(e[`origin-scheme`],`origin-scheme`,`text`)),e[`origin-user`]!==void 0&&o(h,[`origin`,`user`],d(e[`origin-user`],`origin-user`,`text`)),e[`origin-host`]!==void 0&&o(h,[`origin`,`host`],d(e[`origin-host`],`origin-host`,`text`)),e[`origin-port`]!==void 0&&o(h,[`origin`,`port`],e[`origin-port`]),e[`origin-access-client-id`]!==void 0&&o(h,[`origin`,`access_client_id`],d(e[`origin-access-client-id`],`origin-access-client-id`,`text`)),e[`origin-access-client-secret`]!==void 0&&o(h,[`origin`,`access_client_secret`],d(e[`origin-access-client-secret`],`origin-access-client-secret`,`text`)),e[`origin-service-id`]!==void 0&&o(h,[`origin`,`service_id`],d(e[`origin-service-id`],`origin-service-id`,`text`)),e[`origin-connection-limit`]!==void 0&&o(h,[`origin_connection_limit`],e[`origin-connection-limit`]),c(await u(`Updating`,async()=>p.put(`/accounts/${m}/hyperdrive/configs/${encodeURIComponent(String(e[`hyperdrive-id`]))}`,{body:Object.keys(h).length>0?h:void 0})),{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{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";function f(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 p={command:`get <permission-group-id>`,describe:`Get information about a specific permission group in an account.`,builder:f,handler:async e=>{if(e.dryRun){c({command:`cf iam permission-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/permission_groups/${e[`permission-group-id`]==null?`<permission-group-id>`:encodeURIComponent(String(e[`permission-group-id`]))}`,pathParams:{"permission-group-id":String(e[`permission-group-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.iam.permissionGroups.get(a,e[`permission-group-id`])),{successLabel:`Loaded`})}};function m(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 h={command:`list`,describe:`List all the permissions groups for an account.`,builder:m,handler:async e=>{let t={id:e.id,name:e.name,label:e.label,page:e.page,per_page:e[`per-page`]};if(e.dryRun){c({command:`cf iam permission-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/permission_groups`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.permissionGroups.list(o,t)),{successLabel:`Loaded`})}},g={command:`permission-groups`,describe:`View the permission groups that can be assigned to API tokens and policies`,builder:e=>e.command(p).command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(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 v={command:`create`,describe:`Create a new Resource Group under the specified account.`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/resource_groups`,pathParams:{},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/iam/resource_groups`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`Name of the resource group`));let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/iam/resource_groups`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function y(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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`delete <resource-group-id>`,describe:`Remove a resource group from an account.`,builder:y,handler:async t=>{if(t.dryRun){c({command:`cf iam resource-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/resource_groups/${t[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(t[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(t[`resource-group-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?d:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/iam/resource_groups/${encodeURIComponent(String(t[`resource-group-id`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.iam.resourceGroups.delete(u,t[`resource-group-id`])),{successLabel:`Deleted`})}};function x(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 S={command:`get <resource-group-id>`,describe:`Get information about a specific resource group in an account.`,builder:x,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/resource_groups/${e[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(e[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(e[`resource-group-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.iam.resourceGroups.get(a,e[`resource-group-id`])),{successLabel:`Loaded`})}};function C(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 w={command:`list`,describe:`List all the resource groups for an account.`,builder:C,handler:async e=>{let t={id:e.id,name:e.name};if(e.dryRun){c({command:`cf iam resource-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/resource_groups`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.resourceGroups.list(o,t)),{successLabel:`Loaded`})}};function T(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 E={command:`update <resource-group-id>`,describe:`Modify an existing resource group.`,builder:T,handler:async e=>{if(e.dryRun){c({command:`cf iam resource-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/resource_groups/${e[`resource-group-id`]==null?`<resource-group-id>`:encodeURIComponent(String(e[`resource-group-id`]))}`,pathParams:{"resource-group-id":String(e[`resource-group-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let t=await r(e),f=e.local?d:await n(t);if(e.accountId=f,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${f}/iam/resource_groups/${encodeURIComponent(String(e[`resource-group-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.name!==void 0&&a(p,[`name`],u(e.name,`name`,`text`)),s(await l(`Updating`,async()=>t.put(`/accounts/${f}/iam/resource_groups/${encodeURIComponent(String(e[`resource-group-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},D={command:`resource-groups`,describe:`Define scopes that limit which account resources a policy or token can access`,builder:e=>e.command(v).command(b).command(S).command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(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 k={command:`begin-verification <sso-connector-id>`,describe:`Begin SSO connector verification`,builder:O,handler:async e=>{if(e.dryRun){c({command:`cf iam sso begin-verification`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}/begin_verification`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Creating`,async()=>t.iam.sso.beginVerification(a,e[`sso-connector-id`])),{successLabel:`Created`})}};function A(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 j={command:`create`,describe:`Create a new SSO connector`,builder:A,handler:async e=>{if(e.dryRun){c({command:`cf iam sso create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`json`,body:{"begin-verification":e[`begin-verification`],"email-domain":e[`email-domain`],"use-fedramp-language":e[`use-fedramp-language`],body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/sso_connectors`,{body:t})),{successLabel:`Created`});return}e[`email-domain`]===void 0&&(e[`email-domain`]=await t(`email-domain`,`Email domain of the new SSO connector`));let m={};e[`begin-verification`]!==void 0&&a(m,[`begin_verification`],e[`begin-verification`]),e[`email-domain`]!==void 0&&a(m,[`email_domain`],u(e[`email-domain`],`email-domain`,`text`)),e[`use-fedramp-language`]!==void 0&&a(m,[`use_fedramp_language`],e[`use-fedramp-language`]),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/sso_connectors`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function M(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 N={command:`delete <sso-connector-id>`,describe:`Delete an SSO connector`,builder:M,handler:async t=>{if(t.dryRun){c({command:`cf iam sso delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors/${t[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(t[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(t[`sso-connector-id`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}s(await l(`Deleting`,async()=>a.iam.sso.delete(o,t[`sso-connector-id`])),{successLabel:`Deleted`})}};function P(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 F={command:`get <sso-connector-id>`,describe:`Get SSO connector details`,builder:P,handler:async e=>{if(e.dryRun){c({command:`cf iam sso get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.iam.sso.get(a,e[`sso-connector-id`])),{successLabel:`Loaded`})}};function ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`List all SSO connectors`,builder:ee,handler:async e=>{if(e.dryRun){c({command:`cf iam sso list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors`,pathParams:{},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.iam.sso.list(a)),{successLabel:`Loaded`})}};function L(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 R={command:`update <sso-connector-id>`,describe:`Update SSO connector state`,builder:L,handler:async e=>{if(e.dryRun){c({command:`cf iam sso update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/sso_connectors/${e[`sso-connector-id`]==null?`<sso-connector-id>`:encodeURIComponent(String(e[`sso-connector-id`]))}`,pathParams:{"sso-connector-id":String(e[`sso-connector-id`]??``)},bodyKind:`json`,body:{enabled:e.enabled,"use-fedramp-language":e[`use-fedramp-language`],body:e.body}});return}let t=await r(e),u=e.local?d:await n(t);if(e.accountId=u,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.patch(`/accounts/${u}/sso_connectors/${encodeURIComponent(String(e[`sso-connector-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.enabled!==void 0&&a(f,[`enabled`],e.enabled),e[`use-fedramp-language`]!==void 0&&a(f,[`use_fedramp_language`],e[`use-fedramp-language`]),s(await l(`Updating`,async()=>t.patch(`/accounts/${u}/sso_connectors/${encodeURIComponent(String(e[`sso-connector-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},z={command:`sso`,describe:`Configure single sign-on connectors to authenticate account members through an external identity provider`,builder:e=>e.command(k).command(j).command(N).command(F).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(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 V={command:`create`,describe:`Create a new user group under the specified account.`,builder:B,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups`,pathParams:{},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let f=await r(e),p=e.local?d:await n(f);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/iam/user_groups`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`Name of the User group.`));let m={};e.name!==void 0&&a(m,[`name`],u(e.name,`name`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/iam/user_groups`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function H(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 U={command:`delete <user-group-id>`,describe:`Remove a user group from an account.`,builder:H,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}s(await l(`Deleting`,async()=>a.iam.userGroups.delete(o,t[`user-group-id`])),{successLabel:`Deleted`})}};function W(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 G={command:`get <user-group-id>`,describe:`Get information about a specific user group in an account.`,builder:W,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?d:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.iam.userGroups.get(a,e[`user-group-id`])),{successLabel:`Loaded`})}};function K(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 q={command:`list`,describe:`List all the user groups for an account.`,builder:K,handler:async e=>{let t={id:e.id,name:e.name,fuzzyName:e[`fuzzy-name`],page:e.page,per_page:e[`per-page`],direction:e.direction};if(e.dryRun){c({command:`cf iam user-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.list(o,t)),{successLabel:`Loaded`})}};function J(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 Y={command:`create <user-group-id>`,describe:`Add members to a User Group.`,builder:J,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?d:await n(t);if(e.accountId=a,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${a}/iam/user_groups/${encodeURIComponent(String(e[`user-group-id`]))}/members`,{body:n})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function X(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 Z={command:`delete <member-id>`,describe:`Remove a member from User Group`,builder:X,handler:async t=>{if(t.dryRun){c({command:`cf iam user-groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${t[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(t[`user-group-id`]))}/members/${t[`member-id`]==null?`<member-id>`:encodeURIComponent(String(t[`member-id`]))}`,pathParams:{"user-group-id":String(t[`user-group-id`]??``),"member-id":String(t[`member-id`]??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await n(a);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}s(await l(`Deleting`,async()=>a.iam.userGroups.members.delete(o,t[`user-group-id`],t[`member-id`])),{successLabel:`Deleted`})}};function Q(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 $={command:`list`,describe:`List all the members attached to a user group.`,builder:Q,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],fuzzyEmail:e[`fuzzy-email`],direction:e.direction};if(e.dryRun){c({command:`cf iam user-groups members list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?d:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.iam.userGroups.members.list(o,e[`user-group-id`],t)),{successLabel:`Loaded`})}};function te(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 ne={command:`update <user-group-id>`,describe:`Replace the set of members attached to a User Group.`,builder:te,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups members update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}/members`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?d:await n(t);if(e.accountId=a,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${a}/iam/user_groups/${encodeURIComponent(String(e[`user-group-id`]))}/members`,{body:n})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},re={command:`members`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(Y).command(Z).command($).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(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 ae={command:`update <user-group-id>`,describe:`Modify an existing user group.`,builder:ie,handler:async e=>{if(e.dryRun){c({command:`cf iam user-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/iam/user_groups/${e[`user-group-id`]==null?`<user-group-id>`:encodeURIComponent(String(e[`user-group-id`]))}`,pathParams:{"user-group-id":String(e[`user-group-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let t=await r(e),f=e.local?d:await n(t);if(e.accountId=f,e.body){let n=o(e.body);s(await l(`Updating`,async()=>t.put(`/accounts/${f}/iam/user_groups/${encodeURIComponent(String(e[`user-group-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.name!==void 0&&a(p,[`name`],u(e.name,`name`,`text`)),s(await l(`Updating`,async()=>t.put(`/accounts/${f}/iam/user_groups/${encodeURIComponent(String(e[`user-group-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},oe={command:`user-groups`,describe:`Organize account members into groups for easier permission assignment`,builder:e=>e.command(V).command(U).command(G).command(q).command(ae).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},se={command:`iam`,describe:`Identity and access management — permission groups, resource groups, user groups, and SSO connectors`,builder:e=>e.command(g).command(D).command(z).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{se as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d,t as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";import{n as m,t as h}from"./raw-fetch-hRv-6P3D.mjs";function g(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 _={command:`get <image-id>`,describe:`Fetch base image. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf images v1 blobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}/blob`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i;let o=await u(`Loading`,async()=>h(`/accounts/${i}/images/v1/${encodeURIComponent(String(e[`image-id`]))}/blob`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));m(e.text===!0?o.toString(`utf-8`):o)}},v={command:`blobs`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).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 b={command:`create`,describe:`Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url.`,builder:y,handler:async e=>{if(e.dryRun){l({command:`cf images v1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,creator:e.creator,id:e.id,metadata:e.metadata,"require-signed-urls":e[`require-signed-urls`],url:e.url}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.creator!==void 0||e.id!==void 0||e.metadata!==void 0||e[`require-signed-urls`]!==void 0||e.url!==void 0){let n=new FormData;if(e.file){let t=f(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);if(e.creator!==void 0&&n.append(`creator`,String(d(e.creator,`creator`,`text`)??``)),e.id!==void 0&&n.append(`id`,String(d(e.id,`id`,`text`)??``)),e.metadata!==void 0){let t=typeof e.metadata==`string`?d(e.metadata,`metadata`,`text`):e.metadata;n.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}e[`require-signed-urls`]!==void 0&&n.append(`requireSignedURLs`,String(e[`require-signed-urls`])),e.url!==void 0&&n.append(`url`,String(d(e.url,`url`,`text`)??``)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/images/v1`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=d(e.body,`body`,`binary`);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/images/v1`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function x(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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={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:x,handler:async t=>{if(t.dryRun){l({command:`cf images v1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/${t[`image-id`]==null?`<image-id>`:encodeURIComponent(String(t[`image-id`]))}`,pathParams:{"image-id":String(t[`image-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${o}/images/v1/${encodeURIComponent(String(t[`image-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.images.v1.delete(t[`image-id`],o)),{successLabel:`Deleted`})}};function C(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 w={command:`edit <image-id>`,describe:`Update image access control. On access control change, all copies of the image are purged from cache.`,builder:C,handler:async e=>{if(e.dryRun){l({command:`cf images v1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`json`,body:{creator:e.creator,"require-signed-urls":e[`require-signed-urls`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/images/v1/${encodeURIComponent(String(e[`image-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.creator!==void 0&&o(f,[`creator`],d(e.creator,`creator`,`text`)),e[`require-signed-urls`]!==void 0&&o(f,[`requireSignedURLs`],e[`require-signed-urls`]),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/images/v1/${encodeURIComponent(String(e[`image-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function T(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 E={command:`get <image-id>`,describe:`Fetch details for a single image.`,builder:T,handler:async e=>{if(e.dryRun){l({command:`cf images v1 get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/${e[`image-id`]==null?`<image-id>`:encodeURIComponent(String(e[`image-id`]))}`,pathParams:{"image-id":String(e[`image-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.get(e[`image-id`],i)),{successLabel:`Loaded`})}};function D(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 O={command:`delete <signing-key-name>`,describe:`Delete signing key with specified name. Returns all keys available. When last key is removed, a new default signing key will be generated.`,builder:D,handler:async t=>{if(t.dryRun){l({command:`cf images v1 keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/keys/${t[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(t[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(t[`signing-key-name`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}c(await u(`Deleting`,async()=>i.images.v1.keys.delete(t[`signing-key-name`],o)),{successLabel:`Deleted`})}};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Lists your signing keys. These can be found on your Cloudflare Images dashboard.`,builder:k,handler:async e=>{if(e.dryRun){l({command:`cf images v1 keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/keys`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.keys.list(i)),{successLabel:`Loaded`})}};function j(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 M={command:`update <signing-key-name>`,describe:`Create a new signing key with specified name. Returns all keys available.`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf images v1 keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/keys/${e[`signing-key-name`]==null?`<signing-key-name>`:encodeURIComponent(String(e[`signing-key-name`]))}`,pathParams:{"signing-key-name":String(e[`signing-key-name`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Updating`,async()=>t.images.v1.keys.update(e[`signing-key-name`],i)),{successLabel:`Updated`})}},N={command:`keys`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(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 F={command:`list`,describe:`List up to 100 images with one request. Use the optional parameters below to get a specific range of images.`,builder:P,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],creator:e.creator};if(e.dryRun){l({command:`cf images v1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.images.v1.list(o,t)),{successLabel:`Loaded`})}};function I(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get`,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:I,handler:async e=>{if(e.dryRun){l({command:`cf images v1 stats get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/stats`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.stats.get(i)),{successLabel:`Loaded`})}},L={command:`stats`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(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 z={command:`get <variant-id>`,describe:`Fetch details for a single variant with properties at the top level of the result.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf images v1 variants-flat get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}/flat`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.variantsFlat.get(e[`variant-id`],i)),{successLabel:`Loaded`})}},B={command:`variants-flat`,describe:`Images v1 variant details in flat format`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(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 H={command:`create`,describe:`Specify variants that allow you to resize images for different use cases.`,builder:V,handler:async e=>{if(e.dryRun){l({command:`cf images v1 variants create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`json`,body:{id:e.id,"never-require-signed-urls":e[`never-require-signed-urls`],"options-fit":e[`options-fit`],"options-height":e[`options-height`],"options-metadata":e[`options-metadata`],"options-width":e[`options-width`],body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>f.post(`/accounts/${m}/images/v1/variants`,{body:t})),{successLabel:`Created`});return}if(e.id===void 0&&(e.id=await t(`id`,`The id field`)),e[`options-fit`]===void 0&&(e[`options-fit`]=await i(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),e[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(e[`options-metadata`]===void 0&&(e[`options-metadata`]=await i(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),e[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let h={};e.id!==void 0&&o(h,[`id`],d(e.id,`id`,`text`)),e[`never-require-signed-urls`]!==void 0&&o(h,[`neverRequireSignedURLs`],e[`never-require-signed-urls`]),e[`options-fit`]!==void 0&&o(h,[`options`,`fit`],d(e[`options-fit`],`options-fit`,`text`)),e[`options-height`]!==void 0&&o(h,[`options`,`height`],e[`options-height`]),e[`options-metadata`]!==void 0&&o(h,[`options`,`metadata`],d(e[`options-metadata`],`options-metadata`,`text`)),e[`options-width`]!==void 0&&o(h,[`options`,`width`],e[`options-width`]),c(await u(`Creating`,async()=>f.post(`/accounts/${m}/images/v1/variants`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function U(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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`delete <variant-id>`,describe:`Deleting a variant purges the cache for all images associated with the variant.`,builder:U,handler:async t=>{if(t.dryRun){l({command:`cf images v1 variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants/${t[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(t[`variant-id`]))}`,pathParams:{"variant-id":String(t[`variant-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${o}/images/v1/variants/${encodeURIComponent(String(t[`variant-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.images.v1.variants.delete(t[`variant-id`],o)),{successLabel:`Deleted`})}};function G(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 K={command:`edit <variant-id>`,describe:`Updating a variant purges the cache for all images associated with the variant.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf images v1 variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`json`,body:{"never-require-signed-urls":e[`never-require-signed-urls`],"options-fit":e[`options-fit`],"options-height":e[`options-height`],"options-metadata":e[`options-metadata`],"options-width":e[`options-width`],body:e.body}});return}let t=await r(e),f=e.local?p:await n(t);if(e.accountId=f,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${f}/images/v1/variants/${encodeURIComponent(String(e[`variant-id`]))}`,{body:n})),{successLabel:`Updated`});return}if(e[`options-fit`]===void 0&&(e[`options-fit`]=await i(`options-fit`,`The fit property describes how the width and height dimensions should be interpreted.`,[`scale-down`,`contain`,`cover`,`crop`,`pad`])),e[`options-height`]===void 0)throw Error(`--options-height is required (or pass --body with this field set).`);if(e[`options-metadata`]===void 0&&(e[`options-metadata`]=await i(`options-metadata`,`What EXIF data should be preserved in the output image.`,[`keep`,`copyright`,`none`])),e[`options-width`]===void 0)throw Error(`--options-width is required (or pass --body with this field set).`);let m={};e[`never-require-signed-urls`]!==void 0&&o(m,[`neverRequireSignedURLs`],e[`never-require-signed-urls`]),e[`options-fit`]!==void 0&&o(m,[`options`,`fit`],d(e[`options-fit`],`options-fit`,`text`)),e[`options-height`]!==void 0&&o(m,[`options`,`height`],e[`options-height`]),e[`options-metadata`]!==void 0&&o(m,[`options`,`metadata`],d(e[`options-metadata`],`options-metadata`,`text`)),e[`options-width`]!==void 0&&o(m,[`options`,`width`],e[`options-width`]),c(await u(`Updating`,async()=>t.patch(`/accounts/${f}/images/v1/variants/${encodeURIComponent(String(e[`variant-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}};function q(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 J={command:`get <variant-id>`,describe:`Fetch details for a single variant.`,builder:q,handler:async e=>{if(e.dryRun){l({command:`cf images v1 variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants/${e[`variant-id`]==null?`<variant-id>`:encodeURIComponent(String(e[`variant-id`]))}`,pathParams:{"variant-id":String(e[`variant-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.variants.get(e[`variant-id`],i)),{successLabel:`Loaded`})}};function Y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists existing variants.`,builder:Y,handler:async e=>{if(e.dryRun){l({command:`cf images v1 variants list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v1/variants`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.images.v1.variants.list(i)),{successLabel:`Loaded`})}},Z={command:`variants`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(H).command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Q={command:`v1`,describe:`Upload, transform, and serve images with named variants, signing keys, and usage stats`,builder:e=>e.command(b).command(S).command(w).command(E).command(F).command(v).command(N).command(L).command(Z).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).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 te={command:`create`,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:$,handler:async e=>{if(e.dryRun){l({command:`cf images v2 direct-uploads create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v2/direct_upload`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,creator:e.creator,expiry:e.expiry,id:e.id,metadata:e.metadata,"require-signed-urls":e[`require-signed-urls`]}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.creator!==void 0||e.expiry!==void 0||e.id!==void 0||e.metadata!==void 0||e[`require-signed-urls`]!==void 0){let n=new FormData;if(e.file){let t=f(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);if(e.creator!==void 0&&n.append(`creator`,String(d(e.creator,`creator`,`text`)??``)),e.expiry!==void 0&&n.append(`expiry`,String(d(e.expiry,`expiry`,`text`)??``)),e.id!==void 0&&n.append(`id`,String(d(e.id,`id`,`text`)??``)),e.metadata!==void 0){let t=typeof e.metadata==`string`?d(e.metadata,`metadata`,`text`):e.metadata;n.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}e[`require-signed-urls`]!==void 0&&n.append(`requireSignedURLs`,String(e[`require-signed-urls`])),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/images/v2/direct_upload`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=d(e.body,`body`,`binary`);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/images/v2/direct_upload`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ne={command:`direct-uploads`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(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 ie={command:`list`,describe:"List up to 10000 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 - `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 **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 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:re,handler:async e=>{let t={continuation_token:e[`continuation-token`],per_page:e[`per-page`],sort_order:e[`sort-order`],creator:e.creator};if(e.dryRun){l({command:`cf images v2 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/images/v2`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.images.v2.list(o,t)),{successLabel:`Loaded`})}},ae={command:`v2`,describe:`V2 image listing with cursor-based pagination and authenticated direct upload URLs`,builder:e=>e.command(ie).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},oe={command:`images`,describe:`Store, resize, and deliver optimized images globally — variants, signing keys, and direct uploads`,builder:e=>e.command(Q).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{oe 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-B9cKsgsg.mjs";export{r as CliExit,t as buildCli,n as main,e as runMain};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{readFileSync as e}from"node:fs";import{resolve as t}from"node:path";function n(n){let r;try{r=e(t(n))}catch{throw Error(`Cannot read invalid or empty file: ${n}`)}if(r.byteLength===0)throw Error(`Cannot read invalid or empty file: ${n}`);return r}function r(n,r,i=`text`){if(n===void 0||!n.startsWith(`@`))return n;let a=n.slice(1);if(a.length===0)throw Error(`--${r} '@' must be followed by a file path (got empty path)`);let o=t(a),s;try{s=e(o)}catch(e){let t=e instanceof Error?e.message:`unknown read error`;throw Error(`--${r}: cannot read file at '${a}': ${t}`)}switch(i){case`text`:return s.toString(`utf-8`);case`binary`:return s;case`base64`:return s.toString(`base64`);case`json`:{let e=s.toString(`utf-8`);try{return JSON.parse(e)}catch(e){let t=e instanceof Error?e.message:`unknown JSON parse error`;throw Error(`--${r}: file at '${a}' is not valid JSON: ${t}`)}}}}export{r as n,n as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,h as t,t as n,x as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l,t as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";import{n as f,t as p}from"./raw-fetch-hRv-6P3D.mjs";function m(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 ee={command:`get <asn>`,describe:`Gets an overview of the Autonomous System Number (ASN) and a list of subnets for it.`,builder:m,handler:async e=>{if(e.dryRun){s({command:`cf intel asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/asn/${e.asn==null?`<asn>`:encodeURIComponent(String(e.asn))}`,pathParams:{asn:String(e.asn??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.asn.get(e.asn,a)),{successLabel:`Loaded`})}};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:`Get ASN Subnets.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf intel asn subnets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/asn/${e.asn==null?`<asn>`:encodeURIComponent(String(e.asn))}/subnets`,pathParams:{asn:String(e.asn??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.asn.subnets.get(e.asn,a)),{successLabel:`Loaded`})}},_={command:`subnets`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`asn`,describe:`ASN intelligence — ownership, geolocation, and subnet details for autonomous systems`,builder:e=>e.command(ee).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Lists all available issue types in Security Center, describing categories of security issues.`,builder:y,handler:async e=>{if(e.dryRun){s({command:`cf intel attack-surface-report issue-types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/issue-types`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.attackSurfaceReport.issueTypes.get(a)),{successLabel:`Loaded`})}},x={command:`issue-types`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dismissed`,{type:`string`,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 C={command:`class`,describe:`Retrieves Security Center issue counts aggregated by classification class.`,builder:S,handler:async e=>{let i={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf intel attack-surface-report issues class`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/issues/class`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.class(l,i)),{successLabel:`Loaded`})}};function w(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 T={command:`dismiss <issue-id>`,describe:`Deprecated endpoint for archiving Security Center insights. Use the newer archive-security-center-insight endpoint instead.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf intel attack-surface-report issues dismiss`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/${e[`issue-id`]==null?`<issue-id>`:encodeURIComponent(String(e[`issue-id`]))}/dismiss`,pathParams:{"issue-id":String(e[`issue-id`]??``)},bodyKind:`json`,body:{dismiss:e.dismiss,body:e.body}});return}let l=await n(e),u=e.local?d:await t(l);if(e.accountId=u,e.body){let t=a(e.body);o(await c(`Updating`,async()=>l.put(`/accounts/${u}/intel/attack-surface-report/${encodeURIComponent(String(e[`issue-id`]))}/dismiss`,{body:t})),{successLabel:`Updated`});return}let f={};e.dismiss!==void 0&&i(f,[`dismiss`],e.dismiss),o(await c(`Updating`,async()=>l.put(`/accounts/${u}/intel/attack-surface-report/${encodeURIComponent(String(e[`issue-id`]))}/dismiss`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function E(e){return e.option(`dismissed`,{type:`string`,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:`string`,description:`Page`}).option(`per-page`,{type:`string`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Lists all Security Center issues for the account, showing active security problems requiring attention.`,builder:E,handler:async e=>{let i={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject,page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf intel attack-surface-report issues list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/issues`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.list(l,i)),{successLabel:`Loaded`})}};function O(e){return e.option(`dismissed`,{type:`string`,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 k={command:`severity`,describe:`Retrieves Security Center issue counts aggregated by severity level.`,builder:O,handler:async e=>{let i={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf intel attack-surface-report issues severity`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/issues/severity`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.severity(l,i)),{successLabel:`Loaded`})}};function A(e){return e.option(`dismissed`,{type:`string`,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:`type`,describe:`Retrieves Security Center issue counts aggregated by issue type.`,builder:A,handler:async e=>{let i={dismissed:e.dismissed,issue_class:e[`issue-class`],issue_type:e[`issue-type`],product:e.product,severity:e.severity,subject:e.subject};if(e.dryRun){s({command:`cf intel attack-surface-report issues type`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/attack-surface-report/issues/type`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.attackSurfaceReport.issues.type(l,i)),{successLabel:`Loaded`})}},M={command:`issues`,describe:`Attack surface intelligence — exposed assets, vulnerabilities, and infrastructure mapping`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`attack-surface-report`,describe:`Operations for attack-surface-report`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(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 F={command:`list`,describe:`Gets a list of all the domains that have resolved to a specific IP address.`,builder:P,handler:async e=>{let i={start_end_params:e[`start-end-params`],ipv4:e.ipv4,page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf intel dns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/dns`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.dns.list(l,i)),{successLabel:`Loaded`})}},I={command:`dns`,describe:`Passive DNS data showing historical DNS resolution records for domains`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(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 R={command:`get`,describe:`Gets historical security threat and content categories currently and previously assigned to a domain.`,builder:L,handler:async e=>{let i={domain:e.domain};if(e.dryRun){s({command:`cf intel domain-history get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/domain-history`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.domainHistory.get(l,i)),{successLabel:`Loaded`})}},z={command:`domain-history`,describe:`Historical domain registration and categorization changes over time`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.option(`domain`,{type:`string`,description:"Accepts multiple values like `?domain=cloudflare.com&domain=example.com`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get`,describe:`Same as summary.`,builder:B,handler:async e=>{let i={domain:e.domain};if(e.dryRun){s({command:`cf intel domains bulks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/domain/bulk`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.domains.bulks.get(l,i)),{successLabel:`Loaded`})}},H={command:`bulks`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`domain`,{type:`string`,description:`Domain`}).option(`skip-dns`,{type:`boolean`,description:`Skip DNS resolution lookups for faster response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`get`,describe:`Gets security details and statistics about a domain.`,builder:U,handler:async e=>{let i={domain:e.domain,skip_dns:e[`skip-dns`]};if(e.dryRun){s({command:`cf intel domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/domain`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.domains.get(l,i)),{successLabel:`Loaded`})}},G={command:`domains`,describe:`Domain intelligence — risk scores, categories, and associated infrastructure`,builder:e=>e.command(W).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(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 q={command:`create`,describe:`Creates a new custom threat indicator feed for sharing threat intelligence data.`,builder:K,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`json`,body:{description:e.description,name:e.name,body:e.body}});return}let u=await n(e),f=e.local?d:await t(u);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/accounts/${f}/intel/indicator-feeds`,{body:t})),{successLabel:`Created`});return}let p={};e.description!==void 0&&i(p,[`description`],l(e.description,`description`,`text`)),e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Creating`,async()=>u.post(`/accounts/${f}/intel/indicator-feeds`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function J(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 Y={command:`data <feed-id>`,describe:`Retrieves the raw data entries in a custom threat indicator feed.`,builder:J,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds data`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/${e[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(e[`feed-id`]))}/data`,pathParams:{"feed-id":String(e[`feed-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,f((await c(`Loading`,async()=>p(`/accounts/${a}/intel/indicator-feeds/${encodeURIComponent(String(e[`feed-id`]))}/data`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}))).toString(`utf-8`))}};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:`get <feed-id>`,describe:`Downloads the content of a custom threat indicator feed.`,builder:X,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds downloads get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/${e[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(e[`feed-id`]))}/download`,pathParams:{"feed-id":String(e[`feed-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.downloads.get(a,e[`feed-id`])),{successLabel:`Loaded`})}},Z={command:`downloads`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(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 ne={command:`get <feed-id>`,describe:`Retrieves details for a specific custom threat indicator feed.`,builder:Q,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/${e[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(e[`feed-id`]))}`,pathParams:{"feed-id":String(e[`feed-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.get(a,e[`feed-id`])),{successLabel:`Loaded`})}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`Retrieves details for all accessible custom threat indicator feeds.`,builder:re,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.list(a)),{successLabel:`Loaded`})}};function ae(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 oe={command:`create`,describe:`Grants access permissions for a custom threat indicator feed to other accounts.`,builder:ae,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds permissions create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/permissions/add`,pathParams:{},bodyKind:`json`,body:{"account-tag":e[`account-tag`],"feed-id":e[`feed-id`],body:e.body}});return}let u=await n(e),f=e.local?d:await t(u);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/accounts/${f}/intel/indicator-feeds/permissions/add`,{body:t})),{successLabel:`Updated`});return}let p={};e[`account-tag`]!==void 0&&i(p,[`account_tag`],l(e[`account-tag`],`account-tag`,`text`)),e[`feed-id`]!==void 0&&i(p,[`feed_id`],e[`feed-id`]),o(await c(`Updating`,async()=>u.put(`/accounts/${f}/intel/indicator-feeds/permissions/add`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};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(`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 ce={command:`delete`,describe:`Revokes access permissions for a custom threat indicator feed.`,builder:se,handler:async u=>{if(u.dryRun){s({command:`cf intel indicator-feeds permissions delete`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/permissions/remove`,pathParams:{},bodyKind:`json`,body:{"account-tag":u[`account-tag`],"feed-id":u[`feed-id`],body:u.body}});return}let f=await n(u),p=u.local?d:await t(f);if(u.accountId=p,!await e({force:!!u.force,message:`This operation destructively removes a permission entry.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(u.body){let e=a(u.body);o(await c(`Deleting`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/permissions/remove`,{body:e})),{successLabel:`Deleted`});return}let m={};u[`account-tag`]!==void 0&&i(m,[`account_tag`],l(u[`account-tag`],`account-tag`,`text`)),u[`feed-id`]!==void 0&&i(m,[`feed_id`],u[`feed-id`]),o(await c(`Deleting`,async()=>f.put(`/accounts/${p}/intel/indicator-feeds/permissions/remove`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Deleted`})}};function le(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Lists current access permissions for custom threat indicator feeds.`,builder:le,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds permissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/permissions/view`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.indicatorFeeds.permissions.list(a)),{successLabel:`Loaded`})}},de={command:`permissions`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(oe).command(ce).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(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`})}const pe={command:`update <feed-id>`,describe:`Revises the raw data entries in a custom threat indicator feed.`,builder:fe,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds snapshots update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/${e[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(e[`feed-id`]))}/snapshot`,pathParams:{"feed-id":String(e[`feed-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,source:e.source}});return}let i=await n(e),a=e.local?d:await t(i);if(e.accountId=a,e.file!==void 0||e.body!==void 0||e.source!==void 0){let t=new FormData;if(e.file){let n=u(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);e.source!==void 0&&t.append(`source`,String(l(e.source,`source`,`text`)??``)),o(await c(`Updating`,async()=>i.put(`/accounts/${a}/intel/indicator-feeds/${encodeURIComponent(String(e[`feed-id`]))}/snapshot`,{body:t})),{successLabel:`Updated`});return}if(e.body){let t=l(e.body,`body`,`binary`);o(await c(`Updating`,async()=>i.put(`/accounts/${a}/intel/indicator-feeds/${encodeURIComponent(String(e[`feed-id`]))}/snapshot`,{body:t,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},me={command:`snapshots`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(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 ge={command:`update <feed-id>`,describe:`Revises details for a specific custom threat indicator feed.`,builder:he,handler:async e=>{if(e.dryRun){s({command:`cf intel indicator-feeds update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/indicator-feeds/${e[`feed-id`]==null?`<feed-id>`:encodeURIComponent(String(e[`feed-id`]))}`,pathParams:{"feed-id":String(e[`feed-id`]??``)},bodyKind:`json`,body:{description:e.description,"is-attributable":e[`is-attributable`],"is-downloadable":e[`is-downloadable`],"is-public":e[`is-public`],name:e.name,body:e.body}});return}let u=await n(e),f=e.local?d:await t(u);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Updating`,async()=>u.put(`/accounts/${f}/intel/indicator-feeds/${encodeURIComponent(String(e[`feed-id`]))}`,{body:t})),{successLabel:`Updated`});return}let p={};e.description!==void 0&&i(p,[`description`],l(e.description,`description`,`text`)),e[`is-attributable`]!==void 0&&i(p,[`is_attributable`],e[`is-attributable`]),e[`is-downloadable`]!==void 0&&i(p,[`is_downloadable`],e[`is-downloadable`]),e[`is-public`]!==void 0&&i(p,[`is_public`],e[`is-public`]),e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Updating`,async()=>u.put(`/accounts/${f}/intel/indicator-feeds/${encodeURIComponent(String(e[`feed-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},_e={command:`indicator-feeds`,describe:`Threat indicator feeds — subscribe to and manage curated lists of malicious IPs, domains, and URLs`,builder:e=>e.command(q).command(Y).command(ne).command(ie).command(ge).command(Z).command(de).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={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:ve,handler:async e=>{if(e.dryRun){s({command:`cf intel ip-lists get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/ip-lists`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.ipLists.get(a)),{successLabel:`Loaded`})}},be={command:`ip-lists`,describe:`Curated IP lists used for threat detection and policy enforcement`,builder:e=>e.command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(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 xe={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:$,handler:async e=>{let i={ipv4:e.ipv4,ipv6:e.ipv6};if(e.dryRun){s({command:`cf intel ips get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/ip`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.ips.get(l,i)),{successLabel:`Loaded`})}},Se={command:`ips`,describe:`IP address intelligence — geolocation, risk assessment, and hosting provider details`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(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 we={command:`create`,describe:`Allows you to submit requests to change a domain’s category.`,builder:Ce,handler:async e=>{if(e.dryRun){s({command:`cf intel miscategorizations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/miscategorization`,pathParams:{},bodyKind:`json`,body:{"content-adds":e[`content-adds`],"content-removes":e[`content-removes`],"indicator-type":e[`indicator-type`],ip:e.ip,"security-adds":e[`security-adds`],"security-removes":e[`security-removes`],url:e.url,body:e.body}});return}let u=await n(e),f=e.local?d:await t(u);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/accounts/${f}/intel/miscategorization`,{body:t})),{successLabel:`Created`});return}let p={};e[`content-adds`]!==void 0&&i(p,[`content_adds`],e[`content-adds`]),e[`content-removes`]!==void 0&&i(p,[`content_removes`],e[`content-removes`]),e[`indicator-type`]!==void 0&&i(p,[`indicator_type`],l(e[`indicator-type`],`indicator-type`,`text`)),e.ip!==void 0&&i(p,[`ip`],l(e.ip,`ip`,`text`)),e[`security-adds`]!==void 0&&i(p,[`security_adds`],e[`security-adds`]),e[`security-removes`]!==void 0&&i(p,[`security_removes`],e[`security-removes`]),e.url!==void 0&&i(p,[`url`],l(e.url,`url`,`text`)),o(await c(`Creating`,async()=>u.post(`/accounts/${f}/intel/miscategorization`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},Te={command:`miscategorizations`,describe:`Report and track domain miscategorization corrections`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`Retrieves DNS sinkhole configurations used for redirecting malicious domain traffic to safe destinations.`,builder:Ee,handler:async e=>{if(e.dryRun){s({command:`cf intel sinkholes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/sinkholes`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?d:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.intel.sinkholes.list(a)),{successLabel:`Loaded`})}},Oe={command:`sinkholes`,describe:`DNS sinkhole addresses used to redirect malicious traffic for analysis`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(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 Ae={command:`get`,describe:`Retrieves WHOIS registration data for a domain, including registrant and nameserver information.`,builder:ke,handler:async e=>{let i={domain:e.domain};if(e.dryRun){s({command:`cf intel whois get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/intel/whois`,pathParams:{},query:i,bodyKind:`none`});return}let a=await n(e),l=e.local?d:await t(a);e.accountId=l,o(await c(`Loading`,async()=>a.intel.whois.get(l,i)),{successLabel:`Loaded`})}},je={command:`whois`,describe:`WHOIS registration data for domains including registrant, registrar, and nameservers`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Me={command:`intel`,describe:`Threat intelligence lookups — IP reputation, domain info, ASN details, WHOIS, and indicator feeds`,builder:e=>e.command(v).command(N).command(I).command(z).command(G).command(_e).command(be).command(Se).command(Te).command(Oe).command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Me as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./auth-CQcAgnOy.mjs";import{t}from"./output-D7_yAFVR.mjs";import{n,t as r}from"./progress-CjcQ6ato.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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,b as n,t as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`bundle-method`,{type:`string`,description:`A ubiquitous bundle has the highest probability of being verified everywhere, even by clients using outdated or unusual trust stores. An optimal bundle uses the shortest chain and newest intermediates. And the force bundle verifies the chain, but does not otherwise modify it.`,choices:[`ubiquitous`,`optimal`,`force`],default:`ubiquitous`}).option(`certificate`,{type:`string`,description:`The zone's SSL certificate or SSL certificate and intermediate(s).`}).option(`host`,{type:`string`,description:`The keyless SSL name.`}).option(`name`,{type:`string`,description:`The keyless SSL name.`}).option(`port`,{type:`number`,description:`The keyless SSL port used to communicate between Cloudflare and the client's Keyless SSL server.`,default:24008}).option(`tunnel-private-ip`,{type:`string`,description:`Private IP of the Key Server Host`}).option(`tunnel-vnet-id`,{type:`string`,description:`Cloudflare Tunnel Virtual Network ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`tunnel-private-ip`,`tunnel-vnet-id`].some(t=>e[t]!==void 0)){let t=[`tunnel-private-ip`,`tunnel-vnet-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tunnel-* flag is set`)}return!0})}const d={command:`create`,describe:`Creates a Keyless SSL configuration that allows SSL/TLS termination without exposing private keys to Cloudflare. Keys remain on your infrastructure.`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"bundle-method":e[`bundle-method`],certificate:e.certificate,host:e.host,name:e.name,port:e.port,"tunnel-private-ip":e[`tunnel-private-ip`],"tunnel-vnet-id":e[`tunnel-vnet-id`],body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/keyless_certificates`,{body:t})),{successLabel:`Created`});return}if(e.certificate===void 0&&(e.certificate=await t(`certificate`,`The zone's SSL certificate or SSL certificate and intermediate(s).`)),e.host===void 0&&(e.host=await t(`host`,`The keyless SSL name.`)),e.port===void 0)throw Error(`--port is required (or pass --body with this field set).`);let d={};e[`bundle-method`]!==void 0&&i(d,[`bundle_method`],l(e[`bundle-method`],`bundle-method`,`text`)),e.certificate!==void 0&&i(d,[`certificate`],l(e.certificate,`certificate`,`text`)),e.host!==void 0&&i(d,[`host`],l(e.host,`host`,`text`)),e.name!==void 0&&i(d,[`name`],l(e.name,`name`,`text`)),e.port!==void 0&&i(d,[`port`],e.port),e[`tunnel-private-ip`]!==void 0&&i(d,[`tunnel`,`private_ip`],l(e[`tunnel-private-ip`],`tunnel-private-ip`,`text`)),e[`tunnel-vnet-id`]!==void 0&&i(d,[`tunnel`,`vnet_id`],l(e[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/keyless_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function f(e){return e.positional(`keyless-certificate-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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`delete <keyless-certificate-id>`,describe:`Removes a Keyless SSL configuration. SSL connections will no longer use the keyless server for cryptographic operations.`,builder:f,handler:async t=>{if(t.dryRun){s({command:`cf keyless-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/keyless_certificates/${t[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(t[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(t[`keyless-certificate-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),l=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=l,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(t.body){let e=a(t.body);o(await c(`Deleting`,async()=>i.delete(`/zones/${t.zoneId}/keyless_certificates/${encodeURIComponent(String(t[`keyless-certificate-id`]))}`,{body:e})),{successLabel:`Deleted`});return}o(await c(`Deleting`,async()=>i.keylessCertificates.delete(t[`keyless-certificate-id`],l)),{successLabel:`Deleted`})}};function m(e){return e.positional(`keyless-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Whether or not the Keyless SSL is on or off.`}).option(`host`,{type:`string`,description:`The keyless SSL name.`}).option(`name`,{type:`string`,description:`The keyless SSL name.`}).option(`port`,{type:`number`,description:`The keyless SSL port used to communicate between Cloudflare and the client's Keyless SSL server.`}).option(`tunnel-private-ip`,{type:`string`,description:`Private IP of the Key Server Host`}).option(`tunnel-vnet-id`,{type:`string`,description:`Cloudflare Tunnel Virtual Network ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`tunnel-private-ip`,`tunnel-vnet-id`].some(t=>e[t]!==void 0)){let t=[`tunnel-private-ip`,`tunnel-vnet-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tunnel-* flag is set`)}return!0})}const h={command:`edit <keyless-certificate-id>`,describe:`This will update attributes of a Keyless SSL. Consists of one or more of the following: host,name,port.`,builder:m,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates/${e[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(e[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(e[`keyless-certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{enabled:e.enabled,host:e.host,name:e.name,port:e.port,"tunnel-private-ip":e[`tunnel-private-ip`],"tunnel-vnet-id":e[`tunnel-vnet-id`],body:e.body}});return}let t=await r(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=a(e.body);o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/keyless_certificates/${encodeURIComponent(String(e[`keyless-certificate-id`]))}`,{body:n})),{successLabel:`Updated`});return}let u={};e.enabled!==void 0&&i(u,[`enabled`],e.enabled),e.host!==void 0&&i(u,[`host`],l(e.host,`host`,`text`)),e.name!==void 0&&i(u,[`name`],l(e.name,`name`,`text`)),e.port!==void 0&&i(u,[`port`],e.port),e[`tunnel-private-ip`]!==void 0&&i(u,[`tunnel`,`private_ip`],l(e[`tunnel-private-ip`],`tunnel-private-ip`,`text`)),e[`tunnel-vnet-id`]!==void 0&&i(u,[`tunnel`,`vnet_id`],l(e[`tunnel-vnet-id`],`tunnel-vnet-id`,`text`)),o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/keyless_certificates/${encodeURIComponent(String(e[`keyless-certificate-id`]))}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function g(e){return e.positional(`keyless-certificate-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 <keyless-certificate-id>`,describe:`Get details for one Keyless SSL configuration.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates/${e[`keyless-certificate-id`]==null?`<keyless-certificate-id>`:encodeURIComponent(String(e[`keyless-certificate-id`]))}`,pathParams:{"keyless-certificate-id":String(e[`keyless-certificate-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.keylessCertificates.get(e[`keyless-certificate-id`],i)),{successLabel:`Loaded`})}};function v(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List all Keyless SSL configurations for a given zone.`,builder:v,handler:async e=>{if(e.dryRun){s({command:`cf keyless-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/keyless_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.keylessCertificates.list(i)),{successLabel:`Loaded`})}},b={command:`keyless-certificates`,describe:`Use your own SSL certificates without exposing private keys — keys stay on your infrastructure`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,T as t,h as n,t as r,x as i}from"./auth-CQcAgnOy.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-CjcQ6ato.mjs";import{n as u,t as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{n as p,t as m}from"./raw-fetch-hRv-6P3D.mjs";function h(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`delete <namespace-id>`,describe:`Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.`,builder:h,handler:async t=>{if(t.dryRun){c({command:`cf kv bulk delete`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force,message:`This operation deletes the specified keys from the namespace.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(t.body){let e=o(t.body);if(Array.isArray(e)&&e.length>1e4){let n=Math.ceil(e.length/1e4),r=null;for(let i=0;i<e.length;i+=1e4){let o=e.slice(i,i+1e4);r=await l(`Deleting: batch ${Math.floor(i/1e4)+1}/${n}`,async()=>a.post(`/accounts/${u}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:o}))}s(r,{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.post(`/accounts/${u}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/bulk/delete`,{body:e})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function _(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`keys`,{type:`string`,array:!0,description:`Array of keys to retrieve (maximum of 100).`}).option(`type`,{type:`string`,description:`Whether to parse JSON values in the response.`,choices:[`text`,`json`],default:`text`}).option(`with-metadata`,{type:`boolean`,description:`Whether to include metadata in the response.`,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 v={command:`get <namespace-id>`,describe:"Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true.",builder:_,handler:async e=>{if(e.dryRun){c({command:`cf kv bulk get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/bulk/get`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:{keys:e.keys,type:e.type,"with-metadata":e[`with-metadata`],body:e.body}});return}let t=await r(e),d=e.local?f:await n(t);if(e.accountId=d,e.body){let n=o(e.body);s(await l(`Creating`,async()=>t.post(`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk/get`,{body:n})),{successLabel:`Created`});return}if(e.keys===void 0)throw Error(`--keys is required (or pass --body with this field set).`);let p={};e.keys!==void 0&&a(p,[`keys`],e.keys),e.type!==void 0&&a(p,[`type`],u(e.type,`type`,`text`)),e[`with-metadata`]!==void 0&&a(p,[`withMetadata`],e[`with-metadata`]),s(await l(`Creating`,async()=>t.post(`/accounts/${d}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk/get`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function y(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace 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 b={command:`update <namespace-id>`,describe:"Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less.",builder:y,handler:async e=>{if(e.dryRun){c({command:`cf kv bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/bulk`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),a=e.local?f:await n(t);if(e.accountId=a,e.body){let n=o(e.body);if(Array.isArray(n)&&n.length>1e4){let r=Math.ceil(n.length/1e4),i=null;for(let o=0;o<n.length;o+=1e4){let s=n.slice(o,o+1e4);i=await l(`Updating: batch ${Math.floor(o/1e4)+1}/${r}`,async()=>t.put(`/accounts/${a}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk`,{body:s}))}s(i,{successLabel:`Updated`});return}s(await l(`Updating`,async()=>t.put(`/accounts/${a}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/bulk`,{body:n})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},x={command:`bulk`,describe:`Bulk read, write, and delete operations on multiple KV key-value pairs at once`,builder:e=>e.command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`delete <key-name>`,describe:"Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:S,handler:async t=>{if(t.dryRun){c({command:`cf kv keys delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}/values/${t[`key-name`]==null?`<key-name>`:encodeURIComponent(String(t[`key-name`]))}`,pathParams:{"key-name":String(t[`key-name`]??``),"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}/values/${encodeURIComponent(String(t[`key-name`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.kv.keys.delete(t[`key-name`],t[`namespace-id`],u)),{successLabel:`Deleted`})}};function w(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,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 <key-name>`,describe:"Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header.",builder:w,handler:async e=>{if(e.dryRun){c({command:`cf kv keys get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/values/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a;let o=await l(`Loading`,async()=>m(`/accounts/${a}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{method:`GET`,localEndpoint:e.local?e.localEndpoint:void 0}));p(e.text===!0?o.toString(`utf-8`):o)}};function E(e){return e.option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limits the number of keys returned in the response. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit.`}).option(`prefix`,{type:`string`,description:`Filters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned.`}).option(`cursor`,{type:`string`,description:"Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the `cursors` object in the `result_info` structure."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`Lists a namespace's keys.`,builder:E,handler:async e=>{let t={limit:e.limit,prefix:e.prefix,cursor:e.cursor};if(e.dryRun){c({command:`cf kv keys list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/keys`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.kv.keys.list(e[`namespace-id`],o,t)),{successLabel:`Loaded`})}};function O(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`expiration`,{type:`string`,description:`Expires the key at a certain time, measured in number of seconds since the UNIX epoch.`}).option(`expiration-ttl`,{type:`string`,description:`Expires the key after a number of seconds. Must be at least 60.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A byte sequence to be stored, up to 25 MiB in length.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`The metadata`})}const k={command:`update <key-name>`,describe:"Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use `multipart/form-data` content type for your PUT request (see dropdown below in `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored.",builder:O,handler:async e=>{let t={expiration:e.expiration,expiration_ttl:e[`expiration-ttl`]};if(e.dryRun){c({command:`cf kv keys update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/values/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},query:t,bodyKind:`multipart`,body:{body:e.body,file:e.file,metadata:e.metadata}});return}let a=await r(e),o=e.local?f:await n(a);if(e.accountId=o,e.metadata!==void 0){let t=new FormData;if(e.file){let n=d(e.file);t.append(`value`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`value`,e.body);e.metadata!==void 0&&t.append(`metadata`,String(u(e.metadata,`metadata`,`text`)??``)),s(await l(`Updating`,async()=>a.put(`/accounts/${o}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{body:t})),{successLabel:`Updated`});return}if(e.file){let t=d(e.file);s(await l(`Updating`,async()=>a.put(`/accounts/${o}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}`,{body:t,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body){let n=u(e.body,`body`,`binary`),r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();s(await l(`Updating`,async()=>a.put(`/accounts/${o}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}/values/${encodeURIComponent(String(e[`key-name`]))}${r?`?`+r:``}`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`keys`,describe:`Read, write, and delete individual key-value pairs in a KV namespace. Pass --namespace-id to scope.`,builder:e=>e.command(C).command(T).command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`key-name`,{type:`string`,description:`A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL.`,demandOption:!0}).option(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <key-name>`,describe:"Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.",builder:j,handler:async e=>{if(e.dryRun){c({command:`cf kv metadata get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}/metadata/${e[`key-name`]==null?`<key-name>`:encodeURIComponent(String(e[`key-name`]))}`,pathParams:{"key-name":String(e[`key-name`]??``),"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.kv.metadata.get(e[`key-name`],e[`namespace-id`],a)),{successLabel:`Loaded`})}},N={command:`metadata`,describe:`Read the metadata associated with a KV key without fetching its value`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const F={command:`create`,describe:"Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.",builder:P,handler:async e=>{if(e.dryRun){c({command:`cf kv namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},bodyKind:`json`,body:{title:e.title,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Creating`,async()=>d.post(`/accounts/${p}/storage/kv/namespaces`,{body:t})),{successLabel:`Created`});return}e.title===void 0&&(e.title=await t(`title`,`A human-readable string name for a Namespace.`));let m={};e.title!==void 0&&a(m,[`title`],u(e.title,`title`,`text`)),s(await l(`Creating`,async()=>d.post(`/accounts/${p}/storage/kv/namespaces`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function I(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace 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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`delete <namespace-id>`,describe:`Deletes the namespace corresponding to the given ID.`,builder:I,handler:async t=>{if(t.dryRun){c({command:`cf kv namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${t[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(t[`namespace-id`]))}`,pathParams:{"namespace-id":String(t[`namespace-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?f:await n(a);if(t.accountId=u,!await e({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}if(t.body){let e=o(t.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/storage/kv/namespaces/${encodeURIComponent(String(t[`namespace-id`]))}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.kv.namespaces.delete(t[`namespace-id`],u)),{successLabel:`Deleted`})}};function R(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get <namespace-id>`,describe:`Get the namespace corresponding to the given ID.`,builder:R,handler:async e=>{if(e.dryRun){c({command:`cf kv namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`none`});return}let t=await r(e),a=e.local?f:await n(t);e.accountId=a,s(await l(`Loading`,async()=>t.kv.namespaces.get(e[`namespace-id`],a)),{successLabel:`Loaded`})}};function B(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order results by.`,choices:[`id`,`title`]}).option(`direction`,{type:`string`,description:`Direction to order namespaces.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`list`,describe:`Returns the namespaces owned by an account.`,builder:B,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){c({command:`cf kv namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces`,pathParams:{},query:t,bodyKind:`none`});return}let a=await r(e),o=e.local?f:await n(a);e.accountId=o,s(await l(`Loading`,async()=>a.kv.namespaces.list(o,t)),{successLabel:`Loaded`})}};function H(e){return e.positional(`namespace-id`,{type:`string`,description:`Namespace identifier tag.`,demandOption:!0}).option(`title`,{type:`string`,description:`A human-readable string name for a Namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`update <namespace-id>`,describe:`Modifies a namespace's title.`,builder:H,handler:async e=>{if(e.dryRun){c({command:`cf kv namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/storage/kv/namespaces/${e[`namespace-id`]==null?`<namespace-id>`:encodeURIComponent(String(e[`namespace-id`]))}`,pathParams:{"namespace-id":String(e[`namespace-id`]??``)},bodyKind:`json`,body:{title:e.title,body:e.body}});return}let d=await r(e),p=e.local?f:await n(d);if(e.accountId=p,e.body){let t=o(e.body);s(await l(`Updating`,async()=>d.put(`/accounts/${p}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.title===void 0&&(e.title=await t(`title`,`A human-readable string name for a Namespace.`));let m={};e.title!==void 0&&a(m,[`title`],u(e.title,`title`,`text`)),s(await l(`Updating`,async()=>d.put(`/accounts/${p}/storage/kv/namespaces/${encodeURIComponent(String(e[`namespace-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},W={command:`namespaces`,describe:`KV namespaces — create, read, rename, and delete the containers that hold your key-value pairs`,builder:e=>e.command(F).command(L).command(z).command(V).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},G={command:`kv`,describe:`Global, low-latency key-value storage for Workers — namespaces, keys, values, and bulk operations`,builder:e=>e.command(x).command(A).command(N).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{G as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{n as r,t as i}from"./body-parser-Br-BoYk-.mjs";import{t as a}from"./output-D7_yAFVR.mjs";import{n as o,t as s}from"./progress-CjcQ6ato.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return e.option(`enabled`,{type:`boolean`,description:`Determines whether or not Leaked Credential Checks are enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines the overall status for Leaked Credential Checks.`})}const u={command:`create`,describe:`Updates the current status of Leaked Credential Checks.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{enabled:e.enabled,body:e.body}});return}let c=await n(e);if(e.zoneId=await t({zone:e.zone},c,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Creating`,async()=>c.post(`/zones/${e.zoneId}/leaked-credential-checks`,{body:t})),{successLabel:`Created`});return}let l={};e.enabled!==void 0&&r(l,[`enabled`],e.enabled),a(await s(`Creating`,async()=>c.post(`/zones/${e.zoneId}/leaked-credential-checks`,{body:Object.keys(l).length>0?l:void 0})),{successLabel:`Created`})}};function d(e){return e.option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const f={command:`create`,describe:`Create user-defined detection pattern for Leaked Credential Checks.`,builder:d,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{password:e.password,username:e.username,body:e.body}});return}let l=await n(e);if(e.zoneId=await t({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Creating`,async()=>l.post(`/zones/${e.zoneId}/leaked-credential-checks/detections`,{body:t})),{successLabel:`Created`});return}let u={};e.password!==void 0&&r(u,[`password`],c(e.password,`password`,`text`)),e.username!==void 0&&r(u,[`username`],c(e.username,`username`,`text`)),a(await s(`Creating`,async()=>l.post(`/zones/${e.zoneId}/leaked-credential-checks/detections`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Created`})}};function p(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,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 m={command:`delete <detection-id>`,describe:`Remove user-defined detection pattern for Leaked Credential Checks.`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf leaked-credential-checks detections delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/leaked-credential-checks/detections/${r[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(r[`detection-id`]))}`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``),"detection-id":String(r[`detection-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await t({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await e({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>i.leakedCredentialChecks.detections.delete(c,r[`detection-id`])),{successLabel:`Deleted`})}};function h(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <detection-id>`,describe:`Get user-defined detection pattern for Leaked Credential Checks.`,builder:h,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections/${e[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(e[`detection-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"detection-id":String(e[`detection-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.get(i,e[`detection-id`])),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`List user-defined detection patterns for Leaked Credential Checks.`,builder:_,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.detections.list(i)),{successLabel:`Loaded`})}};function y(e){return e.positional(`detection-id`,{type:`string`,description:`Defines the unique ID for this custom detection.`,demandOption:!0}).option(`password`,{type:`string`,description:`Defines ehe ruleset expression to use in matching the password in a request.`}).option(`username`,{type:`string`,description:`Defines the ruleset expression to use in matching the username in a request.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines a custom set of username/password expressions to match Leaked Credential Checks on.`})}const b={command:`update <detection-id>`,describe:`Update user-defined detection pattern for Leaked Credential Checks.`,builder:y,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks detections update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks/detections/${e[`detection-id`]==null?`<detection-id>`:encodeURIComponent(String(e[`detection-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"detection-id":String(e[`detection-id`]??``)},bodyKind:`json`,body:{password:e.password,username:e.username,body:e.body}});return}let l=await n(e);if(e.zoneId=await t({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/leaked-credential-checks/detections/${encodeURIComponent(String(e[`detection-id`]))}`,{body:t})),{successLabel:`Updated`});return}let u={};e.password!==void 0&&r(u,[`password`],c(e.password,`password`,`text`)),e.username!==void 0&&r(u,[`username`],c(e.username,`username`,`text`)),a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/leaked-credential-checks/detections/${encodeURIComponent(String(e[`detection-id`]))}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},x={command:`detections`,describe:`Custom detection rules that define which request fields contain usernames and passwords to check`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Retrieves the current status of Leaked Credential Checks.`,builder:S,handler:async e=>{if(e.dryRun){o({command:`cf leaked-credential-checks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/leaked-credential-checks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.leakedCredentialChecks.get(i)),{successLabel:`Loaded`})}},w={command:`leaked-credential-checks`,describe:`Detect compromised credentials in login requests by checking against known breach databases`,builder:e=>e.command(u).command(C).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
|