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
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e,p as t,t as n,u as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`delete <certificateId>`,describe:`Delete a single custom certificate from a certificate pack that contains two bundled certificates. Deletion is subject to the following constraints. You cannot delete a certificate if it is the only remaining certificate in the pack. At least one certificate must remain in the pack.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-hostname-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`certificate-pack-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)`}),handler:async e=>{if(a(e.certificateId,`certificateId`),e.dryRun){l({command:`cf custom-hostnames certificate-pack certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}/certificate_pack/${e.certificatePackId??`<certificatePackId>`}/certificates/${e.certificateId??`<certificateId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),certificatePackId:String(e.certificatePackId??``),certificateId:String(e.certificateId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`certificate`,String(e.certificateId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting certificate`,async()=>i.delete(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}/certificate_pack/${e.certificatePackId}/certificates/${e.certificateId}`,{body:t})),{successLabel:`Deleted certificate`});return}c(await u(`Deleting certificate`,async()=>i.customHostnames.certificatePack.certificates.delete(e.customHostnameId,e.certificatePackId,e.certificateId,o)),{successLabel:`Deleted certificate`})}},f={command:`update <certificateId>`,describe:`Replace a single custom certificate within a certificate pack that contains two bundled certificates. The replacement must adhere to the following constraints. You can only replace an RSA certificate with another RSA certificate or an ECDSA certificate with another ECDSA certificate.`,builder:e=>e.positional(`certificateId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-hostname-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`certificate-pack-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).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)`}),handler:async t=>{if(a(t.certificateId,`certificateId`),t.dryRun){l({command:`cf custom-hostnames certificate-pack certificates update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/custom_hostnames/${t.customHostnameId??`<customHostnameId>`}/certificate_pack/${t.certificatePackId??`<certificatePackId>`}/certificates/${t.certificateId??`<certificateId>`}`,pathParams:{customHostnameId:String(t.customHostnameId??``),certificatePackId:String(t.certificatePackId??``),certificateId:String(t.certificateId??``),zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{customCertificate:t.customCertificate,customKey:t.customKey,body:t.body},validation:`passed`});return}let d=await n(t);if(t.zoneId=await r({zone:t.zone},d,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating certificate`,async()=>d.put(`/zones/${t.zoneId}/custom_hostnames/${t.customHostnameId}/certificate_pack/${t.certificatePackId}/certificates/${t.certificateId}`,{body:e})),{successLabel:`Updated certificate`});return}t.customCertificate===void 0&&(t.customCertificate=await e(`custom-certificate`,`If a custom uploaded certificate is used.`)),t.customKey===void 0&&(t.customKey=await e(`custom-key`,`The key for a custom uploaded certificate.`,{kind:`secret`}));let f={};t.customCertificate!==void 0&&o(f,[`custom_certificate`],i(t.customCertificate,`customCertificate`,`text`)),t.customKey!==void 0&&o(f,[`custom_key`],i(t.customKey,`customKey`,`text`)),c(await u(`Updating certificate`,async()=>d.put(`/zones/${t.zoneId}/custom_hostnames/${t.customHostnameId}/certificate_pack/${t.certificatePackId}/certificates/${t.certificateId}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated certificate`})}},p={command:`certificates`,describe:`SSL certificates attached to individual custom hostnames`,builder:e=>e.command(d).command(f).demandCommand(1),handler:()=>{}},m={command:`certificate-pack`,describe:`Operations for certificate-pack`,builder:e=>e.command(p).demandCommand(1),handler:()=>{}},h={command:`create`,describe:`Add a new custom hostname and request that an SSL certificate be issued for it. One of three validation methods—http, txt, email—should be used, with 'http' recommended if the CNAME is already in place (or will be soon). Specifying 'email' will send an email to the WHOIS contacts on file for the base domain plus hostmaster, postmaster, webmaster, admin, administrator. If http is used and the domain is not already pointing to the Managed CNAME host, the PATCH method must be used once it is (to complete validation). Enable bundling of certificates using the custom_cert_bundle field. The bundling process requires the following condition One certificate in the bundle must use an RSA, and the other must use an ECDSA.`,builder:e=>e.option(`hostname`,{type:`string`,description:`The custom hostname that will point to your hostname via CNAME.`}).option(`ssl-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(`ssl-certificate-authority`,{type:`string`,description:`The Certificate Authority that will issue the certificate`,choices:[`digicert`,`google`,`lets_encrypt`,`ssl_com`]}).option(`ssl-cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true`}).option(`ssl-custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`ssl-custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`ssl-custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).option(`ssl-method`,{type:`string`,description:`Domain control validation (DCV) method used for this hostname.`,choices:[`http`,`txt`,`email`]}).option(`ssl-settings-ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`ssl-settings-early-hints`,{type:`string`,description:`Whether or not Early Hints is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-http2`,{type:`string`,description:`Whether or not HTTP2 is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-min-tls-version`,{type:`string`,description:`The minimum TLS version supported.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`ssl-settings-tls-1-3`,{type:`string`,description:`Whether or not TLS 1.3 is enabled.`,choices:[`on`,`off`]}).option(`ssl-type`,{type:`string`,description:`Level of validation to be used for this hostname. Domain validation (dv) must be used.`,choices:[`dv`]}).option(`ssl-wildcard`,{type:`boolean`,description:`Indicates whether the certificate covers a wildcard.`}).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)`}),handler:async t=>{if(t.dryRun){l({command:`cf custom-hostnames create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/custom_hostnames`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{hostname:t.hostname,sslBundleMethod:t.sslBundleMethod,sslCertificateAuthority:t.sslCertificateAuthority,sslCloudflareBranding:t.sslCloudflareBranding,sslCustomCertificate:t.sslCustomCertificate,sslCustomCsrId:t.sslCustomCsrId,sslCustomKey:t.sslCustomKey,sslMethod:t.sslMethod,sslSettingsCiphers:t.sslSettingsCiphers,sslSettingsEarlyHints:t.sslSettingsEarlyHints,sslSettingsHttp2:t.sslSettingsHttp2,sslSettingsMinTlsVersion:t.sslSettingsMinTlsVersion,sslSettingsTls13:t.sslSettingsTls13,sslType:t.sslType,sslWildcard:t.sslWildcard,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Creating custom hostname`,async()=>a.post(`/zones/${t.zoneId}/custom_hostnames`,{body:e})),{successLabel:`Created custom hostname`});return}t.hostname===void 0&&(t.hostname=await e(`hostname`,`The custom hostname that will point to your hostname via CNAME.`));let d={};t.hostname!==void 0&&o(d,[`hostname`],i(t.hostname,`hostname`,`text`)),t.sslBundleMethod!==void 0&&o(d,[`ssl`,`bundle_method`],i(t.sslBundleMethod,`sslBundleMethod`,`text`)),t.sslCertificateAuthority!==void 0&&o(d,[`ssl`,`certificate_authority`],i(t.sslCertificateAuthority,`sslCertificateAuthority`,`text`)),t.sslCloudflareBranding!==void 0&&o(d,[`ssl`,`cloudflare_branding`],t.sslCloudflareBranding),t.sslCustomCertificate!==void 0&&o(d,[`ssl`,`custom_certificate`],i(t.sslCustomCertificate,`sslCustomCertificate`,`text`)),t.sslCustomCsrId!==void 0&&o(d,[`ssl`,`custom_csr_id`],i(t.sslCustomCsrId,`sslCustomCsrId`,`text`)),t.sslCustomKey!==void 0&&o(d,[`ssl`,`custom_key`],i(t.sslCustomKey,`sslCustomKey`,`text`)),t.sslMethod!==void 0&&o(d,[`ssl`,`method`],i(t.sslMethod,`sslMethod`,`text`)),t.sslSettingsCiphers!==void 0&&o(d,[`ssl`,`settings`,`ciphers`],t.sslSettingsCiphers),t.sslSettingsEarlyHints!==void 0&&o(d,[`ssl`,`settings`,`early_hints`],i(t.sslSettingsEarlyHints,`sslSettingsEarlyHints`,`text`)),t.sslSettingsHttp2!==void 0&&o(d,[`ssl`,`settings`,`http2`],i(t.sslSettingsHttp2,`sslSettingsHttp2`,`text`)),t.sslSettingsMinTlsVersion!==void 0&&o(d,[`ssl`,`settings`,`min_tls_version`],i(t.sslSettingsMinTlsVersion,`sslSettingsMinTlsVersion`,`text`)),t.sslSettingsTls13!==void 0&&o(d,[`ssl`,`settings`,`tls_1_3`],i(t.sslSettingsTls13,`sslSettingsTls13`,`text`)),t.sslType!==void 0&&o(d,[`ssl`,`type`],i(t.sslType,`sslType`,`text`)),t.sslWildcard!==void 0&&o(d,[`ssl`,`wildcard`],t.sslWildcard),c(await u(`Creating custom hostname`,async()=>a.post(`/zones/${t.zoneId}/custom_hostnames`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created custom hostname`})}},g={command:`delete <customHostnameId>`,describe:`Permanently deletes a custom hostname and revokes any SSL certificates that were issued for it. This action cannot be undone.`,builder:e=>e.positional(`customHostnameId`,{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)`}),handler:async e=>{if(a(e.customHostnameId,`customHostnameId`),e.dryRun){l({command:`cf custom-hostnames delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),o=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,!await t(`custom hostname`,String(e.customHostnameId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting custom hostname`,async()=>i.delete(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}`,{body:t})),{successLabel:`Deleted custom hostname`});return}c(await u(`Deleting custom hostname`,async()=>i.customHostnames.delete(e.customHostnameId,o)),{successLabel:`Deleted custom hostname`})}},_={command:`edit <customHostnameId>`,describe:`Modify SSL configuration for a custom hostname. When sent with SSL config that matches existing config, used to indicate that hostname should pass domain control validation (DCV). Can also be used to change validation type, e.g., from 'http' to 'email'. Bundle an existing certificate with another certificate by using the "custom_cert_bundle" field. The bundling process supports combining certificates as long as the following condition is met. One certificate must use the RSA algorithm, and the other must use the ECDSA algorithm.`,builder:e=>e.positional(`customHostnameId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`custom-origin-server`,{type:`string`,description:`a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME record.`}).option(`custom-origin-sni`,{type:`string`,description:`A hostname that will be sent to your custom origin server as SNI for TLS handshake. This can be a valid subdomain of the zone or custom origin server name or the string ':request_host_header:' which will cause the host header in the request to be used as SNI. Not configurable with default/fallback origin server.`}).option(`ssl-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(`ssl-certificate-authority`,{type:`string`,description:`The Certificate Authority that will issue the certificate`,choices:[`digicert`,`google`,`lets_encrypt`,`ssl_com`]}).option(`ssl-cloudflare-branding`,{type:`boolean`,description:`Whether or not to add Cloudflare Branding for the order. This will add a subdomain of sni.cloudflaressl.com as the Common Name if set to true`}).option(`ssl-custom-certificate`,{type:`string`,description:`If a custom uploaded certificate is used.`}).option(`ssl-custom-csr-id`,{type:`string`,description:`The identifier for the Custom CSR that was used.`}).option(`ssl-custom-key`,{type:`string`,description:`The key for a custom uploaded certificate.`}).option(`ssl-method`,{type:`string`,description:`Domain control validation (DCV) method used for this hostname.`,choices:[`http`,`txt`,`email`]}).option(`ssl-settings-ciphers`,{type:`string`,array:!0,description:`An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.`}).option(`ssl-settings-early-hints`,{type:`string`,description:`Whether or not Early Hints is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-http2`,{type:`string`,description:`Whether or not HTTP2 is enabled.`,choices:[`on`,`off`]}).option(`ssl-settings-min-tls-version`,{type:`string`,description:`The minimum TLS version supported.`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`ssl-settings-tls-1-3`,{type:`string`,description:`Whether or not TLS 1.3 is enabled.`,choices:[`on`,`off`]}).option(`ssl-type`,{type:`string`,description:`Level of validation to be used for this hostname. Domain validation (dv) must be used.`,choices:[`dv`]}).option(`ssl-wildcard`,{type:`boolean`,description:`Indicates whether the certificate covers a wildcard.`}).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)`}),handler:async e=>{if(a(e.customHostnameId,`customHostnameId`),e.dryRun){l({command:`cf custom-hostnames edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/${e.customHostnameId??`<customHostnameId>`}`,pathParams:{customHostnameId:String(e.customHostnameId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{customOriginServer:e.customOriginServer,customOriginSni:e.customOriginSni,sslBundleMethod:e.sslBundleMethod,sslCertificateAuthority:e.sslCertificateAuthority,sslCloudflareBranding:e.sslCloudflareBranding,sslCustomCertificate:e.sslCustomCertificate,sslCustomCsrId:e.sslCustomCsrId,sslCustomKey:e.sslCustomKey,sslMethod:e.sslMethod,sslSettingsCiphers:e.sslSettingsCiphers,sslSettingsEarlyHints:e.sslSettingsEarlyHints,sslSettingsHttp2:e.sslSettingsHttp2,sslSettingsMinTlsVersion:e.sslSettingsMinTlsVersion,sslSettingsTls13:e.sslSettingsTls13,sslType:e.sslType,sslWildcard:e.sslWildcard,body:e.body},validation:`passed`});return}let t=await n(e);if(e.zoneId=await r({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating custom hostname`,async()=>t.patch(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}`,{body:n})),{successLabel:`Updated custom hostname`});return}let d={};e.customOriginServer!==void 0&&o(d,[`custom_origin_server`],i(e.customOriginServer,`customOriginServer`,`text`)),e.customOriginSni!==void 0&&o(d,[`custom_origin_sni`],i(e.customOriginSni,`customOriginSni`,`text`)),e.sslBundleMethod!==void 0&&o(d,[`ssl`,`bundle_method`],i(e.sslBundleMethod,`sslBundleMethod`,`text`)),e.sslCertificateAuthority!==void 0&&o(d,[`ssl`,`certificate_authority`],i(e.sslCertificateAuthority,`sslCertificateAuthority`,`text`)),e.sslCloudflareBranding!==void 0&&o(d,[`ssl`,`cloudflare_branding`],e.sslCloudflareBranding),e.sslCustomCertificate!==void 0&&o(d,[`ssl`,`custom_certificate`],i(e.sslCustomCertificate,`sslCustomCertificate`,`text`)),e.sslCustomCsrId!==void 0&&o(d,[`ssl`,`custom_csr_id`],i(e.sslCustomCsrId,`sslCustomCsrId`,`text`)),e.sslCustomKey!==void 0&&o(d,[`ssl`,`custom_key`],i(e.sslCustomKey,`sslCustomKey`,`text`)),e.sslMethod!==void 0&&o(d,[`ssl`,`method`],i(e.sslMethod,`sslMethod`,`text`)),e.sslSettingsCiphers!==void 0&&o(d,[`ssl`,`settings`,`ciphers`],e.sslSettingsCiphers),e.sslSettingsEarlyHints!==void 0&&o(d,[`ssl`,`settings`,`early_hints`],i(e.sslSettingsEarlyHints,`sslSettingsEarlyHints`,`text`)),e.sslSettingsHttp2!==void 0&&o(d,[`ssl`,`settings`,`http2`],i(e.sslSettingsHttp2,`sslSettingsHttp2`,`text`)),e.sslSettingsMinTlsVersion!==void 0&&o(d,[`ssl`,`settings`,`min_tls_version`],i(e.sslSettingsMinTlsVersion,`sslSettingsMinTlsVersion`,`text`)),e.sslSettingsTls13!==void 0&&o(d,[`ssl`,`settings`,`tls_1_3`],i(e.sslSettingsTls13,`sslSettingsTls13`,`text`)),e.sslType!==void 0&&o(d,[`ssl`,`type`],i(e.sslType,`sslType`,`text`)),e.sslWildcard!==void 0&&o(d,[`ssl`,`wildcard`],e.sslWildcard),c(await u(`Updating custom hostname`,async()=>t.patch(`/zones/${e.zoneId}/custom_hostnames/${e.customHostnameId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated custom hostname`})}},v={command:`delete`,describe:`Removes the fallback origin configuration for custom hostnames on a zone. Custom hostnames without specific origins will no longer have a fallback.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf custom-hostnames fallback-origin delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/custom_hostnames/fallback_origin`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await t(`fallback origin`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(e.body){let t=s(e.body);c(await u(`Deleting fallback origin`,async()=>i.delete(`/zones/${e.zoneId}/custom_hostnames/fallback_origin`,{body:t})),{successLabel:`Deleted fallback origin`});return}c(await u(`Deleting fallback origin`,async()=>i.customHostnames.fallbackOrigin.delete(a)),{successLabel:`Deleted fallback origin`})}},y={command:`get`,describe:`Retrieves the current fallback origin configuration for custom hostnames on a zone. The fallback origin handles traffic when specific custom hostname origins are unavailable.`,builder:e=>e,handler:async e=>{let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading fallback origin`,async()=>t.customHostnames.fallbackOrigin.get(i)),{successLabel:`Loaded fallback origin`})}},b={command:`update`,describe:`Updates the fallback origin configuration for custom hostnames on a zone. Sets the default origin server for custom hostname traffic.`,builder:e=>e.option(`origin`,{type:`string`,description:`Your origin hostname that requests to your custom hostnames will be sent to.`}).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)`}),handler:async t=>{if(t.dryRun){l({command:`cf custom-hostnames fallback-origin update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zoneId??`<zoneId>`}/custom_hostnames/fallback_origin`,pathParams:{zoneId:String(t.zoneId??``)},bodyKind:`json`,body:{origin:t.origin,body:t.body},validation:`passed`});return}let a=await n(t);if(t.zoneId=await r({zone:t.zone},a,{quiet:t.quiet}),t.body){let e=s(t.body);c(await u(`Updating fallback origin`,async()=>a.put(`/zones/${t.zoneId}/custom_hostnames/fallback_origin`,{body:e})),{successLabel:`Updated fallback origin`});return}t.origin===void 0&&(t.origin=await e(`origin`,`Your origin hostname that requests to your custom hostnames will be sent to.`));let d={};t.origin!==void 0&&o(d,[`origin`],i(t.origin,`origin`,`text`)),c(await u(`Updating fallback origin`,async()=>a.put(`/zones/${t.zoneId}/custom_hostnames/fallback_origin`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated fallback origin`})}},x={command:`fallback-origin`,describe:`Default origin server used when a custom hostname does not have its own specific origin`,builder:e=>e.command(v).command(y).command(b).demandCommand(1),handler:()=>{}},S={command:`get <customHostnameId>`,describe:`Retrieves detailed information about a specific custom hostname, including SSL certificate status, ownership verification, and origin configuration.`,builder:e=>e.positional(`customHostnameId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.customHostnameId,`customHostnameId`);let t=await n(e),i=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading custom hostname`,async()=>t.customHostnames.get(e.customHostnameId,i)),{successLabel:`Loaded custom hostname`})}},C={command:`list`,describe:`List, search, sort, and filter all of your custom hostnames.`,builder:e=>e.option(`hostname`,{type:`string`,description:`Fully qualified domain name to match against. This parameter cannot be used with the 'id' parameter.`}).option(`hostname-contain`,{type:`string`,description:`Filters hostnames by a substring match on the hostname value. This parameter cannot be used with the 'id' parameter.`}).option(`id`,{type:`string`,description:`Hostname ID to match against. This ID was generated and returned during the initial custom_hostname creation. This parameter cannot be used with the 'hostname' parameter.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of hostnames per page.`}).option(`order`,{type:`string`,description:`Field to order hostnames by.`,choices:[`ssl`,`ssl_status`]}).option(`direction`,{type:`string`,description:`Direction to order hostnames.`,choices:[`asc`,`desc`]}).option(`ssl-status`,{type:`string`,description:`Filter by SSL certificate status.`,choices:[`initializing`,`pending_validation`,`deleted`,`pending_issuance`,`pending_deployment`,`pending_deletion`,`pending_expiration`,`expired`,`active`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`pending_cleanup`,`staging_deployment`,`staging_active`,`deactivating`,`inactive`,`backup_issued`,`holding_deployment`]}).option(`hostname-status`,{type:`string`,description:`Filter by the hostname's activation status.`,choices:[`active`,`pending`,`active_redeploying`,`moved`,`pending_deletion`,`deleted`,`pending_blocked`,`pending_migration`,`pending_provisioned`,`test_pending`,`test_active`,`test_active_apex`,`test_blocked`,`test_failed`,`provisioned`,`blocked`]}).option(`certificate-authority`,{type:`string`,description:`Filter by the certificate authority that issued the SSL certificate.`,choices:[`google`,`lets_encrypt`,`ssl_com`]}).option(`wildcard`,{type:`boolean`,description:`Filter by whether the custom hostname is a wildcard hostname.`,default:!1}).option(`custom-origin-server`,{type:`string`,description:`Filter by custom origin server name.`}).option(`ssl`,{type:`string`,description:`Whether to filter hostnames based on if they have SSL enabled.`}),handler:async e=>{let t={};e.hostname!==void 0&&(t.hostname=e.hostname),e.hostnameContain!==void 0&&(t.hostnameContain=e.hostnameContain),e.id!==void 0&&(t.id=e.id),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.sslStatus!==void 0&&(t.ssl_status=e.sslStatus),e.hostnameStatus!==void 0&&(t.hostname_status=e.hostnameStatus),e.certificateAuthority!==void 0&&(t.certificate_authority=e.certificateAuthority),e.wildcard!==void 0&&(t.wildcard=e.wildcard),e.customOriginServer!==void 0&&(t.custom_origin_server=e.customOriginServer),e.ssl!==void 0&&(t.ssl=e.ssl);let i=await n(e),a=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading custom hostnames`,async()=>i.customHostnames.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded custom hostnames`})}},w={command:`custom-hostnames`,describe:`Bring custom vanity domains to your SaaS zone with per-hostname SSL and origin mapping`,builder:e=>e.command(h).command(g).command(_).command(S).command(C).command(m).command(x).demandCommand(1),handler:()=>{}};export{w as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i}from"./auth-BHD_B2p9.mjs";import{n as a,r as o}from"./input-validation-BpVQi9rR.mjs";import{n as s,t as c}from"./body-parser-iA3vRFmh.mjs";import{t as l}from"./output-CqGQp2r6.mjs";import{t as u}from"./dry-run-FV0pZwdg.mjs";import{t as d}from"./local-OqhVQbv0.mjs";import{t as f}from"./progress-5sHFvwez.mjs";const p={command:`create`,describe:`Adds a custom nameserver to the account for use as a vanity nameserver on zones.`,builder:e=>e.option(`ns-name`,{type:`string`,description:`The FQDN of the name server.`}).option(`ns-set`,{type:`number`,description:`The number of the set that this name server belongs to.`,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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&o(t,`accountId`),u({command:`cf custom-nameservers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/custom_ns`,pathParams:{},bodyKind:`json`,body:{nsName:r.nsName,nsSet:r.nsSet,body:r.body},validation:`passed`});return}let p=await i(r),m=r.local?d:await n(p);if(r.accountId=m,r.body){let e=c(r.body);l(await f(`Creating custom nameserver`,async()=>p.post(`/accounts/${m}/custom_ns`,{body:e})),{successLabel:`Created custom nameserver`});return}r.nsName===void 0&&(r.nsName=await t(`ns-name`,`The FQDN of the name server.`));let h={};r.nsName!==void 0&&s(h,[`ns_name`],a(r.nsName,`nsName`,`text`)),r.nsSet!==void 0&&s(h,[`ns_set`],r.nsSet),l(await f(`Creating custom nameserver`,async()=>p.post(`/accounts/${m}/custom_ns`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created custom nameserver`})}},m={command:`delete <customNsId>`,describe:`Removes a custom nameserver from the account.`,builder:e=>e.positional(`customNsId`,{type:`string`,description:`The FQDN of the name server.`,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)`}),handler:async t=>{if(o(t.customNsId,`customNsId`),t.dryRun){let n=e();n&&o(n,`accountId`),u({command:`cf custom-nameservers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/custom_ns/${t.customNsId??`<customNsId>`}`,pathParams:{customNsId:String(t.customNsId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),s=t.local?d:await n(a);if(t.accountId=s,!await r(`custom nameserver`,String(t.customNsId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(t.body){let e=c(t.body);l(await f(`Deleting custom nameserver`,async()=>a.delete(`/accounts/${s}/custom_ns/${t.customNsId}`,{body:e})),{successLabel:`Deleted custom nameserver`});return}l(await f(`Deleting custom nameserver`,async()=>a.customNameservers.delete(t.customNsId,s)),{successLabel:`Deleted custom nameserver`})}},h={command:`get`,describe:`List an account's custom nameservers.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?d:await n(t);e.accountId=r,l(await f(`Loading custom nameserver`,async()=>t.customNameservers.get(r)),{successLabel:`Loaded custom nameserver`})}},g={command:`custom-nameservers`,describe:`Vanity nameservers that use your own domain instead of Cloudflare-assigned NS records`,builder:e=>e.command(p).command(m).command(h).demandCommand(1),handler:()=>{}};export{g as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a,u as o}from"./auth-BHD_B2p9.mjs";import{n as s,r as c}from"./input-validation-BpVQi9rR.mjs";import{n as l,t as u}from"./body-parser-iA3vRFmh.mjs";import{t as d}from"./output-CqGQp2r6.mjs";import{t as f}from"./dry-run-FV0pZwdg.mjs";import{t as p}from"./local-OqhVQbv0.mjs";import{t as m}from"./progress-5sHFvwez.mjs";const h={command:`update <identifier>`,describe:`Updates the configuration of an existing custom page.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`state`,{type:`string`,description:`The custom page state.`,choices:[`default`,`customized`]}).option(`url`,{type:`string`,description:`The URL associated with the custom page.`,default:``}).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)`}),handler:async i=>{if(c(i.identifier,`identifier`),i.dryRun){let t=e();t&&c(t,`accountId`),f({command:`cf custom-pages account-custom-pages update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i.accountIdentifier??`<accountIdentifier>`}/custom_pages/${i.identifier??`<identifier>`}`,pathParams:{identifier:String(i.identifier??``),accountIdentifier:String(i.accountIdentifier??``)},bodyKind:`json`,body:{state:i.state,url:i.url,body:i.body},validation:`passed`});return}let o=await a(i);if(i.accountId=i.local?p:await r(o),i.body){let e=u(i.body);d(await m(`Updating account custom page`,async()=>o.put(`/accounts/${i.accountIdentifier}/custom_pages/${i.identifier}`,{body:e})),{successLabel:`Updated account custom page`});return}i.state===void 0&&(i.state=await n(`state`,`The custom page state.`,[`default`,`customized`])),i.url===void 0&&(i.url=await t(`url`,`The URL associated with the custom page.`));let h={};i.state!==void 0&&l(h,[`state`],s(i.state,`state`,`text`)),i.url!==void 0&&l(h,[`url`],s(i.url,`url`,`text`)),d(await m(`Updating account custom page`,async()=>o.put(`/accounts/${i.accountIdentifier}/custom_pages/${i.identifier}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated account custom page`})}},g={command:`account-custom-pages`,describe:`Account-scoped custom page operations`,builder:e=>e.command(h).demandCommand(1),handler:()=>{}},_={command:`asset`,describe:`Creates a new custom asset at the account level.`,builder:e=>e.option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`name`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&c(t,`accountId`),f({command:`cf custom-pages assets create custom asset`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets`,pathParams:{accountIdentifier:String(n.accountIdentifier??``)},bodyKind:`json`,body:{description:n.description,name:n.name,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n);if(n.accountId=n.local?p:await r(i),n.body){let e=u(n.body);d(await m(`Creating custom`,async()=>i.post(`/accounts/${n.accountIdentifier}/custom_pages/assets`,{body:e})),{successLabel:`Created custom`});return}n.description===void 0&&(n.description=await t(`description`,`A short description of the custom asset.`)),n.name===void 0&&(n.name=await t(`name`,`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`)),n.url===void 0&&(n.url=await t(`url`,`The URL where the asset content is fetched from.`));let o={};n.description!==void 0&&l(o,[`description`],s(n.description,`description`,`text`)),n.name!==void 0&&l(o,[`name`],s(n.name,`name`,`text`)),n.url!==void 0&&l(o,[`url`],s(n.url,`url`,`text`)),d(await m(`Creating custom`,async()=>i.post(`/accounts/${n.accountIdentifier}/custom_pages/assets`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Created custom`})}},v={command:`custom`,describe:`Assets operations`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},y={command:`v2 <zoneIdentifier>`,describe:`Creates a new custom asset at the zone level.`,builder:e=>e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`name`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(c(e.zoneIdentifier,`zoneIdentifier`),e.dryRun){f({command:`cf custom-pages assets create v2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets`,pathParams:{zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{description:e.description,name:e.name,url:e.url,body:e.body},validation:`passed`});return}let n=await a(e);if(e.zoneId=await o({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=u(e.body);d(await m(`Creating create`,async()=>n.post(`/zones/${e.zoneIdentifier}/custom_pages/assets`,{body:t})),{successLabel:`Created create`});return}e.description===void 0&&(e.description=await t(`description`,`A short description of the custom asset.`)),e.name===void 0&&(e.name=await t(`name`,`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`)),e.url===void 0&&(e.url=await t(`url`,`The URL where the asset content is fetched from.`));let r={};e.description!==void 0&&l(r,[`description`],s(e.description,`description`,`text`)),e.name!==void 0&&l(r,[`name`],s(e.name,`name`,`text`)),e.url!==void 0&&l(r,[`url`],s(e.url,`url`,`text`)),d(await m(`Creating create`,async()=>n.post(`/zones/${e.zoneIdentifier}/custom_pages/assets`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created create`})}},b={command:`create`,describe:`Assets operations`,builder:e=>e.command(y).command(v).demandCommand(1),handler:()=>{}},x={command:`asset <assetName>`,describe:`Deletes an existing custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,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}),handler:async t=>{if(c(t.assetName,`assetName`),t.dryRun){let n=e();n&&c(n,`accountId`),f({command:`cf custom-pages assets delete custom asset`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets/${t.assetName??`<assetName>`}`,pathParams:{assetName:String(t.assetName??``),accountIdentifier:String(t.accountIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t);if(t.accountId=t.local?p:await r(n),!await i(`custom`,String(t.assetName??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}d(await m(`Deleting custom`,async()=>n.customPages.assets.delete.custom.asset(t.assetName,t.accountIdentifier)),{successLabel:`Deleted custom`})}},S={command:`custom`,describe:`Assets operations`,builder:e=>e.command(x).demandCommand(1),handler:()=>{}},C={command:`v2 <assetName>`,describe:`Deletes an existing custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{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}),handler:async e=>{if(c(e.assetName,`assetName`),e.dryRun){f({command:`cf custom-pages assets delete v2`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets/${e.assetName??`<assetName>`}`,pathParams:{assetName:String(e.assetName??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let t=await a(e),n=await o({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await i(`delete`,String(e.assetName??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}d(await m(`Deleting delete`,async()=>t.customPages.assets.delete.v2(e.assetName,n)),{successLabel:`Deleted delete`})}},w={command:`delete`,describe:`Assets operations`,builder:e=>e.command(C).command(S).demandCommand(1),handler:()=>{}},T={command:`asset <assetName>`,describe:`Fetches the details of a custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}),handler:async e=>{c(e.assetName,`assetName`);let t=await a(e);e.accountId=e.local?p:await r(t),d(await m(`Loading custom`,async()=>t.customPages.assets.get.custom.asset(e.assetName,e.accountIdentifier)),{successLabel:`Loaded custom`})}},E={command:`custom`,describe:`Assets operations`,builder:e=>e.command(T).demandCommand(1),handler:()=>{}},D={command:`v2 <assetName>`,describe:`Fetches the details of a custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{c(e.assetName,`assetName`);let t=await a(e),n=await o({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,d(await m(`Loading get`,async()=>t.customPages.assets.get.v2(e.assetName,n)),{successLabel:`Loaded get`})}},O={command:`get`,describe:`Assets operations`,builder:e=>e.command(D).command(E).demandCommand(1),handler:()=>{}},k={command:`assets`,describe:`Fetches all the custom assets at the account level.`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e);e.accountId=e.local?p:await r(n),d(await m(`Loading custom`,async()=>n.customPages.assets.list.custom.assets(e.accountIdentifier,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded custom`})}},A={command:`custom`,describe:`Assets operations`,builder:e=>e.command(k).demandCommand(1),handler:()=>{}},j={command:`v2 <zoneIdentifier>`,describe:`Fetches all the custom assets at the zone level.`,builder:e=>e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}),handler:async e=>{c(e.zoneIdentifier,`zoneIdentifier`);let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),r=await o({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,d(await m(`Loading list`,async()=>n.customPages.assets.list.v2(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded list`})}},M={command:`list`,describe:`Assets operations`,builder:e=>e.command(j).command(A).demandCommand(1),handler:()=>{}},N={command:`asset <assetName>`,describe:`Updates the configuration of an existing custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(c(n.assetName,`assetName`),n.dryRun){let t=e();t&&c(t,`accountId`),f({command:`cf custom-pages assets update custom asset`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n.accountIdentifier??`<accountIdentifier>`}/custom_pages/assets/${n.assetName??`<assetName>`}`,pathParams:{assetName:String(n.assetName??``),accountIdentifier:String(n.accountIdentifier??``)},bodyKind:`json`,body:{description:n.description,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n);if(n.accountId=n.local?p:await r(i),n.body){let e=u(n.body);d(await m(`Updating custom`,async()=>i.put(`/accounts/${n.accountIdentifier}/custom_pages/assets/${n.assetName}`,{body:e})),{successLabel:`Updated custom`});return}n.description===void 0&&(n.description=await t(`description`,`A short description of the custom asset.`)),n.url===void 0&&(n.url=await t(`url`,`The URL where the asset content is fetched from.`));let o={};n.description!==void 0&&l(o,[`description`],s(n.description,`description`,`text`)),n.url!==void 0&&l(o,[`url`],s(n.url,`url`,`text`)),d(await m(`Updating custom`,async()=>i.put(`/accounts/${n.accountIdentifier}/custom_pages/assets/${n.assetName}`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated custom`})}},P={command:`custom`,describe:`Assets operations`,builder:e=>e.command(N).demandCommand(1),handler:()=>{}},F={command:`v2 <assetName>`,describe:`Updates the configuration of an existing custom asset.`,builder:e=>e.positional(`assetName`,{type:`string`,description:`The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the custom asset.`}).option(`url`,{type:`string`,description:`The URL where the asset content is fetched from.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(c(e.assetName,`assetName`),e.dryRun){f({command:`cf custom-pages assets update v2`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/assets/${e.assetName??`<assetName>`}`,pathParams:{assetName:String(e.assetName??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{description:e.description,url:e.url,body:e.body},validation:`passed`});return}let n=await a(e);if(e.zoneId=await o({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=u(e.body);d(await m(`Updating update`,async()=>n.put(`/zones/${e.zoneIdentifier}/custom_pages/assets/${e.assetName}`,{body:t})),{successLabel:`Updated update`});return}e.description===void 0&&(e.description=await t(`description`,`A short description of the custom asset.`)),e.url===void 0&&(e.url=await t(`url`,`The URL where the asset content is fetched from.`));let r={};e.description!==void 0&&l(r,[`description`],s(e.description,`description`,`text`)),e.url!==void 0&&l(r,[`url`],s(e.url,`url`,`text`)),d(await m(`Updating update`,async()=>n.put(`/zones/${e.zoneIdentifier}/custom_pages/assets/${e.assetName}`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated update`})}},I={command:`update`,describe:`Assets operations`,builder:e=>e.command(F).command(P).demandCommand(1),handler:()=>{}},L={command:`assets`,describe:`Operations for assets`,builder:e=>e.command(b).command(w).command(O).command(M).command(I).demandCommand(1),handler:()=>{}},R={command:`get <identifier>`,describe:`Fetches the details of a custom page.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}),handler:async e=>{c(e.identifier,`identifier`);let t=await a(e);e.accountId=e.local?p:await r(t),d(await m(`Loading custom page`,async()=>t.customPages.get(e.identifier,e.accountIdentifier)),{successLabel:`Loaded custom page`})}},z={command:`list`,describe:`Fetches all the custom pages at the account level.`,builder:e=>e,handler:async e=>{let t=await a(e);e.accountId=e.local?p:await r(t),d(await m(`Loading custom pages`,async()=>t.customPages.list(e.accountIdentifier)),{successLabel:`Loaded custom pages`})}},B={command:`update <identifier>`,describe:`Updates the configuration of an existing custom page.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`state`,{type:`string`,description:`The custom page state.`,choices:[`default`,`customized`]}).option(`url`,{type:`string`,description:`The URL associated with the custom page.`,default:``}).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)`}),handler:async e=>{if(c(e.identifier,`identifier`),e.dryRun){f({command:`cf custom-pages update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneIdentifier??`<zoneIdentifier>`}/custom_pages/${e.identifier??`<identifier>`}`,pathParams:{identifier:String(e.identifier??``),zoneIdentifier:String(e.zoneIdentifier??``)},bodyKind:`json`,body:{state:e.state,url:e.url,body:e.body},validation:`passed`});return}let r=await a(e);if(e.zoneId=await o({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=u(e.body);d(await m(`Updating custom page`,async()=>r.put(`/zones/${e.zoneIdentifier}/custom_pages/${e.identifier}`,{body:t})),{successLabel:`Updated custom page`});return}e.state===void 0&&(e.state=await n(`state`,`The custom page state.`,[`default`,`customized`])),e.url===void 0&&(e.url=await t(`url`,`The URL associated with the custom page.`));let i={};e.state!==void 0&&l(i,[`state`],s(e.state,`state`,`text`)),e.url!==void 0&&l(i,[`url`],s(e.url,`url`,`text`)),d(await m(`Updating custom page`,async()=>r.put(`/zones/${e.zoneIdentifier}/custom_pages/${e.identifier}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated custom page`})}},V={command:`get <identifier>`,describe:`Fetches the details of a custom page.`,builder:e=>e.positional(`identifier`,{type:`string`,description:`Error Page Types`,demandOption:!0}).option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{c(e.identifier,`identifier`);let t=await a(e),n=await o({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,d(await m(`Loading zone custom page`,async()=>t.customPages.zoneCustomPages.get(e.identifier,n)),{successLabel:`Loaded zone custom page`})}},H={command:`list`,describe:`Fetches all the custom pages at the zone level.`,builder:e=>e.option(`zone-identifier`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{let t=await a(e),n=await o({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,d(await m(`Loading zone custom pages`,async()=>t.customPages.zoneCustomPages.list(n)),{successLabel:`Loaded zone custom pages`})}},U={command:`zone-custom-pages`,describe:`Zone-scoped custom page operations`,builder:e=>e.command(V).command(H).demandCommand(1),handler:()=>{}},W={command:`custom-pages`,describe:`Custom error and challenge pages (1000s, WAF blocks, captchas) for zones and accounts`,builder:e=>e.command(R).command(z).command(B).command(g).command(L).command(U).demandCommand(1),handler:()=>{}};export{W as default};
|
package/dist/d1-c_zhZGWf.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Returns the created D1 database.`,builder:e=>e.option(`jurisdiction`,{type:`string`,description:`Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored.`,choices:[`eu`,`fedramp`]}).option(`name`,{type:`string`,description:`D1 database name.`}).option(`primary-location-hint`,{type:`string`,description:`Specify the region to create the D1 primary, if available. If this option is omitted, the D1 will be created as close as possible to the current user.`,choices:[`wnam`,`enam`,`weur`,`eeur`,`apac`,`oc`]}).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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf d1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/d1/database`,pathParams:{},bodyKind:`json`,body:{jurisdiction:n.jurisdiction,name:n.name,primaryLocationHint:n.primaryLocationHint,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating d1`,async()=>i.post(`/accounts/${m}/d1/database`,{body:e})),{successLabel:`Created d1`});return}n.name===void 0&&(n.name=await t(`name`,`D1 database name.`));let h={};n.jurisdiction!==void 0&&c(h,[`jurisdiction`],o(n.jurisdiction,`jurisdiction`,`text`)),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.primaryLocationHint!==void 0&&c(h,[`primary_location_hint`],o(n.primaryLocationHint,`primaryLocationHint`,`text`)),u(await p(`Creating d1`,async()=>i.post(`/accounts/${m}/d1/database`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created d1`})}},h={command:`delete <databaseId>`,describe:`Deletes the specified D1 database.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,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}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`d1`,String(t.databaseId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}u(await p(`Deleting d1`,async()=>n.d1.delete(o,t.databaseId)),{successLabel:`Deleted d1`})}},g={command:`edit <databaseId>`,describe:`Updates partially the specified D1 database.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).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([`read-replication-mode`].some(t=>e[t]!==void 0)){let t=[`read-replication-mode`].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 --read_replication-* flag is set`)}return!0}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{readReplicationMode:t.readReplicationMode,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating d1`,async()=>n.patch(`/accounts/${i}/d1/database/${t.databaseId}`,{body:e})),{successLabel:`Updated d1`});return}let m={};t.readReplicationMode!==void 0&&c(m,[`read_replication`,`mode`],o(t.readReplicationMode,`readReplicationMode`,`text`)),u(await p(`Updating d1`,async()=>n.patch(`/accounts/${i}/d1/database/${t.databaseId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated d1`})}},_={command:`export <databaseId>`,describe:`Returns a URL where the SQL contents of your D1 can be downloaded. Note: this process may take some time for larger DBs, during which your D1 will be unavailable to serve queries. To avoid blocking your DB unnecessarily, an in-progress export must be continually polled or will automatically cancel.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`current-bookmark`,{type:`string`,description:`To poll an in-progress export, provide the current bookmark (returned by your first polling response)`}).option(`dump-options-no-data`,{type:`boolean`,description:`Export only the table definitions, not their contents`}).option(`dump-options-no-schema`,{type:`boolean`,description:`Export only each table's contents, not its definition`}).option(`dump-options-tables`,{type:`string`,array:!0,description:`Filter the export to just one or more tables. Passing an empty array is the same as not passing anything and means: export all tables.`}).option(`output-format`,{type:`string`,description:`Specifies that you will poll this endpoint until the export completes`,choices:[`polling`]}).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)`}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 export`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/export`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{currentBookmark:t.currentBookmark,dumpOptionsNoData:t.dumpOptionsNoData,dumpOptionsNoSchema:t.dumpOptionsNoSchema,dumpOptionsTables:t.dumpOptionsTables,outputFormat:t.outputFormat,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Loading d1`,async()=>i.post(`/accounts/${m}/d1/database/${t.databaseId}/export`,{body:e})),{successLabel:`Loaded d1`});return}t.outputFormat===void 0&&(t.outputFormat=await n(`output-format`,`Specifies that you will poll this endpoint until the export completes`,[`polling`]));let h={};t.currentBookmark!==void 0&&c(h,[`current_bookmark`],o(t.currentBookmark,`currentBookmark`,`text`)),t.dumpOptionsNoData!==void 0&&c(h,[`dump_options`,`no_data`],t.dumpOptionsNoData),t.dumpOptionsNoSchema!==void 0&&c(h,[`dump_options`,`no_schema`],t.dumpOptionsNoSchema),t.dumpOptionsTables!==void 0&&c(h,[`dump_options`,`tables`],t.dumpOptionsTables),t.outputFormat!==void 0&&c(h,[`output_format`],o(t.outputFormat,`outputFormat`,`text`)),u(await p(`Loading d1`,async()=>i.post(`/accounts/${m}/d1/database/${t.databaseId}/export`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Loaded d1`})}},v={command:`get <databaseId>`,describe:`Returns the specified D1 database.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`Database ID`,demandOption:!0}),handler:async e=>{s(e.databaseId,`databaseId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading d1`,async()=>t.d1.get(n,e.databaseId)),{successLabel:`Loaded d1`})}},y={command:`import <databaseId>`,describe:`Generates a temporary URL for uploading an SQL file to, then instructing the D1 to import it and polling it for status updates. Imports block the D1 for their duration.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`action`,{type:`string`,description:`Indicates you have a new SQL file to upload.`,choices:[`init`,`ingest`,`poll`]}).option(`etag`,{type:`string`,description:`Required when action is 'init' or 'ingest'. An md5 hash of the file you're uploading. Used to check if it already exists, and validate its contents before ingesting.`}).option(`filename`,{type:`string`,description:`The filename you have successfully uploaded.`}).option(`current-bookmark`,{type:`string`,description:`This identifies the currently-running import, checking its status.`}).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(`etag`,[`current-bookmark`]).conflicts(`filename`,[`current-bookmark`]).implies(`filename`,[`etag`]).conflicts(`current-bookmark`,[`etag`,`filename`]),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/import`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{action:t.action,etag:t.etag,filename:t.filename,currentBookmark:t.currentBookmark,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Creating d1`,async()=>i.post(`/accounts/${m}/d1/database/${t.databaseId}/import`,{body:e})),{successLabel:`Created d1`});return}t.action===void 0&&(t.action=await n(`action`,`Indicates you have a new SQL file to upload.`,[`init`,`ingest`,`poll`]));let h={};t.action!==void 0&&c(h,[`action`],o(t.action,`action`,`text`)),t.etag!==void 0&&c(h,[`etag`],o(t.etag,`etag`,`text`)),t.filename!==void 0&&c(h,[`filename`],o(t.filename,`filename`,`text`)),t.currentBookmark!==void 0&&c(h,[`current_bookmark`],o(t.currentBookmark,`currentBookmark`,`text`)),u(await p(`Creating d1`,async()=>i.post(`/accounts/${m}/d1/database/${t.databaseId}/import`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created d1`})}},b={command:`list`,describe:`Returns a list of D1 databases.`,builder:e=>e.option(`name`,{type:`string`,description:`a database name to search for.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}),handler:async e=>{let t={};e.name!==void 0&&(t.name=e.name),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading d1`,async()=>n.d1.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded d1`})}},x={command:`query <databaseId>`,describe:`Returns the query result as an object.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A single query object or a batch query object`}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/query`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{params:t.params,sql:t.sql,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Loading d1`,async()=>n.post(`/accounts/${i}/d1/database/${t.databaseId}/query`,{body:e})),{successLabel:`Loaded d1`});return}let m={};t.params!==void 0&&c(m,[`params`],t.params),t.sql!==void 0&&c(m,[`sql`],o(t.sql,`sql`,`text`)),u(await p(`Loading d1`,async()=>n.post(`/accounts/${i}/d1/database/${t.databaseId}/query`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Loaded d1`})}},S={command:`raw <databaseId>`,describe:`Returns the query result rows as arrays rather than objects. This is a performance-optimized version of the /query endpoint.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A single query object or a batch query object`}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/raw`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{params:t.params,sql:t.sql,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Loading d1`,async()=>n.post(`/accounts/${i}/d1/database/${t.databaseId}/raw`,{body:e})),{successLabel:`Loaded d1`});return}let m={};t.params!==void 0&&c(m,[`params`],t.params),t.sql!==void 0&&c(m,[`sql`],o(t.sql,`sql`,`text`)),u(await p(`Loading d1`,async()=>n.post(`/accounts/${i}/d1/database/${t.databaseId}/raw`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Loaded d1`})}},C={command:`get-bookmark <databaseId>`,describe:`Retrieves the current bookmark, or the nearest bookmark at or before a provided timestamp. Bookmarks can be used with the restore endpoint to revert the database to a previous point in time.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`timestamp`,{type:`string`,description:`An optional ISO 8601 timestamp. If provided, returns the nearest available bookmark at or before this timestamp. If omitted, returns the current bookmark.`}),handler:async e=>{s(e.databaseId,`databaseId`);let t={};e.timestamp!==void 0&&(t.timestamp=e.timestamp);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading time travel`,async()=>n.d1.timeTravel.getBookmark(i,e.databaseId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded time travel`})}},w={command:`restore <databaseId>`,describe:`Restores a D1 database to a previous point in time either via a bookmark or a timestamp.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`bookmark`,{type:`string`,description:"A bookmark to restore the database to. Required if `timestamp` is not provided."}).option(`timestamp`,{type:`string`,description:"An ISO 8601 timestamp to restore the database to. Required if `bookmark` is not provided."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.databaseId,`databaseId`);let n={};if(t.bookmark!==void 0&&(n.bookmark=t.bookmark),t.timestamp!==void 0&&(n.timestamp=t.timestamp),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf d1 time-travel restore`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}/time_travel/restore`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);t.accountId=o,u(await p(`Creating time travel`,async()=>i.d1.timeTravel.restore(o,t.databaseId,Object.keys(n).length>0?n:void 0)),{successLabel:`Created time travel`})}},T={command:`time-travel`,describe:`use specific point-in-time backups of your D1 database`,builder:e=>e.command(C).command(w).demandCommand(1),handler:()=>{}},E={command:`update <databaseId>`,describe:`Updates the specified D1 database.`,builder:e=>e.positional(`databaseId`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).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)`}),handler:async t=>{if(s(t.databaseId,`databaseId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf d1 update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/d1/database/${t.databaseId??`<databaseId>`}`,pathParams:{databaseId:String(t.databaseId??``)},bodyKind:`json`,body:{readReplicationMode:t.readReplicationMode,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Updating d1`,async()=>i.put(`/accounts/${m}/d1/database/${t.databaseId}`,{body:e})),{successLabel:`Updated d1`});return}t.readReplicationMode===void 0&&(t.readReplicationMode=await n(`read-replication-mode`,`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,[`auto`,`disabled`]));let h={};t.readReplicationMode!==void 0&&c(h,[`read_replication`,`mode`],o(t.readReplicationMode,`readReplicationMode`,`text`)),u(await p(`Updating d1`,async()=>i.put(`/accounts/${m}/d1/database/${t.databaseId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated d1`})}},D={command:`d1`,describe:`D1 is Cloudflare's managed, serverless database with SQLite's SQL semantics, built-in disaster recovery, and Worker and HTTP API access.`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).command(y).command(b).command(x).command(S).command(E).command(T).demandCommand(1),handler:()=>{}};export{D as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e,u as t}from"./auth-BHD_B2p9.mjs";import{t as n}from"./output-CqGQp2r6.mjs";import{t as r}from"./progress-5sHFvwez.mjs";const i={command:`get`,describe:`Retrieve the account and zone specific unique identifier used as part of the CNAME target for DCV Delegation.`,builder:e=>e,handler:async i=>{let a=await e(i),o=await t({zone:i.zone},a,{quiet:i.quiet});i.zoneId=o,n(await r(`Loading dcv delegation`,async()=>a.dcvDelegation.get(o)),{successLabel:`Loaded dcv delegation`})}},a={command:`dcv-delegation`,describe:`Delegate domain control validation (DCV) to Cloudflare so certificates auto-renew without manual DNS changes`,builder:e=>e.command(i).demandCommand(1),handler:()=>{}};export{a as default};
|
package/dist/dev-Bu26u5Jm.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./src-D8_cWUwt.mjs";import{a as t}from"./theme-BKCxTQTe.mjs";import"./ui-Dj3No2vN.mjs";import{existsSync as n,readFileSync as r}from"node:fs";import{homedir as i}from"node:os";import{join as a}from"node:path";import{execFileSync as o,spawn as s}from"node:child_process";function c(e){return t=>{if(!t.pkgRoot)return null;let r=a(t.pkgRoot,`bin`,e);return n(r)?r:null}}function l(){let e=a(process.env.CARGO_HOME??a(i(),`.cargo`),`bin`,`cloudflare-rs-dev-server`);return n(e)?e:null}const u=[{ecosystem:`npm`,pkg:`@cloudflare/vite-plugin`,description:`Vite-based dev server (recommended for JavaScript/TypeScript)`,manifest:`package.json`,binary:c(`cf-vite`),installHint:`npm install --save-dev @cloudflare/vite-plugin`},{ecosystem:`npm`,pkg:`@cloudflare/wrangler-bundler`,description:`esbuild-based dev server (legacy wrangler dev)`,manifest:`package.json`,binary:c(`cf-wrangler`),installHint:`npm install --save-dev @cloudflare/wrangler-bundler`},{ecosystem:`pypi`,pkg:`cloudflare-py-dev-server`,description:`Python dev server (Pyodide via workerd)`,manifest:`pyproject.toml`,binary:()=>null,installHint:`pip install cloudflare-py-dev-server (or: uv add --dev cloudflare-py-dev-server)`},{ecosystem:`cargo`,pkg:`cloudflare-rs-dev-server`,description:`Rust dev server (wasm-bindgen + workerd)`,manifest:`Cargo.toml`,binary:l,installHint:`cargo install cloudflare-rs-dev-server`}];function d(e){return u.find(t=>t.pkg===e)}function f(e){let t=[];return t.push(...p(e)),t.push(...g(e)),t.push(...b(e)),t}function p(e){let t=a(e,`package.json`);if(!n(t))return[];let i;try{let e=r(t,`utf-8`);i=JSON.parse(e)}catch{return[]}let o=m(i),s=[];for(let n of o){let r=d(n);if(!r||r.ecosystem!==`npm`)continue;let i=h(e,n),a=i?r.binary({cwd:e,pkgRoot:i}):null;s.push({impl:r,binary:a,manifestPath:t})}return s}function m(e){let t=new Set;for(let n of[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`]){let r=e[n];if(r&&typeof r==`object`)for(let e of Object.keys(r))t.add(e)}return t}function h(e,t){if(n(a(e,`node_modules`,t,`package.json`)))return a(e,`node_modules`,t)}function g(e){let t=a(e,`pyproject.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of _()){if(!v(i,n.pkg))continue;let r=y(e,n.pkg);o.push({impl:n,binary:r,manifestPath:t})}return o}function _(){let e=[],t=new Set;for(let n of S())n.ecosystem===`pypi`&&!t.has(n.pkg)&&(e.push(n),t.add(n.pkg));return e}function v(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`["']${n}(?=[\\s\\[<>=!~"';])`,`m`).test(e)}function y(e,t){if(n(a(e,`uv.lock`)))return`uv:${t}`;try{let r=o(`python3`,[`-c`,`import shutil, sys; p = shutil.which(${JSON.stringify(t)}); sys.stdout.write(p or "")`],{cwd:e,stdio:[`ignore`,`pipe`,`ignore`],encoding:`utf-8`}).trim();if(r&&n(r))return r}catch{}return null}function b(e){let t=a(e,`Cargo.toml`);if(!n(t))return[];let i;try{i=r(t,`utf-8`)}catch{return[]}let o=[];for(let n of S()){if(n.ecosystem!==`cargo`||!x(i,n.pkg))continue;let r=n.binary({cwd:e});o.push({impl:n,binary:r,manifestPath:t})}return o}function x(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^\\s*${n}\\s*=)|(^\\s*\\[[^\\]]*\\.${n}\\s*\\])`,`m`).test(e)}function S(){return u}async function C(e,t){let n=e.binary;if(!n)throw Error(`Cannot spawn ${e.impl.pkg}: binary not found.\nTry: ${e.impl.installHint}`);let{command:r,prefixArgs:i}=w(n),a=s(r,[...i,`dev`,...t],{stdio:`inherit`,env:E(process.env,`--no-deprecation`)}),o=e=>{a.kill(e)},c=()=>o(`SIGINT`),l=()=>o(`SIGTERM`);process.on(`SIGINT`,c),process.on(`SIGTERM`,l);try{return await new Promise((e,t)=>{a.once(`exit`,(t,n)=>{e(t===null?n?128+(T[n]??1):1:t)}),a.once(`error`,e=>{t(e)})})}finally{process.off(`SIGINT`,c),process.off(`SIGTERM`,l)}}function w(e){return e.startsWith(`uv:`)?{command:`uv`,prefixArgs:[`run`,`--no-sync`,e.slice(3)]}:{command:e,prefixArgs:[]}}const T={SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGKILL:9,SIGTERM:15};function E(e,t){let n=e.NODE_OPTIONS??``;return n.split(/\s+/).includes(t)?e:{...e,NODE_OPTIONS:n?`${n} ${t}`:t}}const D={command:`dev [implArgs..]`,describe:`Run the project's Cloudflare dev server`,builder:e=>e.positional(`implArgs`,{type:`string`,array:!0,describe:`Arguments forwarded to the dev-server implementation`}).parserConfiguration({"unknown-options-as-args":!0,"camel-case-expansion":!1}).epilogue(`cf dev discovers the installed Cloudflare dev-server in the project's manifest
|
|
3
|
-
(package.json / pyproject.toml / Cargo.toml) and spawns it as a subprocess.
|
|
4
|
-
A project must have exactly one dev-server installed.
|
|
5
|
-
|
|
6
|
-
Use the impl's own --help for its flags (e.g. ${t.brand(`cf dev --help`)}\nfalls through to the impl's help once spawned).`),handler:async t=>{let n=process.cwd(),r=f(n);if(r.length===0)throw O(n),new e(1);if(r.length>1)throw k(r),new e(1);let[i]=r;throw i?i.binary?new e(await C(i,(t.implArgs??[]).map(String))):(A(i),new e(1)):new e(1)}};function O(e){console.error(`
|
|
7
|
-
No Cloudflare dev-server is installed in this project.
|
|
8
|
-
|
|
9
|
-
A project must declare exactly one of the following in its manifest:
|
|
10
|
-
`);for(let e of u)console.error(` ${t.bold(e.pkg)} ${t.muted(`(${e.description})`)}`),console.error(` install: ${e.installHint}`);console.error(`\nThe manifest checked was: ${e}/(package.json|pyproject.toml|Cargo.toml)`)}function k(e){console.error(`
|
|
11
|
-
Multiple Cloudflare dev-server implementations are configured:
|
|
12
|
-
`);for(let n of e)console.error(` - ${t.bold(n.impl.pkg)} (${n.manifestPath})`);console.error(`
|
|
13
|
-
A project can only use one dev-server. Remove all but one
|
|
14
|
-
from your project's manifest and try again.`)}function A(e){console.error(`\n${t.bold(e.impl.pkg)} is declared in ${e.manifestPath} but is not installed.\n\nTry: ${e.impl.installHint}`)}export{D as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Create Endpoint Health Check.`,builder:e=>e.option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`],default:`icmp`}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf diagnostics endpoint-healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/diagnostics/endpoint-healthchecks`,pathParams:{},bodyKind:`json`,body:{checkType:i.checkType,endpoint:i.endpoint,name:i.name,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating endpoint healthcheck`,async()=>m.post(`/accounts/${h}/diagnostics/endpoint-healthchecks`,{body:e})),{successLabel:`Created endpoint healthcheck`});return}i.checkType===void 0&&(i.checkType=await n(`check-type`,`type of check to perform`,[`icmp`])),i.endpoint===void 0&&(i.endpoint=await t(`endpoint`,`the IP address of the host to perform checks against`));let g={};i.checkType!==void 0&&c(g,[`check_type`],o(i.checkType,`checkType`,`text`)),i.endpoint!==void 0&&c(g,[`endpoint`],o(i.endpoint,`endpoint`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),u(await p(`Creating endpoint healthcheck`,async()=>m.post(`/accounts/${h}/diagnostics/endpoint-healthchecks`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created endpoint healthcheck`})}},h={command:`delete <id>`,describe:`Delete Endpoint Health Check.`,builder:e=>e.positional(`id`,{type:`string`,description:`UUID.`,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}),handler:async t=>{if(s(t.id,`id`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf diagnostics endpoint-healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/diagnostics/endpoint-healthchecks/${t.id??`<id>`}`,pathParams:{id:String(t.id??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`endpoint healthcheck`,String(t.id??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}u(await p(`Deleting endpoint healthcheck`,async()=>n.diagnostics.endpointHealthchecks.delete(o,t.id)),{successLabel:`Deleted endpoint healthcheck`})}},g={command:`get <id>`,describe:`Get a single Endpoint Health Check.`,builder:e=>e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}),handler:async e=>{s(e.id,`id`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading endpoint healthcheck`,async()=>t.diagnostics.endpointHealthchecks.get(n,e.id)),{successLabel:`Loaded endpoint healthcheck`})}},_={command:`list`,describe:`List Endpoint Health Checks.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading endpoint healthchecks`,async()=>t.diagnostics.endpointHealthchecks.list(n)),{successLabel:`Loaded endpoint healthchecks`})}},v={command:`update <id>`,describe:`Update a Endpoint Health Check.`,builder:e=>e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`],default:`icmp`}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).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)`}),handler:async i=>{if(s(i.id,`id`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf diagnostics endpoint-healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/diagnostics/endpoint-healthchecks/${i.id??`<id>`}`,pathParams:{id:String(i.id??``)},bodyKind:`json`,body:{checkType:i.checkType,endpoint:i.endpoint,name:i.name,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating endpoint healthcheck`,async()=>m.put(`/accounts/${h}/diagnostics/endpoint-healthchecks/${i.id}`,{body:e})),{successLabel:`Updated endpoint healthcheck`});return}i.checkType===void 0&&(i.checkType=await n(`check-type`,`type of check to perform`,[`icmp`])),i.endpoint===void 0&&(i.endpoint=await t(`endpoint`,`the IP address of the host to perform checks against`));let g={};i.checkType!==void 0&&c(g,[`check_type`],o(i.checkType,`checkType`,`text`)),i.endpoint!==void 0&&c(g,[`endpoint`],o(i.endpoint,`endpoint`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),u(await p(`Updating endpoint healthcheck`,async()=>m.put(`/accounts/${h}/diagnostics/endpoint-healthchecks/${i.id}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated endpoint healthcheck`})}},y={command:`endpoint-healthchecks`,describe:`Monitor external endpoint availability with periodic HTTP/HTTPS health checks`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).demandCommand(1),handler:()=>{}},b={command:`create`,describe:`Run traceroutes from Cloudflare colos.`,builder:e=>e.option(`colos`,{type:`string`,array:!0,description:`If no source colo names specified, all colos will be used. China colos are unavailable for traceroutes.`}).option(`options-max-ttl`,{type:`number`,description:`Max TTL.`,default:15}).option(`options-packet-type`,{type:`string`,description:`Type of packet sent.`,choices:[`icmp`,`tcp`,`udp`,`gre`,`gre+icmp`],default:`icmp`}).option(`options-packets-per-ttl`,{type:`number`,description:`Number of packets sent at each TTL.`,default:3}).option(`options-port`,{type:`number`,description:`For UDP and TCP, specifies the destination port. For ICMP, specifies the initial ICMP sequence value. Default value 0 will choose the best value to use for each protocol.`,default:0}).option(`options-wait-time`,{type:`number`,description:`Set the time (in seconds) to wait for a response to a probe.`,default:1}).option(`targets`,{type:`string`,array:!0,description:`The targets 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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf diagnostics traceroutes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/diagnostics/traceroute`,pathParams:{},bodyKind:`json`,body:{colos:t.colos,optionsMaxTtl:t.optionsMaxTtl,optionsPacketType:t.optionsPacketType,optionsPacketsPerTtl:t.optionsPacketsPerTtl,optionsPort:t.optionsPort,optionsWaitTime:t.optionsWaitTime,targets:t.targets,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating traceroute`,async()=>n.post(`/accounts/${i}/diagnostics/traceroute`,{body:e})),{successLabel:`Created traceroute`});return}if(t.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let m={};t.colos!==void 0&&c(m,[`colos`],t.colos),t.optionsMaxTtl!==void 0&&c(m,[`options`,`max_ttl`],t.optionsMaxTtl),t.optionsPacketType!==void 0&&c(m,[`options`,`packet_type`],o(t.optionsPacketType,`optionsPacketType`,`text`)),t.optionsPacketsPerTtl!==void 0&&c(m,[`options`,`packets_per_ttl`],t.optionsPacketsPerTtl),t.optionsPort!==void 0&&c(m,[`options`,`port`],t.optionsPort),t.optionsWaitTime!==void 0&&c(m,[`options`,`wait_time`],t.optionsWaitTime),t.targets!==void 0&&c(m,[`targets`],t.targets),u(await p(`Creating traceroute`,async()=>n.post(`/accounts/${i}/diagnostics/traceroute`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created traceroute`})}},x={command:`traceroutes`,describe:`Run traceroutes from Cloudflare data centers to diagnose network path issues`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}},S={command:`diagnostics`,describe:`Network diagnostic tools — traceroutes from Cloudflare's edge and endpoint health checks`,builder:e=>e.command(y).command(x).demandCommand(1),handler:()=>{}};export{S as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Create a new Workers for Platforms namespace.`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the dispatch 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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces`,pathParams:{},bodyKind:`json`,body:{name:t.name,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating dispatch namespace`,async()=>n.post(`/accounts/${i}/workers/dispatch/namespaces`,{body:e})),{successLabel:`Created dispatch namespace`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),u(await p(`Creating dispatch namespace`,async()=>n.post(`/accounts/${i}/workers/dispatch/namespaces`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created dispatch namespace`})}},h={command:`delete <dispatchNamespace>`,describe:`Delete a Workers for Platforms namespace.`,builder:e=>e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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}),handler:async t=>{if(s(t.dispatchNamespace,`dispatchNamespace`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`dispatch namespace`,String(t.dispatchNamespace??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}u(await p(`Deleting dispatch namespace`,async()=>n.dispatchNamespaces.delete(o,t.dispatchNamespace)),{successLabel:`Deleted dispatch namespace`})}},g={command:`edit <dispatchNamespace>`,describe:`Patch a Workers for Platforms namespace. Omitted fields are left unchanged.`,builder:e=>e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`trusted-workers`,{type:`boolean`,description:'Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".',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)`}),handler:async t=>{if(s(t.dispatchNamespace,`dispatchNamespace`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`json`,body:{name:t.name,trustedWorkers:t.trustedWorkers,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating dispatch namespace`,async()=>n.patch(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:e})),{successLabel:`Updated dispatch namespace`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.trustedWorkers!==void 0&&c(m,[`trusted_workers`],t.trustedWorkers),u(await p(`Updating dispatch namespace`,async()=>n.patch(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated dispatch namespace`})}},_={command:`get <dispatchNamespace>`,describe:`Get a Workers for Platforms namespace.`,builder:e=>e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}),handler:async e=>{s(e.dispatchNamespace,`dispatchNamespace`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading dispatch namespace`,async()=>t.dispatchNamespaces.get(n,e.dispatchNamespace)),{successLabel:`Loaded dispatch namespace`})}},v={command:`list`,describe:`Fetch a list of Workers for Platforms namespaces.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading dispatch namespaces`,async()=>t.dispatchNamespaces.list(n)),{successLabel:`Loaded dispatch namespaces`})}},y={command:`create <scriptName>`,describe:`Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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)`}),handler:async t=>{if(s(t.scriptName,`scriptName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts asset-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/assets-upload-session`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating asset upload`,async()=>n.post(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/assets-upload-session`,{body:e})),{successLabel:`Created asset upload`});return}u(await p(`Creating asset upload`,async()=>n.dispatchNamespaces.scripts.assetUpload.create(i,t.dispatchNamespace,t.scriptName)),{successLabel:`Created asset upload`})}},b={command:`asset-upload`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`get <scriptName>`,describe:`Fetch script bindings from a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}),handler:async e=>{s(e.scriptName,`scriptName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading binding`,async()=>t.dispatchNamespaces.scripts.bindings.get(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded binding`})}},S={command:`bindings`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(x).demandCommand(1),handler:()=>{}},C={command:`bulk-delete`,describe:`Delete multiple scripts from a Workers for Platforms namespace based on optional tag filters.`,builder:e=>e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`tags`,{type:`string`,description:`Filter scripts by tags before deletion. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}).option(`limit`,{type:`number`,description:`Limit the number of scripts to delete.`}).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}),handler:async t=>{let n={};if(t.tags!==void 0&&(n.tags=t.tags),t.limit!==void 0&&(n.limit=t.limit),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf dispatch-namespaces scripts bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`scripts`,``,{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}u(await p(`Deleting scripts`,async()=>o.dispatchNamespaces.scripts.bulkDelete(c,t.dispatchNamespace,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted scripts`})}},w={command:`get <scriptName>`,describe:`Fetch script content from a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}),handler:async e=>{s(e.scriptName,`scriptName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading content`,async()=>t.dispatchNamespaces.scripts.content.get(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded content`})}},T={command:`update <scriptName>`,describe:`Put script content for a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`cf-worker-body-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.`}).option(`cf-worker-main-module-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.`}).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(`files`,{type:`string`,description:"An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`."}).option(`metadata`,{type:`string`,description:`JSON-encoded metadata about the uploaded parts and Worker configuration.`}),handler:async t=>{s(t.scriptName,`scriptName`);let n={};if(t.cfWorkerBodyPart!==void 0&&(n[`CF-WORKER-BODY-PART`]=String(t.cfWorkerBodyPart)),t.cfWorkerMainModulePart!==void 0&&(n[`CF-WORKER-MAIN-MODULE-PART`]=String(t.cfWorkerMainModulePart)),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts content update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/content`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,files:t.files,metadata:t.metadata},validation:`passed`});return}let i=await a(t),c=t.local?f:await r(i);if(t.accountId=c,t.file!==void 0||t.body!==void 0||t.files!==void 0||t.metadata!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.files!==void 0){let n=typeof t.files==`string`?o(t.files,`files`,`text`):t.files;e.append(`files`,typeof n==`string`?n:JSON.stringify(n))}if(t.metadata!==void 0){let n=typeof t.metadata==`string`?o(t.metadata,`metadata`,`text`):t.metadata;e.append(`metadata`,typeof n==`string`?n:JSON.stringify(n))}u(await p(`Updating content`,async()=>i.put(`/accounts/${c}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/content`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated content`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating content`,async()=>i.put(`/accounts/${c}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/content`,{body:e,headers:{"Content-Type":`multipart/form-data`,...n}})),{successLabel:`Updated content`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},E={command:`content`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(w).command(T).demandCommand(1),handler:()=>{}},D={command:`delete <scriptName>`,describe:`Delete a worker from a Workers for Platforms namespace. This call has no response body on a successful delete.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`force`,{type:`boolean`,description:`If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.`,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)`}),handler:async t=>{s(t.scriptName,`scriptName`);let n={};if(t.force!==void 0&&(n.force=t.force),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf dispatch-namespaces scripts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{...n,body:t.body},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`script`,String(t.scriptName??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(t.body){let e=l(t.body),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Deleting script`,async()=>o.delete(`/accounts/${c}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}${r?`?`+r:``}`,{body:e})),{successLabel:`Deleted script`});return}u(await p(`Deleting script`,async()=>o.dispatchNamespaces.scripts.delete(c,t.dispatchNamespace,t.scriptName,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted script`})}},O={command:`get <scriptName>`,describe:`Fetch information about a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}),handler:async e=>{s(e.scriptName,`scriptName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading script`,async()=>t.dispatchNamespaces.scripts.get(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded script`})}},k={command:`list`,describe:`Fetch a list of scripts uploaded to a Workers for Platforms namespace.`,builder:e=>e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`tags`,{type:`string`,description:`Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}),handler:async e=>{let t={};e.tags!==void 0&&(t.tags=e.tags);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading scripts`,async()=>n.dispatchNamespaces.scripts.list(i,e.dispatchNamespace,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded scripts`})}},A={command:`delete <secretName>`,describe:`Remove a secret from a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`secretName`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`url-encoded`,{type:`string`,description:`Flag that indicates whether the secret name is URL encoded.`}).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}),handler:async t=>{s(t.secretName,`secretName`);let n={};if(t.urlEncoded!==void 0&&(n.url_encoded=t.urlEncoded),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf dispatch-namespaces scripts secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/secrets/${t.secretName??`<secretName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``),secretName:String(t.secretName??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`secret`,String(t.secretName??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}u(await p(`Deleting secret`,async()=>o.dispatchNamespaces.scripts.secrets.delete(c,t.dispatchNamespace,t.scriptName,t.secretName,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted secret`})}},j={command:`get <secretName>`,describe:`Get a given secret binding (value omitted) on a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`secretName`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`url-encoded`,{type:`string`,description:`Flag that indicates whether the secret name is URL encoded.`}),handler:async e=>{s(e.secretName,`secretName`);let t={};e.urlEncoded!==void 0&&(t.url_encoded=e.urlEncoded);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading secret`,async()=>n.dispatchNamespaces.scripts.secrets.get(i,e.dispatchNamespace,e.scriptName,e.secretName,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded secret`})}},M={command:`list`,describe:`List secrets bound to a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}),handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading secrets`,async()=>t.dispatchNamespaces.scripts.secrets.list(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded secrets`})}},N={command:`update <scriptName>`,describe:`Add a secret to a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`A JavaScript variable name for the binding.`}).option(`text`,{type:`string`,description:`The secret value to use.`}).option(`type`,{type:`string`,description:`The kind of resource that the binding provides.`,choices:[`secret_text`,`secret_key`],default:`secret_text`}).option(`format`,{type:`string`,description:`Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).`,choices:[`raw`,`pkcs8`,`spki`,`jwk`]}).option(`key-base64`,{type:`string`,description:'Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki".'}).option(`usages`,{type:`string`,array:!0,description:`Allowed operations with the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A secret value accessible through a binding.`}).conflicts(`text`,[`format`,`key-base64`,`usages`]).conflicts(`format`,[`text`]).implies(`format`,[`usages`]).conflicts(`key-base64`,[`text`]).conflicts(`usages`,[`text`]).implies(`usages`,[`format`]),handler:async i=>{if(s(i.scriptName,`scriptName`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dispatch-namespaces scripts secrets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/workers/dispatch/namespaces/${i.dispatchNamespace??`<dispatchNamespace>`}/scripts/${i.scriptName??`<scriptName>`}/secrets`,pathParams:{dispatchNamespace:String(i.dispatchNamespace??``),scriptName:String(i.scriptName??``)},bodyKind:`json`,body:{name:i.name,text:i.text,type:i.type,format:i.format,keyBase64:i.keyBase64,usages:i.usages,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating secret`,async()=>m.put(`/accounts/${h}/workers/dispatch/namespaces/${i.dispatchNamespace}/scripts/${i.scriptName}/secrets`,{body:e})),{successLabel:`Updated secret`});return}i.name===void 0&&(i.name=await t(`name`,`A JavaScript variable name for the binding.`)),i.type===void 0&&(i.type=await n(`type`,`The kind of resource that the binding provides.`,[`secret_text`,`secret_key`])),i.type===`secret_text`&&i.text===void 0&&(i.text=await t(`text`,`The secret value to use.`,{kind:`secret`,question:`Enter value for --text`})),i.type===`secret_key`&&i.format===void 0&&(i.format=await t(`format`,`Data format of the key. [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format).`,{question:`Enter value for --format`}));let g={};i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.text!==void 0&&c(g,[`text`],o(i.text,`text`,`text`)),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),i.format!==void 0&&c(g,[`format`],o(i.format,`format`,`text`)),i.keyBase64!==void 0&&c(g,[`key_base64`],o(i.keyBase64,`keyBase64`,`text`)),i.usages!==void 0&&c(g,[`usages`],i.usages),u(await p(`Updating secret`,async()=>m.put(`/accounts/${h}/workers/dispatch/namespaces/${i.dispatchNamespace}/scripts/${i.scriptName}/secrets`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated secret`})}},P={command:`secrets`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(A).command(j).command(M).command(N).demandCommand(1),handler:()=>{}},F={command:`edit <scriptName>`,describe:`Patch script metadata, such as bindings.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,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(`settings`,{type:`string`,description:`Script and version settings for Workers for Platforms namespace scripts. Same as script-and-version-settings-item but without annotations, which are not supported for namespace scripts. `}),handler:async t=>{if(s(t.scriptName,`scriptName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts settings edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/settings`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`multipart`,body:{body:t.body,file:t.file,settings:t.settings},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.file!==void 0||t.body!==void 0||t.settings!==void 0){let e=new FormData;if(t.file){let{readFileSync:n}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=n(r(t.file));e.append(`file`,new Blob([i]),t.file.split(`/`).pop())}else t.body!==void 0&&e.append(`file`,t.body);if(t.settings!==void 0){let n=typeof t.settings==`string`?o(t.settings,`settings`,`text`):t.settings;e.append(`settings`,typeof n==`string`?n:JSON.stringify(n))}u(await p(`Updating setting`,async()=>n.patch(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/settings`,{body:e})),{successLabel:`Updated setting`});return}if(t.body){let e=o(t.body,`body`,`binary`);u(await p(`Updating setting`,async()=>n.patch(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/settings`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated setting`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},I={command:`get <scriptName>`,describe:`Get script settings from a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}),handler:async e=>{s(e.scriptName,`scriptName`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading setting`,async()=>t.dispatchNamespaces.scripts.settings.get(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded setting`})}},L={command:`settings`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(F).command(I).demandCommand(1),handler:()=>{}},R={command:`create <tag>`,describe:`Put a single tag on a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`tag`,{type:`string`,description:`Tag`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.tag,`tag`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts tags create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags/${t.tag??`<tag>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``),tag:String(t.tag??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Updating tag`,async()=>n.dispatchNamespaces.scripts.tags.create(i,t.dispatchNamespace,t.scriptName,t.tag)),{successLabel:`Updated tag`})}},z={command:`delete <tag>`,describe:`Delete script tag for a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`tag`,{type:`string`,description:`Tag`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route 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}),handler:async t=>{if(s(t.tag,`tag`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags/${t.tag??`<tag>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``),tag:String(t.tag??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`tag`,String(t.tag??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}u(await p(`Deleting tag`,async()=>n.dispatchNamespaces.scripts.tags.delete(o,t.dispatchNamespace,t.scriptName,t.tag)),{successLabel:`Deleted tag`})}},B={command:`list`,describe:`Fetch tags from a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}),handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading tags`,async()=>t.dispatchNamespaces.scripts.tags.list(n,e.dispatchNamespace,e.scriptName)),{successLabel:`Loaded tags`})}},V={command:`update <scriptName>`,describe:`Put script tags for a script uploaded to a Workers for Platforms namespace.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Tags associated with the Worker.`}),handler:async t=>{if(s(t.scriptName,`scriptName`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces scripts tags update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}/tags`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);if(Array.isArray(e)&&e.length>10){let r=Math.ceil(e.length/10),a=null;for(let o=0;o<e.length;o+=10){let s=e.slice(o,o+10);a=await p(`Updating tag: batch ${Math.floor(o/10)+1}/${r}`,async()=>n.put(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/tags`,{body:s}))}u(a,{successLabel:`Updated tag`});return}u(await p(`Updating tag`,async()=>n.put(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}/tags`,{body:e})),{successLabel:`Updated tag`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},H={command:`tags`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(R).command(z).command(B).command(V).demandCommand(1),handler:()=>{}},U={command:`update <scriptName>`,describe:`Upload a worker module to a Workers for Platforms namespace. You can find more about the multipart metadata on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/.`,builder:e=>e.positional(`scriptName`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`bindings-inherit`,{type:`string`,description:'When set to "strict", the upload will fail if any `inherit` type bindings cannot be resolved against the previous version of the script. Without this, unresolvable inherit bindings are silently dropped.',choices:[`strict`]}).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)`}),handler:async t=>{s(t.scriptName,`scriptName`);let n={};if(t.bindingsInherit!==void 0&&(n.bindings_inherit=t.bindingsInherit),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf dispatch-namespaces scripts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}/scripts/${t.scriptName??`<scriptName>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``),scriptName:String(t.scriptName??``)},bodyKind:`json`,body:{...n,body:t.body},validation:`passed`});return}let i=await a(t),c=t.local?f:await r(i);if(t.accountId=c,t.body){let e=o(t.body,`body`,`binary`),r=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Updating script`,async()=>i.put(`/accounts/${c}/workers/dispatch/namespaces/${t.dispatchNamespace}/scripts/${t.scriptName}${r?`?`+r:``}`,{body:e,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated script`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},W={command:`scripts`,describe:`Customer Workers deployed inside a dispatch namespace — manage scripts, content, settings, bindings, secrets, and tags`,builder:e=>e.command(C).command(D).command(O).command(k).command(U).command(b).command(S).command(E).command(P).command(L).command(H).demandCommand(1),handler:()=>{}},G={command:`update <dispatchNamespace>`,describe:`Update a Workers for Platforms namespace.`,builder:e=>e.positional(`dispatchNamespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`trusted-workers`,{type:`boolean`,description:'Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".',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)`}),handler:async t=>{if(s(t.dispatchNamespace,`dispatchNamespace`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dispatch-namespaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/workers/dispatch/namespaces/${t.dispatchNamespace??`<dispatchNamespace>`}`,pathParams:{dispatchNamespace:String(t.dispatchNamespace??``)},bodyKind:`json`,body:{name:t.name,trustedWorkers:t.trustedWorkers,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating dispatch namespace`,async()=>n.put(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:e})),{successLabel:`Updated dispatch namespace`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.trustedWorkers!==void 0&&c(m,[`trusted_workers`],t.trustedWorkers),u(await p(`Updating dispatch namespace`,async()=>n.put(`/accounts/${i}/workers/dispatch/namespaces/${t.dispatchNamespace}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated dispatch namespace`})}},K={command:`dispatch-namespaces`,describe:`Workers for Platforms dispatch namespaces — isolate customer Workers for SaaS and multi-tenant deployments`,builder:e=>e.command(m).command(h).command(g).command(_).command(v).command(G).command(W).demandCommand(1),handler:()=>{}};export{K as default};
|
package/dist/dns-CrvIxztB.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,o as n,p as r,t as i,u as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";import{n as m,t as h}from"./raw-fetch-CxFs4i0R.mjs";const ee={command:`get`,describe:`Retrieves a list of aggregate metrics grouped by time interval. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters.`,builder:e=>e.option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to query.`}).option(`dimensions`,{type:`string`,description:`A comma-separated list of dimensions to group results by.`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in ISO 8601 format.`}).option(`until`,{type:`string`,description:`End date and time of requesting data period in ISO 8601 format.`}).option(`limit`,{type:`string`,description:`Limit number of returned metrics.`}).option(`sort`,{type:`string`,description:`A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).`}).option(`filters`,{type:`string`,description:`Segmentation filter in 'attribute operator value' format.`}).option(`time-delta`,{type:`string`,description:`Unit of time to group data by.`,choices:[`all`,`auto`,`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`]}),handler:async e=>{let t={};e.metrics!==void 0&&(t.metrics=e.metrics),e.dimensions!==void 0&&(t.dimensions=e.dimensions),e.since!==void 0&&(t.since=e.since),e.until!==void 0&&(t.until=e.until),e.limit!==void 0&&(t.limit=e.limit),e.sort!==void 0&&(t.sort=e.sort),e.filters!==void 0&&(t.filters=e.filters),e.timeDelta!==void 0&&(t.time_delta=e.timeDelta);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading bytime`,async()=>n.dns.analytics.reports.bytimes.get(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded bytime`})}},te={command:`bytimes`,describe:`DNS analytics and reporting`,builder:e=>e.command(ee).demandCommand(1),handler:()=>{}},g={command:`get`,describe:`Retrieves a list of summarised aggregate metrics over a given time period. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters.`,builder:e=>e.option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to query.`}).option(`dimensions`,{type:`string`,description:`A comma-separated list of dimensions to group results by.`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in ISO 8601 format.`}).option(`until`,{type:`string`,description:`End date and time of requesting data period in ISO 8601 format.`}).option(`limit`,{type:`string`,description:`Limit number of returned metrics.`}).option(`sort`,{type:`string`,description:`A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).`}).option(`filters`,{type:`string`,description:`Segmentation filter in 'attribute operator value' format.`}),handler:async e=>{let t={};e.metrics!==void 0&&(t.metrics=e.metrics),e.dimensions!==void 0&&(t.dimensions=e.dimensions),e.since!==void 0&&(t.since=e.since),e.until!==void 0&&(t.until=e.until),e.limit!==void 0&&(t.limit=e.limit),e.sort!==void 0&&(t.sort=e.sort),e.filters!==void 0&&(t.filters=e.filters);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading report`,async()=>n.dns.analytics.reports.get(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded report`})}},_={command:`reports`,describe:`DNS analytics and reporting`,builder:e=>e.command(g).command(te).demandCommand(1),handler:()=>{}},v={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},y={command:`delete`,describe:`Delete DNSSEC.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns dnssec delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dnssec`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`dnssec`,String(n??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(e.body){let n=l(e.body);u(await p(`Deleting dnssec`,async()=>t.delete(`/zones/${e.zoneId}/dnssec`,{body:n})),{successLabel:`Deleted dnssec`});return}u(await p(`Deleting dnssec`,async()=>t.dns.dnssec.delete(n)),{successLabel:`Deleted dnssec`})}},b={command:`edit`,describe:`Enable or disable DNSSEC.`,builder:e=>e.option(`dnssec-multi-signer`,{type:`boolean`,description:`If true, multi-signer DNSSEC is enabled on the zone, allowing multiple providers to serve a DNSSEC-signed zone at the same time. This is required for DNSKEY records (except those automatically generated by Cloudflare) to be added to the zone. See [Multi-signer DNSSEC](https://developers.cloudflare.com/dns/dnssec/multi-signer-dnssec/) for details.`}).option(`dnssec-presigned`,{type:`boolean`,description:`If true, allows Cloudflare to transfer in a DNSSEC-signed zone including signatures from an external provider, without requiring Cloudflare to sign any records on the fly. Note that this feature has some limitations. See [Cloudflare as Secondary](https://developers.cloudflare.com/dns/zone-setups/zone-transfers/cloudflare-as-secondary/setup/#dnssec) for details.`}).option(`dnssec-use-nsec3`,{type:`boolean`,description:`If true, enables the use of NSEC3 together with DNSSEC on the zone. Combined with setting dnssec_presigned to true, this enables the use of NSEC3 records when transferring in from an external provider. If dnssec_presigned is instead set to false (default), NSEC3 records will be generated and signed at request time. See [DNSSEC with NSEC3](https://developers.cloudflare.com/dns/dnssec/enable-nsec3/) for details.`}).option(`status`,{type:`string`,description:`Status of DNSSEC, based on user-desired state and presence of necessary records.`,choices:[`active`,`disabled`]}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns dnssec edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dnssec`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{dnssecMultiSigner:e.dnssecMultiSigner,dnssecPresigned:e.dnssecPresigned,dnssecUseNsec3:e.dnssecUseNsec3,status:e.status,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating dnssec`,async()=>t.patch(`/zones/${e.zoneId}/dnssec`,{body:n})),{successLabel:`Updated dnssec`});return}let n={};e.dnssecMultiSigner!==void 0&&c(n,[`dnssec_multi_signer`],e.dnssecMultiSigner),e.dnssecPresigned!==void 0&&c(n,[`dnssec_presigned`],e.dnssecPresigned),e.dnssecUseNsec3!==void 0&&c(n,[`dnssec_use_nsec3`],e.dnssecUseNsec3),e.status!==void 0&&c(n,[`status`],o(e.status,`status`,`text`)),u(await p(`Updating dnssec`,async()=>t.patch(`/zones/${e.zoneId}/dnssec`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated dnssec`})}},x={command:`get`,describe:`Details about DNSSEC status and configuration.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading dnssec`,async()=>t.dns.dnssec.get(n)),{successLabel:`Loaded dnssec`})}},S={command:`zsks`,describe:`List the Zone Signing Keys (ZSKs) that DNSSEC uses for the zone.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading list`,async()=>t.dns.dnssec.list.zsks(n)),{successLabel:`Loaded list`})}},C={command:`list`,describe:`Manage DNSSEC settings for a zone`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`dnssec`,describe:`Manage DNSSEC settings for a zone`,builder:e=>e.command(y).command(b).command(x).command(C).demandCommand(1),handler:()=>{}},T={command:`batch`,describe:`Send a Batch of DNS Record API calls to be executed together. Notes: - Although Cloudflare will execute the batched operations in a single database transaction, Cloudflare's distributed KV store must treat each record change as a single key-value pair. This means that the propagation of changes is not atomic. See [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/batch-record-changes/ "Batch DNS records") for more information. - The operations you specify within the /batch request body are always executed in the following order: - Deletes - Patches - Puts - Posts`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns records batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/batch`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/batch`,{body:n})),{successLabel:`Created record`});return}u(await p(`Creating record`,async()=>t.dns.records.batch(n)),{successLabel:`Created record`})}},E={command:`create`,describe:`Create a new DNS record for a zone. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns records create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records`,{body:n})),{successLabel:`Created record`});return}u(await p(`Creating record`,async()=>t.dns.records.create(n)),{successLabel:`Created record`})}},D={command:`delete <dnsRecordId>`,describe:`Permanently removes a DNS record from the zone.`,builder:e=>e.positional(`dnsRecordId`,{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)`}),handler:async e=>{if(s(e.dnsRecordId,`dnsRecordId`),e.dryRun){d({command:`cf dns records delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/${e.dnsRecordId??`<dnsRecordId>`}`,pathParams:{dnsRecordId:String(e.dnsRecordId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`record`,String(e.dnsRecordId??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(e.body){let n=l(e.body);u(await p(`Deleting record`,async()=>t.delete(`/zones/${e.zoneId}/dns_records/${e.dnsRecordId}`,{body:n})),{successLabel:`Deleted record`});return}u(await p(`Deleting record`,async()=>t.dns.records.delete(e.dnsRecordId,n)),{successLabel:`Deleted record`})}},O={command:`edit <dnsRecordId>`,describe:`Update an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.`,builder:e=>e.positional(`dnsRecordId`,{type:`string`,description:`Identifier.`,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)`}),handler:async e=>{if(s(e.dnsRecordId,`dnsRecordId`),e.dryRun){d({command:`cf dns records edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/${e.dnsRecordId??`<dnsRecordId>`}`,pathParams:{dnsRecordId:String(e.dnsRecordId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Updating record`,async()=>t.patch(`/zones/${e.zoneId}/dns_records/${e.dnsRecordId}`,{body:n})),{successLabel:`Updated record`});return}u(await p(`Updating record`,async()=>t.dns.records.edit(e.dnsRecordId,n)),{successLabel:`Updated record`})}},k={command:`export`,describe:`You can export your [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this endpoint. See [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records") for more information.`,builder:e=>e,handler:async e=>{let t=await i(e);e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),m((await p(`Loading record`,async()=>h(`/zones/${e.zoneId}/dns_records/export`,`GET`,e.local?e.localEndpoint:void 0))).toString(`utf-8`))}},A={command:`get <dnsRecordId>`,describe:`Retrieves details for a specific DNS record in the zone.`,builder:e=>e.positional(`dnsRecordId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{s(e.dnsRecordId,`dnsRecordId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading record`,async()=>t.dns.records.get(e.dnsRecordId,n)),{successLabel:`Loaded record`})}},j={command:`import`,describe:`You can upload your [BIND config](https://en.wikipedia.org/wiki/Zone_file "Zone file") through this endpoint. It assumes that cURL is called from a location with bind_config.txt (valid BIND config) present. See [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/import-and-export/ "Import and export records") for more information.`,builder:e=>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(`proxied`,{type:`string`,description:"Whether or not proxiable records should receive the performance and security benefits of Cloudflare. The value should be either `true` or `false`."}),handler:async e=>{if(e.dryRun){d({command:`cf dns records import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/import`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,proxied:e.proxied},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.file!==void 0||e.body!==void 0||e.proxied!==void 0){let n=new FormData;if(e.file){let{readFileSync:t}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=t(r(e.file));n.append(`file`,new Blob([i]),e.file.split(`/`).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.proxied!==void 0&&n.append(`proxied`,String(o(e.proxied,`proxied`,`text`)??``)),u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/import`,{body:n})),{successLabel:`Created record`});return}if(e.body){let n=o(e.body,`body`,`binary`);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/import`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created record`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},M={command:`list`,describe:`List, search, sort, and filter a zones' DNS records.`,builder:e=>e.option(`name`,{type:`string`,description:"Exact value of the DNS record name. This is a convenience alias for `name.exact`."}).option(`name-exact`,{type:`string`,description:`Exact value of the DNS record name. Name filters are case-insensitive.`}).option(`name-contains`,{type:`string`,description:`Substring of the DNS record name. Name filters are case-insensitive.`}).option(`name-startswith`,{type:`string`,description:`Prefix of the DNS record name. Name filters are case-insensitive.`}).option(`name-endswith`,{type:`string`,description:`Suffix of the DNS record name. Name filters are case-insensitive.`}).option(`type`,{type:`string`,description:`Record type.`,choices:[`A`,`AAAA`,`CAA`,`CERT`,`CNAME`,`DNSKEY`,`DS`,`HTTPS`,`LOC`,`MX`,`NAPTR`,`NS`,`OPENPGPKEY`,`PTR`,`SMIMEA`,`SRV`,`SSHFP`,`SVCB`,`TLSA`,`TXT`,`URI`]}).option(`content`,{type:`string`,description:"Exact value of the DNS record content. This is a convenience alias for `content.exact`."}).option(`content-exact`,{type:`string`,description:`Exact value of the DNS record content. Content filters are case-insensitive.`}).option(`content-contains`,{type:`string`,description:`Substring of the DNS record content. Content filters are case-insensitive.`}).option(`content-startswith`,{type:`string`,description:`Prefix of the DNS record content. Content filters are case-insensitive.`}).option(`content-endswith`,{type:`string`,description:`Suffix of the DNS record content. Content filters are case-insensitive.`}).option(`proxied`,{type:`string`,description:`Whether the record is receiving the performance and security benefits of Cloudflare.`}).option(`match`,{type:`string`,description:"Whether to match all search requirements or at least one (any). If set to `all`, acts like a logical AND between filters. If set to `any`, acts like a logical OR instead. Note that the interaction between tag filters is controlled by the `tag-match` parameter instead.",choices:[`any`,`all`]}).option(`comment`,{type:`string`,description:"Exact value of the DNS record comment. This is a convenience alias for `comment.exact`."}).option(`comment-present`,{type:`string`,description:`If this parameter is present, only records *with* a comment are returned.`}).option(`comment-absent`,{type:`string`,description:`If this parameter is present, only records *without* a comment are returned.`}).option(`comment-exact`,{type:`string`,description:`Exact value of the DNS record comment. Comment filters are case-insensitive.`}).option(`comment-contains`,{type:`string`,description:`Substring of the DNS record comment. Comment filters are case-insensitive.`}).option(`comment-startswith`,{type:`string`,description:`Prefix of the DNS record comment. Comment filters are case-insensitive.`}).option(`comment-endswith`,{type:`string`,description:`Suffix of the DNS record comment. Comment filters are case-insensitive.`}).option(`tag`,{type:`string`,description:"Condition on the DNS record tag. Parameter values can be of the form `<tag-name>:<tag-value>` to search for an exact `name:value` pair, or just `<tag-name>` to search for records with a specific tag name regardless of its value. This is a convenience shorthand for the more powerful `tag.<predicate>` parameters. Examples: - `tag=important` is equivalent to `tag.present=important` - `tag=team:DNS` is equivalent to `tag.exact=team:DNS`"}).option(`tag-present`,{type:`string`,description:`Name of a tag which must be present on the DNS record. Tag filters are case-insensitive.`}).option(`tag-absent`,{type:`string`,description:`Name of a tag which must *not* be present on the DNS record. Tag filters are case-insensitive.`}).option(`tag-exact`,{type:`string`,description:"A tag and value, of the form `<tag-name>:<tag-value>`. The API will only return DNS records that have a tag named `<tag-name>` whose value is `<tag-value>`. Tag filters are case-insensitive."}).option(`tag-contains`,{type:`string`,description:"A tag and value, of the form `<tag-name>:<tag-value>`. The API will only return DNS records that have a tag named `<tag-name>` whose value contains `<tag-value>`. Tag filters are case-insensitive."}).option(`tag-startswith`,{type:`string`,description:"A tag and value, of the form `<tag-name>:<tag-value>`. The API will only return DNS records that have a tag named `<tag-name>` whose value starts with `<tag-value>`. Tag filters are case-insensitive."}).option(`tag-endswith`,{type:`string`,description:"A tag and value, of the form `<tag-name>:<tag-value>`. The API will only return DNS records that have a tag named `<tag-name>` whose value ends with `<tag-value>`. Tag filters are case-insensitive."}).option(`search`,{type:`string`,description:"Allows searching in multiple properties of a DNS record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. This parameter works independently of the `match` setting. For automated searches, please use the other available parameters."}).option(`tag-match`,{type:`string`,description:"Whether to match all tag search requirements or at least one (any). If set to `all`, acts like a logical AND between tag filters. If set to `any`, acts like a logical OR instead. Note that the regular `match` parameter is still used to combine the resulting condition with other filters that aren't related to tags.",choices:[`any`,`all`]}).option(`page`,{type:`string`,description:`Page number of paginated results.`}).option(`per-page`,{type:`string`,description:`Number of DNS records per page.`}).option(`order`,{type:`string`,description:`Field to order DNS records by.`,choices:[`type`,`name`,`content`,`ttl`,`proxied`]}).option(`direction`,{type:`string`,description:`Direction to order DNS records in.`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.name!==void 0&&(t.name=e.name),e.nameExact!==void 0&&(t.nameExact=e.nameExact),e.nameContains!==void 0&&(t.nameContains=e.nameContains),e.nameStartswith!==void 0&&(t.nameStartswith=e.nameStartswith),e.nameEndswith!==void 0&&(t.nameEndswith=e.nameEndswith),e.type!==void 0&&(t.type=e.type),e.content!==void 0&&(t.content=e.content),e.contentExact!==void 0&&(t.contentExact=e.contentExact),e.contentContains!==void 0&&(t.contentContains=e.contentContains),e.contentStartswith!==void 0&&(t.contentStartswith=e.contentStartswith),e.contentEndswith!==void 0&&(t.contentEndswith=e.contentEndswith),e.proxied!==void 0&&(t.proxied=e.proxied),e.match!==void 0&&(t.match=e.match),e.comment!==void 0&&(t.comment=e.comment),e.commentPresent!==void 0&&(t.commentPresent=e.commentPresent),e.commentAbsent!==void 0&&(t.commentAbsent=e.commentAbsent),e.commentExact!==void 0&&(t.commentExact=e.commentExact),e.commentContains!==void 0&&(t.commentContains=e.commentContains),e.commentStartswith!==void 0&&(t.commentStartswith=e.commentStartswith),e.commentEndswith!==void 0&&(t.commentEndswith=e.commentEndswith),e.tag!==void 0&&(t.tag=e.tag),e.tagPresent!==void 0&&(t.tagPresent=e.tagPresent),e.tagAbsent!==void 0&&(t.tagAbsent=e.tagAbsent),e.tagExact!==void 0&&(t.tagExact=e.tagExact),e.tagContains!==void 0&&(t.tagContains=e.tagContains),e.tagStartswith!==void 0&&(t.tagStartswith=e.tagStartswith),e.tagEndswith!==void 0&&(t.tagEndswith=e.tagEndswith),e.search!==void 0&&(t.search=e.search),e.tagMatch!==void 0&&(t.tag_match=e.tagMatch),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading records`,async()=>n.dns.records.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded records`})}},N={command:`scan-list`,describe:"Retrieves the list of DNS records discovered up to this point by the asynchronous scan. These records are temporary until explicitly accepted or rejected via `POST /scan/review`. Additional records may be discovered by the scan later.",builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading record`,async()=>t.dns.records.scanList(n)),{successLabel:`Loaded record`})}},P={command:`scan-review`,describe:`Accept or reject DNS records found by the DNS records scan. Accepted records will be permanently added to the zone, while rejected records will be permanently deleted.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns records scan-review`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/scan/review`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/scan/review`,{body:n})),{successLabel:`Created record`});return}u(await p(`Creating record`,async()=>t.dns.records.scanReview(n)),{successLabel:`Created record`})}},F={command:`scan-trigger`,describe:"Initiates an asynchronous scan for common DNS records on your domain. Note that this **does not** automatically add records to your zone. The scan runs in the background, and results can be reviewed later using the `/scan/review` endpoints. Useful if you haven't updated your nameservers yet.",builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns records scan-trigger`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/scan/trigger`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/scan/trigger`,{body:n})),{successLabel:`Created record`});return}u(await p(`Creating record`,async()=>t.dns.records.scanTrigger(n)),{successLabel:`Created record`})}},I={command:`scan`,describe:`Scan for common DNS records on your domain and automatically add them to your zone. Useful if you haven't updated your nameservers yet.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns records scan`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/scan`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating record`,async()=>t.post(`/zones/${e.zoneId}/dns_records/scan`,{body:n})),{successLabel:`Created record`});return}u(await p(`Creating record`,async()=>t.dns.records.scan(n)),{successLabel:`Created record`})}},L={command:`update <dnsRecordId>`,describe:`Overwrite an existing DNS record. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.`,builder:e=>e.positional(`dnsRecordId`,{type:`string`,description:`Identifier.`,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)`}),handler:async e=>{if(s(e.dnsRecordId,`dnsRecordId`),e.dryRun){d({command:`cf dns records update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_records/${e.dnsRecordId??`<dnsRecordId>`}`,pathParams:{dnsRecordId:String(e.dnsRecordId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Updating record`,async()=>t.put(`/zones/${e.zoneId}/dns_records/${e.dnsRecordId}`,{body:n})),{successLabel:`Updated record`});return}u(await p(`Updating record`,async()=>t.dns.records.update(e.dnsRecordId,n)),{successLabel:`Updated record`})}},R={command:`records`,describe:`Manage DNS records for a zone`,builder:e=>e.command(T).command(E).command(D).command(O).command(k).command(A).command(j).command(M).command(I).command(N).command(P).command(F).command(L).demandCommand(1),handler:()=>{}},z={command:`edit`,describe:`Update DNS settings for an account`,builder:e=>e.option(`enforce-dns-only`,{type:`boolean`,description:`When enabled, forces all proxied DNS records in the account to behave as DNS-only at the edge, regardless of each record's individual proxy setting. Note that this account-level override does not modify the records themselves; it only affects how they are served at the edge. See more on [Enforce DNS-only](https://developers.cloudflare.com/dns/proxy-status/enforce-dns-only).`}).option(`zone-defaults-flatten-all-cnames`,{type:`boolean`,description:`Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened.`}).option(`zone-defaults-foundation-dns`,{type:`boolean`,description:`Whether to enable Foundation DNS Advanced Nameservers on the zone.`}).option(`zone-defaults-internal-dns-reference-zone-id`,{type:`string`,description:`The ID of the zone to fallback to.`}).option(`zone-defaults-multi-provider`,{type:`boolean`,description:`Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers.`}).option(`zone-defaults-ns-ttl`,{type:`number`,description:`The time to live (TTL) of the zone's nameserver (NS) records.`}).option(`zone-defaults-secondary-overrides`,{type:`boolean`,description:`Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex.`}).option(`zone-defaults-soa-expire`,{type:`number`,description:`Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone.`}).option(`zone-defaults-soa-min-ttl`,{type:`number`,description:`The time to live (TTL) for negative caching of records within the zone.`}).option(`zone-defaults-soa-mname`,{type:`string`,description:`The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used.`}).option(`zone-defaults-soa-refresh`,{type:`number`,description:`Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated.`}).option(`zone-defaults-soa-retry`,{type:`number`,description:`Time in seconds after which secondary servers should retry queries after the primary server was unresponsive.`}).option(`zone-defaults-soa-rname`,{type:`string`,description:`The email address of the zone administrator, with the first label representing the local part of the email address.`}).option(`zone-defaults-soa-ttl`,{type:`number`,description:`The time to live (TTL) of the SOA record itself.`}).option(`zone-defaults-zone-mode`,{type:`string`,description:`Whether the zone mode is a regular or CDN/DNS only zone.`,choices:[`standard`,`cdn_only`,`dns_only`]}).option(`zone-defaults-nameservers-type`,{type:`string`,description:`Nameserver type`,choices:[`cloudflare.standard`,`cloudflare.standard.random`,`custom.account`,`custom.tenant`]}).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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns settings account edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/dns_settings`,pathParams:{},bodyKind:`json`,body:{enforceDnsOnly:t.enforceDnsOnly,zoneDefaultsFlattenAllCnames:t.zoneDefaultsFlattenAllCnames,zoneDefaultsFoundationDns:t.zoneDefaultsFoundationDns,zoneDefaultsInternalDnsReferenceZoneId:t.zoneDefaultsInternalDnsReferenceZoneId,zoneDefaultsMultiProvider:t.zoneDefaultsMultiProvider,zoneDefaultsNsTtl:t.zoneDefaultsNsTtl,zoneDefaultsSecondaryOverrides:t.zoneDefaultsSecondaryOverrides,zoneDefaultsSoaExpire:t.zoneDefaultsSoaExpire,zoneDefaultsSoaMinTtl:t.zoneDefaultsSoaMinTtl,zoneDefaultsSoaMname:t.zoneDefaultsSoaMname,zoneDefaultsSoaRefresh:t.zoneDefaultsSoaRefresh,zoneDefaultsSoaRetry:t.zoneDefaultsSoaRetry,zoneDefaultsSoaRname:t.zoneDefaultsSoaRname,zoneDefaultsSoaTtl:t.zoneDefaultsSoaTtl,zoneDefaultsZoneMode:t.zoneDefaultsZoneMode,zoneDefaultsNameserversType:t.zoneDefaultsNameserversType,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?f:await n(r);if(t.accountId=a,t.body){let e=l(t.body);u(await p(`Updating account`,async()=>r.patch(`/accounts/${a}/dns_settings`,{body:e})),{successLabel:`Updated account`});return}let m={};t.enforceDnsOnly!==void 0&&c(m,[`enforce_dns_only`],t.enforceDnsOnly),t.zoneDefaultsFlattenAllCnames!==void 0&&c(m,[`zone_defaults`,`flatten_all_cnames`],t.zoneDefaultsFlattenAllCnames),t.zoneDefaultsFoundationDns!==void 0&&c(m,[`zone_defaults`,`foundation_dns`],t.zoneDefaultsFoundationDns),t.zoneDefaultsInternalDnsReferenceZoneId!==void 0&&c(m,[`zone_defaults`,`internal_dns`,`reference_zone_id`],o(t.zoneDefaultsInternalDnsReferenceZoneId,`zoneDefaultsInternalDnsReferenceZoneId`,`text`)),t.zoneDefaultsMultiProvider!==void 0&&c(m,[`zone_defaults`,`multi_provider`],t.zoneDefaultsMultiProvider),t.zoneDefaultsNsTtl!==void 0&&c(m,[`zone_defaults`,`ns_ttl`],t.zoneDefaultsNsTtl),t.zoneDefaultsSecondaryOverrides!==void 0&&c(m,[`zone_defaults`,`secondary_overrides`],t.zoneDefaultsSecondaryOverrides),t.zoneDefaultsSoaExpire!==void 0&&c(m,[`zone_defaults`,`soa`,`expire`],t.zoneDefaultsSoaExpire),t.zoneDefaultsSoaMinTtl!==void 0&&c(m,[`zone_defaults`,`soa`,`min_ttl`],t.zoneDefaultsSoaMinTtl),t.zoneDefaultsSoaMname!==void 0&&c(m,[`zone_defaults`,`soa`,`mname`],o(t.zoneDefaultsSoaMname,`zoneDefaultsSoaMname`,`text`)),t.zoneDefaultsSoaRefresh!==void 0&&c(m,[`zone_defaults`,`soa`,`refresh`],t.zoneDefaultsSoaRefresh),t.zoneDefaultsSoaRetry!==void 0&&c(m,[`zone_defaults`,`soa`,`retry`],t.zoneDefaultsSoaRetry),t.zoneDefaultsSoaRname!==void 0&&c(m,[`zone_defaults`,`soa`,`rname`],o(t.zoneDefaultsSoaRname,`zoneDefaultsSoaRname`,`text`)),t.zoneDefaultsSoaTtl!==void 0&&c(m,[`zone_defaults`,`soa`,`ttl`],t.zoneDefaultsSoaTtl),t.zoneDefaultsZoneMode!==void 0&&c(m,[`zone_defaults`,`zone_mode`],o(t.zoneDefaultsZoneMode,`zoneDefaultsZoneMode`,`text`)),t.zoneDefaultsNameserversType!==void 0&&c(m,[`zone_defaults`,`nameservers`,`type`],o(t.zoneDefaultsNameserversType,`zoneDefaultsNameserversType`,`text`)),u(await p(`Updating account`,async()=>r.patch(`/accounts/${a}/dns_settings`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated account`})}},B={command:`get`,describe:`Show DNS settings for an account`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading account`,async()=>t.dns.settings.account.get(r)),{successLabel:`Loaded account`})}},V={command:`create`,describe:`Create Internal DNS View for an account`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the view.`}).option(`zones`,{type:`string`,array:!0,description:`The list of zones linked to this view.`}).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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns settings account views create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/dns_settings/views`,pathParams:{},bodyKind:`json`,body:{name:t.name,zones:t.zones,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?f:await n(r);if(t.accountId=a,t.body){let e=l(t.body);u(await p(`Creating view`,async()=>r.post(`/accounts/${a}/dns_settings/views`,{body:e})),{successLabel:`Created view`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.zones!==void 0&&c(m,[`zones`],t.zones),u(await p(`Creating view`,async()=>r.post(`/accounts/${a}/dns_settings/views`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created view`})}},H={command:`delete <viewId>`,describe:`Delete an existing Internal DNS View`,builder:e=>e.positional(`viewId`,{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)`}),handler:async t=>{if(s(t.viewId,`viewId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns settings account views delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/dns_settings/views/${t.viewId??`<viewId>`}`,pathParams:{viewId:String(t.viewId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`view`,String(t.viewId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting view`,async()=>a.delete(`/accounts/${o}/dns_settings/views/${t.viewId}`,{body:e})),{successLabel:`Deleted view`});return}u(await p(`Deleting view`,async()=>a.dns.settings.account.views.delete(o,t.viewId)),{successLabel:`Deleted view`})}},U={command:`edit <viewId>`,describe:`Update an existing Internal DNS View`,builder:e=>e.positional(`viewId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the view.`}).option(`zones`,{type:`string`,array:!0,description:`The list of zones linked to this view.`}).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)`}),handler:async t=>{if(s(t.viewId,`viewId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns settings account views edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/dns_settings/views/${t.viewId??`<viewId>`}`,pathParams:{viewId:String(t.viewId??``)},bodyKind:`json`,body:{name:t.name,zones:t.zones,body:t.body},validation:`passed`});return}let r=await i(t),a=t.local?f:await n(r);if(t.accountId=a,t.body){let e=l(t.body);u(await p(`Updating view`,async()=>r.patch(`/accounts/${a}/dns_settings/views/${t.viewId}`,{body:e})),{successLabel:`Updated view`});return}let m={};t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.zones!==void 0&&c(m,[`zones`],t.zones),u(await p(`Updating view`,async()=>r.patch(`/accounts/${a}/dns_settings/views/${t.viewId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated view`})}},W={command:`get <viewId>`,describe:`Get DNS Internal View`,builder:e=>e.positional(`viewId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{s(e.viewId,`viewId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading view`,async()=>t.dns.settings.account.views.get(r,e.viewId)),{successLabel:`Loaded view`})}},G={command:`list`,describe:`List DNS Internal Views for an Account`,builder:e=>e.option(`name`,{type:`string`,description:"Exact value of the DNS view name. This is a convenience alias for `name.exact`."}).option(`name-exact`,{type:`string`,description:`Exact value of the DNS view name.`}).option(`name-contains`,{type:`string`,description:`Substring of the DNS view name.`}).option(`name-startswith`,{type:`string`,description:`Prefix of the DNS view name.`}).option(`name-endswith`,{type:`string`,description:`Suffix of the DNS view name.`}).option(`zone-id`,{type:`string`,description:`A zone ID that exists in the zones list for the view.`}).option(`zone-name`,{type:`string`,description:`A zone name that exists in the zones list for the view.`}).option(`match`,{type:`string`,description:"Whether to match all search requirements or at least one (any). If set to `all`, acts like a logical AND between filters. If set to `any`, acts like a logical OR instead.",choices:[`any`,`all`]}).option(`page`,{type:`string`,description:`Page number of paginated results.`}).option(`per-page`,{type:`string`,description:`Number of DNS views per page.`}).option(`order`,{type:`string`,description:`Field to order DNS views by.`,choices:[`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order DNS views in.`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.name!==void 0&&(t.name=e.name),e.nameExact!==void 0&&(t.nameExact=e.nameExact),e.nameContains!==void 0&&(t.nameContains=e.nameContains),e.nameStartswith!==void 0&&(t.nameStartswith=e.nameStartswith),e.nameEndswith!==void 0&&(t.nameEndswith=e.nameEndswith),e.zoneId!==void 0&&(t.zone_id=e.zoneId),e.zoneName!==void 0&&(t.zone_name=e.zoneName),e.match!==void 0&&(t.match=e.match),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?f:await n(r);e.accountId=a,u(await p(`Loading views`,async()=>r.dns.settings.account.views.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded views`})}},K={command:`views`,describe:`Views operations`,builder:e=>e.command(V).command(H).command(U).command(W).command(G).demandCommand(1),handler:()=>{}},q={command:`account`,describe:`Operations for settings.account`,builder:e=>e.command(z).command(B).command(K).demandCommand(1),handler:()=>{}},J={command:`edit`,describe:`Update DNS settings for a zone`,builder:e=>e.option(`flatten-all-cnames`,{type:`boolean`,description:`Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened.`}).option(`foundation-dns`,{type:`boolean`,description:`Whether to enable Foundation DNS Advanced Nameservers on the zone.`}).option(`internal-dns-reference-zone-id`,{type:`string`,description:`The ID of the zone to fallback to.`}).option(`multi-provider`,{type:`boolean`,description:`Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers.`}).option(`ns-ttl`,{type:`number`,description:`The time to live (TTL) of the zone's nameserver (NS) records.`}).option(`secondary-overrides`,{type:`boolean`,description:`Allows a Secondary DNS zone to use (proxied) override records and CNAME flattening at the zone apex.`}).option(`soa-expire`,{type:`number`,description:`Time in seconds of being unable to query the primary server after which secondary servers should stop serving the zone.`}).option(`soa-min-ttl`,{type:`number`,description:`The time to live (TTL) for negative caching of records within the zone.`}).option(`soa-mname`,{type:`string`,description:`The primary nameserver, which may be used for outbound zone transfers. If null, a Cloudflare-assigned value will be used.`}).option(`soa-refresh`,{type:`number`,description:`Time in seconds after which secondary servers should re-check the SOA record to see if the zone has been updated.`}).option(`soa-retry`,{type:`number`,description:`Time in seconds after which secondary servers should retry queries after the primary server was unresponsive.`}).option(`soa-rname`,{type:`string`,description:`The email address of the zone administrator, with the first label representing the local part of the email address.`}).option(`soa-ttl`,{type:`number`,description:`The time to live (TTL) of the SOA record itself.`}).option(`zone-mode`,{type:`string`,description:`Whether the zone mode is a regular or CDN/DNS only zone.`,choices:[`standard`,`cdn_only`,`dns_only`]}).option(`nameservers-ns-set`,{type:`number`,description:`Configured nameserver set to be used for this zone`}).option(`nameservers-type`,{type:`string`,description:`Nameserver type`,choices:[`cloudflare.standard`,`custom.account`,`custom.tenant`,`custom.zone`]}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns settings zone edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/dns_settings`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{flattenAllCnames:e.flattenAllCnames,foundationDns:e.foundationDns,internalDnsReferenceZoneId:e.internalDnsReferenceZoneId,multiProvider:e.multiProvider,nsTtl:e.nsTtl,secondaryOverrides:e.secondaryOverrides,soaExpire:e.soaExpire,soaMinTtl:e.soaMinTtl,soaMname:e.soaMname,soaRefresh:e.soaRefresh,soaRetry:e.soaRetry,soaRname:e.soaRname,soaTtl:e.soaTtl,zoneMode:e.zoneMode,nameserversNsSet:e.nameserversNsSet,nameserversType:e.nameserversType,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating zone`,async()=>t.patch(`/zones/${e.zoneId}/dns_settings`,{body:n})),{successLabel:`Updated zone`});return}let n={};e.flattenAllCnames!==void 0&&c(n,[`flatten_all_cnames`],e.flattenAllCnames),e.foundationDns!==void 0&&c(n,[`foundation_dns`],e.foundationDns),e.internalDnsReferenceZoneId!==void 0&&c(n,[`internal_dns`,`reference_zone_id`],o(e.internalDnsReferenceZoneId,`internalDnsReferenceZoneId`,`text`)),e.multiProvider!==void 0&&c(n,[`multi_provider`],e.multiProvider),e.nsTtl!==void 0&&c(n,[`ns_ttl`],e.nsTtl),e.secondaryOverrides!==void 0&&c(n,[`secondary_overrides`],e.secondaryOverrides),e.soaExpire!==void 0&&c(n,[`soa`,`expire`],e.soaExpire),e.soaMinTtl!==void 0&&c(n,[`soa`,`min_ttl`],e.soaMinTtl),e.soaMname!==void 0&&c(n,[`soa`,`mname`],o(e.soaMname,`soaMname`,`text`)),e.soaRefresh!==void 0&&c(n,[`soa`,`refresh`],e.soaRefresh),e.soaRetry!==void 0&&c(n,[`soa`,`retry`],e.soaRetry),e.soaRname!==void 0&&c(n,[`soa`,`rname`],o(e.soaRname,`soaRname`,`text`)),e.soaTtl!==void 0&&c(n,[`soa`,`ttl`],e.soaTtl),e.zoneMode!==void 0&&c(n,[`zone_mode`],o(e.zoneMode,`zoneMode`,`text`)),e.nameserversNsSet!==void 0&&c(n,[`nameservers`,`ns_set`],e.nameserversNsSet),e.nameserversType!==void 0&&c(n,[`nameservers`,`type`],o(e.nameserversType,`nameserversType`,`text`)),u(await p(`Updating zone`,async()=>t.patch(`/zones/${e.zoneId}/dns_settings`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated zone`})}},Y={command:`get`,describe:`Show DNS settings for a zone`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading zone`,async()=>t.dns.settings.zone.get(n)),{successLabel:`Loaded zone`})}},X={command:`zone`,describe:`DNS settings management for zones`,builder:e=>e.command(J).command(Y).demandCommand(1),handler:()=>{}},Z={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(q).command(X).demandCommand(1),handler:()=>{}},Q={command:`get`,describe:`Get the current DNS record usage and quota for an account. May include internal DNS usage and quota.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading account`,async()=>t.dns.usage.account.get(r)),{successLabel:`Loaded account`})}},ne={command:`account`,describe:`Usage operations`,builder:e=>e.command(Q).demandCommand(1),handler:()=>{}},re={command:`get`,describe:`Get the current DNS record usage for a zone, including the number of records and the quota limit.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading zone`,async()=>t.dns.usage.zone.get(n)),{successLabel:`Loaded zone`})}},ie={command:`zone`,describe:`Usage operations`,builder:e=>e.command(re).demandCommand(1),handler:()=>{}},ae={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(ne).command(ie).demandCommand(1),handler:()=>{}},oe={command:`create`,describe:`Create ACL.`,builder:e=>e.option(`ip-range`,{type:`string`,description:`Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will be applied for the entire account. The IP range is used to allow additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for IPv6 respectively.`}).option(`name`,{type:`string`,description:`The name of the acl.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers acls create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/acls`,pathParams:{},bodyKind:`json`,body:{ipRange:r.ipRange,name:r.name,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating acl`,async()=>a.post(`/accounts/${m}/secondary_dns/acls`,{body:e})),{successLabel:`Created acl`});return}r.ipRange===void 0&&(r.ipRange=await t(`ip-range`,`Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will be applied for the entire account. The IP range is used to allow additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for IPv6 respectively.`)),r.name===void 0&&(r.name=await t(`name`,`The name of the acl.`));let h={};r.ipRange!==void 0&&c(h,[`ip_range`],o(r.ipRange,`ipRange`,`text`)),r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),u(await p(`Creating acl`,async()=>a.post(`/accounts/${m}/secondary_dns/acls`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created acl`})}},se={command:`delete <aclId>`,describe:`Delete ACL.`,builder:e=>e.positional(`aclId`,{type:`string`,description:`Acl 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)`}),handler:async t=>{if(s(t.aclId,`aclId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns zone-transfers acls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secondary_dns/acls/${t.aclId??`<aclId>`}`,pathParams:{aclId:String(t.aclId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`acl`,String(t.aclId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting acl`,async()=>a.delete(`/accounts/${o}/secondary_dns/acls/${t.aclId}`,{body:e})),{successLabel:`Deleted acl`});return}u(await p(`Deleting acl`,async()=>a.dns.zoneTransfers.acls.delete(t.aclId,o)),{successLabel:`Deleted acl`})}},ce={command:`get <aclId>`,describe:`Get ACL.`,builder:e=>e.positional(`aclId`,{type:`string`,description:`Acl ID`,demandOption:!0}),handler:async e=>{s(e.aclId,`aclId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading acl`,async()=>t.dns.zoneTransfers.acls.get(e.aclId,r)),{successLabel:`Loaded acl`})}},le={command:`list`,describe:`List ACLs.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading acls`,async()=>t.dns.zoneTransfers.acls.list(r)),{successLabel:`Loaded acls`})}},ue={command:`update <aclId>`,describe:`Modify ACL.`,builder:e=>e.positional(`aclId`,{type:`string`,description:`Acl ID`,demandOption:!0}).option(`ip-range`,{type:`string`,description:`Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will be applied for the entire account. The IP range is used to allow additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for IPv6 respectively.`}).option(`name`,{type:`string`,description:`The name of the acl.`}).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)`}),handler:async r=>{if(s(r.aclId,`aclId`),r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers acls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/acls/${r.aclId??`<aclId>`}`,pathParams:{aclId:String(r.aclId??``)},bodyKind:`json`,body:{ipRange:r.ipRange,name:r.name,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Updating acl`,async()=>a.put(`/accounts/${m}/secondary_dns/acls/${r.aclId}`,{body:e})),{successLabel:`Updated acl`});return}r.ipRange===void 0&&(r.ipRange=await t(`ip-range`,`Allowed IPv4/IPv6 address range of primary or secondary nameservers. This will be applied for the entire account. The IP range is used to allow additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 and /64 for IPv6 respectively.`)),r.name===void 0&&(r.name=await t(`name`,`The name of the acl.`));let h={};r.ipRange!==void 0&&c(h,[`ip_range`],o(r.ipRange,`ipRange`,`text`)),r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),u(await p(`Updating acl`,async()=>a.put(`/accounts/${m}/secondary_dns/acls/${r.aclId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated acl`})}},de={command:`acls`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(oe).command(se).command(ce).command(le).command(ue).demandCommand(1),handler:()=>{}},fe={command:`create`,describe:`Sends AXFR zone transfer request to primary nameserver(s).`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers force-axfr create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/force_axfr`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating force axfr`,async()=>t.post(`/zones/${e.zoneId}/secondary_dns/force_axfr`,{body:n})),{successLabel:`Created force axfr`});return}u(await p(`Creating force axfr`,async()=>t.dns.zoneTransfers.forceAxfr.create(n)),{successLabel:`Created force axfr`})}},pe={command:`force-axfr`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(fe).demandCommand(1),handler:()=>{}},me={command:`create`,describe:`Create secondary zone configuration for incoming zone transfers.`,builder:e=>e.option(`auto-refresh-seconds`,{type:`number`,description:`How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not applicable for primary zones.`,default:86400}).option(`name`,{type:`string`,description:`Zone name.`}).option(`peers`,{type:`string`,array:!0,description:`A list of peer tags.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers incoming create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/incoming`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{autoRefreshSeconds:e.autoRefreshSeconds,name:e.name,peers:e.peers,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating incoming`,async()=>n.post(`/zones/${e.zoneId}/secondary_dns/incoming`,{body:t})),{successLabel:`Created incoming`});return}if(e.autoRefreshSeconds===void 0)throw Error(`--auto-refresh-seconds is required (or pass --body with this field set).`);if(e.name===void 0&&(e.name=await t(`name`,`Zone name.`)),e.peers===void 0)throw Error(`--peers is required (or pass --body with this field set).`);let r={};e.autoRefreshSeconds!==void 0&&c(r,[`auto_refresh_seconds`],e.autoRefreshSeconds),e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),e.peers!==void 0&&c(r,[`peers`],e.peers),u(await p(`Creating incoming`,async()=>n.post(`/zones/${e.zoneId}/secondary_dns/incoming`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created incoming`})}},he={command:`delete`,describe:`Delete secondary zone configuration for incoming zone transfers.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers incoming delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/incoming`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`incoming`,String(n??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}if(e.body){let n=l(e.body);u(await p(`Deleting incoming`,async()=>t.delete(`/zones/${e.zoneId}/secondary_dns/incoming`,{body:n})),{successLabel:`Deleted incoming`});return}u(await p(`Deleting incoming`,async()=>t.dns.zoneTransfers.incoming.delete(n)),{successLabel:`Deleted incoming`})}},ge={command:`get`,describe:`Get secondary zone configuration for incoming zone transfers.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading incoming`,async()=>t.dns.zoneTransfers.incoming.get(n)),{successLabel:`Loaded incoming`})}},_e={command:`update`,describe:`Update secondary zone configuration for incoming zone transfers.`,builder:e=>e.option(`auto-refresh-seconds`,{type:`number`,description:`How often should a secondary zone auto refresh regardless of DNS NOTIFY. Not applicable for primary zones.`,default:86400}).option(`name`,{type:`string`,description:`Zone name.`}).option(`peers`,{type:`string`,array:!0,description:`A list of peer tags.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers incoming update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/incoming`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{autoRefreshSeconds:e.autoRefreshSeconds,name:e.name,peers:e.peers,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Updating incoming`,async()=>n.put(`/zones/${e.zoneId}/secondary_dns/incoming`,{body:t})),{successLabel:`Updated incoming`});return}if(e.autoRefreshSeconds===void 0)throw Error(`--auto-refresh-seconds is required (or pass --body with this field set).`);if(e.name===void 0&&(e.name=await t(`name`,`Zone name.`)),e.peers===void 0)throw Error(`--peers is required (or pass --body with this field set).`);let r={};e.autoRefreshSeconds!==void 0&&c(r,[`auto_refresh_seconds`],e.autoRefreshSeconds),e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),e.peers!==void 0&&c(r,[`peers`],e.peers),u(await p(`Updating incoming`,async()=>n.put(`/zones/${e.zoneId}/secondary_dns/incoming`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated incoming`})}},ve={command:`incoming`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(me).command(he).command(ge).command(_e).demandCommand(1),handler:()=>{}},ye={command:`create`,describe:`Create primary zone configuration for outgoing zone transfers.`,builder:e=>e.option(`name`,{type:`string`,description:`Zone name.`}).option(`peers`,{type:`string`,array:!0,description:`A list of peer tags.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,peers:e.peers,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating outgoing`,async()=>n.post(`/zones/${e.zoneId}/secondary_dns/outgoing`,{body:t})),{successLabel:`Created outgoing`});return}if(e.name===void 0&&(e.name=await t(`name`,`Zone name.`)),e.peers===void 0)throw Error(`--peers is required (or pass --body with this field set).`);let r={};e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),e.peers!==void 0&&c(r,[`peers`],e.peers),u(await p(`Creating outgoing`,async()=>n.post(`/zones/${e.zoneId}/secondary_dns/outgoing`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created outgoing`})}},be={command:`delete`,describe:`Delete primary zone configuration for outgoing zone transfers.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`outgoing`,String(n??``),{force:!!e.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}if(e.body){let n=l(e.body);u(await p(`Deleting outgoing`,async()=>t.delete(`/zones/${e.zoneId}/secondary_dns/outgoing`,{body:n})),{successLabel:`Deleted outgoing`});return}u(await p(`Deleting outgoing`,async()=>t.dns.zoneTransfers.outgoing.delete(n)),{successLabel:`Deleted outgoing`})}},xe={command:`disable`,describe:`Disable outgoing zone transfers for primary zone and clears IXFR backlog of primary zone.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing/disable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`outgoing`,String(n??``),{force:!!e.force,message:`This operation turns off outgoing zone transfers for the primary zone, which means secondary zones will stop receiving updates.`})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}if(e.body){let n=l(e.body);u(await p(`Deleting outgoing`,async()=>t.post(`/zones/${e.zoneId}/secondary_dns/outgoing/disable`,{body:n})),{successLabel:`Deleted outgoing`});return}u(await p(`Deleting outgoing`,async()=>t.dns.zoneTransfers.outgoing.disable(n)),{successLabel:`Deleted outgoing`})}},Se={command:`enable`,describe:`Enable outgoing zone transfers for primary zone.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing/enable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating outgoing`,async()=>t.post(`/zones/${e.zoneId}/secondary_dns/outgoing/enable`,{body:n})),{successLabel:`Created outgoing`});return}u(await p(`Creating outgoing`,async()=>t.dns.zoneTransfers.outgoing.enable(n)),{successLabel:`Created outgoing`})}},Ce={command:`force-notify`,describe:`Notifies the secondary nameserver(s) and clears IXFR backlog of primary zone.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing force-notify`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing/force_notify`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating outgoing`,async()=>t.post(`/zones/${e.zoneId}/secondary_dns/outgoing/force_notify`,{body:n})),{successLabel:`Created outgoing`});return}u(await p(`Creating outgoing`,async()=>t.dns.zoneTransfers.outgoing.forceNotify(n)),{successLabel:`Created outgoing`})}},we={command:`get`,describe:`Get primary zone configuration for outgoing zone transfers.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading outgoing`,async()=>t.dns.zoneTransfers.outgoing.get(n)),{successLabel:`Loaded outgoing`})}},Te={command:`get`,describe:`Get primary zone transfer status.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading status`,async()=>t.dns.zoneTransfers.outgoing.status.get(n)),{successLabel:`Loaded status`})}},Ee={command:`status`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(Te).demandCommand(1),handler:()=>{}},De={command:`update`,describe:`Update primary zone configuration for outgoing zone transfers.`,builder:e=>e.option(`name`,{type:`string`,description:`Zone name.`}).option(`peers`,{type:`string`,array:!0,description:`A list of peer tags.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf dns zone-transfers outgoing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/secondary_dns/outgoing`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,peers:e.peers,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Updating outgoing`,async()=>n.put(`/zones/${e.zoneId}/secondary_dns/outgoing`,{body:t})),{successLabel:`Updated outgoing`});return}if(e.name===void 0&&(e.name=await t(`name`,`Zone name.`)),e.peers===void 0)throw Error(`--peers is required (or pass --body with this field set).`);let r={};e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),e.peers!==void 0&&c(r,[`peers`],e.peers),u(await p(`Updating outgoing`,async()=>n.put(`/zones/${e.zoneId}/secondary_dns/outgoing`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated outgoing`})}},Oe={command:`outgoing`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(ye).command(be).command(xe).command(Se).command(Ce).command(we).command(De).command(Ee).demandCommand(1),handler:()=>{}},ke={command:`create`,describe:`Create Peer.`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the peer.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers peers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/peers`,pathParams:{},bodyKind:`json`,body:{name:r.name,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating peer`,async()=>a.post(`/accounts/${m}/secondary_dns/peers`,{body:e})),{successLabel:`Created peer`});return}r.name===void 0&&(r.name=await t(`name`,`The name of the peer.`));let h={};r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),u(await p(`Creating peer`,async()=>a.post(`/accounts/${m}/secondary_dns/peers`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created peer`})}},Ae={command:`delete <peerId>`,describe:`Delete Peer.`,builder:e=>e.positional(`peerId`,{type:`string`,description:`Peer 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)`}),handler:async t=>{if(s(t.peerId,`peerId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns zone-transfers peers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secondary_dns/peers/${t.peerId??`<peerId>`}`,pathParams:{peerId:String(t.peerId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`peer`,String(t.peerId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting peer`,async()=>a.delete(`/accounts/${o}/secondary_dns/peers/${t.peerId}`,{body:e})),{successLabel:`Deleted peer`});return}u(await p(`Deleting peer`,async()=>a.dns.zoneTransfers.peers.delete(t.peerId,o)),{successLabel:`Deleted peer`})}},je={command:`get <peerId>`,describe:`Get Peer.`,builder:e=>e.positional(`peerId`,{type:`string`,description:`Peer ID`,demandOption:!0}),handler:async e=>{s(e.peerId,`peerId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading peer`,async()=>t.dns.zoneTransfers.peers.get(e.peerId,r)),{successLabel:`Loaded peer`})}},Me={command:`list`,describe:`List Peers.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading peers`,async()=>t.dns.zoneTransfers.peers.list(r)),{successLabel:`Loaded peers`})}},Ne={command:`update <peerId>`,describe:`Modify Peer.`,builder:e=>e.positional(`peerId`,{type:`string`,description:`Peer ID`,demandOption:!0}).option(`ip`,{type:`string`,description:`IPv4/IPv6 address of primary or secondary nameserver, depending on what zone this peer is linked to. For primary zones this IP defines the IP of the secondary nameserver Cloudflare will NOTIFY upon zone changes. For secondary zones this IP defines the IP of the primary nameserver Cloudflare will send AXFR/IXFR requests to.`}).option(`ixfr-enable`,{type:`boolean`,description:`Enable IXFR transfer protocol, default is AXFR. Only applicable to secondary zones.`}).option(`name`,{type:`string`,description:`The name of the peer.`}).option(`port`,{type:`number`,description:`DNS port of primary or secondary nameserver, depending on what zone this peer is linked to.`}).option(`tsig-id`,{type:`string`,description:`TSIG authentication will be used for zone transfer if configured.`}).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)`}),handler:async r=>{if(s(r.peerId,`peerId`),r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers peers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/peers/${r.peerId??`<peerId>`}`,pathParams:{peerId:String(r.peerId??``)},bodyKind:`json`,body:{ip:r.ip,ixfrEnable:r.ixfrEnable,name:r.name,port:r.port,tsigId:r.tsigId,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Updating peer`,async()=>a.put(`/accounts/${m}/secondary_dns/peers/${r.peerId}`,{body:e})),{successLabel:`Updated peer`});return}r.name===void 0&&(r.name=await t(`name`,`The name of the peer.`));let h={};r.ip!==void 0&&c(h,[`ip`],o(r.ip,`ip`,`text`)),r.ixfrEnable!==void 0&&c(h,[`ixfr_enable`],r.ixfrEnable),r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),r.port!==void 0&&c(h,[`port`],r.port),r.tsigId!==void 0&&c(h,[`tsig_id`],o(r.tsigId,`tsigId`,`text`)),u(await p(`Updating peer`,async()=>a.put(`/accounts/${m}/secondary_dns/peers/${r.peerId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated peer`})}},Pe={command:`peers`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command(ke).command(Ae).command(je).command(Me).command(Ne).demandCommand(1),handler:()=>{}},$={command:`create`,describe:`Create TSIG.`,builder:e=>e.option(`algo`,{type:`string`,description:`TSIG algorithm.`}).option(`name`,{type:`string`,description:`TSIG key name.`}).option(`secret`,{type:`string`,description:`TSIG secret.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers tsigs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/tsigs`,pathParams:{},bodyKind:`json`,body:{algo:r.algo,name:r.name,secret:r.secret,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating tsig`,async()=>a.post(`/accounts/${m}/secondary_dns/tsigs`,{body:e})),{successLabel:`Created tsig`});return}r.algo===void 0&&(r.algo=await t(`algo`,`TSIG algorithm.`)),r.name===void 0&&(r.name=await t(`name`,`TSIG key name.`)),r.secret===void 0&&(r.secret=await t(`secret`,`TSIG secret.`,{kind:`secret`}));let h={};r.algo!==void 0&&c(h,[`algo`],o(r.algo,`algo`,`text`)),r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),r.secret!==void 0&&c(h,[`secret`],o(r.secret,`secret`,`text`)),u(await p(`Creating tsig`,async()=>a.post(`/accounts/${m}/secondary_dns/tsigs`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created tsig`})}},Fe={command:`delete <tsigId>`,describe:`Delete TSIG.`,builder:e=>e.positional(`tsigId`,{type:`string`,description:`Tsig 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)`}),handler:async t=>{if(s(t.tsigId,`tsigId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf dns zone-transfers tsigs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/secondary_dns/tsigs/${t.tsigId??`<tsigId>`}`,pathParams:{tsigId:String(t.tsigId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`tsig`,String(t.tsigId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting tsig`,async()=>a.delete(`/accounts/${o}/secondary_dns/tsigs/${t.tsigId}`,{body:e})),{successLabel:`Deleted tsig`});return}u(await p(`Deleting tsig`,async()=>a.dns.zoneTransfers.tsigs.delete(t.tsigId,o)),{successLabel:`Deleted tsig`})}},Ie={command:`get <tsigId>`,describe:`Get TSIG.`,builder:e=>e.positional(`tsigId`,{type:`string`,description:`Tsig ID`,demandOption:!0}),handler:async e=>{s(e.tsigId,`tsigId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading tsig`,async()=>t.dns.zoneTransfers.tsigs.get(e.tsigId,r)),{successLabel:`Loaded tsig`})}},Le={command:`list`,describe:`List TSIGs.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading tsigs`,async()=>t.dns.zoneTransfers.tsigs.list(r)),{successLabel:`Loaded tsigs`})}},Re={command:`update <tsigId>`,describe:`Modify TSIG.`,builder:e=>e.positional(`tsigId`,{type:`string`,description:`Tsig ID`,demandOption:!0}).option(`algo`,{type:`string`,description:`TSIG algorithm.`}).option(`name`,{type:`string`,description:`TSIG key name.`}).option(`secret`,{type:`string`,description:`TSIG secret.`}).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)`}),handler:async r=>{if(s(r.tsigId,`tsigId`),r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf dns zone-transfers tsigs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/secondary_dns/tsigs/${r.tsigId??`<tsigId>`}`,pathParams:{tsigId:String(r.tsigId??``)},bodyKind:`json`,body:{algo:r.algo,name:r.name,secret:r.secret,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Updating tsig`,async()=>a.put(`/accounts/${m}/secondary_dns/tsigs/${r.tsigId}`,{body:e})),{successLabel:`Updated tsig`});return}r.algo===void 0&&(r.algo=await t(`algo`,`TSIG algorithm.`)),r.name===void 0&&(r.name=await t(`name`,`TSIG key name.`)),r.secret===void 0&&(r.secret=await t(`secret`,`TSIG secret.`,{kind:`secret`}));let h={};r.algo!==void 0&&c(h,[`algo`],o(r.algo,`algo`,`text`)),r.name!==void 0&&c(h,[`name`],o(r.name,`name`,`text`)),r.secret!==void 0&&c(h,[`secret`],o(r.secret,`secret`,`text`)),u(await p(`Updating tsig`,async()=>a.put(`/accounts/${m}/secondary_dns/tsigs/${r.tsigId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated tsig`})}},ze={command:`tsigs`,describe:`Secondary DNS and zone transfer management`,builder:e=>e.command($).command(Fe).command(Ie).command(Le).command(Re).demandCommand(1),handler:()=>{}},Be={command:`zone-transfers`,describe:`Operations for zone-transfers`,builder:e=>e.command(de).command(pe).command(ve).command(Oe).command(Pe).command(ze).demandCommand(1),handler:()=>{}},Ve={command:`dns`,describe:`DNS management API for zones, records, DNSSEC, analytics, and zone transfers`,builder:e=>e.command(v).command(w).command(R).command(Z).command(ae).command(Be).demandCommand(1),handler:()=>{}};export{Ve as default};
|